cdktn 0.23.1 → 0.23.3
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 +1592 -1591
- package/.spec.swcrc +22 -0
- package/README.md +1 -1
- package/jest.config.js +18 -15
- package/lib/_tokens.js +1 -1
- package/lib/annotations.js +2 -2
- package/lib/app.js +2 -2
- package/lib/aspect.js +2 -2
- package/lib/backends/azurerm-backend.js +3 -3
- package/lib/backends/cloud-backend.js +5 -5
- package/lib/backends/consul-backend.js +3 -3
- package/lib/backends/cos-backend.js +3 -3
- package/lib/backends/gcs-backend.js +3 -3
- package/lib/backends/http-backend.js +3 -3
- package/lib/backends/index.js +1 -1
- package/lib/backends/local-backend.js +3 -3
- package/lib/backends/oss-backend.js +3 -3
- package/lib/backends/pg-backend.js +3 -3
- package/lib/backends/remote-backend.js +5 -5
- package/lib/backends/s3-backend.js +3 -3
- package/lib/backends/swift-backend.js +3 -3
- package/lib/complex-computed-list.js +25 -25
- package/lib/errors.d.ts +1 -2
- package/lib/errors.js +11 -8
- package/lib/features.js +1 -1
- package/lib/functions/helpers.js +1 -1
- package/lib/functions/terraform-functions.generated.js +2 -2
- package/lib/hcl/render.js +1 -1
- package/lib/importable-resource.js +2 -2
- package/lib/index.js +1 -1
- package/lib/manifest.js +4 -5
- package/lib/private/fs.d.ts +20 -5
- package/lib/private/fs.js +43 -69
- package/lib/private/unique.js +1 -1
- package/lib/resource.js +2 -2
- package/lib/runtime.js +1 -1
- package/lib/synthesize/index.js +1 -1
- package/lib/synthesize/synthesizer.js +4 -5
- package/lib/synthesize/types.js +1 -1
- package/lib/terraform-addressable.js +1 -1
- package/lib/terraform-asset.js +2 -2
- package/lib/terraform-backend.js +2 -2
- package/lib/terraform-conditions.js +1 -1
- package/lib/terraform-count.js +2 -2
- package/lib/terraform-data-resource.js +2 -2
- package/lib/terraform-data-source.js +2 -2
- package/lib/terraform-dependable.js +1 -1
- package/lib/terraform-dynamic-block.js +2 -2
- package/lib/terraform-dynamic-expression.js +2 -2
- package/lib/terraform-element.js +2 -2
- package/lib/terraform-functions.js +2 -2
- package/lib/terraform-hcl-module.js +2 -2
- package/lib/terraform-iterator.js +6 -6
- package/lib/terraform-local.js +2 -2
- package/lib/terraform-module-asset.js +1 -1
- package/lib/terraform-module.js +2 -2
- package/lib/terraform-operators.js +2 -2
- package/lib/terraform-output.js +2 -2
- package/lib/terraform-provider.js +2 -2
- package/lib/terraform-provisioner.js +2 -2
- package/lib/terraform-remote-state.js +2 -2
- package/lib/terraform-resource-targets.js +2 -2
- package/lib/terraform-resource.js +2 -2
- package/lib/terraform-stack.js +2 -2
- package/lib/terraform-variable.js +3 -3
- package/lib/testing/adapters/jest.js +1 -1
- package/lib/testing/index.js +7 -8
- package/lib/testing/matchers.js +2 -2
- package/lib/tfExpression.js +1 -1
- package/lib/tokens/index.js +1 -1
- package/lib/tokens/lazy.js +4 -4
- package/lib/tokens/private/dependency.js +1 -1
- package/lib/tokens/private/encoding.js +1 -1
- package/lib/tokens/private/intrinsic.d.ts +0 -5
- package/lib/tokens/private/intrinsic.js +2 -9
- package/lib/tokens/private/resolve.js +1 -1
- package/lib/tokens/private/stack-trace.d.ts +6 -0
- package/lib/tokens/private/stack-trace.js +14 -1
- package/lib/tokens/private/token-map.js +1 -1
- package/lib/tokens/private/uniqueid.js +1 -1
- package/lib/tokens/resolvable.js +4 -4
- package/lib/tokens/string-fragments.js +2 -2
- package/lib/tokens/token.js +3 -3
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/upgrade-id-aspect.js +2 -2
- package/lib/util.js +1 -1
- package/lib/validateEnvironment.js +1 -1
- package/lib/validations/index.js +1 -1
- package/lib/validations/validate-binary-version.js +1 -1
- package/lib/validations/validate-provider-presence.js +1 -1
- package/lib/validations/validate-terraform-version.js +1 -1
- package/node_modules/fflate/CHANGELOG.md +115 -0
- package/node_modules/{has-property-descriptors → fflate}/LICENSE +2 -2
- package/node_modules/fflate/README.md +558 -0
- package/node_modules/fflate/esm/browser.d.ts +1501 -0
- package/node_modules/fflate/esm/browser.js +2665 -0
- package/node_modules/fflate/esm/index.d.mts +1501 -0
- package/node_modules/fflate/esm/index.mjs +2679 -0
- package/node_modules/fflate/lib/browser.cjs +2688 -0
- package/node_modules/fflate/lib/browser.d.cts +1501 -0
- package/node_modules/fflate/lib/index.cjs +2668 -0
- package/node_modules/fflate/lib/index.d.ts +1501 -0
- package/node_modules/fflate/lib/node-worker.cjs +32 -0
- package/node_modules/fflate/lib/node.cjs +2700 -0
- package/node_modules/fflate/lib/node.d.cts +1501 -0
- package/node_modules/fflate/lib/worker.cjs +20 -0
- package/node_modules/fflate/package.json +127 -0
- package/node_modules/fflate/umd/index.js +1 -0
- package/node_modules/{yazl → safe-stable-stringify}/LICENSE +1 -1
- 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 +21 -15
- package/tsconfig.json +6 -3
- package/tsconfig.test.json +12 -0
- package/lib/testing/__tests__/matchers.test.d.ts +0 -1
- package/lib/testing/__tests__/matchers.test.js +0 -205
- package/lib/testing/adapters/__tests__/index.test.d.ts +0 -1
- package/lib/testing/adapters/__tests__/index.test.js +0 -67
- package/lib/testing/adapters/__tests__/jest.test.d.ts +0 -1
- package/lib/testing/adapters/__tests__/jest.test.js +0 -41
- package/node_modules/buffer-crc32/LICENSE +0 -19
- package/node_modules/buffer-crc32/README.md +0 -55
- package/node_modules/buffer-crc32/dist/index.cjs +0 -306
- package/node_modules/buffer-crc32/dist/index.d.cts +0 -35
- package/node_modules/buffer-crc32/dist/index.d.mts +0 -35
- package/node_modules/buffer-crc32/dist/index.mjs +0 -304
- package/node_modules/buffer-crc32/index.d.ts +0 -35
- package/node_modules/buffer-crc32/package.json +0 -54
- 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/LICENSE +0 -21
- 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/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
- package/node_modules/yazl/README.md +0 -457
- package/node_modules/yazl/index.js +0 -826
- package/node_modules/yazl/package.json +0 -34
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,625 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { hasOwnProperty } = Object.prototype
|
|
4
|
+
|
|
5
|
+
const stringify = configure()
|
|
6
|
+
|
|
7
|
+
// @ts-expect-error
|
|
8
|
+
stringify.configure = configure
|
|
9
|
+
// @ts-expect-error
|
|
10
|
+
stringify.stringify = stringify
|
|
11
|
+
|
|
12
|
+
// @ts-expect-error
|
|
13
|
+
stringify.default = stringify
|
|
14
|
+
|
|
15
|
+
// @ts-expect-error used for named export
|
|
16
|
+
exports.stringify = stringify
|
|
17
|
+
// @ts-expect-error used for named export
|
|
18
|
+
exports.configure = configure
|
|
19
|
+
|
|
20
|
+
module.exports = stringify
|
|
21
|
+
|
|
22
|
+
// eslint-disable-next-line no-control-regex
|
|
23
|
+
const strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]/
|
|
24
|
+
|
|
25
|
+
// Escape C0 control characters, double quotes, the backslash and every code
|
|
26
|
+
// unit with a numeric value in the inclusive range 0xD800 to 0xDFFF.
|
|
27
|
+
function strEscape (str) {
|
|
28
|
+
// Some magic numbers that worked out fine while benchmarking with v8 8.0
|
|
29
|
+
if (str.length < 5000 && !strEscapeSequencesRegExp.test(str)) {
|
|
30
|
+
return `"${str}"`
|
|
31
|
+
}
|
|
32
|
+
return JSON.stringify(str)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function sort (array, comparator) {
|
|
36
|
+
// Insertion sort is very efficient for small input sizes, but it has a bad
|
|
37
|
+
// worst case complexity. Thus, use native array sort for bigger values.
|
|
38
|
+
if (array.length > 2e2 || comparator) {
|
|
39
|
+
return array.sort(comparator)
|
|
40
|
+
}
|
|
41
|
+
for (let i = 1; i < array.length; i++) {
|
|
42
|
+
const currentValue = array[i]
|
|
43
|
+
let position = i
|
|
44
|
+
while (position !== 0 && array[position - 1] > currentValue) {
|
|
45
|
+
array[position] = array[position - 1]
|
|
46
|
+
position--
|
|
47
|
+
}
|
|
48
|
+
array[position] = currentValue
|
|
49
|
+
}
|
|
50
|
+
return array
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const typedArrayPrototypeGetSymbolToStringTag =
|
|
54
|
+
Object.getOwnPropertyDescriptor(
|
|
55
|
+
Object.getPrototypeOf(
|
|
56
|
+
Object.getPrototypeOf(
|
|
57
|
+
new Int8Array()
|
|
58
|
+
)
|
|
59
|
+
),
|
|
60
|
+
Symbol.toStringTag
|
|
61
|
+
).get
|
|
62
|
+
|
|
63
|
+
function isTypedArrayWithEntries (value) {
|
|
64
|
+
return typedArrayPrototypeGetSymbolToStringTag.call(value) !== undefined && value.length !== 0
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function stringifyTypedArray (array, separator, maximumBreadth) {
|
|
68
|
+
if (array.length < maximumBreadth) {
|
|
69
|
+
maximumBreadth = array.length
|
|
70
|
+
}
|
|
71
|
+
const whitespace = separator === ',' ? '' : ' '
|
|
72
|
+
let res = `"0":${whitespace}${array[0]}`
|
|
73
|
+
for (let i = 1; i < maximumBreadth; i++) {
|
|
74
|
+
res += `${separator}"${i}":${whitespace}${array[i]}`
|
|
75
|
+
}
|
|
76
|
+
return res
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function getCircularValueOption (options) {
|
|
80
|
+
if (hasOwnProperty.call(options, 'circularValue')) {
|
|
81
|
+
const circularValue = options.circularValue
|
|
82
|
+
if (typeof circularValue === 'string') {
|
|
83
|
+
return `"${circularValue}"`
|
|
84
|
+
}
|
|
85
|
+
if (circularValue == null) {
|
|
86
|
+
return circularValue
|
|
87
|
+
}
|
|
88
|
+
if (circularValue === Error || circularValue === TypeError) {
|
|
89
|
+
return {
|
|
90
|
+
toString () {
|
|
91
|
+
throw new TypeError('Converting circular structure to JSON')
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')
|
|
96
|
+
}
|
|
97
|
+
return '"[Circular]"'
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function getDeterministicOption (options) {
|
|
101
|
+
let value
|
|
102
|
+
if (hasOwnProperty.call(options, 'deterministic')) {
|
|
103
|
+
value = options.deterministic
|
|
104
|
+
if (typeof value !== 'boolean' && typeof value !== 'function') {
|
|
105
|
+
throw new TypeError('The "deterministic" argument must be of type boolean or comparator function')
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return value === undefined ? true : value
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function getBooleanOption (options, key) {
|
|
112
|
+
let value
|
|
113
|
+
if (hasOwnProperty.call(options, key)) {
|
|
114
|
+
value = options[key]
|
|
115
|
+
if (typeof value !== 'boolean') {
|
|
116
|
+
throw new TypeError(`The "${key}" argument must be of type boolean`)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return value === undefined ? true : value
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function getPositiveIntegerOption (options, key) {
|
|
123
|
+
let value
|
|
124
|
+
if (hasOwnProperty.call(options, key)) {
|
|
125
|
+
value = options[key]
|
|
126
|
+
if (typeof value !== 'number') {
|
|
127
|
+
throw new TypeError(`The "${key}" argument must be of type number`)
|
|
128
|
+
}
|
|
129
|
+
if (!Number.isInteger(value)) {
|
|
130
|
+
throw new TypeError(`The "${key}" argument must be an integer`)
|
|
131
|
+
}
|
|
132
|
+
if (value < 1) {
|
|
133
|
+
throw new RangeError(`The "${key}" argument must be >= 1`)
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return value === undefined ? Infinity : value
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function getItemCount (number) {
|
|
140
|
+
if (number === 1) {
|
|
141
|
+
return '1 item'
|
|
142
|
+
}
|
|
143
|
+
return `${number} items`
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function getUniqueReplacerSet (replacerArray) {
|
|
147
|
+
const replacerSet = new Set()
|
|
148
|
+
for (const value of replacerArray) {
|
|
149
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
150
|
+
replacerSet.add(String(value))
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return replacerSet
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function getStrictOption (options) {
|
|
157
|
+
if (hasOwnProperty.call(options, 'strict')) {
|
|
158
|
+
const value = options.strict
|
|
159
|
+
if (typeof value !== 'boolean') {
|
|
160
|
+
throw new TypeError('The "strict" argument must be of type boolean')
|
|
161
|
+
}
|
|
162
|
+
if (value) {
|
|
163
|
+
return (value) => {
|
|
164
|
+
let message = `Object can not safely be stringified. Received type ${typeof value}`
|
|
165
|
+
if (typeof value !== 'function') message += ` (${value.toString()})`
|
|
166
|
+
throw new Error(message)
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function configure (options) {
|
|
173
|
+
options = { ...options }
|
|
174
|
+
const fail = getStrictOption(options)
|
|
175
|
+
if (fail) {
|
|
176
|
+
if (options.bigint === undefined) {
|
|
177
|
+
options.bigint = false
|
|
178
|
+
}
|
|
179
|
+
if (!('circularValue' in options)) {
|
|
180
|
+
options.circularValue = Error
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
const circularValue = getCircularValueOption(options)
|
|
184
|
+
const bigint = getBooleanOption(options, 'bigint')
|
|
185
|
+
const deterministic = getDeterministicOption(options)
|
|
186
|
+
const comparator = typeof deterministic === 'function' ? deterministic : undefined
|
|
187
|
+
const maximumDepth = getPositiveIntegerOption(options, 'maximumDepth')
|
|
188
|
+
const maximumBreadth = getPositiveIntegerOption(options, 'maximumBreadth')
|
|
189
|
+
|
|
190
|
+
function stringifyFnReplacer (key, parent, stack, replacer, spacer, indentation) {
|
|
191
|
+
let value = parent[key]
|
|
192
|
+
|
|
193
|
+
if (typeof value === 'object' && value !== null && typeof value.toJSON === 'function') {
|
|
194
|
+
value = value.toJSON(key)
|
|
195
|
+
}
|
|
196
|
+
value = replacer.call(parent, key, value)
|
|
197
|
+
|
|
198
|
+
switch (typeof value) {
|
|
199
|
+
case 'string':
|
|
200
|
+
return strEscape(value)
|
|
201
|
+
case 'object': {
|
|
202
|
+
if (value === null) {
|
|
203
|
+
return 'null'
|
|
204
|
+
}
|
|
205
|
+
if (stack.indexOf(value) !== -1) {
|
|
206
|
+
return circularValue
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
let res = ''
|
|
210
|
+
let join = ','
|
|
211
|
+
const originalIndentation = indentation
|
|
212
|
+
|
|
213
|
+
if (Array.isArray(value)) {
|
|
214
|
+
if (value.length === 0) {
|
|
215
|
+
return '[]'
|
|
216
|
+
}
|
|
217
|
+
if (maximumDepth < stack.length + 1) {
|
|
218
|
+
return '"[Array]"'
|
|
219
|
+
}
|
|
220
|
+
stack.push(value)
|
|
221
|
+
if (spacer !== '') {
|
|
222
|
+
indentation += spacer
|
|
223
|
+
res += `\n${indentation}`
|
|
224
|
+
join = `,\n${indentation}`
|
|
225
|
+
}
|
|
226
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth)
|
|
227
|
+
let i = 0
|
|
228
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
229
|
+
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation)
|
|
230
|
+
res += tmp !== undefined ? tmp : 'null'
|
|
231
|
+
res += join
|
|
232
|
+
}
|
|
233
|
+
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation)
|
|
234
|
+
res += tmp !== undefined ? tmp : 'null'
|
|
235
|
+
if (value.length - 1 > maximumBreadth) {
|
|
236
|
+
const removedKeys = value.length - maximumBreadth - 1
|
|
237
|
+
res += `${join}"... ${getItemCount(removedKeys)} not stringified"`
|
|
238
|
+
}
|
|
239
|
+
if (spacer !== '') {
|
|
240
|
+
res += `\n${originalIndentation}`
|
|
241
|
+
}
|
|
242
|
+
stack.pop()
|
|
243
|
+
return `[${res}]`
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
let keys = Object.keys(value)
|
|
247
|
+
const keyLength = keys.length
|
|
248
|
+
if (keyLength === 0) {
|
|
249
|
+
return '{}'
|
|
250
|
+
}
|
|
251
|
+
if (maximumDepth < stack.length + 1) {
|
|
252
|
+
return '"[Object]"'
|
|
253
|
+
}
|
|
254
|
+
let whitespace = ''
|
|
255
|
+
let separator = ''
|
|
256
|
+
if (spacer !== '') {
|
|
257
|
+
indentation += spacer
|
|
258
|
+
join = `,\n${indentation}`
|
|
259
|
+
whitespace = ' '
|
|
260
|
+
}
|
|
261
|
+
const maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth)
|
|
262
|
+
if (deterministic && !isTypedArrayWithEntries(value)) {
|
|
263
|
+
keys = sort(keys, comparator)
|
|
264
|
+
}
|
|
265
|
+
stack.push(value)
|
|
266
|
+
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
|
267
|
+
const key = keys[i]
|
|
268
|
+
const tmp = stringifyFnReplacer(key, value, stack, replacer, spacer, indentation)
|
|
269
|
+
if (tmp !== undefined) {
|
|
270
|
+
res += `${separator}${strEscape(key)}:${whitespace}${tmp}`
|
|
271
|
+
separator = join
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (keyLength > maximumBreadth) {
|
|
275
|
+
const removedKeys = keyLength - maximumBreadth
|
|
276
|
+
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`
|
|
277
|
+
separator = join
|
|
278
|
+
}
|
|
279
|
+
if (spacer !== '' && separator.length > 1) {
|
|
280
|
+
res = `\n${indentation}${res}\n${originalIndentation}`
|
|
281
|
+
}
|
|
282
|
+
stack.pop()
|
|
283
|
+
return `{${res}}`
|
|
284
|
+
}
|
|
285
|
+
case 'number':
|
|
286
|
+
return isFinite(value) ? String(value) : fail ? fail(value) : 'null'
|
|
287
|
+
case 'boolean':
|
|
288
|
+
return value === true ? 'true' : 'false'
|
|
289
|
+
case 'undefined':
|
|
290
|
+
return undefined
|
|
291
|
+
case 'bigint':
|
|
292
|
+
if (bigint) {
|
|
293
|
+
return String(value)
|
|
294
|
+
}
|
|
295
|
+
// fallthrough
|
|
296
|
+
default:
|
|
297
|
+
return fail ? fail(value) : undefined
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function stringifyArrayReplacer (key, value, stack, replacer, spacer, indentation) {
|
|
302
|
+
if (typeof value === 'object' && value !== null && typeof value.toJSON === 'function') {
|
|
303
|
+
value = value.toJSON(key)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
switch (typeof value) {
|
|
307
|
+
case 'string':
|
|
308
|
+
return strEscape(value)
|
|
309
|
+
case 'object': {
|
|
310
|
+
if (value === null) {
|
|
311
|
+
return 'null'
|
|
312
|
+
}
|
|
313
|
+
if (stack.indexOf(value) !== -1) {
|
|
314
|
+
return circularValue
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
const originalIndentation = indentation
|
|
318
|
+
let res = ''
|
|
319
|
+
let join = ','
|
|
320
|
+
|
|
321
|
+
if (Array.isArray(value)) {
|
|
322
|
+
if (value.length === 0) {
|
|
323
|
+
return '[]'
|
|
324
|
+
}
|
|
325
|
+
if (maximumDepth < stack.length + 1) {
|
|
326
|
+
return '"[Array]"'
|
|
327
|
+
}
|
|
328
|
+
stack.push(value)
|
|
329
|
+
if (spacer !== '') {
|
|
330
|
+
indentation += spacer
|
|
331
|
+
res += `\n${indentation}`
|
|
332
|
+
join = `,\n${indentation}`
|
|
333
|
+
}
|
|
334
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth)
|
|
335
|
+
let i = 0
|
|
336
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
337
|
+
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation)
|
|
338
|
+
res += tmp !== undefined ? tmp : 'null'
|
|
339
|
+
res += join
|
|
340
|
+
}
|
|
341
|
+
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation)
|
|
342
|
+
res += tmp !== undefined ? tmp : 'null'
|
|
343
|
+
if (value.length - 1 > maximumBreadth) {
|
|
344
|
+
const removedKeys = value.length - maximumBreadth - 1
|
|
345
|
+
res += `${join}"... ${getItemCount(removedKeys)} not stringified"`
|
|
346
|
+
}
|
|
347
|
+
if (spacer !== '') {
|
|
348
|
+
res += `\n${originalIndentation}`
|
|
349
|
+
}
|
|
350
|
+
stack.pop()
|
|
351
|
+
return `[${res}]`
|
|
352
|
+
}
|
|
353
|
+
stack.push(value)
|
|
354
|
+
let whitespace = ''
|
|
355
|
+
if (spacer !== '') {
|
|
356
|
+
indentation += spacer
|
|
357
|
+
join = `,\n${indentation}`
|
|
358
|
+
whitespace = ' '
|
|
359
|
+
}
|
|
360
|
+
let separator = ''
|
|
361
|
+
for (const key of replacer) {
|
|
362
|
+
const tmp = stringifyArrayReplacer(key, value[key], stack, replacer, spacer, indentation)
|
|
363
|
+
if (tmp !== undefined) {
|
|
364
|
+
res += `${separator}${strEscape(key)}:${whitespace}${tmp}`
|
|
365
|
+
separator = join
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
if (spacer !== '' && separator.length > 1) {
|
|
369
|
+
res = `\n${indentation}${res}\n${originalIndentation}`
|
|
370
|
+
}
|
|
371
|
+
stack.pop()
|
|
372
|
+
return `{${res}}`
|
|
373
|
+
}
|
|
374
|
+
case 'number':
|
|
375
|
+
return isFinite(value) ? String(value) : fail ? fail(value) : 'null'
|
|
376
|
+
case 'boolean':
|
|
377
|
+
return value === true ? 'true' : 'false'
|
|
378
|
+
case 'undefined':
|
|
379
|
+
return undefined
|
|
380
|
+
case 'bigint':
|
|
381
|
+
if (bigint) {
|
|
382
|
+
return String(value)
|
|
383
|
+
}
|
|
384
|
+
// fallthrough
|
|
385
|
+
default:
|
|
386
|
+
return fail ? fail(value) : undefined
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function stringifyIndent (key, value, stack, spacer, indentation) {
|
|
391
|
+
switch (typeof value) {
|
|
392
|
+
case 'string':
|
|
393
|
+
return strEscape(value)
|
|
394
|
+
case 'object': {
|
|
395
|
+
if (value === null) {
|
|
396
|
+
return 'null'
|
|
397
|
+
}
|
|
398
|
+
if (typeof value.toJSON === 'function') {
|
|
399
|
+
value = value.toJSON(key)
|
|
400
|
+
// Prevent calling `toJSON` again.
|
|
401
|
+
if (typeof value !== 'object') {
|
|
402
|
+
return stringifyIndent(key, value, stack, spacer, indentation)
|
|
403
|
+
}
|
|
404
|
+
if (value === null) {
|
|
405
|
+
return 'null'
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
if (stack.indexOf(value) !== -1) {
|
|
409
|
+
return circularValue
|
|
410
|
+
}
|
|
411
|
+
const originalIndentation = indentation
|
|
412
|
+
|
|
413
|
+
if (Array.isArray(value)) {
|
|
414
|
+
if (value.length === 0) {
|
|
415
|
+
return '[]'
|
|
416
|
+
}
|
|
417
|
+
if (maximumDepth < stack.length + 1) {
|
|
418
|
+
return '"[Array]"'
|
|
419
|
+
}
|
|
420
|
+
stack.push(value)
|
|
421
|
+
indentation += spacer
|
|
422
|
+
let res = `\n${indentation}`
|
|
423
|
+
const join = `,\n${indentation}`
|
|
424
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth)
|
|
425
|
+
let i = 0
|
|
426
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
427
|
+
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation)
|
|
428
|
+
res += tmp !== undefined ? tmp : 'null'
|
|
429
|
+
res += join
|
|
430
|
+
}
|
|
431
|
+
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation)
|
|
432
|
+
res += tmp !== undefined ? tmp : 'null'
|
|
433
|
+
if (value.length - 1 > maximumBreadth) {
|
|
434
|
+
const removedKeys = value.length - maximumBreadth - 1
|
|
435
|
+
res += `${join}"... ${getItemCount(removedKeys)} not stringified"`
|
|
436
|
+
}
|
|
437
|
+
res += `\n${originalIndentation}`
|
|
438
|
+
stack.pop()
|
|
439
|
+
return `[${res}]`
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
let keys = Object.keys(value)
|
|
443
|
+
const keyLength = keys.length
|
|
444
|
+
if (keyLength === 0) {
|
|
445
|
+
return '{}'
|
|
446
|
+
}
|
|
447
|
+
if (maximumDepth < stack.length + 1) {
|
|
448
|
+
return '"[Object]"'
|
|
449
|
+
}
|
|
450
|
+
indentation += spacer
|
|
451
|
+
const join = `,\n${indentation}`
|
|
452
|
+
let res = ''
|
|
453
|
+
let separator = ''
|
|
454
|
+
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth)
|
|
455
|
+
if (isTypedArrayWithEntries(value)) {
|
|
456
|
+
res += stringifyTypedArray(value, join, maximumBreadth)
|
|
457
|
+
keys = keys.slice(value.length)
|
|
458
|
+
maximumPropertiesToStringify -= value.length
|
|
459
|
+
separator = join
|
|
460
|
+
}
|
|
461
|
+
if (deterministic) {
|
|
462
|
+
keys = sort(keys, comparator)
|
|
463
|
+
}
|
|
464
|
+
stack.push(value)
|
|
465
|
+
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
|
466
|
+
const key = keys[i]
|
|
467
|
+
const tmp = stringifyIndent(key, value[key], stack, spacer, indentation)
|
|
468
|
+
if (tmp !== undefined) {
|
|
469
|
+
res += `${separator}${strEscape(key)}: ${tmp}`
|
|
470
|
+
separator = join
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
if (keyLength > maximumBreadth) {
|
|
474
|
+
const removedKeys = keyLength - maximumBreadth
|
|
475
|
+
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`
|
|
476
|
+
separator = join
|
|
477
|
+
}
|
|
478
|
+
if (separator !== '') {
|
|
479
|
+
res = `\n${indentation}${res}\n${originalIndentation}`
|
|
480
|
+
}
|
|
481
|
+
stack.pop()
|
|
482
|
+
return `{${res}}`
|
|
483
|
+
}
|
|
484
|
+
case 'number':
|
|
485
|
+
return isFinite(value) ? String(value) : fail ? fail(value) : 'null'
|
|
486
|
+
case 'boolean':
|
|
487
|
+
return value === true ? 'true' : 'false'
|
|
488
|
+
case 'undefined':
|
|
489
|
+
return undefined
|
|
490
|
+
case 'bigint':
|
|
491
|
+
if (bigint) {
|
|
492
|
+
return String(value)
|
|
493
|
+
}
|
|
494
|
+
// fallthrough
|
|
495
|
+
default:
|
|
496
|
+
return fail ? fail(value) : undefined
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
function stringifySimple (key, value, stack) {
|
|
501
|
+
switch (typeof value) {
|
|
502
|
+
case 'string':
|
|
503
|
+
return strEscape(value)
|
|
504
|
+
case 'object': {
|
|
505
|
+
if (value === null) {
|
|
506
|
+
return 'null'
|
|
507
|
+
}
|
|
508
|
+
if (typeof value.toJSON === 'function') {
|
|
509
|
+
value = value.toJSON(key)
|
|
510
|
+
// Prevent calling `toJSON` again
|
|
511
|
+
if (typeof value !== 'object') {
|
|
512
|
+
return stringifySimple(key, value, stack)
|
|
513
|
+
}
|
|
514
|
+
if (value === null) {
|
|
515
|
+
return 'null'
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
if (stack.indexOf(value) !== -1) {
|
|
519
|
+
return circularValue
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
let res = ''
|
|
523
|
+
|
|
524
|
+
const hasLength = value.length !== undefined
|
|
525
|
+
if (hasLength && Array.isArray(value)) {
|
|
526
|
+
if (value.length === 0) {
|
|
527
|
+
return '[]'
|
|
528
|
+
}
|
|
529
|
+
if (maximumDepth < stack.length + 1) {
|
|
530
|
+
return '"[Array]"'
|
|
531
|
+
}
|
|
532
|
+
stack.push(value)
|
|
533
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth)
|
|
534
|
+
let i = 0
|
|
535
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
536
|
+
const tmp = stringifySimple(String(i), value[i], stack)
|
|
537
|
+
res += tmp !== undefined ? tmp : 'null'
|
|
538
|
+
res += ','
|
|
539
|
+
}
|
|
540
|
+
const tmp = stringifySimple(String(i), value[i], stack)
|
|
541
|
+
res += tmp !== undefined ? tmp : 'null'
|
|
542
|
+
if (value.length - 1 > maximumBreadth) {
|
|
543
|
+
const removedKeys = value.length - maximumBreadth - 1
|
|
544
|
+
res += `,"... ${getItemCount(removedKeys)} not stringified"`
|
|
545
|
+
}
|
|
546
|
+
stack.pop()
|
|
547
|
+
return `[${res}]`
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
let keys = Object.keys(value)
|
|
551
|
+
const keyLength = keys.length
|
|
552
|
+
if (keyLength === 0) {
|
|
553
|
+
return '{}'
|
|
554
|
+
}
|
|
555
|
+
if (maximumDepth < stack.length + 1) {
|
|
556
|
+
return '"[Object]"'
|
|
557
|
+
}
|
|
558
|
+
let separator = ''
|
|
559
|
+
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth)
|
|
560
|
+
if (hasLength && isTypedArrayWithEntries(value)) {
|
|
561
|
+
res += stringifyTypedArray(value, ',', maximumBreadth)
|
|
562
|
+
keys = keys.slice(value.length)
|
|
563
|
+
maximumPropertiesToStringify -= value.length
|
|
564
|
+
separator = ','
|
|
565
|
+
}
|
|
566
|
+
if (deterministic) {
|
|
567
|
+
keys = sort(keys, comparator)
|
|
568
|
+
}
|
|
569
|
+
stack.push(value)
|
|
570
|
+
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
|
571
|
+
const key = keys[i]
|
|
572
|
+
const tmp = stringifySimple(key, value[key], stack)
|
|
573
|
+
if (tmp !== undefined) {
|
|
574
|
+
res += `${separator}${strEscape(key)}:${tmp}`
|
|
575
|
+
separator = ','
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
if (keyLength > maximumBreadth) {
|
|
579
|
+
const removedKeys = keyLength - maximumBreadth
|
|
580
|
+
res += `${separator}"...":"${getItemCount(removedKeys)} not stringified"`
|
|
581
|
+
}
|
|
582
|
+
stack.pop()
|
|
583
|
+
return `{${res}}`
|
|
584
|
+
}
|
|
585
|
+
case 'number':
|
|
586
|
+
return isFinite(value) ? String(value) : fail ? fail(value) : 'null'
|
|
587
|
+
case 'boolean':
|
|
588
|
+
return value === true ? 'true' : 'false'
|
|
589
|
+
case 'undefined':
|
|
590
|
+
return undefined
|
|
591
|
+
case 'bigint':
|
|
592
|
+
if (bigint) {
|
|
593
|
+
return String(value)
|
|
594
|
+
}
|
|
595
|
+
// fallthrough
|
|
596
|
+
default:
|
|
597
|
+
return fail ? fail(value) : undefined
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
function stringify (value, replacer, space) {
|
|
602
|
+
if (arguments.length > 1) {
|
|
603
|
+
let spacer = ''
|
|
604
|
+
if (typeof space === 'number') {
|
|
605
|
+
spacer = ' '.repeat(Math.min(space, 10))
|
|
606
|
+
} else if (typeof space === 'string') {
|
|
607
|
+
spacer = space.slice(0, 10)
|
|
608
|
+
}
|
|
609
|
+
if (replacer != null) {
|
|
610
|
+
if (typeof replacer === 'function') {
|
|
611
|
+
return stringifyFnReplacer('', { '': value }, [], replacer, spacer, '')
|
|
612
|
+
}
|
|
613
|
+
if (Array.isArray(replacer)) {
|
|
614
|
+
return stringifyArrayReplacer('', value, [], getUniqueReplacerSet(replacer), spacer, '')
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
if (spacer.length !== 0) {
|
|
618
|
+
return stringifyIndent('', value, [], spacer, '')
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return stringifySimple('', value, [])
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
return stringify
|
|
625
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "safe-stable-stringify",
|
|
3
|
+
"version": "2.5.0",
|
|
4
|
+
"description": "Deterministic and safely JSON.stringify to quickly serialize JavaScript objects",
|
|
5
|
+
"exports": {
|
|
6
|
+
"require": "./index.js",
|
|
7
|
+
"import": "./esm/wrapper.js"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"stable",
|
|
11
|
+
"stringify",
|
|
12
|
+
"JSON",
|
|
13
|
+
"JSON.stringify",
|
|
14
|
+
"safe",
|
|
15
|
+
"serialize",
|
|
16
|
+
"deterministic",
|
|
17
|
+
"circular",
|
|
18
|
+
"object",
|
|
19
|
+
"predicable",
|
|
20
|
+
"repeatable",
|
|
21
|
+
"fast",
|
|
22
|
+
"bigint"
|
|
23
|
+
],
|
|
24
|
+
"main": "index.js",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"test": "standard && tap test.js",
|
|
27
|
+
"tap": "tap test.js",
|
|
28
|
+
"tap:only": "tap test.js --watch --only",
|
|
29
|
+
"benchmark": "node benchmark.js",
|
|
30
|
+
"compare": "node compare.js",
|
|
31
|
+
"lint": "standard --fix",
|
|
32
|
+
"tsc": "tsc --project tsconfig.json"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=10"
|
|
36
|
+
},
|
|
37
|
+
"author": "Ruben Bridgewater",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"typings": "index.d.ts",
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/json-stable-stringify": "^1.0.34",
|
|
42
|
+
"@types/node": "^18.11.18",
|
|
43
|
+
"benchmark": "^2.1.4",
|
|
44
|
+
"clone": "^2.1.2",
|
|
45
|
+
"fast-json-stable-stringify": "^2.1.0",
|
|
46
|
+
"fast-safe-stringify": "^2.1.1",
|
|
47
|
+
"fast-stable-stringify": "^1.0.0",
|
|
48
|
+
"faster-stable-stringify": "^1.0.0",
|
|
49
|
+
"fastest-stable-stringify": "^2.0.2",
|
|
50
|
+
"json-stable-stringify": "^1.0.1",
|
|
51
|
+
"json-stringify-deterministic": "^1.0.7",
|
|
52
|
+
"json-stringify-safe": "^5.0.1",
|
|
53
|
+
"standard": "^16.0.4",
|
|
54
|
+
"tap": "^15.0.9",
|
|
55
|
+
"typescript": "^4.8.3"
|
|
56
|
+
},
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "git+https://github.com/BridgeAR/safe-stable-stringify.git"
|
|
60
|
+
},
|
|
61
|
+
"bugs": {
|
|
62
|
+
"url": "https://github.com/BridgeAR/safe-stable-stringify/issues"
|
|
63
|
+
},
|
|
64
|
+
"homepage": "https://github.com/BridgeAR/safe-stable-stringify#readme"
|
|
65
|
+
}
|