@prosopo/procaptcha-bundle 4.1.33 → 4.1.35
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/.turbo/turbo-build$colon$cjs.log +4 -4
- package/.turbo/turbo-build$colon$tsc.log +27 -27
- package/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +42 -0
- package/dist/cjs/util/language.cjs +10 -2
- package/dist/cjs/util/widgetFactory.cjs +7 -3
- package/dist/util/language.d.ts +1 -0
- package/dist/util/language.d.ts.map +1 -1
- package/dist/util/language.js +10 -2
- package/dist/util/language.js.map +1 -1
- package/dist/util/widgetFactory.d.ts +1 -1
- package/dist/util/widgetFactory.d.ts.map +1 -1
- package/dist/util/widgetFactory.js +7 -3
- package/dist/util/widgetFactory.js.map +1 -1
- package/package.json +5 -5
- package/src/util/language.ts +19 -2
- package/src/util/widgetFactory.ts +18 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/vite.config.ts +24 -0
package/vite.config.ts
CHANGED
|
@@ -30,6 +30,16 @@ import { defineConfig } from "vite";
|
|
|
30
30
|
// static URL blocklists.
|
|
31
31
|
const honeypotChunkName = `c${randomBytes(4).toString("hex")}`;
|
|
32
32
|
|
|
33
|
+
// Per-build opaque chunk name for the module that holds `@prosopo/fingerprint`
|
|
34
|
+
// + `@prosopo/fingerprintjs`. Same rationale as `honeypotChunkName` — but the
|
|
35
|
+
// primary reason for pulling these into a single shared chunk is dedup: prior
|
|
36
|
+
// to this the module was inlined into multiple downstream chunks (widget
|
|
37
|
+
// bundle + procaptcha-pow), each with its own module-local `componentsCache`,
|
|
38
|
+
// so the fingerprint sources (canvas / WebGL `getContext` / `getParameter` /
|
|
39
|
+
// `getImageData` — expensive on real GPUs) ran twice per widget session. One
|
|
40
|
+
// shared chunk = one module instance = one populated cache = one run.
|
|
41
|
+
const sharedBrowserChunkName = `b${randomBytes(4).toString("hex")}`;
|
|
42
|
+
|
|
33
43
|
// load env using our util because vite loadEnv is not working for .env.development
|
|
34
44
|
loadEnv();
|
|
35
45
|
|
|
@@ -106,6 +116,20 @@ export default defineConfig(async ({ command, mode }) => {
|
|
|
106
116
|
) {
|
|
107
117
|
return honeypotChunkName;
|
|
108
118
|
}
|
|
119
|
+
// Force @prosopo/fingerprint + @prosopo/fingerprintjs into one
|
|
120
|
+
// shared chunk. Without this, Vite inlines them into every
|
|
121
|
+
// downstream chunk that imports them (widget bundle for the
|
|
122
|
+
// account/frictionless flow, procaptcha-pow for the challenge
|
|
123
|
+
// proof), giving each chunk its own module-local
|
|
124
|
+
// `componentsCache` — so the canvas / WebGL fingerprint sources
|
|
125
|
+
// run once per copy, costing ~220ms of main-thread work per
|
|
126
|
+
// duplicate. One chunk = one instance = one cache hit.
|
|
127
|
+
if (
|
|
128
|
+
id.includes("packages/fingerprint/dist") ||
|
|
129
|
+
id.includes("packages/fingerprintjs/dist")
|
|
130
|
+
) {
|
|
131
|
+
return sharedBrowserChunkName;
|
|
132
|
+
}
|
|
109
133
|
if (id.includes("wasm-crypto-wasm")) {
|
|
110
134
|
return "web3Chunk";
|
|
111
135
|
}
|