@contrast/agent 4.16.0 → 4.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/VERSION +1 -1
- package/bin/linux/contrast-service +0 -0
- package/bin/mac/contrast-service +0 -0
- package/bin/windows/contrast-service.exe +0 -0
- package/esm.mjs +21 -11
- package/lib/assess/policy/propagators.json +4 -0
- package/lib/assess/policy/signatures.json +5 -0
- package/lib/assess/propagators/fastify-static/allowed-path.js +85 -0
- package/lib/contrast.js +1 -1
- package/lib/core/rewrite/index.js +2 -2
- package/lib/protect/rules/cmd-injection/cmdinjection-rule.js +1 -1
- package/node_modules/@colors/colors/LICENSE +26 -0
- package/node_modules/@colors/colors/README.md +219 -0
- package/node_modules/@colors/colors/examples/normal-usage.js +83 -0
- package/node_modules/@colors/colors/examples/safe-string.js +80 -0
- package/node_modules/@colors/colors/index.d.ts +136 -0
- package/node_modules/@colors/colors/lib/colors.js +211 -0
- package/node_modules/@colors/colors/lib/custom/trap.js +46 -0
- package/node_modules/@colors/colors/lib/custom/zalgo.js +110 -0
- package/node_modules/@colors/colors/lib/extendStringPrototype.js +110 -0
- package/node_modules/@colors/colors/lib/index.js +13 -0
- package/node_modules/@colors/colors/lib/maps/america.js +10 -0
- package/node_modules/@colors/colors/lib/maps/rainbow.js +12 -0
- package/node_modules/@colors/colors/lib/maps/random.js +11 -0
- package/node_modules/@colors/colors/lib/maps/zebra.js +5 -0
- package/node_modules/@colors/colors/lib/styles.js +95 -0
- package/node_modules/@colors/colors/lib/system/has-flag.js +35 -0
- package/node_modules/@colors/colors/lib/system/supports-colors.js +151 -0
- package/node_modules/@colors/colors/package.json +49 -0
- package/node_modules/@colors/colors/safe.d.ts +48 -0
- package/node_modules/@colors/colors/safe.js +10 -0
- package/node_modules/@colors/colors/themes/generic-logging.js +12 -0
- package/node_modules/@dabh/diagnostics/README.md +16 -16
- package/node_modules/@dabh/diagnostics/package.json +9 -9
- package/node_modules/async/CHANGELOG.md +13 -0
- package/node_modules/async/all.js +74 -9
- package/node_modules/async/allLimit.js +3 -3
- package/node_modules/async/allSeries.js +3 -3
- package/node_modules/async/any.js +75 -9
- package/node_modules/async/anyLimit.js +3 -3
- package/node_modules/async/anySeries.js +3 -3
- package/node_modules/async/applyEach.js +2 -2
- package/node_modules/async/applyEachSeries.js +2 -2
- package/node_modules/async/asyncify.js +3 -3
- package/node_modules/async/auto.js +81 -15
- package/node_modules/async/autoInject.js +30 -4
- package/node_modules/async/cargo.js +1 -1
- package/node_modules/async/cargoQueue.js +1 -1
- package/node_modules/async/compose.js +1 -1
- package/node_modules/async/concat.js +72 -4
- package/node_modules/async/concatLimit.js +3 -3
- package/node_modules/async/concatSeries.js +2 -2
- package/node_modules/async/detect.js +43 -8
- package/node_modules/async/detectLimit.js +3 -3
- package/node_modules/async/detectSeries.js +3 -3
- package/node_modules/async/dir.js +1 -1
- package/node_modules/async/dist/async.js +1379 -168
- package/node_modules/async/dist/async.min.js +1 -1
- package/node_modules/async/dist/async.mjs +1372 -161
- package/node_modules/async/doDuring.js +3 -3
- package/node_modules/async/doUntil.js +2 -2
- package/node_modules/async/doWhilst.js +3 -3
- package/node_modules/async/during.js +3 -3
- package/node_modules/async/each.js +69 -28
- package/node_modules/async/eachLimit.js +4 -4
- package/node_modules/async/eachOf.js +85 -16
- package/node_modules/async/eachOfLimit.js +3 -3
- package/node_modules/async/eachOfSeries.js +2 -2
- package/node_modules/async/eachSeries.js +2 -2
- package/node_modules/async/ensureAsync.js +2 -2
- package/node_modules/async/every.js +74 -9
- package/node_modules/async/everyLimit.js +3 -3
- package/node_modules/async/everySeries.js +3 -3
- package/node_modules/async/filter.js +49 -9
- package/node_modules/async/filterLimit.js +3 -3
- package/node_modules/async/filterSeries.js +3 -3
- package/node_modules/async/find.js +43 -8
- package/node_modules/async/findLimit.js +3 -3
- package/node_modules/async/findSeries.js +3 -3
- package/node_modules/async/flatMap.js +72 -4
- package/node_modules/async/flatMapLimit.js +3 -3
- package/node_modules/async/flatMapSeries.js +2 -2
- package/node_modules/async/foldl.js +87 -11
- package/node_modules/async/foldr.js +2 -2
- package/node_modules/async/forEach.js +69 -28
- package/node_modules/async/forEachLimit.js +4 -4
- package/node_modules/async/forEachOf.js +85 -16
- package/node_modules/async/forEachOfLimit.js +3 -3
- package/node_modules/async/forEachOfSeries.js +2 -2
- package/node_modules/async/forEachSeries.js +2 -2
- package/node_modules/async/forever.js +4 -4
- package/node_modules/async/groupBy.js +62 -8
- package/node_modules/async/groupByLimit.js +3 -3
- package/node_modules/async/groupBySeries.js +2 -2
- package/node_modules/async/inject.js +87 -11
- package/node_modules/async/internal/applyEach.js +2 -2
- package/node_modules/async/internal/asyncEachOfLimit.js +1 -1
- package/node_modules/async/internal/consoleFunc.js +5 -1
- package/node_modules/async/internal/createTester.js +2 -2
- package/node_modules/async/internal/eachOfLimit.js +6 -6
- package/node_modules/async/internal/filter.js +2 -2
- package/node_modules/async/internal/iterator.js +5 -2
- package/node_modules/async/internal/map.js +1 -1
- package/node_modules/async/internal/parallel.js +3 -3
- package/node_modules/async/internal/queue.js +4 -4
- package/node_modules/async/internal/reject.js +2 -2
- package/node_modules/async/internal/setImmediate.js +6 -2
- package/node_modules/async/internal/wrapAsync.js +1 -1
- package/node_modules/async/log.js +1 -1
- package/node_modules/async/map.js +86 -6
- package/node_modules/async/mapLimit.js +3 -3
- package/node_modules/async/mapSeries.js +3 -3
- package/node_modules/async/mapValues.js +102 -12
- package/node_modules/async/mapValuesLimit.js +4 -4
- package/node_modules/async/mapValuesSeries.js +1 -1
- package/node_modules/async/memoize.js +3 -3
- package/node_modules/async/nextTick.js +3 -3
- package/node_modules/async/package.json +4 -6
- package/node_modules/async/parallel.js +96 -7
- package/node_modules/async/parallelLimit.js +2 -2
- package/node_modules/async/priorityQueue.js +11 -4
- package/node_modules/async/queue.js +4 -4
- package/node_modules/async/race.js +3 -3
- package/node_modules/async/reduce.js +87 -11
- package/node_modules/async/reduceRight.js +2 -2
- package/node_modules/async/reflect.js +2 -2
- package/node_modules/async/reflectAll.js +1 -1
- package/node_modules/async/reject.js +44 -10
- package/node_modules/async/rejectLimit.js +3 -3
- package/node_modules/async/rejectSeries.js +3 -3
- package/node_modules/async/retry.js +2 -2
- package/node_modules/async/retryable.js +4 -4
- package/node_modules/async/select.js +49 -9
- package/node_modules/async/selectLimit.js +3 -3
- package/node_modules/async/selectSeries.js +3 -3
- package/node_modules/async/seq.js +4 -4
- package/node_modules/async/series.js +112 -12
- package/node_modules/async/setImmediate.js +1 -1
- package/node_modules/async/some.js +75 -9
- package/node_modules/async/someLimit.js +3 -3
- package/node_modules/async/someSeries.js +3 -3
- package/node_modules/async/sortBy.js +121 -19
- package/node_modules/async/timeout.js +2 -2
- package/node_modules/async/times.js +1 -1
- package/node_modules/async/timesLimit.js +3 -3
- package/node_modules/async/timesSeries.js +1 -1
- package/node_modules/async/transform.js +111 -19
- package/node_modules/async/tryEach.js +3 -3
- package/node_modules/async/until.js +3 -3
- package/node_modules/async/waterfall.js +4 -4
- package/node_modules/async/whilst.js +3 -3
- package/node_modules/async/wrapSync.js +3 -3
- package/node_modules/color/README.md +9 -0
- package/node_modules/color/index.js +4 -1
- package/node_modules/color/package.json +8 -8
- package/node_modules/color-string/README.md +6 -2
- package/node_modules/color-string/index.js +21 -13
- package/node_modules/color-string/package.json +4 -4
- package/node_modules/colorspace/package.json +5 -5
- package/node_modules/fecha/dist/fecha.min.js +1 -1
- package/node_modules/fecha/dist/fecha.min.js.map +1 -0
- package/node_modules/fecha/lib/fecha.d.ts +2 -2
- package/node_modules/fecha/lib/fecha.js +35 -18
- package/node_modules/fecha/lib/fecha.js.map +1 -0
- package/node_modules/fecha/lib/fecha.umd.js +35 -18
- package/node_modules/fecha/lib/fecha.umd.js.map +1 -0
- package/node_modules/fecha/package.json +9 -10
- package/node_modules/fecha/src/fecha.ts +524 -0
- package/node_modules/logform/.eslintrc +1 -1
- package/node_modules/logform/CHANGELOG.md +24 -0
- package/node_modules/logform/README.md +15 -17
- package/node_modules/logform/browser.js +3 -1
- package/node_modules/logform/cli.js +1 -1
- package/node_modules/logform/colorize.js +2 -2
- package/node_modules/logform/dist/browser.js +8 -2
- package/node_modules/logform/dist/cli.js +2 -2
- package/node_modules/logform/dist/colorize.js +5 -5
- package/node_modules/logform/dist/errors.js +1 -1
- package/node_modules/logform/dist/format.js +9 -5
- package/node_modules/logform/dist/index.js +53 -20
- package/node_modules/logform/dist/json.js +7 -6
- package/node_modules/logform/dist/logstash.js +1 -1
- package/node_modules/logform/dist/pad-levels.js +4 -4
- package/node_modules/logform/dist/printf.js +1 -1
- package/node_modules/logform/dist/simple.js +1 -1
- package/node_modules/logform/dist/splat.js +2 -2
- package/node_modules/logform/dist/uncolorize.js +1 -1
- package/node_modules/logform/errors.js +1 -1
- package/node_modules/logform/index.d.ts +36 -0
- package/node_modules/logform/index.js +19 -20
- package/node_modules/logform/json.js +7 -7
- package/node_modules/logform/logstash.js +1 -1
- package/node_modules/logform/package.json +10 -9
- package/node_modules/logform/simple.js +1 -1
- package/node_modules/logform/uncolorize.js +1 -1
- package/node_modules/moment/CHANGELOG.md +6 -0
- package/node_modules/moment/dist/locale/ar-kw.js +4 -3
- package/node_modules/moment/dist/locale/ar-ly.js +1 -1
- package/node_modules/moment/dist/locale/ar-ma.js +4 -3
- package/node_modules/moment/dist/locale/ar-sa.js +4 -3
- package/node_modules/moment/dist/locale/ar-tn.js +4 -3
- package/node_modules/moment/dist/locale/az.js +4 -3
- package/node_modules/moment/dist/locale/be.js +10 -9
- package/node_modules/moment/dist/locale/bn-bd.js +4 -3
- package/node_modules/moment/dist/locale/bn.js +4 -3
- package/node_modules/moment/dist/locale/bo.js +8 -6
- package/node_modules/moment/dist/locale/br.js +6 -3
- package/node_modules/moment/dist/locale/bs.js +4 -3
- package/node_modules/moment/dist/locale/ca.js +12 -9
- package/node_modules/moment/dist/locale/cs.js +15 -6
- package/node_modules/moment/dist/locale/cv.js +4 -3
- package/node_modules/moment/dist/locale/cy.js +4 -3
- package/node_modules/moment/dist/locale/de-at.js +6 -6
- package/node_modules/moment/dist/locale/de-ch.js +6 -6
- package/node_modules/moment/dist/locale/de.js +6 -6
- package/node_modules/moment/dist/locale/el.js +8 -6
- package/node_modules/moment/dist/locale/es-do.js +10 -6
- package/node_modules/moment/dist/locale/es-mx.js +10 -6
- package/node_modules/moment/dist/locale/es-us.js +10 -6
- package/node_modules/moment/dist/locale/es.js +10 -6
- package/node_modules/moment/dist/locale/et.js +6 -6
- package/node_modules/moment/dist/locale/eu.js +8 -6
- package/node_modules/moment/dist/locale/fa.js +12 -9
- package/node_modules/moment/dist/locale/fi.js +12 -9
- package/node_modules/moment/dist/locale/fo.js +4 -3
- package/node_modules/moment/dist/locale/fr-ca.js +4 -3
- package/node_modules/moment/dist/locale/fr-ch.js +4 -3
- package/node_modules/moment/dist/locale/fr.js +10 -6
- package/node_modules/moment/dist/locale/fy.js +4 -6
- package/node_modules/moment/dist/locale/gl.js +4 -3
- package/node_modules/moment/dist/locale/gom-deva.js +8 -6
- package/node_modules/moment/dist/locale/gom-latn.js +6 -6
- package/node_modules/moment/dist/locale/gu.js +4 -3
- package/node_modules/moment/dist/locale/he.js +4 -4
- package/node_modules/moment/dist/locale/hi.js +14 -10
- package/node_modules/moment/dist/locale/hr.js +7 -5
- package/node_modules/moment/dist/locale/hu.js +6 -6
- package/node_modules/moment/dist/locale/hy-am.js +8 -6
- package/node_modules/moment/dist/locale/is.js +4 -3
- package/node_modules/moment/dist/locale/ka.js +10 -10
- package/node_modules/moment/dist/locale/km.js +4 -3
- package/node_modules/moment/dist/locale/kn.js +4 -3
- package/node_modules/moment/dist/locale/ku.js +6 -6
- package/node_modules/moment/dist/locale/lb.js +8 -6
- package/node_modules/moment/dist/locale/lo.js +4 -3
- package/node_modules/moment/dist/locale/lt.js +8 -6
- package/node_modules/moment/dist/locale/lv.js +4 -3
- package/node_modules/moment/dist/locale/me.js +2 -3
- package/node_modules/moment/dist/locale/mi.js +4 -3
- package/node_modules/moment/dist/locale/ml.js +8 -6
- package/node_modules/moment/dist/locale/mn.js +4 -3
- package/node_modules/moment/dist/locale/mr.js +4 -3
- package/node_modules/moment/dist/locale/mt.js +4 -3
- package/node_modules/moment/dist/locale/nb.js +2 -3
- package/node_modules/moment/dist/locale/ne.js +4 -3
- package/node_modules/moment/dist/locale/nl-be.js +12 -12
- package/node_modules/moment/dist/locale/nl.js +12 -12
- package/node_modules/moment/dist/locale/nn.js +2 -3
- package/node_modules/moment/dist/locale/oc-lnc.js +8 -6
- package/node_modules/moment/dist/locale/pa-in.js +4 -3
- package/node_modules/moment/dist/locale/pl.js +10 -9
- package/node_modules/moment/dist/locale/pt-br.js +4 -3
- package/node_modules/moment/dist/locale/pt.js +4 -3
- package/node_modules/moment/dist/locale/ro.js +4 -3
- package/node_modules/moment/dist/locale/ru.js +20 -13
- package/node_modules/moment/dist/locale/se.js +6 -6
- package/node_modules/moment/dist/locale/si.js +4 -3
- package/node_modules/moment/dist/locale/sk.js +4 -3
- package/node_modules/moment/dist/locale/sl.js +4 -3
- package/node_modules/moment/dist/locale/sr-cyrl.js +32 -22
- package/node_modules/moment/dist/locale/sr.js +32 -22
- package/node_modules/moment/dist/locale/ss.js +4 -3
- package/node_modules/moment/dist/locale/sw.js +4 -3
- package/node_modules/moment/dist/locale/ta.js +8 -6
- package/node_modules/moment/dist/locale/te.js +8 -6
- package/node_modules/moment/dist/locale/tg.js +4 -3
- package/node_modules/moment/dist/locale/th.js +4 -3
- package/node_modules/moment/dist/locale/tlh.js +8 -9
- package/node_modules/moment/dist/locale/tr.js +1 -1
- package/node_modules/moment/dist/locale/tzm-latn.js +4 -3
- package/node_modules/moment/dist/locale/tzm.js +4 -3
- package/node_modules/moment/dist/locale/ug-cn.js +4 -3
- package/node_modules/moment/dist/locale/uk.js +16 -12
- package/node_modules/moment/dist/locale/uz-latn.js +4 -3
- package/node_modules/moment/dist/locale/vi.js +4 -3
- package/node_modules/moment/dist/locale/x-pseudo.js +8 -6
- package/node_modules/moment/dist/moment.js +95 -80
- package/node_modules/moment/locale/ar-kw.js +4 -3
- package/node_modules/moment/locale/ar-ly.js +1 -1
- package/node_modules/moment/locale/ar-ma.js +4 -3
- package/node_modules/moment/locale/ar-sa.js +4 -3
- package/node_modules/moment/locale/ar-tn.js +4 -3
- package/node_modules/moment/locale/az.js +4 -3
- package/node_modules/moment/locale/be.js +10 -9
- package/node_modules/moment/locale/bn-bd.js +4 -3
- package/node_modules/moment/locale/bn.js +4 -3
- package/node_modules/moment/locale/bo.js +8 -6
- package/node_modules/moment/locale/br.js +6 -3
- package/node_modules/moment/locale/bs.js +4 -3
- package/node_modules/moment/locale/ca.js +12 -9
- package/node_modules/moment/locale/cs.js +15 -6
- package/node_modules/moment/locale/cv.js +4 -3
- package/node_modules/moment/locale/cy.js +4 -3
- package/node_modules/moment/locale/de-at.js +6 -6
- package/node_modules/moment/locale/de-ch.js +6 -6
- package/node_modules/moment/locale/de.js +6 -6
- package/node_modules/moment/locale/el.js +8 -6
- package/node_modules/moment/locale/es-do.js +10 -6
- package/node_modules/moment/locale/es-mx.js +10 -6
- package/node_modules/moment/locale/es-us.js +10 -6
- package/node_modules/moment/locale/es.js +10 -6
- package/node_modules/moment/locale/et.js +6 -6
- package/node_modules/moment/locale/eu.js +8 -6
- package/node_modules/moment/locale/fa.js +12 -9
- package/node_modules/moment/locale/fi.js +12 -9
- package/node_modules/moment/locale/fo.js +4 -3
- package/node_modules/moment/locale/fr-ca.js +4 -3
- package/node_modules/moment/locale/fr-ch.js +4 -3
- package/node_modules/moment/locale/fr.js +10 -6
- package/node_modules/moment/locale/fy.js +4 -6
- package/node_modules/moment/locale/gl.js +4 -3
- package/node_modules/moment/locale/gom-deva.js +8 -6
- package/node_modules/moment/locale/gom-latn.js +6 -6
- package/node_modules/moment/locale/gu.js +4 -3
- package/node_modules/moment/locale/he.js +4 -4
- package/node_modules/moment/locale/hi.js +14 -10
- package/node_modules/moment/locale/hr.js +7 -5
- package/node_modules/moment/locale/hu.js +6 -6
- package/node_modules/moment/locale/hy-am.js +8 -6
- package/node_modules/moment/locale/is.js +4 -3
- package/node_modules/moment/locale/ka.js +10 -10
- package/node_modules/moment/locale/km.js +4 -3
- package/node_modules/moment/locale/kn.js +4 -3
- package/node_modules/moment/locale/ku.js +6 -6
- package/node_modules/moment/locale/lb.js +8 -6
- package/node_modules/moment/locale/lo.js +4 -3
- package/node_modules/moment/locale/lt.js +8 -6
- package/node_modules/moment/locale/lv.js +4 -3
- package/node_modules/moment/locale/me.js +2 -3
- package/node_modules/moment/locale/mi.js +4 -3
- package/node_modules/moment/locale/ml.js +8 -6
- package/node_modules/moment/locale/mn.js +4 -3
- package/node_modules/moment/locale/mr.js +4 -3
- package/node_modules/moment/locale/mt.js +4 -3
- package/node_modules/moment/locale/nb.js +2 -3
- package/node_modules/moment/locale/ne.js +4 -3
- package/node_modules/moment/locale/nl-be.js +12 -12
- package/node_modules/moment/locale/nl.js +12 -12
- package/node_modules/moment/locale/nn.js +2 -3
- package/node_modules/moment/locale/oc-lnc.js +8 -6
- package/node_modules/moment/locale/pa-in.js +4 -3
- package/node_modules/moment/locale/pl.js +10 -9
- package/node_modules/moment/locale/pt-br.js +4 -3
- package/node_modules/moment/locale/pt.js +4 -3
- package/node_modules/moment/locale/ro.js +4 -3
- package/node_modules/moment/locale/ru.js +20 -13
- package/node_modules/moment/locale/se.js +6 -6
- package/node_modules/moment/locale/si.js +4 -3
- package/node_modules/moment/locale/sk.js +4 -3
- package/node_modules/moment/locale/sl.js +4 -3
- package/node_modules/moment/locale/sr-cyrl.js +32 -22
- package/node_modules/moment/locale/sr.js +32 -22
- package/node_modules/moment/locale/ss.js +4 -3
- package/node_modules/moment/locale/sw.js +4 -3
- package/node_modules/moment/locale/ta.js +8 -6
- package/node_modules/moment/locale/te.js +8 -6
- package/node_modules/moment/locale/tg.js +4 -3
- package/node_modules/moment/locale/th.js +4 -3
- package/node_modules/moment/locale/tlh.js +8 -9
- package/node_modules/moment/locale/tr.js +1 -1
- package/node_modules/moment/locale/tzm-latn.js +4 -3
- package/node_modules/moment/locale/tzm.js +4 -3
- package/node_modules/moment/locale/ug-cn.js +4 -3
- package/node_modules/moment/locale/uk.js +16 -12
- package/node_modules/moment/locale/uz-latn.js +4 -3
- package/node_modules/moment/locale/vi.js +4 -3
- package/node_modules/moment/locale/x-pseudo.js +8 -6
- package/node_modules/moment/min/locales.js +613 -474
- package/node_modules/moment/min/locales.min.js +1 -1
- package/node_modules/moment/min/locales.min.js.map +1 -1
- package/node_modules/moment/min/moment-with-locales.js +707 -553
- package/node_modules/moment/min/moment-with-locales.min.js +1 -1
- package/node_modules/moment/min/moment-with-locales.min.js.map +1 -1
- package/node_modules/moment/min/moment.min.js +1 -1
- package/node_modules/moment/min/moment.min.js.map +1 -1
- package/node_modules/moment/moment.js +95 -80
- package/node_modules/moment/package.json +4 -4
- package/node_modules/moment/src/lib/create/from-string-and-array.js +4 -3
- package/node_modules/moment/src/lib/create/from-string-and-format.js +4 -3
- package/node_modules/moment/src/lib/create/from-string.js +11 -7
- package/node_modules/moment/src/lib/duration/create.js +2 -1
- package/node_modules/moment/src/lib/duration/valid.js +3 -2
- package/node_modules/moment/src/lib/format/format.js +2 -1
- package/node_modules/moment/src/lib/locale/locales.js +7 -1
- package/node_modules/moment/src/lib/moment/constructor.js +6 -3
- package/node_modules/moment/src/lib/moment/get-set.js +3 -2
- package/node_modules/moment/src/lib/parse/regex.js +8 -10
- package/node_modules/moment/src/lib/parse/token.js +4 -2
- package/node_modules/moment/src/lib/units/day-of-week.js +2 -3
- package/node_modules/moment/src/lib/units/era.js +10 -12
- package/node_modules/moment/src/lib/units/month.js +6 -6
- package/node_modules/moment/src/lib/units/week-year.js +6 -8
- package/node_modules/moment/src/lib/units/week.js +6 -8
- package/node_modules/moment/src/lib/utils/deprecate.js +3 -2
- package/node_modules/moment/src/lib/utils/is-moment-input.js +3 -2
- package/node_modules/moment/src/lib/utils/map.js +3 -2
- package/node_modules/moment/src/locale/ar-kw.js +4 -3
- package/node_modules/moment/src/locale/ar-ly.js +1 -1
- package/node_modules/moment/src/locale/ar-ma.js +4 -3
- package/node_modules/moment/src/locale/ar-sa.js +4 -3
- package/node_modules/moment/src/locale/ar-tn.js +4 -3
- package/node_modules/moment/src/locale/az.js +4 -3
- package/node_modules/moment/src/locale/be.js +10 -9
- package/node_modules/moment/src/locale/bn-bd.js +4 -3
- package/node_modules/moment/src/locale/bn.js +4 -3
- package/node_modules/moment/src/locale/bo.js +8 -6
- package/node_modules/moment/src/locale/br.js +6 -3
- package/node_modules/moment/src/locale/bs.js +4 -3
- package/node_modules/moment/src/locale/ca.js +12 -9
- package/node_modules/moment/src/locale/cs.js +15 -6
- package/node_modules/moment/src/locale/cv.js +4 -3
- package/node_modules/moment/src/locale/cy.js +4 -3
- package/node_modules/moment/src/locale/de-at.js +6 -6
- package/node_modules/moment/src/locale/de-ch.js +6 -6
- package/node_modules/moment/src/locale/de.js +6 -6
- package/node_modules/moment/src/locale/el.js +8 -6
- package/node_modules/moment/src/locale/es-do.js +10 -6
- package/node_modules/moment/src/locale/es-mx.js +10 -6
- package/node_modules/moment/src/locale/es-us.js +10 -6
- package/node_modules/moment/src/locale/es.js +10 -6
- package/node_modules/moment/src/locale/et.js +6 -6
- package/node_modules/moment/src/locale/eu.js +8 -6
- package/node_modules/moment/src/locale/fa.js +12 -9
- package/node_modules/moment/src/locale/fi.js +12 -9
- package/node_modules/moment/src/locale/fo.js +4 -3
- package/node_modules/moment/src/locale/fr-ca.js +4 -3
- package/node_modules/moment/src/locale/fr-ch.js +4 -3
- package/node_modules/moment/src/locale/fr.js +10 -6
- package/node_modules/moment/src/locale/fy.js +4 -6
- package/node_modules/moment/src/locale/gl.js +4 -3
- package/node_modules/moment/src/locale/gom-deva.js +8 -6
- package/node_modules/moment/src/locale/gom-latn.js +6 -6
- package/node_modules/moment/src/locale/gu.js +4 -3
- package/node_modules/moment/src/locale/he.js +4 -4
- package/node_modules/moment/src/locale/hi.js +14 -10
- package/node_modules/moment/src/locale/hr.js +7 -5
- package/node_modules/moment/src/locale/hu.js +6 -6
- package/node_modules/moment/src/locale/hy-am.js +8 -6
- package/node_modules/moment/src/locale/is.js +4 -3
- package/node_modules/moment/src/locale/ka.js +10 -10
- package/node_modules/moment/src/locale/km.js +4 -3
- package/node_modules/moment/src/locale/kn.js +4 -3
- package/node_modules/moment/src/locale/ku.js +6 -6
- package/node_modules/moment/src/locale/lb.js +8 -6
- package/node_modules/moment/src/locale/lo.js +4 -3
- package/node_modules/moment/src/locale/lt.js +8 -6
- package/node_modules/moment/src/locale/lv.js +4 -3
- package/node_modules/moment/src/locale/me.js +2 -3
- package/node_modules/moment/src/locale/mi.js +4 -3
- package/node_modules/moment/src/locale/ml.js +8 -6
- package/node_modules/moment/src/locale/mn.js +4 -3
- package/node_modules/moment/src/locale/mr.js +4 -3
- package/node_modules/moment/src/locale/mt.js +4 -3
- package/node_modules/moment/src/locale/nb.js +2 -3
- package/node_modules/moment/src/locale/ne.js +4 -3
- package/node_modules/moment/src/locale/nl-be.js +12 -12
- package/node_modules/moment/src/locale/nl.js +12 -12
- package/node_modules/moment/src/locale/nn.js +2 -3
- package/node_modules/moment/src/locale/oc-lnc.js +8 -6
- package/node_modules/moment/src/locale/pa-in.js +4 -3
- package/node_modules/moment/src/locale/pl.js +10 -9
- package/node_modules/moment/src/locale/pt-br.js +4 -3
- package/node_modules/moment/src/locale/pt.js +4 -3
- package/node_modules/moment/src/locale/ro.js +4 -3
- package/node_modules/moment/src/locale/ru.js +20 -13
- package/node_modules/moment/src/locale/se.js +6 -6
- package/node_modules/moment/src/locale/si.js +4 -3
- package/node_modules/moment/src/locale/sk.js +4 -3
- package/node_modules/moment/src/locale/sl.js +4 -3
- package/node_modules/moment/src/locale/sr-cyrl.js +32 -22
- package/node_modules/moment/src/locale/sr.js +32 -22
- package/node_modules/moment/src/locale/ss.js +4 -3
- package/node_modules/moment/src/locale/sw.js +4 -3
- package/node_modules/moment/src/locale/ta.js +8 -6
- package/node_modules/moment/src/locale/te.js +8 -6
- package/node_modules/moment/src/locale/tg.js +4 -3
- package/node_modules/moment/src/locale/th.js +4 -3
- package/node_modules/moment/src/locale/tlh.js +8 -9
- package/node_modules/moment/src/locale/tr.js +1 -1
- package/node_modules/moment/src/locale/tzm-latn.js +4 -3
- package/node_modules/moment/src/locale/tzm.js +4 -3
- package/node_modules/moment/src/locale/ug-cn.js +4 -3
- package/node_modules/moment/src/locale/uk.js +16 -12
- package/node_modules/moment/src/locale/uz-latn.js +4 -3
- package/node_modules/moment/src/locale/vi.js +4 -3
- package/node_modules/moment/src/locale/x-pseudo.js +8 -6
- package/node_modules/moment/src/moment.js +2 -2
- package/node_modules/moment/ts3.1-typings/moment.d.ts +1 -1
- package/node_modules/safe-stable-stringify/CHANGELOG.md +75 -0
- package/node_modules/safe-stable-stringify/LICENSE +21 -0
- package/node_modules/safe-stable-stringify/esm/package.json +4 -0
- package/node_modules/safe-stable-stringify/esm/wrapper.js +6 -0
- package/node_modules/safe-stable-stringify/index.d.ts +18 -0
- package/node_modules/safe-stable-stringify/index.js +618 -0
- package/node_modules/safe-stable-stringify/package.json +69 -0
- package/node_modules/safe-stable-stringify/readme.md +170 -0
- package/node_modules/safe-stable-stringify/tsconfig.json +22 -0
- package/node_modules/winston/LICENSE +18 -18
- package/node_modules/winston/README.md +1231 -1230
- package/node_modules/winston/dist/winston/common.js +10 -10
- package/node_modules/winston/dist/winston/config/index.js +17 -17
- package/node_modules/winston/dist/winston/container.js +46 -46
- package/node_modules/winston/dist/winston/create-logger.js +28 -24
- package/node_modules/winston/dist/winston/exception-handler.js +49 -49
- package/node_modules/winston/dist/winston/exception-stream.js +27 -27
- package/node_modules/winston/dist/winston/logger.js +152 -138
- package/node_modules/winston/dist/winston/profiler.js +22 -22
- package/node_modules/winston/dist/winston/rejection-handler.js +54 -54
- package/node_modules/winston/dist/winston/tail-file.js +14 -14
- package/node_modules/winston/dist/winston/transports/console.js +31 -31
- package/node_modules/winston/dist/winston/transports/file.js +101 -101
- package/node_modules/winston/dist/winston/transports/http.js +119 -41
- package/node_modules/winston/dist/winston/transports/index.js +17 -17
- package/node_modules/winston/dist/winston/transports/stream.js +24 -24
- package/node_modules/winston/dist/winston.js +91 -97
- package/node_modules/winston/index.d.ts +213 -193
- package/node_modules/winston/lib/winston/common.js +61 -61
- package/node_modules/winston/lib/winston/config/index.d.ts +99 -98
- package/node_modules/winston/lib/winston/config/index.js +35 -35
- package/node_modules/winston/lib/winston/container.js +114 -114
- package/node_modules/winston/lib/winston/create-logger.js +104 -104
- package/node_modules/winston/lib/winston/exception-handler.js +245 -245
- package/node_modules/winston/lib/winston/exception-stream.js +54 -54
- package/node_modules/winston/lib/winston/logger.js +676 -667
- package/node_modules/winston/lib/winston/profiler.js +51 -51
- package/node_modules/winston/lib/winston/rejection-handler.js +251 -251
- package/node_modules/winston/lib/winston/tail-file.js +124 -124
- package/node_modules/winston/lib/winston/transports/console.js +117 -117
- package/node_modules/winston/lib/winston/transports/file.js +695 -695
- package/node_modules/winston/lib/winston/transports/http.js +267 -202
- package/node_modules/winston/lib/winston/transports/index.d.ts +103 -100
- package/node_modules/winston/lib/winston/transports/index.js +56 -56
- package/node_modules/winston/lib/winston/transports/stream.js +63 -63
- package/node_modules/winston/lib/winston.js +176 -182
- package/node_modules/winston/node_modules/winston-transport/.babelrc +3 -0
- package/node_modules/winston/node_modules/winston-transport/.eslintrc +7 -0
- package/node_modules/winston/node_modules/winston-transport/.gitattributes +1 -0
- package/node_modules/winston/node_modules/winston-transport/.nyc_output/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
- package/node_modules/winston/node_modules/winston-transport/.nyc_output/processinfo/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
- package/node_modules/winston/node_modules/winston-transport/.nyc_output/processinfo/index.json +1 -0
- package/node_modules/winston/node_modules/winston-transport/CHANGELOG.md +126 -0
- package/node_modules/winston/node_modules/winston-transport/LICENSE +22 -0
- package/node_modules/winston/node_modules/winston-transport/README.md +50 -0
- package/node_modules/winston/node_modules/winston-transport/dist/index.js +215 -0
- package/node_modules/winston/node_modules/winston-transport/dist/legacy.js +116 -0
- package/node_modules/winston/node_modules/winston-transport/index.d.ts +39 -0
- package/node_modules/winston/node_modules/winston-transport/index.js +215 -0
- package/node_modules/winston/node_modules/winston-transport/legacy.js +119 -0
- package/node_modules/winston/node_modules/winston-transport/package.json +56 -0
- package/node_modules/winston/package.json +76 -75
- package/package.json +6 -4
- package/node_modules/@dabh/diagnostics/example.png +0 -0
- package/node_modules/color-string/CHANGELOG.md +0 -18
- package/node_modules/colorspace/test.js +0 -14
- package/node_modules/fecha/CHANGELOG.md +0 -67
- package/node_modules/logform/.travis.yml +0 -17
- package/node_modules/winston/CHANGELOG.md +0 -560
|
@@ -0,0 +1,618 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const stringify = configure()
|
|
4
|
+
|
|
5
|
+
// @ts-expect-error
|
|
6
|
+
stringify.configure = configure
|
|
7
|
+
// @ts-expect-error
|
|
8
|
+
stringify.stringify = stringify
|
|
9
|
+
|
|
10
|
+
// @ts-expect-error
|
|
11
|
+
stringify.default = stringify
|
|
12
|
+
|
|
13
|
+
// @ts-expect-error used for named export
|
|
14
|
+
exports.stringify = stringify
|
|
15
|
+
// @ts-expect-error used for named export
|
|
16
|
+
exports.configure = configure
|
|
17
|
+
|
|
18
|
+
module.exports = stringify
|
|
19
|
+
|
|
20
|
+
// eslint-disable-next-line
|
|
21
|
+
const strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/
|
|
22
|
+
// eslint-disable-next-line
|
|
23
|
+
const strEscapeSequencesReplacer = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/g
|
|
24
|
+
|
|
25
|
+
// Escaped special characters. Use empty strings to fill up unused entries.
|
|
26
|
+
const meta = [
|
|
27
|
+
'\\u0000', '\\u0001', '\\u0002', '\\u0003', '\\u0004',
|
|
28
|
+
'\\u0005', '\\u0006', '\\u0007', '\\b', '\\t',
|
|
29
|
+
'\\n', '\\u000b', '\\f', '\\r', '\\u000e',
|
|
30
|
+
'\\u000f', '\\u0010', '\\u0011', '\\u0012', '\\u0013',
|
|
31
|
+
'\\u0014', '\\u0015', '\\u0016', '\\u0017', '\\u0018',
|
|
32
|
+
'\\u0019', '\\u001a', '\\u001b', '\\u001c', '\\u001d',
|
|
33
|
+
'\\u001e', '\\u001f', '', '', '\\"',
|
|
34
|
+
'', '', '', '', '', '', '', '', '', '',
|
|
35
|
+
'', '', '', '', '', '', '', '', '', '',
|
|
36
|
+
'', '', '', '', '', '', '', '', '', '',
|
|
37
|
+
'', '', '', '', '', '', '', '', '', '',
|
|
38
|
+
'', '', '', '', '', '', '', '', '', '',
|
|
39
|
+
'', '', '', '', '', '', '', '\\\\'
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
function escapeFn (str) {
|
|
43
|
+
if (str.length === 2) {
|
|
44
|
+
const charCode = str.charCodeAt(1)
|
|
45
|
+
return `${str[0]}\\u${charCode.toString(16)}`
|
|
46
|
+
}
|
|
47
|
+
const charCode = str.charCodeAt(0)
|
|
48
|
+
return meta.length > charCode
|
|
49
|
+
? meta[charCode]
|
|
50
|
+
: `\\u${charCode.toString(16)}`
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Escape C0 control characters, double quotes, the backslash and every code
|
|
54
|
+
// unit with a numeric value in the inclusive range 0xD800 to 0xDFFF.
|
|
55
|
+
function strEscape (str) {
|
|
56
|
+
// Some magic numbers that worked out fine while benchmarking with v8 8.0
|
|
57
|
+
if (str.length < 5000 && !strEscapeSequencesRegExp.test(str)) {
|
|
58
|
+
return str
|
|
59
|
+
}
|
|
60
|
+
if (str.length > 100) {
|
|
61
|
+
return str.replace(strEscapeSequencesReplacer, escapeFn)
|
|
62
|
+
}
|
|
63
|
+
let result = ''
|
|
64
|
+
let last = 0
|
|
65
|
+
for (let i = 0; i < str.length; i++) {
|
|
66
|
+
const point = str.charCodeAt(i)
|
|
67
|
+
if (point === 34 || point === 92 || point < 32) {
|
|
68
|
+
result += `${str.slice(last, i)}${meta[point]}`
|
|
69
|
+
last = i + 1
|
|
70
|
+
} else if (point >= 0xd800 && point <= 0xdfff) {
|
|
71
|
+
if (point <= 0xdbff && i + 1 < str.length) {
|
|
72
|
+
const point = str.charCodeAt(i + 1)
|
|
73
|
+
if (point >= 0xdc00 && point <= 0xdfff) {
|
|
74
|
+
i++
|
|
75
|
+
continue
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
result += `${str.slice(last, i)}${`\\u${point.toString(16)}`}`
|
|
79
|
+
last = i + 1
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
result += str.slice(last)
|
|
83
|
+
return result
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function insertSort (array) {
|
|
87
|
+
// Insertion sort is very efficient for small input sizes but it has a bad
|
|
88
|
+
// worst case complexity. Thus, use native array sort for bigger values.
|
|
89
|
+
if (array.length > 2e2) {
|
|
90
|
+
return array.sort()
|
|
91
|
+
}
|
|
92
|
+
for (let i = 1; i < array.length; i++) {
|
|
93
|
+
const currentValue = array[i]
|
|
94
|
+
let position = i
|
|
95
|
+
while (position !== 0 && array[position - 1] > currentValue) {
|
|
96
|
+
array[position] = array[position - 1]
|
|
97
|
+
position--
|
|
98
|
+
}
|
|
99
|
+
array[position] = currentValue
|
|
100
|
+
}
|
|
101
|
+
return array
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const typedArrayPrototypeGetSymbolToStringTag =
|
|
105
|
+
Object.getOwnPropertyDescriptor(
|
|
106
|
+
Object.getPrototypeOf(
|
|
107
|
+
Object.getPrototypeOf(
|
|
108
|
+
new Uint8Array()
|
|
109
|
+
)
|
|
110
|
+
),
|
|
111
|
+
Symbol.toStringTag
|
|
112
|
+
).get
|
|
113
|
+
|
|
114
|
+
function isTypedArrayWithEntries (value) {
|
|
115
|
+
return typedArrayPrototypeGetSymbolToStringTag.call(value) !== undefined && value.length !== 0
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function stringifyTypedArray (array, separator, maximumBreadth) {
|
|
119
|
+
if (array.length < maximumBreadth) {
|
|
120
|
+
maximumBreadth = array.length
|
|
121
|
+
}
|
|
122
|
+
const whitespace = separator === ',' ? '' : ' '
|
|
123
|
+
let res = `"0":${whitespace}${array[0]}`
|
|
124
|
+
for (let i = 1; i < maximumBreadth; i++) {
|
|
125
|
+
res += `${separator}"${i}":${whitespace}${array[i]}`
|
|
126
|
+
}
|
|
127
|
+
return res
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function getCircularValueOption (options) {
|
|
131
|
+
if (options && Object.prototype.hasOwnProperty.call(options, 'circularValue')) {
|
|
132
|
+
var circularValue = options.circularValue
|
|
133
|
+
if (typeof circularValue === 'string') {
|
|
134
|
+
return `"${circularValue}"`
|
|
135
|
+
}
|
|
136
|
+
if (circularValue == null) {
|
|
137
|
+
return circularValue
|
|
138
|
+
}
|
|
139
|
+
if (circularValue === Error || circularValue === TypeError) {
|
|
140
|
+
return {
|
|
141
|
+
toString () {
|
|
142
|
+
throw new TypeError('Converting circular structure to JSON')
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')
|
|
147
|
+
}
|
|
148
|
+
return '"[Circular]"'
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function getBooleanOption (options, key) {
|
|
152
|
+
if (options && Object.prototype.hasOwnProperty.call(options, key)) {
|
|
153
|
+
var value = options[key]
|
|
154
|
+
if (typeof value !== 'boolean') {
|
|
155
|
+
throw new TypeError(`The "${key}" argument must be of type boolean`)
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return value === undefined ? true : value
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function getPositiveIntegerOption (options, key) {
|
|
162
|
+
if (options && Object.prototype.hasOwnProperty.call(options, key)) {
|
|
163
|
+
var value = options[key]
|
|
164
|
+
if (typeof value !== 'number') {
|
|
165
|
+
throw new TypeError(`The "${key}" argument must be of type number`)
|
|
166
|
+
}
|
|
167
|
+
if (!Number.isInteger(value)) {
|
|
168
|
+
throw new TypeError(`The "${key}" argument must be an integer`)
|
|
169
|
+
}
|
|
170
|
+
if (value < 1) {
|
|
171
|
+
throw new RangeError(`The "${key}" argument must be >= 1`)
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return value === undefined ? Infinity : value
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function getItemCount (number) {
|
|
178
|
+
if (number === 1) {
|
|
179
|
+
return '1 item'
|
|
180
|
+
}
|
|
181
|
+
return `${number} items`
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function getUniqueReplacerSet (replacerArray) {
|
|
185
|
+
const replacerSet = new Set()
|
|
186
|
+
for (const value of replacerArray) {
|
|
187
|
+
if (typeof value === 'string') {
|
|
188
|
+
replacerSet.add(value)
|
|
189
|
+
} else if (typeof value === 'number') {
|
|
190
|
+
replacerSet.add(String(value))
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return replacerSet
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function configure (options) {
|
|
197
|
+
const circularValue = getCircularValueOption(options)
|
|
198
|
+
const bigint = getBooleanOption(options, 'bigint')
|
|
199
|
+
const deterministic = getBooleanOption(options, 'deterministic')
|
|
200
|
+
const maximumDepth = getPositiveIntegerOption(options, 'maximumDepth')
|
|
201
|
+
const maximumBreadth = getPositiveIntegerOption(options, 'maximumBreadth')
|
|
202
|
+
|
|
203
|
+
function stringifyFnReplacer (key, parent, stack, replacer, spacer, indentation) {
|
|
204
|
+
let value = parent[key]
|
|
205
|
+
|
|
206
|
+
if (typeof value === 'object' && value !== null && typeof value.toJSON === 'function') {
|
|
207
|
+
value = value.toJSON(key)
|
|
208
|
+
}
|
|
209
|
+
value = replacer.call(parent, key, value)
|
|
210
|
+
|
|
211
|
+
switch (typeof value) {
|
|
212
|
+
case 'string':
|
|
213
|
+
return `"${strEscape(value)}"`
|
|
214
|
+
case 'object': {
|
|
215
|
+
if (value === null) {
|
|
216
|
+
return 'null'
|
|
217
|
+
}
|
|
218
|
+
if (stack.indexOf(value) !== -1) {
|
|
219
|
+
return circularValue
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
let res = ''
|
|
223
|
+
let join = ','
|
|
224
|
+
const originalIndentation = indentation
|
|
225
|
+
|
|
226
|
+
if (Array.isArray(value)) {
|
|
227
|
+
if (value.length === 0) {
|
|
228
|
+
return '[]'
|
|
229
|
+
}
|
|
230
|
+
if (maximumDepth < stack.length + 1) {
|
|
231
|
+
return '"[Array]"'
|
|
232
|
+
}
|
|
233
|
+
stack.push(value)
|
|
234
|
+
if (spacer !== '') {
|
|
235
|
+
indentation += spacer
|
|
236
|
+
res += `\n${indentation}`
|
|
237
|
+
join = `,\n${indentation}`
|
|
238
|
+
}
|
|
239
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth)
|
|
240
|
+
let i = 0
|
|
241
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
242
|
+
const tmp = stringifyFnReplacer(i, value, stack, replacer, spacer, indentation)
|
|
243
|
+
res += tmp !== undefined ? tmp : 'null'
|
|
244
|
+
res += join
|
|
245
|
+
}
|
|
246
|
+
const tmp = stringifyFnReplacer(i, value, stack, replacer, spacer, indentation)
|
|
247
|
+
res += tmp !== undefined ? tmp : 'null'
|
|
248
|
+
if (value.length - 1 > maximumBreadth) {
|
|
249
|
+
const removedKeys = value.length - maximumBreadth - 1
|
|
250
|
+
res += `${join}"... ${getItemCount(removedKeys)} not stringified"`
|
|
251
|
+
}
|
|
252
|
+
if (spacer !== '') {
|
|
253
|
+
res += `\n${originalIndentation}`
|
|
254
|
+
}
|
|
255
|
+
stack.pop()
|
|
256
|
+
return `[${res}]`
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
let keys = Object.keys(value)
|
|
260
|
+
const keyLength = keys.length
|
|
261
|
+
if (keyLength === 0) {
|
|
262
|
+
return '{}'
|
|
263
|
+
}
|
|
264
|
+
if (maximumDepth < stack.length + 1) {
|
|
265
|
+
return '"[Object]"'
|
|
266
|
+
}
|
|
267
|
+
let whitespace = ''
|
|
268
|
+
let separator = ''
|
|
269
|
+
if (spacer !== '') {
|
|
270
|
+
indentation += spacer
|
|
271
|
+
join = `,\n${indentation}`
|
|
272
|
+
whitespace = ' '
|
|
273
|
+
}
|
|
274
|
+
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth)
|
|
275
|
+
if (isTypedArrayWithEntries(value)) {
|
|
276
|
+
res += stringifyTypedArray(value, join, maximumBreadth)
|
|
277
|
+
keys = keys.slice(value.length)
|
|
278
|
+
maximumPropertiesToStringify -= value.length
|
|
279
|
+
separator = join
|
|
280
|
+
}
|
|
281
|
+
if (deterministic) {
|
|
282
|
+
keys = insertSort(keys)
|
|
283
|
+
}
|
|
284
|
+
stack.push(value)
|
|
285
|
+
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
|
286
|
+
const key = keys[i]
|
|
287
|
+
const tmp = stringifyFnReplacer(key, value, stack, replacer, spacer, indentation)
|
|
288
|
+
if (tmp !== undefined) {
|
|
289
|
+
res += `${separator}"${strEscape(key)}":${whitespace}${tmp}`
|
|
290
|
+
separator = join
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (keyLength > maximumBreadth) {
|
|
294
|
+
const removedKeys = keyLength - maximumBreadth
|
|
295
|
+
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`
|
|
296
|
+
separator = join
|
|
297
|
+
}
|
|
298
|
+
if (spacer !== '' && separator.length > 1) {
|
|
299
|
+
res = `\n${indentation}${res}\n${originalIndentation}`
|
|
300
|
+
}
|
|
301
|
+
stack.pop()
|
|
302
|
+
return `{${res}}`
|
|
303
|
+
}
|
|
304
|
+
case 'number':
|
|
305
|
+
return isFinite(value) ? String(value) : 'null'
|
|
306
|
+
case 'boolean':
|
|
307
|
+
return value === true ? 'true' : 'false'
|
|
308
|
+
case 'bigint':
|
|
309
|
+
return bigint ? String(value) : undefined
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
function stringifyArrayReplacer (key, value, stack, replacer, spacer, indentation) {
|
|
314
|
+
if (typeof value === 'object' && value !== null && typeof value.toJSON === 'function') {
|
|
315
|
+
value = value.toJSON(key)
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
switch (typeof value) {
|
|
319
|
+
case 'string':
|
|
320
|
+
return `"${strEscape(value)}"`
|
|
321
|
+
case 'object': {
|
|
322
|
+
if (value === null) {
|
|
323
|
+
return 'null'
|
|
324
|
+
}
|
|
325
|
+
if (stack.indexOf(value) !== -1) {
|
|
326
|
+
return circularValue
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const originalIndentation = indentation
|
|
330
|
+
let res = ''
|
|
331
|
+
let join = ','
|
|
332
|
+
|
|
333
|
+
if (Array.isArray(value)) {
|
|
334
|
+
if (value.length === 0) {
|
|
335
|
+
return '[]'
|
|
336
|
+
}
|
|
337
|
+
if (maximumDepth < stack.length + 1) {
|
|
338
|
+
return '"[Array]"'
|
|
339
|
+
}
|
|
340
|
+
stack.push(value)
|
|
341
|
+
if (spacer !== '') {
|
|
342
|
+
indentation += spacer
|
|
343
|
+
res += `\n${indentation}`
|
|
344
|
+
join = `,\n${indentation}`
|
|
345
|
+
}
|
|
346
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth)
|
|
347
|
+
let i = 0
|
|
348
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
349
|
+
const tmp = stringifyArrayReplacer(i, value[i], stack, replacer, spacer, indentation)
|
|
350
|
+
res += tmp !== undefined ? tmp : 'null'
|
|
351
|
+
res += join
|
|
352
|
+
}
|
|
353
|
+
const tmp = stringifyArrayReplacer(i, value[i], stack, replacer, spacer, indentation)
|
|
354
|
+
res += tmp !== undefined ? tmp : 'null'
|
|
355
|
+
if (value.length - 1 > maximumBreadth) {
|
|
356
|
+
const removedKeys = value.length - maximumBreadth - 1
|
|
357
|
+
res += `${join}"... ${getItemCount(removedKeys)} not stringified"`
|
|
358
|
+
}
|
|
359
|
+
if (spacer !== '') {
|
|
360
|
+
res += `\n${originalIndentation}`
|
|
361
|
+
}
|
|
362
|
+
stack.pop()
|
|
363
|
+
return `[${res}]`
|
|
364
|
+
}
|
|
365
|
+
if (replacer.size === 0) {
|
|
366
|
+
return '{}'
|
|
367
|
+
}
|
|
368
|
+
stack.push(value)
|
|
369
|
+
let whitespace = ''
|
|
370
|
+
if (spacer !== '') {
|
|
371
|
+
indentation += spacer
|
|
372
|
+
join = `,\n${indentation}`
|
|
373
|
+
whitespace = ' '
|
|
374
|
+
}
|
|
375
|
+
let separator = ''
|
|
376
|
+
for (const key of replacer) {
|
|
377
|
+
const tmp = stringifyArrayReplacer(key, value[key], stack, replacer, spacer, indentation)
|
|
378
|
+
if (tmp !== undefined) {
|
|
379
|
+
res += `${separator}"${strEscape(key)}":${whitespace}${tmp}`
|
|
380
|
+
separator = join
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
if (spacer !== '' && separator.length > 1) {
|
|
384
|
+
res = `\n${indentation}${res}\n${originalIndentation}`
|
|
385
|
+
}
|
|
386
|
+
stack.pop()
|
|
387
|
+
return `{${res}}`
|
|
388
|
+
}
|
|
389
|
+
case 'number':
|
|
390
|
+
return isFinite(value) ? String(value) : 'null'
|
|
391
|
+
case 'boolean':
|
|
392
|
+
return value === true ? 'true' : 'false'
|
|
393
|
+
case 'bigint':
|
|
394
|
+
return bigint ? String(value) : undefined
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
function stringifyIndent (key, value, stack, spacer, indentation) {
|
|
399
|
+
switch (typeof value) {
|
|
400
|
+
case 'string':
|
|
401
|
+
return `"${strEscape(value)}"`
|
|
402
|
+
case 'object': {
|
|
403
|
+
if (value === null) {
|
|
404
|
+
return 'null'
|
|
405
|
+
}
|
|
406
|
+
if (typeof value.toJSON === 'function') {
|
|
407
|
+
value = value.toJSON(key)
|
|
408
|
+
// Prevent calling `toJSON` again.
|
|
409
|
+
if (typeof value !== 'object') {
|
|
410
|
+
return stringifyIndent(key, value, stack, spacer, indentation)
|
|
411
|
+
}
|
|
412
|
+
if (value === null) {
|
|
413
|
+
return 'null'
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
if (stack.indexOf(value) !== -1) {
|
|
417
|
+
return circularValue
|
|
418
|
+
}
|
|
419
|
+
const originalIndentation = indentation
|
|
420
|
+
|
|
421
|
+
if (Array.isArray(value)) {
|
|
422
|
+
if (value.length === 0) {
|
|
423
|
+
return '[]'
|
|
424
|
+
}
|
|
425
|
+
if (maximumDepth < stack.length + 1) {
|
|
426
|
+
return '"[Array]"'
|
|
427
|
+
}
|
|
428
|
+
stack.push(value)
|
|
429
|
+
indentation += spacer
|
|
430
|
+
let res = `\n${indentation}`
|
|
431
|
+
const join = `,\n${indentation}`
|
|
432
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth)
|
|
433
|
+
let i = 0
|
|
434
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
435
|
+
const tmp = stringifyIndent(i, value[i], stack, spacer, indentation)
|
|
436
|
+
res += tmp !== undefined ? tmp : 'null'
|
|
437
|
+
res += join
|
|
438
|
+
}
|
|
439
|
+
const tmp = stringifyIndent(i, value[i], stack, spacer, indentation)
|
|
440
|
+
res += tmp !== undefined ? tmp : 'null'
|
|
441
|
+
if (value.length - 1 > maximumBreadth) {
|
|
442
|
+
const removedKeys = value.length - maximumBreadth - 1
|
|
443
|
+
res += `${join}"... ${getItemCount(removedKeys)} not stringified"`
|
|
444
|
+
}
|
|
445
|
+
res += `\n${originalIndentation}`
|
|
446
|
+
stack.pop()
|
|
447
|
+
return `[${res}]`
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
let keys = Object.keys(value)
|
|
451
|
+
const keyLength = keys.length
|
|
452
|
+
if (keyLength === 0) {
|
|
453
|
+
return '{}'
|
|
454
|
+
}
|
|
455
|
+
if (maximumDepth < stack.length + 1) {
|
|
456
|
+
return '"[Object]"'
|
|
457
|
+
}
|
|
458
|
+
indentation += spacer
|
|
459
|
+
const join = `,\n${indentation}`
|
|
460
|
+
let res = ''
|
|
461
|
+
let separator = ''
|
|
462
|
+
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth)
|
|
463
|
+
if (isTypedArrayWithEntries(value)) {
|
|
464
|
+
res += stringifyTypedArray(value, join, maximumBreadth)
|
|
465
|
+
keys = keys.slice(value.length)
|
|
466
|
+
maximumPropertiesToStringify -= value.length
|
|
467
|
+
separator = join
|
|
468
|
+
}
|
|
469
|
+
if (deterministic) {
|
|
470
|
+
keys = insertSort(keys)
|
|
471
|
+
}
|
|
472
|
+
stack.push(value)
|
|
473
|
+
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
|
474
|
+
const key = keys[i]
|
|
475
|
+
const tmp = stringifyIndent(key, value[key], stack, spacer, indentation)
|
|
476
|
+
if (tmp !== undefined) {
|
|
477
|
+
res += `${separator}"${strEscape(key)}": ${tmp}`
|
|
478
|
+
separator = join
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
if (keyLength > maximumBreadth) {
|
|
482
|
+
const removedKeys = keyLength - maximumBreadth
|
|
483
|
+
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`
|
|
484
|
+
separator = join
|
|
485
|
+
}
|
|
486
|
+
if (separator !== '') {
|
|
487
|
+
res = `\n${indentation}${res}\n${originalIndentation}`
|
|
488
|
+
}
|
|
489
|
+
stack.pop()
|
|
490
|
+
return `{${res}}`
|
|
491
|
+
}
|
|
492
|
+
case 'number':
|
|
493
|
+
return isFinite(value) ? String(value) : 'null'
|
|
494
|
+
case 'boolean':
|
|
495
|
+
return value === true ? 'true' : 'false'
|
|
496
|
+
case 'bigint':
|
|
497
|
+
return bigint ? String(value) : undefined
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
function stringifySimple (key, value, stack) {
|
|
502
|
+
switch (typeof value) {
|
|
503
|
+
case 'string':
|
|
504
|
+
return `"${strEscape(value)}"`
|
|
505
|
+
case 'object': {
|
|
506
|
+
if (value === null) {
|
|
507
|
+
return 'null'
|
|
508
|
+
}
|
|
509
|
+
if (typeof value.toJSON === 'function') {
|
|
510
|
+
value = value.toJSON(key)
|
|
511
|
+
// Prevent calling `toJSON` again
|
|
512
|
+
if (typeof value !== 'object') {
|
|
513
|
+
return stringifySimple(key, value, stack)
|
|
514
|
+
}
|
|
515
|
+
if (value === null) {
|
|
516
|
+
return 'null'
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
if (stack.indexOf(value) !== -1) {
|
|
520
|
+
return circularValue
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
let res = ''
|
|
524
|
+
|
|
525
|
+
if (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(i, value[i], stack)
|
|
537
|
+
res += tmp !== undefined ? tmp : 'null'
|
|
538
|
+
res += ','
|
|
539
|
+
}
|
|
540
|
+
const tmp = stringifySimple(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 (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 = insertSort(keys)
|
|
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) : 'null'
|
|
587
|
+
case 'boolean':
|
|
588
|
+
return value === true ? 'true' : 'false'
|
|
589
|
+
case 'bigint':
|
|
590
|
+
return bigint ? String(value) : undefined
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
function stringify (value, replacer, space) {
|
|
595
|
+
if (arguments.length > 1) {
|
|
596
|
+
let spacer = ''
|
|
597
|
+
if (typeof space === 'number') {
|
|
598
|
+
spacer = ' '.repeat(Math.min(space, 10))
|
|
599
|
+
} else if (typeof space === 'string') {
|
|
600
|
+
spacer = space.slice(0, 10)
|
|
601
|
+
}
|
|
602
|
+
if (replacer != null) {
|
|
603
|
+
if (typeof replacer === 'function') {
|
|
604
|
+
return stringifyFnReplacer('', { '': value }, [], replacer, spacer, '')
|
|
605
|
+
}
|
|
606
|
+
if (Array.isArray(replacer)) {
|
|
607
|
+
return stringifyArrayReplacer('', value, [], getUniqueReplacerSet(replacer), spacer, '')
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
if (spacer.length !== 0) {
|
|
611
|
+
return stringifyIndent('', value, [], spacer, '')
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
return stringifySimple('', value, [])
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
return stringify
|
|
618
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "safe-stable-stringify",
|
|
3
|
+
"version": "2.3.1",
|
|
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.32",
|
|
42
|
+
"@types/node": "^16.11.1",
|
|
43
|
+
"benchmark": "^2.1.4",
|
|
44
|
+
"clone": "^2.1.2",
|
|
45
|
+
"fast-json-stable-stringify": "^2.1.0",
|
|
46
|
+
"fast-safe-stringify": "^2.0.7",
|
|
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.1",
|
|
52
|
+
"json-stringify-safe": "^5.0.1",
|
|
53
|
+
"standard": "^15.0.0",
|
|
54
|
+
"tap": "^15.0.9",
|
|
55
|
+
"typescript": "^4.4.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
|
+
|
|
66
|
+
,"_resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.3.1.tgz"
|
|
67
|
+
,"_integrity": "sha512-kYBSfT+troD9cDA85VDnHZ1rpHC50O0g1e6WlGHVCz/g+JS+9WKLj+XwFYyR8UbrZN8ll9HUpDAAddY58MGisg=="
|
|
68
|
+
,"_from": "safe-stable-stringify@2.3.1"
|
|
69
|
+
}
|