@prosopo/client-bundle-example 2.11.0 → 2.11.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/.turbo/turbo-build$colon$cjs.log +2 -2
- package/.turbo/turbo-build$colon$tsc.log +11 -11
- package/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +5 -0
- package/package.json +5 -5
- package/src/plugins/layout-injector.ts +19 -1
- package/src/tests/plugins.unit.test.ts +42 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/client-bundle-example@2.11.
|
|
2
|
+
> @prosopo/client-bundle-example@2.11.1 build:cjs
|
|
3
3
|
> NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
|
|
4
4
|
|
|
5
5
|
ViteCommonJSConfig: .
|
|
@@ -33,4 +33,4 @@ computing gzip size...
|
|
|
33
33
|
dist/cjs/index.cjs 0.71 kB │ gzip: 0.27 kB
|
|
34
34
|
dist/cjs/plugins/pages.cjs 4.63 kB │ gzip: 1.20 kB
|
|
35
35
|
|
|
36
|
-
[32m✓ built in
|
|
36
|
+
[32m✓ built in 66ms[39m
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/client-bundle-example@2.11.
|
|
2
|
+
> @prosopo/client-bundle-example@2.11.1 build:tsc
|
|
3
3
|
> tsc --build --verbose
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
3:36:52 PM - Projects in this build:
|
|
6
6
|
* ../../dev/config/tsconfig.json
|
|
7
7
|
* ../../packages/util/tsconfig.json
|
|
8
8
|
* ../../packages/logger/tsconfig.json
|
|
@@ -12,21 +12,21 @@
|
|
|
12
12
|
* ../../packages/types/tsconfig.json
|
|
13
13
|
* tsconfig.json
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
3:36:52 PM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/webpack/webpack.config.ts' is older than output '../../dev/config/tsconfig.tsbuildinfo'
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
3:36:52 PM - Project '../../packages/util/tsconfig.json' is up to date because newest input '../../packages/util/src/url.ts' is older than output '../../packages/util/tsconfig.tsbuildinfo'
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
3:36:52 PM - Project '../../packages/logger/tsconfig.json' is up to date because newest input '../../packages/logger/src/index.ts' is older than output '../../packages/logger/tsconfig.tsbuildinfo'
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
3:36:52 PM - Project '../../packages/dotenv/tsconfig.json' is up to date because newest input '../../packages/dotenv/src/index.ts' is older than output '../../packages/dotenv/tsconfig.tsbuildinfo'
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
3:36:52 PM - Project '../../packages/locale/tsconfig.json' is up to date because newest input '../../packages/locale/src/translationKey.ts' is older than output '../../packages/locale/tsconfig.tsbuildinfo'
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
3:36:52 PM - Project '../../packages/util-crypto/tsconfig.json' is up to date because newest input '../../packages/util-crypto/src/types.ts' is older than output '../../packages/util-crypto/tsconfig.tsbuildinfo'
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
3:36:52 PM - Project '../../packages/types/tsconfig.json' is up to date because newest input '../../packages/types/src/types.test-d.ts' is older than output '../../packages/types/tsconfig.tsbuildinfo'
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
3:36:52 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
3:36:52 PM - Building project '/home/runner/work/captcha/captcha/demos/client-bundle-example/tsconfig.json'...
|
|
32
32
|
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/client-bundle-example@2.11.
|
|
2
|
+
> @prosopo/client-bundle-example@2.11.1 build
|
|
3
3
|
> npm run build:cross-env -- --mode ${NODE_ENV:-development}
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @prosopo/client-bundle-example@2.11.
|
|
6
|
+
> @prosopo/client-bundle-example@2.11.1 build:cross-env
|
|
7
7
|
> vite build --config vite.esm.config.ts --mode production
|
|
8
8
|
|
|
9
9
|
ViteEsmConfig: .
|
|
@@ -38,4 +38,4 @@ dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
|
|
|
38
38
|
dist/index.js 0.42 kB │ gzip: 0.19 kB
|
|
39
39
|
dist/plugins/pages.js 4.04 kB │ gzip: 1.15 kB
|
|
40
40
|
|
|
41
|
-
[32m✓ built in
|
|
41
|
+
[32m✓ built in 67ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# @prosopo/client-bundle-example
|
|
2
2
|
|
|
3
|
+
## 2.11.1
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- 495c016: The public demo at demo.prosopo.io now reports page views to Plausible under the `demo.prosopo.io` site, so we can see who uses it. The tracker only loads on that exact host, so local runs, staging and the Cypress suite send nothing.
|
|
7
|
+
|
|
3
8
|
## 2.11.0
|
|
4
9
|
### Minor Changes
|
|
5
10
|
|
package/package.json
CHANGED
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"start": "NODE_ENV=${NODE_ENV:-development}; vite serve ./src --port 9232 --config vite.config.ts --mode=$NODE_ENV",
|
|
26
26
|
"test": "NODE_ENV=${NODE_ENV:-test}; npx vitest run --config ./vite.test.config.ts"
|
|
27
27
|
},
|
|
28
|
-
"version": "2.11.
|
|
28
|
+
"version": "2.11.1",
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@emotion/cache": "11.14.0",
|
|
31
|
-
"@prosopo/config": "3.
|
|
32
|
-
"@prosopo/dotenv": "3.0.
|
|
33
|
-
"@prosopo/locale": "3.
|
|
34
|
-
"@prosopo/types": "5.
|
|
31
|
+
"@prosopo/config": "3.4.1",
|
|
32
|
+
"@prosopo/dotenv": "3.0.57",
|
|
33
|
+
"@prosopo/locale": "3.6.0",
|
|
34
|
+
"@prosopo/types": "5.10.2",
|
|
35
35
|
"@types/node": "22.5.5",
|
|
36
36
|
"@vitest/coverage-v8": "4.1.11",
|
|
37
37
|
"concurrently": "9.0.1",
|
|
@@ -40,13 +40,31 @@ const DOCS_URL = "https://docs.prosopo.io/";
|
|
|
40
40
|
const ariaCurrent = (isCurrent: boolean): string =>
|
|
41
41
|
isCurrent ? ' aria-current="page"' : "";
|
|
42
42
|
|
|
43
|
+
export const DEMO_HOSTNAME = "demo.prosopo.io";
|
|
44
|
+
const PLAUSIBLE_SCRIPT_URL =
|
|
45
|
+
"https://prosopo.io/js/script.kairee5buy1chae8eit0so8ahphae9Oo.js";
|
|
46
|
+
|
|
47
|
+
// Only the public demo reports to Plausible: local runs and the Cypress suite
|
|
48
|
+
// serve these same pages.
|
|
49
|
+
const analyticsTag = `
|
|
50
|
+
<script>
|
|
51
|
+
(function () {
|
|
52
|
+
if (location.hostname !== "${DEMO_HOSTNAME}") return;
|
|
53
|
+
var tracker = document.createElement("script");
|
|
54
|
+
tracker.defer = true;
|
|
55
|
+
tracker.setAttribute("data-domain", "${DEMO_HOSTNAME}");
|
|
56
|
+
tracker.src = "${PLAUSIBLE_SCRIPT_URL}";
|
|
57
|
+
document.head.appendChild(tracker);
|
|
58
|
+
})();
|
|
59
|
+
</script>`;
|
|
60
|
+
|
|
43
61
|
const headTags = (prefix: string): string => `
|
|
44
62
|
<meta charset="utf-8">
|
|
45
63
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
|
46
64
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
47
65
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
48
66
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700;800&display=swap">
|
|
49
|
-
<link rel="stylesheet" href="${prefix}styles/demo.css"
|
|
67
|
+
<link rel="stylesheet" href="${prefix}styles/demo.css">${analyticsTag}`;
|
|
50
68
|
|
|
51
69
|
const header = `
|
|
52
70
|
<header class="demo-header">
|
|
@@ -24,7 +24,7 @@ import codeSnippetInjector, {
|
|
|
24
24
|
snippetFor,
|
|
25
25
|
} from "../plugins/code-snippet-injector.js";
|
|
26
26
|
import formFillerInjector from "../plugins/form-filler-injector.js";
|
|
27
|
-
import layoutInjector from "../plugins/layout-injector.js";
|
|
27
|
+
import layoutInjector, { DEMO_HOSTNAME } from "../plugins/layout-injector.js";
|
|
28
28
|
import {
|
|
29
29
|
type DemoRendering,
|
|
30
30
|
demoPages,
|
|
@@ -161,6 +161,47 @@ describe("layoutInjector", () => {
|
|
|
161
161
|
);
|
|
162
162
|
});
|
|
163
163
|
|
|
164
|
+
it("loads Plausible only when served from the public demo host", () => {
|
|
165
|
+
const html = handler(page(), ctx(`${cwd}/src/pow-explicit.html`));
|
|
166
|
+
const inlineScript = html.match(
|
|
167
|
+
/<script>\s*\(function \(\) \{([\s\S]*?)\}\)\(\);\s*<\/script>/,
|
|
168
|
+
)?.[1];
|
|
169
|
+
expect(inlineScript).toBeDefined();
|
|
170
|
+
|
|
171
|
+
type FakeElement = Record<string, unknown>;
|
|
172
|
+
const loadedFrom = (hostname: string): FakeElement[] => {
|
|
173
|
+
const appended: FakeElement[] = [];
|
|
174
|
+
const fakeDocument = {
|
|
175
|
+
createElement: (): FakeElement => {
|
|
176
|
+
const element: FakeElement = {};
|
|
177
|
+
element.setAttribute = (name: string, value: string): void => {
|
|
178
|
+
element[name] = value;
|
|
179
|
+
};
|
|
180
|
+
return element;
|
|
181
|
+
},
|
|
182
|
+
head: {
|
|
183
|
+
appendChild: (element: FakeElement): void => {
|
|
184
|
+
appended.push(element);
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
new Function("location", "document", inlineScript ?? "")(
|
|
189
|
+
{ hostname },
|
|
190
|
+
fakeDocument,
|
|
191
|
+
);
|
|
192
|
+
return appended;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
expect(loadedFrom("localhost")).toHaveLength(0);
|
|
196
|
+
expect(loadedFrom(`staging.${DEMO_HOSTNAME}`)).toHaveLength(0);
|
|
197
|
+
const [tracker] = loadedFrom(DEMO_HOSTNAME);
|
|
198
|
+
expect(tracker).toMatchObject({
|
|
199
|
+
defer: true,
|
|
200
|
+
"data-domain": DEMO_HOSTNAME,
|
|
201
|
+
src: "https://prosopo.io/js/script.kairee5buy1chae8eit0so8ahphae9Oo.js",
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
|
|
164
205
|
it("marks the current type, mode and rendering", () => {
|
|
165
206
|
const html = handler(page(), ctx(`${cwd}/src/pow-explicit.html`));
|
|
166
207
|
|