@relative-ci/core 5.3.4-alpha.0 → 6.0.0-beta.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/lib/cjs/__/@actions/http-client/lib/index.js +1 -1
- package/lib/cjs/__/@octokit/core/dist-src/version.js +1 -1
- package/lib/cjs/__/@octokit/core/dist-src/version.js.map +1 -1
- package/lib/cjs/__/@octokit/graphql/dist-bundle/index.js +4 -0
- package/lib/cjs/__/@octokit/graphql/dist-bundle/index.js.map +1 -1
- package/lib/cjs/__/@octokit/request/dist-bundle/index.js +10 -6
- package/lib/cjs/__/@octokit/request/dist-bundle/index.js.map +1 -1
- package/lib/cjs/__/content-type/dist/index.js +183 -0
- package/lib/cjs/__/content-type/dist/index.js.map +1 -0
- package/lib/cjs/__/cross-spawn/index.js +1 -1
- package/lib/cjs/__/{execa → env-ci/__/execa}/index.js +1 -1
- package/lib/cjs/__/env-ci/__/execa/index.js.map +1 -0
- package/lib/cjs/__/env-ci/__/execa/lib/command.js.map +1 -0
- package/lib/cjs/__/env-ci/__/execa/lib/error.js.map +1 -0
- package/lib/cjs/__/env-ci/__/execa/lib/promise.js.map +1 -0
- package/lib/cjs/__/env-ci/__/execa/lib/stdio.js.map +1 -0
- package/lib/cjs/__/{execa → env-ci/__/execa}/lib/stream.js +1 -1
- package/lib/cjs/__/env-ci/__/execa/lib/stream.js.map +1 -0
- package/lib/cjs/__/env-ci/__/execa/lib/verbose.js.map +1 -0
- package/lib/cjs/__/env-ci/__/get-stream/source/array-buffer.js.map +1 -0
- package/lib/cjs/__/env-ci/__/human-signals/build/src/core.js.map +1 -0
- package/lib/cjs/__/env-ci/__/human-signals/build/src/main.js.map +1 -0
- package/lib/cjs/__/env-ci/__/human-signals/build/src/realtime.js.map +1 -0
- package/lib/cjs/__/env-ci/__/human-signals/build/src/signals.js.map +1 -0
- package/lib/cjs/__/env-ci/__/is-stream/index.js.map +1 -0
- package/lib/cjs/__/{npm-run-path → env-ci/__/npm-run-path}/index.js +1 -1
- package/lib/cjs/__/env-ci/__/npm-run-path/index.js.map +1 -0
- package/lib/cjs/__/env-ci/__/path-key/index.js.map +1 -0
- package/lib/cjs/__/env-ci/__/signal-exit/dist/mjs/index.js.map +1 -0
- package/lib/cjs/__/env-ci/__/signal-exit/dist/mjs/signals.js.map +1 -0
- package/lib/cjs/__/env-ci/__/strip-final-newline/index.js.map +1 -0
- package/lib/cjs/__/env-ci/lib/git.js +1 -1
- package/lib/cjs/__/json-with-bigint/json-with-bigint.js +419 -60
- package/lib/cjs/__/json-with-bigint/json-with-bigint.js.map +1 -1
- package/lib/cjs/__/undici/lib/core/request.js +12 -1
- package/lib/cjs/__/undici/lib/core/request.js.map +1 -1
- package/lib/cjs/__/undici/lib/dispatcher/agent.js +0 -1
- package/lib/cjs/__/undici/lib/dispatcher/agent.js.map +1 -1
- package/lib/cjs/__/undici/lib/dispatcher/client-h1.js +151 -25
- package/lib/cjs/__/undici/lib/dispatcher/client-h1.js.map +1 -1
- package/lib/cjs/__/undici/lib/dispatcher/dispatcher-base.js +1 -0
- package/lib/cjs/__/undici/lib/dispatcher/dispatcher-base.js.map +1 -1
- package/lib/cjs/__/undici/lib/handler/retry-handler.js +34 -0
- package/lib/cjs/__/undici/lib/handler/retry-handler.js.map +1 -1
- package/lib/cjs/__/undici/lib/web/cookies/parse.js +16 -23
- package/lib/cjs/__/undici/lib/web/cookies/parse.js.map +1 -1
- package/lib/cjs/__/undici/lib/web/cookies/util.js +79 -9
- package/lib/cjs/__/undici/lib/web/cookies/util.js.map +1 -1
- package/lib/cjs/__/undici/lib/web/websocket/receiver.js +31 -8
- package/lib/cjs/__/undici/lib/web/websocket/receiver.js.map +1 -1
- package/lib/cjs/__/undici/lib/web/websocket/websocket.js +4 -1
- package/lib/cjs/__/undici/lib/web/websocket/websocket.js.map +1 -1
- package/lib/cjs/_virtual/_commonjsHelpers.js +1 -1
- package/lib/cjs/_virtual/index10.js +2 -2
- package/lib/cjs/_virtual/index11.js +2 -2
- package/lib/cjs/_virtual/index13.js +2 -2
- package/lib/cjs/_virtual/index9.js +3 -3
- package/lib/cjs/env/load.js +1 -1
- package/lib/cjs/env/load.js.map +1 -1
- package/lib/esm/__/@actions/http-client/lib/index.js +1 -1
- package/lib/esm/__/@octokit/core/dist-src/version.js +1 -1
- package/lib/esm/__/@octokit/core/dist-src/version.js.map +1 -1
- package/lib/esm/__/@octokit/graphql/dist-bundle/index.js +4 -0
- package/lib/esm/__/@octokit/graphql/dist-bundle/index.js.map +1 -1
- package/lib/esm/__/@octokit/request/dist-bundle/index.js +11 -7
- package/lib/esm/__/@octokit/request/dist-bundle/index.js.map +1 -1
- package/lib/esm/__/content-type/dist/index.js +181 -0
- package/lib/esm/__/content-type/dist/index.js.map +1 -0
- package/lib/esm/__/cross-spawn/index.js +1 -1
- package/lib/esm/__/{execa → env-ci/__/execa}/index.js +1 -1
- package/lib/esm/__/env-ci/__/execa/index.js.map +1 -0
- package/lib/esm/__/env-ci/__/execa/lib/command.js.map +1 -0
- package/lib/esm/__/env-ci/__/execa/lib/error.js.map +1 -0
- package/lib/esm/__/env-ci/__/execa/lib/promise.js.map +1 -0
- package/lib/esm/__/env-ci/__/execa/lib/stdio.js.map +1 -0
- package/lib/esm/__/{execa → env-ci/__/execa}/lib/stream.js +1 -1
- package/lib/esm/__/env-ci/__/execa/lib/stream.js.map +1 -0
- package/lib/esm/__/env-ci/__/execa/lib/verbose.js.map +1 -0
- package/lib/esm/__/env-ci/__/get-stream/source/array-buffer.js.map +1 -0
- package/lib/esm/__/env-ci/__/human-signals/build/src/core.js.map +1 -0
- package/lib/esm/__/env-ci/__/human-signals/build/src/main.js.map +1 -0
- package/lib/esm/__/env-ci/__/human-signals/build/src/realtime.js.map +1 -0
- package/lib/esm/__/env-ci/__/human-signals/build/src/signals.js.map +1 -0
- package/lib/esm/__/env-ci/__/is-stream/index.js.map +1 -0
- package/lib/esm/__/{npm-run-path → env-ci/__/npm-run-path}/index.js +1 -1
- package/lib/esm/__/env-ci/__/npm-run-path/index.js.map +1 -0
- package/lib/esm/__/env-ci/__/path-key/index.js.map +1 -0
- package/lib/esm/__/env-ci/__/signal-exit/dist/mjs/index.js.map +1 -0
- package/lib/esm/__/env-ci/__/signal-exit/dist/mjs/signals.js.map +1 -0
- package/lib/esm/__/env-ci/__/strip-final-newline/index.js.map +1 -0
- package/lib/esm/__/env-ci/lib/git.js +1 -1
- package/lib/esm/__/json-with-bigint/json-with-bigint.js +419 -60
- package/lib/esm/__/json-with-bigint/json-with-bigint.js.map +1 -1
- package/lib/esm/__/undici/lib/core/request.js +12 -1
- package/lib/esm/__/undici/lib/core/request.js.map +1 -1
- package/lib/esm/__/undici/lib/dispatcher/agent.js +0 -1
- package/lib/esm/__/undici/lib/dispatcher/agent.js.map +1 -1
- package/lib/esm/__/undici/lib/dispatcher/client-h1.js +151 -25
- package/lib/esm/__/undici/lib/dispatcher/client-h1.js.map +1 -1
- package/lib/esm/__/undici/lib/dispatcher/dispatcher-base.js +1 -0
- package/lib/esm/__/undici/lib/dispatcher/dispatcher-base.js.map +1 -1
- package/lib/esm/__/undici/lib/handler/retry-handler.js +34 -0
- package/lib/esm/__/undici/lib/handler/retry-handler.js.map +1 -1
- package/lib/esm/__/undici/lib/web/cookies/parse.js +16 -23
- package/lib/esm/__/undici/lib/web/cookies/parse.js.map +1 -1
- package/lib/esm/__/undici/lib/web/cookies/util.js +79 -9
- package/lib/esm/__/undici/lib/web/cookies/util.js.map +1 -1
- package/lib/esm/__/undici/lib/web/websocket/receiver.js +31 -8
- package/lib/esm/__/undici/lib/web/websocket/receiver.js.map +1 -1
- package/lib/esm/__/undici/lib/web/websocket/websocket.js +4 -1
- package/lib/esm/__/undici/lib/web/websocket/websocket.js.map +1 -1
- package/lib/esm/_virtual/_commonjsHelpers.js +1 -1
- package/lib/esm/_virtual/index10.js +2 -2
- package/lib/esm/_virtual/index11.js +2 -2
- package/lib/esm/_virtual/index13.js +2 -2
- package/lib/esm/_virtual/index9.js +3 -3
- package/lib/esm/env/load.js +1 -1
- package/lib/esm/env/load.js.map +1 -1
- package/package.json +12 -12
- package/lib/cjs/__/execa/index.js.map +0 -1
- package/lib/cjs/__/execa/lib/command.js.map +0 -1
- package/lib/cjs/__/execa/lib/error.js.map +0 -1
- package/lib/cjs/__/execa/lib/promise.js.map +0 -1
- package/lib/cjs/__/execa/lib/stdio.js.map +0 -1
- package/lib/cjs/__/execa/lib/stream.js.map +0 -1
- package/lib/cjs/__/execa/lib/verbose.js.map +0 -1
- package/lib/cjs/__/fast-content-type-parse/index.js +0 -182
- package/lib/cjs/__/fast-content-type-parse/index.js.map +0 -1
- package/lib/cjs/__/get-stream/source/array-buffer.js.map +0 -1
- package/lib/cjs/__/human-signals/build/src/core.js.map +0 -1
- package/lib/cjs/__/human-signals/build/src/main.js.map +0 -1
- package/lib/cjs/__/human-signals/build/src/realtime.js.map +0 -1
- package/lib/cjs/__/human-signals/build/src/signals.js.map +0 -1
- package/lib/cjs/__/is-stream/index.js.map +0 -1
- package/lib/cjs/__/npm-run-path/__/path-key/index.js.map +0 -1
- package/lib/cjs/__/npm-run-path/index.js.map +0 -1
- package/lib/cjs/__/signal-exit/dist/mjs/index.js.map +0 -1
- package/lib/cjs/__/signal-exit/dist/mjs/signals.js.map +0 -1
- package/lib/cjs/__/strip-final-newline/index.js.map +0 -1
- package/lib/esm/__/execa/index.js.map +0 -1
- package/lib/esm/__/execa/lib/command.js.map +0 -1
- package/lib/esm/__/execa/lib/error.js.map +0 -1
- package/lib/esm/__/execa/lib/promise.js.map +0 -1
- package/lib/esm/__/execa/lib/stdio.js.map +0 -1
- package/lib/esm/__/execa/lib/stream.js.map +0 -1
- package/lib/esm/__/execa/lib/verbose.js.map +0 -1
- package/lib/esm/__/fast-content-type-parse/index.js +0 -180
- package/lib/esm/__/fast-content-type-parse/index.js.map +0 -1
- package/lib/esm/__/get-stream/source/array-buffer.js.map +0 -1
- package/lib/esm/__/human-signals/build/src/core.js.map +0 -1
- package/lib/esm/__/human-signals/build/src/main.js.map +0 -1
- package/lib/esm/__/human-signals/build/src/realtime.js.map +0 -1
- package/lib/esm/__/human-signals/build/src/signals.js.map +0 -1
- package/lib/esm/__/is-stream/index.js.map +0 -1
- package/lib/esm/__/npm-run-path/__/path-key/index.js.map +0 -1
- package/lib/esm/__/npm-run-path/index.js.map +0 -1
- package/lib/esm/__/signal-exit/dist/mjs/index.js.map +0 -1
- package/lib/esm/__/signal-exit/dist/mjs/signals.js.map +0 -1
- package/lib/esm/__/strip-final-newline/index.js.map +0 -1
- /package/lib/cjs/__/{execa → env-ci/__/execa}/lib/command.js +0 -0
- /package/lib/cjs/__/{execa → env-ci/__/execa}/lib/error.js +0 -0
- /package/lib/cjs/__/{execa → env-ci/__/execa}/lib/promise.js +0 -0
- /package/lib/cjs/__/{execa → env-ci/__/execa}/lib/stdio.js +0 -0
- /package/lib/cjs/__/{execa → env-ci/__/execa}/lib/verbose.js +0 -0
- /package/lib/cjs/__/{get-stream → env-ci/__/get-stream}/source/array-buffer.js +0 -0
- /package/lib/cjs/__/{human-signals → env-ci/__/human-signals}/build/src/core.js +0 -0
- /package/lib/cjs/__/{human-signals → env-ci/__/human-signals}/build/src/main.js +0 -0
- /package/lib/cjs/__/{human-signals → env-ci/__/human-signals}/build/src/realtime.js +0 -0
- /package/lib/cjs/__/{human-signals → env-ci/__/human-signals}/build/src/signals.js +0 -0
- /package/lib/cjs/__/{is-stream → env-ci/__/is-stream}/index.js +0 -0
- /package/lib/cjs/__/{npm-run-path → env-ci}/__/path-key/index.js +0 -0
- /package/lib/cjs/__/{signal-exit → env-ci/__/signal-exit}/dist/mjs/index.js +0 -0
- /package/lib/cjs/__/{signal-exit → env-ci/__/signal-exit}/dist/mjs/signals.js +0 -0
- /package/lib/cjs/__/{strip-final-newline → env-ci/__/strip-final-newline}/index.js +0 -0
- /package/lib/esm/__/{execa → env-ci/__/execa}/lib/command.js +0 -0
- /package/lib/esm/__/{execa → env-ci/__/execa}/lib/error.js +0 -0
- /package/lib/esm/__/{execa → env-ci/__/execa}/lib/promise.js +0 -0
- /package/lib/esm/__/{execa → env-ci/__/execa}/lib/stdio.js +0 -0
- /package/lib/esm/__/{execa → env-ci/__/execa}/lib/verbose.js +0 -0
- /package/lib/esm/__/{get-stream → env-ci/__/get-stream}/source/array-buffer.js +0 -0
- /package/lib/esm/__/{human-signals → env-ci/__/human-signals}/build/src/core.js +0 -0
- /package/lib/esm/__/{human-signals → env-ci/__/human-signals}/build/src/main.js +0 -0
- /package/lib/esm/__/{human-signals → env-ci/__/human-signals}/build/src/realtime.js +0 -0
- /package/lib/esm/__/{human-signals → env-ci/__/human-signals}/build/src/signals.js +0 -0
- /package/lib/esm/__/{is-stream → env-ci/__/is-stream}/index.js +0 -0
- /package/lib/esm/__/{npm-run-path → env-ci}/__/path-key/index.js +0 -0
- /package/lib/esm/__/{signal-exit → env-ci/__/signal-exit}/dist/mjs/index.js +0 -0
- /package/lib/esm/__/{signal-exit → env-ci/__/signal-exit}/dist/mjs/signals.js +0 -0
- /package/lib/esm/__/{strip-final-newline → env-ci/__/strip-final-newline}/index.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/env-ci/node_modules/npm-run-path/index.js"],"sourcesContent":["import process from 'node:process';\nimport path from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport pathKey from 'path-key';\n\nexport const npmRunPath = ({\n\tcwd = process.cwd(),\n\tpath: pathOption = process.env[pathKey()],\n\tpreferLocal = true,\n\texecPath = process.execPath,\n\taddExecPath = true,\n} = {}) => {\n\tconst cwdString = cwd instanceof URL ? fileURLToPath(cwd) : cwd;\n\tconst cwdPath = path.resolve(cwdString);\n\tconst result = [];\n\n\tif (preferLocal) {\n\t\tapplyPreferLocal(result, cwdPath);\n\t}\n\n\tif (addExecPath) {\n\t\tapplyExecPath(result, execPath, cwdPath);\n\t}\n\n\treturn [...result, pathOption].join(path.delimiter);\n};\n\nconst applyPreferLocal = (result, cwdPath) => {\n\tlet previous;\n\n\twhile (previous !== cwdPath) {\n\t\tresult.push(path.join(cwdPath, 'node_modules/.bin'));\n\t\tprevious = cwdPath;\n\t\tcwdPath = path.resolve(cwdPath, '..');\n\t}\n};\n\n// Ensure the running `node` binary is used\nconst applyExecPath = (result, execPath, cwdPath) => {\n\tconst execPathString = execPath instanceof URL ? fileURLToPath(execPath) : execPath;\n\tresult.push(path.resolve(cwdPath, execPathString, '..'));\n};\n\nexport const npmRunPathEnv = ({env = process.env, ...options} = {}) => {\n\tenv = {...env};\n\n\tconst pathName = pathKey({env});\n\toptions.path = env[pathName];\n\tenv[pathName] = npmRunPath(options);\n\n\treturn env;\n};\n"],"names":["process","pathKey","fileURLToPath","path"],"mappings":";;;;;;;;;;;;AAKY,MAAC,UAAU,GAAG,CAAC;AAC3B,CAAC,GAAG,GAAGA,wBAAO,CAAC,GAAG,EAAE;AACpB,CAAC,IAAI,EAAE,UAAU,GAAGA,wBAAO,CAAC,GAAG,CAACC,KAAO,EAAE,CAAC;AAC1C,CAAC,WAAW,GAAG,IAAI;AACnB,CAAC,QAAQ,GAAGD,wBAAO,CAAC,QAAQ;AAC5B,CAAC,WAAW,GAAG,IAAI;AACnB,CAAC,GAAG,EAAE,KAAK;AACX,CAAC,MAAM,SAAS,GAAG,GAAG,YAAY,GAAG,GAAGE,wBAAa,CAAC,GAAG,CAAC,GAAG,GAAG;AAChE,CAAC,MAAM,OAAO,GAAGC,qBAAI,CAAC,OAAO,CAAC,SAAS,CAAC;AACxC,CAAC,MAAM,MAAM,GAAG,EAAE;;AAElB,CAAC,IAAI,WAAW,EAAE;AAClB,EAAE,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC;AACnC,CAAC;;AAED,CAAC,IAAI,WAAW,EAAE;AAClB,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC;AAC1C,CAAC;;AAED,CAAC,OAAO,CAAC,GAAG,MAAM,EAAE,UAAU,CAAC,CAAC,IAAI,CAACA,qBAAI,CAAC,SAAS,CAAC;AACpD;;AAEA,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK;AAC9C,CAAC,IAAI,QAAQ;;AAEb,CAAC,OAAO,QAAQ,KAAK,OAAO,EAAE;AAC9B,EAAE,MAAM,CAAC,IAAI,CAACA,qBAAI,CAAC,IAAI,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;AACtD,EAAE,QAAQ,GAAG,OAAO;AACpB,EAAE,OAAO,GAAGA,qBAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC;AACvC,CAAC;AACD,CAAC;;AAED;AACA,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK;AACrD,CAAC,MAAM,cAAc,GAAG,QAAQ,YAAY,GAAG,GAAGD,wBAAa,CAAC,QAAQ,CAAC,GAAG,QAAQ;AACpF,CAAC,MAAM,CAAC,IAAI,CAACC,qBAAI,CAAC,OAAO,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;AACzD,CAAC;;AAEW,MAAC,aAAa,GAAG,CAAC,CAAC,GAAG,GAAGH,wBAAO,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,KAAK;AACvE,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;;AAEf,CAAC,MAAM,QAAQ,GAAGC,KAAO,CAAC,CAAC,GAAG,CAAC,CAAC;AAChC,CAAC,OAAO,CAAC,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC;AAC7B,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC;;AAEpC,CAAC,OAAO,GAAG;AACX;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/env-ci/node_modules/path-key/index.js"],"sourcesContent":["export default function pathKey(options = {}) {\n\tconst {\n\t\tenv = process.env,\n\t\tplatform = process.platform\n\t} = options;\n\n\tif (platform !== 'win32') {\n\t\treturn 'PATH';\n\t}\n\n\treturn Object.keys(env).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';\n}\n"],"names":[],"mappings":";;AAAe,SAAS,OAAO,CAAC,OAAO,GAAG,EAAE,EAAE;AAC9C,CAAC,MAAM;AACP,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG;AACnB,EAAE,QAAQ,GAAG,OAAO,CAAC;AACrB,EAAE,GAAG,OAAO;;AAEZ,CAAC,IAAI,QAAQ,KAAK,OAAO,EAAE;AAC3B,EAAE,OAAO,MAAM;AACf,CAAC;;AAED,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,IAAI,MAAM;AACtF;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../../../node_modules/env-ci/node_modules/signal-exit/dist/mjs/index.js"],"sourcesContent":["// Note: since nyc uses this module to output coverage, any lines\n// that are in the direct sync flow of nyc's outputCoverage are\n// ignored, since we can never get coverage for them.\n// grab a reference to node's real process object right away\nimport { signals } from './signals.js';\nexport { signals };\nconst processOk = (process) => !!process &&\n typeof process === 'object' &&\n typeof process.removeListener === 'function' &&\n typeof process.emit === 'function' &&\n typeof process.reallyExit === 'function' &&\n typeof process.listeners === 'function' &&\n typeof process.kill === 'function' &&\n typeof process.pid === 'number' &&\n typeof process.on === 'function';\nconst kExitEmitter = Symbol.for('signal-exit emitter');\nconst global = globalThis;\nconst ObjectDefineProperty = Object.defineProperty.bind(Object);\n// teeny special purpose ee\nclass Emitter {\n emitted = {\n afterExit: false,\n exit: false,\n };\n listeners = {\n afterExit: [],\n exit: [],\n };\n count = 0;\n id = Math.random();\n constructor() {\n if (global[kExitEmitter]) {\n return global[kExitEmitter];\n }\n ObjectDefineProperty(global, kExitEmitter, {\n value: this,\n writable: false,\n enumerable: false,\n configurable: false,\n });\n }\n on(ev, fn) {\n this.listeners[ev].push(fn);\n }\n removeListener(ev, fn) {\n const list = this.listeners[ev];\n const i = list.indexOf(fn);\n /* c8 ignore start */\n if (i === -1) {\n return;\n }\n /* c8 ignore stop */\n if (i === 0 && list.length === 1) {\n list.length = 0;\n }\n else {\n list.splice(i, 1);\n }\n }\n emit(ev, code, signal) {\n if (this.emitted[ev]) {\n return false;\n }\n this.emitted[ev] = true;\n let ret = false;\n for (const fn of this.listeners[ev]) {\n ret = fn(code, signal) === true || ret;\n }\n if (ev === 'exit') {\n ret = this.emit('afterExit', code, signal) || ret;\n }\n return ret;\n }\n}\nclass SignalExitBase {\n}\nconst signalExitWrap = (handler) => {\n return {\n onExit(cb, opts) {\n return handler.onExit(cb, opts);\n },\n load() {\n return handler.load();\n },\n unload() {\n return handler.unload();\n },\n };\n};\nclass SignalExitFallback extends SignalExitBase {\n onExit() {\n return () => { };\n }\n load() { }\n unload() { }\n}\nclass SignalExit extends SignalExitBase {\n // \"SIGHUP\" throws an `ENOSYS` error on Windows,\n // so use a supported signal instead\n /* c8 ignore start */\n #hupSig = process.platform === 'win32' ? 'SIGINT' : 'SIGHUP';\n /* c8 ignore stop */\n #emitter = new Emitter();\n #process;\n #originalProcessEmit;\n #originalProcessReallyExit;\n #sigListeners = {};\n #loaded = false;\n constructor(process) {\n super();\n this.#process = process;\n // { <signal>: <listener fn>, ... }\n this.#sigListeners = {};\n for (const sig of signals) {\n this.#sigListeners[sig] = () => {\n // If there are no other listeners, an exit is coming!\n // Simplest way: remove us and then re-send the signal.\n // We know that this will kill the process, so we can\n // safely emit now.\n const listeners = this.#process.listeners(sig);\n let { count } = this.#emitter;\n // This is a workaround for the fact that signal-exit v3 and signal\n // exit v4 are not aware of each other, and each will attempt to let\n // the other handle it, so neither of them do. To correct this, we\n // detect if we're the only handler *except* for previous versions\n // of signal-exit, and increment by the count of listeners it has\n // created.\n /* c8 ignore start */\n const p = process;\n if (typeof p.__signal_exit_emitter__ === 'object' &&\n typeof p.__signal_exit_emitter__.count === 'number') {\n count += p.__signal_exit_emitter__.count;\n }\n /* c8 ignore stop */\n if (listeners.length === count) {\n this.unload();\n const ret = this.#emitter.emit('exit', null, sig);\n /* c8 ignore start */\n const s = sig === 'SIGHUP' ? this.#hupSig : sig;\n if (!ret)\n process.kill(process.pid, s);\n /* c8 ignore stop */\n }\n };\n }\n this.#originalProcessReallyExit = process.reallyExit;\n this.#originalProcessEmit = process.emit;\n }\n onExit(cb, opts) {\n /* c8 ignore start */\n if (!processOk(this.#process)) {\n return () => { };\n }\n /* c8 ignore stop */\n if (this.#loaded === false) {\n this.load();\n }\n const ev = opts?.alwaysLast ? 'afterExit' : 'exit';\n this.#emitter.on(ev, cb);\n return () => {\n this.#emitter.removeListener(ev, cb);\n if (this.#emitter.listeners['exit'].length === 0 &&\n this.#emitter.listeners['afterExit'].length === 0) {\n this.unload();\n }\n };\n }\n load() {\n if (this.#loaded) {\n return;\n }\n this.#loaded = true;\n // This is the number of onSignalExit's that are in play.\n // It's important so that we can count the correct number of\n // listeners on signals, and don't wait for the other one to\n // handle it instead of us.\n this.#emitter.count += 1;\n for (const sig of signals) {\n try {\n const fn = this.#sigListeners[sig];\n if (fn)\n this.#process.on(sig, fn);\n }\n catch (_) { }\n }\n this.#process.emit = (ev, ...a) => {\n return this.#processEmit(ev, ...a);\n };\n this.#process.reallyExit = (code) => {\n return this.#processReallyExit(code);\n };\n }\n unload() {\n if (!this.#loaded) {\n return;\n }\n this.#loaded = false;\n signals.forEach(sig => {\n const listener = this.#sigListeners[sig];\n /* c8 ignore start */\n if (!listener) {\n throw new Error('Listener not defined for signal: ' + sig);\n }\n /* c8 ignore stop */\n try {\n this.#process.removeListener(sig, listener);\n /* c8 ignore start */\n }\n catch (_) { }\n /* c8 ignore stop */\n });\n this.#process.emit = this.#originalProcessEmit;\n this.#process.reallyExit = this.#originalProcessReallyExit;\n this.#emitter.count -= 1;\n }\n #processReallyExit(code) {\n /* c8 ignore start */\n if (!processOk(this.#process)) {\n return 0;\n }\n this.#process.exitCode = code || 0;\n /* c8 ignore stop */\n this.#emitter.emit('exit', this.#process.exitCode, null);\n return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);\n }\n #processEmit(ev, ...args) {\n const og = this.#originalProcessEmit;\n if (ev === 'exit' && processOk(this.#process)) {\n if (typeof args[0] === 'number') {\n this.#process.exitCode = args[0];\n /* c8 ignore start */\n }\n /* c8 ignore start */\n const ret = og.call(this.#process, ev, ...args);\n /* c8 ignore start */\n this.#emitter.emit('exit', this.#process.exitCode, null);\n /* c8 ignore stop */\n return ret;\n }\n else {\n return og.call(this.#process, ev, ...args);\n }\n }\n}\nconst process = globalThis.process;\n// wrap so that we call the method on the actual handler, without\n// exporting it directly.\nexport const { \n/**\n * Called when the process is exiting, whether via signal, explicit\n * exit, or running out of stuff to do.\n *\n * If the global process object is not suitable for instrumentation,\n * then this will be a no-op.\n *\n * Returns a function that may be used to unload signal-exit.\n */\nonExit, \n/**\n * Load the listeners. Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\nload, \n/**\n * Unload the listeners. Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\nunload, } = signalExitWrap(processOk(process) ? new SignalExit(process) : new SignalExitFallback());\n//# sourceMappingURL=index.js.map"],"names":["signals"],"mappings":";;;;AAAA;AACA;AACA;AACA;AAGA,MAAM,SAAS,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO;AACxC,IAAI,OAAO,OAAO,KAAK,QAAQ;AAC/B,IAAI,OAAO,OAAO,CAAC,cAAc,KAAK,UAAU;AAChD,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,UAAU;AACtC,IAAI,OAAO,OA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AAE,EAAE,GAAG,IAAI,EAAE;AAC9B,QAAQ,MAAM,EAAE,GAAG,IAAI,CAAC,oBAAoB;AAC5C,QAAQ,IAAI,EAAE,KAAK,MAAM,IAAI,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;AACvD,YAAY,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;AAC7C,gBAAgB,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC;AAChD;AACA,YAAY;AACZ;AACA,YAAY,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;AAC3D;AACA,YAAY,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;AACpE;AACA,YAAY,OAAO,GAAG;AACtB,QAAQ;AACR,aAAa;AACb,YAAY,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;AACtD,QAAQ;AACR,IAAI;AACJ;AACA,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO;AAClC;AACA;AA2BY,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,IAAI,kBAAkB,EAAE;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signals.js","sources":["../../../../../../../../../../node_modules/env-ci/node_modules/signal-exit/dist/mjs/signals.js"],"sourcesContent":["/**\n * This is not the set of all possible signals.\n *\n * It IS, however, the set of all signals that trigger\n * an exit on either Linux or BSD systems. Linux is a\n * superset of the signal names supported on BSD, and\n * the unknown signals just fail to register, so we can\n * catch that easily enough.\n *\n * Windows signals are a different set, since there are\n * signals that terminate Windows processes, but don't\n * terminate (or don't even exist) on Posix systems.\n *\n * Don't bother with SIGKILL. It's uncatchable, which\n * means that we can't fire any callbacks anyway.\n *\n * If a user does happen to register a handler on a non-\n * fatal signal like SIGWINCH or something, and then\n * exit, it'll end up firing `process.emit('exit')`, so\n * the handler will be fired anyway.\n *\n * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n * artificially, inherently leave the process in a\n * state from which it is not safe to try and enter JS\n * listeners.\n */\nexport const signals = [];\nsignals.push('SIGHUP', 'SIGINT', 'SIGTERM');\nif (process.platform !== 'win32') {\n signals.push('SIGALRM', 'SIGABRT', 'SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT'\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n );\n}\nif (process.platform === 'linux') {\n signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT');\n}\n//# sourceMappingURL=signals.js.map"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAG;AACvB,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC;AAC3C,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;AAClC,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE;AACrH;AACA;AACA;AACA,KAAK;AACL;AACA,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;AAClC,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC;AAC3D;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/env-ci/node_modules/strip-final-newline/index.js"],"sourcesContent":["export default function stripFinalNewline(input) {\n\tconst LF = typeof input === 'string' ? '\\n' : '\\n'.charCodeAt();\n\tconst CR = typeof input === 'string' ? '\\r' : '\\r'.charCodeAt();\n\n\tif (input[input.length - 1] === LF) {\n\t\tinput = input.slice(0, -1);\n\t}\n\n\tif (input[input.length - 1] === CR) {\n\t\tinput = input.slice(0, -1);\n\t}\n\n\treturn input;\n}\n"],"names":[],"mappings":";;AAAe,SAAS,iBAAiB,CAAC,KAAK,EAAE;AACjD,CAAC,MAAM,EAAE,GAAG,OAAO,KAAK,KAAK,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE;AAChE,CAAC,MAAM,EAAE,GAAG,OAAO,KAAK,KAAK,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE;;AAEhE,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;AACrC,EAAE,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;AAC5B,CAAC;;AAED,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;AACrC,EAAE,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;AAC5B,CAAC;;AAED,CAAC,OAAO,KAAK;AACb;;;;","x_google_ignoreList":[0]}
|
|
@@ -6,15 +6,251 @@ const originalStringify = JSON.stringify;
|
|
|
6
6
|
const originalParse = JSON.parse;
|
|
7
7
|
const customFormat = /^-?\d+n$/;
|
|
8
8
|
|
|
9
|
-
const bigIntsStringify = /([\[:])?"(-?\d+)n"(
|
|
10
|
-
const noiseStringify =
|
|
11
|
-
/([\[:])?("-?\d+n+)n("$|"([\\n]|\s)*(\s|[\\n])*[,\}\]])/g;
|
|
9
|
+
const bigIntsStringify = /([\[:])?"(-?\d+)n"($|\s*[,\}\]])/g;
|
|
10
|
+
const noiseStringify = /([\[:])?("-?\d+n+)n("$|"\s*[,\}\]])/g;
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* @typedef {(this: any, key: string | number | undefined, value: any) => any} Replacer
|
|
15
14
|
* @typedef {(key: string | number | undefined, value: any, context?: { source: string }) => any} Reviver
|
|
16
15
|
*/
|
|
17
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Checks if a value is unstringifiable according to native JSON.stringify rules.
|
|
19
|
+
*
|
|
20
|
+
* @param {any} val The value to check.
|
|
21
|
+
* @returns {boolean} True if the value is undefined, a function, or a symbol.
|
|
22
|
+
*/
|
|
23
|
+
const isUnstringifiable = (val) =>
|
|
24
|
+
val === undefined || typeof val === "function" || typeof val === "symbol";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Checks if a value is a native JSON.rawJSON object (Node.js 22+).
|
|
28
|
+
*
|
|
29
|
+
* @param {any} val The value to check.
|
|
30
|
+
* @returns {boolean} True if the value is a RawJSON instance.
|
|
31
|
+
*/
|
|
32
|
+
const isRawJSON = (val) =>
|
|
33
|
+
val !== null &&
|
|
34
|
+
typeof val === "object" &&
|
|
35
|
+
val.constructor &&
|
|
36
|
+
val.constructor.name === "RawJSON";
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Iteratively converts a JS value to a JSON string.
|
|
40
|
+
* Used as a fallback when the native JSON.stringify hits the Maximum Call Stack size.
|
|
41
|
+
* Fully compliant with JSON formatting (space), replacers, and toJSON behaviors.
|
|
42
|
+
*
|
|
43
|
+
* @param {any} rootValue The value to stringify.
|
|
44
|
+
* @param {Replacer | Array<string | number> | null} [replacer] User's custom replacer function.
|
|
45
|
+
* @param {string | number} [spaceParam] Indentation for pretty-printing.
|
|
46
|
+
* @returns {string | undefined} The generated JSON string.
|
|
47
|
+
*/
|
|
48
|
+
const stringifyIteratively = (rootValue, replacer, spaceParam) => {
|
|
49
|
+
let space = "";
|
|
50
|
+
const propertyList = Array.isArray(replacer)
|
|
51
|
+
? new Set(replacer.map(String))
|
|
52
|
+
: null;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Prepares a value for stringification by resolving toJSON, handling BigInts,
|
|
56
|
+
* applying custom replacers, and unwrapping primitive objects.
|
|
57
|
+
*
|
|
58
|
+
* @param {object|Array} parent The parent object or array holding the value.
|
|
59
|
+
* @param {string} key The key associated with the value.
|
|
60
|
+
* @param {any} val The raw value to process.
|
|
61
|
+
* @returns {any} The processed value ready for stringification.
|
|
62
|
+
*/
|
|
63
|
+
const prepareVal = (parent, key, val) => {
|
|
64
|
+
const isObject = val !== null && typeof val === "object";
|
|
65
|
+
const hasToJSON = isObject && typeof val.toJSON === "function";
|
|
66
|
+
|
|
67
|
+
if (hasToJSON) {
|
|
68
|
+
val = val.toJSON(key);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const isNoise = typeof val === "string" && noiseValue.test(val);
|
|
72
|
+
|
|
73
|
+
if (isNoise) return val + "n";
|
|
74
|
+
|
|
75
|
+
const isBigInt = typeof val === "bigint";
|
|
76
|
+
|
|
77
|
+
if (isBigInt) {
|
|
78
|
+
const supportsRawJSON = "rawJSON" in JSON;
|
|
79
|
+
|
|
80
|
+
if (supportsRawJSON) return JSON.rawJSON(val.toString());
|
|
81
|
+
|
|
82
|
+
return val.toString() + "n";
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const isPostReplacerObject = val !== null && typeof val === "object";
|
|
86
|
+
|
|
87
|
+
if (isPostReplacerObject) {
|
|
88
|
+
const isPrimitiveWrapper =
|
|
89
|
+
val instanceof Number ||
|
|
90
|
+
val instanceof String ||
|
|
91
|
+
val instanceof Boolean;
|
|
92
|
+
|
|
93
|
+
if (isPrimitiveWrapper) {
|
|
94
|
+
val = val.valueOf();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return val;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const rootProcessed = prepareVal({ }, "", rootValue);
|
|
102
|
+
|
|
103
|
+
if (isUnstringifiable(rootProcessed)) {
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const isRootPrimitive =
|
|
108
|
+
rootProcessed === null || typeof rootProcessed !== "object";
|
|
109
|
+
const isRootNativeRawJSON = isRawJSON(rootProcessed);
|
|
110
|
+
|
|
111
|
+
if (isRootPrimitive || isRootNativeRawJSON) {
|
|
112
|
+
return originalStringify(rootProcessed);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const chunks = [];
|
|
116
|
+
|
|
117
|
+
const stack = [
|
|
118
|
+
{
|
|
119
|
+
parent: { "": rootProcessed },
|
|
120
|
+
key: "",
|
|
121
|
+
val: rootProcessed,
|
|
122
|
+
isArray: Array.isArray(rootProcessed),
|
|
123
|
+
keys: Array.isArray(rootProcessed) ? null : Object.keys(rootProcessed),
|
|
124
|
+
index: 0,
|
|
125
|
+
first: true,
|
|
126
|
+
},
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
const visited = new WeakSet([rootProcessed]);
|
|
130
|
+
|
|
131
|
+
while (stack.length > 0) {
|
|
132
|
+
const node = stack[stack.length - 1];
|
|
133
|
+
|
|
134
|
+
if (node.index === 0) {
|
|
135
|
+
chunks.push(node.isArray ? "[" : "{");
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
let isDone = false;
|
|
139
|
+
|
|
140
|
+
if (node.isArray) {
|
|
141
|
+
if (node.index < node.val.length) {
|
|
142
|
+
if (!node.first) chunks.push(",");
|
|
143
|
+
|
|
144
|
+
const childRaw = node.val[node.index];
|
|
145
|
+
const childVal = prepareVal(node.val, String(node.index), childRaw);
|
|
146
|
+
|
|
147
|
+
if (isUnstringifiable(childVal)) {
|
|
148
|
+
chunks.push("null");
|
|
149
|
+
node.first = false;
|
|
150
|
+
node.index++;
|
|
151
|
+
} else {
|
|
152
|
+
const isComplexObject =
|
|
153
|
+
childVal !== null && typeof childVal === "object";
|
|
154
|
+
const isNativeRaw = isRawJSON(childVal);
|
|
155
|
+
|
|
156
|
+
if (isComplexObject && !isNativeRaw) {
|
|
157
|
+
if (visited.has(childVal)) {
|
|
158
|
+
throw new TypeError("Converting circular structure to JSON");
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
visited.add(childVal);
|
|
162
|
+
|
|
163
|
+
stack.push({
|
|
164
|
+
parent: node.val,
|
|
165
|
+
key: String(node.index),
|
|
166
|
+
val: childVal,
|
|
167
|
+
isArray: Array.isArray(childVal),
|
|
168
|
+
keys: Array.isArray(childVal) ? null : Object.keys(childVal),
|
|
169
|
+
index: 0,
|
|
170
|
+
first: true,
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
node.first = false;
|
|
174
|
+
node.index++;
|
|
175
|
+
} else {
|
|
176
|
+
chunks.push(originalStringify(childVal));
|
|
177
|
+
node.first = false;
|
|
178
|
+
node.index++;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
} else {
|
|
182
|
+
isDone = true;
|
|
183
|
+
}
|
|
184
|
+
} else {
|
|
185
|
+
while (node.index < node.keys.length) {
|
|
186
|
+
const k = node.keys[node.index++];
|
|
187
|
+
|
|
188
|
+
const isFilteredOutByArray = propertyList && !propertyList.has(k);
|
|
189
|
+
|
|
190
|
+
if (isFilteredOutByArray) continue;
|
|
191
|
+
|
|
192
|
+
const childRaw = node.val[k];
|
|
193
|
+
const childVal = prepareVal(node.val, k, childRaw);
|
|
194
|
+
|
|
195
|
+
if (isUnstringifiable(childVal)) continue;
|
|
196
|
+
|
|
197
|
+
if (!node.first) chunks.push(",");
|
|
198
|
+
|
|
199
|
+
{
|
|
200
|
+
chunks.push(originalStringify(k) + ":");
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const isComplexObject =
|
|
204
|
+
childVal !== null && typeof childVal === "object";
|
|
205
|
+
const isNativeRaw = isRawJSON(childVal);
|
|
206
|
+
|
|
207
|
+
if (isComplexObject && !isNativeRaw) {
|
|
208
|
+
if (visited.has(childVal)) {
|
|
209
|
+
throw new TypeError("Converting circular structure to JSON");
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
visited.add(childVal);
|
|
213
|
+
|
|
214
|
+
stack.push({
|
|
215
|
+
parent: node.val,
|
|
216
|
+
key: k,
|
|
217
|
+
val: childVal,
|
|
218
|
+
isArray: Array.isArray(childVal),
|
|
219
|
+
keys: Array.isArray(childVal) ? null : Object.keys(childVal),
|
|
220
|
+
index: 0,
|
|
221
|
+
first: true,
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
node.first = false;
|
|
225
|
+
|
|
226
|
+
break; // Stop current loop level to process the newly pushed stack node
|
|
227
|
+
} else {
|
|
228
|
+
chunks.push(originalStringify(childVal));
|
|
229
|
+
node.first = false;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const isNodeFullyProcessed =
|
|
234
|
+
node.index >= node.keys.length && stack[stack.length - 1] === node;
|
|
235
|
+
|
|
236
|
+
if (isNodeFullyProcessed) {
|
|
237
|
+
isDone = true;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (isDone) {
|
|
242
|
+
|
|
243
|
+
if (!node.first && space) ;
|
|
244
|
+
|
|
245
|
+
chunks.push(node.isArray ? "]" : "}");
|
|
246
|
+
visited.delete(node.val);
|
|
247
|
+
stack.pop();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return chunks.join("");
|
|
252
|
+
};
|
|
253
|
+
|
|
18
254
|
/**
|
|
19
255
|
* Converts a JavaScript value to a JSON string.
|
|
20
256
|
*
|
|
@@ -26,51 +262,87 @@ const noiseStringify =
|
|
|
26
262
|
*
|
|
27
263
|
* @param {*} value The value to convert to a JSON string.
|
|
28
264
|
* @param {Replacer | Array<string | number> | null} [replacer]
|
|
29
|
-
*
|
|
30
|
-
*
|
|
265
|
+
* A function that alters the behavior of the stringification process,
|
|
266
|
+
* or an array of strings/numbers to indicate properties to exclude.
|
|
31
267
|
* @param {string | number} [space]
|
|
32
|
-
*
|
|
268
|
+
* A string or number to specify indentation or pretty-printing.
|
|
33
269
|
* @returns {string} The JSON string representation.
|
|
34
270
|
*/
|
|
35
271
|
const JSONStringify = (value, replacer, space) => {
|
|
36
|
-
|
|
37
|
-
|
|
272
|
+
try {
|
|
273
|
+
const supportsRawJSON = "rawJSON" in JSON;
|
|
274
|
+
|
|
275
|
+
if (supportsRawJSON) {
|
|
276
|
+
return originalStringify(
|
|
277
|
+
value,
|
|
278
|
+
(key, val) => {
|
|
279
|
+
if (typeof val === "bigint") return JSON.rawJSON(val.toString());
|
|
280
|
+
|
|
281
|
+
const hasFunctionReplacer = typeof replacer === "function";
|
|
282
|
+
|
|
283
|
+
if (hasFunctionReplacer) ;
|
|
284
|
+
|
|
285
|
+
const isKeyInArrayReplacer =
|
|
286
|
+
Array.isArray(replacer) && replacer.includes(key);
|
|
287
|
+
|
|
288
|
+
if (isKeyInArrayReplacer) return val;
|
|
289
|
+
|
|
290
|
+
return val;
|
|
291
|
+
},
|
|
292
|
+
space,
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (!value) return originalStringify(value, replacer, space);
|
|
297
|
+
|
|
298
|
+
const convertedToCustomJSON = originalStringify(
|
|
38
299
|
value,
|
|
39
|
-
(key,
|
|
40
|
-
|
|
300
|
+
(key, val) => {
|
|
301
|
+
const isNoise = typeof val === "string" && noiseValue.test(val);
|
|
302
|
+
|
|
303
|
+
if (isNoise) return val.toString() + "n"; // Mark noise values with additional "n" to offset the deletion of one "n" during the processing
|
|
304
|
+
|
|
305
|
+
if (typeof val === "bigint") return val.toString() + "n";
|
|
41
306
|
|
|
42
|
-
|
|
307
|
+
const hasFunctionReplacer = typeof replacer === "function";
|
|
43
308
|
|
|
44
|
-
|
|
309
|
+
if (hasFunctionReplacer) ;
|
|
310
|
+
|
|
311
|
+
const isKeyInArrayReplacer =
|
|
312
|
+
Array.isArray(replacer) && replacer.includes(key);
|
|
313
|
+
|
|
314
|
+
if (isKeyInArrayReplacer) return val;
|
|
315
|
+
|
|
316
|
+
return val;
|
|
45
317
|
},
|
|
46
318
|
space,
|
|
47
319
|
);
|
|
48
|
-
}
|
|
49
320
|
|
|
50
|
-
|
|
321
|
+
const processedJSON = convertedToCustomJSON.replace(
|
|
322
|
+
bigIntsStringify,
|
|
323
|
+
"$1$2$3",
|
|
324
|
+
); // Delete one "n" off the end of every BigInt value
|
|
51
325
|
|
|
52
|
-
|
|
53
|
-
value,
|
|
54
|
-
(key, value) => {
|
|
55
|
-
const isNoise = typeof value === "string" && noiseValue.test(value);
|
|
326
|
+
const denoisedJSON = processedJSON.replace(noiseStringify, "$1$2$3"); // Remove one "n" off the end of every noisy string
|
|
56
327
|
|
|
57
|
-
|
|
328
|
+
return denoisedJSON;
|
|
329
|
+
} catch (error) {
|
|
330
|
+
if (error instanceof RangeError) {
|
|
331
|
+
const convertedJSON = stringifyIteratively(value, replacer);
|
|
58
332
|
|
|
59
|
-
if (
|
|
333
|
+
if (convertedJSON === undefined) return undefined;
|
|
60
334
|
|
|
61
|
-
|
|
335
|
+
const supportsRawJSON = "rawJSON" in JSON;
|
|
62
336
|
|
|
63
|
-
return
|
|
64
|
-
},
|
|
65
|
-
space,
|
|
66
|
-
);
|
|
67
|
-
const processedJSON = convertedToCustomJSON.replace(
|
|
68
|
-
bigIntsStringify,
|
|
69
|
-
"$1$2$3",
|
|
70
|
-
); // Delete one "n" off the end of every BigInt value
|
|
71
|
-
const denoisedJSON = processedJSON.replace(noiseStringify, "$1$2$3"); // Remove one "n" off the end of every noisy string
|
|
337
|
+
if (supportsRawJSON) return convertedJSON;
|
|
72
338
|
|
|
73
|
-
|
|
339
|
+
const processedJSON = convertedJSON.replace(bigIntsStringify, "$1$2$3");
|
|
340
|
+
|
|
341
|
+
return processedJSON.replace(noiseStringify, "$1$2$3");
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
throw error;
|
|
345
|
+
}
|
|
74
346
|
};
|
|
75
347
|
|
|
76
348
|
const featureCache = new Map();
|
|
@@ -118,6 +390,7 @@ const isContextSourceSupported = () => {
|
|
|
118
390
|
const convertMarkedBigIntsReviver = (key, value, context, userReviver) => {
|
|
119
391
|
const isCustomFormatBigInt =
|
|
120
392
|
typeof value === "string" && customFormat.test(value);
|
|
393
|
+
|
|
121
394
|
if (isCustomFormatBigInt) return BigInt(value.slice(0, -1));
|
|
122
395
|
|
|
123
396
|
const isNoiseValue = typeof value === "string" && noiseValue.test(value);
|
|
@@ -139,9 +412,10 @@ const convertMarkedBigIntsReviver = (key, value, context, userReviver) => {
|
|
|
139
412
|
*/
|
|
140
413
|
const JSONParseV2 = (text, reviver) => {
|
|
141
414
|
return JSON.parse(text, (key, value, context) => {
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
415
|
+
const isNumber = typeof value === "number";
|
|
416
|
+
const isOutOfBounds =
|
|
417
|
+
value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER;
|
|
418
|
+
const isBigNumber = isNumber && isOutOfBounds;
|
|
145
419
|
const isInt = context && intRegex.test(context.source);
|
|
146
420
|
const isBigInt = isBigNumber && isInt;
|
|
147
421
|
|
|
@@ -157,6 +431,99 @@ const stringsOrLargeNumbers =
|
|
|
157
431
|
/"(?:\\.|[^"])*"|-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/g;
|
|
158
432
|
const noiseValueWithQuotes = /^"-?\d+n+"$/; // Noise - strings that match the custom format before being converted to it
|
|
159
433
|
|
|
434
|
+
/**
|
|
435
|
+
* Iteratively traverses the parsed object bottom-up (post-order),
|
|
436
|
+
* emulating the native JSON.parse reviver behavior.
|
|
437
|
+
* This avoids Call Stack overflows (RangeError) on deeply nested structures.
|
|
438
|
+
*
|
|
439
|
+
* @param {any} parsed The natively parsed JSON object.
|
|
440
|
+
* @param {Reviver} [userReviver] User's custom reviver function.
|
|
441
|
+
* @returns {any} The fully processed object.
|
|
442
|
+
*/
|
|
443
|
+
const applyReviverIteratively = (parsed, userReviver) => {
|
|
444
|
+
const rootHolder = { "": parsed };
|
|
445
|
+
const stack = [{ parent: rootHolder, key: "", visited: false }];
|
|
446
|
+
|
|
447
|
+
while (stack.length > 0) {
|
|
448
|
+
const node = stack[stack.length - 1];
|
|
449
|
+
|
|
450
|
+
if (!node.visited) {
|
|
451
|
+
node.visited = true;
|
|
452
|
+
|
|
453
|
+
const value = node.parent[node.key];
|
|
454
|
+
const isComplexObject = value !== null && typeof value === "object";
|
|
455
|
+
|
|
456
|
+
if (isComplexObject) {
|
|
457
|
+
const keys = Object.keys(value);
|
|
458
|
+
|
|
459
|
+
for (let i = keys.length - 1; i >= 0; i--) {
|
|
460
|
+
stack.push({ parent: value, key: keys[i], visited: false });
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
} else {
|
|
464
|
+
const { parent, key } = node;
|
|
465
|
+
let value = parent[key];
|
|
466
|
+
|
|
467
|
+
if (typeof value === "string") {
|
|
468
|
+
const isCustomFormatBigInt = customFormat.test(value);
|
|
469
|
+
|
|
470
|
+
if (isCustomFormatBigInt) {
|
|
471
|
+
value = BigInt(value.slice(0, -1));
|
|
472
|
+
} else {
|
|
473
|
+
const isNoise = noiseValue.test(value);
|
|
474
|
+
|
|
475
|
+
if (isNoise) value = value.slice(0, -1);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
const isDeleted = value === undefined;
|
|
480
|
+
|
|
481
|
+
if (isDeleted) {
|
|
482
|
+
delete parent[key];
|
|
483
|
+
} else {
|
|
484
|
+
parent[key] = value;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
stack.pop();
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
return rootHolder[""];
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Pre-processes the JSON string to mark large numbers with an 'n' suffix.
|
|
496
|
+
*
|
|
497
|
+
* @param {string} text The raw JSON string.
|
|
498
|
+
* @returns {string} The serialized string with marked BigInts.
|
|
499
|
+
*/
|
|
500
|
+
const serializeBigInts = (text) => {
|
|
501
|
+
return text.replace(
|
|
502
|
+
stringsOrLargeNumbers,
|
|
503
|
+
(match, digits, fractional, exponential) => {
|
|
504
|
+
const isString = match[0] === '"';
|
|
505
|
+
const isNoise = isString && noiseValueWithQuotes.test(match);
|
|
506
|
+
|
|
507
|
+
if (isNoise) return match.substring(0, match.length - 1) + 'n"'; // Mark noise values with additional "n" to offset the deletion of one "n" during the processing
|
|
508
|
+
|
|
509
|
+
const hasFractionalOrExponential = fractional || exponential;
|
|
510
|
+
|
|
511
|
+
// With a fixed number of digits, we can correctly use lexicographical comparison to do a numeric comparison
|
|
512
|
+
const isLessThanMaxSafeInt =
|
|
513
|
+
digits &&
|
|
514
|
+
(digits.length < MAX_DIGITS ||
|
|
515
|
+
(digits.length === MAX_DIGITS && digits <= MAX_INT));
|
|
516
|
+
|
|
517
|
+
const isStandardValue =
|
|
518
|
+
isString || hasFractionalOrExponential || isLessThanMaxSafeInt;
|
|
519
|
+
|
|
520
|
+
if (isStandardValue) return match;
|
|
521
|
+
|
|
522
|
+
return '"' + match + 'n"';
|
|
523
|
+
},
|
|
524
|
+
);
|
|
525
|
+
};
|
|
526
|
+
|
|
160
527
|
/**
|
|
161
528
|
* Converts a JSON string into a JavaScript value.
|
|
162
529
|
*
|
|
@@ -168,42 +535,34 @@ const noiseValueWithQuotes = /^"-?\d+n+"$/; // Noise - strings that match the cu
|
|
|
168
535
|
*
|
|
169
536
|
* @param {string} text A valid JSON string.
|
|
170
537
|
* @param {Reviver} [reviver]
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
538
|
+
* A function that transforms the results. This function is called for each member
|
|
539
|
+
* of the object. If a member contains nested objects, the nested objects are
|
|
540
|
+
* transformed before the parent object is.
|
|
174
541
|
* @returns {any} The parsed JavaScript value.
|
|
175
542
|
* @throws {SyntaxError} If text is not valid JSON.
|
|
176
543
|
*/
|
|
177
544
|
const JSONParse = (text, reviver) => {
|
|
178
545
|
if (!text) return originalParse(text, reviver);
|
|
179
546
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
// Find and mark big numbers with "n"
|
|
183
|
-
const serializedData = text.replace(
|
|
184
|
-
stringsOrLargeNumbers,
|
|
185
|
-
(text, digits, fractional, exponential) => {
|
|
186
|
-
const isString = text[0] === '"';
|
|
187
|
-
const isNoise = isString && noiseValueWithQuotes.test(text);
|
|
547
|
+
try {
|
|
548
|
+
if (isContextSourceSupported()) return JSONParseV2(text, reviver); // Shortcut to a faster (2x) and simpler version
|
|
188
549
|
|
|
189
|
-
|
|
550
|
+
// Find and mark big numbers with "n"
|
|
551
|
+
const serializedData = serializeBigInts(text);
|
|
190
552
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
return text;
|
|
553
|
+
return originalParse(serializedData, (key, value, context) =>
|
|
554
|
+
convertMarkedBigIntsReviver(key, value, context, reviver),
|
|
555
|
+
);
|
|
556
|
+
} catch (error) {
|
|
557
|
+
if (error instanceof RangeError) {
|
|
558
|
+
const serializedData = serializeBigInts(text);
|
|
559
|
+
const parsed = originalParse(serializedData);
|
|
199
560
|
|
|
200
|
-
return
|
|
201
|
-
}
|
|
202
|
-
);
|
|
561
|
+
return applyReviverIteratively(parsed);
|
|
562
|
+
}
|
|
203
563
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
);
|
|
564
|
+
throw error;
|
|
565
|
+
}
|
|
207
566
|
};
|
|
208
567
|
|
|
209
568
|
exports.JSONParse = JSONParse;
|