@ohos-ports/synpress-cache 0.0.0-stage → 0.0.14-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/LICENSE.md +21 -0
  2. package/dist/cli/index.js +1407 -0
  3. package/dist/cli/index.js.map +1 -0
  4. package/dist/index.js +1421 -0
  5. package/dist/index.js.map +1 -0
  6. package/package.json +74 -4
  7. package/src/cli/cliEntrypoint.ts +104 -0
  8. package/src/cli/compilationFixes.ts +17 -0
  9. package/src/cli/compileWalletSetupFunctions.ts +73 -0
  10. package/src/cli/footer.ts +5 -0
  11. package/src/cli/index.ts +15 -0
  12. package/src/constants.ts +3 -0
  13. package/src/createCache.ts +20 -0
  14. package/src/defineWalletSetup.ts +28 -0
  15. package/src/downloadFile.ts +67 -0
  16. package/src/ensureCacheDirExists.ts +9 -0
  17. package/src/index.ts +11 -0
  18. package/src/prepareExtension.ts +21 -0
  19. package/src/prepareExtensionPhantom.ts +20 -0
  20. package/src/unzipArchive.ts +100 -0
  21. package/src/utils/buildWalletSetupFunction.ts +15 -0
  22. package/src/utils/bytesToMegabytes.ts +4 -0
  23. package/src/utils/createCacheForWalletSetupFunction.ts +45 -0
  24. package/src/utils/createTempContextDir.ts +14 -0
  25. package/src/utils/extractWalletSetupFunction.ts +12 -0
  26. package/src/utils/getUniqueWalletSetupFunctions.ts +60 -0
  27. package/src/utils/getWalletSetupFiles.ts +31 -0
  28. package/src/utils/getWalletSetupFuncHash.ts +12 -0
  29. package/src/utils/importWalletSetupFile.ts +32 -0
  30. package/src/utils/isDirEmpty.ts +15 -0
  31. package/src/utils/onDownloadProgress.ts +40 -0
  32. package/src/utils/removeTempContextDir.ts +23 -0
  33. package/src/utils/triggerCacheCreation.ts +50 -0
  34. package/src/utils/waitForExtensionOnLoadPage.ts +192 -0
  35. package/types/cli/cliEntrypoint.d.ts +2 -0
  36. package/types/cli/cliEntrypoint.d.ts.map +1 -0
  37. package/types/cli/compilationFixes.d.ts +2 -0
  38. package/types/cli/compilationFixes.d.ts.map +1 -0
  39. package/types/cli/compileWalletSetupFunctions.d.ts +5 -0
  40. package/types/cli/compileWalletSetupFunctions.d.ts.map +1 -0
  41. package/types/cli/footer.d.ts +2 -0
  42. package/types/cli/footer.d.ts.map +1 -0
  43. package/types/cli/index.d.ts +3 -0
  44. package/types/cli/index.d.ts.map +1 -0
  45. package/types/constants.d.ts +3 -0
  46. package/types/constants.d.ts.map +1 -0
  47. package/types/createCache.d.ts +2 -0
  48. package/types/createCache.d.ts.map +1 -0
  49. package/types/defineWalletSetup.d.ts +17 -0
  50. package/types/defineWalletSetup.d.ts.map +1 -0
  51. package/types/downloadFile.d.ts +13 -0
  52. package/types/downloadFile.d.ts.map +1 -0
  53. package/types/ensureCacheDirExists.d.ts +2 -0
  54. package/types/ensureCacheDirExists.d.ts.map +1 -0
  55. package/types/index.d.ts +12 -0
  56. package/types/index.d.ts.map +1 -0
  57. package/types/prepareExtension.d.ts +4 -0
  58. package/types/prepareExtension.d.ts.map +1 -0
  59. package/types/prepareExtensionPhantom.d.ts +3 -0
  60. package/types/prepareExtensionPhantom.d.ts.map +1 -0
  61. package/types/unzipArchive.d.ts +18 -0
  62. package/types/unzipArchive.d.ts.map +1 -0
  63. package/types/utils/buildWalletSetupFunction.d.ts +2 -0
  64. package/types/utils/buildWalletSetupFunction.d.ts.map +1 -0
  65. package/types/utils/bytesToMegabytes.d.ts +2 -0
  66. package/types/utils/bytesToMegabytes.d.ts.map +1 -0
  67. package/types/utils/createCacheForWalletSetupFunction.d.ts +3 -0
  68. package/types/utils/createCacheForWalletSetupFunction.d.ts.map +1 -0
  69. package/types/utils/createTempContextDir.d.ts +9 -0
  70. package/types/utils/createTempContextDir.d.ts.map +1 -0
  71. package/types/utils/extractWalletSetupFunction.d.ts +2 -0
  72. package/types/utils/extractWalletSetupFunction.d.ts.map +1 -0
  73. package/types/utils/getUniqueWalletSetupFunctions.d.ts +6 -0
  74. package/types/utils/getUniqueWalletSetupFunctions.d.ts.map +1 -0
  75. package/types/utils/getWalletSetupFiles.d.ts +2 -0
  76. package/types/utils/getWalletSetupFiles.d.ts.map +1 -0
  77. package/types/utils/getWalletSetupFuncHash.d.ts +3 -0
  78. package/types/utils/getWalletSetupFuncHash.d.ts.map +1 -0
  79. package/types/utils/importWalletSetupFile.d.ts +6 -0
  80. package/types/utils/importWalletSetupFile.d.ts.map +1 -0
  81. package/types/utils/isDirEmpty.d.ts +2 -0
  82. package/types/utils/isDirEmpty.d.ts.map +1 -0
  83. package/types/utils/onDownloadProgress.d.ts +3 -0
  84. package/types/utils/onDownloadProgress.d.ts.map +1 -0
  85. package/types/utils/removeTempContextDir.d.ts +8 -0
  86. package/types/utils/removeTempContextDir.d.ts.map +1 -0
  87. package/types/utils/triggerCacheCreation.d.ts +6 -0
  88. package/types/utils/triggerCacheCreation.d.ts.map +1 -0
  89. package/types/utils/waitForExtensionOnLoadPage.d.ts +6 -0
  90. package/types/utils/waitForExtensionOnLoadPage.d.ts.map +1 -0
  91. package/README.md +0 -3
@@ -0,0 +1,192 @@
1
+ import type { BrowserContext, Page } from 'playwright-core'
2
+
3
+ // Increase timeout for CI environments
4
+ const EXTENSION_LOAD_TIMEOUT = 10000
5
+ // Increase max retries for CI environments
6
+ const MAX_RETRIES = 3
7
+ // Add delay between retries
8
+ const RETRY_DELAY_BASE = 1000
9
+ // Initial delay to ensure browser is fully initialized
10
+ const INITIAL_BROWSER_DELAY = 1000
11
+ // Max retries for fixing blank pages
12
+ const MAX_BLANK_PAGE_RETRIES = 5
13
+ // Delay after page reload
14
+ const RELOAD_DELAY = 1000
15
+ // Polling interval for finding extension page
16
+ const POLLING_INTERVAL = 500
17
+
18
+ const APP_SELECTORS = {
19
+ METAMASK: '#app-content .app',
20
+ PHANTOM: '#root'
21
+ }
22
+
23
+ const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
24
+
25
+ /**
26
+ * Checks if a page is blank (no MetaMask or Phantom app content)
27
+ */
28
+ async function isPageBlank(page: Page, extensionPath: string): Promise<boolean> {
29
+ const app = (extensionPath: string) => {
30
+ if (extensionPath.includes('metamask')) {
31
+ return 'METAMASK'
32
+ } else {
33
+ return 'PHANTOM'
34
+ }
35
+ }
36
+
37
+ try {
38
+ // Check for specific app element
39
+ const appElementCount = await page
40
+ .locator(APP_SELECTORS[app(extensionPath)])
41
+ .count()
42
+ .catch(() => 0)
43
+
44
+ if (appElementCount === 0) {
45
+ console.log(`[WaitForExtensionOnLoadPage] ${app(extensionPath)} app element not found, page appears to be blank`)
46
+ return true
47
+ }
48
+
49
+ return false
50
+ } catch (e) {
51
+ console.warn(
52
+ `[WaitForExtensionOnLoadPage] Error checking if page is blank: ${e instanceof Error ? e.message : String(e)}`
53
+ )
54
+ return true // Assume blank if we can't check
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Attempts to fix a blank page by reloading
60
+ */
61
+ async function fixBlankPage(page: Page, extensionPath: string): Promise<boolean> {
62
+ for (let attempt = 0; attempt < MAX_BLANK_PAGE_RETRIES; attempt++) {
63
+ console.log(`[WaitForExtensionOnLoadPage] Checking page state (attempt ${attempt + 1}/${MAX_BLANK_PAGE_RETRIES})`)
64
+
65
+ const isBlank = await isPageBlank(page, extensionPath)
66
+
67
+ if (isBlank) {
68
+ console.log('[WaitForExtensionOnLoadPage] Page is blank, reloading...')
69
+ await page.reload()
70
+ await sleep(RELOAD_DELAY)
71
+ } else {
72
+ console.log('[WaitForExtensionOnLoadPage] Page appears to be loaded correctly')
73
+ return true
74
+ }
75
+ }
76
+
77
+ console.warn('[WaitForExtensionOnLoadPage] Failed to fix blank/error page after multiple attempts')
78
+ return false
79
+ }
80
+
81
+ /**
82
+ * Finds an extension page in the current browser context
83
+ */
84
+ async function findExtensionPage(context: BrowserContext): Promise<Page | null> {
85
+ const pages = context.pages()
86
+ const extensionPage = pages.find((page) => {
87
+ try {
88
+ const url = page.url()
89
+ return url.startsWith('chrome-extension://')
90
+ } catch (e) {
91
+ return false
92
+ }
93
+ })
94
+
95
+ return extensionPage || null
96
+ }
97
+
98
+ /**
99
+ * Waits for the extension page to load and ensures it's not blank or has errors
100
+ */
101
+ export async function waitForExtensionOnLoadPage(context: BrowserContext, extensionPath: string): Promise<Page> {
102
+ const { errors: playwrightErrors } = await import('playwright-core')
103
+ let retries = 0
104
+ console.log(
105
+ `[WaitForExtensionOnLoadPage] Starting with timeout: ${EXTENSION_LOAD_TIMEOUT}ms and max retries: ${MAX_RETRIES}`
106
+ )
107
+
108
+ // Initial delay to ensure browser is fully initialized
109
+ console.log(`[WaitForExtensionOnLoadPage] Waiting ${INITIAL_BROWSER_DELAY}ms for browser to initialize...`)
110
+ await sleep(INITIAL_BROWSER_DELAY)
111
+
112
+ const startTime = Date.now()
113
+
114
+ while (retries <= MAX_RETRIES) {
115
+ try {
116
+ console.log(
117
+ `[WaitForExtensionOnLoadPage] Looking for extension page (attempt ${retries + 1}/${MAX_RETRIES + 1})...`
118
+ )
119
+
120
+ // Poll for extension page until timeout
121
+ let extensionPage: Page | null = null
122
+ let pollingAttempts = 0
123
+ const maxPollingAttempts = Math.floor(EXTENSION_LOAD_TIMEOUT / POLLING_INTERVAL)
124
+
125
+ while (pollingAttempts < maxPollingAttempts) {
126
+ extensionPage = await findExtensionPage(context)
127
+
128
+ if (extensionPage) {
129
+ console.log(`[WaitForExtensionOnLoadPage] Found extension page after ${pollingAttempts + 1} polling attempts`)
130
+ break
131
+ }
132
+
133
+ pollingAttempts++
134
+ console.log(
135
+ `[WaitForExtensionOnLoadPage] No extension page found, polling (${pollingAttempts}/${maxPollingAttempts})...`
136
+ )
137
+ await sleep(POLLING_INTERVAL)
138
+ }
139
+
140
+ if (!extensionPage) {
141
+ throw new playwrightErrors.TimeoutError(
142
+ `Timed out waiting for extension page after ${EXTENSION_LOAD_TIMEOUT}ms`
143
+ )
144
+ }
145
+
146
+ // Now check if the page is blank or has errors and fix if needed
147
+ console.log('[WaitForExtensionOnLoadPage] Checking if extension page is properly loaded...')
148
+ const isFixed = await fixBlankPage(extensionPage, extensionPath)
149
+
150
+ if (isFixed) {
151
+ console.log('[WaitForExtensionOnLoadPage] Extension page is properly loaded and ready')
152
+ return extensionPage
153
+ } else {
154
+ throw new Error('Failed to fix blank or error page')
155
+ }
156
+ } catch (e) {
157
+ retries++
158
+
159
+ // Log more detailed information about the current browser state
160
+ const pages = context.pages()
161
+ console.log(`[WaitForExtensionOnLoadPage] Current browser has ${pages.length} pages open`)
162
+ for (let i = 0; i < pages.length; i++) {
163
+ const page = pages[i]
164
+ if (page) {
165
+ try {
166
+ console.log(`[WaitForExtensionOnLoadPage] Page ${i + 1}: ${page.url()}`)
167
+ } catch (urlError) {
168
+ console.log(`[WaitForExtensionOnLoadPage] Page ${i + 1}: Unable to get URL`)
169
+ }
170
+ }
171
+ }
172
+
173
+ if (retries <= MAX_RETRIES) {
174
+ const delayTime = RETRY_DELAY_BASE * retries
175
+ console.warn(
176
+ `[WaitForExtensionOnLoadPage] Extension page issue, retrying (attempt ${retries}/${MAX_RETRIES}) after ${delayTime}ms delay...`
177
+ )
178
+
179
+ await sleep(delayTime)
180
+ continue
181
+ }
182
+
183
+ const elapsedTime = Date.now() - startTime
184
+ throw new Error(
185
+ `[WaitForExtensionOnLoadPage] Extension failed to load properly after ${elapsedTime}ms and ${retries} attempts!`
186
+ )
187
+ }
188
+ }
189
+
190
+ // This should never be reached
191
+ throw new Error('[WaitForExtensionOnLoadPage] Unexpected end of function reached')
192
+ }
@@ -0,0 +1,2 @@
1
+ export declare const cliEntrypoint: () => Promise<void>;
2
+ //# sourceMappingURL=cliEntrypoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cliEntrypoint.d.ts","sourceRoot":"","sources":["../../src/cli/cliEntrypoint.ts"],"names":[],"mappings":"AA+BA,eAAO,MAAM,aAAa,qBAwEzB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const FIXES_BANNER: string;
2
+ //# sourceMappingURL=compilationFixes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compilationFixes.d.ts","sourceRoot":"","sources":["../../src/cli/compilationFixes.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,YAAY,QAMZ,CAAA"}
@@ -0,0 +1,5 @@
1
+ export declare function compileWalletSetupFunctions(walletSetupDir: string, debug: boolean): Promise<{
2
+ outDir: string;
3
+ setupFunctionHashes: string[];
4
+ }>;
5
+ //# sourceMappingURL=compileWalletSetupFunctions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compileWalletSetupFunctions.d.ts","sourceRoot":"","sources":["../../src/cli/compileWalletSetupFunctions.ts"],"names":[],"mappings":"AAeA,wBAAsB,2BAA2B,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;;;GAyDvF"}
@@ -0,0 +1,2 @@
1
+ export declare const footer: string;
2
+ //# sourceMappingURL=footer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../src/cli/footer.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM,QAA0C,CAAA"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export declare const CACHE_DIR_NAME = ".cache-synpress";
2
+ export declare const WALLET_SETUP_DIR_NAME = "wallet-setup";
3
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,oBAAoB,CAAA;AAE/C,eAAO,MAAM,qBAAqB,iBAAiB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare function createCache(walletSetupDirPath: string, hashes: string[], downloadExtension: () => Promise<string>, force?: boolean): Promise<void>;
2
+ //# sourceMappingURL=createCache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createCache.d.ts","sourceRoot":"","sources":["../src/createCache.ts"],"names":[],"mappings":"AAGA,wBAAsB,WAAW,CAC/B,kBAAkB,EAAE,MAAM,EAC1B,MAAM,EAAE,MAAM,EAAE,EAChB,iBAAiB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACxC,KAAK,UAAQ,iBAYd"}
@@ -0,0 +1,17 @@
1
+ import type { BrowserContext, Page } from 'playwright-core';
2
+ export type WalletSetupFunction = (context: BrowserContext, walletPage: Page) => Promise<void>;
3
+ /**
4
+ * This function is used to define how a wallet should be set up.
5
+ * Based on the contents of this function, a browser with the wallet extension is set up and cached so that it can be used by the tests later.
6
+ *
7
+ * @param walletPassword - The password of the wallet.
8
+ * @param fn - A function describing the setup of the wallet.
9
+ *
10
+ * @returns An object containing the hash of the function, the function itself, and the wallet password. The `testWithWalletSetup` function uses this object.
11
+ */
12
+ export declare function defineWalletSetup(walletPassword: string, fn: WalletSetupFunction): {
13
+ hash: string;
14
+ fn: WalletSetupFunction;
15
+ walletPassword: string;
16
+ };
17
+ //# sourceMappingURL=defineWalletSetup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineWalletSetup.d.ts","sourceRoot":"","sources":["../src/defineWalletSetup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAK3D,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAG9F;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE,EAAE,mBAAmB;;;;EAUhF"}
@@ -0,0 +1,13 @@
1
+ type DownloaderOptions = {
2
+ url: string;
3
+ outputDir: string;
4
+ fileName: string;
5
+ overrideFile?: boolean;
6
+ };
7
+ type DownloadFileResult = {
8
+ filePath: string;
9
+ downloadSkipped: boolean;
10
+ };
11
+ export declare function downloadFile(options: DownloaderOptions): Promise<DownloadFileResult>;
12
+ export {};
13
+ //# sourceMappingURL=downloadFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"downloadFile.d.ts","sourceRoot":"","sources":["../src/downloadFile.ts"],"names":[],"mappings":"AAKA,KAAK,iBAAiB,GAAG;IACvB,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,EAAE,OAAO,CAAA;CACzB,CAAA;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,iBAAiB,+BAiD5D"}
@@ -0,0 +1,2 @@
1
+ export declare function ensureCacheDirExists(): string;
2
+ //# sourceMappingURL=ensureCacheDirExists.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureCacheDirExists.d.ts","sourceRoot":"","sources":["../src/ensureCacheDirExists.ts"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB,WAInC"}
@@ -0,0 +1,12 @@
1
+ export * from './constants';
2
+ export * from './downloadFile';
3
+ export * from './unzipArchive';
4
+ export * from './ensureCacheDirExists';
5
+ export * from './createCache';
6
+ export * from './defineWalletSetup';
7
+ export * from './utils/createTempContextDir';
8
+ export * from './utils/removeTempContextDir';
9
+ export * from './prepareExtension';
10
+ export * from './cli/cliEntrypoint';
11
+ export * from './prepareExtensionPhantom';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA"}
@@ -0,0 +1,4 @@
1
+ export declare const DEFAULT_METAMASK_VERSION = "13.13.1";
2
+ export declare const EXTENSION_DOWNLOAD_URL = "https://github.com/MetaMask/metamask-extension/releases/download/v13.13.1/metamask-chrome-13.13.1.zip";
3
+ export declare function prepareExtension(): Promise<string>;
4
+ //# sourceMappingURL=prepareExtension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareExtension.d.ts","sourceRoot":"","sources":["../src/prepareExtension.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB,YAAY,CAAA;AACjD,eAAO,MAAM,sBAAsB,0GAAkJ,CAAA;AAGrL,wBAAsB,gBAAgB,oBAcrC"}
@@ -0,0 +1,3 @@
1
+ export declare const PHANTOM_EXTENSION_DOWNLOAD_URL = "https://crx-backup.phantom.dev/latest.crx";
2
+ export declare function prepareExtensionPhantom(): Promise<string>;
3
+ //# sourceMappingURL=prepareExtensionPhantom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareExtensionPhantom.d.ts","sourceRoot":"","sources":["../src/prepareExtensionPhantom.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,8BAA8B,8CAA8C,CAAA;AAGzF,wBAAsB,uBAAuB,oBAc5C"}
@@ -0,0 +1,18 @@
1
+ type UnzipArchiveOptions = {
2
+ archivePath: string;
3
+ overwrite?: boolean;
4
+ };
5
+ type UnzipArchiveResult = {
6
+ outputPath: string;
7
+ unzipSkipped: boolean;
8
+ };
9
+ export declare function unzipArchive(options: UnzipArchiveOptions): Promise<UnzipArchiveResult>;
10
+ export declare function unzipArchivePhantom(options: UnzipArchiveOptions): Promise<{
11
+ outputPath: string;
12
+ unzipSkipped: boolean;
13
+ } | {
14
+ outputPath: string;
15
+ unzipSkipped?: never;
16
+ }>;
17
+ export {};
18
+ //# sourceMappingURL=unzipArchive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unzipArchive.d.ts","sourceRoot":"","sources":["../src/unzipArchive.ts"],"names":[],"mappings":"AAKA,KAAK,mBAAmB,GAAG;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,mBAAmB,+BA4D9D;AAED,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,mBAAmB;;;;;;GAsBrE"}
@@ -0,0 +1,2 @@
1
+ export default function buildWalletSetupFunction(walletSetupFunctionString: string): string;
2
+ //# sourceMappingURL=buildWalletSetupFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildWalletSetupFunction.d.ts","sourceRoot":"","sources":["../../src/utils/buildWalletSetupFunction.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,yBAAyB,EAAE,MAAM,UAYjF"}
@@ -0,0 +1,2 @@
1
+ export declare function bytesToMegabytes(bytes: number): number;
2
+ //# sourceMappingURL=bytesToMegabytes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bytesToMegabytes.d.ts","sourceRoot":"","sources":["../../src/utils/bytesToMegabytes.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,UAG7C"}
@@ -0,0 +1,3 @@
1
+ import type { WalletSetupFunction } from '../defineWalletSetup';
2
+ export declare function createCacheForWalletSetupFunction(extensionPath: string, contextCacheDirPath: string, walletSetup: WalletSetupFunction, fileName: string): Promise<void>;
3
+ //# sourceMappingURL=createCacheForWalletSetupFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createCacheForWalletSetupFunction.d.ts","sourceRoot":"","sources":["../../src/utils/createCacheForWalletSetupFunction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAM/D,wBAAsB,iCAAiC,CACrD,aAAa,EAAE,MAAM,EACrB,mBAAmB,EAAE,MAAM,EAC3B,WAAW,EAAE,mBAAmB,EAChC,QAAQ,EAAE,MAAM,iBAgCjB"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Creates a temporary context directory.
3
+ * This directory should be created per-worker basis.
4
+ *
5
+ * This function mirrors the one found in the Playwright source code:
6
+ * https://github.com/microsoft/playwright/blob/d1d5fc67dc684a5d4b682749e59bba8cc0ad14de/packages/playwright-core/src/server/browserType.ts#L161
7
+ */
8
+ export declare function createTempContextDir(browserName: string, testId: string): Promise<string>;
9
+ //# sourceMappingURL=createTempContextDir.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTempContextDir.d.ts","sourceRoot":"","sources":["../../src/utils/createTempContextDir.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mBAE7E"}
@@ -0,0 +1,2 @@
1
+ export declare function extractWalletSetupFunction(sourceCode: string): string;
2
+ //# sourceMappingURL=extractWalletSetupFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractWalletSetupFunction.d.ts","sourceRoot":"","sources":["../../src/utils/extractWalletSetupFunction.ts"],"names":[],"mappings":"AAAA,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAWrE"}
@@ -0,0 +1,6 @@
1
+ import type { WalletSetupFunction } from '../defineWalletSetup';
2
+ export declare function getUniqueWalletSetupFunctions(walletSetupDirPath: string): Promise<Map<string, {
3
+ fileName: string;
4
+ setupFunction: WalletSetupFunction;
5
+ }>>;
6
+ //# sourceMappingURL=getUniqueWalletSetupFunctions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUniqueWalletSetupFunctions.d.ts","sourceRoot":"","sources":["../../src/utils/getUniqueWalletSetupFunctions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAM/D,wBAAsB,6BAA6B,CAAC,kBAAkB,EAAE,MAAM;cAGzB,MAAM;mBAAiB,mBAAmB;IA0B9F"}
@@ -0,0 +1,2 @@
1
+ export declare function getWalletSetupFiles(walletSetupDirPath: string): Promise<string[]>;
2
+ //# sourceMappingURL=getWalletSetupFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getWalletSetupFiles.d.ts","sourceRoot":"","sources":["../../src/utils/getWalletSetupFiles.ts"],"names":[],"mappings":"AAIA,wBAAsB,mBAAmB,CAAC,kBAAkB,EAAE,MAAM,qBA0BnE"}
@@ -0,0 +1,3 @@
1
+ export declare const WALLET_SETUP_FUNC_HASH_LENGTH = 10;
2
+ export declare function getWalletSetupFuncHash(walletSetupString: string): string;
3
+ //# sourceMappingURL=getWalletSetupFuncHash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getWalletSetupFuncHash.d.ts","sourceRoot":"","sources":["../../src/utils/getWalletSetupFuncHash.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,6BAA6B,KAAK,CAAA;AAE/C,wBAAgB,sBAAsB,CAAC,iBAAiB,EAAE,MAAM,UAM/D"}
@@ -0,0 +1,6 @@
1
+ import type { WalletSetupFunction } from '../defineWalletSetup';
2
+ export declare function importWalletSetupFile(walletSetupFilePath: string): Promise<{
3
+ hash: string;
4
+ fn: WalletSetupFunction;
5
+ }>;
6
+ //# sourceMappingURL=importWalletSetupFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importWalletSetupFile.d.ts","sourceRoot":"","sources":["../../src/utils/importWalletSetupFile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAU/D,wBAAsB,qBAAqB,CAAC,mBAAmB,EAAE,MAAM;;;GAoBtE"}
@@ -0,0 +1,2 @@
1
+ export declare function isDirEmpty(dirPath: string): Promise<boolean>;
2
+ //# sourceMappingURL=isDirEmpty.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isDirEmpty.d.ts","sourceRoot":"","sources":["../../src/utils/isDirEmpty.ts"],"names":[],"mappings":"AAEA,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,oBAY/C"}
@@ -0,0 +1,3 @@
1
+ import type { AxiosProgressEvent } from 'axios';
2
+ export declare function onDownloadProgress(url: string, fileName: string): ({ loaded: downloadedBytes, total: totalDownloadBytes }: AxiosProgressEvent) => void;
3
+ //# sourceMappingURL=onDownloadProgress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onDownloadProgress.d.ts","sourceRoot":"","sources":["../../src/utils/onDownloadProgress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAI/C,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,4DAIE,kBAAkB,UAenF"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Removes the temporary context directory created per-worker basis.
3
+ *
4
+ * This function mirrors the one found in the Playwright source code:
5
+ * https://github.com/microsoft/playwright/blob/d1d5fc67dc684a5d4b682749e59bba8cc0ad14de/packages/playwright-core/src/utils/processLauncher.ts#L142
6
+ */
7
+ export declare function removeTempContextDir(contextDirPath: string): Promise<Error | null>;
8
+ //# sourceMappingURL=removeTempContextDir.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeTempContextDir.d.ts","sourceRoot":"","sources":["../../src/utils/removeTempContextDir.ts"],"names":[],"mappings":"AAUA;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,cAAc,EAAE,MAAM,yBAMhE"}
@@ -0,0 +1,6 @@
1
+ import type { WalletSetupFunction } from '../defineWalletSetup';
2
+ export declare function triggerCacheCreation(setupFunctions: Map<string, {
3
+ fileName: string;
4
+ setupFunction: WalletSetupFunction;
5
+ }>, hashes: string[], downloadExtension: () => Promise<string>, force: boolean): Promise<void[]>;
6
+ //# sourceMappingURL=triggerCacheCreation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triggerCacheCreation.d.ts","sourceRoot":"","sources":["../../src/utils/triggerCacheCreation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAK/D,wBAAsB,oBAAoB,CACxC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,mBAAmB,CAAA;CAAE,CAAC,EACrF,MAAM,EAAE,MAAM,EAAE,EAChB,iBAAiB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACxC,KAAK,EAAE,OAAO,mBAsCf"}
@@ -0,0 +1,6 @@
1
+ import { type BrowserContext, type Page } from 'playwright-core';
2
+ /**
3
+ * Waits for the extension page to load and ensures it's not blank or has errors
4
+ */
5
+ export declare function waitForExtensionOnLoadPage(context: BrowserContext, extensionPath: string): Promise<Page>;
6
+ //# sourceMappingURL=waitForExtensionOnLoadPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waitForExtensionOnLoadPage.d.ts","sourceRoot":"","sources":["../../src/utils/waitForExtensionOnLoadPage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAA8B,MAAM,iBAAiB,CAAA;AAiG5F;;GAEG;AACH,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0F9G"}
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.