@contrast/agent-bundle 5.41.0 → 5.45.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/README.md +1 -10
- package/node_modules/@contrast/agent/README.md +1 -10
- package/node_modules/@contrast/agent/package.json +13 -12
- package/node_modules/@contrast/agent-swc-plugin/package.json +3 -3
- package/node_modules/@contrast/agentify/lib/rewrite-hooks.js +3 -3
- package/node_modules/@contrast/agentify/lib/utils.js +13 -7
- package/node_modules/@contrast/agentify/package.json +17 -17
- package/node_modules/@contrast/architecture-components/package.json +6 -6
- package/node_modules/@contrast/assess/lib/dataflow/propagation/install/ejs/template.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/propagation/install/pug/index.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/sinks/install/http/server-response.js +1 -12
- package/node_modules/@contrast/assess/lib/dataflow/sinks/install/restify.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/http.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/tracker.js +1 -1
- package/node_modules/@contrast/assess/lib/get-source-context.js +1 -1
- package/node_modules/@contrast/assess/lib/response-scanning/install/http.js +0 -12
- package/node_modules/@contrast/assess/package.json +14 -14
- package/node_modules/@contrast/code-events/binding.gyp +1 -1
- package/node_modules/@contrast/code-events/package.json +11 -9
- package/node_modules/@contrast/code-events/prebuilds/darwin-x64+arm64/@contrast+code-events.abi108.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/darwin-x64+arm64/@contrast+code-events.abi115.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/darwin-x64+arm64/@contrast+code-events.abi127.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/darwin-x64+arm64/{@contrast+code-events.abi93.node → @contrast+code-events.abi137.node} +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi108.armv8.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi115.armv8.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi127.armv8.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi137.armv8.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi108.glibc.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi108.musl.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi115.glibc.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi115.musl.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi127.glibc.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi127.musl.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi137.glibc.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi137.musl.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi108.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi115.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi127.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi137.node +0 -0
- package/node_modules/@contrast/common/lib/constants.d.ts +1 -1
- package/node_modules/@contrast/common/lib/constants.js +1 -1
- package/node_modules/@contrast/common/lib/index.js +15 -15
- package/node_modules/@contrast/common/lib/primordials.d.ts +22 -20
- package/node_modules/@contrast/common/lib/types.d.ts +18 -6
- package/node_modules/@contrast/common/package.json +2 -2
- package/node_modules/@contrast/config/lib/options.js +29 -4
- package/node_modules/@contrast/config/package.json +4 -4
- package/node_modules/@contrast/core/lib/app-info.js +53 -74
- package/node_modules/@contrast/core/lib/index.d.ts +17 -1
- package/node_modules/@contrast/core/lib/sensitive-data-masking/index.js +33 -5
- package/node_modules/@contrast/core/package.json +10 -9
- package/node_modules/@contrast/deadzones/package.json +6 -6
- package/node_modules/@contrast/dep-hooks/lib/export-handler-registry.d.ts +17 -13
- package/node_modules/@contrast/dep-hooks/lib/export-handler-registry.js +16 -4
- package/node_modules/@contrast/dep-hooks/lib/export-hook-descriptor.d.ts +2 -2
- package/node_modules/@contrast/dep-hooks/lib/export-hook-descriptor.js +2 -3
- package/node_modules/@contrast/dep-hooks/lib/handler-invoker.d.ts +6 -6
- package/node_modules/@contrast/dep-hooks/lib/handler-invoker.js +0 -1
- package/node_modules/@contrast/dep-hooks/lib/helpers.d.ts +0 -7
- package/node_modules/@contrast/dep-hooks/lib/helpers.js +2 -18
- package/node_modules/@contrast/dep-hooks/lib/index.d.ts +17 -12
- package/node_modules/@contrast/dep-hooks/lib/index.js +5 -3
- package/node_modules/@contrast/dep-hooks/lib/package-finder.d.ts +2 -1
- package/node_modules/@contrast/dep-hooks/lib/package-finder.js +6 -6
- package/node_modules/@contrast/dep-hooks/package.json +4 -3
- package/node_modules/@contrast/distringuish/package.json +7 -6
- package/node_modules/@contrast/distringuish/prebuilds/darwin-x64+arm64/@contrast+distringuish.abi108.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/darwin-x64+arm64/@contrast+distringuish.abi115.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/darwin-x64+arm64/@contrast+distringuish.abi127.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/darwin-x64+arm64/{@contrast+distringuish.abi93.node → @contrast+distringuish.abi137.node} +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi108.armv8.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi115.armv8.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi127.armv8.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi137.armv8.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi108.glibc.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi108.musl.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi115.glibc.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi115.musl.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi127.glibc.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi127.musl.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi137.glibc.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi137.musl.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi108.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi115.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi127.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi137.node +0 -0
- package/node_modules/@contrast/esm-hooks/lib/debug-methods.mjs +4 -4
- package/node_modules/@contrast/esm-hooks/lib/get-file-type.mjs +2 -9
- package/node_modules/@contrast/esm-hooks/lib/hooks.mjs +0 -2
- package/node_modules/@contrast/esm-hooks/lib/redirects/builtin/fs/promises.mjs +2 -0
- package/node_modules/@contrast/esm-hooks/lib/redirects/builtin/fs.mjs +3 -0
- package/node_modules/@contrast/esm-hooks/lib/redirects/builtin/util.mjs +1 -0
- package/node_modules/@contrast/esm-hooks/package.json +7 -7
- package/node_modules/@contrast/fn-inspect/package.json +9 -5
- package/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/@contrast+fn-inspect.abi108.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/@contrast+fn-inspect.abi115.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/@contrast+fn-inspect.abi127.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/{@contrast+fn-inspect.abi93.node → @contrast+fn-inspect.abi137.node} +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi108.armv8.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi115.armv8.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi127.armv8.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi137.armv8.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi108.glibc.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi108.musl.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi115.glibc.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi115.musl.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi127.glibc.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi127.musl.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi137.glibc.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/{@contrast+fn-inspect.abi93.musl.node → @contrast+fn-inspect.abi137.musl.node} +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi108.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi115.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi127.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi137.node +0 -0
- package/node_modules/@contrast/instrumentation/lib/http2.js +0 -11
- package/node_modules/@contrast/instrumentation/package.json +6 -6
- package/node_modules/@contrast/library-analysis/lib/install/library-reporting/dep.json +312 -224
- package/node_modules/@contrast/library-analysis/package.json +6 -6
- package/node_modules/@contrast/logger/lib/index.js +18 -8
- package/node_modules/@contrast/logger/lib/serializers.js +5 -5
- package/node_modules/@contrast/logger/lib/utils.d.ts +0 -6
- package/node_modules/@contrast/logger/package.json +4 -4
- package/node_modules/@contrast/metrics/lib/index.d.ts +6 -6
- package/node_modules/@contrast/metrics/lib/index.js +0 -1
- package/node_modules/@contrast/metrics/package.json +7 -7
- package/node_modules/@contrast/patcher/package.json +3 -3
- package/node_modules/@contrast/perf/package.json +7 -4
- package/node_modules/@contrast/protect/lib/hardening/handlers.js +37 -21
- package/node_modules/@contrast/protect/lib/index.d.ts +3 -2
- package/node_modules/@contrast/protect/lib/index.js +9 -2
- package/node_modules/@contrast/protect/lib/input-analysis/handlers.js +275 -233
- package/node_modules/@contrast/protect/lib/input-analysis/install/http.js +3 -4
- package/node_modules/@contrast/protect/lib/input-tracing/{handlers/index.js → handlers.js} +15 -15
- package/node_modules/@contrast/protect/lib/input-tracing/index.js +0 -1
- package/node_modules/@contrast/protect/lib/make-source-context.js +5 -7
- package/node_modules/@contrast/protect/lib/policy.js +130 -95
- package/node_modules/@contrast/protect/lib/semantic-analysis/handlers.js +19 -18
- package/node_modules/@contrast/protect/package.json +12 -12
- package/node_modules/@contrast/reporter/lib/index.js +1 -1
- package/node_modules/@contrast/reporter/lib/reporters/base.d.ts +0 -1
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/index.d.ts +4 -2
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/index.js +14 -14
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.d.ts +43 -6
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.js +262 -429
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/server-inventory.d.ts +3 -3
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.d.ts +11 -11
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.js +93 -93
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.js +12 -13
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/utils.js +6 -7
- package/node_modules/@contrast/reporter/lib/reporters/file.js +1 -1
- package/node_modules/@contrast/reporter/lib/reporters/security-logger/index.d.ts +2 -3
- package/node_modules/@contrast/reporter/lib/reporters/security-logger/index.js +72 -86
- package/node_modules/@contrast/reporter/lib/reporters/security-logger/messages.js +6 -7
- package/node_modules/@contrast/reporter/lib/validators.js +0 -1
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/.husky/pre-commit +2 -2
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/.taprc +5 -0
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/README.md +2 -4
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/bench.js +5 -36
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/index.js +56 -300
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/package.json +12 -7
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test.js +1684 -0
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/types/index.d.ts +1 -2
- package/node_modules/@contrast/reporter/package.json +10 -10
- package/node_modules/@contrast/rewriter/lib/index.js +5 -43
- package/node_modules/@contrast/rewriter/package.json +8 -8
- package/node_modules/@contrast/route-coverage/lib/install/express/express5.js +0 -5
- package/node_modules/@contrast/route-coverage/lib/install/hapi.js +9 -2
- package/node_modules/@contrast/route-coverage/lib/install/restify.js +1 -1
- package/node_modules/@contrast/route-coverage/package.json +10 -10
- package/node_modules/@contrast/scopes/package.json +6 -6
- package/node_modules/@contrast/sec-obs/lib/traces/http.js +1 -1
- package/node_modules/@contrast/sec-obs/lib/traces/http.test.js +1 -1
- package/node_modules/@contrast/sec-obs/package.json +10 -10
- package/node_modules/@contrast/sources/lib/index.js +1 -1
- package/node_modules/@contrast/sources/lib/index.test.js +0 -26
- package/node_modules/@contrast/sources/package.json +3 -3
- package/node_modules/@contrast/telemetry/package.json +6 -6
- package/node_modules/@opentelemetry/semantic-conventions/README.md +3 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.d.ts +4350 -2882
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js +4350 -2882
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_events.d.ts +136 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_events.js +154 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_events.js.map +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.d.ts +713 -141
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.js +713 -141
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.d.ts +2 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.js +2 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.d.ts +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.d.ts +7 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js +7 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.d.ts +5 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js +23 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js.map +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.d.ts +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.js +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.d.ts +4350 -2882
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.js +4350 -2882
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_events.d.ts +136 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_events.js +154 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_events.js.map +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.d.ts +713 -141
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.js +713 -141
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.d.ts +2 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.js +2 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.d.ts +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.js +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.d.ts +7 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.js +7 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.d.ts +5 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.js +23 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.js.map +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.d.ts +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.js +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.d.ts +4350 -2882
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.js +4354 -2883
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.d.ts +136 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.js +157 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.js.map +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.d.ts +713 -141
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js +720 -147
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.d.ts +2 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.js +2 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index.d.ts +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index.js +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.d.ts +7 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js +10 -4
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.d.ts +5 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.js +26 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.js.map +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/version.d.ts +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/version.js +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/version.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/package.json +6 -7
- package/node_modules/@swc/core/README.md +5 -0
- package/node_modules/@swc/core/binding.d.ts +2 -2
- package/node_modules/@swc/core/index.d.ts +5 -4
- package/node_modules/@swc/core/index.js +2 -2
- package/node_modules/@swc/core/package.json +12 -12
- package/node_modules/@swc/core-darwin-arm64/package.json +1 -1
- package/node_modules/@swc/core-darwin-arm64/swc.darwin-arm64.node +0 -0
- package/node_modules/@swc/core-darwin-x64/package.json +1 -1
- package/node_modules/@swc/core-darwin-x64/swc.darwin-x64.node +0 -0
- package/node_modules/@swc/core-linux-arm64-gnu/package.json +1 -1
- package/node_modules/@swc/core-linux-arm64-gnu/swc.linux-arm64-gnu.node +0 -0
- package/node_modules/@swc/core-linux-arm64-musl/package.json +1 -1
- package/node_modules/@swc/core-linux-arm64-musl/swc.linux-arm64-musl.node +0 -0
- package/node_modules/@swc/core-linux-x64-gnu/package.json +1 -1
- package/node_modules/@swc/core-linux-x64-gnu/swc.linux-x64-gnu.node +0 -0
- package/node_modules/@swc/core-linux-x64-musl/package.json +1 -1
- package/node_modules/@swc/core-linux-x64-musl/swc.linux-x64-musl.node +0 -0
- package/node_modules/@swc/core-win32-arm64-msvc/package.json +1 -1
- package/node_modules/@swc/core-win32-arm64-msvc/swc.win32-arm64-msvc.node +0 -0
- package/node_modules/@swc/core-win32-x64-msvc/package.json +1 -1
- package/node_modules/@swc/core-win32-x64-msvc/swc.win32-x64-msvc.node +0 -0
- package/node_modules/@swc/types/index.d.ts +15 -5
- package/node_modules/@swc/types/package.json +2 -2
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/buffer.d.ts +1 -1
- package/node_modules/@types/node/child_process.d.ts +26 -122
- package/node_modules/@types/node/crypto.d.ts +61 -11
- package/node_modules/@types/node/dns.d.ts +5 -0
- package/node_modules/@types/node/fs/promises.d.ts +48 -29
- package/node_modules/@types/node/fs.d.ts +52 -37
- package/node_modules/@types/node/globals.d.ts +148 -347
- package/node_modules/@types/node/http.d.ts +29 -5
- package/node_modules/@types/node/http2.d.ts +13 -11
- package/node_modules/@types/node/https.d.ts +5 -0
- package/node_modules/@types/node/index.d.ts +7 -2
- package/node_modules/@types/node/inspector.d.ts +187 -3985
- package/node_modules/@types/node/inspector.generated.d.ts +4052 -0
- package/node_modules/@types/node/module.d.ts +25 -0
- package/node_modules/@types/node/net.d.ts +21 -0
- package/node_modules/@types/node/package.json +4 -9
- package/node_modules/@types/node/perf_hooks.d.ts +14 -0
- package/node_modules/@types/node/repl.d.ts +11 -1
- package/node_modules/@types/node/sqlite.d.ts +34 -1
- package/node_modules/@types/node/stream/web.d.ts +4 -0
- package/node_modules/@types/node/stream.d.ts +17 -6
- package/node_modules/@types/node/test.d.ts +120 -1
- package/node_modules/@types/node/timers.d.ts +0 -2
- package/node_modules/@types/node/tls.d.ts +32 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +7 -2
- package/node_modules/@types/node/ts5.7/index.d.ts +7 -2
- package/node_modules/@types/node/url.d.ts +20 -6
- package/node_modules/@types/node/util.d.ts +12 -6
- package/node_modules/@types/node/vm.d.ts +73 -10
- package/node_modules/@types/node/wasi.d.ts +21 -0
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/node_modules/@types/node/{dom-events.d.ts → web-globals/events.d.ts} +47 -52
- package/node_modules/@types/node/web-globals/fetch.d.ts +50 -0
- package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
- package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/node_modules/@types/node/worker_threads.d.ts +63 -3
- package/node_modules/@types/node/zlib.d.ts +8 -2
- package/node_modules/axios/CHANGELOG.md +58 -0
- package/node_modules/axios/README.md +87 -10
- package/node_modules/axios/dist/axios.js +355 -289
- package/node_modules/axios/dist/axios.js.map +1 -1
- package/node_modules/axios/dist/axios.min.js +2 -2
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +286 -213
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
- package/node_modules/axios/dist/esm/axios.js +286 -213
- package/node_modules/axios/dist/esm/axios.js.map +1 -1
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +377 -213
- package/node_modules/axios/dist/node/axios.cjs.map +1 -1
- package/node_modules/axios/index.d.cts +12 -5
- package/node_modules/axios/index.d.ts +13 -4
- package/node_modules/axios/lib/adapters/adapters.js +6 -4
- package/node_modules/axios/lib/adapters/fetch.js +221 -162
- package/node_modules/axios/lib/adapters/http.js +18 -0
- package/node_modules/axios/lib/adapters/xhr.js +11 -8
- package/node_modules/axios/lib/core/Axios.js +0 -2
- package/node_modules/axios/lib/core/AxiosError.js +10 -3
- package/node_modules/axios/lib/core/dispatchRequest.js +1 -1
- package/node_modules/axios/lib/defaults/index.js +1 -1
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/buildURL.js +1 -3
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +73 -0
- package/node_modules/axios/lib/helpers/resolveConfig.js +13 -9
- package/node_modules/axios/lib/utils.js +5 -3
- package/node_modules/axios/package.json +18 -12
- package/node_modules/balanced-match/.github/FUNDING.yml +2 -0
- package/node_modules/balanced-match/LICENSE.md +21 -0
- package/node_modules/balanced-match/README.md +97 -0
- package/node_modules/balanced-match/index.js +62 -0
- package/node_modules/balanced-match/package.json +48 -0
- package/node_modules/brace-expansion/.github/FUNDING.yml +2 -0
- package/node_modules/brace-expansion/LICENSE +21 -0
- package/node_modules/brace-expansion/README.md +135 -0
- package/node_modules/brace-expansion/index.js +203 -0
- package/node_modules/brace-expansion/package.json +49 -0
- package/node_modules/detect-libc/lib/detect-libc.js +59 -13
- package/node_modules/detect-libc/lib/elf.js +39 -0
- package/node_modules/detect-libc/lib/filesystem.js +18 -8
- package/node_modules/detect-libc/package.json +3 -2
- package/node_modules/minimatch/LICENSE +15 -0
- package/node_modules/minimatch/README.md +454 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/ast.d.ts +20 -0
- package/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/ast.js +592 -0
- package/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +8 -0
- package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/brace-expressions.js +152 -0
- package/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/escape.d.ts +12 -0
- package/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/escape.js +22 -0
- package/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/index.d.ts +94 -0
- package/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/index.js +1017 -0
- package/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/package.json +3 -0
- package/node_modules/minimatch/dist/commonjs/unescape.d.ts +17 -0
- package/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/unescape.js +24 -0
- package/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
- package/node_modules/minimatch/dist/esm/ast.d.ts +20 -0
- package/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/ast.js +588 -0
- package/node_modules/minimatch/dist/esm/ast.js.map +1 -0
- package/node_modules/minimatch/dist/esm/brace-expressions.d.ts +8 -0
- package/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/brace-expressions.js +148 -0
- package/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
- package/node_modules/minimatch/dist/esm/escape.d.ts +12 -0
- package/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/escape.js +18 -0
- package/node_modules/minimatch/dist/esm/escape.js.map +1 -0
- package/node_modules/minimatch/dist/esm/index.d.ts +94 -0
- package/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/index.js +1001 -0
- package/node_modules/minimatch/dist/esm/index.js.map +1 -0
- package/node_modules/minimatch/dist/esm/package.json +3 -0
- package/node_modules/minimatch/dist/esm/unescape.d.ts +17 -0
- package/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/unescape.js +20 -0
- package/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
- package/node_modules/minimatch/package.json +82 -0
- package/node_modules/node-abi/LICENSE +21 -0
- package/node_modules/node-abi/README.md +54 -0
- package/node_modules/node-abi/abi_registry.json +408 -0
- package/node_modules/node-abi/getNextTarget.js +13 -0
- package/node_modules/node-abi/index.js +161 -0
- package/node_modules/node-abi/package.json +46 -0
- package/node_modules/node-addon-api/README.md +25 -249
- package/node_modules/node-addon-api/common.gypi +1 -0
- package/node_modules/node-addon-api/index.js +2 -0
- package/node_modules/node-addon-api/napi-inl.h +592 -166
- package/node_modules/node-addon-api/napi.h +167 -59
- package/node_modules/node-addon-api/node_addon_api.gyp +10 -0
- package/node_modules/node-addon-api/noexcept.gypi +1 -1
- package/node_modules/node-addon-api/package.json +13 -13
- package/node_modules/node-addon-api/tools/conversion.js +1 -1
- 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 +2 -2
- package/node_modules/protobufjs/dist/protobuf.min.js +2 -2
- package/node_modules/protobufjs/google/protobuf/descriptor.json +2 -2
- package/node_modules/protobufjs/google/protobuf/descriptor.proto +2 -1
- package/node_modules/protobufjs/package.json +1 -1
- package/node_modules/undici-types/agent.d.ts +4 -0
- package/node_modules/undici-types/client-stats.d.ts +15 -0
- package/node_modules/undici-types/client.d.ts +6 -3
- package/node_modules/undici-types/diagnostics-channel.d.ts +9 -0
- package/node_modules/undici-types/dispatcher.d.ts +3 -2
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +2 -1
- package/node_modules/undici-types/eventsource.d.ts +3 -3
- package/node_modules/undici-types/fetch.d.ts +1 -0
- package/node_modules/undici-types/handlers.d.ts +1 -1
- package/node_modules/undici-types/mock-agent.d.ts +3 -0
- package/node_modules/undici-types/mock-client.d.ts +2 -0
- package/node_modules/undici-types/mock-interceptor.d.ts +2 -0
- package/node_modules/undici-types/mock-pool.d.ts +2 -0
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/pool.d.ts +2 -0
- package/node_modules/undici-types/proxy-agent.d.ts +1 -0
- package/node_modules/undici-types/retry-handler.d.ts +9 -0
- package/node_modules/undici-types/webidl.d.ts +29 -15
- package/node_modules/undici-types/websocket.d.ts +3 -1
- package/node_modules/yaml/README.md +2 -20
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +1 -1
- package/node_modules/yaml/dist/stringify/stringifyString.js +1 -1
- package/node_modules/yaml/package.json +2 -1
- package/package.json +4 -3
- package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi93.armv8.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi93.glibc.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi93.musl.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi93.node +0 -0
- package/node_modules/@contrast/core/lib/sensitive-data-masking/protect-listener.js +0 -111
- package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi93.armv8.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi93.glibc.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi93.musl.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi93.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi93.armv8.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi93.glibc.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi93.node +0 -0
- package/node_modules/@contrast/perf/lib/index.test.js +0 -547
- package/node_modules/@contrast/perf/lib/tsconfig.json +0 -31
- package/node_modules/@contrast/protect/lib/input-tracing/install/spdy.js +0 -63
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/.taprc.yaml +0 -11
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/destroy.test.js +0 -49
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/end.test.js +0 -98
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/flush-sync.test.js +0 -140
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/flush.test.js +0 -419
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/fsync.test.js +0 -63
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/helper.js +0 -42
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/minlength.test.js +0 -35
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/mode.test.js +0 -116
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/reopen.test.js +0 -239
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/retry.test.js +0 -414
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/sync.test.js +0 -261
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/write.test.js +0 -465
- package/node_modules/@types/node/ts5.1/compatibility/disposable.d.ts +0 -12
- package/node_modules/@types/node/ts5.1/index.d.ts +0 -98
- package/node_modules/node-addon-api/tools/eslint-format.js +0 -79
|
@@ -1,465 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { test } = require('tap')
|
|
4
|
-
const fs = require('fs')
|
|
5
|
-
const proxyquire = require('proxyquire')
|
|
6
|
-
const SonicBoom = require('../')
|
|
7
|
-
const { file, runTests } = require('./helper')
|
|
8
|
-
|
|
9
|
-
runTests(buildTests)
|
|
10
|
-
|
|
11
|
-
function buildTests (test, sync) {
|
|
12
|
-
// Reset the umask for testing
|
|
13
|
-
process.umask(0o000)
|
|
14
|
-
|
|
15
|
-
test('write things to a file descriptor', (t) => {
|
|
16
|
-
t.plan(6)
|
|
17
|
-
|
|
18
|
-
const dest = file()
|
|
19
|
-
const fd = fs.openSync(dest, 'w')
|
|
20
|
-
const stream = new SonicBoom({ fd, sync })
|
|
21
|
-
|
|
22
|
-
stream.on('ready', () => {
|
|
23
|
-
t.pass('ready emitted')
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
t.ok(stream.write('hello world\n'))
|
|
27
|
-
t.ok(stream.write('something else\n'))
|
|
28
|
-
|
|
29
|
-
stream.end()
|
|
30
|
-
|
|
31
|
-
stream.on('finish', () => {
|
|
32
|
-
fs.readFile(dest, 'utf8', (err, data) => {
|
|
33
|
-
t.error(err)
|
|
34
|
-
t.equal(data, 'hello world\nsomething else\n')
|
|
35
|
-
})
|
|
36
|
-
})
|
|
37
|
-
stream.on('close', () => {
|
|
38
|
-
t.pass('close emitted')
|
|
39
|
-
})
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
test('write things in a streaming fashion', (t) => {
|
|
43
|
-
t.plan(8)
|
|
44
|
-
|
|
45
|
-
const dest = file()
|
|
46
|
-
const fd = fs.openSync(dest, 'w')
|
|
47
|
-
const stream = new SonicBoom({ fd, sync })
|
|
48
|
-
|
|
49
|
-
stream.once('drain', () => {
|
|
50
|
-
fs.readFile(dest, 'utf8', (err, data) => {
|
|
51
|
-
t.error(err)
|
|
52
|
-
t.equal(data, 'hello world\n')
|
|
53
|
-
t.ok(stream.write('something else\n'))
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
stream.once('drain', () => {
|
|
57
|
-
fs.readFile(dest, 'utf8', (err, data) => {
|
|
58
|
-
t.error(err)
|
|
59
|
-
t.equal(data, 'hello world\nsomething else\n')
|
|
60
|
-
stream.end()
|
|
61
|
-
})
|
|
62
|
-
})
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
t.ok(stream.write('hello world\n'))
|
|
66
|
-
|
|
67
|
-
stream.on('finish', () => {
|
|
68
|
-
t.pass('finish emitted')
|
|
69
|
-
})
|
|
70
|
-
stream.on('close', () => {
|
|
71
|
-
t.pass('close emitted')
|
|
72
|
-
})
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
test('can be piped into', (t) => {
|
|
76
|
-
t.plan(4)
|
|
77
|
-
|
|
78
|
-
const dest = file()
|
|
79
|
-
const fd = fs.openSync(dest, 'w')
|
|
80
|
-
const stream = new SonicBoom({ fd, sync })
|
|
81
|
-
const source = fs.createReadStream(__filename, { encoding: 'utf8' })
|
|
82
|
-
|
|
83
|
-
source.pipe(stream)
|
|
84
|
-
|
|
85
|
-
stream.on('finish', () => {
|
|
86
|
-
fs.readFile(__filename, 'utf8', (err, expected) => {
|
|
87
|
-
t.error(err)
|
|
88
|
-
fs.readFile(dest, 'utf8', (err, data) => {
|
|
89
|
-
t.error(err)
|
|
90
|
-
t.equal(data, expected)
|
|
91
|
-
})
|
|
92
|
-
})
|
|
93
|
-
})
|
|
94
|
-
stream.on('close', () => {
|
|
95
|
-
t.pass('close emitted')
|
|
96
|
-
})
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
test('write things to a file', (t) => {
|
|
100
|
-
t.plan(6)
|
|
101
|
-
|
|
102
|
-
const dest = file()
|
|
103
|
-
const stream = new SonicBoom({ dest, sync })
|
|
104
|
-
|
|
105
|
-
stream.on('ready', () => {
|
|
106
|
-
t.pass('ready emitted')
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
t.ok(stream.write('hello world\n'))
|
|
110
|
-
t.ok(stream.write('something else\n'))
|
|
111
|
-
|
|
112
|
-
stream.end()
|
|
113
|
-
|
|
114
|
-
stream.on('finish', () => {
|
|
115
|
-
fs.readFile(dest, 'utf8', (err, data) => {
|
|
116
|
-
t.error(err)
|
|
117
|
-
t.equal(data, 'hello world\nsomething else\n')
|
|
118
|
-
})
|
|
119
|
-
})
|
|
120
|
-
stream.on('close', () => {
|
|
121
|
-
t.pass('close emitted')
|
|
122
|
-
})
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
test('minLength', (t) => {
|
|
126
|
-
t.plan(8)
|
|
127
|
-
|
|
128
|
-
const dest = file()
|
|
129
|
-
const stream = new SonicBoom({ dest, minLength: 4096, sync })
|
|
130
|
-
|
|
131
|
-
stream.on('ready', () => {
|
|
132
|
-
t.pass('ready emitted')
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
t.ok(stream.write('hello world\n'))
|
|
136
|
-
t.ok(stream.write('something else\n'))
|
|
137
|
-
|
|
138
|
-
const fail = t.fail
|
|
139
|
-
stream.on('drain', fail)
|
|
140
|
-
|
|
141
|
-
// bad use of timer
|
|
142
|
-
// TODO refactor
|
|
143
|
-
setTimeout(function () {
|
|
144
|
-
fs.readFile(dest, 'utf8', (err, data) => {
|
|
145
|
-
t.error(err)
|
|
146
|
-
t.equal(data, '')
|
|
147
|
-
|
|
148
|
-
stream.end()
|
|
149
|
-
|
|
150
|
-
stream.on('finish', () => {
|
|
151
|
-
fs.readFile(dest, 'utf8', (err, data) => {
|
|
152
|
-
t.error(err)
|
|
153
|
-
t.equal(data, 'hello world\nsomething else\n')
|
|
154
|
-
})
|
|
155
|
-
})
|
|
156
|
-
})
|
|
157
|
-
}, 100)
|
|
158
|
-
|
|
159
|
-
stream.on('close', () => {
|
|
160
|
-
t.pass('close emitted')
|
|
161
|
-
})
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
test('write later on recoverable error', (t) => {
|
|
165
|
-
t.plan(8)
|
|
166
|
-
|
|
167
|
-
const fakeFs = Object.create(fs)
|
|
168
|
-
const SonicBoom = proxyquire('../', {
|
|
169
|
-
fs: fakeFs
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
const dest = file()
|
|
173
|
-
const fd = fs.openSync(dest, 'w')
|
|
174
|
-
const stream = new SonicBoom({ fd, minLength: 0, sync })
|
|
175
|
-
|
|
176
|
-
stream.on('ready', () => {
|
|
177
|
-
t.pass('ready emitted')
|
|
178
|
-
})
|
|
179
|
-
stream.on('error', () => {
|
|
180
|
-
t.pass('error emitted')
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
if (sync) {
|
|
184
|
-
fakeFs.writeSync = function (fd, buf, enc) {
|
|
185
|
-
t.pass('fake fs.writeSync called')
|
|
186
|
-
throw new Error('recoverable error')
|
|
187
|
-
}
|
|
188
|
-
} else {
|
|
189
|
-
fakeFs.write = function (fd, buf, ...args) {
|
|
190
|
-
t.pass('fake fs.write called')
|
|
191
|
-
setTimeout(() => args.pop()(new Error('recoverable error')), 0)
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
t.ok(stream.write('hello world\n'))
|
|
196
|
-
|
|
197
|
-
setTimeout(() => {
|
|
198
|
-
if (sync) {
|
|
199
|
-
fakeFs.writeSync = fs.writeSync
|
|
200
|
-
} else {
|
|
201
|
-
fakeFs.write = fs.write
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
t.ok(stream.write('something else\n'))
|
|
205
|
-
|
|
206
|
-
stream.end()
|
|
207
|
-
stream.on('finish', () => {
|
|
208
|
-
fs.readFile(dest, 'utf8', (err, data) => {
|
|
209
|
-
t.error(err)
|
|
210
|
-
t.equal(data, 'hello world\nsomething else\n')
|
|
211
|
-
})
|
|
212
|
-
})
|
|
213
|
-
stream.on('close', () => {
|
|
214
|
-
t.pass('close emitted')
|
|
215
|
-
})
|
|
216
|
-
}, 0)
|
|
217
|
-
})
|
|
218
|
-
|
|
219
|
-
test('emit write events', (t) => {
|
|
220
|
-
t.plan(7)
|
|
221
|
-
|
|
222
|
-
const dest = file()
|
|
223
|
-
const stream = new SonicBoom({ dest, sync })
|
|
224
|
-
|
|
225
|
-
stream.on('ready', () => {
|
|
226
|
-
t.pass('ready emitted')
|
|
227
|
-
})
|
|
228
|
-
|
|
229
|
-
let length = 0
|
|
230
|
-
stream.on('write', (bytes) => {
|
|
231
|
-
length += bytes
|
|
232
|
-
})
|
|
233
|
-
|
|
234
|
-
t.ok(stream.write('hello world\n'))
|
|
235
|
-
t.ok(stream.write('something else\n'))
|
|
236
|
-
|
|
237
|
-
stream.end()
|
|
238
|
-
|
|
239
|
-
stream.on('finish', () => {
|
|
240
|
-
fs.readFile(dest, 'utf8', (err, data) => {
|
|
241
|
-
t.error(err)
|
|
242
|
-
t.equal(data, 'hello world\nsomething else\n')
|
|
243
|
-
t.equal(length, 27)
|
|
244
|
-
})
|
|
245
|
-
})
|
|
246
|
-
stream.on('close', () => {
|
|
247
|
-
t.pass('close emitted')
|
|
248
|
-
})
|
|
249
|
-
})
|
|
250
|
-
|
|
251
|
-
test('write multi-byte characters string over than maxWrite', (t) => {
|
|
252
|
-
const fakeFs = Object.create(fs)
|
|
253
|
-
const MAX_WRITE = 65535
|
|
254
|
-
fakeFs.write = function (fd, buf, ...args) {
|
|
255
|
-
// only write byteLength === MAX_WRITE
|
|
256
|
-
const _buf = Buffer.from(buf).subarray(0, MAX_WRITE).toString()
|
|
257
|
-
fs.write(fd, _buf, ...args)
|
|
258
|
-
setImmediate(args[args.length - 1], null, MAX_WRITE)
|
|
259
|
-
fakeFs.write = function (fd, buf, ...args) {
|
|
260
|
-
fs.write(fd, buf, ...args)
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
const SonicBoom = proxyquire('../', {
|
|
264
|
-
fs: fakeFs
|
|
265
|
-
})
|
|
266
|
-
const dest = file()
|
|
267
|
-
const fd = fs.openSync(dest, 'w')
|
|
268
|
-
const stream = new SonicBoom({ fd, minLength: 0, sync, maxWrite: MAX_WRITE })
|
|
269
|
-
let buf = Buffer.alloc(MAX_WRITE).fill('x')
|
|
270
|
-
buf = '🌲' + buf.toString()
|
|
271
|
-
stream.write(buf)
|
|
272
|
-
stream.end()
|
|
273
|
-
|
|
274
|
-
stream.on('finish', () => {
|
|
275
|
-
fs.readFile(dest, 'utf8', (err, data) => {
|
|
276
|
-
t.error(err)
|
|
277
|
-
t.equal(data, buf)
|
|
278
|
-
t.end()
|
|
279
|
-
})
|
|
280
|
-
})
|
|
281
|
-
stream.on('close', () => {
|
|
282
|
-
t.pass('close emitted')
|
|
283
|
-
})
|
|
284
|
-
stream.on('error', () => {
|
|
285
|
-
t.pass('error emitted')
|
|
286
|
-
})
|
|
287
|
-
})
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
test('write buffers that are not totally written', (t) => {
|
|
291
|
-
t.plan(9)
|
|
292
|
-
|
|
293
|
-
const fakeFs = Object.create(fs)
|
|
294
|
-
fakeFs.write = function (fd, buf, ...args) {
|
|
295
|
-
t.pass('fake fs.write called')
|
|
296
|
-
fakeFs.write = function (fd, buf, ...args) {
|
|
297
|
-
t.pass('calling real fs.write, ' + buf)
|
|
298
|
-
fs.write(fd, buf, ...args)
|
|
299
|
-
}
|
|
300
|
-
process.nextTick(args[args.length - 1], null, 0)
|
|
301
|
-
}
|
|
302
|
-
const SonicBoom = proxyquire('../', {
|
|
303
|
-
fs: fakeFs
|
|
304
|
-
})
|
|
305
|
-
|
|
306
|
-
const dest = file()
|
|
307
|
-
const fd = fs.openSync(dest, 'w')
|
|
308
|
-
const stream = new SonicBoom({ fd, minLength: 0, sync: false })
|
|
309
|
-
|
|
310
|
-
stream.on('ready', () => {
|
|
311
|
-
t.pass('ready emitted')
|
|
312
|
-
})
|
|
313
|
-
|
|
314
|
-
t.ok(stream.write('hello world\n'))
|
|
315
|
-
t.ok(stream.write('something else\n'))
|
|
316
|
-
|
|
317
|
-
stream.end()
|
|
318
|
-
|
|
319
|
-
stream.on('finish', () => {
|
|
320
|
-
fs.readFile(dest, 'utf8', (err, data) => {
|
|
321
|
-
t.error(err)
|
|
322
|
-
t.equal(data, 'hello world\nsomething else\n')
|
|
323
|
-
})
|
|
324
|
-
})
|
|
325
|
-
stream.on('close', () => {
|
|
326
|
-
t.pass('close emitted')
|
|
327
|
-
})
|
|
328
|
-
})
|
|
329
|
-
|
|
330
|
-
test('write enormously large buffers async', (t) => {
|
|
331
|
-
t.plan(3)
|
|
332
|
-
|
|
333
|
-
const dest = file()
|
|
334
|
-
const fd = fs.openSync(dest, 'w')
|
|
335
|
-
const stream = new SonicBoom({ fd, minLength: 0, sync: false })
|
|
336
|
-
|
|
337
|
-
const buf = Buffer.alloc(1024).fill('x').toString() // 1 MB
|
|
338
|
-
let length = 0
|
|
339
|
-
|
|
340
|
-
for (let i = 0; i < 1024 * 512; i++) {
|
|
341
|
-
length += buf.length
|
|
342
|
-
stream.write(buf)
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
stream.end()
|
|
346
|
-
|
|
347
|
-
stream.on('finish', () => {
|
|
348
|
-
fs.stat(dest, (err, stat) => {
|
|
349
|
-
t.error(err)
|
|
350
|
-
t.equal(stat.size, length)
|
|
351
|
-
})
|
|
352
|
-
})
|
|
353
|
-
stream.on('close', () => {
|
|
354
|
-
t.pass('close emitted')
|
|
355
|
-
})
|
|
356
|
-
})
|
|
357
|
-
|
|
358
|
-
test('make sure `maxWrite` is passed', (t) => {
|
|
359
|
-
t.plan(1)
|
|
360
|
-
const dest = file()
|
|
361
|
-
const stream = new SonicBoom({ dest, maxLength: 65536 })
|
|
362
|
-
t.equal(stream.maxLength, 65536)
|
|
363
|
-
})
|
|
364
|
-
|
|
365
|
-
test('write enormously large buffers async atomicly', (t) => {
|
|
366
|
-
const fakeFs = Object.create(fs)
|
|
367
|
-
const SonicBoom = proxyquire('../', {
|
|
368
|
-
fs: fakeFs
|
|
369
|
-
})
|
|
370
|
-
|
|
371
|
-
const dest = file()
|
|
372
|
-
const fd = fs.openSync(dest, 'w')
|
|
373
|
-
const stream = new SonicBoom({ fd, minLength: 0, sync: false })
|
|
374
|
-
|
|
375
|
-
const buf = Buffer.alloc(1023).fill('x').toString()
|
|
376
|
-
|
|
377
|
-
fakeFs.write = function (fd, _buf, ...args) {
|
|
378
|
-
if (_buf.length % buf.length !== 0) {
|
|
379
|
-
t.fail('write called with wrong buffer size')
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
setImmediate(args[args.length - 1], null, _buf.length)
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
for (let i = 0; i < 1024 * 512; i++) {
|
|
386
|
-
stream.write(buf)
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
setImmediate(() => {
|
|
390
|
-
for (let i = 0; i < 1024 * 512; i++) {
|
|
391
|
-
stream.write(buf)
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
stream.end()
|
|
395
|
-
})
|
|
396
|
-
|
|
397
|
-
stream.on('close', () => {
|
|
398
|
-
t.pass('close emitted')
|
|
399
|
-
t.end()
|
|
400
|
-
})
|
|
401
|
-
})
|
|
402
|
-
|
|
403
|
-
test('write should not drop new data if buffer is not full', (t) => {
|
|
404
|
-
t.plan(2)
|
|
405
|
-
const fakeFs = Object.create(fs)
|
|
406
|
-
const SonicBoom = proxyquire('../', {
|
|
407
|
-
fs: fakeFs
|
|
408
|
-
})
|
|
409
|
-
|
|
410
|
-
const dest = file()
|
|
411
|
-
const fd = fs.openSync(dest, 'w')
|
|
412
|
-
const stream = new SonicBoom({ fd, minLength: 101, maxLength: 102, sync: false })
|
|
413
|
-
|
|
414
|
-
const buf = Buffer.alloc(100).fill('x').toString()
|
|
415
|
-
|
|
416
|
-
fakeFs.write = function (fd, _buf, ...args) {
|
|
417
|
-
t.equal(_buf.length, buf.length + 2)
|
|
418
|
-
setImmediate(args[args.length - 1], null, _buf.length)
|
|
419
|
-
fakeFs.write = () => t.error('shouldnt call write again')
|
|
420
|
-
stream.end()
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
stream.on('drop', (data) => {
|
|
424
|
-
t.error('should not drop')
|
|
425
|
-
})
|
|
426
|
-
|
|
427
|
-
stream.write(buf)
|
|
428
|
-
stream.write('aa')
|
|
429
|
-
|
|
430
|
-
stream.on('close', () => {
|
|
431
|
-
t.pass('close emitted')
|
|
432
|
-
})
|
|
433
|
-
})
|
|
434
|
-
|
|
435
|
-
test('write should drop new data if buffer is full', (t) => {
|
|
436
|
-
t.plan(3)
|
|
437
|
-
const fakeFs = Object.create(fs)
|
|
438
|
-
const SonicBoom = proxyquire('../', {
|
|
439
|
-
fs: fakeFs
|
|
440
|
-
})
|
|
441
|
-
|
|
442
|
-
const dest = file()
|
|
443
|
-
const fd = fs.openSync(dest, 'w')
|
|
444
|
-
const stream = new SonicBoom({ fd, minLength: 101, maxLength: 102, sync: false })
|
|
445
|
-
|
|
446
|
-
const buf = Buffer.alloc(100).fill('x').toString()
|
|
447
|
-
|
|
448
|
-
fakeFs.write = function (fd, _buf, ...args) {
|
|
449
|
-
t.equal(_buf.length, buf.length)
|
|
450
|
-
setImmediate(args[args.length - 1], null, _buf.length)
|
|
451
|
-
fakeFs.write = () => t.error('shouldnt call write more than once')
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
stream.on('drop', (data) => {
|
|
455
|
-
t.equal(data.length, 3)
|
|
456
|
-
stream.end()
|
|
457
|
-
})
|
|
458
|
-
|
|
459
|
-
stream.write(buf)
|
|
460
|
-
stream.write('aaa')
|
|
461
|
-
|
|
462
|
-
stream.on('close', () => {
|
|
463
|
-
t.pass('close emitted')
|
|
464
|
-
})
|
|
465
|
-
})
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* License for programmatically and manually incorporated
|
|
3
|
-
* documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc
|
|
4
|
-
*
|
|
5
|
-
* Copyright Node.js contributors. All rights reserved.
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to
|
|
8
|
-
* deal in the Software without restriction, including without limitation the
|
|
9
|
-
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
10
|
-
* sell copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in
|
|
14
|
-
* all copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
21
|
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
22
|
-
* IN THE SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
// NOTE: These definitions support Node.js and TypeScript 5.1.
|
|
26
|
-
|
|
27
|
-
// Reference required TypeScript libraries:
|
|
28
|
-
/// <reference lib="es2020" />
|
|
29
|
-
|
|
30
|
-
// TypeScript library polyfills required for TypeScript <=5.1:
|
|
31
|
-
/// <reference path="./compatibility/disposable.d.ts" />
|
|
32
|
-
|
|
33
|
-
// TypeScript library polyfills required for TypeScript <=5.6:
|
|
34
|
-
/// <reference path="../ts5.6/compatibility/float16array.d.ts" />
|
|
35
|
-
|
|
36
|
-
// Iterator definitions required for compatibility with TypeScript <5.6:
|
|
37
|
-
/// <reference path="../compatibility/iterators.d.ts" />
|
|
38
|
-
|
|
39
|
-
// Definitions for Node.js modules specific to TypeScript <=5.6:
|
|
40
|
-
/// <reference path="../ts5.6/globals.typedarray.d.ts" />
|
|
41
|
-
/// <reference path="../ts5.6/buffer.buffer.d.ts" />
|
|
42
|
-
|
|
43
|
-
// Definitions for Node.js modules that are not specific to any version of TypeScript:
|
|
44
|
-
/// <reference path="../globals.d.ts" />
|
|
45
|
-
/// <reference path="../assert.d.ts" />
|
|
46
|
-
/// <reference path="../assert/strict.d.ts" />
|
|
47
|
-
/// <reference path="../async_hooks.d.ts" />
|
|
48
|
-
/// <reference path="../buffer.d.ts" />
|
|
49
|
-
/// <reference path="../child_process.d.ts" />
|
|
50
|
-
/// <reference path="../cluster.d.ts" />
|
|
51
|
-
/// <reference path="../console.d.ts" />
|
|
52
|
-
/// <reference path="../constants.d.ts" />
|
|
53
|
-
/// <reference path="../crypto.d.ts" />
|
|
54
|
-
/// <reference path="../dgram.d.ts" />
|
|
55
|
-
/// <reference path="../diagnostics_channel.d.ts" />
|
|
56
|
-
/// <reference path="../dns.d.ts" />
|
|
57
|
-
/// <reference path="../dns/promises.d.ts" />
|
|
58
|
-
/// <reference path="../dns/promises.d.ts" />
|
|
59
|
-
/// <reference path="../domain.d.ts" />
|
|
60
|
-
/// <reference path="../dom-events.d.ts" />
|
|
61
|
-
/// <reference path="../events.d.ts" />
|
|
62
|
-
/// <reference path="../fs.d.ts" />
|
|
63
|
-
/// <reference path="../fs/promises.d.ts" />
|
|
64
|
-
/// <reference path="../http.d.ts" />
|
|
65
|
-
/// <reference path="../http2.d.ts" />
|
|
66
|
-
/// <reference path="../https.d.ts" />
|
|
67
|
-
/// <reference path="../inspector.d.ts" />
|
|
68
|
-
/// <reference path="../module.d.ts" />
|
|
69
|
-
/// <reference path="../net.d.ts" />
|
|
70
|
-
/// <reference path="../os.d.ts" />
|
|
71
|
-
/// <reference path="../path.d.ts" />
|
|
72
|
-
/// <reference path="../perf_hooks.d.ts" />
|
|
73
|
-
/// <reference path="../process.d.ts" />
|
|
74
|
-
/// <reference path="../punycode.d.ts" />
|
|
75
|
-
/// <reference path="../querystring.d.ts" />
|
|
76
|
-
/// <reference path="../readline.d.ts" />
|
|
77
|
-
/// <reference path="../readline/promises.d.ts" />
|
|
78
|
-
/// <reference path="../repl.d.ts" />
|
|
79
|
-
/// <reference path="../sea.d.ts" />
|
|
80
|
-
/// <reference path="../sqlite.d.ts" />
|
|
81
|
-
/// <reference path="../stream.d.ts" />
|
|
82
|
-
/// <reference path="../stream/promises.d.ts" />
|
|
83
|
-
/// <reference path="../stream/consumers.d.ts" />
|
|
84
|
-
/// <reference path="../stream/web.d.ts" />
|
|
85
|
-
/// <reference path="../string_decoder.d.ts" />
|
|
86
|
-
/// <reference path="../test.d.ts" />
|
|
87
|
-
/// <reference path="../timers.d.ts" />
|
|
88
|
-
/// <reference path="../timers/promises.d.ts" />
|
|
89
|
-
/// <reference path="../tls.d.ts" />
|
|
90
|
-
/// <reference path="../trace_events.d.ts" />
|
|
91
|
-
/// <reference path="../tty.d.ts" />
|
|
92
|
-
/// <reference path="../url.d.ts" />
|
|
93
|
-
/// <reference path="../util.d.ts" />
|
|
94
|
-
/// <reference path="../v8.d.ts" />
|
|
95
|
-
/// <reference path="../vm.d.ts" />
|
|
96
|
-
/// <reference path="../wasi.d.ts" />
|
|
97
|
-
/// <reference path="../worker_threads.d.ts" />
|
|
98
|
-
/// <reference path="../zlib.d.ts" />
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const spawn = require('child_process').spawnSync;
|
|
4
|
-
|
|
5
|
-
const filesToCheck = '*.js';
|
|
6
|
-
const FORMAT_START = process.env.FORMAT_START || 'main';
|
|
7
|
-
const IS_WIN = process.platform === 'win32';
|
|
8
|
-
const ESLINT_PATH = IS_WIN ? 'node_modules\\.bin\\eslint.cmd' : 'node_modules/.bin/eslint';
|
|
9
|
-
|
|
10
|
-
function main (args) {
|
|
11
|
-
let fix = false;
|
|
12
|
-
while (args.length > 0) {
|
|
13
|
-
switch (args[0]) {
|
|
14
|
-
case '-f':
|
|
15
|
-
case '--fix':
|
|
16
|
-
fix = true;
|
|
17
|
-
break;
|
|
18
|
-
default:
|
|
19
|
-
}
|
|
20
|
-
args.shift();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Check js files that change on unstaged file
|
|
24
|
-
const fileUnStaged = spawn(
|
|
25
|
-
'git',
|
|
26
|
-
['diff', '--name-only', '--diff-filter=d', FORMAT_START, filesToCheck],
|
|
27
|
-
{
|
|
28
|
-
encoding: 'utf-8'
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
// Check js files that change on staged file
|
|
33
|
-
const fileStaged = spawn(
|
|
34
|
-
'git',
|
|
35
|
-
['diff', '--name-only', '--cached', '--diff-filter=d', FORMAT_START, filesToCheck],
|
|
36
|
-
{
|
|
37
|
-
encoding: 'utf-8'
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const options = [
|
|
42
|
-
...fileStaged.stdout.split('\n').filter((f) => f !== ''),
|
|
43
|
-
...fileUnStaged.stdout.split('\n').filter((f) => f !== '')
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
if (fix) {
|
|
47
|
-
options.push('--fix');
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const result = spawn(ESLINT_PATH, [...options], {
|
|
51
|
-
encoding: 'utf-8'
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
if (result.error && result.error.errno === 'ENOENT') {
|
|
55
|
-
console.error('Eslint not found! Eslint is supposed to be found at ', ESLINT_PATH);
|
|
56
|
-
return 2;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (result.status === 1) {
|
|
60
|
-
console.error('Eslint error:', result.stdout);
|
|
61
|
-
const fixCmd = 'npm run lint:fix';
|
|
62
|
-
console.error(`ERROR: please run "${fixCmd}" to format changes in your commit
|
|
63
|
-
Note that when running the command locally, please keep your local
|
|
64
|
-
main branch and working branch up to date with nodejs/node-addon-api
|
|
65
|
-
to exclude un-related complains.
|
|
66
|
-
Or you can run "env FORMAT_START=upstream/main ${fixCmd}".
|
|
67
|
-
Also fix JS files by yourself if necessary.`);
|
|
68
|
-
return 1;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (result.stderr) {
|
|
72
|
-
console.error('Error running eslint:', result.stderr);
|
|
73
|
-
return 2;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (require.main === module) {
|
|
78
|
-
process.exitCode = main(process.argv.slice(2));
|
|
79
|
-
}
|