@zuplo/cli 6.71.22 → 6.71.25
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/node_modules/@fastify/fast-json-stringify-compiler/.github/dependabot.yml +42 -2
- package/node_modules/@fastify/fast-json-stringify-compiler/.github/workflows/ci.yml +6 -1
- package/node_modules/@fastify/fast-json-stringify-compiler/.github/workflows/lock-threads.yml +19 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/LICENSE +1 -1
- package/node_modules/@fastify/fast-json-stringify-compiler/README.md +1 -1
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/.gitattributes +2 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/.github/dependabot.yml +13 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/.github/workflows/ci.yml +33 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/.github/workflows/lock-threads.yml +19 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/LICENSE +22 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/README.md +742 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/benchmark/bench-cmp-branch.js +116 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/benchmark/bench-cmp-lib.js +339 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/benchmark/bench-thread.js +33 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/benchmark/bench.js +391 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/build/build-schema-validator.js +26 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/eslint.config.js +9 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/examples/example.js +81 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/examples/server.js +42 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/index.js +1308 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/location.js +24 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/merge-schemas.js +9 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/schema-validator.js +1134 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/serializer.js +141 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/standalone.js +34 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/validator.js +96 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/package.json +89 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/additionalProperties.test.js +332 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/allof.test.js +751 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/any.test.js +231 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/anyof.test.js +812 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/array.test.js +688 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/asNumber.test.js +13 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/basic.test.js +400 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/bigint.test.js +76 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/clean-cache.test.js +47 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/const.test.js +314 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/date.test.js +639 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/debug-mode.test.js +130 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/defaults.test.js +376 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/enum.test.js +37 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/fix-604.test.js +25 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/fixtures/.keep +0 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/if-then-else.test.js +540 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/inferType.test.js +92 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/infinity.test.js +55 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/integer.test.js +194 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/invalidSchema.test.js +38 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/issue-479.test.js +57 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/issue-793.test.js +107 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/issue-794.test.js +177 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/issue-836.test.js +183 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-add-comma.test.js +57 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/README.md +10 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft4/required.json +54 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft4.test.js +12 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft6/required.json +70 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft6.test.js +12 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft7/required.json +70 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft7.test.js +12 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/util.js +31 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/missing-values.test.js +88 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/multi-type-serializer.test.js +19 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/nestedObjects.test.js +63 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/nullable.test.js +543 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/oneof.test.js +510 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/patternProperties.test.js +168 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/recursion.test.js +245 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/ref.json +12 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/ref.test.js +2077 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/regex.test.js +32 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/required.test.js +204 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/requiresAjv.test.js +50 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize.test.js +141 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize2.test.js +18 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize3.test.js +17 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize4.test.js +16 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize5.test.js +16 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize6.test.js +22 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize7.test.js +68 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/side-effect.test.js +196 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/standalone-mode.test.js +219 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/string.test.js +84 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/surrogate.test.js +67 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/toJSON.test.js +203 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/typebox.test.js +36 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/typesArray.test.js +550 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/unknownFormats.test.js +27 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/webpack.test.js +50 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/types/index.d.ts +219 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/types/index.tst.ts +259 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/package.json +6 -11
- package/node_modules/@fastify/fast-json-stringify-compiler/types/{index.test-d.ts → index.tst.ts} +34 -32
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts +5 -0
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core-stateless.js +50 -10
- package/node_modules/@posthog/core/dist/posthog-core-stateless.mjs +47 -10
- package/node_modules/@posthog/core/dist/posthog-core.d.ts +2 -2
- package/node_modules/@posthog/core/dist/posthog-core.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core.js +10 -6
- package/node_modules/@posthog/core/dist/posthog-core.mjs +11 -7
- package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.d.ts +1 -0
- package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.js +3 -0
- package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.mjs +3 -0
- package/node_modules/@posthog/core/dist/utils/promise-queue.d.ts +3 -0
- package/node_modules/@posthog/core/dist/utils/promise-queue.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/utils/promise-queue.js +15 -3
- package/node_modules/@posthog/core/dist/utils/promise-queue.mjs +15 -3
- package/node_modules/@posthog/core/package.json +1 -1
- package/node_modules/@posthog/core/src/posthog-core-stateless.ts +80 -14
- package/node_modules/@posthog/core/src/posthog-core.ts +18 -7
- package/node_modules/@posthog/core/src/testing/PostHogCoreTestClient.ts +4 -0
- package/node_modules/@posthog/core/src/utils/promise-queue.ts +17 -4
- package/node_modules/@posthog/types/dist/posthog.d.ts +12 -0
- package/node_modules/@posthog/types/dist/posthog.d.ts.map +1 -1
- package/node_modules/@posthog/types/package.json +1 -1
- package/node_modules/@posthog/types/src/posthog.ts +13 -0
- package/node_modules/@protobufjs/utf8/CHANGELOG.md +8 -0
- package/node_modules/@protobufjs/utf8/index.js +29 -18
- package/node_modules/@protobufjs/utf8/package.json +2 -2
- package/node_modules/@protobufjs/utf8/tests/index.js +5 -0
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/buffer.d.ts +64 -25
- package/node_modules/@types/node/crypto.d.ts +18 -5
- package/node_modules/@types/node/diagnostics_channel.d.ts +237 -3
- package/node_modules/@types/node/dns.d.ts +1 -1
- package/node_modules/@types/node/ffi.d.ts +486 -0
- package/node_modules/@types/node/fs/promises.d.ts +3 -0
- package/node_modules/@types/node/fs.d.ts +21 -6
- package/node_modules/@types/node/http.d.ts +25 -0
- package/node_modules/@types/node/index.d.ts +1 -0
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/process.d.ts +14 -1
- package/node_modules/@types/node/quic.d.ts +92 -11
- package/node_modules/@types/node/sqlite.d.ts +55 -0
- package/node_modules/@types/node/stream/iter.d.ts +150 -0
- package/node_modules/@types/node/stream.d.ts +32 -0
- package/node_modules/@types/node/test.d.ts +112 -2
- package/node_modules/@types/node/ts5.6/index.d.ts +1 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +1 -0
- package/node_modules/@types/node/util.d.ts +19 -2
- package/node_modules/@types/node/v8.d.ts +84 -2
- package/node_modules/@types/node/worker_threads.d.ts +8 -7
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/out/esm/index.js +11 -11
- package/node_modules/@zuplo/graphql/out/esm/index.js.map +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-54PA7VDV.js → chunk-4QJJMELB.js} +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-54PA7VDV.js.map → chunk-4QJJMELB.js.map} +1 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-MJWTZPC2.js +402 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-MJWTZPC2.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +7 -7
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +263 -19
- package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +33 -7
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/node_modules/hono/dist/adapter/aws-lambda/handler.js +1 -1
- package/node_modules/hono/dist/adapter/bun/websocket.js +3 -1
- package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +1 -1
- package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +3 -1
- package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +1 -1
- package/node_modules/hono/dist/cjs/utils/body.js +12 -4
- package/node_modules/hono/dist/cjs/utils/buffer.js +2 -1
- package/node_modules/hono/dist/cjs/validator/validator.js +3 -3
- package/node_modules/hono/dist/middleware/serve-static/index.js +1 -1
- package/node_modules/hono/dist/types/middleware/context-storage/index.d.ts +2 -2
- package/node_modules/hono/dist/types/utils/body.d.ts +1 -1
- package/node_modules/hono/dist/utils/body.js +12 -4
- package/node_modules/hono/dist/utils/buffer.js +2 -1
- package/node_modules/hono/dist/validator/validator.js +3 -3
- package/node_modules/hono/package.json +8 -7
- package/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
- package/node_modules/iconv-lite/encodings/utf32.js +10 -3
- package/node_modules/iconv-lite/package.json +2 -2
- package/node_modules/iconv-lite/types/encodings.d.ts +2 -0
- package/node_modules/protobufjs/dist/light/protobuf.js +2 -2
- package/node_modules/protobufjs/dist/light/protobuf.min.js +2 -2
- package/node_modules/protobufjs/dist/minimal/protobuf.js +2 -2
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
- package/node_modules/protobufjs/dist/protobuf.js +5 -2
- package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/package.json +1 -1
- package/node_modules/protobufjs/src/parse.js +3 -0
- package/node_modules/toad-cache/README.md +10 -9
- package/node_modules/toad-cache/dist/toad-cache.cjs +139 -139
- package/node_modules/toad-cache/dist/toad-cache.mjs +136 -140
- package/node_modules/toad-cache/package.json +8 -8
- package/node_modules/toad-cache/toad-cache.d.cts +20 -14
- package/node_modules/toad-cache/toad-cache.d.ts +18 -14
- package/package.json +6 -6
- package/node_modules/@fastify/fast-json-stringify-compiler/.eslintrc +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-36XLJ4X6.js +0 -389
- package/node_modules/@zuplo/runtime/out/esm/chunk-36XLJ4X6.js.map +0 -1
- package/node_modules/hono/dist/tsconfig.build.tsbuildinfo +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-36XLJ4X6.js.LEGAL.txt → chunk-MJWTZPC2.js.LEGAL.txt} +0 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process')
|
|
4
|
+
|
|
5
|
+
const cliSelect = require('cli-select')
|
|
6
|
+
const simpleGit = require('simple-git')
|
|
7
|
+
|
|
8
|
+
const git = simpleGit(process.cwd())
|
|
9
|
+
|
|
10
|
+
const COMMAND = 'npm run bench'
|
|
11
|
+
const DEFAULT_BRANCH = 'main'
|
|
12
|
+
const PERCENT_THRESHOLD = 5
|
|
13
|
+
const greyColor = '\x1b[30m'
|
|
14
|
+
const redColor = '\x1b[31m'
|
|
15
|
+
const greenColor = '\x1b[32m'
|
|
16
|
+
const resetColor = '\x1b[0m'
|
|
17
|
+
|
|
18
|
+
async function selectBranchName (message, branches) {
|
|
19
|
+
console.log(message)
|
|
20
|
+
const result = await cliSelect({
|
|
21
|
+
type: 'list',
|
|
22
|
+
name: 'branch',
|
|
23
|
+
values: branches
|
|
24
|
+
})
|
|
25
|
+
console.log(result.value)
|
|
26
|
+
return result.value
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function executeCommandOnBranch (command, branch) {
|
|
30
|
+
console.log(`${greyColor}Checking out "${branch}"${resetColor}`)
|
|
31
|
+
await git.checkout(branch)
|
|
32
|
+
|
|
33
|
+
console.log(`${greyColor}Execute "${command}"${resetColor}`)
|
|
34
|
+
const childProcess = spawn(command, { stdio: 'pipe', shell: true })
|
|
35
|
+
|
|
36
|
+
let result = ''
|
|
37
|
+
childProcess.stdout.on('data', (data) => {
|
|
38
|
+
process.stdout.write(data.toString())
|
|
39
|
+
result += data.toString()
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
await new Promise(resolve => childProcess.on('close', resolve))
|
|
43
|
+
|
|
44
|
+
console.log()
|
|
45
|
+
|
|
46
|
+
return parseBenchmarksStdout(result)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function parseBenchmarksStdout (text) {
|
|
50
|
+
const results = []
|
|
51
|
+
|
|
52
|
+
const lines = text.split('\n')
|
|
53
|
+
for (const line of lines) {
|
|
54
|
+
const match = /^(.+?)(\.*) x (.+) ops\/sec .*$/.exec(line)
|
|
55
|
+
if (match !== null) {
|
|
56
|
+
results.push({
|
|
57
|
+
name: match[1],
|
|
58
|
+
alignedName: match[1] + match[2],
|
|
59
|
+
result: parseInt(match[3].split(',').join(''))
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return results
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function compareResults (featureBranch, mainBranch) {
|
|
68
|
+
for (const { name, alignedName, result: mainBranchResult } of mainBranch) {
|
|
69
|
+
const featureBranchBenchmark = featureBranch.find(result => result.name === name)
|
|
70
|
+
if (featureBranchBenchmark) {
|
|
71
|
+
const featureBranchResult = featureBranchBenchmark.result
|
|
72
|
+
const percent = (featureBranchResult - mainBranchResult) * 100 / mainBranchResult
|
|
73
|
+
const roundedPercent = Math.round(percent * 100) / 100
|
|
74
|
+
|
|
75
|
+
const percentString = roundedPercent > 0 ? `+${roundedPercent}%` : `${roundedPercent}%`
|
|
76
|
+
const message = alignedName + percentString.padStart(7, '.')
|
|
77
|
+
|
|
78
|
+
if (roundedPercent > PERCENT_THRESHOLD) {
|
|
79
|
+
console.log(`${greenColor}${message}${resetColor}`)
|
|
80
|
+
} else if (roundedPercent < -PERCENT_THRESHOLD) {
|
|
81
|
+
console.log(`${redColor}${message}${resetColor}`)
|
|
82
|
+
} else {
|
|
83
|
+
console.log(message)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
(async function () {
|
|
90
|
+
const branches = await git.branch()
|
|
91
|
+
const currentBranch = branches.branches[branches.current]
|
|
92
|
+
|
|
93
|
+
let featureBranch = null
|
|
94
|
+
let mainBranch = null
|
|
95
|
+
|
|
96
|
+
if (process.argv[2] === '--ci') {
|
|
97
|
+
featureBranch = currentBranch.name
|
|
98
|
+
mainBranch = DEFAULT_BRANCH
|
|
99
|
+
} else {
|
|
100
|
+
featureBranch = await selectBranchName('Select the branch you want to compare (feature branch):', branches.all)
|
|
101
|
+
mainBranch = await selectBranchName('Select the branch you want to compare with (main branch):', branches.all)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
try {
|
|
105
|
+
const featureBranchResult = await executeCommandOnBranch(COMMAND, featureBranch)
|
|
106
|
+
const mainBranchResult = await executeCommandOnBranch(COMMAND, mainBranch)
|
|
107
|
+
compareResults(featureBranchResult, mainBranchResult)
|
|
108
|
+
} catch (error) {
|
|
109
|
+
console.error('Switch to origin branch due to an error', error.message)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
await git.checkout(currentBranch.commit)
|
|
113
|
+
await git.checkout(currentBranch.name)
|
|
114
|
+
|
|
115
|
+
console.log(`${greyColor}Back to ${currentBranch.name} ${currentBranch.commit}${resetColor}`)
|
|
116
|
+
})()
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { Bench } = require('tinybench')
|
|
4
|
+
const suite = new Bench({
|
|
5
|
+
name: 'Library Comparison Benchmarks',
|
|
6
|
+
setup: (_task, mode) => {
|
|
7
|
+
// Run the garbage collector before warmup at each cycle
|
|
8
|
+
if (mode === 'warmup' && typeof globalThis.gc === 'function') {
|
|
9
|
+
globalThis.gc()
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const STR_LEN = 1e4
|
|
15
|
+
const LARGE_ARRAY_SIZE = 2e4
|
|
16
|
+
const MULTI_ARRAY_LENGTH = 1e3
|
|
17
|
+
|
|
18
|
+
const schema = {
|
|
19
|
+
title: 'Example Schema',
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
firstName: {
|
|
23
|
+
type: 'string'
|
|
24
|
+
},
|
|
25
|
+
lastName: {
|
|
26
|
+
type: ['string', 'null']
|
|
27
|
+
},
|
|
28
|
+
age: {
|
|
29
|
+
description: 'Age in years',
|
|
30
|
+
type: 'integer',
|
|
31
|
+
minimum: 0
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const schemaCJS = {
|
|
36
|
+
title: 'Example Schema',
|
|
37
|
+
type: 'object',
|
|
38
|
+
properties: {
|
|
39
|
+
firstName: {
|
|
40
|
+
type: 'string'
|
|
41
|
+
},
|
|
42
|
+
lastName: {
|
|
43
|
+
type: ['string', 'null']
|
|
44
|
+
},
|
|
45
|
+
age: {
|
|
46
|
+
description: 'Age in years',
|
|
47
|
+
type: 'number',
|
|
48
|
+
minimum: 0
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const schemaAJVJTD = {
|
|
54
|
+
properties: {
|
|
55
|
+
firstName: {
|
|
56
|
+
type: 'string'
|
|
57
|
+
},
|
|
58
|
+
lastName: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
nullable: true
|
|
61
|
+
},
|
|
62
|
+
age: {
|
|
63
|
+
type: 'uint8'
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const arraySchema = {
|
|
69
|
+
title: 'array schema',
|
|
70
|
+
type: 'array',
|
|
71
|
+
items: schema
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const arraySchemaCJS = {
|
|
75
|
+
title: 'array schema',
|
|
76
|
+
type: 'array',
|
|
77
|
+
items: schemaCJS
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const arraySchemaAJVJTD = {
|
|
81
|
+
elements: schemaAJVJTD
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const dateFormatSchema = {
|
|
85
|
+
description: 'Date of birth',
|
|
86
|
+
type: 'string',
|
|
87
|
+
format: 'datetime'
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const dateFormatSchemaCJS = {
|
|
91
|
+
description: 'Date of birth',
|
|
92
|
+
type: 'string',
|
|
93
|
+
format: 'datetime'
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const obj = {
|
|
97
|
+
firstName: 'Matteo',
|
|
98
|
+
lastName: 'Collina',
|
|
99
|
+
age: 32
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const date = new Date()
|
|
103
|
+
|
|
104
|
+
const multiArray = new Array(MULTI_ARRAY_LENGTH)
|
|
105
|
+
const largeArray = new Array(LARGE_ARRAY_SIZE)
|
|
106
|
+
|
|
107
|
+
const CJS = require('compile-json-stringify')
|
|
108
|
+
const CJSStringify = CJS(schemaCJS)
|
|
109
|
+
const CJSStringifyArray = CJS(arraySchemaCJS)
|
|
110
|
+
const CJSStringifyDate = CJS(dateFormatSchemaCJS)
|
|
111
|
+
const CJSStringifyString = CJS({ type: 'string' })
|
|
112
|
+
|
|
113
|
+
const FJS = require('..')
|
|
114
|
+
const stringify = FJS(schema)
|
|
115
|
+
const stringifyArrayDefault = FJS(arraySchema)
|
|
116
|
+
const stringifyArrayJSONStringify = FJS(arraySchema, {
|
|
117
|
+
largeArrayMechanism: 'json-stringify'
|
|
118
|
+
})
|
|
119
|
+
const stringifyDate = FJS(dateFormatSchema)
|
|
120
|
+
const stringifyString = FJS({ type: 'string' })
|
|
121
|
+
let str = ''
|
|
122
|
+
|
|
123
|
+
const Ajv = require('ajv/dist/jtd')
|
|
124
|
+
const ajv = new Ajv()
|
|
125
|
+
const ajvSerialize = ajv.compileSerializer(schemaAJVJTD)
|
|
126
|
+
const ajvSerializeArray = ajv.compileSerializer(arraySchemaAJVJTD)
|
|
127
|
+
const ajvSerializeString = ajv.compileSerializer({ type: 'string' })
|
|
128
|
+
|
|
129
|
+
const { createAccelerator } = require('json-accelerator')
|
|
130
|
+
const accelStringify = createAccelerator(schema)
|
|
131
|
+
const accelArray = createAccelerator(arraySchema)
|
|
132
|
+
const accelDate = FJS(dateFormatSchema)
|
|
133
|
+
const accelString = FJS({ type: 'string' })
|
|
134
|
+
|
|
135
|
+
const getRandomString = (length) => {
|
|
136
|
+
if (!Number.isInteger(length)) {
|
|
137
|
+
throw new Error('Expected integer length')
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const validCharacters = 'abcdefghijklmnopqrstuvwxyz'
|
|
141
|
+
const nValidCharacters = 26
|
|
142
|
+
|
|
143
|
+
let result = ''
|
|
144
|
+
for (let i = 0; i < length; ++i) {
|
|
145
|
+
result += validCharacters[Math.floor(Math.random() * nValidCharacters)]
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return result[0].toUpperCase() + result.slice(1)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
for (let i = 0; i < STR_LEN; i++) {
|
|
152
|
+
largeArray[i] = {
|
|
153
|
+
firstName: getRandomString(8),
|
|
154
|
+
lastName: getRandomString(6),
|
|
155
|
+
age: Math.ceil(Math.random() * 99)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
str += i
|
|
159
|
+
if (i % 100 === 0) {
|
|
160
|
+
str += '"'
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
for (let i = STR_LEN; i < LARGE_ARRAY_SIZE; ++i) {
|
|
165
|
+
largeArray[i] = {
|
|
166
|
+
firstName: getRandomString(10),
|
|
167
|
+
lastName: getRandomString(4),
|
|
168
|
+
age: Math.ceil(Math.random() * 99)
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
for (let i = 0; i < MULTI_ARRAY_LENGTH; i++) {
|
|
173
|
+
multiArray[i] = obj
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
suite.add('fast-json-stringify: creation', function () {
|
|
177
|
+
FJS(schema)
|
|
178
|
+
})
|
|
179
|
+
suite.add('compile-json-stringify: creation', function () {
|
|
180
|
+
CJS(schemaCJS)
|
|
181
|
+
})
|
|
182
|
+
suite.add('AJV: creation', function () {
|
|
183
|
+
ajv.compileSerializer(schemaAJVJTD)
|
|
184
|
+
})
|
|
185
|
+
suite.add('json-accelerator: creation', function () {
|
|
186
|
+
createAccelerator(schema)
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
suite.add('JSON.stringify: array', function () {
|
|
190
|
+
JSON.stringify(multiArray)
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
suite.add('fast-json-stringify [default]: array', function () {
|
|
194
|
+
stringifyArrayDefault(multiArray)
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
suite.add('json-accelerator: array', function () {
|
|
198
|
+
accelArray(multiArray)
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
suite.add('fast-json-stringify [json-stringify]: array', function () {
|
|
202
|
+
stringifyArrayJSONStringify(multiArray)
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
suite.add('compile-json-stringify: array', function () {
|
|
206
|
+
CJSStringifyArray(multiArray)
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
suite.add('AJV: array', function () {
|
|
210
|
+
ajvSerializeArray(multiArray)
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
suite.add('JSON.stringify: large array', function () {
|
|
214
|
+
JSON.stringify(largeArray)
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
suite.add('fast-json-stringify [default]: large array', function () {
|
|
218
|
+
stringifyArrayDefault(largeArray)
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
suite.add('fast-json-stringify [json-stringify]: large array', function () {
|
|
222
|
+
stringifyArrayJSONStringify(largeArray)
|
|
223
|
+
})
|
|
224
|
+
|
|
225
|
+
suite.add('compile-json-stringify: large array', function () {
|
|
226
|
+
CJSStringifyArray(largeArray)
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
suite.add('AJV: large array', function () {
|
|
230
|
+
ajvSerializeArray(largeArray)
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
suite.add('JSON.stringify: long string', function () {
|
|
234
|
+
JSON.stringify(str)
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
suite.add('fast-json-stringify: long string', function () {
|
|
238
|
+
stringifyString(str)
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
suite.add('json-accelerator: long string', function () {
|
|
242
|
+
stringifyString(str)
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
suite.add('compile-json-stringify: long string', function () {
|
|
246
|
+
CJSStringifyString(str)
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
suite.add('AJV: long string', function () {
|
|
250
|
+
ajvSerializeString(str)
|
|
251
|
+
})
|
|
252
|
+
|
|
253
|
+
suite.add('JSON.stringify: short string', function () {
|
|
254
|
+
JSON.stringify('hello world')
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
suite.add('fast-json-stringify: short string', function () {
|
|
258
|
+
stringifyString('hello world')
|
|
259
|
+
})
|
|
260
|
+
|
|
261
|
+
suite.add('json-accelerator: short string', function () {
|
|
262
|
+
accelString('hello world')
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
suite.add('compile-json-stringify: short string', function () {
|
|
266
|
+
CJSStringifyString('hello world')
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
suite.add('AJV: short string', function () {
|
|
270
|
+
ajvSerializeString('hello world')
|
|
271
|
+
})
|
|
272
|
+
|
|
273
|
+
suite.add('JSON.stringify: obj', function () {
|
|
274
|
+
JSON.stringify(obj)
|
|
275
|
+
})
|
|
276
|
+
|
|
277
|
+
suite.add('fast-json-stringify: obj', function () {
|
|
278
|
+
stringify(obj)
|
|
279
|
+
})
|
|
280
|
+
|
|
281
|
+
suite.add('json-accelerator: obj', function () {
|
|
282
|
+
accelStringify(obj)
|
|
283
|
+
})
|
|
284
|
+
|
|
285
|
+
suite.add('compile-json-stringify: obj', function () {
|
|
286
|
+
CJSStringify(obj)
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
suite.add('AJV: obj', function () {
|
|
290
|
+
ajvSerialize(obj)
|
|
291
|
+
})
|
|
292
|
+
|
|
293
|
+
suite.add('JSON.stringify: date', function () {
|
|
294
|
+
JSON.stringify(date)
|
|
295
|
+
})
|
|
296
|
+
|
|
297
|
+
suite.add('fast-json-stringify: date', function () {
|
|
298
|
+
stringifyDate(date)
|
|
299
|
+
})
|
|
300
|
+
|
|
301
|
+
suite.add('json-accelerate: date', function () {
|
|
302
|
+
accelDate(date)
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
suite.add('compile-json-stringify: date', function () {
|
|
306
|
+
CJSStringifyDate(date)
|
|
307
|
+
})
|
|
308
|
+
|
|
309
|
+
suite.run().then(() => {
|
|
310
|
+
const results = suite.tasks.map(task => ({
|
|
311
|
+
name: task.name,
|
|
312
|
+
hz: task.result.throughput.mean,
|
|
313
|
+
rme: task.result.latency.rme,
|
|
314
|
+
samples: task.result.latency.df + 1
|
|
315
|
+
}))
|
|
316
|
+
|
|
317
|
+
const scenarios = {}
|
|
318
|
+
for (const result of results) {
|
|
319
|
+
const [library, scenario] = result.name.split(':').map(s => s.trim())
|
|
320
|
+
|
|
321
|
+
if (!scenarios[scenario]) scenarios[scenario] = []
|
|
322
|
+
scenarios[scenario].push({ ...result, library })
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
for (const [scenario, tasks] of Object.entries(scenarios)) {
|
|
326
|
+
console.log(`\n--- ${scenario} ---`)
|
|
327
|
+
const sorted = tasks.sort((a, b) => b.hz - a.hz)
|
|
328
|
+
const winner = sorted[0]
|
|
329
|
+
|
|
330
|
+
for (const task of sorted) {
|
|
331
|
+
const formattedHz = task.hz.toLocaleString('en-US', { maximumFractionDigits: 0 })
|
|
332
|
+
const formattedRme = task.rme.toFixed(2)
|
|
333
|
+
const isWinner = task === winner
|
|
334
|
+
const prefix = isWinner ? '🏆 ' : ' '
|
|
335
|
+
|
|
336
|
+
console.log(`${prefix}${task.library.padEnd(40)} x ${formattedHz.padStart(15)} ops/sec ±${formattedRme}% (${task.samples} runs sampled)`)
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}).catch(err => console.error(`Error: ${err.message}`))
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { workerData: benchmark, parentPort } = require('worker_threads')
|
|
4
|
+
|
|
5
|
+
const { Bench } = require('tinybench')
|
|
6
|
+
|
|
7
|
+
const bench = new Bench({
|
|
8
|
+
name: benchmark.name,
|
|
9
|
+
setup: (_task, mode) => {
|
|
10
|
+
// Run the garbage collector before warmup at each cycle
|
|
11
|
+
if (mode === 'warmup' && typeof globalThis.gc === 'function') {
|
|
12
|
+
globalThis.gc()
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const FJS = require('..')
|
|
18
|
+
const stringify = FJS(benchmark.schema)
|
|
19
|
+
|
|
20
|
+
bench.add(benchmark.name, () => {
|
|
21
|
+
stringify(benchmark.input)
|
|
22
|
+
}).run().then(() => {
|
|
23
|
+
const task = bench.tasks[0]
|
|
24
|
+
const hz = task.result.throughput.mean // ops/sec
|
|
25
|
+
const rme = task.result.latency.rme // relative margin of error (%)
|
|
26
|
+
const samples = task.result.latency.df + 1 // degrees of freedom + 1 = sample count
|
|
27
|
+
|
|
28
|
+
const formattedHz = hz.toLocaleString('en-US', { maximumFractionDigits: 0 })
|
|
29
|
+
const formattedRme = rme.toFixed(2)
|
|
30
|
+
|
|
31
|
+
const output = `${task.name} x ${formattedHz} ops/sec ±${formattedRme}% (${samples} runs sampled)`
|
|
32
|
+
parentPort.postMessage(output)
|
|
33
|
+
}).catch(err => parentPort.postMessage(`Error: ${err.message}`))
|