happo 6.9.0 → 6.10.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/dist/cli/cancelJob-4I7RBUQG.js +10 -0
- package/dist/cli/{chunk-P4EXA4AX.js → chunk-64XRFVHC.js} +8 -4
- package/dist/cli/chunk-64XRFVHC.js.map +7 -0
- package/dist/cli/{chunk-J2EA5OBW.js → chunk-GG7D7TQZ.js} +2 -2
- package/dist/cli/chunk-ML3Z5Z22.js +44 -0
- package/dist/cli/chunk-ML3Z5Z22.js.map +7 -0
- package/dist/cli/{chunk-BK32666K.js → chunk-OCKO64S4.js} +3 -3
- package/dist/cli/{chunk-R6YURZXU.js → chunk-RJXHIGT5.js} +2 -2
- package/dist/cli/{chunk-BESQLM5F.js → chunk-UTRRH3WF.js} +2 -2
- package/dist/cli/{chunk-CVX5DVCT.js → chunk-XZTQZZFK.js} +2 -2
- package/dist/cli/createAsyncComparison-WLPUS2NJ.js +10 -0
- package/dist/cli/{createAsyncReport-4ZD53TJC.js → createAsyncReport-2ZTQOHDA.js} +4 -4
- package/dist/cli/createExtendsReportSnapRequest-4ZSBNCPL.js +32 -0
- package/dist/cli/createExtendsReportSnapRequest-4ZSBNCPL.js.map +7 -0
- package/dist/cli/findBaselineReport-2SHS2OH7.js +36 -0
- package/dist/cli/findBaselineReport-2SHS2OH7.js.map +7 -0
- package/dist/cli/{getFlakes-6ZGTWZTM.js → getFlakes-DLKH2VLM.js} +4 -4
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/main.js +160 -19
- package/dist/cli/main.js.map +3 -3
- package/dist/cli/package-TU7REKQ6.js +7 -0
- package/dist/cli/parseOptions.d.ts +6 -0
- package/dist/cli/parseOptions.d.ts.map +1 -1
- package/dist/cli/{prepareSnapRequests-2LHSGFZV.js → prepareSnapRequests-WBXFGB4B.js} +170 -65
- package/dist/cli/prepareSnapRequests-WBXFGB4B.js.map +7 -0
- package/dist/cli/startJob-33HGTT4N.js +10 -0
- package/dist/cli/{wrapper-7RE2N7Y3.js → wrapper-CCHBHKT2.js} +45 -26
- package/dist/cli/wrapper-CCHBHKT2.js.map +7 -0
- package/dist/config/index.d.ts +0 -8
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js.map +2 -2
- package/dist/custom/index.d.ts.map +1 -1
- package/dist/custom/index.js +70 -14
- package/dist/custom/index.js.map +3 -3
- package/dist/cypress/chunk-TYBGAHYH.js +69 -0
- package/dist/cypress/chunk-TYBGAHYH.js.map +7 -0
- package/dist/cypress/index.d.ts.map +1 -1
- package/dist/cypress/index.js +14 -4
- package/dist/cypress/index.js.map +2 -2
- package/dist/cypress/task.d.ts +4 -2
- package/dist/cypress/task.d.ts.map +1 -1
- package/dist/cypress/task.js +25 -6
- package/dist/cypress/task.js.map +4 -4
- package/dist/e2e/wrapper.d.ts +1 -1
- package/dist/e2e/wrapper.d.ts.map +1 -1
- package/dist/environment/index.d.ts +2 -1
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/isomorphic/parseOnly.d.ts +15 -0
- package/dist/isomorphic/parseOnly.d.ts.map +1 -0
- package/dist/isomorphic/parseSkip.d.ts +28 -0
- package/dist/isomorphic/parseSkip.d.ts.map +1 -0
- package/dist/isomorphic/types.d.ts +11 -0
- package/dist/isomorphic/types.d.ts.map +1 -1
- package/dist/network/createExtendsReportSnapRequest.d.ts +4 -0
- package/dist/network/createExtendsReportSnapRequest.d.ts.map +1 -0
- package/dist/network/findBaselineReport.d.ts +5 -0
- package/dist/network/findBaselineReport.d.ts.map +1 -0
- package/dist/network/prepareSnapRequests.d.ts +9 -1
- package/dist/network/prepareSnapRequests.d.ts.map +1 -1
- package/dist/playwright/index.d.ts.map +1 -1
- package/dist/playwright/index.js +59 -3
- package/dist/playwright/index.js.map +3 -3
- package/dist/storybook/browser/register.d.ts +2 -1
- package/dist/storybook/browser/register.d.ts.map +1 -1
- package/dist/storybook/browser/register.js +5 -1
- package/dist/storybook/browser/register.js.map +2 -2
- package/dist/storybook/index.d.ts +9 -1
- package/dist/storybook/index.d.ts.map +1 -1
- package/dist/storybook/index.js +134 -42
- package/dist/storybook/index.js.map +4 -4
- package/dist/storybook/isomorphic/types.d.ts +4 -0
- package/dist/storybook/isomorphic/types.d.ts.map +1 -1
- package/dist/storybook/resolveStoryFileItems.d.ts +21 -0
- package/dist/storybook/resolveStoryFileItems.d.ts.map +1 -0
- package/package.json +7 -3
- package/dist/cli/cancelJob-Y4WJCCU6.js +0 -10
- package/dist/cli/chunk-P4EXA4AX.js.map +0 -7
- package/dist/cli/createAsyncComparison-CQLGQXY2.js +0 -10
- package/dist/cli/package-4NRNRUE3.js +0 -7
- package/dist/cli/prepareSnapRequests-2LHSGFZV.js.map +0 -7
- package/dist/cli/startJob-JAO5FUA2.js +0 -10
- package/dist/cli/wrapper-7RE2N7Y3.js.map +0 -7
- package/dist/cypress/chunk-RKK2MPML.js +0 -20
- package/dist/cypress/chunk-RKK2MPML.js.map +0 -7
- /package/dist/cli/{cancelJob-Y4WJCCU6.js.map → cancelJob-4I7RBUQG.js.map} +0 -0
- /package/dist/cli/{chunk-J2EA5OBW.js.map → chunk-GG7D7TQZ.js.map} +0 -0
- /package/dist/cli/{chunk-BK32666K.js.map → chunk-OCKO64S4.js.map} +0 -0
- /package/dist/cli/{chunk-R6YURZXU.js.map → chunk-RJXHIGT5.js.map} +0 -0
- /package/dist/cli/{chunk-BESQLM5F.js.map → chunk-UTRRH3WF.js.map} +0 -0
- /package/dist/cli/{chunk-CVX5DVCT.js.map → chunk-XZTQZZFK.js.map} +0 -0
- /package/dist/cli/{createAsyncComparison-CQLGQXY2.js.map → createAsyncComparison-WLPUS2NJ.js.map} +0 -0
- /package/dist/cli/{createAsyncReport-4ZD53TJC.js.map → createAsyncReport-2ZTQOHDA.js.map} +0 -0
- /package/dist/cli/{getFlakes-6ZGTWZTM.js.map → getFlakes-DLKH2VLM.js.map} +0 -0
- /package/dist/cli/{package-4NRNRUE3.js.map → package-TU7REKQ6.js.map} +0 -0
- /package/dist/cli/{startJob-JAO5FUA2.js.map → startJob-33HGTT4N.js.map} +0 -0
|
@@ -1,26 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
postGitHubComment
|
|
3
|
+
} from "./chunk-X4TE2VNY.js";
|
|
4
|
+
import {
|
|
5
|
+
cancelJob
|
|
6
|
+
} from "./chunk-OCKO64S4.js";
|
|
1
7
|
import {
|
|
2
8
|
startServer
|
|
3
9
|
} from "./chunk-JTRP4JVC.js";
|
|
4
10
|
import {
|
|
5
11
|
startJob
|
|
6
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XZTQZZFK.js";
|
|
7
13
|
import {
|
|
8
14
|
createAsyncComparison
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
postGitHubComment
|
|
12
|
-
} from "./chunk-X4TE2VNY.js";
|
|
13
|
-
import {
|
|
14
|
-
cancelJob
|
|
15
|
-
} from "./chunk-BK32666K.js";
|
|
15
|
+
} from "./chunk-GG7D7TQZ.js";
|
|
16
16
|
import {
|
|
17
17
|
makeHappoAPIRequest
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-RJXHIGT5.js";
|
|
19
|
+
import "./chunk-UTRRH3WF.js";
|
|
20
|
+
import "./chunk-64XRFVHC.js";
|
|
21
21
|
|
|
22
22
|
// src/e2e/wrapper.ts
|
|
23
23
|
import { spawn } from "node:child_process";
|
|
24
|
+
import fs from "node:fs";
|
|
25
|
+
import os from "node:os";
|
|
26
|
+
import path from "node:path";
|
|
24
27
|
var allRequestIds;
|
|
25
28
|
async function postAsyncReport(requestIds, environment, happoConfig) {
|
|
26
29
|
const { afterSha, nonce, link, message } = environment;
|
|
@@ -45,21 +48,21 @@ async function finalizeAll({
|
|
|
45
48
|
environment,
|
|
46
49
|
logger
|
|
47
50
|
}) {
|
|
48
|
-
const { afterSha, nonce,
|
|
51
|
+
const { afterSha, nonce, skip: skipJSON } = environment;
|
|
49
52
|
if (!nonce) {
|
|
50
53
|
throw new Error("[HAPPO] Missing --nonce argument");
|
|
51
54
|
}
|
|
52
55
|
const body = {
|
|
53
56
|
project: happoConfig.project,
|
|
54
57
|
nonce,
|
|
55
|
-
|
|
58
|
+
skip: []
|
|
56
59
|
};
|
|
57
|
-
if (
|
|
60
|
+
if (skipJSON) {
|
|
58
61
|
try {
|
|
59
|
-
const
|
|
60
|
-
body.
|
|
62
|
+
const skipItems = JSON.parse(skipJSON);
|
|
63
|
+
body.skip = skipItems;
|
|
61
64
|
} catch (e) {
|
|
62
|
-
logger.error("Error when parsing --
|
|
65
|
+
logger.error("Error when parsing --skip", skipJSON);
|
|
63
66
|
throw e;
|
|
64
67
|
}
|
|
65
68
|
}
|
|
@@ -152,7 +155,7 @@ function assertE2EIntegration(integration) {
|
|
|
152
155
|
throw new Error(`Unsupported integration type: ${integration.type}`);
|
|
153
156
|
}
|
|
154
157
|
}
|
|
155
|
-
async function runWithWrapper(dashdashCommandParts, happoConfig, environment, logger, configFilePath) {
|
|
158
|
+
async function runWithWrapper(dashdashCommandParts, happoConfig, environment, logger, configFilePath, skipJSON) {
|
|
156
159
|
allRequestIds = /* @__PURE__ */ new Set();
|
|
157
160
|
const e2eServer = await startE2EServer(environment, happoConfig);
|
|
158
161
|
logger.log(`[HAPPO] Listening on port ${e2eServer.port}`);
|
|
@@ -160,17 +163,29 @@ async function runWithWrapper(dashdashCommandParts, happoConfig, environment, lo
|
|
|
160
163
|
if (!job) {
|
|
161
164
|
throw new Error("Failed to create Happo job");
|
|
162
165
|
}
|
|
166
|
+
let skipFilePath;
|
|
167
|
+
if (skipJSON) {
|
|
168
|
+
skipFilePath = path.join(
|
|
169
|
+
os.tmpdir(),
|
|
170
|
+
`happo-skipped-${process.pid}.json`
|
|
171
|
+
);
|
|
172
|
+
await fs.promises.writeFile(skipFilePath, skipJSON, "utf8");
|
|
173
|
+
}
|
|
163
174
|
try {
|
|
164
175
|
const exitCode = await new Promise((resolve, reject) => {
|
|
176
|
+
const childEnv = {
|
|
177
|
+
...process.env,
|
|
178
|
+
HAPPO_E2E_PORT: e2eServer.port.toString(),
|
|
179
|
+
HAPPO_CONFIG_FILE: configFilePath,
|
|
180
|
+
HAPPO_API_KEY: happoConfig.apiKey,
|
|
181
|
+
HAPPO_API_SECRET: happoConfig.apiSecret
|
|
182
|
+
};
|
|
183
|
+
if (skipFilePath) {
|
|
184
|
+
childEnv.HAPPO_SKIP_FILE = skipFilePath;
|
|
185
|
+
}
|
|
165
186
|
const child = spawn(dashdashCommandParts[0], dashdashCommandParts.slice(1), {
|
|
166
187
|
stdio: "inherit",
|
|
167
|
-
env:
|
|
168
|
-
...process.env,
|
|
169
|
-
HAPPO_E2E_PORT: e2eServer.port.toString(),
|
|
170
|
-
HAPPO_CONFIG_FILE: configFilePath,
|
|
171
|
-
HAPPO_API_KEY: happoConfig.apiKey,
|
|
172
|
-
HAPPO_API_SECRET: happoConfig.apiSecret
|
|
173
|
-
},
|
|
188
|
+
env: childEnv,
|
|
174
189
|
shell: process.platform == "win32"
|
|
175
190
|
});
|
|
176
191
|
child.on("error", (e) => {
|
|
@@ -210,10 +225,14 @@ async function runWithWrapper(dashdashCommandParts, happoConfig, environment, lo
|
|
|
210
225
|
} finally {
|
|
211
226
|
allRequestIds.clear();
|
|
212
227
|
await e2eServer.close();
|
|
228
|
+
if (skipFilePath) {
|
|
229
|
+
await fs.promises.unlink(skipFilePath).catch(() => {
|
|
230
|
+
});
|
|
231
|
+
}
|
|
213
232
|
}
|
|
214
233
|
}
|
|
215
234
|
export {
|
|
216
235
|
runWithWrapper as default,
|
|
217
236
|
finalizeAll
|
|
218
237
|
};
|
|
219
|
-
//# sourceMappingURL=wrapper-
|
|
238
|
+
//# sourceMappingURL=wrapper-CCHBHKT2.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/e2e/wrapper.ts"],
|
|
4
|
+
"sourcesContent": ["import { spawn } from 'node:child_process';\nimport fs from 'node:fs';\nimport http from 'node:http';\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport type { ConfigWithDefaults, E2EIntegration } from '../config/index.ts';\nimport type { EnvironmentResult } from '../environment/index.ts';\nimport cancelJob from '../network/cancelJob.ts';\nimport createAsyncComparison from '../network/createAsyncComparison.ts';\nimport makeHappoAPIRequest from '../network/makeHappoAPIRequest.ts';\nimport postGitHubComment from '../network/postGitHubComment.ts';\nimport startJob, { type StartJobResult } from '../network/startJob.ts';\nimport startServer, { type ServerInfo } from '../network/startServer.ts';\n\nlet allRequestIds: Set<number>;\n\nasync function postAsyncReport(\n requestIds: Array<number>,\n environment: EnvironmentResult,\n happoConfig: ConfigWithDefaults,\n) {\n const { afterSha, nonce, link, message } = environment;\n return await makeHappoAPIRequest(\n {\n path: `/api/async-reports/${afterSha}`,\n method: 'POST',\n body: {\n requestIds,\n project: happoConfig.project,\n nonce,\n link,\n message,\n },\n },\n happoConfig,\n { retryCount: 2 },\n );\n}\n\ntype Example = {\n component: string;\n variant: string;\n target: string;\n};\n\ntype Logger = Pick<Console, 'log' | 'error'>;\n\ninterface FinalizeAllOptions {\n happoConfig: ConfigWithDefaults;\n environment: EnvironmentResult;\n logger: Logger;\n}\n\nexport async function finalizeAll({\n happoConfig,\n environment,\n logger,\n}: FinalizeAllOptions): Promise<void> {\n const { afterSha, nonce, skip: skipJSON } = environment;\n\n if (!nonce) {\n throw new Error('[HAPPO] Missing --nonce argument');\n }\n\n const body: {\n project?: string | undefined;\n nonce: string;\n skip: Array<Example>;\n } = {\n project: happoConfig.project,\n nonce,\n skip: [],\n };\n\n if (skipJSON) {\n try {\n const skipItems = JSON.parse(skipJSON);\n body.skip = skipItems;\n } catch (e) {\n logger.error('Error when parsing --skip', skipJSON);\n throw e;\n }\n }\n await makeHappoAPIRequest(\n {\n path: `/api/async-reports/${afterSha}/finalize`,\n method: 'POST',\n body,\n },\n happoConfig,\n { retryCount: 3 },\n );\n\n if (environment.beforeSha !== environment.afterSha) {\n const compareResult = await createAsyncComparison(\n happoConfig,\n environment,\n logger,\n );\n\n if (environment.link && environment.githubToken && happoConfig.githubApiUrl) {\n // githubToken and githubApiUrl are set which means that we should post\n // a comment to the PR.\n // https://docs.happo.io/docs/continuous-integration#posting-statuses-without-installing-the-happo-github-app\n await postGitHubComment({\n authToken: environment.githubToken,\n link: environment.link,\n statusImageUrl: compareResult.statusImageUrl,\n compareUrl: compareResult.compareUrl,\n githubApiUrl: happoConfig.githubApiUrl,\n });\n }\n }\n}\n\nasync function finalizeHappoReport(\n happoConfig: ConfigWithDefaults,\n environment: EnvironmentResult,\n job: StartJobResult,\n logger: Logger,\n) {\n if (!allRequestIds.size) {\n logger.log(`[HAPPO] No snapshots were recorded. Ignoring.`);\n return;\n }\n const reportResult = await postAsyncReport(\n [...allRequestIds],\n environment,\n happoConfig,\n );\n\n if (!reportResult) {\n throw new Error('Failed to create async Happo report');\n }\n\n const { nonce } = environment;\n\n if (!nonce) {\n // If there is a nonce, the comparison will happen when the finalize\n // command is called.\n const compareResult = await createAsyncComparison(\n happoConfig,\n environment,\n logger,\n );\n\n if (\n compareResult &&\n environment.link &&\n environment.githubToken &&\n happoConfig.githubApiUrl\n ) {\n // githubToken and githubApiUrl is set which means that we should post\n // a comment to the PR.\n // https://docs.happo.io/docs/continuous-integration#posting-statuses-without-installing-the-happo-github-app\n await postGitHubComment({\n authToken: environment.githubToken,\n link: environment.link,\n statusImageUrl: compareResult.statusImageUrl,\n compareUrl: compareResult.compareUrl,\n githubApiUrl: happoConfig.githubApiUrl,\n });\n }\n }\n logger.log(`[HAPPO] ${job.url}`);\n}\n\nfunction startE2EServer(\n environment: EnvironmentResult,\n happoConfig: ConfigWithDefaults,\n): Promise<ServerInfo> {\n function requestHandler(req: http.IncomingMessage, res: http.ServerResponse) {\n const bodyParts: Array<string> = [];\n req.on('data', (chunk: Buffer) => {\n bodyParts.push(chunk.toString());\n });\n req.on('end', async () => {\n const potentialIds = bodyParts\n .join('')\n .split('\\n')\n .filter(Boolean)\n .map((requestId) => Number.parseInt(requestId, 10));\n\n if (potentialIds.some((id) => Number.isNaN(id))) {\n res.writeHead(400);\n res.end('invalid payload');\n return;\n }\n\n for (const requestId of potentialIds) {\n allRequestIds.add(requestId);\n }\n\n const { nonce } = environment;\n if (nonce && potentialIds.length) {\n // Associate these snapRequests with the async report as soon as possible\n await postAsyncReport(potentialIds, environment, happoConfig);\n }\n res.writeHead(200);\n res.end('');\n });\n }\n return startServer(requestHandler);\n}\n\nfunction assertE2EIntegration(\n integration: NonNullable<ConfigWithDefaults['integration']>,\n): asserts integration is E2EIntegration {\n if (integration.type !== 'cypress' && integration.type !== 'playwright') {\n throw new Error(`Unsupported integration type: ${integration.type}`);\n }\n}\n\n/**\n * Runs a command with the wrapper and returns the exit code.\n *\n * @param dashdashCommandParts The command to run with the wrapper\n * @param happoConfig The Happo config\n * @param environment The environment\n * @param port The port to listen on\n * @param logger The logger\n * @returns The exit code of the command\n */\nexport default async function runWithWrapper(\n dashdashCommandParts: Array<string>,\n happoConfig: ConfigWithDefaults,\n environment: EnvironmentResult,\n logger: Logger,\n configFilePath: string,\n skipJSON?: string,\n): Promise<number> {\n allRequestIds = new Set<number>();\n const e2eServer = await startE2EServer(environment, happoConfig);\n logger.log(`[HAPPO] Listening on port ${e2eServer.port}`);\n\n const job = await startJob(happoConfig, environment, logger);\n if (!job) {\n throw new Error('Failed to create Happo job');\n }\n\n // Write skipped examples to a temp file to avoid env var size limits.\n let skipFilePath: string | undefined;\n if (skipJSON) {\n skipFilePath = path.join(\n os.tmpdir(),\n `happo-skipped-${process.pid}.json`,\n );\n await fs.promises.writeFile(skipFilePath, skipJSON, 'utf8');\n }\n\n try {\n const exitCode = await new Promise<number>((resolve, reject) => {\n const childEnv: Record<string, string | undefined> = {\n ...process.env,\n HAPPO_E2E_PORT: e2eServer.port.toString(),\n HAPPO_CONFIG_FILE: configFilePath,\n HAPPO_API_KEY: happoConfig.apiKey,\n HAPPO_API_SECRET: happoConfig.apiSecret,\n };\n\n if (skipFilePath) {\n childEnv.HAPPO_SKIP_FILE = skipFilePath;\n }\n\n const child = spawn(dashdashCommandParts[0]!, dashdashCommandParts.slice(1), {\n stdio: 'inherit',\n env: childEnv,\n shell: process.platform == 'win32',\n });\n\n child.on('error', (e) => {\n return reject(e);\n });\n\n const e2eIntegration = happoConfig.integration;\n assertE2EIntegration(e2eIntegration);\n child.on('close', async (code: number) => {\n if (code === 0 || e2eIntegration.allowFailures) {\n try {\n await finalizeHappoReport(happoConfig, environment, job, logger);\n } catch (e) {\n logger.error('Failed to finalize Happo report', e);\n return reject(e);\n }\n } else {\n logger.error(\n 'Command failed with exit code ${code}. Cancelling Happo job.',\n );\n try {\n await cancelJob(\n 'failure',\n `${e2eIntegration.type} run failed`,\n happoConfig,\n environment,\n logger,\n );\n } catch (e) {\n logger.error('Failed to cancel Happo job', e);\n return reject(e);\n }\n }\n resolve(code);\n });\n });\n return exitCode;\n } finally {\n allRequestIds.clear();\n await e2eServer.close();\n if (skipFilePath) {\n await fs.promises.unlink(skipFilePath).catch(() => {\n // Ignore errors \u2014 the file may already be gone.\n });\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAa;AACtB,OAAO,QAAQ;AAEf,OAAO,QAAQ;AACf,OAAO,UAAU;AAWjB,IAAI;AAEJ,eAAe,gBACb,YACA,aACA,aACA;AACA,QAAM,EAAE,UAAU,OAAO,MAAM,QAAQ,IAAI;AAC3C,SAAO,MAAM;AAAA,IACX;AAAA,MACE,MAAM,sBAAsB,QAAQ;AAAA,MACpC,QAAQ;AAAA,MACR,MAAM;AAAA,QACJ;AAAA,QACA,SAAS,YAAY;AAAA,QACrB;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA;AAAA,IACA,EAAE,YAAY,EAAE;AAAA,EAClB;AACF;AAgBA,eAA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AAM,mCAAmC,CAAC;AACjD,mBAAO,OAAO,CAAC;AAAA,UACjB;AAAA,QACF,OAAO;AACL,iBAAO;AAAA,YACL;AAAA,UACF;AACA,cAAI;AACF,kBAAM;AAAA,cACJ;AAAA,cACA,GAAG,eAAe,IAAI;AAAA,cACtB;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,UACF,SAAS,GAAG;AACV,mBAAO,MAAM,8BAA8B,CAAC;AAC5C,mBAAO,OAAO,CAAC;AAAA,UACjB;AAAA,QACF;AACA,gBAAQ,IAAI;AAAA,MACd,CAAC;AAAA,IACH,CAAC;AACD,WAAO;AAAA,EACT,UAAE;AACA,kBAAc,MAAM;AACpB,UAAM,UAAU,MAAM;AACtB,QAAI,cAAc;AAChB,YAAM,GAAG,SAAS,OAAO,YAAY,EAAE,MAAM,MAAM;AAAA,MAEnD,CAAC;AAAA,IACH;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { SkipItems } from '../storybook/isomorphic/types.ts';
|
|
2
1
|
export interface StorybookIntegration {
|
|
3
2
|
type: 'storybook';
|
|
4
3
|
/**
|
|
@@ -18,13 +17,6 @@ export interface StorybookIntegration {
|
|
|
18
17
|
* sure that files are built to the outputDir.
|
|
19
18
|
*/
|
|
20
19
|
usePrebuiltPackage?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Items to skip when generating snapshots.
|
|
23
|
-
*
|
|
24
|
-
* Can be an async function that resolves to an array of `{component,
|
|
25
|
-
* variant}`, or an array of `{component, variant}`.
|
|
26
|
-
*/
|
|
27
|
-
skip?: SkipItems | (() => Promise<SkipItems>) | undefined;
|
|
28
20
|
}
|
|
29
21
|
interface BaseE2EIntegration {
|
|
30
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"A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W,CAAC,CAAC,CAAC;IAC5C,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;IAChD,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IAC1C,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;IAClD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CAC7C;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
package/dist/config/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/config/index.ts"],
|
|
4
|
-
"sourcesContent": ["import type { SkipItems } from '../storybook/isomorphic/types.ts';\n\nexport interface StorybookIntegration {\n type: 'storybook';\n\n /**\n * The directory containing the Storybook configuration\n */\n configDir?: string;\n\n /**\n * The directory containing the static files to serve\n */\n staticDir?: string;\n\n /**\n * The directory to output the static Storybook package to\n */\n outputDir?: string;\n\n /**\n * Whether to use a prebuilt Storybook package. If you use this option, make\n * sure that files are built to the outputDir.\n */\n usePrebuiltPackage?: boolean;\n\n /**\n * Items to skip when generating snapshots.\n *\n * Can be an async function that resolves to an array of `{component,\n * variant}`, or an array of `{component, variant}`.\n */\n skip?: SkipItems | (() => Promise<SkipItems>) | undefined;\n}\n\ninterface BaseE2EIntegration {\n /**\n * Whether to allow failures.\n */\n allowFailures?: boolean;\n\n /**\n * Whether to download and include all assets in the asset package. If false\n * (default), only local assets will be included. When true, even external\n * assets will be included.\n */\n downloadAllAssets?: boolean;\n\n /**\n * When set to `true`, Happo automatically detects elements that are in\n * `:hover`, `:active`, or `:focus-visible` states at the moment a screenshot\n * is taken and adds the corresponding `data-happo-hover`,\n * `data-happo-active`, and `data-happo-focus-visible` attributes. It also\n * improves focus handling by traversing into shadow DOM to find the deepest\n * focused element so that `data-happo-focus` is applied reliably.\n *\n * Note: basic focus handling (`data-happo-focus` based on `activeElement`)\n * is always applied regardless of this option.\n *\n * This lets you write tests naturally (e.g. hover or focus an element) and\n * have Happo capture those states without any extra markup.\n *\n * Requires `applyPseudoClasses: true` on your targets for the attributes to\n * be rendered as CSS pseudo-class styles on Happo workers.\n */\n autoApplyPseudoStateAttributes?: boolean;\n}\n\ninterface CypressIntegration extends BaseE2EIntegration {\n type: 'cypress';\n}\n\ninterface PlaywrightIntegration extends BaseE2EIntegration {\n type: 'playwright';\n}\n\nexport type E2EIntegration = CypressIntegration | PlaywrightIntegration;\n\ninterface CustomIntegration {\n type: 'custom';\n\n /**\n * An async function that generates a custom package. Returns an object with\n * the path to the folder containing the custom files and the path to the\n * entry point file relative to the root directory.\n *\n * Optionally return `estimatedSnapsCount` to enable server-side auto-chunking,\n * which parallelizes rendering across multiple workers.\n *\n * @example\n * { rootDir: 'dist/custom', entryPoint: 'index.js', estimatedSnapsCount: 42 }\n */\n build: () => Promise<{\n rootDir: string;\n entryPoint: string;\n estimatedSnapsCount?: number;\n }>;\n}\n\nexport interface Page {\n /**\n * URL of the page to screenshot\n *\n * Note: The URLs to the website need to be publicly available, otherwise\n * Happo workers won't be able to access the pages.\n */\n url: string;\n\n /**\n * Title of the page to screenshot\n *\n * This is used as the \"component\" identifier in Happo reports, so ensure\n * it is unique for each page.\n */\n title: string;\n\n /**\n * Wait for the content to appear on the page before taking the screenshot.\n */\n waitForContent?: string;\n\n /**\n * Wait for a condition to be true before taking the screenshot.\n */\n waitForSelector?: string;\n}\n\ninterface PagesIntegration {\n type: 'pages';\n\n /**\n * A list of pages to screenshot.\n */\n pages: Array<Page>;\n}\n\n/**\n * Settings for deep compare functionality\n */\nexport interface DeepCompareSettings {\n /**\n * Threshold for comparing images with the given diff algorithm (float between\n * 0 and 1). 1 means all differences are allowed. 0 means no differences are\n * allowed. A good starting value is 0.03 for color-delta and 0.01 for ssim.\n */\n compareThreshold: number;\n\n /**\n * Algorithm to use for diff comparison. Must be \"color-delta\" or \"ssim\".\n * Defaults to \"color-delta\" if not provided. Note that \"ssim\" is experimental\n * and may be removed in the future.\n */\n diffAlgorithm?: 'color-delta' | 'ssim';\n\n /**\n * Threshold for ignoring individual pixel differences, side-stepping the\n * compare threshold. Used relatively to the image size. E.g. a value of 0.01\n * means 1% of the pixels can be above the compare threshold. Use this option\n * if your screenshots contain images or graphics with sharp noise. It is not\n * recommended to use this option for other types of diffs. (float\n * between 0 and 1).\n */\n ignoreThreshold?: number;\n\n /**\n * Whether to ignore whitespace in the diff. If true, whitespace differences\n * will not be considered when comparing images. Whitespace is defined as a\n * vertical section in a screenshot containing a single solid color.\n */\n ignoreWhitespace?: boolean;\n\n /**\n * Whether to apply blur to the diff. This can be used to smooth out subtle\n * differences that would otherwise be above the compare threshold. This\n * should mainly be used when your screenshots have a high contrast and you\n * want to smooth out some of the sharpness that can otherwise cause flakiness.\n */\n applyBlur?: boolean;\n}\n\nexport interface Config {\n /**\n * Key used to authenticate with the Happo API. Never store this in plain\n * text.\n */\n apiKey?: string;\n\n /**\n * Secret used to authenticate with the Happo API. Never store this in plain\n * text.\n */\n apiSecret?: string;\n\n /**\n * The endpoint to use for the happo run. Defaults to `https://happo.io`\n */\n endpoint?: string;\n\n /**\n * The name of the project to associate the Happo run with. If not provided,\n * the default project will be used.\n */\n project?: string;\n\n /**\n * Use this to post Happo statuses as comments to your PR. This can be useful\n * if the Happo server doesn't have access to your GitHub repository.\n *\n * The default is `'https://api.github.com'`. If you are using GitHub\n * Enterprise, enter the URL to your local GitHub API here, such as\n * `'https://ghe.mycompany.zone/api/v3'` (the default for GHE installation is\n * for the API to be located at `/api/v3`).\n */\n githubApiUrl?: string;\n\n /**\n * Browsers to use when generating snapshots\n */\n targets: Record<string, Target>;\n\n /**\n * Type of integration to use\n *\n * - 'storybook': Use Storybook to generate snapshots\n * - 'e2e': Use Playwright or Cypress to generate snapshots\n * - 'custom': Use a custom JS bundle to generate snapshots\n *\n * - 'pages': Use a list of pages to generate snapshots\n */\n integration?:\n | StorybookIntegration\n | CypressIntegration\n | PlaywrightIntegration\n | CustomIntegration\n | PagesIntegration;\n\n /**\n * An object with settings for deep compare.\n */\n deepCompare?: DeepCompareSettings;\n}\n\ntype MobileSafariBrowserType = 'ios-safari' | 'ipad-safari';\ntype DesktopBrowserType = 'chrome' | 'firefox' | 'edge' | 'safari' | 'accessibility';\nexport type BrowserType = MobileSafariBrowserType | DesktopBrowserType;\n\ninterface BaseTarget {\n type: BrowserType;\n\n /**\n * Split the target into chunks to be run on multiple workers in parallel\n *\n * This adds some overhead, so if your test suite isn't large, using more than\n * one chunk might actually slow things down.\n */\n chunks?: number;\n\n /**\n * Override the default maximum height (5000px) used by Happo workers\n *\n * This is useful when taking screenshots of tall components or pages.\n *\n * Note: The maximum width defaults to the maximum height, so if you set\n * `maxHeight`, you may also want to set `maxWidth` at the same time.\n */\n maxHeight?: number;\n\n /**\n * Override the default maximum width used by Happo workers (defaults to\n * `maxHeight`, which defaults to 5000 pixels)\n *\n * This is useful when taking screenshots of wide components or pages.\n */\n maxWidth?: number;\n\n /**\n * Controls how Happo handles elements with the `data-happo-hide` attribute.\n * By default, elements with this attribute are made invisible. Use the value\n * `'ignore'` to make the content appear in screenshots but exclude it from\n * comparison.\n */\n hideBehavior?: 'ignore';\n\n /**\n * When set to `true`, this option allows you to add `data-happo-hover`,\n * `data-happo-focus`, and `data-happo-active` attributes to your DOM elements\n * and have Happo apply the corresponding `:hover`, `:focus`, or `:active`\n * styles.\n *\n * For example, if you have this markup:\n *\n * ```html\n * <button>Hover me</button>\n * <style>\n * button:hover {\n * background-color: blue;\n * }\n * </style>\n * ```\n *\n * To apply the hover style before taking the screenshot (making the button\n * blue), change the markup to:\n *\n * ```html\n * <button data-happo-hover>Hover me</button>\n * <style>\n * button:hover {\n * background-color: blue;\n * }\n * </style>\n * ```\n *\n * Similarly, you can add focus to elements using `data-happo-focus`:\n *\n * ```html\n * <input type=\"text\" data-happo-focus />\n * ```\n *\n * And add `data-happo-active` to elements to simulate the `:active` state:\n *\n * ```html\n * <button data-happo-active>Click me</button>\n * <style>\n * button:active {\n * background-color: red;\n * }\n * </style>\n * ```\n */\n applyPseudoClasses?: boolean;\n\n /**\n * Set `prefersColorScheme: 'dark'` or `prefersColorScheme: 'light'` to set\n * the color scheme preference in the browser.\n */\n prefersColorScheme?: 'light' | 'dark';\n\n /**\n * Controls whether pointer events are allowed in the browser. Defaults to\n * `true`.\n *\n * When `true` (the default), Happo does not inject CSS to disable pointer\n * events, which allows mouse interaction in your tests (e.g., when using\n * Storybook interactive stories).\n *\n * Set `allowPointerEvents: false` to tell Happo to inject CSS that disables\n * pointer events. This can prevent spurious hover effects caused by the\n * system mouse pointer.\n *\n * If you're interested in testing `:hover`, `:focus`, and `:active` states\n * with Happo, you may also want to use the `applyPseudoClasses` option.\n */\n allowPointerEvents?: boolean;\n\n /**\n * Set `freezeAnimations: 'last-frame'` to freeze the animations at the last\n * frame. This is the default behavior.\n *\n * Set `freezeAnimations: 'first-frame'` to freeze the animations at the first\n * frame.\n */\n freezeAnimations?: 'last-frame' | 'first-frame';\n}\n\ninterface MobileSafariTarget extends BaseTarget {\n type: MobileSafariBrowserType;\n}\n\ninterface DesktopTarget extends BaseTarget {\n type: DesktopBrowserType;\n\n /**\n * Set the viewport size for the browser\n */\n viewport: `${number}x${number}`;\n\n /**\n * By default, Happo makes the browser prefer reduced motion when rendering\n * the UI. Set `prefersReducedMotion: false` to disable this behavior.\n */\n prefersReducedMotion?: boolean;\n\n /**\n * Add additional headers to the outgoing requests from the browser. This is\n * useful if you for instance need to tell a CDN that the request originates\n * from a Happo run.\n */\n outgoingRequestHeaders?: Array<{ name: string; value: string }>;\n}\n\nexport type Target = MobileSafariTarget | DesktopTarget;\n\nexport interface TargetWithDefaults extends BaseTarget {\n viewport: `${number}x${number}`;\n __dynamic: boolean;\n prefersReducedMotion?: boolean;\n}\n\nexport interface ConfigWithDefaults extends Config {\n apiKey: NonNullable<Config['apiKey']>;\n apiSecret: NonNullable<Config['apiSecret']>;\n integration: NonNullable<Config['integration']>;\n endpoint: NonNullable<Config['endpoint']>;\n githubApiUrl: NonNullable<Config['githubApiUrl']>;\n targets: Record<string, TargetWithDefaults>;\n}\n\nexport function defineConfig(config: Config): Config {\n return config;\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["export interface StorybookIntegration {\n type: 'storybook';\n\n /**\n * The directory containing the Storybook configuration\n */\n configDir?: string;\n\n /**\n * The directory containing the static files to serve\n */\n staticDir?: string;\n\n /**\n * The directory to output the static Storybook package to\n */\n outputDir?: string;\n\n /**\n * Whether to use a prebuilt Storybook package. If you use this option, make\n * sure that files are built to the outputDir.\n */\n usePrebuiltPackage?: boolean;\n}\n\ninterface BaseE2EIntegration {\n /**\n * Whether to allow failures.\n */\n allowFailures?: boolean;\n\n /**\n * Whether to download and include all assets in the asset package. If false\n * (default), only local assets will be included. When true, even external\n * assets will be included.\n */\n downloadAllAssets?: boolean;\n\n /**\n * When set to `true`, Happo automatically detects elements that are in\n * `:hover`, `:active`, or `:focus-visible` states at the moment a screenshot\n * is taken and adds the corresponding `data-happo-hover`,\n * `data-happo-active`, and `data-happo-focus-visible` attributes. It also\n * improves focus handling by traversing into shadow DOM to find the deepest\n * focused element so that `data-happo-focus` is applied reliably.\n *\n * Note: basic focus handling (`data-happo-focus` based on `activeElement`)\n * is always applied regardless of this option.\n *\n * This lets you write tests naturally (e.g. hover or focus an element) and\n * have Happo capture those states without any extra markup.\n *\n * Requires `applyPseudoClasses: true` on your targets for the attributes to\n * be rendered as CSS pseudo-class styles on Happo workers.\n */\n autoApplyPseudoStateAttributes?: boolean;\n}\n\ninterface CypressIntegration extends BaseE2EIntegration {\n type: 'cypress';\n}\n\ninterface PlaywrightIntegration extends BaseE2EIntegration {\n type: 'playwright';\n}\n\nexport type E2EIntegration = CypressIntegration | PlaywrightIntegration;\n\ninterface CustomIntegration {\n type: 'custom';\n\n /**\n * An async function that generates a custom package. Returns an object with\n * the path to the folder containing the custom files and the path to the\n * entry point file relative to the root directory.\n *\n * Optionally return `estimatedSnapsCount` to enable server-side auto-chunking,\n * which parallelizes rendering across multiple workers.\n *\n * @example\n * { rootDir: 'dist/custom', entryPoint: 'index.js', estimatedSnapsCount: 42 }\n */\n build: () => Promise<{\n rootDir: string;\n entryPoint: string;\n estimatedSnapsCount?: number;\n }>;\n}\n\nexport interface Page {\n /**\n * URL of the page to screenshot\n *\n * Note: The URLs to the website need to be publicly available, otherwise\n * Happo workers won't be able to access the pages.\n */\n url: string;\n\n /**\n * Title of the page to screenshot\n *\n * This is used as the \"component\" identifier in Happo reports, so ensure\n * it is unique for each page.\n */\n title: string;\n\n /**\n * Wait for the content to appear on the page before taking the screenshot.\n */\n waitForContent?: string;\n\n /**\n * Wait for a condition to be true before taking the screenshot.\n */\n waitForSelector?: string;\n}\n\ninterface PagesIntegration {\n type: 'pages';\n\n /**\n * A list of pages to screenshot.\n */\n pages: Array<Page>;\n}\n\n/**\n * Settings for deep compare functionality\n */\nexport interface DeepCompareSettings {\n /**\n * Threshold for comparing images with the given diff algorithm (float between\n * 0 and 1). 1 means all differences are allowed. 0 means no differences are\n * allowed. A good starting value is 0.03 for color-delta and 0.01 for ssim.\n */\n compareThreshold: number;\n\n /**\n * Algorithm to use for diff comparison. Must be \"color-delta\" or \"ssim\".\n * Defaults to \"color-delta\" if not provided. Note that \"ssim\" is experimental\n * and may be removed in the future.\n */\n diffAlgorithm?: 'color-delta' | 'ssim';\n\n /**\n * Threshold for ignoring individual pixel differences, side-stepping the\n * compare threshold. Used relatively to the image size. E.g. a value of 0.01\n * means 1% of the pixels can be above the compare threshold. Use this option\n * if your screenshots contain images or graphics with sharp noise. It is not\n * recommended to use this option for other types of diffs. (float\n * between 0 and 1).\n */\n ignoreThreshold?: number;\n\n /**\n * Whether to ignore whitespace in the diff. If true, whitespace differences\n * will not be considered when comparing images. Whitespace is defined as a\n * vertical section in a screenshot containing a single solid color.\n */\n ignoreWhitespace?: boolean;\n\n /**\n * Whether to apply blur to the diff. This can be used to smooth out subtle\n * differences that would otherwise be above the compare threshold. This\n * should mainly be used when your screenshots have a high contrast and you\n * want to smooth out some of the sharpness that can otherwise cause flakiness.\n */\n applyBlur?: boolean;\n}\n\nexport interface Config {\n /**\n * Key used to authenticate with the Happo API. Never store this in plain\n * text.\n */\n apiKey?: string;\n\n /**\n * Secret used to authenticate with the Happo API. Never store this in plain\n * text.\n */\n apiSecret?: string;\n\n /**\n * The endpoint to use for the happo run. Defaults to `https://happo.io`\n */\n endpoint?: string;\n\n /**\n * The name of the project to associate the Happo run with. If not provided,\n * the default project will be used.\n */\n project?: string;\n\n /**\n * Use this to post Happo statuses as comments to your PR. This can be useful\n * if the Happo server doesn't have access to your GitHub repository.\n *\n * The default is `'https://api.github.com'`. If you are using GitHub\n * Enterprise, enter the URL to your local GitHub API here, such as\n * `'https://ghe.mycompany.zone/api/v3'` (the default for GHE installation is\n * for the API to be located at `/api/v3`).\n */\n githubApiUrl?: string;\n\n /**\n * Browsers to use when generating snapshots\n */\n targets: Record<string, Target>;\n\n /**\n * Type of integration to use\n *\n * - 'storybook': Use Storybook to generate snapshots\n * - 'e2e': Use Playwright or Cypress to generate snapshots\n * - 'custom': Use a custom JS bundle to generate snapshots\n *\n * - 'pages': Use a list of pages to generate snapshots\n */\n integration?:\n | StorybookIntegration\n | CypressIntegration\n | PlaywrightIntegration\n | CustomIntegration\n | PagesIntegration;\n\n /**\n * An object with settings for deep compare.\n */\n deepCompare?: DeepCompareSettings;\n}\n\ntype MobileSafariBrowserType = 'ios-safari' | 'ipad-safari';\ntype DesktopBrowserType = 'chrome' | 'firefox' | 'edge' | 'safari' | 'accessibility';\nexport type BrowserType = MobileSafariBrowserType | DesktopBrowserType;\n\ninterface BaseTarget {\n type: BrowserType;\n\n /**\n * Split the target into chunks to be run on multiple workers in parallel\n *\n * This adds some overhead, so if your test suite isn't large, using more than\n * one chunk might actually slow things down.\n */\n chunks?: number;\n\n /**\n * Override the default maximum height (5000px) used by Happo workers\n *\n * This is useful when taking screenshots of tall components or pages.\n *\n * Note: The maximum width defaults to the maximum height, so if you set\n * `maxHeight`, you may also want to set `maxWidth` at the same time.\n */\n maxHeight?: number;\n\n /**\n * Override the default maximum width used by Happo workers (defaults to\n * `maxHeight`, which defaults to 5000 pixels)\n *\n * This is useful when taking screenshots of wide components or pages.\n */\n maxWidth?: number;\n\n /**\n * Controls how Happo handles elements with the `data-happo-hide` attribute.\n * By default, elements with this attribute are made invisible. Use the value\n * `'ignore'` to make the content appear in screenshots but exclude it from\n * comparison.\n */\n hideBehavior?: 'ignore';\n\n /**\n * When set to `true`, this option allows you to add `data-happo-hover`,\n * `data-happo-focus`, and `data-happo-active` attributes to your DOM elements\n * and have Happo apply the corresponding `:hover`, `:focus`, or `:active`\n * styles.\n *\n * For example, if you have this markup:\n *\n * ```html\n * <button>Hover me</button>\n * <style>\n * button:hover {\n * background-color: blue;\n * }\n * </style>\n * ```\n *\n * To apply the hover style before taking the screenshot (making the button\n * blue), change the markup to:\n *\n * ```html\n * <button data-happo-hover>Hover me</button>\n * <style>\n * button:hover {\n * background-color: blue;\n * }\n * </style>\n * ```\n *\n * Similarly, you can add focus to elements using `data-happo-focus`:\n *\n * ```html\n * <input type=\"text\" data-happo-focus />\n * ```\n *\n * And add `data-happo-active` to elements to simulate the `:active` state:\n *\n * ```html\n * <button data-happo-active>Click me</button>\n * <style>\n * button:active {\n * background-color: red;\n * }\n * </style>\n * ```\n */\n applyPseudoClasses?: boolean;\n\n /**\n * Set `prefersColorScheme: 'dark'` or `prefersColorScheme: 'light'` to set\n * the color scheme preference in the browser.\n */\n prefersColorScheme?: 'light' | 'dark';\n\n /**\n * Controls whether pointer events are allowed in the browser. Defaults to\n * `true`.\n *\n * When `true` (the default), Happo does not inject CSS to disable pointer\n * events, which allows mouse interaction in your tests (e.g., when using\n * Storybook interactive stories).\n *\n * Set `allowPointerEvents: false` to tell Happo to inject CSS that disables\n * pointer events. This can prevent spurious hover effects caused by the\n * system mouse pointer.\n *\n * If you're interested in testing `:hover`, `:focus`, and `:active` states\n * with Happo, you may also want to use the `applyPseudoClasses` option.\n */\n allowPointerEvents?: boolean;\n\n /**\n * Set `freezeAnimations: 'last-frame'` to freeze the animations at the last\n * frame. This is the default behavior.\n *\n * Set `freezeAnimations: 'first-frame'` to freeze the animations at the first\n * frame.\n */\n freezeAnimations?: 'last-frame' | 'first-frame';\n}\n\ninterface MobileSafariTarget extends BaseTarget {\n type: MobileSafariBrowserType;\n}\n\ninterface DesktopTarget extends BaseTarget {\n type: DesktopBrowserType;\n\n /**\n * Set the viewport size for the browser\n */\n viewport: `${number}x${number}`;\n\n /**\n * By default, Happo makes the browser prefer reduced motion when rendering\n * the UI. Set `prefersReducedMotion: false` to disable this behavior.\n */\n prefersReducedMotion?: boolean;\n\n /**\n * Add additional headers to the outgoing requests from the browser. This is\n * useful if you for instance need to tell a CDN that the request originates\n * from a Happo run.\n */\n outgoingRequestHeaders?: Array<{ name: string; value: string }>;\n}\n\nexport type Target = MobileSafariTarget | DesktopTarget;\n\nexport interface TargetWithDefaults extends BaseTarget {\n viewport: `${number}x${number}`;\n __dynamic: boolean;\n prefersReducedMotion?: boolean;\n}\n\nexport interface ConfigWithDefaults extends Config {\n apiKey: NonNullable<Config['apiKey']>;\n apiSecret: NonNullable<Config['apiSecret']>;\n integration: NonNullable<Config['integration']>;\n endpoint: NonNullable<Config['endpoint']>;\n githubApiUrl: NonNullable<Config['githubApiUrl']>;\n targets: Record<string, TargetWithDefaults>;\n}\n\nexport function defineConfig(config: Config): Config {\n return config;\n}\n"],
|
|
5
|
+
"mappings": ";AA6YO,SAAS,aAAa,QAAwB;AACnD,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/custom/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/custom/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEjF,UAAU,kBAAmB,SAAQ,iBAAiB;IACpD,SAAS,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAAC,CAAC;IACpD,OAAO,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC,SAAS,CAAC,CAAC;IAChD,MAAM,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC9C,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACzB;AAKD,QAAA,MAAM,WAAW;eACL,eAAe,GAAuB,IAAI;2BAsE7B,kBAAkB,GAAG,IAAI;aA6BvC,IAAI;CAId,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/dist/custom/index.js
CHANGED
|
@@ -1,3 +1,49 @@
|
|
|
1
|
+
// src/isomorphic/parseSkip.ts
|
|
2
|
+
function isSkipItem(item) {
|
|
3
|
+
if (typeof item !== "object" || item === null) return false;
|
|
4
|
+
const record = item;
|
|
5
|
+
const hasComponent = typeof record["component"] === "string";
|
|
6
|
+
const hasStoryFile = typeof record["storyFile"] === "string";
|
|
7
|
+
if (hasComponent && hasStoryFile) return false;
|
|
8
|
+
if (hasStoryFile) return record["variant"] === void 0;
|
|
9
|
+
if (hasComponent) return record["variant"] === void 0 || typeof record["variant"] === "string";
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
function validateSkip(json) {
|
|
13
|
+
const parsed = JSON.parse(json);
|
|
14
|
+
if (!Array.isArray(parsed) || !parsed.every(isSkipItem)) {
|
|
15
|
+
throw new TypeError(
|
|
16
|
+
"--skip must be a JSON array of {component, variant?} or {storyFile} objects"
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
return parsed;
|
|
20
|
+
}
|
|
21
|
+
function parseSkip(json) {
|
|
22
|
+
if (!json) return [];
|
|
23
|
+
try {
|
|
24
|
+
return validateSkip(json);
|
|
25
|
+
} catch {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function toSkipSet(items) {
|
|
30
|
+
const componentOnly = /* @__PURE__ */ new Set();
|
|
31
|
+
const componentVariant = /* @__PURE__ */ new Set();
|
|
32
|
+
for (const item of items) {
|
|
33
|
+
if (!("component" in item)) continue;
|
|
34
|
+
const { component, variant } = item;
|
|
35
|
+
if (variant === void 0) {
|
|
36
|
+
componentOnly.add(component);
|
|
37
|
+
} else {
|
|
38
|
+
componentVariant.add(`${component}\0${variant}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return [componentOnly, componentVariant];
|
|
42
|
+
}
|
|
43
|
+
function isInSkipSet([componentOnly, componentVariant], component, variant) {
|
|
44
|
+
return componentOnly.has(component) || componentVariant.has(`${component}\0${variant}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
1
47
|
// src/custom/index.ts
|
|
2
48
|
var examples = [];
|
|
3
49
|
var currentIndex = 0;
|
|
@@ -27,21 +73,31 @@ var happoStatic = {
|
|
|
27
73
|
}
|
|
28
74
|
},
|
|
29
75
|
nextExample: async () => {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
76
|
+
const happoSkippedEl = typeof document === "undefined" ? null : document.getElementById("happo-skipped");
|
|
77
|
+
const skipSet = toSkipSet(
|
|
78
|
+
parseSkip(happoSkippedEl?.textContent ?? void 0)
|
|
79
|
+
);
|
|
80
|
+
while (true) {
|
|
81
|
+
const example = examples[currentIndex];
|
|
82
|
+
if (!example) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (isInSkipSet(skipSet, example.component, example.variant)) {
|
|
86
|
+
currentIndex++;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (example.render) {
|
|
90
|
+
await example.render();
|
|
91
|
+
}
|
|
92
|
+
currentIndex++;
|
|
93
|
+
const clone = {
|
|
94
|
+
component: example.component,
|
|
95
|
+
variant: example.variant,
|
|
96
|
+
targets: example.targets,
|
|
97
|
+
waitForContent: example.waitForContent
|
|
98
|
+
};
|
|
99
|
+
return clone;
|
|
36
100
|
}
|
|
37
|
-
currentIndex++;
|
|
38
|
-
const clone = {
|
|
39
|
-
component: example.component,
|
|
40
|
-
variant: example.variant,
|
|
41
|
-
targets: example.targets,
|
|
42
|
-
waitForContent: example.waitForContent
|
|
43
|
-
};
|
|
44
|
-
return clone;
|
|
45
101
|
}
|
|
46
102
|
};
|
|
47
103
|
},
|
package/dist/custom/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/custom/index.ts"],
|
|
4
|
-
"sourcesContent": ["import type { NextExampleResult, WindowWithHappo } from '../isomorphic/types.ts';\n\ninterface HappoStaticExample extends NextExampleResult {\n component: Required<NextExampleResult>['component'];\n variant: Required<NextExampleResult>['variant'];\n render: Required<NextExampleResult>['render'];\n targets?: Array<string>;\n}\n\nlet examples: Array<HappoStaticExample> = [];\nlet currentIndex = 0;\n\nconst happoStatic = {\n init(win: WindowWithHappo = globalThis.window): void {\n win.happo = {\n ...win.happo,\n\n init: ({ targetName, chunk, only }) => {\n currentIndex = 0;\n\n if (only) {\n examples = examples.filter(\n (e) => e.component === only.component && e.variant === only.variant,\n );\n } else if (chunk) {\n const examplesPerChunk = Math.ceil(examples.length / chunk.total);\n const startIndex = chunk.index * examplesPerChunk;\n const endIndex = startIndex + examplesPerChunk;\n examples = examples.slice(startIndex, endIndex);\n }\n\n if (targetName) {\n examples = examples.filter((example) => {\n if (!example.targets || !Array.isArray(example.targets)) {\n // This story hasn't been filtered for specific targets\n return true;\n }\n\n return example.targets.includes(targetName);\n });\n }\n },\n\n nextExample: async () => {\n const example = examples[currentIndex];\n\n
|
|
5
|
-
"mappings": ";AASA,IAAI,WAAsC,CAAC;AAC3C,IAAI,eAAe;AAEnB,IAAM,cAAc;AAAA,EAClB,KAAK,MAAuB,WAAW,QAAc;AACnD,QAAI,QAAQ;AAAA,MACV,GAAG,IAAI;AAAA,MAEP,MAAM,CAAC,EAAE,YAAY,OAAO,KAAK,MAAM;AACrC,uBAAe;AAEf,YAAI,MAAM;AACR,qBAAW,SAAS;AAAA,YAClB,CAAC,MAAM,EAAE,cAAc,KAAK,aAAa,EAAE,YAAY,KAAK;AAAA,UAC9D;AAAA,QACF,WAAW,OAAO;AAChB,gBAAM,mBAAmB,KAAK,KAAK,SAAS,SAAS,MAAM,KAAK;AAChE,gBAAM,aAAa,MAAM,QAAQ;AACjC,gBAAM,WAAW,aAAa;AAC9B,qBAAW,SAAS,MAAM,YAAY,QAAQ;AAAA,QAChD;AAEA,YAAI,YAAY;AACd,qBAAW,SAAS,OAAO,CAAC,YAAY;AACtC,gBAAI,CAAC,QAAQ,WAAW,CAAC,MAAM,QAAQ,QAAQ,OAAO,GAAG;AAEvD,qBAAO;AAAA,YACT;AAEA,mBAAO,QAAQ,QAAQ,SAAS,UAAU;AAAA,UAC5C,CAAC;AAAA,QACH;AAAA,MACF;AAAA,MAEA,aAAa,YAAY;AACvB,cAAM,UAAU,SAAS,YAAY;AAErC,
|
|
3
|
+
"sources": ["../../src/isomorphic/parseSkip.ts", "../../src/custom/index.ts"],
|
|
4
|
+
"sourcesContent": ["import type { SkipItem } from './types.ts';\n\n/**\n * A pair of Sets used for O(1) skip lookups.\n * - [0]: component-only skips (match all variants of the component)\n * - [1]: component+variant skips (match a specific variant, keyed as \"component\\0variant\")\n */\nexport type SkipSet = readonly [componentOnly: Set<string>, componentVariant: Set<string>];\n\nfunction isSkipItem(item: unknown): item is SkipItem {\n if (typeof item !== 'object' || item === null) return false;\n const record = item as Record<string, unknown>;\n const hasComponent = typeof record['component'] === 'string';\n const hasStoryFile = typeof record['storyFile'] === 'string';\n if (hasComponent && hasStoryFile) return false;\n if (hasStoryFile) return record['variant'] === undefined;\n if (hasComponent) return record['variant'] === undefined || typeof record['variant'] === 'string';\n return false;\n}\n\n/**\n * Parses and validates a JSON string, returning an array of SkipItems.\n * Throws a TypeError if the JSON is invalid or not an array of SkipItems.\n */\nexport function validateSkip(json: string): Array<SkipItem> {\n const parsed: unknown = JSON.parse(json);\n if (!Array.isArray(parsed) || !parsed.every(isSkipItem)) {\n throw new TypeError(\n '--skip must be a JSON array of {component, variant?} or {storyFile} objects',\n );\n }\n return parsed;\n}\n\n/**\n * Parses a JSON string into an array of SkipItems. Returns an empty array on\n * any parse error or if the value is not a valid array of SkipItems.\n */\nexport function parseSkip(json?: string): Array<SkipItem> {\n if (!json) return [];\n try {\n return validateSkip(json);\n } catch {\n return [];\n }\n}\n\n/**\n * Converts an array of SkipItems into a SkipSet for efficient lookups.\n * Items with a `storyFile` key (unresolved) are silently ignored.\n */\nexport function toSkipSet(items: Array<SkipItem>): SkipSet {\n const componentOnly = new Set<string>();\n const componentVariant = new Set<string>();\n for (const item of items) {\n if (!('component' in item)) continue;\n const { component, variant } = item;\n if (variant === undefined) {\n componentOnly.add(component);\n } else {\n componentVariant.add(`${component}\\0${variant}`);\n }\n }\n return [componentOnly, componentVariant];\n}\n\n/**\n * Returns true if the given component+variant should be skipped according to\n * the SkipSet.\n */\nexport function isInSkipSet(\n [componentOnly, componentVariant]: SkipSet,\n component: string,\n variant: string,\n): boolean {\n return componentOnly.has(component) || componentVariant.has(`${component}\\0${variant}`);\n}\n", "import {\n isInSkipSet,\n parseSkip,\n toSkipSet,\n} from '../isomorphic/parseSkip.ts';\nimport type { NextExampleResult, WindowWithHappo } from '../isomorphic/types.ts';\n\ninterface HappoStaticExample extends NextExampleResult {\n component: Required<NextExampleResult>['component'];\n variant: Required<NextExampleResult>['variant'];\n render: Required<NextExampleResult>['render'];\n targets?: Array<string>;\n}\n\nlet examples: Array<HappoStaticExample> = [];\nlet currentIndex = 0;\n\nconst happoStatic = {\n init(win: WindowWithHappo = globalThis.window): void {\n win.happo = {\n ...win.happo,\n\n init: ({ targetName, chunk, only }) => {\n currentIndex = 0;\n\n if (only) {\n examples = examples.filter(\n (e) => e.component === only.component && e.variant === only.variant,\n );\n } else if (chunk) {\n const examplesPerChunk = Math.ceil(examples.length / chunk.total);\n const startIndex = chunk.index * examplesPerChunk;\n const endIndex = startIndex + examplesPerChunk;\n examples = examples.slice(startIndex, endIndex);\n }\n\n if (targetName) {\n examples = examples.filter((example) => {\n if (!example.targets || !Array.isArray(example.targets)) {\n // This story hasn't been filtered for specific targets\n return true;\n }\n\n return example.targets.includes(targetName);\n });\n }\n },\n\n nextExample: async () => {\n const happoSkippedEl =\n typeof document === 'undefined'\n ? null\n : document.getElementById('happo-skipped');\n const skipSet = toSkipSet(\n parseSkip(happoSkippedEl?.textContent ?? undefined),\n );\n\n while (true) {\n const example = examples[currentIndex];\n\n if (!example) {\n // we're done\n return;\n }\n\n if (isInSkipSet(skipSet, example.component, example.variant)) {\n currentIndex++;\n continue;\n }\n\n if (example.render) {\n await example.render();\n }\n currentIndex++;\n\n const clone = {\n component: example.component,\n variant: example.variant,\n targets: example.targets,\n waitForContent: example.waitForContent,\n };\n\n return clone;\n }\n },\n };\n },\n\n registerExample(props: HappoStaticExample): void {\n if (!props.component) {\n throw new Error('Missing `component` property');\n }\n if (!props.variant) {\n throw new Error('Missing `variant` property');\n }\n if (!props.render) {\n throw new Error('Missing `render` property');\n }\n\n const compType = typeof props.component;\n if (compType !== 'string') {\n throw new Error(`Property \\`component\\` must be a string. Got \"${compType}\".`);\n }\n\n const varType = typeof props.variant;\n if (varType !== 'string') {\n throw new Error(`Property \\`variant\\` must be a string. Got \"${varType}\".`);\n }\n\n const rendType = typeof props.render;\n if (rendType !== 'function') {\n throw new Error(`Property \\`render\\` must be a function. Got \"${rendType}\".`);\n }\n\n examples.push(props);\n },\n\n reset(): void {\n examples = [];\n currentIndex = 0;\n },\n};\n\nexport default happoStatic;\n"],
|
|
5
|
+
"mappings": ";AASA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UAC1B;AAEA,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,gBAAgB,OAAiC;AAC/C,QAAI,CAAC,MAAM,WAAW;AACpB,YAAM,IAAI,MAAM,8BAA8B;AAAA,IAChD;AACA,QAAI,CAAC,MAAM,SAAS;AAClB,YAAM,IAAI,MAAM,4BAA4B;AAAA,IAC9C;AACA,QAAI,CAAC,MAAM,QAAQ;AACjB,YAAM,IAAI,MAAM,2BAA2B;AAAA,IAC7C;AAEA,UAAM,WAAW,OAAO,MAAM;AAC9B,QAAI,aAAa,UAAU;AACzB,YAAM,IAAI,MAAM,iDAAiD,QAAQ,IAAI;AAAA,IAC/E;AAEA,UAAM,UAAU,OAAO,MAAM;AAC7B,QAAI,YAAY,UAAU;AACxB,YAAM,IAAI,MAAM,+CAA+C,OAAO,IAAI;AAAA,IAC5E;AAEA,UAAM,WAAW,OAAO,MAAM;AAC9B,QAAI,aAAa,YAAY;AAC3B,YAAM,IAAI,MAAM,gDAAgD,QAAQ,IAAI;AAAA,IAC9E;AAEA,aAAS,KAAK,KAAK;AAAA,EACrB;AAAA,EAEA,QAAc;AACZ,eAAW,CAAC;AACZ,mBAAe;AAAA,EACjB;AACF;AAEA,IAAO,gBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// src/isomorphic/parseSkip.ts
|
|
2
|
+
function isSkipItem(item) {
|
|
3
|
+
if (typeof item !== "object" || item === null) return false;
|
|
4
|
+
const record = item;
|
|
5
|
+
const hasComponent = typeof record["component"] === "string";
|
|
6
|
+
const hasStoryFile = typeof record["storyFile"] === "string";
|
|
7
|
+
if (hasComponent && hasStoryFile) return false;
|
|
8
|
+
if (hasStoryFile) return record["variant"] === void 0;
|
|
9
|
+
if (hasComponent) return record["variant"] === void 0 || typeof record["variant"] === "string";
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
function validateSkip(json) {
|
|
13
|
+
const parsed = JSON.parse(json);
|
|
14
|
+
if (!Array.isArray(parsed) || !parsed.every(isSkipItem)) {
|
|
15
|
+
throw new TypeError(
|
|
16
|
+
"--skip must be a JSON array of {component, variant?} or {storyFile} objects"
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
return parsed;
|
|
20
|
+
}
|
|
21
|
+
function parseSkip(json) {
|
|
22
|
+
if (!json) return [];
|
|
23
|
+
try {
|
|
24
|
+
return validateSkip(json);
|
|
25
|
+
} catch {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function toSkipSet(items) {
|
|
30
|
+
const componentOnly = /* @__PURE__ */ new Set();
|
|
31
|
+
const componentVariant = /* @__PURE__ */ new Set();
|
|
32
|
+
for (const item of items) {
|
|
33
|
+
if (!("component" in item)) continue;
|
|
34
|
+
const { component, variant } = item;
|
|
35
|
+
if (variant === void 0) {
|
|
36
|
+
componentOnly.add(component);
|
|
37
|
+
} else {
|
|
38
|
+
componentVariant.add(`${component}\0${variant}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return [componentOnly, componentVariant];
|
|
42
|
+
}
|
|
43
|
+
function isInSkipSet([componentOnly, componentVariant], component, variant) {
|
|
44
|
+
return componentOnly.has(component) || componentVariant.has(`${component}\0${variant}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// src/isomorphic/findCSSAssetUrls.ts
|
|
48
|
+
var URL_PATTERN = /(url\(['"]?)(.*?)(['"]?\))/g;
|
|
49
|
+
function findCSSAssetUrls(string) {
|
|
50
|
+
const result = [];
|
|
51
|
+
let match;
|
|
52
|
+
while (match = URL_PATTERN.exec(string)) {
|
|
53
|
+
const url = match[2];
|
|
54
|
+
if (url && !url.startsWith("data:")) {
|
|
55
|
+
result.push(url);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
var findCSSAssetUrls_default = findCSSAssetUrls;
|
|
61
|
+
|
|
62
|
+
export {
|
|
63
|
+
URL_PATTERN,
|
|
64
|
+
findCSSAssetUrls_default,
|
|
65
|
+
parseSkip,
|
|
66
|
+
toSkipSet,
|
|
67
|
+
isInSkipSet
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=chunk-TYBGAHYH.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/isomorphic/parseSkip.ts", "../../src/isomorphic/findCSSAssetUrls.ts"],
|
|
4
|
+
"sourcesContent": ["import type { SkipItem } from './types.ts';\n\n/**\n * A pair of Sets used for O(1) skip lookups.\n * - [0]: component-only skips (match all variants of the component)\n * - [1]: component+variant skips (match a specific variant, keyed as \"component\\0variant\")\n */\nexport type SkipSet = readonly [componentOnly: Set<string>, componentVariant: Set<string>];\n\nfunction isSkipItem(item: unknown): item is SkipItem {\n if (typeof item !== 'object' || item === null) return false;\n const record = item as Record<string, unknown>;\n const hasComponent = typeof record['component'] === 'string';\n const hasStoryFile = typeof record['storyFile'] === 'string';\n if (hasComponent && hasStoryFile) return false;\n if (hasStoryFile) return record['variant'] === undefined;\n if (hasComponent) return record['variant'] === undefined || typeof record['variant'] === 'string';\n return false;\n}\n\n/**\n * Parses and validates a JSON string, returning an array of SkipItems.\n * Throws a TypeError if the JSON is invalid or not an array of SkipItems.\n */\nexport function validateSkip(json: string): Array<SkipItem> {\n const parsed: unknown = JSON.parse(json);\n if (!Array.isArray(parsed) || !parsed.every(isSkipItem)) {\n throw new TypeError(\n '--skip must be a JSON array of {component, variant?} or {storyFile} objects',\n );\n }\n return parsed;\n}\n\n/**\n * Parses a JSON string into an array of SkipItems. Returns an empty array on\n * any parse error or if the value is not a valid array of SkipItems.\n */\nexport function parseSkip(json?: string): Array<SkipItem> {\n if (!json) return [];\n try {\n return validateSkip(json);\n } catch {\n return [];\n }\n}\n\n/**\n * Converts an array of SkipItems into a SkipSet for efficient lookups.\n * Items with a `storyFile` key (unresolved) are silently ignored.\n */\nexport function toSkipSet(items: Array<SkipItem>): SkipSet {\n const componentOnly = new Set<string>();\n const componentVariant = new Set<string>();\n for (const item of items) {\n if (!('component' in item)) continue;\n const { component, variant } = item;\n if (variant === undefined) {\n componentOnly.add(component);\n } else {\n componentVariant.add(`${component}\\0${variant}`);\n }\n }\n return [componentOnly, componentVariant];\n}\n\n/**\n * Returns true if the given component+variant should be skipped according to\n * the SkipSet.\n */\nexport function isInSkipSet(\n [componentOnly, componentVariant]: SkipSet,\n component: string,\n variant: string,\n): boolean {\n return componentOnly.has(component) || componentVariant.has(`${component}\\0${variant}`);\n}\n", "const URL_PATTERN: RegExp = /(url\\(['\"]?)(.*?)(['\"]?\\))/g;\n\nfunction findCSSAssetUrls(string: string): Array<string> {\n const result: Array<string> = [];\n let match: RegExpExecArray | null;\n while ((match = URL_PATTERN.exec(string))) {\n const url = match[2];\n if (url && !url.startsWith('data:')) {\n result.push(url);\n }\n }\n return result;\n}\n\nexport { URL_PATTERN };\nexport default findCSSAssetUrls;\n"],
|
|
5
|
+
"mappings": ";AASA,SAAS,WAAW,MAAiC;AACnD,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,QAAM,SAAS;AACf,QAAM,eAAe,OAAO,OAAO,WAAW,MAAM;AACpD,QAAM,eAAe,OAAO,OAAO,WAAW,MAAM;AACpD,MAAI,gBAAgB,aAAc,QAAO;AACzC,MAAI,aAAc,QAAO,OAAO,SAAS,MAAM;AAC/C,MAAI,aAAc,QAAO,OAAO,SAAS,MAAM,UAAa,OAAO,OAAO,SAAS,MAAM;AACzF,SAAO;AACT;AAMO,SAAS,aAAa,MAA+B;AAC1D,QAAM,SAAkB,KAAK,MAAM,IAAI;AACvC,MAAI,CAAC,MAAM,QAAQ,MAAM,KAAK,CAAC,OAAO,MAAM,UAAU,GAAG;AACvD,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAMO,SAAS,UAAU,MAAgC;AACxD,MAAI,CAAC,KAAM,QAAO,CAAC;AACnB,MAAI;AACF,WAAO,aAAa,IAAI;AAAA,EAC1B,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;AAMO,SAAS,UAAU,OAAiC;AACzD,QAAM,gBAAgB,oBAAI,IAAY;AACtC,QAAM,mBAAmB,oBAAI,IAAY;AACzC,aAAW,QAAQ,OAAO;AACxB,QAAI,EAAE,eAAe,MAAO;AAC5B,UAAM,EAAE,WAAW,QAAQ,IAAI;AAC/B,QAAI,YAAY,QAAW;AACzB,oBAAc,IAAI,SAAS;AAAA,IAC7B,OAAO;AACL,uBAAiB,IAAI,GAAG,SAAS,KAAK,OAAO,EAAE;AAAA,IACjD;AAAA,EACF;AACA,SAAO,CAAC,eAAe,gBAAgB;AACzC;AAMO,SAAS,YACd,CAAC,eAAe,gBAAgB,GAChC,WACA,SACS;AACT,SAAO,cAAc,IAAI,SAAS,KAAK,iBAAiB,IAAI,GAAG,SAAS,KAAK,OAAO,EAAE;AACxF;;;AC5EA,IAAM,cAAsB;AAE5B,SAAS,iBAAiB,QAA+B;AACvD,QAAM,SAAwB,CAAC;AAC/B,MAAI;AACJ,SAAQ,QAAQ,YAAY,KAAK,MAAM,GAAI;AACzC,UAAM,MAAM,MAAM,CAAC;AACnB,QAAI,OAAO,CAAC,IAAI,WAAW,OAAO,GAAG;AACnC,aAAO,KAAK,GAAG;AAAA,IACjB;AAAA,EACF;AACA,SAAO;AACT;AAGA,IAAO,2BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cypress/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cypress/index.ts"],"names":[],"mappings":"AAYA,UAAU,sBAAsB;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACpC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,KAAK,OAAO,CAAC;KACzD,CAAC;IAEF;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,OAAO,CAAC;QAChB,UAAU,SAAS;YACjB,eAAe,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;SACvE;KACF;CACF;AA6DD,UAAU,aAAa;IACrB,yBAAyB,EAAE,OAAO,CAAC;IACnC,eAAe,EAAE,MAAM,CAAC;CACzB;AAWD,eAAO,MAAM,SAAS,GAAI,aAAa,OAAO,CAAC,aAAa,CAAC,KAAG,IAE/D,CAAC"}
|
package/dist/cypress/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
findCSSAssetUrls_default
|
|
3
|
-
|
|
2
|
+
findCSSAssetUrls_default,
|
|
3
|
+
isInSkipSet,
|
|
4
|
+
toSkipSet
|
|
5
|
+
} from "./chunk-TYBGAHYH.js";
|
|
4
6
|
|
|
5
7
|
// src/browser/applyConstructedStylesPatch.ts
|
|
6
8
|
var recordedCSSSymbol = /* @__PURE__ */ Symbol("recordedCssRules");
|
|
@@ -1095,6 +1097,7 @@ var config = {
|
|
|
1095
1097
|
// 800 Kb per chunk
|
|
1096
1098
|
};
|
|
1097
1099
|
var cachedAutoApplyPseudoStateAttributes = null;
|
|
1100
|
+
var cachedSkipSet = null;
|
|
1098
1101
|
var configure = (userConfig) => {
|
|
1099
1102
|
config = { ...config, ...userConfig };
|
|
1100
1103
|
};
|
|
@@ -1176,11 +1179,18 @@ Cypress.Commands.add(
|
|
|
1176
1179
|
"happoGetIntegrationConfig",
|
|
1177
1180
|
null,
|
|
1178
1181
|
{ ...taskOptions, log: false }
|
|
1179
|
-
).then((
|
|
1180
|
-
cachedAutoApplyPseudoStateAttributes =
|
|
1182
|
+
).then((happoSettings) => {
|
|
1183
|
+
cachedAutoApplyPseudoStateAttributes = happoSettings?.autoApplyPseudoStateAttributes ?? false;
|
|
1184
|
+
cachedSkipSet = toSkipSet(happoSettings?.skip ?? []);
|
|
1185
|
+
if (isInSkipSet(cachedSkipSet, component, variant)) {
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1181
1188
|
takeSnapshot(cachedAutoApplyPseudoStateAttributes);
|
|
1182
1189
|
});
|
|
1183
1190
|
} else {
|
|
1191
|
+
if (cachedSkipSet && isInSkipSet(cachedSkipSet, component, variant)) {
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1184
1194
|
takeSnapshot(cachedAutoApplyPseudoStateAttributes);
|
|
1185
1195
|
}
|
|
1186
1196
|
}
|