@contrast/agent-bundle 5.39.1 → 5.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@contrast/agent/lib/start-agent.js +50 -40
- package/node_modules/@contrast/agent/package.json +11 -11
- package/node_modules/@contrast/agent-swc-plugin/index.js +9 -3
- package/node_modules/@contrast/agent-swc-plugin/methods.js +15 -1
- package/node_modules/@contrast/agent-swc-plugin/package.json +5 -8
- package/node_modules/@contrast/agent-swc-plugin/rewriter.wasm +0 -0
- package/node_modules/@contrast/agentify/lib/index.js +2 -2
- package/node_modules/@contrast/agentify/package.json +15 -14
- package/node_modules/@contrast/architecture-components/package.json +5 -5
- package/node_modules/@contrast/assess/lib/dataflow/propagation/install/string/replace.js +6 -3
- package/node_modules/@contrast/assess/lib/dataflow/propagation/install/util-format.js +44 -21
- package/node_modules/@contrast/assess/lib/dataflow/sources/index.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/{body-parser1.js → body-parser.js} +2 -2
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/koa-bodyparsers.js +3 -1
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/qs6.js +5 -5
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/querystring.js +2 -1
- package/node_modules/@contrast/assess/lib/index.d.ts +0 -1
- package/node_modules/@contrast/assess/lib/make-source-context.js +7 -37
- package/node_modules/@contrast/assess/lib/sampler/common.js +7 -11
- package/node_modules/@contrast/assess/package.json +12 -11
- package/node_modules/@contrast/common/lib/constants.d.ts +6 -0
- package/node_modules/@contrast/common/lib/constants.js +8 -1
- package/node_modules/@contrast/common/lib/types.d.ts +7 -1
- package/node_modules/@contrast/common/package.json +1 -1
- package/node_modules/@contrast/config/lib/common.js +1 -1
- package/node_modules/@contrast/config/lib/config.js +49 -27
- package/node_modules/@contrast/config/lib/index.d.ts +3 -2
- package/node_modules/@contrast/config/lib/options.js +4 -4
- package/node_modules/@contrast/config/package.json +4 -3
- package/node_modules/@contrast/core/lib/sensitive-data-masking/protect-listener.js +15 -15
- package/node_modules/@contrast/core/package.json +6 -6
- package/node_modules/@contrast/deadzones/package.json +5 -5
- package/node_modules/@contrast/dep-hooks/package.json +3 -3
- package/node_modules/@contrast/esm-hooks/package.json +6 -6
- package/node_modules/@contrast/instrumentation/lib/index.js +0 -1
- package/node_modules/@contrast/instrumentation/package.json +5 -5
- package/node_modules/@contrast/library-analysis/lib/install/library-reporting/dep.json +300 -152
- package/node_modules/@contrast/library-analysis/lib/install/library-reporting/index.js +9 -2
- package/node_modules/@contrast/library-analysis/lib/install/library-reporting/utils.js +54 -43
- package/node_modules/@contrast/library-analysis/package.json +4 -4
- package/node_modules/@contrast/logger/lib/serializers.js +2 -2
- package/node_modules/@contrast/logger/package.json +3 -3
- package/node_modules/@contrast/metrics/package.json +6 -6
- package/node_modules/@contrast/patcher/package.json +2 -2
- package/node_modules/@contrast/protect/lib/get-source-context.js +3 -1
- package/node_modules/@contrast/protect/lib/index.js +6 -1
- package/node_modules/@contrast/protect/lib/input-analysis/handlers.js +7 -9
- package/node_modules/@contrast/protect/lib/input-analysis/index.js +1 -1
- package/node_modules/@contrast/protect/lib/input-analysis/install/{body-parser1.js → body-parser.js} +1 -1
- package/node_modules/@contrast/protect/lib/input-analysis/install/http.js +18 -19
- package/node_modules/@contrast/protect/lib/input-analysis/install/qs6.js +18 -17
- package/node_modules/@contrast/protect/lib/input-analysis/install/universal-cookie4.js +2 -3
- package/node_modules/@contrast/protect/lib/make-source-context.js +22 -66
- package/node_modules/@contrast/protect/lib/semantic-analysis/handlers.js +73 -72
- package/node_modules/@contrast/protect/package.json +11 -11
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/index.js +7 -7
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.d.ts +3 -3
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.js +24 -21
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/routes-observed.js +2 -1
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.js +1 -1
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.d.ts +1 -2
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.js +8 -2
- package/node_modules/@contrast/reporter/lib/reporters/security-logger/index.d.ts +2 -2
- package/node_modules/@contrast/reporter/lib/reporters/security-logger/index.js +22 -20
- package/node_modules/@contrast/reporter/package.json +7 -7
- package/node_modules/@contrast/rewriter/lib/index.js +2 -2
- package/node_modules/@contrast/rewriter/package.json +6 -6
- package/node_modules/@contrast/route-coverage/lib/index.d.ts +2 -0
- package/node_modules/@contrast/route-coverage/lib/index.js +15 -17
- package/node_modules/@contrast/route-coverage/lib/install/express/express5.js +489 -202
- package/node_modules/@contrast/route-coverage/package.json +9 -9
- package/node_modules/@contrast/scopes/package.json +5 -5
- package/node_modules/@contrast/sec-obs/lib/traces/http.js +2 -2
- package/node_modules/@contrast/sec-obs/lib/traces/http.test.js +17 -0
- package/node_modules/@contrast/sec-obs/lib/traces/outbound-service-call.js +2 -2
- package/node_modules/@contrast/sec-obs/lib/traces/outbound-service-call.test.js +17 -0
- package/node_modules/@contrast/sec-obs/package.json +9 -9
- package/node_modules/@contrast/sources/lib/index.js +109 -0
- package/node_modules/@contrast/sources/lib/index.test.js +120 -0
- package/node_modules/@contrast/{route-coverage/lib/normalized-url-mapper.js → sources/lib/normalized-uri-mapper.js} +10 -3
- package/node_modules/@contrast/sources/lib/normalized-uri-mapper.test.js +59 -0
- package/node_modules/@contrast/{sec-obs/node_modules/@contrast/core/lib/sensitive-data-masking/constants.js → sources/lib/req-data.js} +0 -6
- package/node_modules/@contrast/sources/lib/source-info.js +183 -0
- package/node_modules/@contrast/sources/lib/source-info.test.js +68 -0
- package/node_modules/@contrast/sources/package.json +16 -0
- package/node_modules/@contrast/telemetry/package.json +6 -6
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.d.ts +2831 -77
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js +2831 -77
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.d.ts +415 -98
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.js +415 -98
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.d.ts +106 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js +106 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js.map +1 -1
- 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 +2831 -77
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.js +2831 -77
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.d.ts +415 -98
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.js +415 -98
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.d.ts +106 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.js +106 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.js.map +1 -1
- 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 +2831 -77
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.js +2858 -103
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.d.ts +415 -98
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js +420 -102
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.d.ts +106 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js +106 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js.map +1 -1
- 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 +3 -3
- package/node_modules/@types/node/README.md +2 -2
- package/node_modules/@types/node/buffer.d.ts +5 -0
- package/node_modules/@types/node/dns/promises.d.ts +11 -10
- package/node_modules/@types/node/dns.d.ts +18 -19
- package/node_modules/@types/node/fs.d.ts +13 -1
- package/node_modules/@types/node/http.d.ts +4 -19
- package/node_modules/@types/node/inspector.d.ts +53 -0
- package/node_modules/@types/node/package.json +2 -82
- package/node_modules/@types/node/stream/web.d.ts +4 -0
- package/node_modules/axios/CHANGELOG.md +17 -0
- package/node_modules/axios/README.md +1 -4
- package/node_modules/axios/dist/axios.js +39 -5
- 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 +46 -9
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
- package/node_modules/axios/dist/esm/axios.js +46 -9
- 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 +46 -9
- package/node_modules/axios/dist/node/axios.cjs.map +1 -1
- package/node_modules/axios/index.d.cts +13 -2
- package/node_modules/axios/lib/core/Axios.js +2 -2
- package/node_modules/axios/lib/core/mergeConfig.js +1 -1
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/throttle.js +1 -1
- package/node_modules/axios/lib/helpers/toURLEncodedForm.js +4 -3
- package/node_modules/axios/lib/utils.js +36 -0
- package/node_modules/axios/package.json +5 -5
- package/node_modules/deepmerge/.editorconfig +7 -0
- package/node_modules/deepmerge/.eslintcache +1 -0
- package/node_modules/deepmerge/changelog.md +167 -0
- package/node_modules/deepmerge/dist/cjs.js +133 -0
- package/node_modules/deepmerge/dist/umd.js +139 -0
- package/node_modules/deepmerge/index.d.ts +20 -0
- package/node_modules/deepmerge/index.js +106 -0
- package/node_modules/{path-to-regexp/LICENSE → deepmerge/license.txt} +1 -1
- package/node_modules/deepmerge/package.json +42 -0
- package/node_modules/deepmerge/readme.md +264 -0
- package/node_modules/deepmerge/rollup.config.js +22 -0
- package/node_modules/follow-redirects/package.json +1 -1
- package/node_modules/form-data/CHANGELOG.md +601 -0
- package/node_modules/form-data/{Readme.md → README.md} +4 -4
- package/node_modules/form-data/lib/form_data.js +2 -6
- package/node_modules/form-data/package.json +22 -6
- package/node_modules/nan/.github/workflows/ci.yml +8 -10
- package/node_modules/nan/.pre-commit-config.yaml +8 -0
- package/node_modules/nan/CHANGELOG.md +5 -1
- package/node_modules/nan/README.md +4 -4
- package/node_modules/nan/nan.h +16 -12
- package/node_modules/nan/nan_callbacks.h +13 -0
- package/node_modules/nan/nan_callbacks_12_inl.h +16 -2
- package/node_modules/nan/nan_callbacks_pre_12_inl.h +6 -2
- package/node_modules/nan/nan_maybe_43_inl.h +1 -1
- package/node_modules/nan/nan_maybe_pre_43_inl.h +1 -1
- package/node_modules/nan/nan_scriptorigin.h +11 -9
- package/node_modules/nan/nan_typedarray_contents.h +1 -1
- package/node_modules/nan/package.json +2 -2
- package/package.json +5 -3
- package/node_modules/@contrast/agentify/lib/sources.js +0 -94
- package/node_modules/@contrast/route-coverage/lib/install/http.js +0 -44
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/LICENSE +0 -12
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/constants.d.ts +0 -385
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/constants.js +0 -270
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/index.d.ts +0 -40
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/index.js +0 -228
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/primordials.d.ts +0 -65
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/primordials.js +0 -66
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/types.d.ts +0 -383
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/types.js +0 -30
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/package.json +0 -23
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/LICENSE +0 -12
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/README.md +0 -44
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/common.js +0 -131
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/config.js +0 -290
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/index.d.ts +0 -328
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/index.js +0 -29
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/options.js +0 -836
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/validators.js +0 -23
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/package.json +0 -27
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/LICENSE +0 -12
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/README.md +0 -98
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/agent-info.js +0 -36
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/app-info.js +0 -233
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/build-id.js +0 -51
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/capture-stacktrace.js +0 -256
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/contrast-methods.js +0 -155
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/index.d.ts +0 -52
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/ioc/core.js +0 -95
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/is-agent-path.js +0 -37
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/messages.js +0 -28
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/sensitive-data-masking/index.js +0 -63
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/sensitive-data-masking/protect-listener.js +0 -111
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/sensitive-data-masking/server-settings-listener.js +0 -44
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/system-info/cloud-provider-metadata.js +0 -146
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/system-info/index.js +0 -225
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/system-info/linux-os-info.js +0 -137
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/system-info/utils.js +0 -35
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/package.json +0 -33
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/LICENSE +0 -12
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/README.md +0 -94
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/export-handler-registry.d.ts +0 -121
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/export-handler-registry.js +0 -206
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/export-hook-descriptor.d.ts +0 -72
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/export-hook-descriptor.js +0 -88
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/handler-invoker.d.ts +0 -46
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/handler-invoker.js +0 -106
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/helpers.d.ts +0 -28
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/helpers.js +0 -66
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/index.d.ts +0 -115
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/index.js +0 -208
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/package-finder.d.ts +0 -43
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/package-finder.js +0 -79
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/package.json +0 -29
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/LICENSE +0 -12
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/README.md +0 -270
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/index.d.ts +0 -16
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/index.js +0 -132
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/serializers.d.ts +0 -33
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/serializers.js +0 -75
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/utils.d.ts +0 -15
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/utils.js +0 -34
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/package.json +0 -28
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/patcher/LICENSE +0 -12
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/patcher/README.md +0 -51
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/patcher/lib/index.d.ts +0 -101
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/patcher/lib/index.js +0 -544
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/patcher/package.json +0 -25
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/LICENSE +0 -12
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/README.md +0 -6
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/lib/cache.js +0 -318
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/lib/index.js +0 -216
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/lib/rewrite-is-deadzoned.js +0 -143
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/package.json +0 -30
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/LICENSE +0 -12
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/constants.js +0 -26
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/index.d.ts +0 -46
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/index.js +0 -70
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/bluebird.js +0 -128
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/index.js +0 -34
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/mongodb-core.js +0 -83
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/mongodb3.js +0 -89
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/mongodb4.js +0 -80
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/mongodb6.js +0 -46
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/mysql.js +0 -151
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/redis.js +0 -79
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/utils.js +0 -35
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/package.json +0 -28
- package/node_modules/form-data/README.md.bak +0 -355
- package/node_modules/path-to-regexp/Readme.md +0 -216
- package/node_modules/path-to-regexp/dist/index.d.ts +0 -136
- package/node_modules/path-to-regexp/dist/index.js +0 -403
- package/node_modules/path-to-regexp/dist/index.js.map +0 -1
- package/node_modules/path-to-regexp/package.json +0 -62
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright: 2025 Contrast Security, Inc
|
|
3
|
-
* Contact: support@contrastsecurity.com
|
|
4
|
-
* License: Commercial
|
|
5
|
-
|
|
6
|
-
* NOTICE: This Software and the patented inventions embodied within may only be
|
|
7
|
-
* used as part of Contrast Security’s commercial offerings. Even though it is
|
|
8
|
-
* made available through public repositories, use of this Software is subject to
|
|
9
|
-
* the applicable End User Licensing Agreement found at
|
|
10
|
-
* https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
|
|
11
|
-
* between Contrast Security and the End User. The Software may not be reverse
|
|
12
|
-
* engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
13
|
-
* way not consistent with the End User License Agreement.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
'use strict';
|
|
17
|
-
|
|
18
|
-
// Abusing the `validators` pattern to allow us to log after core has been set up.
|
|
19
|
-
module.exports.config = function config(core) {
|
|
20
|
-
core.config._logs.forEach(({ level, obj, msg, args = [] }) => {
|
|
21
|
-
core.logger[level](obj, msg, ...args);
|
|
22
|
-
});
|
|
23
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@contrast/config",
|
|
3
|
-
"version": "1.48.0",
|
|
4
|
-
"description": "An API for discovering Contrast agent configuration data",
|
|
5
|
-
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
-
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|
|
7
|
-
"files": [
|
|
8
|
-
"lib/",
|
|
9
|
-
"!*.test.*",
|
|
10
|
-
"!tsconfig.*",
|
|
11
|
-
"!*.map"
|
|
12
|
-
],
|
|
13
|
-
"main": "lib/index.js",
|
|
14
|
-
"types": "lib/index.d.ts",
|
|
15
|
-
"engines": {
|
|
16
|
-
"npm": ">=6.13.7 <7 || >= 8.3.1",
|
|
17
|
-
"node": ">= 16.9.1"
|
|
18
|
-
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"test": "bash ../scripts/test.sh"
|
|
21
|
-
},
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@contrast/common": "1.33.0",
|
|
24
|
-
"@contrast/core": "1.53.0",
|
|
25
|
-
"yaml": "^2.2.2"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Copyright: 2025 Contrast Security, Inc
|
|
2
|
-
Contact: support@contrastsecurity.com
|
|
3
|
-
License: Commercial
|
|
4
|
-
|
|
5
|
-
NOTICE: This Software and the patented inventions embodied within may only be
|
|
6
|
-
used as part of Contrast Security’s commercial offerings. Even though it is
|
|
7
|
-
made available through public repositories, use of this Software is subject to
|
|
8
|
-
the applicable End User Licensing Agreement found at
|
|
9
|
-
https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
|
|
10
|
-
between Contrast Security and the End User. The Software may not be reverse
|
|
11
|
-
engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
12
|
-
way not consistent with the End User License Agreement.
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
# `@contrast/core`
|
|
2
|
-
|
|
3
|
-
Discovers Contrast configuration data (yaml, env vars, etc) and preconfigures a common set of APIs to be used for agent and tooling development.
|
|
4
|
-
|
|
5
|
-
## Basic Usage
|
|
6
|
-
|
|
7
|
-
The module exports a factory function.
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
const core = require('@contrast/core')();
|
|
11
|
-
|
|
12
|
-
```
|
|
13
|
-
### What You Get
|
|
14
|
-
|
|
15
|
-
- Logging
|
|
16
|
-
|
|
17
|
-
```typescript
|
|
18
|
-
core.logger.info('...');
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
See more about the `@contrast/logger` service [here](../logger/README.md).
|
|
22
|
-
|
|
23
|
-
- Monkey-patching
|
|
24
|
-
|
|
25
|
-
```typescript
|
|
26
|
-
core.patcher.patch(res, 'end', {
|
|
27
|
-
name: 'http.ServerResponse.end',
|
|
28
|
-
patchType: 'http-things',
|
|
29
|
-
pre(data) {
|
|
30
|
-
// ...
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
See more about the `@contrast/patcher` service [here](../patcher/README.md).
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
- Code rewriting
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
core.rewriter.addTransforms({
|
|
42
|
-
CallExpression(path, state) {
|
|
43
|
-
// ...
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
core.rewriter.rewrite('function() { ...');
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
See more about the `@contrast/rewriter` service [here](../rewriter/README.md).
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
- Dependency hooks
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
core.depHooks.resolve({ name: 'http' }, http => {
|
|
56
|
-
// implemention details
|
|
57
|
-
});
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
See more about the `@contrast/dep-hooks` service [here](../dep-hooks/README.md).
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
- Models and factories
|
|
64
|
-
|
|
65
|
-
The construction of model data _can_ rely on configuration and therefore can be stateful. So, we provide the models and their factories as services that can be used by consumers as if static.
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
// stackframe filtration is configurable, thus stateful
|
|
69
|
-
const snap = core.models.StacktraceFactory.createSnapshot();
|
|
70
|
-
const frames = snap();
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
See more about the `@contrast/models` service [here](../models/README.md).
|
|
74
|
-
|
|
75
|
-
- Report messages
|
|
76
|
-
|
|
77
|
-
```typescript
|
|
78
|
-
// configuration will tell which reporters become active
|
|
79
|
-
core.reporters.install();
|
|
80
|
-
core.messages.emit('ProtectInputTracingEvent', { ... });
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
See more about the `@contrast/reporter` service [here](../reporter/README.md).
|
|
84
|
-
|
|
85
|
-
- Other stuff
|
|
86
|
-
|
|
87
|
-
There are some utility-type functions that rely on configuration state.
|
|
88
|
-
|
|
89
|
-
```typescript
|
|
90
|
-
// This uses core.config.stack_trace_filters (new to v5)
|
|
91
|
-
core.isAgentPath('/foo');
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## Related
|
|
95
|
-
|
|
96
|
-
- `@contrast/agentify`: Integrate core services and instrumentation into an application. See more [here](../agentify/README.md).
|
|
97
|
-
|
|
98
|
-
<br><br>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright: 2025 Contrast Security, Inc
|
|
3
|
-
* Contact: support@contrastsecurity.com
|
|
4
|
-
* License: Commercial
|
|
5
|
-
|
|
6
|
-
* NOTICE: This Software and the patented inventions embodied within may only be
|
|
7
|
-
* used as part of Contrast Security’s commercial offerings. Even though it is
|
|
8
|
-
* made available through public repositories, use of this Software is subject to
|
|
9
|
-
* the applicable End User Licensing Agreement found at
|
|
10
|
-
* https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
|
|
11
|
-
* between Contrast Security and the End User. The Software may not be reverse
|
|
12
|
-
* engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
13
|
-
* way not consistent with the End User License Agreement.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
'use strict';
|
|
17
|
-
|
|
18
|
-
const { randomUUID } = require('crypto');
|
|
19
|
-
const { name: agentName, version: agentVersion } = require('../package.json');
|
|
20
|
-
|
|
21
|
-
module.exports = function init(core) {
|
|
22
|
-
// default to name and version of core
|
|
23
|
-
if (!core.agentName) {
|
|
24
|
-
core.agentName = agentName;
|
|
25
|
-
}
|
|
26
|
-
if (!core.agentVersion) {
|
|
27
|
-
core.agentVersion = agentVersion;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// default to a new random UUID
|
|
31
|
-
if (!core.reportingInstance) {
|
|
32
|
-
core.reportingInstance = randomUUID();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return core;
|
|
36
|
-
};
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright: 2025 Contrast Security, Inc
|
|
3
|
-
* Contact: support@contrastsecurity.com
|
|
4
|
-
* License: Commercial
|
|
5
|
-
|
|
6
|
-
* NOTICE: This Software and the patented inventions embodied within may only be
|
|
7
|
-
* used as part of Contrast Security’s commercial offerings. Even though it is
|
|
8
|
-
* made available through public repositories, use of this Software is subject to
|
|
9
|
-
* the applicable End User Licensing Agreement found at
|
|
10
|
-
* https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
|
|
11
|
-
* between Contrast Security and the End User. The Software may not be reverse
|
|
12
|
-
* engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
13
|
-
* way not consistent with the End User License Agreement.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
'use strict';
|
|
17
|
-
|
|
18
|
-
const os = require('os');
|
|
19
|
-
const fs = require('fs');
|
|
20
|
-
const path = require('path');
|
|
21
|
-
const semver = require('semver');
|
|
22
|
-
const process = require('process');
|
|
23
|
-
const { IntentionalError, primordials: { ArrayPrototypeJoin } } = require('@contrast/common');
|
|
24
|
-
const { findPackageJsonSync } = require('@contrast/find-package-json');
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @typedef {Object} PackageInfo
|
|
28
|
-
* @property {string} dir - the directory containing the `package.json`
|
|
29
|
-
* @property {object} packageData - parsed package contents
|
|
30
|
-
* @property {string} packageFile - filename of `package.json` (abs path)
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
module.exports = function (core) {
|
|
34
|
-
const { logger, config } = core;
|
|
35
|
-
const { app_root, cmd_ignore_list, exclusive_entrypoint } = config.agent.node;
|
|
36
|
-
|
|
37
|
-
checkPreLoadFlag();
|
|
38
|
-
const cmd = getCommand();
|
|
39
|
-
const pkgInfo = getPackageInfo();
|
|
40
|
-
const entrypoint = getEntrypoint();
|
|
41
|
-
const name = getApplicationName();
|
|
42
|
-
|
|
43
|
-
core.appInfo = {
|
|
44
|
-
// dedupe this? - it's already in systemInfo
|
|
45
|
-
os: {
|
|
46
|
-
type: os.type(),
|
|
47
|
-
platform: os.platform(),
|
|
48
|
-
architecture: os.arch(),
|
|
49
|
-
release: os.release(),
|
|
50
|
-
},
|
|
51
|
-
cmd,
|
|
52
|
-
hostname: os.hostname(),
|
|
53
|
-
indexFile: entrypoint,
|
|
54
|
-
path: pkgInfo.packageFile,
|
|
55
|
-
pkg: pkgInfo.packageData,
|
|
56
|
-
name,
|
|
57
|
-
app_dir: pkgInfo.dir,
|
|
58
|
-
version: config.application.version || pkgInfo.packageData.version,
|
|
59
|
-
serverVersion: config.server.version,
|
|
60
|
-
nodeVersion: process.version,
|
|
61
|
-
appPath: config.application.path || pkgInfo.dir,
|
|
62
|
-
serverName: config.server.name,
|
|
63
|
-
serverType: config.server.type,
|
|
64
|
-
serverEnvironment: config.server.environment,
|
|
65
|
-
group: config.application.group,
|
|
66
|
-
metadata: config.application.metadata,
|
|
67
|
-
};
|
|
68
|
-
// by convention return the object
|
|
69
|
-
return core.appInfo;
|
|
70
|
-
|
|
71
|
-
function checkPreLoadFlag() {
|
|
72
|
-
const {
|
|
73
|
-
version,
|
|
74
|
-
execArgv,
|
|
75
|
-
env: { NODE_OPTIONS },
|
|
76
|
-
} = process;
|
|
77
|
-
[
|
|
78
|
-
{ range: '>=18.19.0', flags: ['--import'] },
|
|
79
|
-
{ range: '>=16.17.0 <18.19.0', flags: ['--loader'] },
|
|
80
|
-
{ range: '<16.17.0', flags: ['-r', '--require'] }
|
|
81
|
-
].forEach(({ range, flags }) => {
|
|
82
|
-
if (
|
|
83
|
-
semver.satisfies(version, range) &&
|
|
84
|
-
(execArgv.some((el, idx) => el === '@contrast/agent' && !flags.includes(execArgv[idx - 1])) ||
|
|
85
|
-
NODE_OPTIONS?.includes('@contrast/agent') && !flags.some(flag => NODE_OPTIONS.includes(flag)))
|
|
86
|
-
) {
|
|
87
|
-
logger.warn(
|
|
88
|
-
'For Node LTS %s, use %s command to run the agent. See: https://docs.contrastsecurity.com/en/install-node-js.html',
|
|
89
|
-
range,
|
|
90
|
-
flags
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Generates a command string based on ARGV and process.argv0, which will be used
|
|
98
|
-
* for the `appInfo.cmd` field. This function will throw if any of the config's
|
|
99
|
-
* cmd_ignore_list values match the command.
|
|
100
|
-
* @returns {string} the issued command that started the current node process
|
|
101
|
-
* @throws {IntentionalError} when command should be is ignored by Contrast
|
|
102
|
-
*/
|
|
103
|
-
function getCommand() {
|
|
104
|
-
const args = [process.argv0, ...process.argv].map((a) => path.basename(a));
|
|
105
|
-
const cmd = ArrayPrototypeJoin.call(Array.from(new Set(args)), ' ');
|
|
106
|
-
const message = 'application command matches cmd_ignore_list config option';
|
|
107
|
-
|
|
108
|
-
if (cmd_ignore_list) {
|
|
109
|
-
let err;
|
|
110
|
-
for (const ignoreCommand of cmd_ignore_list) {
|
|
111
|
-
|
|
112
|
-
if (ignoreCommand === 'npm*') {
|
|
113
|
-
if (cmd.includes('npm ')) err = new IntentionalError(message);
|
|
114
|
-
} else {
|
|
115
|
-
if (cmd.includes(ignoreCommand)) err = new IntentionalError(message);
|
|
116
|
-
}
|
|
117
|
-
if (err) {
|
|
118
|
-
logger.trace({ cmd_ignore_list, cmd }, message);
|
|
119
|
-
throw err;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return cmd;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Returns the entrypoint file. If none is found, or the one discovered doesn't match the
|
|
129
|
-
* config's `agent.node.exclusive_entrypoint` value, this will throw.
|
|
130
|
-
* @returns {string} entrypoint file name
|
|
131
|
-
* @throws {Error|IntentionalError} if no entrypoint is found or we're supposed to ignore the app
|
|
132
|
-
*/
|
|
133
|
-
function getEntrypoint() {
|
|
134
|
-
let entrypoint = process.argv[1];
|
|
135
|
-
const { packageData } = pkgInfo;
|
|
136
|
-
|
|
137
|
-
try {
|
|
138
|
-
if (entrypoint && fs.statSync(entrypoint).isDirectory()) {
|
|
139
|
-
const main = path.join(entrypoint, packageData.main || 'index.js');
|
|
140
|
-
try {
|
|
141
|
-
if (fs.statSync(main)) {
|
|
142
|
-
entrypoint = main;
|
|
143
|
-
}
|
|
144
|
-
} catch (err) {
|
|
145
|
-
entrypoint = null;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
} catch (err) {} // eslint-disable-line no-empty
|
|
149
|
-
|
|
150
|
-
if (!entrypoint) {
|
|
151
|
-
logger.error('no entrypoint found for application');
|
|
152
|
-
throw new Error('No entrypoint found');
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (exclusive_entrypoint) {
|
|
156
|
-
const expectedEntrypoint = path.resolve(app_root || process.cwd(), exclusive_entrypoint);
|
|
157
|
-
if (entrypoint !== expectedEntrypoint) {
|
|
158
|
-
const message = 'application does not match exclusive_entrypoint config option';
|
|
159
|
-
logger.trace({
|
|
160
|
-
entrypoint,
|
|
161
|
-
exclusive_entrypoint: expectedEntrypoint,
|
|
162
|
-
}, message);
|
|
163
|
-
throw new IntentionalError(message);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
return entrypoint;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Will try to read the `package.json` file of the app. This will use find-pacakge-json
|
|
172
|
-
* starting first from entrypoint, then from CWD.
|
|
173
|
-
* NOTE: If the `app_root` value is specified, this will check only there and then throw if not found.
|
|
174
|
-
* @param {string} entrypoint app entrypoint
|
|
175
|
-
* @returns {PackageInfo} dir, packageData, and packageFile
|
|
176
|
-
* @throws {Error} if package can't be found or parsed
|
|
177
|
-
*/
|
|
178
|
-
function getPackageInfo() {
|
|
179
|
-
const cwd = process.cwd();
|
|
180
|
-
const dirs = new Set();
|
|
181
|
-
|
|
182
|
-
let dir;
|
|
183
|
-
let packageData;
|
|
184
|
-
let packageFile;
|
|
185
|
-
|
|
186
|
-
// if this is not the default value, we should only check it
|
|
187
|
-
if (app_root && app_root !== cwd) {
|
|
188
|
-
dirs.add(path.resolve(app_root));
|
|
189
|
-
} else {
|
|
190
|
-
// otherwise check up folder tree from entrypoint and then cwd
|
|
191
|
-
dirs.add(cwd);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
for (dir of dirs) {
|
|
195
|
-
try {
|
|
196
|
-
packageFile = process.env.npm_package_json ?? findPackageJsonSync({ cwd: dir });
|
|
197
|
-
packageData = require(packageFile);
|
|
198
|
-
break;
|
|
199
|
-
} catch (err) {} // eslint-disable-line no-empty
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (!packageData) {
|
|
203
|
-
const message = 'unable to locate application package.json';
|
|
204
|
-
logger.error({
|
|
205
|
-
app_root,
|
|
206
|
-
paths: Array.from(dirs),
|
|
207
|
-
}, message);
|
|
208
|
-
throw new Error(message);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return {
|
|
212
|
-
dir: path.dirname(packageFile),
|
|
213
|
-
packageData,
|
|
214
|
-
packageFile,
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* The name field is required e.g. reporting, rewrite caching, etc.
|
|
220
|
-
* @throws {Error} if there is no name identified
|
|
221
|
-
*/
|
|
222
|
-
function getApplicationName() {
|
|
223
|
-
const name = config.application.name || pkgInfo.packageData.name;
|
|
224
|
-
if (!name) {
|
|
225
|
-
throw new Error(
|
|
226
|
-
'The application\'s name was not identified. ' +
|
|
227
|
-
'Please provide name in package.json field or with the agent\'s application.name config option.'
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
return name;
|
|
232
|
-
}
|
|
233
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright: 2025 Contrast Security, Inc
|
|
3
|
-
* Contact: support@contrastsecurity.com
|
|
4
|
-
* License: Commercial
|
|
5
|
-
|
|
6
|
-
* NOTICE: This Software and the patented inventions embodied within may only be
|
|
7
|
-
* used as part of Contrast Security’s commercial offerings. Even though it is
|
|
8
|
-
* made available through public repositories, use of this Software is subject to
|
|
9
|
-
* the applicable End User Licensing Agreement found at
|
|
10
|
-
* https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
|
|
11
|
-
* between Contrast Security and the End User. The Software may not be reverse
|
|
12
|
-
* engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
13
|
-
* way not consistent with the End User License Agreement.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
'use strict';
|
|
17
|
-
|
|
18
|
-
const { CRC32 } = require('@tsxper/crc32');
|
|
19
|
-
const { readFile } = require('fs/promises');
|
|
20
|
-
const { resolve } = require('path');
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @param {Object} core
|
|
24
|
-
* @param {import('@contrast/common').AppInfo} core.appInfo
|
|
25
|
-
* @returns
|
|
26
|
-
*/
|
|
27
|
-
module.exports = function init(core) {
|
|
28
|
-
/** @type {string | undefined} */
|
|
29
|
-
let _buildId;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Attempts to hash the contents of the `package-lock.json` neighbor of the
|
|
33
|
-
* application's `package.json`. If no package-lock is detected, fall back to
|
|
34
|
-
* the app's `package.json` to generate the build ID.
|
|
35
|
-
* @returns {Promise<number | void>}
|
|
36
|
-
*/
|
|
37
|
-
return core.getBuildId = async function getBuildId() {
|
|
38
|
-
if (_buildId) return _buildId;
|
|
39
|
-
|
|
40
|
-
const crc32 = new CRC32();
|
|
41
|
-
try {
|
|
42
|
-
const buf = await readFile(resolve(core.appInfo.app_dir, 'package-lock.json'));
|
|
43
|
-
return _buildId = crc32.forBuffer(buf).toString(16);
|
|
44
|
-
} catch (err) {
|
|
45
|
-
// unable to hash package-lock.json, fall back to stored package.json
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const str = JSON.stringify(core.appInfo.pkg);
|
|
49
|
-
return _buildId = crc32.forString(str).toString(16);
|
|
50
|
-
};
|
|
51
|
-
};
|