projen 0.99.72 → 0.99.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +2 -2
- package/lib/ai-instructions.js +2 -2
- package/lib/awscdk/auto-discover.js +6 -6
- package/lib/awscdk/awscdk-app-java.js +1 -1
- package/lib/awscdk/awscdk-app-py.js +1 -1
- package/lib/awscdk/awscdk-app-ts.js +1 -1
- package/lib/awscdk/awscdk-construct.js +2 -2
- package/lib/awscdk/awscdk-deps-java.js +1 -1
- package/lib/awscdk/awscdk-deps-js.js +1 -1
- package/lib/awscdk/awscdk-deps-py.js +1 -1
- package/lib/awscdk/awscdk-deps.js +1 -1
- package/lib/awscdk/cdk-config.js +4 -4
- package/lib/awscdk/cdk-tasks.js +1 -1
- package/lib/awscdk/integration-test.js +1 -1
- package/lib/awscdk/lambda-extension.js +1 -1
- package/lib/awscdk/lambda-function.js +2 -2
- package/lib/awscdk/private/feature-flags-v2.const.d.ts +1 -1
- package/lib/awscdk/private/feature-flags-v2.const.js +2 -2
- package/lib/build/build-workflow.js +1 -1
- package/lib/cdk/auto-discover-base.js +2 -2
- package/lib/cdk/construct-lib.js +1 -1
- package/lib/cdk/integration-test-base.js +1 -1
- package/lib/cdk/jsii-build.js +1 -1
- package/lib/cdk/jsii-docgen.js +1 -1
- package/lib/cdk/jsii-project.js +1 -1
- package/lib/cdk8s/auto-discover.js +2 -2
- package/lib/cdk8s/cdk8s-app-py.js +1 -1
- package/lib/cdk8s/cdk8s-app-ts.js +1 -1
- package/lib/cdk8s/cdk8s-construct.js +1 -1
- package/lib/cdk8s/cdk8s-deps-py.js +1 -1
- package/lib/cdk8s/cdk8s-deps.js +1 -1
- package/lib/cdk8s/integration-test.js +1 -1
- package/lib/cdktf/cdktf-construct.js +1 -1
- package/lib/circleci/circleci.js +1 -1
- package/lib/component.js +1 -1
- package/lib/dependencies.js +1 -1
- package/lib/dev-env.js +1 -1
- package/lib/docker-compose/docker-compose-service.js +1 -1
- package/lib/docker-compose/docker-compose.js +1 -1
- package/lib/file.js +1 -1
- package/lib/gitattributes.js +1 -1
- package/lib/github/actions-provider.js +1 -1
- package/lib/github/auto-approve.js +1 -1
- package/lib/github/auto-merge.js +1 -1
- package/lib/github/auto-queue.js +1 -1
- package/lib/github/dependabot.js +1 -1
- package/lib/github/dependency-review.js +1 -1
- package/lib/github/github-credentials.js +1 -1
- package/lib/github/github-project.js +1 -1
- package/lib/github/github.js +1 -1
- package/lib/github/merge-queue.js +1 -1
- package/lib/github/mergify.js +1 -1
- package/lib/github/pr-template.js +1 -1
- package/lib/github/pull-request-backport.js +1 -1
- package/lib/github/pull-request-lint.js +1 -1
- package/lib/github/stale.js +1 -1
- package/lib/github/task-workflow-job.js +1 -1
- package/lib/github/task-workflow.js +1 -1
- package/lib/github/workflow-actions.js +1 -1
- package/lib/github/workflow-jobs.js +1 -1
- package/lib/github/workflow-steps.js +1 -1
- package/lib/github/workflows.js +1 -1
- package/lib/gitlab/configuration.js +1 -1
- package/lib/gitlab/gitlab-configuration.js +1 -1
- package/lib/gitlab/nested-configuration.js +1 -1
- package/lib/gitpod.js +1 -1
- package/lib/ignore-file.js +1 -1
- package/lib/ini.js +1 -1
- package/lib/java/java-project.js +1 -1
- package/lib/java/junit.js +1 -1
- package/lib/java/maven-compile.js +1 -1
- package/lib/java/maven-packaging.js +1 -1
- package/lib/java/maven-sample.js +1 -1
- package/lib/java/pom.js +2 -2
- package/lib/java/projenrc.js +1 -1
- package/lib/javascript/biome/biome.js +1 -1
- package/lib/javascript/bundler.js +1 -1
- package/lib/javascript/eslint.js +1 -1
- package/lib/javascript/jest.js +4 -4
- package/lib/javascript/license-checker.js +1 -1
- package/lib/javascript/node-package.js +1 -1
- package/lib/javascript/node-project.js +1 -1
- package/lib/javascript/npm-config.js +1 -1
- package/lib/javascript/prettier.js +1 -1
- package/lib/javascript/projenrc.js +1 -1
- package/lib/javascript/typescript-config.js +2 -2
- package/lib/javascript/upgrade-dependencies.js +2 -2
- package/lib/javascript/yarnrc.js +1 -1
- package/lib/json-patch.js +1 -1
- package/lib/json.js +1 -1
- package/lib/license.js +1 -1
- package/lib/logger.js +1 -1
- package/lib/makefile.js +1 -1
- package/lib/object-file.js +1 -1
- package/lib/project-build.js +1 -1
- package/lib/project-tree.js +1 -1
- package/lib/project.js +1 -1
- package/lib/projects.js +1 -1
- package/lib/projenrc-json.js +2 -2
- package/lib/projenrc.js +1 -1
- package/lib/python/pip.js +1 -1
- package/lib/python/poetry.js +2 -2
- package/lib/python/projenrc.js +1 -1
- package/lib/python/pyproject-toml-file.js +1 -1
- package/lib/python/pytest-sample.js +1 -1
- package/lib/python/pytest.js +1 -1
- package/lib/python/python-project.js +1 -1
- package/lib/python/python-sample.js +1 -1
- package/lib/python/requirements-file.js +1 -1
- package/lib/python/setuppy.js +1 -1
- package/lib/python/setuptools.js +1 -1
- package/lib/python/uv.js +1 -1
- package/lib/python/venv.js +1 -1
- package/lib/readme.js +1 -1
- package/lib/release/publisher.js +1 -1
- package/lib/release/release-trigger.js +1 -1
- package/lib/release/release.js +1 -1
- package/lib/renovatebot.js +1 -1
- package/lib/sample-file.js +2 -2
- package/lib/semver.js +1 -1
- package/lib/source-code.js +1 -1
- package/lib/task-runtime.js +1 -1
- package/lib/task.js +1 -1
- package/lib/tasks.js +1 -1
- package/lib/testing.js +1 -1
- package/lib/textfile.js +1 -1
- package/lib/toml.js +1 -1
- package/lib/typescript/projenrc-ts.js +1 -1
- package/lib/typescript/projenrc.js +1 -1
- package/lib/typescript/typescript-typedoc.js +1 -1
- package/lib/typescript/typescript.js +6 -6
- package/lib/version.js +2 -2
- package/lib/vscode/devcontainer.js +1 -1
- package/lib/vscode/extensions.js +1 -1
- package/lib/vscode/launch-config.js +1 -1
- package/lib/vscode/settings.js +1 -1
- package/lib/vscode/vscode.js +1 -1
- package/lib/web/next.js +3 -3
- package/lib/web/postcss.js +1 -1
- package/lib/web/react.js +4 -4
- package/lib/web/tailwind.js +1 -1
- package/lib/xmlfile.js +1 -1
- package/lib/yaml.js +1 -1
- package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/README.md +10 -15
- package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/lib/enoent.js +1 -1
- package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/lib/parse.js +1 -35
- package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/lib/util/readShebang.js +1 -10
- package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/lib/util/resolveCommand.js +4 -3
- package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/package.json +23 -25
- package/node_modules/execa/index.d.ts +564 -0
- package/node_modules/execa/index.js +268 -0
- package/node_modules/execa/lib/command.js +52 -0
- package/node_modules/execa/lib/error.js +88 -0
- package/node_modules/execa/lib/kill.js +115 -0
- package/node_modules/execa/lib/promise.js +46 -0
- package/node_modules/execa/lib/stdio.js +52 -0
- package/node_modules/execa/lib/stream.js +97 -0
- package/node_modules/execa/license +9 -0
- package/node_modules/execa/package.json +74 -0
- package/node_modules/execa/readme.md +663 -0
- package/node_modules/fastq/README.md +0 -2
- package/node_modules/fastq/eslint.config.js +11 -0
- package/node_modules/fastq/example.mjs +0 -2
- package/node_modules/fastq/index.d.ts +2 -0
- package/node_modules/fastq/package.json +5 -9
- package/node_modules/fastq/queue.js +36 -1
- package/node_modules/fastq/test/promise.js +34 -0
- package/node_modules/fastq/test/test.js +80 -0
- package/node_modules/get-stream/buffer-stream.js +52 -0
- package/node_modules/get-stream/index.d.ts +105 -0
- package/node_modules/get-stream/index.js +61 -0
- package/node_modules/get-stream/license +9 -0
- package/node_modules/{shelljs/node_modules/get-stream → get-stream}/package.json +11 -10
- package/node_modules/{shelljs/node_modules/get-stream → get-stream}/readme.md +19 -18
- package/node_modules/human-signals/LICENSE +201 -0
- package/node_modules/human-signals/README.md +165 -0
- package/node_modules/human-signals/build/src/core.js +273 -0
- package/node_modules/human-signals/build/src/core.js.map +1 -0
- package/node_modules/human-signals/build/src/main.d.ts +52 -0
- package/node_modules/human-signals/build/src/main.js +71 -0
- package/node_modules/human-signals/build/src/main.js.map +1 -0
- package/node_modules/human-signals/build/src/realtime.js +19 -0
- package/node_modules/human-signals/build/src/realtime.js.map +1 -0
- package/node_modules/human-signals/build/src/signals.js +35 -0
- package/node_modules/human-signals/build/src/signals.js.map +1 -0
- package/node_modules/human-signals/package.json +64 -0
- package/node_modules/is-stream/index.d.ts +79 -0
- package/node_modules/is-stream/index.js +28 -0
- package/node_modules/is-stream/license +9 -0
- package/node_modules/is-stream/package.json +42 -0
- package/node_modules/is-stream/readme.md +60 -0
- package/node_modules/js-yaml/README.md +4 -20
- package/node_modules/js-yaml/bin/js-yaml.js +53 -62
- package/node_modules/js-yaml/dist/js-yaml.js +2404 -3880
- package/node_modules/js-yaml/dist/js-yaml.js.map +1 -0
- package/node_modules/js-yaml/dist/js-yaml.min.js +33 -2
- package/node_modules/js-yaml/dist/js-yaml.min.js.map +1 -0
- package/node_modules/js-yaml/dist/js-yaml.mjs +2381 -3855
- package/node_modules/js-yaml/dist/js-yaml.mjs.map +1 -0
- package/node_modules/js-yaml/index.js +32 -35
- package/node_modules/js-yaml/lib/common.js +28 -37
- package/node_modules/js-yaml/lib/dumper.js +450 -478
- package/node_modules/js-yaml/lib/exception.js +23 -27
- package/node_modules/js-yaml/lib/index_vite_proxy.tmp.mjs +37 -0
- package/node_modules/js-yaml/lib/loader.js +927 -866
- package/node_modules/js-yaml/lib/schema/core.js +2 -4
- package/node_modules/js-yaml/lib/schema/default.js +2 -4
- package/node_modules/js-yaml/lib/schema/failsafe.js +3 -6
- package/node_modules/js-yaml/lib/schema/json.js +2 -4
- package/node_modules/js-yaml/lib/schema.js +56 -68
- package/node_modules/js-yaml/lib/snippet.js +47 -52
- package/node_modules/js-yaml/lib/type/binary.js +61 -64
- package/node_modules/js-yaml/lib/type/bool.js +14 -14
- package/node_modules/js-yaml/lib/type/float.js +47 -45
- package/node_modules/js-yaml/lib/type/int.js +65 -79
- package/node_modules/js-yaml/lib/type/map.js +4 -4
- package/node_modules/js-yaml/lib/type/merge.js +5 -5
- package/node_modules/js-yaml/lib/type/null.js +16 -16
- package/node_modules/js-yaml/lib/type/omap.js +22 -21
- package/node_modules/js-yaml/lib/type/pairs.js +24 -27
- package/node_modules/js-yaml/lib/type/seq.js +4 -4
- package/node_modules/js-yaml/lib/type/set.js +12 -12
- package/node_modules/js-yaml/lib/type/str.js +4 -4
- package/node_modules/js-yaml/lib/type/timestamp.js +53 -53
- package/node_modules/js-yaml/lib/type.js +30 -30
- package/node_modules/js-yaml/package.json +32 -21
- package/node_modules/{nice-try → merge-stream}/LICENSE +1 -1
- package/node_modules/merge-stream/README.md +78 -0
- package/node_modules/merge-stream/index.js +41 -0
- package/node_modules/merge-stream/package.json +19 -0
- package/node_modules/mimic-fn/index.d.ts +54 -0
- package/node_modules/mimic-fn/index.js +13 -0
- package/node_modules/mimic-fn/package.json +42 -0
- package/node_modules/mimic-fn/readme.md +69 -0
- package/node_modules/npm-run-path/index.d.ts +89 -0
- package/node_modules/npm-run-path/index.js +47 -0
- package/node_modules/npm-run-path/package.json +44 -0
- package/node_modules/{shelljs/node_modules/npm-run-path → npm-run-path}/readme.md +39 -5
- package/node_modules/onetime/index.d.ts +64 -0
- package/node_modules/onetime/index.js +44 -0
- package/node_modules/onetime/license +9 -0
- package/node_modules/onetime/package.json +43 -0
- package/node_modules/onetime/readme.md +94 -0
- package/node_modules/path-key/index.d.ts +40 -0
- package/node_modules/path-key/index.js +16 -0
- package/node_modules/path-key/license +9 -0
- package/node_modules/path-key/package.json +39 -0
- package/node_modules/{shelljs/node_modules/path-key → path-key}/readme.md +15 -5
- package/node_modules/semver/classes/range.js +9 -0
- package/node_modules/semver/package.json +1 -1
- package/node_modules/shebang-command/index.js +19 -0
- package/node_modules/shebang-command/license +9 -0
- package/node_modules/shebang-command/package.json +34 -0
- package/node_modules/{shelljs/node_modules/shebang-command → shebang-command}/readme.md +1 -6
- package/node_modules/shebang-regex/index.d.ts +22 -0
- package/node_modules/shebang-regex/index.js +2 -0
- package/node_modules/shebang-regex/license +9 -0
- package/node_modules/shebang-regex/package.json +35 -0
- package/node_modules/shebang-regex/readme.md +33 -0
- package/node_modules/shelljs/README.md +7 -1
- package/node_modules/shelljs/global.js +4 -1
- package/node_modules/shelljs/package.json +8 -13
- package/node_modules/shelljs/shell.js +9 -7
- package/node_modules/shelljs/src/cat.js +1 -1
- package/node_modules/shelljs/src/chmod.js +1 -1
- package/node_modules/shelljs/src/cmd.js +25 -9
- package/node_modules/shelljs/src/common.js +11 -8
- package/node_modules/shelljs/src/dirs.js +1 -1
- package/node_modules/shelljs/src/exec.js +6 -6
- package/node_modules/shelljs/src/grep.js +121 -7
- package/node_modules/shelljs/src/head.js +1 -1
- package/node_modules/shelljs/src/ls.js +1 -1
- package/node_modules/shelljs/src/mkdir.js +1 -1
- package/node_modules/shelljs/src/rm.js +1 -1
- package/node_modules/shelljs/src/sed.js +1 -1
- package/node_modules/shelljs/src/sort.js +1 -1
- package/node_modules/shelljs/src/tail.js +1 -1
- package/node_modules/shelljs/src/tempdir.js +1 -1
- package/node_modules/shelljs/src/test.js +1 -1
- package/node_modules/shelljs/src/to.js +1 -1
- package/node_modules/shelljs/src/toEnd.js +1 -1
- package/node_modules/shelljs/src/touch.js +1 -1
- package/node_modules/shelljs/src/uniq.js +1 -1
- package/node_modules/shelljs/src/which.js +1 -1
- package/node_modules/strip-final-newline/index.js +16 -0
- package/node_modules/strip-final-newline/license +9 -0
- package/node_modules/strip-final-newline/package.json +40 -0
- package/node_modules/strip-final-newline/readme.md +30 -0
- package/node_modules/{shelljs/node_modules/which → which}/README.md +3 -0
- package/node_modules/which/package.json +43 -0
- package/node_modules/which/which.js +125 -0
- package/package.json +4 -1
- package/node_modules/end-of-stream/LICENSE +0 -21
- package/node_modules/end-of-stream/README.md +0 -54
- package/node_modules/end-of-stream/index.js +0 -96
- package/node_modules/end-of-stream/package.json +0 -37
- package/node_modules/fastq/.github/dependabot.yml +0 -11
- package/node_modules/fastq/.github/workflows/ci.yml +0 -75
- package/node_modules/function-bind/.eslintrc +0 -21
- package/node_modules/function-bind/.github/FUNDING.yml +0 -12
- package/node_modules/function-bind/.github/SECURITY.md +0 -3
- package/node_modules/function-bind/.nycrc +0 -13
- package/node_modules/function-bind/CHANGELOG.md +0 -136
- package/node_modules/function-bind/LICENSE +0 -20
- package/node_modules/function-bind/README.md +0 -46
- package/node_modules/function-bind/implementation.js +0 -84
- package/node_modules/function-bind/index.js +0 -5
- package/node_modules/function-bind/package.json +0 -87
- package/node_modules/function-bind/test/.eslintrc +0 -9
- package/node_modules/function-bind/test/index.js +0 -252
- package/node_modules/hasown/.eslintrc +0 -5
- package/node_modules/hasown/.github/FUNDING.yml +0 -12
- package/node_modules/hasown/.nycrc +0 -13
- package/node_modules/hasown/CHANGELOG.md +0 -40
- package/node_modules/hasown/LICENSE +0 -21
- package/node_modules/hasown/README.md +0 -40
- package/node_modules/hasown/index.d.ts +0 -3
- package/node_modules/hasown/index.js +0 -8
- package/node_modules/hasown/package.json +0 -92
- package/node_modules/hasown/tsconfig.json +0 -6
- package/node_modules/interpret/LICENSE +0 -22
- package/node_modules/interpret/README.md +0 -187
- package/node_modules/interpret/index.js +0 -168
- package/node_modules/interpret/mjs-stub.js +0 -1
- package/node_modules/interpret/package.json +0 -75
- package/node_modules/is-core-module/.eslintrc +0 -18
- package/node_modules/is-core-module/.nycrc +0 -9
- package/node_modules/is-core-module/CHANGELOG.md +0 -218
- package/node_modules/is-core-module/LICENSE +0 -20
- package/node_modules/is-core-module/README.md +0 -40
- package/node_modules/is-core-module/core.json +0 -162
- package/node_modules/is-core-module/index.js +0 -69
- package/node_modules/is-core-module/package.json +0 -76
- package/node_modules/is-core-module/test/index.js +0 -157
- package/node_modules/nice-try/README.md +0 -32
- package/node_modules/nice-try/package.json +0 -33
- package/node_modules/nice-try/src/index.js +0 -12
- package/node_modules/once/README.md +0 -79
- package/node_modules/once/once.js +0 -42
- package/node_modules/once/package.json +0 -33
- package/node_modules/p-finally/index.js +0 -15
- package/node_modules/p-finally/license +0 -21
- package/node_modules/p-finally/package.json +0 -42
- package/node_modules/p-finally/readme.md +0 -47
- package/node_modules/path-parse/LICENSE +0 -21
- package/node_modules/path-parse/README.md +0 -42
- package/node_modules/path-parse/index.js +0 -75
- package/node_modules/path-parse/package.json +0 -33
- package/node_modules/pump/.github/FUNDING.yml +0 -2
- package/node_modules/pump/.travis.yml +0 -5
- package/node_modules/pump/LICENSE +0 -21
- package/node_modules/pump/README.md +0 -74
- package/node_modules/pump/SECURITY.md +0 -5
- package/node_modules/pump/index.js +0 -86
- package/node_modules/pump/package.json +0 -24
- package/node_modules/pump/test-browser.js +0 -66
- package/node_modules/pump/test-node.js +0 -53
- package/node_modules/rechoir/.npmignore +0 -1
- package/node_modules/rechoir/.travis.yml +0 -24
- package/node_modules/rechoir/CHANGELOG +0 -38
- package/node_modules/rechoir/LICENSE +0 -22
- package/node_modules/rechoir/README.md +0 -42
- package/node_modules/rechoir/index.js +0 -59
- package/node_modules/rechoir/lib/extension.js +0 -11
- package/node_modules/rechoir/lib/normalize.js +0 -15
- package/node_modules/rechoir/lib/register.js +0 -15
- package/node_modules/rechoir/package.json +0 -88
- package/node_modules/resolve/.editorconfig +0 -37
- package/node_modules/resolve/.eslintrc +0 -65
- package/node_modules/resolve/.github/FUNDING.yml +0 -12
- package/node_modules/resolve/.github/INCIDENT_RESPONSE_PROCESS.md +0 -119
- package/node_modules/resolve/.github/THREAT_MODEL.md +0 -74
- package/node_modules/resolve/LICENSE +0 -21
- package/node_modules/resolve/SECURITY.md +0 -11
- package/node_modules/resolve/async.js +0 -3
- package/node_modules/resolve/bin/resolve +0 -50
- package/node_modules/resolve/example/async.js +0 -5
- package/node_modules/resolve/example/sync.js +0 -3
- package/node_modules/resolve/index.js +0 -6
- package/node_modules/resolve/lib/async.js +0 -333
- package/node_modules/resolve/lib/caller.js +0 -8
- package/node_modules/resolve/lib/core.js +0 -12
- package/node_modules/resolve/lib/core.json +0 -162
- package/node_modules/resolve/lib/homedir.js +0 -24
- package/node_modules/resolve/lib/is-core.js +0 -5
- package/node_modules/resolve/lib/node-modules-paths.js +0 -45
- package/node_modules/resolve/lib/normalize-options.js +0 -10
- package/node_modules/resolve/lib/sync.js +0 -212
- package/node_modules/resolve/package.json +0 -75
- package/node_modules/resolve/readme.markdown +0 -301
- package/node_modules/resolve/sync.js +0 -3
- package/node_modules/resolve/test/core.js +0 -88
- package/node_modules/resolve/test/dotdot/abc/index.js +0 -2
- package/node_modules/resolve/test/dotdot/index.js +0 -1
- package/node_modules/resolve/test/dotdot.js +0 -29
- package/node_modules/resolve/test/faulty_basedir.js +0 -29
- package/node_modules/resolve/test/filter.js +0 -34
- package/node_modules/resolve/test/filter_sync.js +0 -33
- package/node_modules/resolve/test/home_paths.js +0 -127
- package/node_modules/resolve/test/home_paths_sync.js +0 -114
- package/node_modules/resolve/test/mock.js +0 -315
- package/node_modules/resolve/test/mock_sync.js +0 -214
- package/node_modules/resolve/test/module_dir/xmodules/aaa/index.js +0 -1
- package/node_modules/resolve/test/module_dir/ymodules/aaa/index.js +0 -1
- package/node_modules/resolve/test/module_dir/zmodules/bbb/main.js +0 -1
- package/node_modules/resolve/test/module_dir/zmodules/bbb/package.json +0 -3
- package/node_modules/resolve/test/module_dir.js +0 -56
- package/node_modules/resolve/test/node-modules-paths.js +0 -143
- package/node_modules/resolve/test/node_path/x/aaa/index.js +0 -1
- package/node_modules/resolve/test/node_path/x/ccc/index.js +0 -1
- package/node_modules/resolve/test/node_path/y/bbb/index.js +0 -1
- package/node_modules/resolve/test/node_path/y/ccc/index.js +0 -1
- package/node_modules/resolve/test/node_path.js +0 -70
- package/node_modules/resolve/test/nonstring.js +0 -9
- package/node_modules/resolve/test/pathfilter/deep_ref/main.js +0 -0
- package/node_modules/resolve/test/pathfilter.js +0 -75
- package/node_modules/resolve/test/precedence/aaa/index.js +0 -1
- package/node_modules/resolve/test/precedence/aaa/main.js +0 -1
- package/node_modules/resolve/test/precedence/aaa.js +0 -1
- package/node_modules/resolve/test/precedence/bbb/main.js +0 -1
- package/node_modules/resolve/test/precedence/bbb.js +0 -1
- package/node_modules/resolve/test/precedence.js +0 -23
- package/node_modules/resolve/test/resolver/baz/doom.js +0 -0
- package/node_modules/resolve/test/resolver/baz/package.json +0 -4
- package/node_modules/resolve/test/resolver/baz/quux.js +0 -1
- package/node_modules/resolve/test/resolver/browser_field/a.js +0 -0
- package/node_modules/resolve/test/resolver/browser_field/b.js +0 -0
- package/node_modules/resolve/test/resolver/browser_field/package.json +0 -5
- package/node_modules/resolve/test/resolver/cup.coffee +0 -1
- package/node_modules/resolve/test/resolver/dot_main/index.js +0 -1
- package/node_modules/resolve/test/resolver/dot_main/package.json +0 -3
- package/node_modules/resolve/test/resolver/dot_slash_main/index.js +0 -1
- package/node_modules/resolve/test/resolver/dot_slash_main/package.json +0 -3
- package/node_modules/resolve/test/resolver/false_main/index.js +0 -0
- package/node_modules/resolve/test/resolver/false_main/package.json +0 -4
- package/node_modules/resolve/test/resolver/foo.js +0 -1
- package/node_modules/resolve/test/resolver/incorrect_main/index.js +0 -2
- package/node_modules/resolve/test/resolver/incorrect_main/package.json +0 -3
- package/node_modules/resolve/test/resolver/invalid_main/package.json +0 -7
- package/node_modules/resolve/test/resolver/mug.coffee +0 -0
- package/node_modules/resolve/test/resolver/mug.js +0 -0
- package/node_modules/resolve/test/resolver/multirepo/lerna.json +0 -6
- package/node_modules/resolve/test/resolver/multirepo/package.json +0 -20
- package/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js +0 -35
- package/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json +0 -14
- package/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js +0 -0
- package/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json +0 -14
- package/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js +0 -26
- package/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json +0 -15
- package/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js +0 -12
- package/node_modules/resolve/test/resolver/other_path/lib/other-lib.js +0 -0
- package/node_modules/resolve/test/resolver/other_path/root.js +0 -0
- package/node_modules/resolve/test/resolver/quux/foo/index.js +0 -1
- package/node_modules/resolve/test/resolver/same_names/foo/index.js +0 -1
- package/node_modules/resolve/test/resolver/same_names/foo.js +0 -1
- package/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js +0 -0
- package/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep +0 -0
- package/node_modules/resolve/test/resolver/symlinked/package/bar.js +0 -1
- package/node_modules/resolve/test/resolver/symlinked/package/package.json +0 -3
- package/node_modules/resolve/test/resolver/without_basedir/main.js +0 -5
- package/node_modules/resolve/test/resolver.js +0 -597
- package/node_modules/resolve/test/resolver_sync.js +0 -730
- package/node_modules/resolve/test/shadowed_core/node_modules/util/index.js +0 -0
- package/node_modules/resolve/test/shadowed_core.js +0 -54
- package/node_modules/resolve/test/subdirs.js +0 -13
- package/node_modules/resolve/test/symlinks.js +0 -176
- package/node_modules/shelljs/bin/shjs +0 -48
- package/node_modules/shelljs/node_modules/execa/index.js +0 -361
- package/node_modules/shelljs/node_modules/execa/lib/errname.js +0 -39
- package/node_modules/shelljs/node_modules/execa/lib/stdio.js +0 -41
- package/node_modules/shelljs/node_modules/execa/package.json +0 -69
- package/node_modules/shelljs/node_modules/execa/readme.md +0 -327
- package/node_modules/shelljs/node_modules/get-stream/buffer-stream.js +0 -51
- package/node_modules/shelljs/node_modules/get-stream/index.js +0 -50
- package/node_modules/shelljs/node_modules/is-stream/index.js +0 -21
- package/node_modules/shelljs/node_modules/is-stream/license +0 -21
- package/node_modules/shelljs/node_modules/is-stream/package.json +0 -38
- package/node_modules/shelljs/node_modules/is-stream/readme.md +0 -42
- package/node_modules/shelljs/node_modules/npm-run-path/index.js +0 -39
- package/node_modules/shelljs/node_modules/npm-run-path/license +0 -21
- package/node_modules/shelljs/node_modules/npm-run-path/package.json +0 -45
- package/node_modules/shelljs/node_modules/path-key/index.js +0 -13
- package/node_modules/shelljs/node_modules/path-key/license +0 -21
- package/node_modules/shelljs/node_modules/path-key/package.json +0 -39
- package/node_modules/shelljs/node_modules/semver/LICENSE +0 -15
- package/node_modules/shelljs/node_modules/semver/README.md +0 -412
- package/node_modules/shelljs/node_modules/semver/bin/semver +0 -160
- package/node_modules/shelljs/node_modules/semver/package.json +0 -38
- package/node_modules/shelljs/node_modules/semver/range.bnf +0 -16
- package/node_modules/shelljs/node_modules/semver/semver.js +0 -1525
- package/node_modules/shelljs/node_modules/shebang-command/index.js +0 -19
- package/node_modules/shelljs/node_modules/shebang-command/license +0 -21
- package/node_modules/shelljs/node_modules/shebang-command/package.json +0 -39
- package/node_modules/shelljs/node_modules/shebang-regex/index.js +0 -2
- package/node_modules/shelljs/node_modules/shebang-regex/license +0 -21
- package/node_modules/shelljs/node_modules/shebang-regex/package.json +0 -32
- package/node_modules/shelljs/node_modules/shebang-regex/readme.md +0 -29
- package/node_modules/shelljs/node_modules/which/LICENSE +0 -15
- package/node_modules/shelljs/node_modules/which/package.json +0 -30
- package/node_modules/shelljs/node_modules/which/which.js +0 -135
- package/node_modules/strip-eof/index.js +0 -15
- package/node_modules/strip-eof/license +0 -21
- package/node_modules/strip-eof/package.json +0 -39
- package/node_modules/strip-eof/readme.md +0 -28
- package/node_modules/supports-preserve-symlinks-flag/.eslintrc +0 -14
- package/node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml +0 -12
- package/node_modules/supports-preserve-symlinks-flag/.nycrc +0 -9
- package/node_modules/supports-preserve-symlinks-flag/CHANGELOG.md +0 -22
- package/node_modules/supports-preserve-symlinks-flag/LICENSE +0 -21
- package/node_modules/supports-preserve-symlinks-flag/README.md +0 -42
- package/node_modules/supports-preserve-symlinks-flag/browser.js +0 -3
- package/node_modules/supports-preserve-symlinks-flag/index.js +0 -9
- package/node_modules/supports-preserve-symlinks-flag/package.json +0 -70
- package/node_modules/supports-preserve-symlinks-flag/test/index.js +0 -29
- package/node_modules/wrappy/LICENSE +0 -15
- package/node_modules/wrappy/README.md +0 -36
- package/node_modules/wrappy/package.json +0 -29
- package/node_modules/wrappy/wrappy.js +0 -33
- /package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/LICENSE +0 -0
- /package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/index.js +0 -0
- /package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/lib/util/escape.js +0 -0
- /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/LICENSE +0 -0
- /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/README.md +0 -0
- /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/index.js +0 -0
- /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/lib/constants.js +0 -0
- /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/lib/parse.js +0 -0
- /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/lib/picomatch.js +0 -0
- /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/lib/scan.js +0 -0
- /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/lib/utils.js +0 -0
- /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/package.json +0 -0
- /package/node_modules/{shelljs/node_modules/execa → mimic-fn}/license +0 -0
- /package/node_modules/{shelljs/node_modules/get-stream → npm-run-path}/license +0 -0
- /package/node_modules/{once → which}/LICENSE +0 -0
- /package/node_modules/{shelljs/node_modules/which/bin/which → which/bin/node-which} +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fastq",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.1",
|
|
4
4
|
"description": "Fast, in memory work queue",
|
|
5
5
|
"main": "queue.js",
|
|
6
|
+
"type": "commonjs",
|
|
6
7
|
"scripts": {
|
|
7
|
-
"lint": "
|
|
8
|
+
"lint": "eslint .",
|
|
8
9
|
"unit": "nyc --lines 100 --branches 100 --functions 100 --check-coverage --reporter=text tape test/test.js test/promise.js",
|
|
9
10
|
"coverage": "nyc --reporter=html --reporter=cobertura --reporter=text tape test/test.js test/promise.js",
|
|
10
11
|
"test:report": "npm run lint && npm run unit:report",
|
|
@@ -34,20 +35,15 @@
|
|
|
34
35
|
"homepage": "https://github.com/mcollina/fastq#readme",
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"async": "^3.1.0",
|
|
38
|
+
"eslint": "^9.36.0",
|
|
37
39
|
"neo-async": "^2.6.1",
|
|
40
|
+
"neostandard": "^0.12.2",
|
|
38
41
|
"nyc": "^17.0.0",
|
|
39
42
|
"pre-commit": "^1.2.2",
|
|
40
|
-
"snazzy": "^9.0.0",
|
|
41
|
-
"standard": "^16.0.0",
|
|
42
43
|
"tape": "^5.0.0",
|
|
43
44
|
"typescript": "^5.0.4"
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
47
|
"reusify": "^1.0.4"
|
|
47
|
-
},
|
|
48
|
-
"standard": {
|
|
49
|
-
"ignore": [
|
|
50
|
-
"example.mjs"
|
|
51
|
-
]
|
|
52
48
|
}
|
|
53
49
|
}
|
|
@@ -53,7 +53,8 @@ function fastqueue (context, worker, _concurrency) {
|
|
|
53
53
|
empty: noop,
|
|
54
54
|
kill: kill,
|
|
55
55
|
killAndDrain: killAndDrain,
|
|
56
|
-
error: error
|
|
56
|
+
error: error,
|
|
57
|
+
abort: abort
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
return self
|
|
@@ -193,6 +194,40 @@ function fastqueue (context, worker, _concurrency) {
|
|
|
193
194
|
self.drain = noop
|
|
194
195
|
}
|
|
195
196
|
|
|
197
|
+
function abort () {
|
|
198
|
+
var current = queueHead
|
|
199
|
+
queueHead = null
|
|
200
|
+
queueTail = null
|
|
201
|
+
|
|
202
|
+
while (current) {
|
|
203
|
+
var next = current.next
|
|
204
|
+
var callback = current.callback
|
|
205
|
+
var errorHandler = current.errorHandler
|
|
206
|
+
var val = current.value
|
|
207
|
+
var context = current.context
|
|
208
|
+
|
|
209
|
+
// Reset the task state
|
|
210
|
+
current.value = null
|
|
211
|
+
current.callback = noop
|
|
212
|
+
current.errorHandler = null
|
|
213
|
+
|
|
214
|
+
// Call error handler if present
|
|
215
|
+
if (errorHandler) {
|
|
216
|
+
errorHandler(new Error('abort'), val)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Call callback with error
|
|
220
|
+
callback.call(context, new Error('abort'))
|
|
221
|
+
|
|
222
|
+
// Release the task back to the pool
|
|
223
|
+
current.release(current)
|
|
224
|
+
|
|
225
|
+
current = next
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
self.drain = noop
|
|
229
|
+
}
|
|
230
|
+
|
|
196
231
|
function error (handler) {
|
|
197
232
|
errorHandler = handler
|
|
198
233
|
}
|
|
@@ -289,3 +289,37 @@ test('drained should handle undefined drain function', async function (t) {
|
|
|
289
289
|
|
|
290
290
|
t.pass('drained resolved successfully with undefined drain')
|
|
291
291
|
})
|
|
292
|
+
|
|
293
|
+
test('abort rejects all pending promises', async function (t) {
|
|
294
|
+
const queue = buildQueue(worker, 1)
|
|
295
|
+
const promises = []
|
|
296
|
+
let rejectedCount = 0
|
|
297
|
+
|
|
298
|
+
// Pause queue to prevent tasks from starting
|
|
299
|
+
queue.pause()
|
|
300
|
+
|
|
301
|
+
for (let i = 0; i < 10; i++) {
|
|
302
|
+
promises.push(queue.push(i))
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
queue.abort()
|
|
306
|
+
|
|
307
|
+
// All promises should be rejected
|
|
308
|
+
for (const promise of promises) {
|
|
309
|
+
try {
|
|
310
|
+
await promise
|
|
311
|
+
t.fail('promise should have been rejected')
|
|
312
|
+
} catch (err) {
|
|
313
|
+
t.equal(err.message, 'abort', 'error message is abort')
|
|
314
|
+
rejectedCount++
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
t.equal(rejectedCount, 10, 'all promises were rejected')
|
|
319
|
+
t.equal(queue.length(), 0, 'queue is empty')
|
|
320
|
+
|
|
321
|
+
async function worker (arg) {
|
|
322
|
+
await sleep(500)
|
|
323
|
+
return arg
|
|
324
|
+
}
|
|
325
|
+
})
|
|
@@ -651,3 +651,83 @@ test('paused flag', function (t) {
|
|
|
651
651
|
queue.pause()
|
|
652
652
|
t.equal(queue.paused, true)
|
|
653
653
|
})
|
|
654
|
+
|
|
655
|
+
test('abort', function (t) {
|
|
656
|
+
t.plan(11)
|
|
657
|
+
|
|
658
|
+
var queue = buildQueue(worker, 1)
|
|
659
|
+
var abortedTasks = 0
|
|
660
|
+
|
|
661
|
+
var predrain = queue.drain
|
|
662
|
+
|
|
663
|
+
queue.drain = function drain () {
|
|
664
|
+
t.fail('drain should never be called')
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// Pause queue to prevent tasks from starting
|
|
668
|
+
queue.pause()
|
|
669
|
+
queue.push(1, doneAborted)
|
|
670
|
+
queue.push(4, doneAborted)
|
|
671
|
+
queue.unshift(3, doneAborted)
|
|
672
|
+
queue.unshift(2, doneAborted)
|
|
673
|
+
|
|
674
|
+
// Abort all queued tasks
|
|
675
|
+
queue.abort()
|
|
676
|
+
|
|
677
|
+
// Verify state after abort
|
|
678
|
+
t.equal(queue.length(), 0, 'no queued tasks after abort')
|
|
679
|
+
t.equal(queue.drain, predrain, 'drain is back to default')
|
|
680
|
+
|
|
681
|
+
setImmediate(function () {
|
|
682
|
+
t.equal(abortedTasks, 4, 'all queued tasks were aborted')
|
|
683
|
+
})
|
|
684
|
+
|
|
685
|
+
function doneAborted (err) {
|
|
686
|
+
t.ok(err, 'error is present')
|
|
687
|
+
t.equal(err.message, 'abort', 'error message is abort')
|
|
688
|
+
abortedTasks++
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
function worker (arg, cb) {
|
|
692
|
+
t.fail('worker should not be called')
|
|
693
|
+
setImmediate(function () {
|
|
694
|
+
cb(null, true)
|
|
695
|
+
})
|
|
696
|
+
}
|
|
697
|
+
})
|
|
698
|
+
|
|
699
|
+
test('abort with error handler', function (t) {
|
|
700
|
+
t.plan(7)
|
|
701
|
+
|
|
702
|
+
var queue = buildQueue(worker, 1)
|
|
703
|
+
var errorHandlerCalled = 0
|
|
704
|
+
|
|
705
|
+
queue.error(function (err, task) {
|
|
706
|
+
t.equal(err.message, 'abort', 'error handler receives abort error')
|
|
707
|
+
t.ok(task !== null, 'error handler receives task value')
|
|
708
|
+
errorHandlerCalled++
|
|
709
|
+
})
|
|
710
|
+
|
|
711
|
+
// Pause queue to prevent tasks from starting
|
|
712
|
+
queue.pause()
|
|
713
|
+
queue.push(1, doneAborted)
|
|
714
|
+
queue.push(2, doneAborted)
|
|
715
|
+
|
|
716
|
+
// Abort all queued tasks
|
|
717
|
+
queue.abort()
|
|
718
|
+
|
|
719
|
+
setImmediate(function () {
|
|
720
|
+
t.equal(errorHandlerCalled, 2, 'error handler called for all aborted tasks')
|
|
721
|
+
})
|
|
722
|
+
|
|
723
|
+
function doneAborted (err) {
|
|
724
|
+
t.ok(err, 'callback receives error')
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
function worker (arg, cb) {
|
|
728
|
+
t.fail('worker should not be called')
|
|
729
|
+
setImmediate(function () {
|
|
730
|
+
cb(null, true)
|
|
731
|
+
})
|
|
732
|
+
}
|
|
733
|
+
})
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const {PassThrough: PassThroughStream} = require('stream');
|
|
3
|
+
|
|
4
|
+
module.exports = options => {
|
|
5
|
+
options = {...options};
|
|
6
|
+
|
|
7
|
+
const {array} = options;
|
|
8
|
+
let {encoding} = options;
|
|
9
|
+
const isBuffer = encoding === 'buffer';
|
|
10
|
+
let objectMode = false;
|
|
11
|
+
|
|
12
|
+
if (array) {
|
|
13
|
+
objectMode = !(encoding || isBuffer);
|
|
14
|
+
} else {
|
|
15
|
+
encoding = encoding || 'utf8';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (isBuffer) {
|
|
19
|
+
encoding = null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const stream = new PassThroughStream({objectMode});
|
|
23
|
+
|
|
24
|
+
if (encoding) {
|
|
25
|
+
stream.setEncoding(encoding);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let length = 0;
|
|
29
|
+
const chunks = [];
|
|
30
|
+
|
|
31
|
+
stream.on('data', chunk => {
|
|
32
|
+
chunks.push(chunk);
|
|
33
|
+
|
|
34
|
+
if (objectMode) {
|
|
35
|
+
length = chunks.length;
|
|
36
|
+
} else {
|
|
37
|
+
length += chunk.length;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
stream.getBufferedValue = () => {
|
|
42
|
+
if (array) {
|
|
43
|
+
return chunks;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return isBuffer ? Buffer.concat(chunks, length) : chunks.join('');
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
stream.getBufferedLength = () => length;
|
|
50
|
+
|
|
51
|
+
return stream;
|
|
52
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/// <reference types="node"/>
|
|
2
|
+
import {Stream} from 'stream';
|
|
3
|
+
|
|
4
|
+
declare class MaxBufferErrorClass extends Error {
|
|
5
|
+
readonly name: 'MaxBufferError';
|
|
6
|
+
constructor();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare namespace getStream {
|
|
10
|
+
interface Options {
|
|
11
|
+
/**
|
|
12
|
+
Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected with a `MaxBufferError` error.
|
|
13
|
+
|
|
14
|
+
@default Infinity
|
|
15
|
+
*/
|
|
16
|
+
readonly maxBuffer?: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface OptionsWithEncoding<EncodingType = BufferEncoding> extends Options {
|
|
20
|
+
/**
|
|
21
|
+
[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream.
|
|
22
|
+
|
|
23
|
+
@default 'utf8'
|
|
24
|
+
*/
|
|
25
|
+
readonly encoding?: EncodingType;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type MaxBufferError = MaxBufferErrorClass;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare const getStream: {
|
|
32
|
+
/**
|
|
33
|
+
Get the `stream` as a string.
|
|
34
|
+
|
|
35
|
+
@returns A promise that resolves when the end event fires on the stream, indicating that there is no more data to be read. The stream is switched to flowing mode.
|
|
36
|
+
|
|
37
|
+
@example
|
|
38
|
+
```
|
|
39
|
+
import * as fs from 'fs';
|
|
40
|
+
import getStream = require('get-stream');
|
|
41
|
+
|
|
42
|
+
(async () => {
|
|
43
|
+
const stream = fs.createReadStream('unicorn.txt');
|
|
44
|
+
|
|
45
|
+
console.log(await getStream(stream));
|
|
46
|
+
// ,,))))))));,
|
|
47
|
+
// __)))))))))))))),
|
|
48
|
+
// \|/ -\(((((''''((((((((.
|
|
49
|
+
// -*-==//////(('' . `)))))),
|
|
50
|
+
// /|\ ))| o ;-. '((((( ,(,
|
|
51
|
+
// ( `| / ) ;))))' ,_))^;(~
|
|
52
|
+
// | | | ,))((((_ _____------~~~-. %,;(;(>';'~
|
|
53
|
+
// o_); ; )))(((` ~---~ `:: \ %%~~)(v;(`('~
|
|
54
|
+
// ; ''''```` `: `:::|\,__,%% );`'; ~
|
|
55
|
+
// | _ ) / `:|`----' `-'
|
|
56
|
+
// ______/\/~ | / /
|
|
57
|
+
// /~;;.____/;;' / ___--,-( `;;;/
|
|
58
|
+
// / // _;______;'------~~~~~ /;;/\ /
|
|
59
|
+
// // | | / ; \;;,\
|
|
60
|
+
// (<_ | ; /',/-----' _>
|
|
61
|
+
// \_| ||_ //~;~~~~~~~~~
|
|
62
|
+
// `\_| (,~~
|
|
63
|
+
// \~\
|
|
64
|
+
// ~~
|
|
65
|
+
})();
|
|
66
|
+
```
|
|
67
|
+
*/
|
|
68
|
+
(stream: Stream, options?: getStream.OptionsWithEncoding): Promise<string>;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
Get the `stream` as a buffer.
|
|
72
|
+
|
|
73
|
+
It honors the `maxBuffer` option as above, but it refers to byte length rather than string length.
|
|
74
|
+
*/
|
|
75
|
+
buffer(
|
|
76
|
+
stream: Stream,
|
|
77
|
+
options?: getStream.Options
|
|
78
|
+
): Promise<Buffer>;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
Get the `stream` as an array of values.
|
|
82
|
+
|
|
83
|
+
It honors both the `maxBuffer` and `encoding` options. The behavior changes slightly based on the encoding chosen:
|
|
84
|
+
|
|
85
|
+
- When `encoding` is unset, it assumes an [object mode stream](https://nodesource.com/blog/understanding-object-streams/) and collects values emitted from `stream` unmodified. In this case `maxBuffer` refers to the number of items in the array (not the sum of their sizes).
|
|
86
|
+
- When `encoding` is set to `buffer`, it collects an array of buffers. `maxBuffer` refers to the summed byte lengths of every buffer in the array.
|
|
87
|
+
- When `encoding` is set to anything else, it collects an array of strings. `maxBuffer` refers to the summed character lengths of every string in the array.
|
|
88
|
+
*/
|
|
89
|
+
array<StreamObjectModeType>(
|
|
90
|
+
stream: Stream,
|
|
91
|
+
options?: getStream.Options
|
|
92
|
+
): Promise<StreamObjectModeType[]>;
|
|
93
|
+
array(
|
|
94
|
+
stream: Stream,
|
|
95
|
+
options: getStream.OptionsWithEncoding<'buffer'>
|
|
96
|
+
): Promise<Buffer[]>;
|
|
97
|
+
array(
|
|
98
|
+
stream: Stream,
|
|
99
|
+
options: getStream.OptionsWithEncoding<BufferEncoding>
|
|
100
|
+
): Promise<string[]>;
|
|
101
|
+
|
|
102
|
+
MaxBufferError: typeof MaxBufferErrorClass;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export = getStream;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const {constants: BufferConstants} = require('buffer');
|
|
3
|
+
const stream = require('stream');
|
|
4
|
+
const {promisify} = require('util');
|
|
5
|
+
const bufferStream = require('./buffer-stream');
|
|
6
|
+
|
|
7
|
+
const streamPipelinePromisified = promisify(stream.pipeline);
|
|
8
|
+
|
|
9
|
+
class MaxBufferError extends Error {
|
|
10
|
+
constructor() {
|
|
11
|
+
super('maxBuffer exceeded');
|
|
12
|
+
this.name = 'MaxBufferError';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async function getStream(inputStream, options) {
|
|
17
|
+
if (!inputStream) {
|
|
18
|
+
throw new Error('Expected a stream');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
options = {
|
|
22
|
+
maxBuffer: Infinity,
|
|
23
|
+
...options
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const {maxBuffer} = options;
|
|
27
|
+
const stream = bufferStream(options);
|
|
28
|
+
|
|
29
|
+
await new Promise((resolve, reject) => {
|
|
30
|
+
const rejectPromise = error => {
|
|
31
|
+
// Don't retrieve an oversized buffer.
|
|
32
|
+
if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
33
|
+
error.bufferedData = stream.getBufferedValue();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
reject(error);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
(async () => {
|
|
40
|
+
try {
|
|
41
|
+
await streamPipelinePromisified(inputStream, stream);
|
|
42
|
+
resolve();
|
|
43
|
+
} catch (error) {
|
|
44
|
+
rejectPromise(error);
|
|
45
|
+
}
|
|
46
|
+
})();
|
|
47
|
+
|
|
48
|
+
stream.on('data', () => {
|
|
49
|
+
if (stream.getBufferedLength() > maxBuffer) {
|
|
50
|
+
rejectPromise(new MaxBufferError());
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return stream.getBufferedValue();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = getStream;
|
|
59
|
+
module.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'});
|
|
60
|
+
module.exports.array = (stream, options) => getStream(stream, {...options, array: true});
|
|
61
|
+
module.exports.MaxBufferError = MaxBufferError;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "get-stream",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "Get a stream as a string, buffer, or array",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "sindresorhus/get-stream",
|
|
7
|
+
"funding": "https://github.com/sponsors/sindresorhus",
|
|
7
8
|
"author": {
|
|
8
9
|
"name": "Sindre Sorhus",
|
|
9
10
|
"email": "sindresorhus@gmail.com",
|
|
10
|
-
"url": "sindresorhus.com"
|
|
11
|
+
"url": "https://sindresorhus.com"
|
|
11
12
|
},
|
|
12
13
|
"engines": {
|
|
13
|
-
"node": ">=
|
|
14
|
+
"node": ">=10"
|
|
14
15
|
},
|
|
15
16
|
"scripts": {
|
|
16
|
-
"test": "xo && ava"
|
|
17
|
+
"test": "xo && ava && tsd"
|
|
17
18
|
},
|
|
18
19
|
"files": [
|
|
19
20
|
"index.js",
|
|
21
|
+
"index.d.ts",
|
|
20
22
|
"buffer-stream.js"
|
|
21
23
|
],
|
|
22
24
|
"keywords": [
|
|
@@ -35,12 +37,11 @@
|
|
|
35
37
|
"array",
|
|
36
38
|
"object"
|
|
37
39
|
],
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"pump": "^3.0.0"
|
|
40
|
-
},
|
|
41
40
|
"devDependencies": {
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
41
|
+
"@types/node": "^14.0.27",
|
|
42
|
+
"ava": "^2.4.0",
|
|
43
|
+
"into-stream": "^5.0.0",
|
|
44
|
+
"tsd": "^0.13.1",
|
|
45
|
+
"xo": "^0.24.0"
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
# get-stream
|
|
1
|
+
# get-stream
|
|
2
2
|
|
|
3
3
|
> Get a stream as a string, buffer, or array
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
## Install
|
|
7
6
|
|
|
8
7
|
```
|
|
9
8
|
$ npm install get-stream
|
|
10
9
|
```
|
|
11
10
|
|
|
12
|
-
|
|
13
11
|
## Usage
|
|
14
12
|
|
|
15
13
|
```js
|
|
@@ -44,40 +42,39 @@ const getStream = require('get-stream');
|
|
|
44
42
|
})();
|
|
45
43
|
```
|
|
46
44
|
|
|
47
|
-
|
|
48
45
|
## API
|
|
49
46
|
|
|
50
47
|
The methods returns a promise that resolves when the `end` event fires on the stream, indicating that there is no more data to be read. The stream is switched to flowing mode.
|
|
51
48
|
|
|
52
|
-
### getStream(stream,
|
|
49
|
+
### getStream(stream, options?)
|
|
53
50
|
|
|
54
51
|
Get the `stream` as a string.
|
|
55
52
|
|
|
56
53
|
#### options
|
|
57
54
|
|
|
58
|
-
Type: `
|
|
55
|
+
Type: `object`
|
|
59
56
|
|
|
60
57
|
##### encoding
|
|
61
58
|
|
|
62
|
-
Type: `string
|
|
63
|
-
Default: `utf8`
|
|
59
|
+
Type: `string`\
|
|
60
|
+
Default: `'utf8'`
|
|
64
61
|
|
|
65
62
|
[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream.
|
|
66
63
|
|
|
67
64
|
##### maxBuffer
|
|
68
65
|
|
|
69
|
-
Type: `number
|
|
66
|
+
Type: `number`\
|
|
70
67
|
Default: `Infinity`
|
|
71
68
|
|
|
72
69
|
Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected with a `getStream.MaxBufferError` error.
|
|
73
70
|
|
|
74
|
-
### getStream.buffer(stream,
|
|
71
|
+
### getStream.buffer(stream, options?)
|
|
75
72
|
|
|
76
73
|
Get the `stream` as a buffer.
|
|
77
74
|
|
|
78
75
|
It honors the `maxBuffer` option as above, but it refers to byte length rather than string length.
|
|
79
76
|
|
|
80
|
-
### getStream.array(stream,
|
|
77
|
+
### getStream.array(stream, options?)
|
|
81
78
|
|
|
82
79
|
Get the `stream` as an array of values.
|
|
83
80
|
|
|
@@ -89,7 +86,6 @@ It honors both the `maxBuffer` and `encoding` options. The behavior changes slig
|
|
|
89
86
|
|
|
90
87
|
- When `encoding` is set to anything else, it collects an array of strings. `maxBuffer` refers to the summed character lengths of every string in the array.
|
|
91
88
|
|
|
92
|
-
|
|
93
89
|
## Errors
|
|
94
90
|
|
|
95
91
|
If the input stream emits an `error` event, the promise will be rejected with the error. The buffered data will be attached to the `bufferedData` property of the error.
|
|
@@ -105,19 +101,24 @@ If the input stream emits an `error` event, the promise will be rejected with th
|
|
|
105
101
|
})()
|
|
106
102
|
```
|
|
107
103
|
|
|
108
|
-
|
|
109
104
|
## FAQ
|
|
110
105
|
|
|
111
106
|
### How is this different from [`concat-stream`](https://github.com/maxogden/concat-stream)?
|
|
112
107
|
|
|
113
108
|
This module accepts a stream instead of being one and returns a promise instead of using a callback. The API is simpler and it only supports returning a string, buffer, or array. It doesn't have a fragile type inference. You explicitly choose what you want. And it doesn't depend on the huge `readable-stream` package.
|
|
114
109
|
|
|
115
|
-
|
|
116
110
|
## Related
|
|
117
111
|
|
|
118
112
|
- [get-stdin](https://github.com/sindresorhus/get-stdin) - Get stdin as a string or buffer
|
|
119
113
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
<div align="center">
|
|
117
|
+
<b>
|
|
118
|
+
<a href="https://tidelift.com/subscription/pkg/npm-get-stream?utm_source=npm-get-stream&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
|
119
|
+
</b>
|
|
120
|
+
<br>
|
|
121
|
+
<sub>
|
|
122
|
+
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
|
123
|
+
</sub>
|
|
124
|
+
</div>
|