cdktn 0.23.2 → 0.23.4
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/.jsii +468 -251
- package/README.md +3 -3
- package/lib/annotations.js +1 -1
- package/lib/app.js +1 -1
- package/lib/aspect.js +1 -1
- package/lib/backends/azurerm-backend.js +2 -2
- package/lib/backends/cloud-backend.js +4 -4
- package/lib/backends/consul-backend.js +2 -2
- package/lib/backends/cos-backend.js +2 -2
- package/lib/backends/gcs-backend.js +2 -2
- package/lib/backends/http-backend.js +2 -2
- package/lib/backends/local-backend.js +2 -2
- package/lib/backends/oss-backend.js +2 -2
- package/lib/backends/pg-backend.js +2 -2
- package/lib/backends/remote-backend.js +4 -4
- package/lib/backends/s3-backend.d.ts +11 -1
- package/lib/backends/s3-backend.js +11 -4
- package/lib/backends/swift-backend.js +2 -2
- package/lib/complex-computed-list.js +25 -25
- package/lib/errors.d.ts +1 -2
- package/lib/errors.js +11 -8
- package/lib/features.d.ts +9 -0
- package/lib/features.js +11 -2
- package/lib/functions/function-availability.generated.d.ts +16 -0
- package/lib/functions/function-availability.generated.js +21 -0
- package/lib/functions/helpers.js +3 -1
- package/lib/functions/terraform-functions.generated.d.ts +40 -2
- package/lib/functions/terraform-functions.generated.js +57 -5
- package/lib/functions/usage-registry.d.ts +6 -0
- package/lib/functions/usage-registry.js +34 -0
- package/lib/importable-resource.js +1 -1
- package/lib/manifest.js +4 -5
- package/lib/resource.js +1 -1
- package/lib/synthesize/synthesizer.js +8 -5
- package/lib/terraform-asset.js +1 -1
- package/lib/terraform-backend.js +1 -1
- package/lib/terraform-count.js +1 -1
- package/lib/terraform-data-resource.js +1 -1
- package/lib/terraform-data-source.js +1 -1
- package/lib/terraform-dynamic-block.js +2 -2
- package/lib/terraform-dynamic-expression.js +2 -2
- package/lib/terraform-element.js +1 -1
- package/lib/terraform-functions.js +1 -1
- package/lib/terraform-hcl-module.js +1 -1
- package/lib/terraform-iterator.js +5 -5
- package/lib/terraform-local.js +1 -1
- package/lib/terraform-module.js +1 -1
- package/lib/terraform-operators.js +1 -1
- package/lib/terraform-output.js +1 -1
- package/lib/terraform-provider.js +1 -1
- package/lib/terraform-provisioner.js +1 -1
- package/lib/terraform-remote-state.js +1 -1
- package/lib/terraform-resource-targets.js +1 -1
- package/lib/terraform-resource.js +1 -1
- package/lib/terraform-stack.js +6 -2
- package/lib/terraform-variable.js +2 -2
- package/lib/testing/index.js +8 -9
- package/lib/testing/matchers.js +1 -1
- package/lib/tokens/lazy.js +4 -4
- package/lib/tokens/private/intrinsic.d.ts +0 -5
- package/lib/tokens/private/intrinsic.js +2 -9
- package/lib/tokens/private/stack-trace.d.ts +6 -0
- package/lib/tokens/private/stack-trace.js +14 -1
- package/lib/tokens/resolvable.js +4 -4
- package/lib/tokens/string-fragments.js +1 -1
- package/lib/tokens/token.js +2 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/upgrade-id-aspect.js +1 -1
- package/lib/validations/index.d.ts +3 -0
- package/lib/validations/index.js +4 -1
- package/lib/validations/target-versions.d.ts +71 -0
- package/lib/validations/target-versions.js +132 -0
- package/lib/validations/validate-binary-version.d.ts +10 -0
- package/lib/validations/validate-binary-version.js +11 -1
- package/lib/validations/validate-function-version-support.d.ts +21 -0
- package/lib/validations/validate-function-version-support.js +53 -0
- package/lib/validations/validate-terraform-feature-version.d.ts +34 -0
- package/lib/validations/validate-terraform-feature-version.js +34 -0
- package/node_modules/{call-bind-apply-helpers → safe-stable-stringify}/LICENSE +2 -2
- package/node_modules/safe-stable-stringify/esm/package.json +4 -0
- package/node_modules/safe-stable-stringify/esm/wrapper.d.ts +4 -0
- package/node_modules/safe-stable-stringify/esm/wrapper.js +6 -0
- package/node_modules/safe-stable-stringify/index.d.ts +22 -0
- package/node_modules/safe-stable-stringify/index.js +625 -0
- package/node_modules/safe-stable-stringify/package.json +65 -0
- package/node_modules/safe-stable-stringify/readme.md +179 -0
- package/package.json +11 -12
- package/scripts/pack.mjs +168 -0
- package/node_modules/call-bind/.eslintignore +0 -1
- package/node_modules/call-bind/.eslintrc +0 -16
- package/node_modules/call-bind/.github/FUNDING.yml +0 -12
- package/node_modules/call-bind/.nycrc +0 -9
- package/node_modules/call-bind/CHANGELOG.md +0 -106
- package/node_modules/call-bind/LICENSE +0 -21
- package/node_modules/call-bind/README.md +0 -64
- package/node_modules/call-bind/callBound.js +0 -15
- package/node_modules/call-bind/index.js +0 -24
- package/node_modules/call-bind/package.json +0 -93
- package/node_modules/call-bind/test/callBound.js +0 -54
- package/node_modules/call-bind/test/index.js +0 -74
- package/node_modules/call-bind-apply-helpers/.eslintrc +0 -17
- package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +0 -12
- package/node_modules/call-bind-apply-helpers/.nycrc +0 -9
- package/node_modules/call-bind-apply-helpers/CHANGELOG.md +0 -30
- package/node_modules/call-bind-apply-helpers/README.md +0 -62
- package/node_modules/call-bind-apply-helpers/actualApply.d.ts +0 -1
- package/node_modules/call-bind-apply-helpers/actualApply.js +0 -10
- package/node_modules/call-bind-apply-helpers/applyBind.d.ts +0 -19
- package/node_modules/call-bind-apply-helpers/applyBind.js +0 -10
- package/node_modules/call-bind-apply-helpers/functionApply.d.ts +0 -1
- package/node_modules/call-bind-apply-helpers/functionApply.js +0 -4
- package/node_modules/call-bind-apply-helpers/functionCall.d.ts +0 -1
- package/node_modules/call-bind-apply-helpers/functionCall.js +0 -4
- package/node_modules/call-bind-apply-helpers/index.d.ts +0 -64
- package/node_modules/call-bind-apply-helpers/index.js +0 -15
- package/node_modules/call-bind-apply-helpers/package.json +0 -85
- package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +0 -3
- package/node_modules/call-bind-apply-helpers/reflectApply.js +0 -4
- package/node_modules/call-bind-apply-helpers/test/index.js +0 -63
- package/node_modules/call-bind-apply-helpers/tsconfig.json +0 -9
- package/node_modules/call-bound/.eslintrc +0 -13
- package/node_modules/call-bound/.github/FUNDING.yml +0 -12
- package/node_modules/call-bound/.nycrc +0 -9
- package/node_modules/call-bound/CHANGELOG.md +0 -42
- package/node_modules/call-bound/LICENSE +0 -21
- package/node_modules/call-bound/README.md +0 -53
- package/node_modules/call-bound/index.d.ts +0 -94
- package/node_modules/call-bound/index.js +0 -19
- package/node_modules/call-bound/package.json +0 -99
- package/node_modules/call-bound/test/index.js +0 -61
- package/node_modules/call-bound/tsconfig.json +0 -10
- package/node_modules/define-data-property/.eslintrc +0 -24
- package/node_modules/define-data-property/.github/FUNDING.yml +0 -12
- package/node_modules/define-data-property/.nycrc +0 -13
- package/node_modules/define-data-property/CHANGELOG.md +0 -70
- package/node_modules/define-data-property/LICENSE +0 -21
- package/node_modules/define-data-property/README.md +0 -67
- package/node_modules/define-data-property/index.d.ts +0 -12
- package/node_modules/define-data-property/index.js +0 -56
- package/node_modules/define-data-property/package.json +0 -106
- package/node_modules/define-data-property/test/index.js +0 -392
- package/node_modules/define-data-property/tsconfig.json +0 -59
- package/node_modules/dunder-proto/.eslintrc +0 -5
- package/node_modules/dunder-proto/.github/FUNDING.yml +0 -12
- package/node_modules/dunder-proto/.nycrc +0 -13
- package/node_modules/dunder-proto/CHANGELOG.md +0 -24
- package/node_modules/dunder-proto/LICENSE +0 -21
- package/node_modules/dunder-proto/README.md +0 -54
- package/node_modules/dunder-proto/get.d.ts +0 -5
- package/node_modules/dunder-proto/get.js +0 -30
- package/node_modules/dunder-proto/package.json +0 -76
- package/node_modules/dunder-proto/set.d.ts +0 -5
- package/node_modules/dunder-proto/set.js +0 -35
- package/node_modules/dunder-proto/test/get.js +0 -34
- package/node_modules/dunder-proto/test/index.js +0 -4
- package/node_modules/dunder-proto/test/set.js +0 -50
- package/node_modules/dunder-proto/tsconfig.json +0 -9
- package/node_modules/es-define-property/.eslintrc +0 -13
- package/node_modules/es-define-property/.github/FUNDING.yml +0 -12
- package/node_modules/es-define-property/.nycrc +0 -9
- package/node_modules/es-define-property/CHANGELOG.md +0 -29
- package/node_modules/es-define-property/LICENSE +0 -21
- package/node_modules/es-define-property/README.md +0 -49
- package/node_modules/es-define-property/index.d.ts +0 -3
- package/node_modules/es-define-property/index.js +0 -14
- package/node_modules/es-define-property/package.json +0 -81
- package/node_modules/es-define-property/test/index.js +0 -56
- package/node_modules/es-define-property/tsconfig.json +0 -10
- package/node_modules/es-errors/.eslintrc +0 -5
- package/node_modules/es-errors/.github/FUNDING.yml +0 -12
- package/node_modules/es-errors/CHANGELOG.md +0 -40
- package/node_modules/es-errors/LICENSE +0 -21
- package/node_modules/es-errors/README.md +0 -55
- package/node_modules/es-errors/eval.d.ts +0 -3
- package/node_modules/es-errors/eval.js +0 -4
- package/node_modules/es-errors/index.d.ts +0 -3
- package/node_modules/es-errors/index.js +0 -4
- package/node_modules/es-errors/package.json +0 -80
- package/node_modules/es-errors/range.d.ts +0 -3
- package/node_modules/es-errors/range.js +0 -4
- package/node_modules/es-errors/ref.d.ts +0 -3
- package/node_modules/es-errors/ref.js +0 -4
- package/node_modules/es-errors/syntax.d.ts +0 -3
- package/node_modules/es-errors/syntax.js +0 -4
- package/node_modules/es-errors/test/index.js +0 -19
- package/node_modules/es-errors/tsconfig.json +0 -49
- package/node_modules/es-errors/type.d.ts +0 -3
- package/node_modules/es-errors/type.js +0 -4
- package/node_modules/es-errors/uri.d.ts +0 -3
- package/node_modules/es-errors/uri.js +0 -4
- package/node_modules/es-object-atoms/.eslintrc +0 -16
- package/node_modules/es-object-atoms/.github/FUNDING.yml +0 -12
- package/node_modules/es-object-atoms/CHANGELOG.md +0 -37
- package/node_modules/es-object-atoms/LICENSE +0 -21
- package/node_modules/es-object-atoms/README.md +0 -63
- package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +0 -3
- package/node_modules/es-object-atoms/RequireObjectCoercible.js +0 -11
- package/node_modules/es-object-atoms/ToObject.d.ts +0 -7
- package/node_modules/es-object-atoms/ToObject.js +0 -10
- package/node_modules/es-object-atoms/index.d.ts +0 -3
- package/node_modules/es-object-atoms/index.js +0 -4
- package/node_modules/es-object-atoms/isObject.d.ts +0 -3
- package/node_modules/es-object-atoms/isObject.js +0 -6
- package/node_modules/es-object-atoms/package.json +0 -80
- package/node_modules/es-object-atoms/test/index.js +0 -38
- package/node_modules/es-object-atoms/tsconfig.json +0 -6
- package/node_modules/function-bind/.eslintrc +0 -21
- package/node_modules/function-bind/.github/FUNDING.yml +0 -12
- package/node_modules/function-bind/.github/SECURITY.md +0 -3
- package/node_modules/function-bind/.nycrc +0 -13
- package/node_modules/function-bind/CHANGELOG.md +0 -136
- package/node_modules/function-bind/LICENSE +0 -20
- package/node_modules/function-bind/README.md +0 -46
- package/node_modules/function-bind/implementation.js +0 -84
- package/node_modules/function-bind/index.js +0 -5
- package/node_modules/function-bind/package.json +0 -87
- package/node_modules/function-bind/test/.eslintrc +0 -9
- package/node_modules/function-bind/test/index.js +0 -252
- package/node_modules/get-intrinsic/.eslintrc +0 -42
- package/node_modules/get-intrinsic/.github/FUNDING.yml +0 -12
- package/node_modules/get-intrinsic/.nycrc +0 -9
- package/node_modules/get-intrinsic/CHANGELOG.md +0 -186
- package/node_modules/get-intrinsic/LICENSE +0 -21
- package/node_modules/get-intrinsic/README.md +0 -71
- package/node_modules/get-intrinsic/index.js +0 -378
- package/node_modules/get-intrinsic/package.json +0 -97
- package/node_modules/get-intrinsic/test/GetIntrinsic.js +0 -274
- package/node_modules/get-proto/.eslintrc +0 -10
- package/node_modules/get-proto/.github/FUNDING.yml +0 -12
- package/node_modules/get-proto/.nycrc +0 -9
- package/node_modules/get-proto/CHANGELOG.md +0 -21
- package/node_modules/get-proto/LICENSE +0 -21
- package/node_modules/get-proto/Object.getPrototypeOf.d.ts +0 -5
- package/node_modules/get-proto/Object.getPrototypeOf.js +0 -6
- package/node_modules/get-proto/README.md +0 -50
- package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +0 -3
- package/node_modules/get-proto/Reflect.getPrototypeOf.js +0 -4
- package/node_modules/get-proto/index.d.ts +0 -5
- package/node_modules/get-proto/index.js +0 -27
- package/node_modules/get-proto/package.json +0 -81
- package/node_modules/get-proto/test/index.js +0 -68
- package/node_modules/get-proto/tsconfig.json +0 -9
- package/node_modules/gopd/.eslintrc +0 -16
- package/node_modules/gopd/.github/FUNDING.yml +0 -12
- package/node_modules/gopd/CHANGELOG.md +0 -45
- package/node_modules/gopd/LICENSE +0 -21
- package/node_modules/gopd/README.md +0 -40
- package/node_modules/gopd/gOPD.d.ts +0 -1
- package/node_modules/gopd/gOPD.js +0 -4
- package/node_modules/gopd/index.d.ts +0 -5
- package/node_modules/gopd/index.js +0 -15
- package/node_modules/gopd/package.json +0 -77
- package/node_modules/gopd/test/index.js +0 -36
- package/node_modules/gopd/tsconfig.json +0 -9
- package/node_modules/has-property-descriptors/.eslintrc +0 -13
- package/node_modules/has-property-descriptors/.github/FUNDING.yml +0 -12
- package/node_modules/has-property-descriptors/.nycrc +0 -9
- package/node_modules/has-property-descriptors/CHANGELOG.md +0 -35
- package/node_modules/has-property-descriptors/LICENSE +0 -21
- package/node_modules/has-property-descriptors/README.md +0 -43
- package/node_modules/has-property-descriptors/index.js +0 -22
- package/node_modules/has-property-descriptors/package.json +0 -77
- package/node_modules/has-property-descriptors/test/index.js +0 -57
- package/node_modules/has-symbols/.eslintrc +0 -11
- package/node_modules/has-symbols/.github/FUNDING.yml +0 -12
- package/node_modules/has-symbols/.nycrc +0 -9
- package/node_modules/has-symbols/CHANGELOG.md +0 -91
- package/node_modules/has-symbols/LICENSE +0 -21
- package/node_modules/has-symbols/README.md +0 -46
- package/node_modules/has-symbols/index.d.ts +0 -3
- package/node_modules/has-symbols/index.js +0 -14
- package/node_modules/has-symbols/package.json +0 -111
- package/node_modules/has-symbols/shams.d.ts +0 -3
- package/node_modules/has-symbols/shams.js +0 -45
- package/node_modules/has-symbols/test/index.js +0 -22
- package/node_modules/has-symbols/test/shams/core-js.js +0 -29
- package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +0 -29
- package/node_modules/has-symbols/test/tests.js +0 -58
- package/node_modules/has-symbols/tsconfig.json +0 -10
- package/node_modules/hasown/.eslintrc +0 -5
- package/node_modules/hasown/.github/FUNDING.yml +0 -12
- package/node_modules/hasown/.nycrc +0 -13
- package/node_modules/hasown/CHANGELOG.md +0 -40
- package/node_modules/hasown/LICENSE +0 -21
- package/node_modules/hasown/README.md +0 -40
- package/node_modules/hasown/index.d.ts +0 -3
- package/node_modules/hasown/index.js +0 -8
- package/node_modules/hasown/package.json +0 -92
- package/node_modules/hasown/tsconfig.json +0 -6
- package/node_modules/isarray/LICENSE +0 -21
- package/node_modules/isarray/README.md +0 -38
- package/node_modules/isarray/index.js +0 -5
- package/node_modules/isarray/package.json +0 -48
- package/node_modules/json-stable-stringify/.eslintrc +0 -31
- package/node_modules/json-stable-stringify/.github/FUNDING.yml +0 -12
- package/node_modules/json-stable-stringify/CHANGELOG.md +0 -160
- package/node_modules/json-stable-stringify/LICENSE +0 -21
- package/node_modules/json-stable-stringify/README.md +0 -157
- package/node_modules/json-stable-stringify/example/key_cmp.js +0 -9
- package/node_modules/json-stable-stringify/example/nested.js +0 -7
- package/node_modules/json-stable-stringify/example/str.js +0 -7
- package/node_modules/json-stable-stringify/example/value_cmp.js +0 -12
- package/node_modules/json-stable-stringify/index.d.ts +0 -25
- package/node_modules/json-stable-stringify/index.js +0 -124
- package/node_modules/json-stable-stringify/package.json +0 -88
- package/node_modules/json-stable-stringify/test/cmp.js +0 -33
- package/node_modules/json-stable-stringify/test/nested.js +0 -48
- package/node_modules/json-stable-stringify/test/replacer.js +0 -81
- package/node_modules/json-stable-stringify/test/space.js +0 -127
- package/node_modules/json-stable-stringify/test/str.js +0 -46
- package/node_modules/json-stable-stringify/test/to-json.js +0 -22
- package/node_modules/json-stable-stringify/tsconfig.json +0 -10
- package/node_modules/jsonify/.eslintrc +0 -21
- package/node_modules/jsonify/.github/FUNDING.yml +0 -12
- package/node_modules/jsonify/CHANGELOG.md +0 -48
- package/node_modules/jsonify/README.md +0 -66
- package/node_modules/jsonify/index.js +0 -4
- package/node_modules/jsonify/lib/parse.js +0 -261
- package/node_modules/jsonify/lib/stringify.js +0 -151
- package/node_modules/jsonify/package.json +0 -62
- package/node_modules/jsonify/test/parse.js +0 -20
- package/node_modules/jsonify/test/stringify.js +0 -18
- package/node_modules/math-intrinsics/.eslintrc +0 -16
- package/node_modules/math-intrinsics/.github/FUNDING.yml +0 -12
- package/node_modules/math-intrinsics/CHANGELOG.md +0 -24
- package/node_modules/math-intrinsics/LICENSE +0 -21
- package/node_modules/math-intrinsics/README.md +0 -50
- package/node_modules/math-intrinsics/abs.d.ts +0 -1
- package/node_modules/math-intrinsics/abs.js +0 -4
- package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +0 -3
- package/node_modules/math-intrinsics/constants/maxArrayLength.js +0 -4
- package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +0 -3
- package/node_modules/math-intrinsics/constants/maxSafeInteger.js +0 -5
- package/node_modules/math-intrinsics/constants/maxValue.d.ts +0 -3
- package/node_modules/math-intrinsics/constants/maxValue.js +0 -5
- package/node_modules/math-intrinsics/floor.d.ts +0 -1
- package/node_modules/math-intrinsics/floor.js +0 -4
- package/node_modules/math-intrinsics/isFinite.d.ts +0 -3
- package/node_modules/math-intrinsics/isFinite.js +0 -12
- package/node_modules/math-intrinsics/isInteger.d.ts +0 -3
- package/node_modules/math-intrinsics/isInteger.js +0 -16
- package/node_modules/math-intrinsics/isNaN.d.ts +0 -1
- package/node_modules/math-intrinsics/isNaN.js +0 -6
- package/node_modules/math-intrinsics/isNegativeZero.d.ts +0 -3
- package/node_modules/math-intrinsics/isNegativeZero.js +0 -6
- package/node_modules/math-intrinsics/max.d.ts +0 -1
- package/node_modules/math-intrinsics/max.js +0 -4
- package/node_modules/math-intrinsics/min.d.ts +0 -1
- package/node_modules/math-intrinsics/min.js +0 -4
- package/node_modules/math-intrinsics/mod.d.ts +0 -3
- package/node_modules/math-intrinsics/mod.js +0 -9
- package/node_modules/math-intrinsics/package.json +0 -86
- package/node_modules/math-intrinsics/pow.d.ts +0 -1
- package/node_modules/math-intrinsics/pow.js +0 -4
- package/node_modules/math-intrinsics/round.d.ts +0 -1
- package/node_modules/math-intrinsics/round.js +0 -4
- package/node_modules/math-intrinsics/sign.d.ts +0 -3
- package/node_modules/math-intrinsics/sign.js +0 -11
- package/node_modules/math-intrinsics/test/index.js +0 -192
- package/node_modules/math-intrinsics/tsconfig.json +0 -3
- package/node_modules/object-keys/.editorconfig +0 -13
- package/node_modules/object-keys/.eslintrc +0 -17
- package/node_modules/object-keys/.travis.yml +0 -277
- package/node_modules/object-keys/CHANGELOG.md +0 -232
- package/node_modules/object-keys/LICENSE +0 -21
- package/node_modules/object-keys/README.md +0 -76
- package/node_modules/object-keys/implementation.js +0 -122
- package/node_modules/object-keys/index.js +0 -32
- package/node_modules/object-keys/isArguments.js +0 -17
- package/node_modules/object-keys/package.json +0 -88
- package/node_modules/object-keys/test/index.js +0 -5
- package/node_modules/set-function-length/.eslintrc +0 -27
- package/node_modules/set-function-length/.github/FUNDING.yml +0 -12
- package/node_modules/set-function-length/.nycrc +0 -13
- package/node_modules/set-function-length/CHANGELOG.md +0 -70
- package/node_modules/set-function-length/LICENSE +0 -21
- package/node_modules/set-function-length/README.md +0 -56
- package/node_modules/set-function-length/env.d.ts +0 -9
- package/node_modules/set-function-length/env.js +0 -25
- package/node_modules/set-function-length/index.d.ts +0 -7
- package/node_modules/set-function-length/index.js +0 -42
- package/node_modules/set-function-length/package.json +0 -102
- package/node_modules/set-function-length/tsconfig.json +0 -9
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# safe-stable-stringify
|
|
2
|
+
|
|
3
|
+
Safe, deterministic and fast serialization alternative to [JSON.stringify][].
|
|
4
|
+
Zero dependencies. ESM and CJS. 100% coverage.
|
|
5
|
+
|
|
6
|
+
Gracefully handles circular structures and bigint instead of throwing.
|
|
7
|
+
|
|
8
|
+
Optional custom circular values, deterministic behavior or strict JSON
|
|
9
|
+
compatibility check.
|
|
10
|
+
|
|
11
|
+
## stringify(value[, replacer[, space]])
|
|
12
|
+
|
|
13
|
+
The same as [JSON.stringify][].
|
|
14
|
+
|
|
15
|
+
* `value` {any}
|
|
16
|
+
* `replacer` {string[]|function|null}
|
|
17
|
+
* `space` {number|string}
|
|
18
|
+
* Returns: {string}
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const stringify = require('safe-stable-stringify')
|
|
22
|
+
|
|
23
|
+
const bigint = { a: 0, c: 2n, b: 1 }
|
|
24
|
+
|
|
25
|
+
stringify(bigint)
|
|
26
|
+
// '{"a":0,"b":1,"c":2}'
|
|
27
|
+
JSON.stringify(bigint)
|
|
28
|
+
// TypeError: Do not know how to serialize a BigInt
|
|
29
|
+
|
|
30
|
+
const circular = { b: 1, a: 0 }
|
|
31
|
+
circular.circular = circular
|
|
32
|
+
|
|
33
|
+
stringify(circular)
|
|
34
|
+
// '{"a":0,"b":1,"circular":"[Circular]"}'
|
|
35
|
+
JSON.stringify(circular)
|
|
36
|
+
// TypeError: Converting circular structure to JSON
|
|
37
|
+
|
|
38
|
+
stringify(circular, ['a', 'b'], 2)
|
|
39
|
+
// {
|
|
40
|
+
// "a": 0,
|
|
41
|
+
// "b": 1
|
|
42
|
+
// }
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## stringify.configure(options)
|
|
46
|
+
|
|
47
|
+
* `bigint` {boolean} If `true`, bigint values are converted to a number. Otherwise
|
|
48
|
+
they are ignored. **Default:** `true`.
|
|
49
|
+
* `circularValue` {string|null|undefined|ErrorConstructor} Defines the value for
|
|
50
|
+
circular references. Set to `undefined`, circular properties are not
|
|
51
|
+
serialized (array entries are replaced with `null`). Set to `Error`, to throw
|
|
52
|
+
on circular references. **Default:** `'[Circular]'`.
|
|
53
|
+
* `deterministic` {boolean|function} If `true` or a `Array#sort(comparator)`
|
|
54
|
+
comparator method, guarantee a deterministic key order instead of relying on
|
|
55
|
+
the insertion order. **Default:** `true`.
|
|
56
|
+
* `maximumBreadth` {number} Maximum number of entries to serialize per object
|
|
57
|
+
(at least one). The serialized output contains information about how many
|
|
58
|
+
entries have not been serialized. Ignored properties are counted as well
|
|
59
|
+
(e.g., properties with symbol values). Using the array replacer overrules this
|
|
60
|
+
option. **Default:** `Infinity`
|
|
61
|
+
* `maximumDepth` {number} Maximum number of object nesting levels (at least 1)
|
|
62
|
+
that will be serialized. Objects at the maximum level are serialized as
|
|
63
|
+
`'[Object]'` and arrays as `'[Array]'`. **Default:** `Infinity`
|
|
64
|
+
* `strict` {boolean} Instead of handling any JSON value gracefully, throw an
|
|
65
|
+
error in case it may not be represented as JSON (functions, NaN, ...).
|
|
66
|
+
Circular values and bigint values throw as well in case either option is not
|
|
67
|
+
explicitly defined. Sets and Maps are not detected as well as Symbol keys!
|
|
68
|
+
**Default:** `false`
|
|
69
|
+
* Returns: {function} A stringify function with the options applied.
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
import { configure } from 'safe-stable-stringify'
|
|
73
|
+
|
|
74
|
+
const stringify = configure({
|
|
75
|
+
bigint: true,
|
|
76
|
+
circularValue: 'Magic circle!',
|
|
77
|
+
deterministic: false,
|
|
78
|
+
maximumDepth: 1,
|
|
79
|
+
maximumBreadth: 4
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
const circular = {
|
|
83
|
+
bigint: 999_999_999_999_999_999n,
|
|
84
|
+
typed: new Uint8Array(3),
|
|
85
|
+
deterministic: "I don't think so",
|
|
86
|
+
}
|
|
87
|
+
circular.circular = circular
|
|
88
|
+
circular.ignored = true
|
|
89
|
+
circular.alsoIgnored = 'Yes!'
|
|
90
|
+
|
|
91
|
+
const stringified = stringify(circular, null, 4)
|
|
92
|
+
|
|
93
|
+
console.log(stringified)
|
|
94
|
+
// {
|
|
95
|
+
// "bigint": 999999999999999999,
|
|
96
|
+
// "typed": "[Object]",
|
|
97
|
+
// "deterministic": "I don't think so",
|
|
98
|
+
// "circular": "Magic circle!",
|
|
99
|
+
// "...": "2 items not stringified"
|
|
100
|
+
// }
|
|
101
|
+
|
|
102
|
+
const throwOnCircular = configure({
|
|
103
|
+
circularValue: Error
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
throwOnCircular(circular);
|
|
107
|
+
// TypeError: Converting circular structure to JSON
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Differences to JSON.stringify
|
|
111
|
+
|
|
112
|
+
1. _Circular values_ are replaced with the string `[Circular]` (configurable).
|
|
113
|
+
1. _Object keys_ are sorted instead of using the insertion order (configurable).
|
|
114
|
+
1. _BigInt_ values are stringified as regular number instead of throwing a
|
|
115
|
+
TypeError (configurable).
|
|
116
|
+
1. _Boxed primitives_ (e.g., `Number(5)`) are not unboxed and are handled as
|
|
117
|
+
regular object.
|
|
118
|
+
|
|
119
|
+
Those are the only differences to `JSON.stringify()`. This is a side effect free
|
|
120
|
+
variant and [`toJSON`][], [`replacer`][] and the [`spacer`][] work the same as
|
|
121
|
+
with `JSON.stringify()`.
|
|
122
|
+
|
|
123
|
+
## Performance / Benchmarks
|
|
124
|
+
|
|
125
|
+
Currently this is by far the fastest known stable (deterministic) stringify
|
|
126
|
+
implementation. This is especially important for big objects and TypedArrays.
|
|
127
|
+
|
|
128
|
+
(Dell Precision 5540, i7-9850H CPU @ 2.60GHz, Node.js 16.11.1)
|
|
129
|
+
|
|
130
|
+
```md
|
|
131
|
+
simple: simple object x 3,463,894 ops/sec ±0.44% (98 runs sampled)
|
|
132
|
+
simple: circular x 1,236,007 ops/sec ±0.46% (99 runs sampled)
|
|
133
|
+
simple: deep x 18,942 ops/sec ±0.41% (93 runs sampled)
|
|
134
|
+
simple: deep circular x 18,690 ops/sec ±0.72% (96 runs sampled)
|
|
135
|
+
|
|
136
|
+
replacer: simple object x 2,664,940 ops/sec ±0.31% (98 runs sampled)
|
|
137
|
+
replacer: circular x 1,015,981 ops/sec ±0.09% (99 runs sampled)
|
|
138
|
+
replacer: deep x 17,328 ops/sec ±0.38% (97 runs sampled)
|
|
139
|
+
replacer: deep circular x 17,071 ops/sec ±0.21% (98 runs sampled)
|
|
140
|
+
|
|
141
|
+
array: simple object x 3,869,608 ops/sec ±0.22% (98 runs sampled)
|
|
142
|
+
array: circular x 3,853,943 ops/sec ±0.45% (96 runs sampled)
|
|
143
|
+
array: deep x 3,563,227 ops/sec ±0.20% (100 runs sampled)
|
|
144
|
+
array: deep circular x 3,286,475 ops/sec ±0.07% (100 runs sampled)
|
|
145
|
+
|
|
146
|
+
indentation: simple object x 2,183,162 ops/sec ±0.66% (97 runs sampled)
|
|
147
|
+
indentation: circular x 872,538 ops/sec ±0.57% (98 runs sampled)
|
|
148
|
+
indentation: deep x 16,795 ops/sec ±0.48% (93 runs sampled)
|
|
149
|
+
indentation: deep circular x 16,443 ops/sec ±0.40% (97 runs sampled)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Comparing `safe-stable-stringify` with known alternatives:
|
|
153
|
+
|
|
154
|
+
```md
|
|
155
|
+
fast-json-stable-stringify x 18,765 ops/sec ±0.71% (94 runs sampled)
|
|
156
|
+
json-stable-stringify x 13,870 ops/sec ±0.72% (94 runs sampled)
|
|
157
|
+
fast-stable-stringify x 21,343 ops/sec ±0.33% (95 runs sampled)
|
|
158
|
+
faster-stable-stringify x 17,707 ops/sec ±0.44% (97 runs sampled)
|
|
159
|
+
json-stringify-deterministic x 11,208 ops/sec ±0.57% (98 runs sampled)
|
|
160
|
+
fast-safe-stringify x 21,460 ops/sec ±0.75% (99 runs sampled)
|
|
161
|
+
this x 30,367 ops/sec ±0.39% (96 runs sampled)
|
|
162
|
+
|
|
163
|
+
The fastest is this
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The `fast-safe-stringify` comparison uses the modules stable implementation.
|
|
167
|
+
|
|
168
|
+
## Acknowledgements
|
|
169
|
+
|
|
170
|
+
Sponsored by [MaibornWolff](https://www.maibornwolff.de/) and [nearForm](http://nearform.com)
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
MIT
|
|
175
|
+
|
|
176
|
+
[`replacer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The%20replacer%20parameter
|
|
177
|
+
[`spacer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The%20space%20argument
|
|
178
|
+
[`toJSON`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON()_behavior
|
|
179
|
+
[JSON.stringify]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cdktn",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.4",
|
|
4
4
|
"description": "Cloud Development Kit for Terraform",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "jsii --silence-warnings reserved-word",
|
|
7
7
|
"watch": "jsii -w --silence-warnings reserved-word",
|
|
8
8
|
"watch-preserve-output": "tsc -w --preserveWatchOutput",
|
|
9
|
-
"package": "
|
|
10
|
-
"package:python": "
|
|
11
|
-
"package:java": "
|
|
12
|
-
"package:dotnet": "
|
|
13
|
-
"package:js": "
|
|
14
|
-
"package:go": "
|
|
9
|
+
"package": "node ./scripts/pack.mjs",
|
|
10
|
+
"package:python": "node ./scripts/pack.mjs python",
|
|
11
|
+
"package:java": "node ./scripts/pack.mjs java",
|
|
12
|
+
"package:dotnet": "node ./scripts/pack.mjs dotnet",
|
|
13
|
+
"package:js": "node ./scripts/pack.mjs js",
|
|
14
|
+
"package:go": "node ./scripts/pack.mjs go",
|
|
15
15
|
"test:update": "jest -u",
|
|
16
16
|
"dist-clean": "rm -rf dist"
|
|
17
17
|
},
|
|
@@ -77,22 +77,21 @@
|
|
|
77
77
|
},
|
|
78
78
|
"license": "MPL-2.0",
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@types/json-stable-stringify": "1.2.0",
|
|
81
80
|
"@types/node": "18.19.130",
|
|
82
81
|
"@types/semver": "7.7.1",
|
|
83
82
|
"constructs": "10.6.0",
|
|
84
|
-
"jsii": "5.9.
|
|
83
|
+
"jsii": "~5.9.0",
|
|
85
84
|
"jsii-pacmak": "1.128.0",
|
|
86
|
-
"typescript": "5.
|
|
85
|
+
"typescript": "^5.0.0"
|
|
87
86
|
},
|
|
88
87
|
"dependencies": {
|
|
89
88
|
"fflate": "0.8.2",
|
|
90
|
-
"
|
|
89
|
+
"safe-stable-stringify": "2.5.0",
|
|
91
90
|
"semver": "7.7.4"
|
|
92
91
|
},
|
|
93
92
|
"bundledDependencies": [
|
|
94
93
|
"fflate",
|
|
95
|
-
"
|
|
94
|
+
"safe-stable-stringify",
|
|
96
95
|
"semver"
|
|
97
96
|
],
|
|
98
97
|
"stability": "experimental",
|
package/scripts/pack.mjs
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Build the cdktn language packages via jsii-pacmak.
|
|
7
|
+
//
|
|
8
|
+
// Why this script exists:
|
|
9
|
+
// cdktn ships its runtime deps (json-stable-stringify, semver, yazl) inside the published tarball so JSII pacmak can
|
|
10
|
+
// embed them in the Python/Java/Go/.NET targets — the embedded JS needs them at runtime in user environments where
|
|
11
|
+
// there is no `npm install`.
|
|
12
|
+
//
|
|
13
|
+
// Under pnpm's default isolated layout, those deps inside packages/cdktn/node_modules are symlinks back into
|
|
14
|
+
// ../../node_modules/.pnpm/<dep>/. When `npm pack` (called by jsii-pacmak) walks the symlinks, it produces tarball
|
|
15
|
+
// entries with `..`-escape paths that most tar extractors discard, leaving the bundled deps' transitives missing in
|
|
16
|
+
// the published tarballs.
|
|
17
|
+
//
|
|
18
|
+
// This script sidesteps the issue by copying cdktn's source into a staging directory and running `npm install
|
|
19
|
+
// --omit=dev` there. npm produces a regular nested node_modules layout (no symlinks), which jsii-pacmak + `npm pack`
|
|
20
|
+
// can bundle correctly. Outputs are copied back to packages/cdktn/dist/.
|
|
21
|
+
|
|
22
|
+
import { execFileSync } from "node:child_process";
|
|
23
|
+
import { rmSync, mkdirSync, cpSync, existsSync } from "node:fs";
|
|
24
|
+
import { fileURLToPath } from "node:url";
|
|
25
|
+
import { dirname, join, resolve } from "node:path";
|
|
26
|
+
import { pacmak } from "jsii-pacmak";
|
|
27
|
+
|
|
28
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
29
|
+
const packageDir = resolve(__dirname, "..");
|
|
30
|
+
const stagingDir = join(packageDir, ".pack-staging");
|
|
31
|
+
const distOutDir = join(packageDir, "dist");
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Run a command synchronously, inheriting stdio and logging the invocation.
|
|
35
|
+
* Throws on non-zero exit.
|
|
36
|
+
*
|
|
37
|
+
* @param {string} cmd
|
|
38
|
+
* @param {string[]} args
|
|
39
|
+
* @param {import("node:child_process").SpawnSyncOptionsWithBufferEncoding} [opts]
|
|
40
|
+
*/
|
|
41
|
+
function run(cmd, args, opts = {}) {
|
|
42
|
+
console.log(`> ${cmd} ${args.join(" ")}`);
|
|
43
|
+
execFileSync(cmd, args, {
|
|
44
|
+
stdio: "inherit",
|
|
45
|
+
cwd: packageDir,
|
|
46
|
+
...opts,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Use `npm pack --dry-run --json` to discover the file list npm would publish and return it as relative paths from
|
|
52
|
+
* `packageDir`. Drops any `..`-escape paths that come from npm following pnpm's node_modules symlinks — those are
|
|
53
|
+
* the broken entries the staging copy will replace with a clean `npm install`.
|
|
54
|
+
*
|
|
55
|
+
* @returns {string[]} relative paths from packageDir
|
|
56
|
+
*/
|
|
57
|
+
function resolveSourceFiles() {
|
|
58
|
+
console.log("Resolving cdktn's file list via `npm pack --dry-run`...");
|
|
59
|
+
const packJson = execFileSync("npm", ["pack", "--dry-run", "--json"], {
|
|
60
|
+
cwd: packageDir,
|
|
61
|
+
}).toString();
|
|
62
|
+
const packInfo = JSON.parse(packJson);
|
|
63
|
+
const files = packInfo[0].files
|
|
64
|
+
.map((f) => f.path)
|
|
65
|
+
.filter((p) => !p.includes(".."));
|
|
66
|
+
console.log(` ${files.length} source files to copy.`);
|
|
67
|
+
return files;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Recreate the staging directory empty.
|
|
72
|
+
*/
|
|
73
|
+
function prepareStagingDir() {
|
|
74
|
+
console.log(`Preparing staging dir at ${stagingDir}...`);
|
|
75
|
+
rmSync(stagingDir, { recursive: true, force: true });
|
|
76
|
+
mkdirSync(stagingDir, { recursive: true });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Copy the resolved source files into the staging directory, preserving relative paths.
|
|
81
|
+
*
|
|
82
|
+
* @param {string[]} sourceFiles relative paths from packageDir
|
|
83
|
+
*/
|
|
84
|
+
function copySourceFiles(sourceFiles) {
|
|
85
|
+
for (const relPath of sourceFiles) {
|
|
86
|
+
const src = join(packageDir, relPath);
|
|
87
|
+
const dst = join(stagingDir, relPath);
|
|
88
|
+
if (!existsSync(src)) continue;
|
|
89
|
+
mkdirSync(dirname(dst), { recursive: true });
|
|
90
|
+
cpSync(src, dst);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Install runtime dependencies into the staging directory using npm. Produces a flat/nested node_modules layout (no
|
|
96
|
+
* pnpm symlinks) suitable for npm pack.
|
|
97
|
+
*
|
|
98
|
+
* Flags:
|
|
99
|
+
* --omit=dev: skip devDependencies (jest, jsii, typescript, ...).
|
|
100
|
+
* --omit=optional: skip optional deps.
|
|
101
|
+
* --no-package-lock: don't pollute staging with a fresh lockfile.
|
|
102
|
+
* --prefer-offline: use the local npm cache before the network.
|
|
103
|
+
* --ignore-scripts: don't run install scripts of bundled deps; bundling needs the tree on disk only.
|
|
104
|
+
*/
|
|
105
|
+
function installRuntimeDeps() {
|
|
106
|
+
console.log("Installing runtime deps into staging via npm...");
|
|
107
|
+
run(
|
|
108
|
+
"npm",
|
|
109
|
+
[
|
|
110
|
+
"install",
|
|
111
|
+
"--omit=dev",
|
|
112
|
+
"--omit=optional",
|
|
113
|
+
"--no-package-lock",
|
|
114
|
+
"--prefer-offline",
|
|
115
|
+
"--ignore-scripts",
|
|
116
|
+
],
|
|
117
|
+
{ cwd: stagingDir },
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Run jsii-pacmak against the staging directory via its programmatic API. Avoids spawning a Node subprocess and lets
|
|
123
|
+
* static analysers see the jsii-pacmak dependency.
|
|
124
|
+
*
|
|
125
|
+
* @param {string[]} targets jsii-pacmak target names; empty = all.
|
|
126
|
+
*/
|
|
127
|
+
async function runJsiiPacmak(targets) {
|
|
128
|
+
console.log("Running jsii-pacmak from staging...");
|
|
129
|
+
await pacmak({
|
|
130
|
+
inputDirectories: [stagingDir],
|
|
131
|
+
...(targets.length > 0 ? { targets } : {}),
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Run go-copyright-header.sh against the staging output. Operates on dist/go/ so needs to run from where dist/ landed
|
|
137
|
+
* (the staging dir).
|
|
138
|
+
*/
|
|
139
|
+
function runGoCopyrightHeader() {
|
|
140
|
+
const script = join(stagingDir, "go-copyright-header.sh");
|
|
141
|
+
if (!existsSync(script)) return;
|
|
142
|
+
console.log("Running go-copyright-header.sh from staging...");
|
|
143
|
+
run("bash", ["./go-copyright-header.sh"], { cwd: stagingDir });
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Move the produced dist/ from staging back to the package's dist/. Replaces any prior content.
|
|
148
|
+
*/
|
|
149
|
+
function moveDistOut() {
|
|
150
|
+
const stagingDist = join(stagingDir, "dist");
|
|
151
|
+
if (!existsSync(stagingDist)) {
|
|
152
|
+
console.error(`No dist/ produced in staging at ${stagingDist}`);
|
|
153
|
+
process.exit(1);
|
|
154
|
+
}
|
|
155
|
+
console.log(`Moving staging dist/ to ${distOutDir}...`);
|
|
156
|
+
rmSync(distOutDir, { recursive: true, force: true });
|
|
157
|
+
cpSync(stagingDist, distOutDir, { recursive: true });
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const targets = process.argv.slice(2);
|
|
161
|
+
const sourceFiles = resolveSourceFiles();
|
|
162
|
+
prepareStagingDir();
|
|
163
|
+
copySourceFiles(sourceFiles);
|
|
164
|
+
installRuntimeDeps();
|
|
165
|
+
await runJsiiPacmak(targets);
|
|
166
|
+
runGoCopyrightHeader();
|
|
167
|
+
moveDistOut();
|
|
168
|
+
console.log("Done.");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
coverage/
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# These are supported funding model platforms
|
|
2
|
-
|
|
3
|
-
github: [ljharb]
|
|
4
|
-
patreon: # Replace with a single Patreon username
|
|
5
|
-
open_collective: # Replace with a single Open Collective username
|
|
6
|
-
ko_fi: # Replace with a single Ko-fi username
|
|
7
|
-
tidelift: npm/call-bind
|
|
8
|
-
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
|
9
|
-
liberapay: # Replace with a single Liberapay username
|
|
10
|
-
issuehunt: # Replace with a single IssueHunt username
|
|
11
|
-
otechie: # Replace with a single Otechie username
|
|
12
|
-
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [v1.0.8](https://github.com/ljharb/call-bind/compare/v1.0.7...v1.0.8) - 2024-12-05
|
|
9
|
-
|
|
10
|
-
### Commits
|
|
11
|
-
|
|
12
|
-
- [Refactor] extract out some helpers and avoid get-intrinsic usage [`407fd5e`](https://github.com/ljharb/call-bind/commit/407fd5eec34ec58394522a6ce3badfa4788fd5ae)
|
|
13
|
-
- [Refactor] replace code with extracted `call-bind-apply-helpers` [`81018fb`](https://github.com/ljharb/call-bind/commit/81018fb78902ff5acbc6c09300780e97f0db6a34)
|
|
14
|
-
- [Tests] use `set-function-length/env` [`0fc311d`](https://github.com/ljharb/call-bind/commit/0fc311de0e115cfa6b02969b23a42ad45aadf224)
|
|
15
|
-
- [actions] split out node 10-20, and 20+ [`77a0cad`](https://github.com/ljharb/call-bind/commit/77a0cad75f83f5b8050dc13baef4fa2cff537fa3)
|
|
16
|
-
- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `es-value-fixtures`, `gopd`, `object-inspect`, `tape` [`a145d10`](https://github.com/ljharb/call-bind/commit/a145d10fe847f350e11094f8541848b028ee8c91)
|
|
17
|
-
- [Tests] replace `aud` with `npm audit` [`30ca3dd`](https://github.com/ljharb/call-bind/commit/30ca3dd7234648eb029947477d06b17879e10727)
|
|
18
|
-
- [Deps] update `set-function-length` [`57c79a3`](https://github.com/ljharb/call-bind/commit/57c79a3666022ea797cc2a4a3b43fe089bc97d1b)
|
|
19
|
-
- [Dev Deps] add missing peer dep [`601cfa5`](https://github.com/ljharb/call-bind/commit/601cfa5540066b6206039ceb9496cecbd134ff7b)
|
|
20
|
-
|
|
21
|
-
## [v1.0.7](https://github.com/ljharb/call-bind/compare/v1.0.6...v1.0.7) - 2024-02-12
|
|
22
|
-
|
|
23
|
-
### Commits
|
|
24
|
-
|
|
25
|
-
- [Refactor] use `es-define-property` [`09b76a0`](https://github.com/ljharb/call-bind/commit/09b76a01634440461d44a80c9924ec4b500f3b03)
|
|
26
|
-
- [Deps] update `get-intrinsic`, `set-function-length` [`ad5136d`](https://github.com/ljharb/call-bind/commit/ad5136ddda2a45c590959829ad3dce0c9f4e3590)
|
|
27
|
-
|
|
28
|
-
## [v1.0.6](https://github.com/ljharb/call-bind/compare/v1.0.5...v1.0.6) - 2024-02-05
|
|
29
|
-
|
|
30
|
-
### Commits
|
|
31
|
-
|
|
32
|
-
- [Dev Deps] update `aud`, `npmignore`, `tape` [`d564d5c`](https://github.com/ljharb/call-bind/commit/d564d5ce3e06a19df4d499c77f8d1a9da44e77aa)
|
|
33
|
-
- [Deps] update `get-intrinsic`, `set-function-length` [`cfc2bdc`](https://github.com/ljharb/call-bind/commit/cfc2bdca7b633df0e0e689e6b637f668f1c6792e)
|
|
34
|
-
- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`64cd289`](https://github.com/ljharb/call-bind/commit/64cd289ae5862c250a4ca80aa8d461047c166af5)
|
|
35
|
-
- [meta] add missing `engines.node` [`32a4038`](https://github.com/ljharb/call-bind/commit/32a4038857b62179f7f9b7b3df2c5260036be582)
|
|
36
|
-
|
|
37
|
-
## [v1.0.5](https://github.com/ljharb/call-bind/compare/v1.0.4...v1.0.5) - 2023-10-19
|
|
38
|
-
|
|
39
|
-
### Commits
|
|
40
|
-
|
|
41
|
-
- [Fix] throw an error on non-functions as early as possible [`f262408`](https://github.com/ljharb/call-bind/commit/f262408f822c840fbc268080f3ad7c429611066d)
|
|
42
|
-
- [Deps] update `set-function-length` [`3fff271`](https://github.com/ljharb/call-bind/commit/3fff27145a1e3a76a5b74f1d7c3c43d0fa3b9871)
|
|
43
|
-
|
|
44
|
-
## [v1.0.4](https://github.com/ljharb/call-bind/compare/v1.0.3...v1.0.4) - 2023-10-19
|
|
45
|
-
|
|
46
|
-
## [v1.0.3](https://github.com/ljharb/call-bind/compare/v1.0.2...v1.0.3) - 2023-10-19
|
|
47
|
-
|
|
48
|
-
### Commits
|
|
49
|
-
|
|
50
|
-
- [actions] reuse common workflows [`a994df6`](https://github.com/ljharb/call-bind/commit/a994df69f401f4bf735a4ccd77029b85d1549453)
|
|
51
|
-
- [meta] use `npmignore` to autogenerate an npmignore file [`eef3ef2`](https://github.com/ljharb/call-bind/commit/eef3ef21e1f002790837fedb8af2679c761fbdf5)
|
|
52
|
-
- [readme] flesh out content [`1845ccf`](https://github.com/ljharb/call-bind/commit/1845ccfd9976a607884cfc7157c93192cc16cf22)
|
|
53
|
-
- [actions] use `node/install` instead of `node/run`; use `codecov` action [`5b47d53`](https://github.com/ljharb/call-bind/commit/5b47d53d2fd74af5ea0a44f1d51e503cd42f7a90)
|
|
54
|
-
- [Refactor] use `set-function-length` [`a0e165c`](https://github.com/ljharb/call-bind/commit/a0e165c5dc61db781cbc919b586b1c2b8da0b150)
|
|
55
|
-
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`9c50103`](https://github.com/ljharb/call-bind/commit/9c50103f44137279a817317cf6cc421a658f85b4)
|
|
56
|
-
- [meta] simplify "exports" [`019c6d0`](https://github.com/ljharb/call-bind/commit/019c6d06b0e1246ceed8e579f57e44441cbbf6d9)
|
|
57
|
-
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `safe-publish-latest`, `tape` [`23bd718`](https://github.com/ljharb/call-bind/commit/23bd718a288d3b03042062b4ef5153b3cea83f11)
|
|
58
|
-
- [actions] update codecov uploader [`62552d7`](https://github.com/ljharb/call-bind/commit/62552d79cc79e05825e99aaba134ae5b37f33da5)
|
|
59
|
-
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`ec81665`](https://github.com/ljharb/call-bind/commit/ec81665b300f87eabff597afdc8b8092adfa7afd)
|
|
60
|
-
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`35d67fc`](https://github.com/ljharb/call-bind/commit/35d67fcea883e686650f736f61da5ddca2592de8)
|
|
61
|
-
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`0266d8d`](https://github.com/ljharb/call-bind/commit/0266d8d2a45086a922db366d0c2932fa463662ff)
|
|
62
|
-
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`43a5b28`](https://github.com/ljharb/call-bind/commit/43a5b28a444e710e1bbf92adb8afb5cf7523a223)
|
|
63
|
-
- [Deps] update `define-data-property`, `function-bind`, `get-intrinsic` [`780eb36`](https://github.com/ljharb/call-bind/commit/780eb36552514f8cc99c70821ce698697c2726a5)
|
|
64
|
-
- [Dev Deps] update `aud`, `tape` [`90d50ad`](https://github.com/ljharb/call-bind/commit/90d50ad03b061e0268b3380b0065fcaec183dc05)
|
|
65
|
-
- [meta] use `prepublishOnly` script for npm 7+ [`44c5433`](https://github.com/ljharb/call-bind/commit/44c5433b7980e02b4870007046407cf6fc543329)
|
|
66
|
-
- [Deps] update `get-intrinsic` [`86bfbfc`](https://github.com/ljharb/call-bind/commit/86bfbfcf34afdc6eabc93ce3d408548d0e27d958)
|
|
67
|
-
- [Deps] update `get-intrinsic` [`5c53354`](https://github.com/ljharb/call-bind/commit/5c5335489be0294c18cd7a8bb6e08226ee019ff5)
|
|
68
|
-
- [actions] update checkout action [`4c393a8`](https://github.com/ljharb/call-bind/commit/4c393a8173b3c8e5b30d5b3297b3b94d48bf87f3)
|
|
69
|
-
- [Deps] update `get-intrinsic` [`4e70bde`](https://github.com/ljharb/call-bind/commit/4e70bdec0626acb11616d66250fc14565e716e91)
|
|
70
|
-
- [Deps] update `get-intrinsic` [`55ae803`](https://github.com/ljharb/call-bind/commit/55ae803a920bd93c369cd798c20de31f91e9fc60)
|
|
71
|
-
|
|
72
|
-
## [v1.0.2](https://github.com/ljharb/call-bind/compare/v1.0.1...v1.0.2) - 2021-01-11
|
|
73
|
-
|
|
74
|
-
### Commits
|
|
75
|
-
|
|
76
|
-
- [Fix] properly include the receiver in the bound length [`dbae7bc`](https://github.com/ljharb/call-bind/commit/dbae7bc676c079a0d33c0a43e9ef92cb7b01345d)
|
|
77
|
-
|
|
78
|
-
## [v1.0.1](https://github.com/ljharb/call-bind/compare/v1.0.0...v1.0.1) - 2021-01-08
|
|
79
|
-
|
|
80
|
-
### Commits
|
|
81
|
-
|
|
82
|
-
- [Tests] migrate tests to Github Actions [`b6db284`](https://github.com/ljharb/call-bind/commit/b6db284c36f8ccd195b88a6764fe84b7223a0da1)
|
|
83
|
-
- [meta] do not publish github action workflow files [`ec7fe46`](https://github.com/ljharb/call-bind/commit/ec7fe46e60cfa4764ee943d2755f5e5a366e578e)
|
|
84
|
-
- [Fix] preserve original function’s length when possible [`adbceaa`](https://github.com/ljharb/call-bind/commit/adbceaa3cac4b41ea78bb19d7ccdbaaf7e0bdadb)
|
|
85
|
-
- [Tests] gather coverage data on every job [`d69e23c`](https://github.com/ljharb/call-bind/commit/d69e23cc65f101ba1d4c19bb07fa8eb0ec624be8)
|
|
86
|
-
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`2fd3586`](https://github.com/ljharb/call-bind/commit/2fd3586c5d47b335364c14293114c6b625ae1f71)
|
|
87
|
-
- [Deps] update `get-intrinsic` [`f23e931`](https://github.com/ljharb/call-bind/commit/f23e9318cc271c2add8bb38cfded85ee7baf8eee)
|
|
88
|
-
- [Deps] update `get-intrinsic` [`72d9f44`](https://github.com/ljharb/call-bind/commit/72d9f44e184465ba8dd3fb48260bbcff234985f2)
|
|
89
|
-
- [meta] fix FUNDING.yml [`e723573`](https://github.com/ljharb/call-bind/commit/e723573438c5a68dcec31fb5d96ea6b7e4a93be8)
|
|
90
|
-
- [eslint] ignore coverage output [`15e76d2`](https://github.com/ljharb/call-bind/commit/15e76d28a5f43e504696401e5b31ebb78ee1b532)
|
|
91
|
-
- [meta] add Automatic Rebase and Require Allow Edits workflows [`8fa4dab`](https://github.com/ljharb/call-bind/commit/8fa4dabb23ba3dd7bb92c9571c1241c08b56e4b6)
|
|
92
|
-
|
|
93
|
-
## v1.0.0 - 2020-10-30
|
|
94
|
-
|
|
95
|
-
### Commits
|
|
96
|
-
|
|
97
|
-
- Initial commit [`306cf98`](https://github.com/ljharb/call-bind/commit/306cf98c7ec9e7ef66b653ec152277ac1381eb50)
|
|
98
|
-
- Tests [`e10d0bb`](https://github.com/ljharb/call-bind/commit/e10d0bbdadc7a10ecedc9a1c035112d3e368b8df)
|
|
99
|
-
- Implementation [`43852ed`](https://github.com/ljharb/call-bind/commit/43852eda0f187327b7fad2423ca972149a52bd65)
|
|
100
|
-
- npm init [`408f860`](https://github.com/ljharb/call-bind/commit/408f860b773a2f610805fd3613d0d71bac1b6249)
|
|
101
|
-
- [meta] add Automatic Rebase and Require Allow Edits workflows [`fb349b2`](https://github.com/ljharb/call-bind/commit/fb349b2e48defbec8b5ec8a8395cc8f69f220b13)
|
|
102
|
-
- [meta] add `auto-changelog` [`c4001fc`](https://github.com/ljharb/call-bind/commit/c4001fc43031799ef908211c98d3b0fb2b60fde4)
|
|
103
|
-
- [meta] add "funding"; create `FUNDING.yml` [`d4d6d29`](https://github.com/ljharb/call-bind/commit/d4d6d2974a14bc2e98830468eda7fe6d6a776717)
|
|
104
|
-
- [Tests] add `npm run lint` [`dedfb98`](https://github.com/ljharb/call-bind/commit/dedfb98bd0ecefb08ddb9a94061bd10cde4332af)
|
|
105
|
-
- Only apps should have lockfiles [`54ac776`](https://github.com/ljharb/call-bind/commit/54ac77653db45a7361dc153d2f478e743f110650)
|
|
106
|
-
- [meta] add `safe-publish-latest` [`9ea8e43`](https://github.com/ljharb/call-bind/commit/9ea8e435b950ce9b705559cd651039f9bf40140f)
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 Jordan Harband
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# call-bind <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
|
2
|
-
|
|
3
|
-
[![github actions][actions-image]][actions-url]
|
|
4
|
-
[![coverage][codecov-image]][codecov-url]
|
|
5
|
-
[![dependency status][deps-svg]][deps-url]
|
|
6
|
-
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
|
7
|
-
[![License][license-image]][license-url]
|
|
8
|
-
[![Downloads][downloads-image]][downloads-url]
|
|
9
|
-
|
|
10
|
-
[![npm badge][npm-badge-png]][package-url]
|
|
11
|
-
|
|
12
|
-
Robustly `.call.bind()` a function.
|
|
13
|
-
|
|
14
|
-
## Getting started
|
|
15
|
-
|
|
16
|
-
```sh
|
|
17
|
-
npm install --save call-bind
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Usage/Examples
|
|
21
|
-
|
|
22
|
-
```js
|
|
23
|
-
const assert = require('assert');
|
|
24
|
-
const callBind = require('call-bind');
|
|
25
|
-
const callBound = require('call-bind/callBound');
|
|
26
|
-
|
|
27
|
-
function f(a, b) {
|
|
28
|
-
assert.equal(this, 1);
|
|
29
|
-
assert.equal(a, 2);
|
|
30
|
-
assert.equal(b, 3);
|
|
31
|
-
assert.equal(arguments.length, 2);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const fBound = callBind(f);
|
|
35
|
-
|
|
36
|
-
const slice = callBound('Array.prototype.slice');
|
|
37
|
-
|
|
38
|
-
delete Function.prototype.call;
|
|
39
|
-
delete Function.prototype.bind;
|
|
40
|
-
|
|
41
|
-
fBound(1, 2, 3);
|
|
42
|
-
|
|
43
|
-
assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]);
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## Tests
|
|
47
|
-
|
|
48
|
-
Clone the repo, `npm install`, and run `npm test`
|
|
49
|
-
|
|
50
|
-
[package-url]: https://npmjs.org/package/call-bind
|
|
51
|
-
[npm-version-svg]: https://versionbadg.es/ljharb/call-bind.svg
|
|
52
|
-
[deps-svg]: https://david-dm.org/ljharb/call-bind.svg
|
|
53
|
-
[deps-url]: https://david-dm.org/ljharb/call-bind
|
|
54
|
-
[dev-deps-svg]: https://david-dm.org/ljharb/call-bind/dev-status.svg
|
|
55
|
-
[dev-deps-url]: https://david-dm.org/ljharb/call-bind#info=devDependencies
|
|
56
|
-
[npm-badge-png]: https://nodei.co/npm/call-bind.png?downloads=true&stars=true
|
|
57
|
-
[license-image]: https://img.shields.io/npm/l/call-bind.svg
|
|
58
|
-
[license-url]: LICENSE
|
|
59
|
-
[downloads-image]: https://img.shields.io/npm/dm/call-bind.svg
|
|
60
|
-
[downloads-url]: https://npm-stat.com/charts.html?package=call-bind
|
|
61
|
-
[codecov-image]: https://codecov.io/gh/ljharb/call-bind/branch/main/graphs/badge.svg
|
|
62
|
-
[codecov-url]: https://app.codecov.io/gh/ljharb/call-bind/
|
|
63
|
-
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bind
|
|
64
|
-
[actions-url]: https://github.com/ljharb/call-bind/actions
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var GetIntrinsic = require('get-intrinsic');
|
|
4
|
-
|
|
5
|
-
var callBind = require('./');
|
|
6
|
-
|
|
7
|
-
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
|
|
8
|
-
|
|
9
|
-
module.exports = function callBoundIntrinsic(name, allowMissing) {
|
|
10
|
-
var intrinsic = GetIntrinsic(name, !!allowMissing);
|
|
11
|
-
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
|
12
|
-
return callBind(intrinsic);
|
|
13
|
-
}
|
|
14
|
-
return intrinsic;
|
|
15
|
-
};
|