@botpress/webchat 2.6.2-beta.0 → 3.0.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.
- package/.turbo/turbo-build.log +8 -9
- package/check-bundle-size.js +68 -0
- package/dist/index.d.ts +123 -13360
- package/dist/index.js +21298 -32502
- package/dist/index.umd.cjs +224 -85
- package/dist/style.css +1 -1
- package/package.json +10 -14
- package/tailwind.config.js +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/webchat@
|
|
2
|
+
> @botpress/webchat@3.0.0 build /home/runner/work/genisys/genisys/packages/webchat-components
|
|
3
3
|
> vite build
|
|
4
4
|
|
|
5
5
|
[36mvite v5.4.8 [32mbuilding for production...[36m[39m
|
|
6
6
|
transforming...
|
|
7
|
-
[
|
|
8
|
-
[32m✓[39m 2984 modules transformed.
|
|
7
|
+
[32m✓[39m 3046 modules transformed.
|
|
9
8
|
rendering chunks...
|
|
10
9
|
|
|
11
10
|
[vite:dts] Start generate declaration files...
|
|
12
11
|
computing gzip size...
|
|
13
|
-
[2mdist/[22m[35mstyle.css [39m[1m[2m
|
|
14
|
-
[2mdist/[22m[36mindex.js [39m[1m[
|
|
12
|
+
[2mdist/[22m[35mstyle.css [39m[1m[2m 44.76 kB[22m[1m[22m[2m │ gzip: 8.25 kB[22m
|
|
13
|
+
[2mdist/[22m[36mindex.js [39m[1m[33m776.75 kB[39m[22m[2m │ gzip: 212.99 kB[22m
|
|
15
14
|
[vite:dts] Start rollup declaration files...
|
|
16
15
|
Analysis will use the bundled TypeScript version 5.4.2
|
|
17
16
|
*** The target project appears to use TypeScript 5.6.2 which is newer than the bundled compiler engine; consider upgrading API Extractor.
|
|
18
|
-
[vite:dts] Declaration files built in
|
|
17
|
+
[vite:dts] Declaration files built in 21441ms.
|
|
19
18
|
|
|
20
|
-
[2mdist/[22m[35mstyle.css [39m[1m[2m
|
|
21
|
-
[2mdist/[22m[36mindex.umd.cjs [39m[1m[
|
|
22
|
-
[32m✓ built in
|
|
19
|
+
[2mdist/[22m[35mstyle.css [39m[1m[2m 44.76 kB[22m[1m[22m[2m │ gzip: 8.25 kB[22m
|
|
20
|
+
[2mdist/[22m[36mindex.umd.cjs [39m[1m[33m517.62 kB[39m[22m[2m │ gzip: 174.18 kB[22m
|
|
21
|
+
[32m✓ built in 28.74s[39m
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import zlib from 'node:zlib'
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
|
|
4
|
+
const ESM_BUNDLE_SIZE_LIMIT = 250000
|
|
5
|
+
const CJS_BUNDLE_SIZE_LIMIT = 200000
|
|
6
|
+
|
|
7
|
+
class BundleSizeExceededError extends Error {
|
|
8
|
+
constructor(filePath, maxSize, actualSize) {
|
|
9
|
+
super(
|
|
10
|
+
`BUNDLE SIZE EXCEEDED: ${filePath} exceeded max size of ${maxSize / 1000}kB. Actual size is ${actualSize / 1000}kB (gzipped).`
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
class BundleSizeInfo {
|
|
16
|
+
constructor(filePath, actualSize) {
|
|
17
|
+
this.message = `BUNDLE SIZE OK: ${filePath} actual size is ${actualSize / 1000}kB (gzipped).`
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function reportResults(results) {
|
|
22
|
+
let failed = false
|
|
23
|
+
|
|
24
|
+
for (const result of results) {
|
|
25
|
+
if (result.status === 'rejected') {
|
|
26
|
+
failed = true
|
|
27
|
+
if (result.reason instanceof BundleSizeExceededError) {
|
|
28
|
+
console.error(result.reason.message)
|
|
29
|
+
} else {
|
|
30
|
+
console.error('An unknown error occured when computing the bundle size')
|
|
31
|
+
console.error(result.reason)
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
console.log(result.value.message)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (failed) {
|
|
39
|
+
process.exit(-1)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async function assertGzipSizeBelowThreshold(filePath, maxBytes) {
|
|
44
|
+
const size = await getGzipSize(filePath)
|
|
45
|
+
|
|
46
|
+
if (size > maxBytes) {
|
|
47
|
+
throw new BundleSizeExceededError(filePath, maxBytes, size)
|
|
48
|
+
} else {
|
|
49
|
+
return new BundleSizeInfo(filePath, size)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function getGzipSize(filePath) {
|
|
54
|
+
const gzipStream = fs.createReadStream(filePath).pipe(zlib.createGzip())
|
|
55
|
+
|
|
56
|
+
let size = 0
|
|
57
|
+
|
|
58
|
+
for await (const chunk of gzipStream) {
|
|
59
|
+
size += chunk.byteLength
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return size
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
await Promise.allSettled([
|
|
66
|
+
assertGzipSizeBelowThreshold('dist/index.js', ESM_BUNDLE_SIZE_LIMIT),
|
|
67
|
+
assertGzipSizeBelowThreshold('dist/index.umd.cjs', CJS_BUNDLE_SIZE_LIMIT),
|
|
68
|
+
]).then(reportResults)
|