@dev-sergeev/datalab-kit 0.1.1 → 0.1.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/CHANGELOG.md +14 -0
- package/README.md +26 -8
- package/THIRD_PARTY_NOTICES.md +6 -2
- package/dist/extension.js +8 -1
- package/dist/recap.d.ts +2 -0
- package/dist/recap.js +31 -0
- package/docs/adr/0002-package-delivery.md +2 -0
- package/node_modules/@gotgenes/pi-permission-system/src/authority/permission-prompt-component.ts +0 -11
- package/node_modules/@gotgenes/pi-permission-system/src/config/config-store.ts +0 -5
- package/node_modules/@gotgenes/pi-permission-system/src/index.ts +3 -15
- package/node_modules/@pi-plugins/elapsed/LICENSE +21 -0
- package/node_modules/@pi-plugins/elapsed/README.md +45 -0
- package/node_modules/@pi-plugins/elapsed/dist/index.d.mts +8 -0
- package/node_modules/@pi-plugins/elapsed/dist/index.d.mts.map +1 -0
- package/node_modules/@pi-plugins/elapsed/dist/index.mjs +47 -0
- package/node_modules/@pi-plugins/elapsed/dist/index.mjs.map +1 -0
- package/node_modules/@pi-plugins/elapsed/package.json +65 -0
- package/node_modules/@tifan/pi-recap/README.md +61 -0
- package/node_modules/@tifan/pi-recap/package.json +43 -0
- package/node_modules/@tifan/pi-recap/src/index.ts +584 -0
- package/node_modules/@tifan/pi-recap/src/model-picker.ts +233 -0
- package/node_modules/@tifan/pi-recap/src/models.ts +183 -0
- package/node_modules/@tifan/pi-recap/src/sanitize.ts +119 -0
- package/node_modules/@tifan/pi-recap/src/tui.ts +155 -0
- package/node_modules/@zigai/pi-extension-internals/README.md +24 -0
- package/node_modules/@zigai/pi-extension-internals/dist/editor-enhancer-registry.d.ts +21 -0
- package/node_modules/@zigai/pi-extension-internals/dist/editor-enhancer-registry.js +233 -0
- package/node_modules/@zigai/pi-extension-internals/dist/index.d.ts +6 -0
- package/node_modules/@zigai/pi-extension-internals/dist/index.js +3 -0
- package/node_modules/@zigai/pi-extension-internals/dist/linked-method-patch.d.ts +34 -0
- package/node_modules/@zigai/pi-extension-internals/dist/linked-method-patch.js +272 -0
- package/node_modules/@zigai/pi-extension-internals/dist/pi-internal-import.d.ts +11 -0
- package/node_modules/@zigai/pi-extension-internals/dist/pi-internal-import.js +139 -0
- package/node_modules/@zigai/pi-extension-internals/package.json +41 -0
- package/node_modules/@zigai/pi-extension-settings/LICENSE +21 -0
- package/node_modules/@zigai/pi-extension-settings/README.md +36 -0
- package/node_modules/@zigai/pi-extension-settings/dist/artifacts.d.ts +23 -0
- package/node_modules/@zigai/pi-extension-settings/dist/artifacts.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/artifacts.js +75 -0
- package/node_modules/@zigai/pi-extension-settings/dist/artifacts.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.d.ts +3 -0
- package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.js +5 -0
- package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/cli.d.ts +6 -0
- package/node_modules/@zigai/pi-extension-settings/dist/cli.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/cli.js +87 -0
- package/node_modules/@zigai/pi-extension-settings/dist/cli.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.d.ts +2 -0
- package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.js +2 -0
- package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/definition.d.ts +159 -0
- package/node_modules/@zigai/pi-extension-settings/dist/definition.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/definition.js +248 -0
- package/node_modules/@zigai/pi-extension-settings/dist/definition.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/file-system.d.ts +10 -0
- package/node_modules/@zigai/pi-extension-settings/dist/file-system.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/file-system.js +115 -0
- package/node_modules/@zigai/pi-extension-settings/dist/file-system.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/index.d.ts +2 -0
- package/node_modules/@zigai/pi-extension-settings/dist/index.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/index.js +2 -0
- package/node_modules/@zigai/pi-extension-settings/dist/index.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/json-value.d.ts +18 -0
- package/node_modules/@zigai/pi-extension-settings/dist/json-value.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/json-value.js +56 -0
- package/node_modules/@zigai/pi-extension-settings/dist/json-value.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/paths.d.ts +11 -0
- package/node_modules/@zigai/pi-extension-settings/dist/paths.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/paths.js +23 -0
- package/node_modules/@zigai/pi-extension-settings/dist/paths.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.d.ts +5 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.js +21 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi.d.ts +106 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi.js +122 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi.ts +2537 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi.ts.map +7 -0
- package/node_modules/@zigai/pi-extension-settings/dist/projects.d.ts +10 -0
- package/node_modules/@zigai/pi-extension-settings/dist/projects.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/projects.js +177 -0
- package/node_modules/@zigai/pi-extension-settings/dist/projects.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/runtime.d.ts +40 -0
- package/node_modules/@zigai/pi-extension-settings/dist/runtime.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/runtime.js +158 -0
- package/node_modules/@zigai/pi-extension-settings/dist/runtime.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/runtime.ts +158 -0
- package/node_modules/@zigai/pi-extension-settings/dist/runtime.ts.map +7 -0
- package/node_modules/@zigai/pi-extension-settings/dist/schema-document.d.ts +19 -0
- package/node_modules/@zigai/pi-extension-settings/dist/schema-document.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/schema-document.js +168 -0
- package/node_modules/@zigai/pi-extension-settings/dist/schema-document.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.d.ts +9 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.js +242 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.d.ts +59 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.js +98 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.d.ts +80 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.js +144 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.d.ts +5 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.js +30 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.d.ts +10 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.js +16 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.d.ts +54 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.js +202 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.d.ts +5 -0
- package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.js +9 -0
- package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/docs/generation.md +71 -0
- package/node_modules/@zigai/pi-extension-settings/docs/manual-setup.md +98 -0
- package/node_modules/@zigai/pi-extension-settings/docs/runtime.md +100 -0
- package/node_modules/@zigai/pi-extension-settings/docs/ui-controls.md +31 -0
- package/node_modules/@zigai/pi-extension-settings/package.json +97 -0
- package/node_modules/@zigai/pi-mention-anything/README.md +113 -0
- package/node_modules/@zigai/pi-mention-anything/config.schema.json +313 -0
- package/node_modules/@zigai/pi-mention-anything/docs/command-protocol.md +106 -0
- package/node_modules/@zigai/pi-mention-anything/docs/providers.md +128 -0
- package/node_modules/@zigai/pi-mention-anything/examples/query-command.mjs +96 -0
- package/node_modules/@zigai/pi-mention-anything/examples/recursive-tree.ts +28 -0
- package/node_modules/@zigai/pi-mention-anything/examples/static.ts +28 -0
- package/node_modules/@zigai/pi-mention-anything/examples/tmux.ts +90 -0
- package/node_modules/@zigai/pi-mention-anything/examples/tree-settings.json +25 -0
- package/node_modules/@zigai/pi-mention-anything/package.json +58 -0
- package/node_modules/@zigai/pi-mention-anything/src/api.ts +75 -0
- package/node_modules/@zigai/pi-mention-anything/src/autocomplete.ts +231 -0
- package/node_modules/@zigai/pi-mention-anything/src/chain-autocomplete.ts +596 -0
- package/node_modules/@zigai/pi-mention-anything/src/chain-syntax.ts +345 -0
- package/node_modules/@zigai/pi-mention-anything/src/command-provider.ts +291 -0
- package/node_modules/@zigai/pi-mention-anything/src/configured-source.ts +66 -0
- package/node_modules/@zigai/pi-mention-anything/src/editor.ts +180 -0
- package/node_modules/@zigai/pi-mention-anything/src/expand-mentions.ts +162 -0
- package/node_modules/@zigai/pi-mention-anything/src/index.ts +54 -0
- package/node_modules/@zigai/pi-mention-anything/src/initial-suggestions.ts +190 -0
- package/node_modules/@zigai/pi-mention-anything/src/list-provider.ts +71 -0
- package/node_modules/@zigai/pi-mention-anything/src/mention-hub.ts +307 -0
- package/node_modules/@zigai/pi-mention-anything/src/mention-resolution.ts +374 -0
- package/node_modules/@zigai/pi-mention-anything/src/mention-syntax.ts +105 -0
- package/node_modules/@zigai/pi-mention-anything/src/register-mention.ts +89 -0
- package/node_modules/@zigai/pi-mention-anything/src/rendering.ts +53 -0
- package/node_modules/@zigai/pi-mention-anything/src/selected-items.ts +21 -0
- package/node_modules/@zigai/pi-mention-anything/src/selection-history.ts +135 -0
- package/node_modules/@zigai/pi-mention-anything/src/settings-input.ts +317 -0
- package/node_modules/@zigai/pi-mention-anything/src/settings.prevalidated.ts +57 -0
- package/node_modules/@zigai/pi-mention-anything/src/settings.ts +52 -0
- package/node_modules/@zigai/pi-mention-anything/src/source-contract.ts +174 -0
- package/node_modules/@zigai/pi-mention-anything/src/source-controller.ts +1070 -0
- package/node_modules/@zigai/pi-mention-anything/src/source-runtime.ts +99 -0
- package/node_modules/@zigai/pi-mention-skill/README.md +60 -0
- package/node_modules/@zigai/pi-mention-skill/config.schema.json +81 -0
- package/node_modules/@zigai/pi-mention-skill/package.json +56 -0
- package/node_modules/@zigai/pi-mention-skill/src/index.ts +60 -0
- package/node_modules/@zigai/pi-mention-skill/src/settings-input.ts +74 -0
- package/node_modules/@zigai/pi-mention-skill/src/settings.prevalidated.ts +18 -0
- package/node_modules/@zigai/pi-mention-skill/src/settings.ts +54 -0
- package/node_modules/@zigai/pi-mention-skill/src/skill-commands.ts +18 -0
- package/node_modules/@zigai/pi-mention-skill/src/skill-content.ts +60 -0
- package/node_modules/@zigai/pi-mention-skill/src/skill-provider.ts +105 -0
- package/node_modules/@zigai/pi-mention-skill/src/slash-skill-filter.ts +29 -0
- package/node_modules/argparse/LICENSE +21 -0
- package/node_modules/argparse/README.md +257 -0
- package/node_modules/argparse/index.js +3 -0
- package/node_modules/argparse/lib/action/append/constant.js +47 -0
- package/node_modules/argparse/lib/action/append.js +53 -0
- package/node_modules/argparse/lib/action/count.js +40 -0
- package/node_modules/argparse/lib/action/help.js +47 -0
- package/node_modules/argparse/lib/action/store/constant.js +43 -0
- package/node_modules/argparse/lib/action/store/false.js +27 -0
- package/node_modules/argparse/lib/action/store/true.js +26 -0
- package/node_modules/argparse/lib/action/store.js +50 -0
- package/node_modules/argparse/lib/action/subparsers.js +149 -0
- package/node_modules/argparse/lib/action/version.js +47 -0
- package/node_modules/argparse/lib/action.js +146 -0
- package/node_modules/argparse/lib/action_container.js +482 -0
- package/node_modules/argparse/lib/argparse.js +14 -0
- package/node_modules/argparse/lib/argument/error.js +50 -0
- package/node_modules/argparse/lib/argument/exclusive.js +54 -0
- package/node_modules/argparse/lib/argument/group.js +75 -0
- package/node_modules/argparse/lib/argument_parser.js +1161 -0
- package/node_modules/argparse/lib/const.js +21 -0
- package/node_modules/argparse/lib/help/added_formatters.js +87 -0
- package/node_modules/argparse/lib/help/formatter.js +795 -0
- package/node_modules/argparse/lib/namespace.js +76 -0
- package/node_modules/argparse/lib/utils.js +57 -0
- package/node_modules/argparse/package.json +34 -0
- package/node_modules/esprima/LICENSE.BSD +21 -0
- package/node_modules/esprima/README.md +46 -0
- package/node_modules/esprima/bin/esparse.js +139 -0
- package/node_modules/esprima/bin/esvalidate.js +236 -0
- package/node_modules/esprima/dist/esprima.js +6709 -0
- package/node_modules/esprima/package.json +112 -0
- package/node_modules/extend-shallow/LICENSE +21 -0
- package/node_modules/extend-shallow/README.md +61 -0
- package/node_modules/extend-shallow/index.js +33 -0
- package/node_modules/extend-shallow/package.json +56 -0
- package/node_modules/graceful-fs/LICENSE +15 -0
- package/node_modules/graceful-fs/README.md +143 -0
- package/node_modules/graceful-fs/clone.js +23 -0
- package/node_modules/graceful-fs/graceful-fs.js +448 -0
- package/node_modules/graceful-fs/legacy-streams.js +118 -0
- package/node_modules/graceful-fs/package.json +53 -0
- package/node_modules/graceful-fs/polyfills.js +355 -0
- package/node_modules/gray-matter/LICENSE +21 -0
- package/node_modules/gray-matter/README.md +565 -0
- package/node_modules/gray-matter/gray-matter.d.ts +114 -0
- package/node_modules/gray-matter/index.js +228 -0
- package/node_modules/gray-matter/lib/defaults.js +18 -0
- package/node_modules/gray-matter/lib/engine.js +30 -0
- package/node_modules/gray-matter/lib/engines.js +54 -0
- package/node_modules/gray-matter/lib/excerpt.js +32 -0
- package/node_modules/gray-matter/lib/parse.js +13 -0
- package/node_modules/gray-matter/lib/stringify.js +56 -0
- package/node_modules/gray-matter/lib/to-file.js +43 -0
- package/node_modules/gray-matter/lib/utils.js +66 -0
- package/node_modules/gray-matter/package.json +127 -0
- package/node_modules/is-extendable/LICENSE +21 -0
- package/node_modules/is-extendable/README.md +72 -0
- package/node_modules/is-extendable/index.js +13 -0
- package/node_modules/is-extendable/package.json +51 -0
- package/node_modules/js-yaml/LICENSE +21 -0
- package/node_modules/js-yaml/README.md +302 -0
- package/node_modules/js-yaml/bin/js-yaml.js +132 -0
- package/node_modules/js-yaml/dist/js-yaml.js +4024 -0
- package/node_modules/js-yaml/dist/js-yaml.min.js +1 -0
- package/node_modules/js-yaml/index.js +7 -0
- package/node_modules/js-yaml/lib/js-yaml/common.js +59 -0
- package/node_modules/js-yaml/lib/js-yaml/dumper.js +850 -0
- package/node_modules/js-yaml/lib/js-yaml/exception.js +43 -0
- package/node_modules/js-yaml/lib/js-yaml/loader.js +1679 -0
- package/node_modules/js-yaml/lib/js-yaml/mark.js +76 -0
- package/node_modules/js-yaml/lib/js-yaml/schema/core.js +18 -0
- package/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +25 -0
- package/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +28 -0
- package/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +17 -0
- package/node_modules/js-yaml/lib/js-yaml/schema/json.js +25 -0
- package/node_modules/js-yaml/lib/js-yaml/schema.js +108 -0
- package/node_modules/js-yaml/lib/js-yaml/type/binary.js +138 -0
- package/node_modules/js-yaml/lib/js-yaml/type/bool.js +35 -0
- package/node_modules/js-yaml/lib/js-yaml/type/float.js +116 -0
- package/node_modules/js-yaml/lib/js-yaml/type/int.js +173 -0
- package/node_modules/js-yaml/lib/js-yaml/type/js/function.js +93 -0
- package/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +60 -0
- package/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +28 -0
- package/node_modules/js-yaml/lib/js-yaml/type/map.js +8 -0
- package/node_modules/js-yaml/lib/js-yaml/type/merge.js +12 -0
- package/node_modules/js-yaml/lib/js-yaml/type/null.js +34 -0
- package/node_modules/js-yaml/lib/js-yaml/type/omap.js +44 -0
- package/node_modules/js-yaml/lib/js-yaml/type/pairs.js +53 -0
- package/node_modules/js-yaml/lib/js-yaml/type/seq.js +8 -0
- package/node_modules/js-yaml/lib/js-yaml/type/set.js +29 -0
- package/node_modules/js-yaml/lib/js-yaml/type/str.js +8 -0
- package/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +88 -0
- package/node_modules/js-yaml/lib/js-yaml/type.js +61 -0
- package/node_modules/js-yaml/lib/js-yaml.js +39 -0
- package/node_modules/js-yaml/package.json +52 -0
- package/node_modules/kind-of/LICENSE +21 -0
- package/node_modules/kind-of/README.md +367 -0
- package/node_modules/kind-of/index.js +129 -0
- package/node_modules/kind-of/package.json +88 -0
- package/node_modules/pi-toggle-skills/README.md +213 -0
- package/node_modules/pi-toggle-skills/package.json +60 -0
- package/node_modules/pi-toggle-skills/src/index.ts +112 -0
- package/node_modules/pi-toggle-skills/src/skill-discovery.ts +258 -0
- package/node_modules/pi-toggle-skills/src/skill-selector.ts +435 -0
- package/node_modules/pi-toggle-skills/toggle-skills.ts +316 -0
- package/node_modules/pi-toggle-skills/vitest.config.ts +15 -0
- package/node_modules/proper-lockfile/LICENSE +21 -0
- package/node_modules/proper-lockfile/README.md +183 -0
- package/node_modules/proper-lockfile/index.js +40 -0
- package/node_modules/proper-lockfile/lib/adapter.js +85 -0
- package/node_modules/proper-lockfile/lib/lockfile.js +342 -0
- package/node_modules/proper-lockfile/lib/mtime-precision.js +55 -0
- package/node_modules/proper-lockfile/node_modules/retry/.npmignore +3 -0
- package/node_modules/proper-lockfile/node_modules/retry/.travis.yml +15 -0
- package/node_modules/proper-lockfile/node_modules/retry/License +21 -0
- package/node_modules/proper-lockfile/node_modules/retry/Makefile +18 -0
- package/node_modules/proper-lockfile/node_modules/retry/README.md +227 -0
- package/node_modules/proper-lockfile/node_modules/retry/equation.gif +0 -0
- package/node_modules/proper-lockfile/node_modules/retry/example/dns.js +31 -0
- package/node_modules/proper-lockfile/node_modules/retry/example/stop.js +40 -0
- package/node_modules/proper-lockfile/node_modules/retry/index.js +1 -0
- package/node_modules/proper-lockfile/node_modules/retry/lib/retry.js +100 -0
- package/node_modules/proper-lockfile/node_modules/retry/lib/retry_operation.js +158 -0
- package/node_modules/proper-lockfile/node_modules/retry/package.json +32 -0
- package/node_modules/proper-lockfile/node_modules/retry/test/common.js +10 -0
- package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-forever.js +24 -0
- package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-retry-operation.js +258 -0
- package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-retry-wrap.js +101 -0
- package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-timeouts.js +69 -0
- package/node_modules/proper-lockfile/package.json +71 -0
- package/node_modules/section-matter/LICENSE +21 -0
- package/node_modules/section-matter/README.md +236 -0
- package/node_modules/section-matter/index.js +136 -0
- package/node_modules/section-matter/package.json +55 -0
- package/node_modules/signal-exit/LICENSE.txt +16 -0
- package/node_modules/signal-exit/README.md +39 -0
- package/node_modules/signal-exit/index.js +202 -0
- package/node_modules/signal-exit/package.json +38 -0
- package/node_modules/signal-exit/signals.js +53 -0
- package/node_modules/sprintf-js/.npmignore +1 -0
- package/node_modules/sprintf-js/LICENSE +24 -0
- package/node_modules/sprintf-js/README.md +88 -0
- package/node_modules/sprintf-js/bower.json +14 -0
- package/node_modules/sprintf-js/demo/angular.html +20 -0
- package/node_modules/sprintf-js/dist/angular-sprintf.min.js +4 -0
- package/node_modules/sprintf-js/dist/angular-sprintf.min.js.map +1 -0
- package/node_modules/sprintf-js/dist/angular-sprintf.min.map +1 -0
- package/node_modules/sprintf-js/dist/sprintf.min.js +4 -0
- package/node_modules/sprintf-js/dist/sprintf.min.js.map +1 -0
- package/node_modules/sprintf-js/dist/sprintf.min.map +1 -0
- package/node_modules/sprintf-js/gruntfile.js +36 -0
- package/node_modules/sprintf-js/package.json +22 -0
- package/node_modules/sprintf-js/src/angular-sprintf.js +18 -0
- package/node_modules/sprintf-js/src/sprintf.js +208 -0
- package/node_modules/sprintf-js/test/test.js +82 -0
- package/node_modules/strip-bom-string/LICENSE +21 -0
- package/node_modules/strip-bom-string/README.md +66 -0
- package/node_modules/strip-bom-string/index.js +15 -0
- package/node_modules/strip-bom-string/package.json +60 -0
- package/package.json +13 -4
- package/dist/confirmation.d.ts +0 -33
- package/dist/confirmation.js +0 -64
- package/dist/yolo.d.ts +0 -6
- package/dist/yolo.js +0 -33
|
@@ -0,0 +1,2537 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
+
});
|
|
13
|
+
var __esm = (fn, res, err) => function __init() {
|
|
14
|
+
if (err) throw err[0];
|
|
15
|
+
try {
|
|
16
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw err = [e], e;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
22
|
+
try {
|
|
23
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
24
|
+
} catch (e) {
|
|
25
|
+
throw mod = 0, e;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var __export = (target, all) => {
|
|
29
|
+
for (var name in all)
|
|
30
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
31
|
+
};
|
|
32
|
+
var __copyProps = (to, from, except, desc) => {
|
|
33
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
34
|
+
for (let key of __getOwnPropNames(from))
|
|
35
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
36
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
37
|
+
}
|
|
38
|
+
return to;
|
|
39
|
+
};
|
|
40
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
41
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
42
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
43
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
44
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
45
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
46
|
+
mod
|
|
47
|
+
));
|
|
48
|
+
|
|
49
|
+
// src/typebox-runtime.ts
|
|
50
|
+
import * as typebox from "typebox";
|
|
51
|
+
import { Value as typeboxValue } from "typebox/value";
|
|
52
|
+
var Typebox, Type2, Value;
|
|
53
|
+
var init_typebox_runtime = __esm({
|
|
54
|
+
"src/typebox-runtime.ts"() {
|
|
55
|
+
"use strict";
|
|
56
|
+
Typebox = typebox;
|
|
57
|
+
Type2 = typebox.Type;
|
|
58
|
+
Value = typeboxValue;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// src/file-system.ts
|
|
63
|
+
import { randomUUID } from "node:crypto";
|
|
64
|
+
import {
|
|
65
|
+
linkSync,
|
|
66
|
+
lstatSync,
|
|
67
|
+
mkdirSync,
|
|
68
|
+
readFileSync,
|
|
69
|
+
renameSync,
|
|
70
|
+
rmSync,
|
|
71
|
+
writeFileSync
|
|
72
|
+
} from "node:fs";
|
|
73
|
+
import { chmod, mkdir, open, readFile, rename, rm, stat } from "node:fs/promises";
|
|
74
|
+
import { basename, dirname, join as join3 } from "node:path";
|
|
75
|
+
function errorCode(cause) {
|
|
76
|
+
return Value.Check(CodedErrorSchema, cause) ? cause.code : void 0;
|
|
77
|
+
}
|
|
78
|
+
function readTextIfPresent(path) {
|
|
79
|
+
try {
|
|
80
|
+
return readFileSync(path, "utf8");
|
|
81
|
+
} catch (cause) {
|
|
82
|
+
if (cause instanceof Error && errorCode(cause) === "ENOENT") return void 0;
|
|
83
|
+
throw cause;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async function readTextIfPresentAsync(path) {
|
|
87
|
+
try {
|
|
88
|
+
return await readFile(path, "utf8");
|
|
89
|
+
} catch (cause) {
|
|
90
|
+
if (cause instanceof Error && errorCode(cause) === "ENOENT") return void 0;
|
|
91
|
+
throw cause;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function writeTextIfMissing(path, produceContent, mode = 384) {
|
|
95
|
+
if (lstatSync(path, { throwIfNoEntry: false }) !== void 0) return "unchanged";
|
|
96
|
+
const directory = dirname(path);
|
|
97
|
+
const temporaryPath = join3(directory, `.${basename(path)}.${randomUUID()}.tmp`);
|
|
98
|
+
try {
|
|
99
|
+
mkdirSync(directory, { recursive: true });
|
|
100
|
+
writeFileSync(temporaryPath, produceContent(), { encoding: "utf8", flag: "wx", mode });
|
|
101
|
+
try {
|
|
102
|
+
linkSync(temporaryPath, path);
|
|
103
|
+
return "created";
|
|
104
|
+
} catch (cause) {
|
|
105
|
+
if (cause instanceof Error && errorCode(cause) === "EEXIST") return "unchanged";
|
|
106
|
+
throw cause;
|
|
107
|
+
}
|
|
108
|
+
} finally {
|
|
109
|
+
try {
|
|
110
|
+
rmSync(temporaryPath, { force: true });
|
|
111
|
+
} catch {
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function writeTextAtomically(path, content, mode = 420) {
|
|
116
|
+
const current = readTextIfPresent(path);
|
|
117
|
+
if (current === content) return "unchanged";
|
|
118
|
+
const directory = dirname(path);
|
|
119
|
+
const temporaryPath = join3(directory, `.${basename(path)}.${randomUUID()}.tmp`);
|
|
120
|
+
try {
|
|
121
|
+
mkdirSync(directory, { recursive: true });
|
|
122
|
+
writeFileSync(temporaryPath, content, { encoding: "utf8", flag: "wx", mode });
|
|
123
|
+
renameSync(temporaryPath, path);
|
|
124
|
+
return current === void 0 ? "created" : "updated";
|
|
125
|
+
} finally {
|
|
126
|
+
try {
|
|
127
|
+
rmSync(temporaryPath, { force: true });
|
|
128
|
+
} catch {
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async function writeTextAtomicallyAsync(path, content, defaultMode = 384) {
|
|
133
|
+
let mode = defaultMode;
|
|
134
|
+
try {
|
|
135
|
+
mode = (await stat(path)).mode & 511;
|
|
136
|
+
} catch (cause) {
|
|
137
|
+
if (!(cause instanceof Error) || errorCode(cause) !== "ENOENT") throw cause;
|
|
138
|
+
}
|
|
139
|
+
const directory = dirname(path);
|
|
140
|
+
const temporaryPath = join3(directory, `.${basename(path)}.${randomUUID()}.tmp`);
|
|
141
|
+
await mkdir(directory, { recursive: true });
|
|
142
|
+
try {
|
|
143
|
+
const handle = await open(temporaryPath, "wx", mode);
|
|
144
|
+
try {
|
|
145
|
+
await handle.writeFile(content, { encoding: "utf8" });
|
|
146
|
+
await handle.sync();
|
|
147
|
+
} finally {
|
|
148
|
+
await handle.close();
|
|
149
|
+
}
|
|
150
|
+
await chmod(temporaryPath, mode);
|
|
151
|
+
await rename(temporaryPath, path);
|
|
152
|
+
} finally {
|
|
153
|
+
try {
|
|
154
|
+
await rm(temporaryPath, { force: true });
|
|
155
|
+
} catch {
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
var CodedErrorSchema;
|
|
160
|
+
var init_file_system = __esm({
|
|
161
|
+
"src/file-system.ts"() {
|
|
162
|
+
"use strict";
|
|
163
|
+
init_typebox_runtime();
|
|
164
|
+
CodedErrorSchema = Type2.Object({ code: Type2.String() });
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
// src/json-value.ts
|
|
169
|
+
function isPlainJsonObject(value) {
|
|
170
|
+
if (!Value.Check(JsonObjectCandidateSchema, value)) return false;
|
|
171
|
+
const prototype = Reflect.getPrototypeOf(value);
|
|
172
|
+
return (prototype === Object.prototype || prototype === null) && Object.getOwnPropertySymbols(value).length === 0;
|
|
173
|
+
}
|
|
174
|
+
function isJsonString(value) {
|
|
175
|
+
return Value.Check(JsonStringSchema, value);
|
|
176
|
+
}
|
|
177
|
+
function isJsonObject(value) {
|
|
178
|
+
return value !== void 0 && isPlainJsonObject(value);
|
|
179
|
+
}
|
|
180
|
+
function cloneJson(value) {
|
|
181
|
+
return structuredClone(value);
|
|
182
|
+
}
|
|
183
|
+
function parseJson(text) {
|
|
184
|
+
try {
|
|
185
|
+
return Value.Parse(JsonValueSchema, JSON.parse(text));
|
|
186
|
+
} catch {
|
|
187
|
+
return void 0;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function formatJson(value) {
|
|
191
|
+
return `${JSON.stringify(value, void 0, 2)}
|
|
192
|
+
`;
|
|
193
|
+
}
|
|
194
|
+
var ArrayType, BooleanType, Cyclic, Null, NumberType, RecordType, Ref, Refine, StringType, Union, Unknown, Unsafe, JsonObjectCandidateSchema, JsonValueSchema, JsonBooleanSchema, JsonNumberSchema, JsonStringSchema;
|
|
195
|
+
var init_json_value = __esm({
|
|
196
|
+
"src/json-value.ts"() {
|
|
197
|
+
"use strict";
|
|
198
|
+
init_typebox_runtime();
|
|
199
|
+
({
|
|
200
|
+
Array: ArrayType,
|
|
201
|
+
Boolean: BooleanType,
|
|
202
|
+
Cyclic,
|
|
203
|
+
Null,
|
|
204
|
+
Number: NumberType,
|
|
205
|
+
Record: RecordType,
|
|
206
|
+
Ref,
|
|
207
|
+
Refine,
|
|
208
|
+
String: StringType,
|
|
209
|
+
Union,
|
|
210
|
+
Unknown,
|
|
211
|
+
Unsafe
|
|
212
|
+
} = Typebox);
|
|
213
|
+
JsonObjectCandidateSchema = RecordType(StringType(), Unknown());
|
|
214
|
+
JsonValueSchema = Unsafe(
|
|
215
|
+
Cyclic(
|
|
216
|
+
{
|
|
217
|
+
JsonValue: Union([
|
|
218
|
+
Null(),
|
|
219
|
+
BooleanType(),
|
|
220
|
+
NumberType(),
|
|
221
|
+
StringType(),
|
|
222
|
+
ArrayType(Ref("JsonValue")),
|
|
223
|
+
Refine(RecordType(StringType(), Ref("JsonValue")), isPlainJsonObject)
|
|
224
|
+
])
|
|
225
|
+
},
|
|
226
|
+
"JsonValue"
|
|
227
|
+
)
|
|
228
|
+
);
|
|
229
|
+
JsonBooleanSchema = BooleanType();
|
|
230
|
+
JsonNumberSchema = NumberType();
|
|
231
|
+
JsonStringSchema = StringType();
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
// src/schema-document.ts
|
|
236
|
+
function makeSettingsObjectPartial(schema) {
|
|
237
|
+
const transformed = {};
|
|
238
|
+
for (const [key, value] of Object.entries(schema)) {
|
|
239
|
+
if (key === "required") continue;
|
|
240
|
+
if (key === "properties" && isJsonObject(value)) {
|
|
241
|
+
const properties = {};
|
|
242
|
+
for (const [name, child] of Object.entries(value)) {
|
|
243
|
+
properties[name] = isJsonObject(child) && child.type === "object" && isJsonObject(child.properties) ? makeSettingsObjectPartial(child) : cloneJson(child);
|
|
244
|
+
}
|
|
245
|
+
transformed[key] = properties;
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
transformed[key] = cloneJson(value);
|
|
249
|
+
}
|
|
250
|
+
return transformed;
|
|
251
|
+
}
|
|
252
|
+
function stripTypeBoxMetadata(value) {
|
|
253
|
+
if (Array.isArray(value)) return value.map(stripTypeBoxMetadata);
|
|
254
|
+
if (!isJsonObject(value)) return value;
|
|
255
|
+
const sanitized = {};
|
|
256
|
+
for (const [key, child] of Object.entries(value)) {
|
|
257
|
+
if (key.startsWith("~")) continue;
|
|
258
|
+
sanitized[key] = stripTypeBoxMetadata(child);
|
|
259
|
+
}
|
|
260
|
+
return sanitized;
|
|
261
|
+
}
|
|
262
|
+
function schemaRecord(schema) {
|
|
263
|
+
const serialized = JSON.stringify(schema);
|
|
264
|
+
if (serialized === void 0) {
|
|
265
|
+
throw new TypeError("The TypeBox schema is not JSON serializable.");
|
|
266
|
+
}
|
|
267
|
+
const parsed = parseJson(serialized);
|
|
268
|
+
if (!isJsonObject(parsed)) {
|
|
269
|
+
throw new TypeError("The TypeBox settings schema must serialize to a JSON object.");
|
|
270
|
+
}
|
|
271
|
+
return stripTypeBoxMetadata(parsed);
|
|
272
|
+
}
|
|
273
|
+
function createSettingsFileSchema(input) {
|
|
274
|
+
const partial = makeSettingsObjectPartial(schemaRecord(input.schema));
|
|
275
|
+
if (!isJsonObject(partial.properties)) {
|
|
276
|
+
throw new TypeError("The TypeBox settings schema must be an object with properties.");
|
|
277
|
+
}
|
|
278
|
+
const properties = {};
|
|
279
|
+
properties.$schema = {
|
|
280
|
+
type: "string",
|
|
281
|
+
default: `./schemas/${input.id}.schema.json`,
|
|
282
|
+
description: "JSON Schema used by editors for this settings file."
|
|
283
|
+
};
|
|
284
|
+
for (const [key, value] of Object.entries(partial.properties)) {
|
|
285
|
+
properties[key] = cloneJson(value);
|
|
286
|
+
}
|
|
287
|
+
const schemaKeywords = {};
|
|
288
|
+
for (const [key, value] of Object.entries(partial)) {
|
|
289
|
+
if (["$schema", "$id", "title", "description", "properties", "required"].includes(key)) {
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
schemaKeywords[key] = cloneJson(value);
|
|
293
|
+
}
|
|
294
|
+
return {
|
|
295
|
+
$schema: JSON_SCHEMA_DIALECT,
|
|
296
|
+
$id: input.schemaId,
|
|
297
|
+
title: `${input.title} settings`,
|
|
298
|
+
description: input.description,
|
|
299
|
+
...schemaKeywords,
|
|
300
|
+
type: "object",
|
|
301
|
+
properties,
|
|
302
|
+
additionalProperties: false
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
function createSettingsDocument(id, settings, schemaReference = `./schemas/${id}.schema.json`) {
|
|
306
|
+
const settingsEntries = Object.entries(settings).map(
|
|
307
|
+
([key, value]) => [key, cloneJson(value)]
|
|
308
|
+
);
|
|
309
|
+
return {
|
|
310
|
+
$schema: schemaReference,
|
|
311
|
+
...Object.fromEntries(settingsEntries)
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
function createDefaultSettingsDocument(input) {
|
|
315
|
+
return createSettingsDocument(input.id, input.defaultSettings);
|
|
316
|
+
}
|
|
317
|
+
var JSON_SCHEMA_DIALECT;
|
|
318
|
+
var init_schema_document = __esm({
|
|
319
|
+
"src/schema-document.ts"() {
|
|
320
|
+
"use strict";
|
|
321
|
+
init_json_value();
|
|
322
|
+
JSON_SCHEMA_DIALECT = "https://json-schema.org/draft/2020-12/schema";
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
// src/settings-merge.ts
|
|
327
|
+
function mergeValue(current, next) {
|
|
328
|
+
if (!isJsonObject(current) || !isJsonObject(next)) return cloneJson(next);
|
|
329
|
+
const merged = {};
|
|
330
|
+
for (const [key, value] of Object.entries(current)) merged[key] = cloneJson(value);
|
|
331
|
+
for (const [key, value] of Object.entries(next)) {
|
|
332
|
+
merged[key] = mergeValue(merged[key], value);
|
|
333
|
+
}
|
|
334
|
+
return merged;
|
|
335
|
+
}
|
|
336
|
+
function settingsLayerFromFile(file) {
|
|
337
|
+
const settings = {};
|
|
338
|
+
for (const [key, value] of Object.entries(file)) {
|
|
339
|
+
if (key === "$schema") continue;
|
|
340
|
+
settings[key] = cloneJson(value);
|
|
341
|
+
}
|
|
342
|
+
return settings;
|
|
343
|
+
}
|
|
344
|
+
function mergeSettings(current, next) {
|
|
345
|
+
const merged = mergeValue(current, next);
|
|
346
|
+
if (!isJsonObject(merged)) {
|
|
347
|
+
throw new TypeError("Settings merge unexpectedly produced a non-object value.");
|
|
348
|
+
}
|
|
349
|
+
return merged;
|
|
350
|
+
}
|
|
351
|
+
var init_settings_merge = __esm({
|
|
352
|
+
"src/settings-merge.ts"() {
|
|
353
|
+
"use strict";
|
|
354
|
+
init_json_value();
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
// src/settings-layer.ts
|
|
359
|
+
function settingsValidationIssues(schema, value) {
|
|
360
|
+
return [...Value.Errors(schema, value)].map((issue) => ({
|
|
361
|
+
path: issue.instancePath === "" ? "/" : issue.instancePath,
|
|
362
|
+
message: issue.message
|
|
363
|
+
}));
|
|
364
|
+
}
|
|
365
|
+
function parseSettingsLayer(path, scope, text, layerSchema) {
|
|
366
|
+
const parsed = parseJson(text);
|
|
367
|
+
if (parsed === void 0) {
|
|
368
|
+
return {
|
|
369
|
+
settings: void 0,
|
|
370
|
+
schemaReference: void 0,
|
|
371
|
+
diagnostics: [
|
|
372
|
+
{
|
|
373
|
+
code: "config-malformed",
|
|
374
|
+
severity: "error",
|
|
375
|
+
scope,
|
|
376
|
+
path,
|
|
377
|
+
message: `${scope} settings contain malformed JSON and were ignored`
|
|
378
|
+
}
|
|
379
|
+
]
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
if (!Value.Check(layerSchema, parsed)) {
|
|
383
|
+
return {
|
|
384
|
+
settings: void 0,
|
|
385
|
+
schemaReference: void 0,
|
|
386
|
+
diagnostics: [
|
|
387
|
+
{
|
|
388
|
+
code: "config-invalid",
|
|
389
|
+
severity: "error",
|
|
390
|
+
scope,
|
|
391
|
+
path,
|
|
392
|
+
message: `${scope} settings do not match the extension schema and were ignored`,
|
|
393
|
+
issues: settingsValidationIssues(layerSchema, parsed)
|
|
394
|
+
}
|
|
395
|
+
]
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
const schemaReference = isJsonObject(parsed) && isJsonString(parsed.$schema) ? parsed.$schema : void 0;
|
|
399
|
+
try {
|
|
400
|
+
const decoded = Value.Decode(layerSchema, parsed);
|
|
401
|
+
const decodedJson = Value.Parse(JsonValueSchema, decoded);
|
|
402
|
+
if (!isJsonObject(decodedJson)) {
|
|
403
|
+
return {
|
|
404
|
+
settings: void 0,
|
|
405
|
+
schemaReference,
|
|
406
|
+
diagnostics: [
|
|
407
|
+
{
|
|
408
|
+
code: "config-decode-failed",
|
|
409
|
+
severity: "error",
|
|
410
|
+
scope,
|
|
411
|
+
path,
|
|
412
|
+
message: `${scope} settings did not decode to a JSON object and were ignored`
|
|
413
|
+
}
|
|
414
|
+
]
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
return { settings: settingsLayerFromFile(decodedJson), schemaReference, diagnostics: [] };
|
|
418
|
+
} catch {
|
|
419
|
+
return {
|
|
420
|
+
settings: void 0,
|
|
421
|
+
schemaReference,
|
|
422
|
+
diagnostics: [
|
|
423
|
+
{
|
|
424
|
+
code: "config-decode-failed",
|
|
425
|
+
severity: "error",
|
|
426
|
+
scope,
|
|
427
|
+
path,
|
|
428
|
+
message: `${scope} settings could not be decoded and were ignored`
|
|
429
|
+
}
|
|
430
|
+
]
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
function applySettingsLayer(schema, current, layer, path, scope) {
|
|
435
|
+
if (layer.settings === void 0) return { settings: current };
|
|
436
|
+
const merged = mergeSettings(current, layer.settings);
|
|
437
|
+
if (Value.Check(schema, merged)) return { settings: merged };
|
|
438
|
+
return {
|
|
439
|
+
settings: current,
|
|
440
|
+
diagnostic: {
|
|
441
|
+
code: "config-invalid",
|
|
442
|
+
severity: "error",
|
|
443
|
+
scope,
|
|
444
|
+
path,
|
|
445
|
+
message: `${scope} settings conflict with the resolved configuration and were ignored`,
|
|
446
|
+
issues: settingsValidationIssues(schema, merged)
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
var init_settings_layer = __esm({
|
|
451
|
+
"src/settings-layer.ts"() {
|
|
452
|
+
"use strict";
|
|
453
|
+
init_typebox_runtime();
|
|
454
|
+
init_json_value();
|
|
455
|
+
init_settings_merge();
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
// src/settings-revision.ts
|
|
460
|
+
import { createHash } from "node:crypto";
|
|
461
|
+
function createSettingsRevision(...sources) {
|
|
462
|
+
const hash = createHash("sha256");
|
|
463
|
+
for (const source of sources) {
|
|
464
|
+
if (source === void 0) {
|
|
465
|
+
hash.update("missing\0");
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
const content = Buffer.from(source, "utf8");
|
|
469
|
+
hash.update(`present:${content.byteLength}\0`);
|
|
470
|
+
hash.update(content);
|
|
471
|
+
}
|
|
472
|
+
return `sha256:${hash.digest("hex")}`;
|
|
473
|
+
}
|
|
474
|
+
var init_settings_revision = __esm({
|
|
475
|
+
"src/settings-revision.ts"() {
|
|
476
|
+
"use strict";
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
// node_modules/graceful-fs/polyfills.js
|
|
481
|
+
var require_polyfills = __commonJS({
|
|
482
|
+
"node_modules/graceful-fs/polyfills.js"(exports, module) {
|
|
483
|
+
var constants = __require("constants");
|
|
484
|
+
var origCwd = process.cwd;
|
|
485
|
+
var cwd = null;
|
|
486
|
+
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
487
|
+
process.cwd = function() {
|
|
488
|
+
if (!cwd)
|
|
489
|
+
cwd = origCwd.call(process);
|
|
490
|
+
return cwd;
|
|
491
|
+
};
|
|
492
|
+
try {
|
|
493
|
+
process.cwd();
|
|
494
|
+
} catch (er) {
|
|
495
|
+
}
|
|
496
|
+
if (typeof process.chdir === "function") {
|
|
497
|
+
chdir = process.chdir;
|
|
498
|
+
process.chdir = function(d) {
|
|
499
|
+
cwd = null;
|
|
500
|
+
chdir.call(process, d);
|
|
501
|
+
};
|
|
502
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
|
|
503
|
+
}
|
|
504
|
+
var chdir;
|
|
505
|
+
module.exports = patch;
|
|
506
|
+
function patch(fs) {
|
|
507
|
+
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
508
|
+
patchLchmod(fs);
|
|
509
|
+
}
|
|
510
|
+
if (!fs.lutimes) {
|
|
511
|
+
patchLutimes(fs);
|
|
512
|
+
}
|
|
513
|
+
fs.chown = chownFix(fs.chown);
|
|
514
|
+
fs.fchown = chownFix(fs.fchown);
|
|
515
|
+
fs.lchown = chownFix(fs.lchown);
|
|
516
|
+
fs.chmod = chmodFix(fs.chmod);
|
|
517
|
+
fs.fchmod = chmodFix(fs.fchmod);
|
|
518
|
+
fs.lchmod = chmodFix(fs.lchmod);
|
|
519
|
+
fs.chownSync = chownFixSync(fs.chownSync);
|
|
520
|
+
fs.fchownSync = chownFixSync(fs.fchownSync);
|
|
521
|
+
fs.lchownSync = chownFixSync(fs.lchownSync);
|
|
522
|
+
fs.chmodSync = chmodFixSync(fs.chmodSync);
|
|
523
|
+
fs.fchmodSync = chmodFixSync(fs.fchmodSync);
|
|
524
|
+
fs.lchmodSync = chmodFixSync(fs.lchmodSync);
|
|
525
|
+
fs.stat = statFix(fs.stat);
|
|
526
|
+
fs.fstat = statFix(fs.fstat);
|
|
527
|
+
fs.lstat = statFix(fs.lstat);
|
|
528
|
+
fs.statSync = statFixSync(fs.statSync);
|
|
529
|
+
fs.fstatSync = statFixSync(fs.fstatSync);
|
|
530
|
+
fs.lstatSync = statFixSync(fs.lstatSync);
|
|
531
|
+
if (fs.chmod && !fs.lchmod) {
|
|
532
|
+
fs.lchmod = function(path, mode, cb) {
|
|
533
|
+
if (cb) process.nextTick(cb);
|
|
534
|
+
};
|
|
535
|
+
fs.lchmodSync = function() {
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
if (fs.chown && !fs.lchown) {
|
|
539
|
+
fs.lchown = function(path, uid, gid, cb) {
|
|
540
|
+
if (cb) process.nextTick(cb);
|
|
541
|
+
};
|
|
542
|
+
fs.lchownSync = function() {
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
if (platform === "win32") {
|
|
546
|
+
fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) {
|
|
547
|
+
function rename2(from, to, cb) {
|
|
548
|
+
var start = Date.now();
|
|
549
|
+
var backoff = 0;
|
|
550
|
+
fs$rename(from, to, function CB(er) {
|
|
551
|
+
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
552
|
+
setTimeout(function() {
|
|
553
|
+
fs.stat(to, function(stater, st) {
|
|
554
|
+
if (stater && stater.code === "ENOENT")
|
|
555
|
+
fs$rename(from, to, CB);
|
|
556
|
+
else
|
|
557
|
+
cb(er);
|
|
558
|
+
});
|
|
559
|
+
}, backoff);
|
|
560
|
+
if (backoff < 100)
|
|
561
|
+
backoff += 10;
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
if (cb) cb(er);
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(rename2, fs$rename);
|
|
568
|
+
return rename2;
|
|
569
|
+
})(fs.rename);
|
|
570
|
+
}
|
|
571
|
+
fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) {
|
|
572
|
+
function read(fd, buffer, offset, length, position, callback_) {
|
|
573
|
+
var callback;
|
|
574
|
+
if (callback_ && typeof callback_ === "function") {
|
|
575
|
+
var eagCounter = 0;
|
|
576
|
+
callback = function(er, _, __) {
|
|
577
|
+
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
578
|
+
eagCounter++;
|
|
579
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
580
|
+
}
|
|
581
|
+
callback_.apply(this, arguments);
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
585
|
+
}
|
|
586
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
587
|
+
return read;
|
|
588
|
+
})(fs.read);
|
|
589
|
+
fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ (function(fs$readSync) {
|
|
590
|
+
return function(fd, buffer, offset, length, position) {
|
|
591
|
+
var eagCounter = 0;
|
|
592
|
+
while (true) {
|
|
593
|
+
try {
|
|
594
|
+
return fs$readSync.call(fs, fd, buffer, offset, length, position);
|
|
595
|
+
} catch (er) {
|
|
596
|
+
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
597
|
+
eagCounter++;
|
|
598
|
+
continue;
|
|
599
|
+
}
|
|
600
|
+
throw er;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
})(fs.readSync);
|
|
605
|
+
function patchLchmod(fs2) {
|
|
606
|
+
fs2.lchmod = function(path, mode, callback) {
|
|
607
|
+
fs2.open(
|
|
608
|
+
path,
|
|
609
|
+
constants.O_WRONLY | constants.O_SYMLINK,
|
|
610
|
+
mode,
|
|
611
|
+
function(err, fd) {
|
|
612
|
+
if (err) {
|
|
613
|
+
if (callback) callback(err);
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
fs2.fchmod(fd, mode, function(err2) {
|
|
617
|
+
fs2.close(fd, function(err22) {
|
|
618
|
+
if (callback) callback(err2 || err22);
|
|
619
|
+
});
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
);
|
|
623
|
+
};
|
|
624
|
+
fs2.lchmodSync = function(path, mode) {
|
|
625
|
+
var fd = fs2.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
626
|
+
var threw = true;
|
|
627
|
+
var ret;
|
|
628
|
+
try {
|
|
629
|
+
ret = fs2.fchmodSync(fd, mode);
|
|
630
|
+
threw = false;
|
|
631
|
+
} finally {
|
|
632
|
+
if (threw) {
|
|
633
|
+
try {
|
|
634
|
+
fs2.closeSync(fd);
|
|
635
|
+
} catch (er) {
|
|
636
|
+
}
|
|
637
|
+
} else {
|
|
638
|
+
fs2.closeSync(fd);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
return ret;
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
function patchLutimes(fs2) {
|
|
645
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
|
|
646
|
+
fs2.lutimes = function(path, at, mt, cb) {
|
|
647
|
+
fs2.open(path, constants.O_SYMLINK, function(er, fd) {
|
|
648
|
+
if (er) {
|
|
649
|
+
if (cb) cb(er);
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
fs2.futimes(fd, at, mt, function(er2) {
|
|
653
|
+
fs2.close(fd, function(er22) {
|
|
654
|
+
if (cb) cb(er2 || er22);
|
|
655
|
+
});
|
|
656
|
+
});
|
|
657
|
+
});
|
|
658
|
+
};
|
|
659
|
+
fs2.lutimesSync = function(path, at, mt) {
|
|
660
|
+
var fd = fs2.openSync(path, constants.O_SYMLINK);
|
|
661
|
+
var ret;
|
|
662
|
+
var threw = true;
|
|
663
|
+
try {
|
|
664
|
+
ret = fs2.futimesSync(fd, at, mt);
|
|
665
|
+
threw = false;
|
|
666
|
+
} finally {
|
|
667
|
+
if (threw) {
|
|
668
|
+
try {
|
|
669
|
+
fs2.closeSync(fd);
|
|
670
|
+
} catch (er) {
|
|
671
|
+
}
|
|
672
|
+
} else {
|
|
673
|
+
fs2.closeSync(fd);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
return ret;
|
|
677
|
+
};
|
|
678
|
+
} else if (fs2.futimes) {
|
|
679
|
+
fs2.lutimes = function(_a, _b, _c, cb) {
|
|
680
|
+
if (cb) process.nextTick(cb);
|
|
681
|
+
};
|
|
682
|
+
fs2.lutimesSync = function() {
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
function chmodFix(orig) {
|
|
687
|
+
if (!orig) return orig;
|
|
688
|
+
return function(target, mode, cb) {
|
|
689
|
+
return orig.call(fs, target, mode, function(er) {
|
|
690
|
+
if (chownErOk(er)) er = null;
|
|
691
|
+
if (cb) cb.apply(this, arguments);
|
|
692
|
+
});
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
function chmodFixSync(orig) {
|
|
696
|
+
if (!orig) return orig;
|
|
697
|
+
return function(target, mode) {
|
|
698
|
+
try {
|
|
699
|
+
return orig.call(fs, target, mode);
|
|
700
|
+
} catch (er) {
|
|
701
|
+
if (!chownErOk(er)) throw er;
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
function chownFix(orig) {
|
|
706
|
+
if (!orig) return orig;
|
|
707
|
+
return function(target, uid, gid, cb) {
|
|
708
|
+
return orig.call(fs, target, uid, gid, function(er) {
|
|
709
|
+
if (chownErOk(er)) er = null;
|
|
710
|
+
if (cb) cb.apply(this, arguments);
|
|
711
|
+
});
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
function chownFixSync(orig) {
|
|
715
|
+
if (!orig) return orig;
|
|
716
|
+
return function(target, uid, gid) {
|
|
717
|
+
try {
|
|
718
|
+
return orig.call(fs, target, uid, gid);
|
|
719
|
+
} catch (er) {
|
|
720
|
+
if (!chownErOk(er)) throw er;
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
function statFix(orig) {
|
|
725
|
+
if (!orig) return orig;
|
|
726
|
+
return function(target, options, cb) {
|
|
727
|
+
if (typeof options === "function") {
|
|
728
|
+
cb = options;
|
|
729
|
+
options = null;
|
|
730
|
+
}
|
|
731
|
+
function callback(er, stats) {
|
|
732
|
+
if (stats) {
|
|
733
|
+
if (stats.uid < 0) stats.uid += 4294967296;
|
|
734
|
+
if (stats.gid < 0) stats.gid += 4294967296;
|
|
735
|
+
}
|
|
736
|
+
if (cb) cb.apply(this, arguments);
|
|
737
|
+
}
|
|
738
|
+
return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
function statFixSync(orig) {
|
|
742
|
+
if (!orig) return orig;
|
|
743
|
+
return function(target, options) {
|
|
744
|
+
var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
|
|
745
|
+
if (stats) {
|
|
746
|
+
if (stats.uid < 0) stats.uid += 4294967296;
|
|
747
|
+
if (stats.gid < 0) stats.gid += 4294967296;
|
|
748
|
+
}
|
|
749
|
+
return stats;
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
function chownErOk(er) {
|
|
753
|
+
if (!er)
|
|
754
|
+
return true;
|
|
755
|
+
if (er.code === "ENOSYS")
|
|
756
|
+
return true;
|
|
757
|
+
var nonroot = !process.getuid || process.getuid() !== 0;
|
|
758
|
+
if (nonroot) {
|
|
759
|
+
if (er.code === "EINVAL" || er.code === "EPERM")
|
|
760
|
+
return true;
|
|
761
|
+
}
|
|
762
|
+
return false;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
});
|
|
767
|
+
|
|
768
|
+
// node_modules/graceful-fs/legacy-streams.js
|
|
769
|
+
var require_legacy_streams = __commonJS({
|
|
770
|
+
"node_modules/graceful-fs/legacy-streams.js"(exports, module) {
|
|
771
|
+
var Stream = __require("stream").Stream;
|
|
772
|
+
module.exports = legacy;
|
|
773
|
+
function legacy(fs) {
|
|
774
|
+
return {
|
|
775
|
+
ReadStream,
|
|
776
|
+
WriteStream
|
|
777
|
+
};
|
|
778
|
+
function ReadStream(path, options) {
|
|
779
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
|
|
780
|
+
Stream.call(this);
|
|
781
|
+
var self = this;
|
|
782
|
+
this.path = path;
|
|
783
|
+
this.fd = null;
|
|
784
|
+
this.readable = true;
|
|
785
|
+
this.paused = false;
|
|
786
|
+
this.flags = "r";
|
|
787
|
+
this.mode = 438;
|
|
788
|
+
this.bufferSize = 64 * 1024;
|
|
789
|
+
options = options || {};
|
|
790
|
+
var keys = Object.keys(options);
|
|
791
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
792
|
+
var key = keys[index];
|
|
793
|
+
this[key] = options[key];
|
|
794
|
+
}
|
|
795
|
+
if (this.encoding) this.setEncoding(this.encoding);
|
|
796
|
+
if (this.start !== void 0) {
|
|
797
|
+
if ("number" !== typeof this.start) {
|
|
798
|
+
throw TypeError("start must be a Number");
|
|
799
|
+
}
|
|
800
|
+
if (this.end === void 0) {
|
|
801
|
+
this.end = Infinity;
|
|
802
|
+
} else if ("number" !== typeof this.end) {
|
|
803
|
+
throw TypeError("end must be a Number");
|
|
804
|
+
}
|
|
805
|
+
if (this.start > this.end) {
|
|
806
|
+
throw new Error("start must be <= end");
|
|
807
|
+
}
|
|
808
|
+
this.pos = this.start;
|
|
809
|
+
}
|
|
810
|
+
if (this.fd !== null) {
|
|
811
|
+
process.nextTick(function() {
|
|
812
|
+
self._read();
|
|
813
|
+
});
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
fs.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
817
|
+
if (err) {
|
|
818
|
+
self.emit("error", err);
|
|
819
|
+
self.readable = false;
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
self.fd = fd;
|
|
823
|
+
self.emit("open", fd);
|
|
824
|
+
self._read();
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
function WriteStream(path, options) {
|
|
828
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path, options);
|
|
829
|
+
Stream.call(this);
|
|
830
|
+
this.path = path;
|
|
831
|
+
this.fd = null;
|
|
832
|
+
this.writable = true;
|
|
833
|
+
this.flags = "w";
|
|
834
|
+
this.encoding = "binary";
|
|
835
|
+
this.mode = 438;
|
|
836
|
+
this.bytesWritten = 0;
|
|
837
|
+
options = options || {};
|
|
838
|
+
var keys = Object.keys(options);
|
|
839
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
840
|
+
var key = keys[index];
|
|
841
|
+
this[key] = options[key];
|
|
842
|
+
}
|
|
843
|
+
if (this.start !== void 0) {
|
|
844
|
+
if ("number" !== typeof this.start) {
|
|
845
|
+
throw TypeError("start must be a Number");
|
|
846
|
+
}
|
|
847
|
+
if (this.start < 0) {
|
|
848
|
+
throw new Error("start must be >= zero");
|
|
849
|
+
}
|
|
850
|
+
this.pos = this.start;
|
|
851
|
+
}
|
|
852
|
+
this.busy = false;
|
|
853
|
+
this._queue = [];
|
|
854
|
+
if (this.fd === null) {
|
|
855
|
+
this._open = fs.open;
|
|
856
|
+
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
|
|
857
|
+
this.flush();
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
|
|
864
|
+
// node_modules/graceful-fs/clone.js
|
|
865
|
+
var require_clone = __commonJS({
|
|
866
|
+
"node_modules/graceful-fs/clone.js"(exports, module) {
|
|
867
|
+
"use strict";
|
|
868
|
+
module.exports = clone;
|
|
869
|
+
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
|
|
870
|
+
return obj.__proto__;
|
|
871
|
+
};
|
|
872
|
+
function clone(obj) {
|
|
873
|
+
if (obj === null || typeof obj !== "object")
|
|
874
|
+
return obj;
|
|
875
|
+
if (obj instanceof Object)
|
|
876
|
+
var copy = { __proto__: getPrototypeOf(obj) };
|
|
877
|
+
else
|
|
878
|
+
var copy = /* @__PURE__ */ Object.create(null);
|
|
879
|
+
Object.getOwnPropertyNames(obj).forEach(function(key) {
|
|
880
|
+
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
881
|
+
});
|
|
882
|
+
return copy;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
// node_modules/graceful-fs/graceful-fs.js
|
|
888
|
+
var require_graceful_fs = __commonJS({
|
|
889
|
+
"node_modules/graceful-fs/graceful-fs.js"(exports, module) {
|
|
890
|
+
var fs = __require("fs");
|
|
891
|
+
var polyfills = require_polyfills();
|
|
892
|
+
var legacy = require_legacy_streams();
|
|
893
|
+
var clone = require_clone();
|
|
894
|
+
var util = __require("util");
|
|
895
|
+
var gracefulQueue;
|
|
896
|
+
var previousSymbol;
|
|
897
|
+
if (typeof Symbol === "function" && typeof Symbol.for === "function") {
|
|
898
|
+
gracefulQueue = /* @__PURE__ */ Symbol.for("graceful-fs.queue");
|
|
899
|
+
previousSymbol = /* @__PURE__ */ Symbol.for("graceful-fs.previous");
|
|
900
|
+
} else {
|
|
901
|
+
gracefulQueue = "___graceful-fs.queue";
|
|
902
|
+
previousSymbol = "___graceful-fs.previous";
|
|
903
|
+
}
|
|
904
|
+
function noop() {
|
|
905
|
+
}
|
|
906
|
+
function publishQueue(context, queue2) {
|
|
907
|
+
Object.defineProperty(context, gracefulQueue, {
|
|
908
|
+
get: function() {
|
|
909
|
+
return queue2;
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
var debug = noop;
|
|
914
|
+
if (util.debuglog)
|
|
915
|
+
debug = util.debuglog("gfs4");
|
|
916
|
+
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
|
|
917
|
+
debug = function() {
|
|
918
|
+
var m = util.format.apply(util, arguments);
|
|
919
|
+
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
920
|
+
console.error(m);
|
|
921
|
+
};
|
|
922
|
+
if (!fs[gracefulQueue]) {
|
|
923
|
+
queue = global[gracefulQueue] || [];
|
|
924
|
+
publishQueue(fs, queue);
|
|
925
|
+
fs.close = (function(fs$close) {
|
|
926
|
+
function close(fd, cb) {
|
|
927
|
+
return fs$close.call(fs, fd, function(err) {
|
|
928
|
+
if (!err) {
|
|
929
|
+
resetQueue();
|
|
930
|
+
}
|
|
931
|
+
if (typeof cb === "function")
|
|
932
|
+
cb.apply(this, arguments);
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
Object.defineProperty(close, previousSymbol, {
|
|
936
|
+
value: fs$close
|
|
937
|
+
});
|
|
938
|
+
return close;
|
|
939
|
+
})(fs.close);
|
|
940
|
+
fs.closeSync = (function(fs$closeSync) {
|
|
941
|
+
function closeSync(fd) {
|
|
942
|
+
fs$closeSync.apply(fs, arguments);
|
|
943
|
+
resetQueue();
|
|
944
|
+
}
|
|
945
|
+
Object.defineProperty(closeSync, previousSymbol, {
|
|
946
|
+
value: fs$closeSync
|
|
947
|
+
});
|
|
948
|
+
return closeSync;
|
|
949
|
+
})(fs.closeSync);
|
|
950
|
+
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
951
|
+
process.on("exit", function() {
|
|
952
|
+
debug(fs[gracefulQueue]);
|
|
953
|
+
__require("assert").equal(fs[gracefulQueue].length, 0);
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
var queue;
|
|
958
|
+
if (!global[gracefulQueue]) {
|
|
959
|
+
publishQueue(global, fs[gracefulQueue]);
|
|
960
|
+
}
|
|
961
|
+
module.exports = patch(clone(fs));
|
|
962
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
|
|
963
|
+
module.exports = patch(fs);
|
|
964
|
+
fs.__patched = true;
|
|
965
|
+
}
|
|
966
|
+
function patch(fs2) {
|
|
967
|
+
polyfills(fs2);
|
|
968
|
+
fs2.gracefulify = patch;
|
|
969
|
+
fs2.createReadStream = createReadStream;
|
|
970
|
+
fs2.createWriteStream = createWriteStream;
|
|
971
|
+
var fs$readFile = fs2.readFile;
|
|
972
|
+
fs2.readFile = readFile2;
|
|
973
|
+
function readFile2(path, options, cb) {
|
|
974
|
+
if (typeof options === "function")
|
|
975
|
+
cb = options, options = null;
|
|
976
|
+
return go$readFile(path, options, cb);
|
|
977
|
+
function go$readFile(path2, options2, cb2, startTime) {
|
|
978
|
+
return fs$readFile(path2, options2, function(err) {
|
|
979
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
980
|
+
enqueue([go$readFile, [path2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
981
|
+
else {
|
|
982
|
+
if (typeof cb2 === "function")
|
|
983
|
+
cb2.apply(this, arguments);
|
|
984
|
+
}
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
var fs$writeFile = fs2.writeFile;
|
|
989
|
+
fs2.writeFile = writeFile;
|
|
990
|
+
function writeFile(path, data, options, cb) {
|
|
991
|
+
if (typeof options === "function")
|
|
992
|
+
cb = options, options = null;
|
|
993
|
+
return go$writeFile(path, data, options, cb);
|
|
994
|
+
function go$writeFile(path2, data2, options2, cb2, startTime) {
|
|
995
|
+
return fs$writeFile(path2, data2, options2, function(err) {
|
|
996
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
997
|
+
enqueue([go$writeFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
998
|
+
else {
|
|
999
|
+
if (typeof cb2 === "function")
|
|
1000
|
+
cb2.apply(this, arguments);
|
|
1001
|
+
}
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
var fs$appendFile = fs2.appendFile;
|
|
1006
|
+
if (fs$appendFile)
|
|
1007
|
+
fs2.appendFile = appendFile;
|
|
1008
|
+
function appendFile(path, data, options, cb) {
|
|
1009
|
+
if (typeof options === "function")
|
|
1010
|
+
cb = options, options = null;
|
|
1011
|
+
return go$appendFile(path, data, options, cb);
|
|
1012
|
+
function go$appendFile(path2, data2, options2, cb2, startTime) {
|
|
1013
|
+
return fs$appendFile(path2, data2, options2, function(err) {
|
|
1014
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1015
|
+
enqueue([go$appendFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
1016
|
+
else {
|
|
1017
|
+
if (typeof cb2 === "function")
|
|
1018
|
+
cb2.apply(this, arguments);
|
|
1019
|
+
}
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
var fs$copyFile = fs2.copyFile;
|
|
1024
|
+
if (fs$copyFile)
|
|
1025
|
+
fs2.copyFile = copyFile;
|
|
1026
|
+
function copyFile(src, dest, flags, cb) {
|
|
1027
|
+
if (typeof flags === "function") {
|
|
1028
|
+
cb = flags;
|
|
1029
|
+
flags = 0;
|
|
1030
|
+
}
|
|
1031
|
+
return go$copyFile(src, dest, flags, cb);
|
|
1032
|
+
function go$copyFile(src2, dest2, flags2, cb2, startTime) {
|
|
1033
|
+
return fs$copyFile(src2, dest2, flags2, function(err) {
|
|
1034
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1035
|
+
enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
1036
|
+
else {
|
|
1037
|
+
if (typeof cb2 === "function")
|
|
1038
|
+
cb2.apply(this, arguments);
|
|
1039
|
+
}
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
var fs$readdir = fs2.readdir;
|
|
1044
|
+
fs2.readdir = readdir;
|
|
1045
|
+
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
1046
|
+
function readdir(path, options, cb) {
|
|
1047
|
+
if (typeof options === "function")
|
|
1048
|
+
cb = options, options = null;
|
|
1049
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path2, options2, cb2, startTime) {
|
|
1050
|
+
return fs$readdir(path2, fs$readdirCallback(
|
|
1051
|
+
path2,
|
|
1052
|
+
options2,
|
|
1053
|
+
cb2,
|
|
1054
|
+
startTime
|
|
1055
|
+
));
|
|
1056
|
+
} : function go$readdir2(path2, options2, cb2, startTime) {
|
|
1057
|
+
return fs$readdir(path2, options2, fs$readdirCallback(
|
|
1058
|
+
path2,
|
|
1059
|
+
options2,
|
|
1060
|
+
cb2,
|
|
1061
|
+
startTime
|
|
1062
|
+
));
|
|
1063
|
+
};
|
|
1064
|
+
return go$readdir(path, options, cb);
|
|
1065
|
+
function fs$readdirCallback(path2, options2, cb2, startTime) {
|
|
1066
|
+
return function(err, files) {
|
|
1067
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1068
|
+
enqueue([
|
|
1069
|
+
go$readdir,
|
|
1070
|
+
[path2, options2, cb2],
|
|
1071
|
+
err,
|
|
1072
|
+
startTime || Date.now(),
|
|
1073
|
+
Date.now()
|
|
1074
|
+
]);
|
|
1075
|
+
else {
|
|
1076
|
+
if (files && files.sort)
|
|
1077
|
+
files.sort();
|
|
1078
|
+
if (typeof cb2 === "function")
|
|
1079
|
+
cb2.call(this, err, files);
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
if (process.version.substr(0, 4) === "v0.8") {
|
|
1085
|
+
var legStreams = legacy(fs2);
|
|
1086
|
+
ReadStream = legStreams.ReadStream;
|
|
1087
|
+
WriteStream = legStreams.WriteStream;
|
|
1088
|
+
}
|
|
1089
|
+
var fs$ReadStream = fs2.ReadStream;
|
|
1090
|
+
if (fs$ReadStream) {
|
|
1091
|
+
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
1092
|
+
ReadStream.prototype.open = ReadStream$open;
|
|
1093
|
+
}
|
|
1094
|
+
var fs$WriteStream = fs2.WriteStream;
|
|
1095
|
+
if (fs$WriteStream) {
|
|
1096
|
+
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
1097
|
+
WriteStream.prototype.open = WriteStream$open;
|
|
1098
|
+
}
|
|
1099
|
+
Object.defineProperty(fs2, "ReadStream", {
|
|
1100
|
+
get: function() {
|
|
1101
|
+
return ReadStream;
|
|
1102
|
+
},
|
|
1103
|
+
set: function(val) {
|
|
1104
|
+
ReadStream = val;
|
|
1105
|
+
},
|
|
1106
|
+
enumerable: true,
|
|
1107
|
+
configurable: true
|
|
1108
|
+
});
|
|
1109
|
+
Object.defineProperty(fs2, "WriteStream", {
|
|
1110
|
+
get: function() {
|
|
1111
|
+
return WriteStream;
|
|
1112
|
+
},
|
|
1113
|
+
set: function(val) {
|
|
1114
|
+
WriteStream = val;
|
|
1115
|
+
},
|
|
1116
|
+
enumerable: true,
|
|
1117
|
+
configurable: true
|
|
1118
|
+
});
|
|
1119
|
+
var FileReadStream = ReadStream;
|
|
1120
|
+
Object.defineProperty(fs2, "FileReadStream", {
|
|
1121
|
+
get: function() {
|
|
1122
|
+
return FileReadStream;
|
|
1123
|
+
},
|
|
1124
|
+
set: function(val) {
|
|
1125
|
+
FileReadStream = val;
|
|
1126
|
+
},
|
|
1127
|
+
enumerable: true,
|
|
1128
|
+
configurable: true
|
|
1129
|
+
});
|
|
1130
|
+
var FileWriteStream = WriteStream;
|
|
1131
|
+
Object.defineProperty(fs2, "FileWriteStream", {
|
|
1132
|
+
get: function() {
|
|
1133
|
+
return FileWriteStream;
|
|
1134
|
+
},
|
|
1135
|
+
set: function(val) {
|
|
1136
|
+
FileWriteStream = val;
|
|
1137
|
+
},
|
|
1138
|
+
enumerable: true,
|
|
1139
|
+
configurable: true
|
|
1140
|
+
});
|
|
1141
|
+
function ReadStream(path, options) {
|
|
1142
|
+
if (this instanceof ReadStream)
|
|
1143
|
+
return fs$ReadStream.apply(this, arguments), this;
|
|
1144
|
+
else
|
|
1145
|
+
return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
1146
|
+
}
|
|
1147
|
+
function ReadStream$open() {
|
|
1148
|
+
var that = this;
|
|
1149
|
+
open2(that.path, that.flags, that.mode, function(err, fd) {
|
|
1150
|
+
if (err) {
|
|
1151
|
+
if (that.autoClose)
|
|
1152
|
+
that.destroy();
|
|
1153
|
+
that.emit("error", err);
|
|
1154
|
+
} else {
|
|
1155
|
+
that.fd = fd;
|
|
1156
|
+
that.emit("open", fd);
|
|
1157
|
+
that.read();
|
|
1158
|
+
}
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
function WriteStream(path, options) {
|
|
1162
|
+
if (this instanceof WriteStream)
|
|
1163
|
+
return fs$WriteStream.apply(this, arguments), this;
|
|
1164
|
+
else
|
|
1165
|
+
return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
1166
|
+
}
|
|
1167
|
+
function WriteStream$open() {
|
|
1168
|
+
var that = this;
|
|
1169
|
+
open2(that.path, that.flags, that.mode, function(err, fd) {
|
|
1170
|
+
if (err) {
|
|
1171
|
+
that.destroy();
|
|
1172
|
+
that.emit("error", err);
|
|
1173
|
+
} else {
|
|
1174
|
+
that.fd = fd;
|
|
1175
|
+
that.emit("open", fd);
|
|
1176
|
+
}
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
function createReadStream(path, options) {
|
|
1180
|
+
return new fs2.ReadStream(path, options);
|
|
1181
|
+
}
|
|
1182
|
+
function createWriteStream(path, options) {
|
|
1183
|
+
return new fs2.WriteStream(path, options);
|
|
1184
|
+
}
|
|
1185
|
+
var fs$open = fs2.open;
|
|
1186
|
+
fs2.open = open2;
|
|
1187
|
+
function open2(path, flags, mode, cb) {
|
|
1188
|
+
if (typeof mode === "function")
|
|
1189
|
+
cb = mode, mode = null;
|
|
1190
|
+
return go$open(path, flags, mode, cb);
|
|
1191
|
+
function go$open(path2, flags2, mode2, cb2, startTime) {
|
|
1192
|
+
return fs$open(path2, flags2, mode2, function(err, fd) {
|
|
1193
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1194
|
+
enqueue([go$open, [path2, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
1195
|
+
else {
|
|
1196
|
+
if (typeof cb2 === "function")
|
|
1197
|
+
cb2.apply(this, arguments);
|
|
1198
|
+
}
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
return fs2;
|
|
1203
|
+
}
|
|
1204
|
+
function enqueue(elem) {
|
|
1205
|
+
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
1206
|
+
fs[gracefulQueue].push(elem);
|
|
1207
|
+
retry();
|
|
1208
|
+
}
|
|
1209
|
+
var retryTimer;
|
|
1210
|
+
function resetQueue() {
|
|
1211
|
+
var now = Date.now();
|
|
1212
|
+
for (var i = 0; i < fs[gracefulQueue].length; ++i) {
|
|
1213
|
+
if (fs[gracefulQueue][i].length > 2) {
|
|
1214
|
+
fs[gracefulQueue][i][3] = now;
|
|
1215
|
+
fs[gracefulQueue][i][4] = now;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
retry();
|
|
1219
|
+
}
|
|
1220
|
+
function retry() {
|
|
1221
|
+
clearTimeout(retryTimer);
|
|
1222
|
+
retryTimer = void 0;
|
|
1223
|
+
if (fs[gracefulQueue].length === 0)
|
|
1224
|
+
return;
|
|
1225
|
+
var elem = fs[gracefulQueue].shift();
|
|
1226
|
+
var fn = elem[0];
|
|
1227
|
+
var args = elem[1];
|
|
1228
|
+
var err = elem[2];
|
|
1229
|
+
var startTime = elem[3];
|
|
1230
|
+
var lastTime = elem[4];
|
|
1231
|
+
if (startTime === void 0) {
|
|
1232
|
+
debug("RETRY", fn.name, args);
|
|
1233
|
+
fn.apply(null, args);
|
|
1234
|
+
} else if (Date.now() - startTime >= 6e4) {
|
|
1235
|
+
debug("TIMEOUT", fn.name, args);
|
|
1236
|
+
var cb = args.pop();
|
|
1237
|
+
if (typeof cb === "function")
|
|
1238
|
+
cb.call(null, err);
|
|
1239
|
+
} else {
|
|
1240
|
+
var sinceAttempt = Date.now() - lastTime;
|
|
1241
|
+
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
1242
|
+
var desiredDelay = Math.min(sinceStart * 1.2, 100);
|
|
1243
|
+
if (sinceAttempt >= desiredDelay) {
|
|
1244
|
+
debug("RETRY", fn.name, args);
|
|
1245
|
+
fn.apply(null, args.concat([startTime]));
|
|
1246
|
+
} else {
|
|
1247
|
+
fs[gracefulQueue].push(elem);
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
if (retryTimer === void 0) {
|
|
1251
|
+
retryTimer = setTimeout(retry, 0);
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
});
|
|
1256
|
+
|
|
1257
|
+
// node_modules/proper-lockfile/node_modules/retry/lib/retry_operation.js
|
|
1258
|
+
var require_retry_operation = __commonJS({
|
|
1259
|
+
"node_modules/proper-lockfile/node_modules/retry/lib/retry_operation.js"(exports, module) {
|
|
1260
|
+
function RetryOperation(timeouts, options) {
|
|
1261
|
+
if (typeof options === "boolean") {
|
|
1262
|
+
options = { forever: options };
|
|
1263
|
+
}
|
|
1264
|
+
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
1265
|
+
this._timeouts = timeouts;
|
|
1266
|
+
this._options = options || {};
|
|
1267
|
+
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
1268
|
+
this._fn = null;
|
|
1269
|
+
this._errors = [];
|
|
1270
|
+
this._attempts = 1;
|
|
1271
|
+
this._operationTimeout = null;
|
|
1272
|
+
this._operationTimeoutCb = null;
|
|
1273
|
+
this._timeout = null;
|
|
1274
|
+
this._operationStart = null;
|
|
1275
|
+
if (this._options.forever) {
|
|
1276
|
+
this._cachedTimeouts = this._timeouts.slice(0);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
module.exports = RetryOperation;
|
|
1280
|
+
RetryOperation.prototype.reset = function() {
|
|
1281
|
+
this._attempts = 1;
|
|
1282
|
+
this._timeouts = this._originalTimeouts;
|
|
1283
|
+
};
|
|
1284
|
+
RetryOperation.prototype.stop = function() {
|
|
1285
|
+
if (this._timeout) {
|
|
1286
|
+
clearTimeout(this._timeout);
|
|
1287
|
+
}
|
|
1288
|
+
this._timeouts = [];
|
|
1289
|
+
this._cachedTimeouts = null;
|
|
1290
|
+
};
|
|
1291
|
+
RetryOperation.prototype.retry = function(err) {
|
|
1292
|
+
if (this._timeout) {
|
|
1293
|
+
clearTimeout(this._timeout);
|
|
1294
|
+
}
|
|
1295
|
+
if (!err) {
|
|
1296
|
+
return false;
|
|
1297
|
+
}
|
|
1298
|
+
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
1299
|
+
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
1300
|
+
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
1301
|
+
return false;
|
|
1302
|
+
}
|
|
1303
|
+
this._errors.push(err);
|
|
1304
|
+
var timeout = this._timeouts.shift();
|
|
1305
|
+
if (timeout === void 0) {
|
|
1306
|
+
if (this._cachedTimeouts) {
|
|
1307
|
+
this._errors.splice(this._errors.length - 1, this._errors.length);
|
|
1308
|
+
this._timeouts = this._cachedTimeouts.slice(0);
|
|
1309
|
+
timeout = this._timeouts.shift();
|
|
1310
|
+
} else {
|
|
1311
|
+
return false;
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
var self = this;
|
|
1315
|
+
var timer = setTimeout(function() {
|
|
1316
|
+
self._attempts++;
|
|
1317
|
+
if (self._operationTimeoutCb) {
|
|
1318
|
+
self._timeout = setTimeout(function() {
|
|
1319
|
+
self._operationTimeoutCb(self._attempts);
|
|
1320
|
+
}, self._operationTimeout);
|
|
1321
|
+
if (self._options.unref) {
|
|
1322
|
+
self._timeout.unref();
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
self._fn(self._attempts);
|
|
1326
|
+
}, timeout);
|
|
1327
|
+
if (this._options.unref) {
|
|
1328
|
+
timer.unref();
|
|
1329
|
+
}
|
|
1330
|
+
return true;
|
|
1331
|
+
};
|
|
1332
|
+
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
1333
|
+
this._fn = fn;
|
|
1334
|
+
if (timeoutOps) {
|
|
1335
|
+
if (timeoutOps.timeout) {
|
|
1336
|
+
this._operationTimeout = timeoutOps.timeout;
|
|
1337
|
+
}
|
|
1338
|
+
if (timeoutOps.cb) {
|
|
1339
|
+
this._operationTimeoutCb = timeoutOps.cb;
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
var self = this;
|
|
1343
|
+
if (this._operationTimeoutCb) {
|
|
1344
|
+
this._timeout = setTimeout(function() {
|
|
1345
|
+
self._operationTimeoutCb();
|
|
1346
|
+
}, self._operationTimeout);
|
|
1347
|
+
}
|
|
1348
|
+
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
1349
|
+
this._fn(this._attempts);
|
|
1350
|
+
};
|
|
1351
|
+
RetryOperation.prototype.try = function(fn) {
|
|
1352
|
+
console.log("Using RetryOperation.try() is deprecated");
|
|
1353
|
+
this.attempt(fn);
|
|
1354
|
+
};
|
|
1355
|
+
RetryOperation.prototype.start = function(fn) {
|
|
1356
|
+
console.log("Using RetryOperation.start() is deprecated");
|
|
1357
|
+
this.attempt(fn);
|
|
1358
|
+
};
|
|
1359
|
+
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
1360
|
+
RetryOperation.prototype.errors = function() {
|
|
1361
|
+
return this._errors;
|
|
1362
|
+
};
|
|
1363
|
+
RetryOperation.prototype.attempts = function() {
|
|
1364
|
+
return this._attempts;
|
|
1365
|
+
};
|
|
1366
|
+
RetryOperation.prototype.mainError = function() {
|
|
1367
|
+
if (this._errors.length === 0) {
|
|
1368
|
+
return null;
|
|
1369
|
+
}
|
|
1370
|
+
var counts = {};
|
|
1371
|
+
var mainError = null;
|
|
1372
|
+
var mainErrorCount = 0;
|
|
1373
|
+
for (var i = 0; i < this._errors.length; i++) {
|
|
1374
|
+
var error = this._errors[i];
|
|
1375
|
+
var message = error.message;
|
|
1376
|
+
var count = (counts[message] || 0) + 1;
|
|
1377
|
+
counts[message] = count;
|
|
1378
|
+
if (count >= mainErrorCount) {
|
|
1379
|
+
mainError = error;
|
|
1380
|
+
mainErrorCount = count;
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
return mainError;
|
|
1384
|
+
};
|
|
1385
|
+
}
|
|
1386
|
+
});
|
|
1387
|
+
|
|
1388
|
+
// node_modules/proper-lockfile/node_modules/retry/lib/retry.js
|
|
1389
|
+
var require_retry = __commonJS({
|
|
1390
|
+
"node_modules/proper-lockfile/node_modules/retry/lib/retry.js"(exports) {
|
|
1391
|
+
var RetryOperation = require_retry_operation();
|
|
1392
|
+
exports.operation = function(options) {
|
|
1393
|
+
var timeouts = exports.timeouts(options);
|
|
1394
|
+
return new RetryOperation(timeouts, {
|
|
1395
|
+
forever: options && options.forever,
|
|
1396
|
+
unref: options && options.unref,
|
|
1397
|
+
maxRetryTime: options && options.maxRetryTime
|
|
1398
|
+
});
|
|
1399
|
+
};
|
|
1400
|
+
exports.timeouts = function(options) {
|
|
1401
|
+
if (options instanceof Array) {
|
|
1402
|
+
return [].concat(options);
|
|
1403
|
+
}
|
|
1404
|
+
var opts = {
|
|
1405
|
+
retries: 10,
|
|
1406
|
+
factor: 2,
|
|
1407
|
+
minTimeout: 1 * 1e3,
|
|
1408
|
+
maxTimeout: Infinity,
|
|
1409
|
+
randomize: false
|
|
1410
|
+
};
|
|
1411
|
+
for (var key in options) {
|
|
1412
|
+
opts[key] = options[key];
|
|
1413
|
+
}
|
|
1414
|
+
if (opts.minTimeout > opts.maxTimeout) {
|
|
1415
|
+
throw new Error("minTimeout is greater than maxTimeout");
|
|
1416
|
+
}
|
|
1417
|
+
var timeouts = [];
|
|
1418
|
+
for (var i = 0; i < opts.retries; i++) {
|
|
1419
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
1420
|
+
}
|
|
1421
|
+
if (options && options.forever && !timeouts.length) {
|
|
1422
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
1423
|
+
}
|
|
1424
|
+
timeouts.sort(function(a, b) {
|
|
1425
|
+
return a - b;
|
|
1426
|
+
});
|
|
1427
|
+
return timeouts;
|
|
1428
|
+
};
|
|
1429
|
+
exports.createTimeout = function(attempt, opts) {
|
|
1430
|
+
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
1431
|
+
var timeout = Math.round(random * opts.minTimeout * Math.pow(opts.factor, attempt));
|
|
1432
|
+
timeout = Math.min(timeout, opts.maxTimeout);
|
|
1433
|
+
return timeout;
|
|
1434
|
+
};
|
|
1435
|
+
exports.wrap = function(obj, options, methods) {
|
|
1436
|
+
if (options instanceof Array) {
|
|
1437
|
+
methods = options;
|
|
1438
|
+
options = null;
|
|
1439
|
+
}
|
|
1440
|
+
if (!methods) {
|
|
1441
|
+
methods = [];
|
|
1442
|
+
for (var key in obj) {
|
|
1443
|
+
if (typeof obj[key] === "function") {
|
|
1444
|
+
methods.push(key);
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
for (var i = 0; i < methods.length; i++) {
|
|
1449
|
+
var method = methods[i];
|
|
1450
|
+
var original = obj[method];
|
|
1451
|
+
obj[method] = function retryWrapper(original2) {
|
|
1452
|
+
var op = exports.operation(options);
|
|
1453
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
|
1454
|
+
var callback = args.pop();
|
|
1455
|
+
args.push(function(err) {
|
|
1456
|
+
if (op.retry(err)) {
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1459
|
+
if (err) {
|
|
1460
|
+
arguments[0] = op.mainError();
|
|
1461
|
+
}
|
|
1462
|
+
callback.apply(this, arguments);
|
|
1463
|
+
});
|
|
1464
|
+
op.attempt(function() {
|
|
1465
|
+
original2.apply(obj, args);
|
|
1466
|
+
});
|
|
1467
|
+
}.bind(obj, original);
|
|
1468
|
+
obj[method].options = options;
|
|
1469
|
+
}
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
});
|
|
1473
|
+
|
|
1474
|
+
// node_modules/proper-lockfile/node_modules/retry/index.js
|
|
1475
|
+
var require_retry2 = __commonJS({
|
|
1476
|
+
"node_modules/proper-lockfile/node_modules/retry/index.js"(exports, module) {
|
|
1477
|
+
module.exports = require_retry();
|
|
1478
|
+
}
|
|
1479
|
+
});
|
|
1480
|
+
|
|
1481
|
+
// node_modules/signal-exit/signals.js
|
|
1482
|
+
var require_signals = __commonJS({
|
|
1483
|
+
"node_modules/signal-exit/signals.js"(exports, module) {
|
|
1484
|
+
module.exports = [
|
|
1485
|
+
"SIGABRT",
|
|
1486
|
+
"SIGALRM",
|
|
1487
|
+
"SIGHUP",
|
|
1488
|
+
"SIGINT",
|
|
1489
|
+
"SIGTERM"
|
|
1490
|
+
];
|
|
1491
|
+
if (process.platform !== "win32") {
|
|
1492
|
+
module.exports.push(
|
|
1493
|
+
"SIGVTALRM",
|
|
1494
|
+
"SIGXCPU",
|
|
1495
|
+
"SIGXFSZ",
|
|
1496
|
+
"SIGUSR2",
|
|
1497
|
+
"SIGTRAP",
|
|
1498
|
+
"SIGSYS",
|
|
1499
|
+
"SIGQUIT",
|
|
1500
|
+
"SIGIOT"
|
|
1501
|
+
// should detect profiler and enable/disable accordingly.
|
|
1502
|
+
// see #21
|
|
1503
|
+
// 'SIGPROF'
|
|
1504
|
+
);
|
|
1505
|
+
}
|
|
1506
|
+
if (process.platform === "linux") {
|
|
1507
|
+
module.exports.push(
|
|
1508
|
+
"SIGIO",
|
|
1509
|
+
"SIGPOLL",
|
|
1510
|
+
"SIGPWR",
|
|
1511
|
+
"SIGSTKFLT",
|
|
1512
|
+
"SIGUNUSED"
|
|
1513
|
+
);
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
});
|
|
1517
|
+
|
|
1518
|
+
// node_modules/signal-exit/index.js
|
|
1519
|
+
var require_signal_exit = __commonJS({
|
|
1520
|
+
"node_modules/signal-exit/index.js"(exports, module) {
|
|
1521
|
+
var process2 = global.process;
|
|
1522
|
+
var processOk = function(process3) {
|
|
1523
|
+
return process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
|
|
1524
|
+
};
|
|
1525
|
+
if (!processOk(process2)) {
|
|
1526
|
+
module.exports = function() {
|
|
1527
|
+
return function() {
|
|
1528
|
+
};
|
|
1529
|
+
};
|
|
1530
|
+
} else {
|
|
1531
|
+
assert = __require("assert");
|
|
1532
|
+
signals = require_signals();
|
|
1533
|
+
isWin = /^win/i.test(process2.platform);
|
|
1534
|
+
EE = __require("events");
|
|
1535
|
+
if (typeof EE !== "function") {
|
|
1536
|
+
EE = EE.EventEmitter;
|
|
1537
|
+
}
|
|
1538
|
+
if (process2.__signal_exit_emitter__) {
|
|
1539
|
+
emitter = process2.__signal_exit_emitter__;
|
|
1540
|
+
} else {
|
|
1541
|
+
emitter = process2.__signal_exit_emitter__ = new EE();
|
|
1542
|
+
emitter.count = 0;
|
|
1543
|
+
emitter.emitted = {};
|
|
1544
|
+
}
|
|
1545
|
+
if (!emitter.infinite) {
|
|
1546
|
+
emitter.setMaxListeners(Infinity);
|
|
1547
|
+
emitter.infinite = true;
|
|
1548
|
+
}
|
|
1549
|
+
module.exports = function(cb, opts) {
|
|
1550
|
+
if (!processOk(global.process)) {
|
|
1551
|
+
return function() {
|
|
1552
|
+
};
|
|
1553
|
+
}
|
|
1554
|
+
assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
|
|
1555
|
+
if (loaded === false) {
|
|
1556
|
+
load();
|
|
1557
|
+
}
|
|
1558
|
+
var ev = "exit";
|
|
1559
|
+
if (opts && opts.alwaysLast) {
|
|
1560
|
+
ev = "afterexit";
|
|
1561
|
+
}
|
|
1562
|
+
var remove = function() {
|
|
1563
|
+
emitter.removeListener(ev, cb);
|
|
1564
|
+
if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
|
|
1565
|
+
unload();
|
|
1566
|
+
}
|
|
1567
|
+
};
|
|
1568
|
+
emitter.on(ev, cb);
|
|
1569
|
+
return remove;
|
|
1570
|
+
};
|
|
1571
|
+
unload = function unload2() {
|
|
1572
|
+
if (!loaded || !processOk(global.process)) {
|
|
1573
|
+
return;
|
|
1574
|
+
}
|
|
1575
|
+
loaded = false;
|
|
1576
|
+
signals.forEach(function(sig) {
|
|
1577
|
+
try {
|
|
1578
|
+
process2.removeListener(sig, sigListeners[sig]);
|
|
1579
|
+
} catch (er) {
|
|
1580
|
+
}
|
|
1581
|
+
});
|
|
1582
|
+
process2.emit = originalProcessEmit;
|
|
1583
|
+
process2.reallyExit = originalProcessReallyExit;
|
|
1584
|
+
emitter.count -= 1;
|
|
1585
|
+
};
|
|
1586
|
+
module.exports.unload = unload;
|
|
1587
|
+
emit = function emit2(event, code, signal) {
|
|
1588
|
+
if (emitter.emitted[event]) {
|
|
1589
|
+
return;
|
|
1590
|
+
}
|
|
1591
|
+
emitter.emitted[event] = true;
|
|
1592
|
+
emitter.emit(event, code, signal);
|
|
1593
|
+
};
|
|
1594
|
+
sigListeners = {};
|
|
1595
|
+
signals.forEach(function(sig) {
|
|
1596
|
+
sigListeners[sig] = function listener() {
|
|
1597
|
+
if (!processOk(global.process)) {
|
|
1598
|
+
return;
|
|
1599
|
+
}
|
|
1600
|
+
var listeners = process2.listeners(sig);
|
|
1601
|
+
if (listeners.length === emitter.count) {
|
|
1602
|
+
unload();
|
|
1603
|
+
emit("exit", null, sig);
|
|
1604
|
+
emit("afterexit", null, sig);
|
|
1605
|
+
if (isWin && sig === "SIGHUP") {
|
|
1606
|
+
sig = "SIGINT";
|
|
1607
|
+
}
|
|
1608
|
+
process2.kill(process2.pid, sig);
|
|
1609
|
+
}
|
|
1610
|
+
};
|
|
1611
|
+
});
|
|
1612
|
+
module.exports.signals = function() {
|
|
1613
|
+
return signals;
|
|
1614
|
+
};
|
|
1615
|
+
loaded = false;
|
|
1616
|
+
load = function load2() {
|
|
1617
|
+
if (loaded || !processOk(global.process)) {
|
|
1618
|
+
return;
|
|
1619
|
+
}
|
|
1620
|
+
loaded = true;
|
|
1621
|
+
emitter.count += 1;
|
|
1622
|
+
signals = signals.filter(function(sig) {
|
|
1623
|
+
try {
|
|
1624
|
+
process2.on(sig, sigListeners[sig]);
|
|
1625
|
+
return true;
|
|
1626
|
+
} catch (er) {
|
|
1627
|
+
return false;
|
|
1628
|
+
}
|
|
1629
|
+
});
|
|
1630
|
+
process2.emit = processEmit;
|
|
1631
|
+
process2.reallyExit = processReallyExit;
|
|
1632
|
+
};
|
|
1633
|
+
module.exports.load = load;
|
|
1634
|
+
originalProcessReallyExit = process2.reallyExit;
|
|
1635
|
+
processReallyExit = function processReallyExit2(code) {
|
|
1636
|
+
if (!processOk(global.process)) {
|
|
1637
|
+
return;
|
|
1638
|
+
}
|
|
1639
|
+
process2.exitCode = code || /* istanbul ignore next */
|
|
1640
|
+
0;
|
|
1641
|
+
emit("exit", process2.exitCode, null);
|
|
1642
|
+
emit("afterexit", process2.exitCode, null);
|
|
1643
|
+
originalProcessReallyExit.call(process2, process2.exitCode);
|
|
1644
|
+
};
|
|
1645
|
+
originalProcessEmit = process2.emit;
|
|
1646
|
+
processEmit = function processEmit2(ev, arg) {
|
|
1647
|
+
if (ev === "exit" && processOk(global.process)) {
|
|
1648
|
+
if (arg !== void 0) {
|
|
1649
|
+
process2.exitCode = arg;
|
|
1650
|
+
}
|
|
1651
|
+
var ret = originalProcessEmit.apply(this, arguments);
|
|
1652
|
+
emit("exit", process2.exitCode, null);
|
|
1653
|
+
emit("afterexit", process2.exitCode, null);
|
|
1654
|
+
return ret;
|
|
1655
|
+
} else {
|
|
1656
|
+
return originalProcessEmit.apply(this, arguments);
|
|
1657
|
+
}
|
|
1658
|
+
};
|
|
1659
|
+
}
|
|
1660
|
+
var assert;
|
|
1661
|
+
var signals;
|
|
1662
|
+
var isWin;
|
|
1663
|
+
var EE;
|
|
1664
|
+
var emitter;
|
|
1665
|
+
var unload;
|
|
1666
|
+
var emit;
|
|
1667
|
+
var sigListeners;
|
|
1668
|
+
var loaded;
|
|
1669
|
+
var load;
|
|
1670
|
+
var originalProcessReallyExit;
|
|
1671
|
+
var processReallyExit;
|
|
1672
|
+
var originalProcessEmit;
|
|
1673
|
+
var processEmit;
|
|
1674
|
+
}
|
|
1675
|
+
});
|
|
1676
|
+
|
|
1677
|
+
// node_modules/proper-lockfile/lib/mtime-precision.js
|
|
1678
|
+
var require_mtime_precision = __commonJS({
|
|
1679
|
+
"node_modules/proper-lockfile/lib/mtime-precision.js"(exports, module) {
|
|
1680
|
+
"use strict";
|
|
1681
|
+
var cacheSymbol = /* @__PURE__ */ Symbol();
|
|
1682
|
+
function probe(file, fs, callback) {
|
|
1683
|
+
const cachedPrecision = fs[cacheSymbol];
|
|
1684
|
+
if (cachedPrecision) {
|
|
1685
|
+
return fs.stat(file, (err, stat2) => {
|
|
1686
|
+
if (err) {
|
|
1687
|
+
return callback(err);
|
|
1688
|
+
}
|
|
1689
|
+
callback(null, stat2.mtime, cachedPrecision);
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
|
|
1693
|
+
fs.utimes(file, mtime, mtime, (err) => {
|
|
1694
|
+
if (err) {
|
|
1695
|
+
return callback(err);
|
|
1696
|
+
}
|
|
1697
|
+
fs.stat(file, (err2, stat2) => {
|
|
1698
|
+
if (err2) {
|
|
1699
|
+
return callback(err2);
|
|
1700
|
+
}
|
|
1701
|
+
const precision = stat2.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
|
|
1702
|
+
Object.defineProperty(fs, cacheSymbol, { value: precision });
|
|
1703
|
+
callback(null, stat2.mtime, precision);
|
|
1704
|
+
});
|
|
1705
|
+
});
|
|
1706
|
+
}
|
|
1707
|
+
function getMtime(precision) {
|
|
1708
|
+
let now = Date.now();
|
|
1709
|
+
if (precision === "s") {
|
|
1710
|
+
now = Math.ceil(now / 1e3) * 1e3;
|
|
1711
|
+
}
|
|
1712
|
+
return new Date(now);
|
|
1713
|
+
}
|
|
1714
|
+
module.exports.probe = probe;
|
|
1715
|
+
module.exports.getMtime = getMtime;
|
|
1716
|
+
}
|
|
1717
|
+
});
|
|
1718
|
+
|
|
1719
|
+
// node_modules/proper-lockfile/lib/lockfile.js
|
|
1720
|
+
var require_lockfile = __commonJS({
|
|
1721
|
+
"node_modules/proper-lockfile/lib/lockfile.js"(exports, module) {
|
|
1722
|
+
"use strict";
|
|
1723
|
+
var path = __require("path");
|
|
1724
|
+
var fs = require_graceful_fs();
|
|
1725
|
+
var retry = require_retry2();
|
|
1726
|
+
var onExit = require_signal_exit();
|
|
1727
|
+
var mtimePrecision = require_mtime_precision();
|
|
1728
|
+
var locks = {};
|
|
1729
|
+
function getLockFile(file, options) {
|
|
1730
|
+
return options.lockfilePath || `${file}.lock`;
|
|
1731
|
+
}
|
|
1732
|
+
function resolveCanonicalPath(file, options, callback) {
|
|
1733
|
+
if (!options.realpath) {
|
|
1734
|
+
return callback(null, path.resolve(file));
|
|
1735
|
+
}
|
|
1736
|
+
options.fs.realpath(file, callback);
|
|
1737
|
+
}
|
|
1738
|
+
function acquireLock(file, options, callback) {
|
|
1739
|
+
const lockfilePath = getLockFile(file, options);
|
|
1740
|
+
options.fs.mkdir(lockfilePath, (err) => {
|
|
1741
|
+
if (!err) {
|
|
1742
|
+
return mtimePrecision.probe(lockfilePath, options.fs, (err2, mtime, mtimePrecision2) => {
|
|
1743
|
+
if (err2) {
|
|
1744
|
+
options.fs.rmdir(lockfilePath, () => {
|
|
1745
|
+
});
|
|
1746
|
+
return callback(err2);
|
|
1747
|
+
}
|
|
1748
|
+
callback(null, mtime, mtimePrecision2);
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1751
|
+
if (err.code !== "EEXIST") {
|
|
1752
|
+
return callback(err);
|
|
1753
|
+
}
|
|
1754
|
+
if (options.stale <= 0) {
|
|
1755
|
+
return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file }));
|
|
1756
|
+
}
|
|
1757
|
+
options.fs.stat(lockfilePath, (err2, stat2) => {
|
|
1758
|
+
if (err2) {
|
|
1759
|
+
if (err2.code === "ENOENT") {
|
|
1760
|
+
return acquireLock(file, { ...options, stale: 0 }, callback);
|
|
1761
|
+
}
|
|
1762
|
+
return callback(err2);
|
|
1763
|
+
}
|
|
1764
|
+
if (!isLockStale(stat2, options)) {
|
|
1765
|
+
return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file }));
|
|
1766
|
+
}
|
|
1767
|
+
removeLock(file, options, (err3) => {
|
|
1768
|
+
if (err3) {
|
|
1769
|
+
return callback(err3);
|
|
1770
|
+
}
|
|
1771
|
+
acquireLock(file, { ...options, stale: 0 }, callback);
|
|
1772
|
+
});
|
|
1773
|
+
});
|
|
1774
|
+
});
|
|
1775
|
+
}
|
|
1776
|
+
function isLockStale(stat2, options) {
|
|
1777
|
+
return stat2.mtime.getTime() < Date.now() - options.stale;
|
|
1778
|
+
}
|
|
1779
|
+
function removeLock(file, options, callback) {
|
|
1780
|
+
options.fs.rmdir(getLockFile(file, options), (err) => {
|
|
1781
|
+
if (err && err.code !== "ENOENT") {
|
|
1782
|
+
return callback(err);
|
|
1783
|
+
}
|
|
1784
|
+
callback();
|
|
1785
|
+
});
|
|
1786
|
+
}
|
|
1787
|
+
function updateLock(file, options) {
|
|
1788
|
+
const lock2 = locks[file];
|
|
1789
|
+
if (lock2.updateTimeout) {
|
|
1790
|
+
return;
|
|
1791
|
+
}
|
|
1792
|
+
lock2.updateDelay = lock2.updateDelay || options.update;
|
|
1793
|
+
lock2.updateTimeout = setTimeout(() => {
|
|
1794
|
+
lock2.updateTimeout = null;
|
|
1795
|
+
options.fs.stat(lock2.lockfilePath, (err, stat2) => {
|
|
1796
|
+
const isOverThreshold = lock2.lastUpdate + options.stale < Date.now();
|
|
1797
|
+
if (err) {
|
|
1798
|
+
if (err.code === "ENOENT" || isOverThreshold) {
|
|
1799
|
+
return setLockAsCompromised(file, lock2, Object.assign(err, { code: "ECOMPROMISED" }));
|
|
1800
|
+
}
|
|
1801
|
+
lock2.updateDelay = 1e3;
|
|
1802
|
+
return updateLock(file, options);
|
|
1803
|
+
}
|
|
1804
|
+
const isMtimeOurs = lock2.mtime.getTime() === stat2.mtime.getTime();
|
|
1805
|
+
if (!isMtimeOurs) {
|
|
1806
|
+
return setLockAsCompromised(
|
|
1807
|
+
file,
|
|
1808
|
+
lock2,
|
|
1809
|
+
Object.assign(
|
|
1810
|
+
new Error("Unable to update lock within the stale threshold"),
|
|
1811
|
+
{ code: "ECOMPROMISED" }
|
|
1812
|
+
)
|
|
1813
|
+
);
|
|
1814
|
+
}
|
|
1815
|
+
const mtime = mtimePrecision.getMtime(lock2.mtimePrecision);
|
|
1816
|
+
options.fs.utimes(lock2.lockfilePath, mtime, mtime, (err2) => {
|
|
1817
|
+
const isOverThreshold2 = lock2.lastUpdate + options.stale < Date.now();
|
|
1818
|
+
if (lock2.released) {
|
|
1819
|
+
return;
|
|
1820
|
+
}
|
|
1821
|
+
if (err2) {
|
|
1822
|
+
if (err2.code === "ENOENT" || isOverThreshold2) {
|
|
1823
|
+
return setLockAsCompromised(file, lock2, Object.assign(err2, { code: "ECOMPROMISED" }));
|
|
1824
|
+
}
|
|
1825
|
+
lock2.updateDelay = 1e3;
|
|
1826
|
+
return updateLock(file, options);
|
|
1827
|
+
}
|
|
1828
|
+
lock2.mtime = mtime;
|
|
1829
|
+
lock2.lastUpdate = Date.now();
|
|
1830
|
+
lock2.updateDelay = null;
|
|
1831
|
+
updateLock(file, options);
|
|
1832
|
+
});
|
|
1833
|
+
});
|
|
1834
|
+
}, lock2.updateDelay);
|
|
1835
|
+
if (lock2.updateTimeout.unref) {
|
|
1836
|
+
lock2.updateTimeout.unref();
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
function setLockAsCompromised(file, lock2, err) {
|
|
1840
|
+
lock2.released = true;
|
|
1841
|
+
if (lock2.updateTimeout) {
|
|
1842
|
+
clearTimeout(lock2.updateTimeout);
|
|
1843
|
+
}
|
|
1844
|
+
if (locks[file] === lock2) {
|
|
1845
|
+
delete locks[file];
|
|
1846
|
+
}
|
|
1847
|
+
lock2.options.onCompromised(err);
|
|
1848
|
+
}
|
|
1849
|
+
function lock(file, options, callback) {
|
|
1850
|
+
options = {
|
|
1851
|
+
stale: 1e4,
|
|
1852
|
+
update: null,
|
|
1853
|
+
realpath: true,
|
|
1854
|
+
retries: 0,
|
|
1855
|
+
fs,
|
|
1856
|
+
onCompromised: (err) => {
|
|
1857
|
+
throw err;
|
|
1858
|
+
},
|
|
1859
|
+
...options
|
|
1860
|
+
};
|
|
1861
|
+
options.retries = options.retries || 0;
|
|
1862
|
+
options.retries = typeof options.retries === "number" ? { retries: options.retries } : options.retries;
|
|
1863
|
+
options.stale = Math.max(options.stale || 0, 2e3);
|
|
1864
|
+
options.update = options.update == null ? options.stale / 2 : options.update || 0;
|
|
1865
|
+
options.update = Math.max(Math.min(options.update, options.stale / 2), 1e3);
|
|
1866
|
+
resolveCanonicalPath(file, options, (err, file2) => {
|
|
1867
|
+
if (err) {
|
|
1868
|
+
return callback(err);
|
|
1869
|
+
}
|
|
1870
|
+
const operation = retry.operation(options.retries);
|
|
1871
|
+
operation.attempt(() => {
|
|
1872
|
+
acquireLock(file2, options, (err2, mtime, mtimePrecision2) => {
|
|
1873
|
+
if (operation.retry(err2)) {
|
|
1874
|
+
return;
|
|
1875
|
+
}
|
|
1876
|
+
if (err2) {
|
|
1877
|
+
return callback(operation.mainError());
|
|
1878
|
+
}
|
|
1879
|
+
const lock2 = locks[file2] = {
|
|
1880
|
+
lockfilePath: getLockFile(file2, options),
|
|
1881
|
+
mtime,
|
|
1882
|
+
mtimePrecision: mtimePrecision2,
|
|
1883
|
+
options,
|
|
1884
|
+
lastUpdate: Date.now()
|
|
1885
|
+
};
|
|
1886
|
+
updateLock(file2, options);
|
|
1887
|
+
callback(null, (releasedCallback) => {
|
|
1888
|
+
if (lock2.released) {
|
|
1889
|
+
return releasedCallback && releasedCallback(Object.assign(new Error("Lock is already released"), { code: "ERELEASED" }));
|
|
1890
|
+
}
|
|
1891
|
+
unlock(file2, { ...options, realpath: false }, releasedCallback);
|
|
1892
|
+
});
|
|
1893
|
+
});
|
|
1894
|
+
});
|
|
1895
|
+
});
|
|
1896
|
+
}
|
|
1897
|
+
function unlock(file, options, callback) {
|
|
1898
|
+
options = {
|
|
1899
|
+
fs,
|
|
1900
|
+
realpath: true,
|
|
1901
|
+
...options
|
|
1902
|
+
};
|
|
1903
|
+
resolveCanonicalPath(file, options, (err, file2) => {
|
|
1904
|
+
if (err) {
|
|
1905
|
+
return callback(err);
|
|
1906
|
+
}
|
|
1907
|
+
const lock2 = locks[file2];
|
|
1908
|
+
if (!lock2) {
|
|
1909
|
+
return callback(Object.assign(new Error("Lock is not acquired/owned by you"), { code: "ENOTACQUIRED" }));
|
|
1910
|
+
}
|
|
1911
|
+
lock2.updateTimeout && clearTimeout(lock2.updateTimeout);
|
|
1912
|
+
lock2.released = true;
|
|
1913
|
+
delete locks[file2];
|
|
1914
|
+
removeLock(file2, options, callback);
|
|
1915
|
+
});
|
|
1916
|
+
}
|
|
1917
|
+
function check(file, options, callback) {
|
|
1918
|
+
options = {
|
|
1919
|
+
stale: 1e4,
|
|
1920
|
+
realpath: true,
|
|
1921
|
+
fs,
|
|
1922
|
+
...options
|
|
1923
|
+
};
|
|
1924
|
+
options.stale = Math.max(options.stale || 0, 2e3);
|
|
1925
|
+
resolveCanonicalPath(file, options, (err, file2) => {
|
|
1926
|
+
if (err) {
|
|
1927
|
+
return callback(err);
|
|
1928
|
+
}
|
|
1929
|
+
options.fs.stat(getLockFile(file2, options), (err2, stat2) => {
|
|
1930
|
+
if (err2) {
|
|
1931
|
+
return err2.code === "ENOENT" ? callback(null, false) : callback(err2);
|
|
1932
|
+
}
|
|
1933
|
+
return callback(null, !isLockStale(stat2, options));
|
|
1934
|
+
});
|
|
1935
|
+
});
|
|
1936
|
+
}
|
|
1937
|
+
function getLocks() {
|
|
1938
|
+
return locks;
|
|
1939
|
+
}
|
|
1940
|
+
onExit(() => {
|
|
1941
|
+
for (const file in locks) {
|
|
1942
|
+
const options = locks[file].options;
|
|
1943
|
+
try {
|
|
1944
|
+
options.fs.rmdirSync(getLockFile(file, options));
|
|
1945
|
+
} catch (e) {
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
});
|
|
1949
|
+
module.exports.lock = lock;
|
|
1950
|
+
module.exports.unlock = unlock;
|
|
1951
|
+
module.exports.check = check;
|
|
1952
|
+
module.exports.getLocks = getLocks;
|
|
1953
|
+
}
|
|
1954
|
+
});
|
|
1955
|
+
|
|
1956
|
+
// node_modules/proper-lockfile/lib/adapter.js
|
|
1957
|
+
var require_adapter = __commonJS({
|
|
1958
|
+
"node_modules/proper-lockfile/lib/adapter.js"(exports, module) {
|
|
1959
|
+
"use strict";
|
|
1960
|
+
var fs = require_graceful_fs();
|
|
1961
|
+
function createSyncFs(fs2) {
|
|
1962
|
+
const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
|
|
1963
|
+
const newFs = { ...fs2 };
|
|
1964
|
+
methods.forEach((method) => {
|
|
1965
|
+
newFs[method] = (...args) => {
|
|
1966
|
+
const callback = args.pop();
|
|
1967
|
+
let ret;
|
|
1968
|
+
try {
|
|
1969
|
+
ret = fs2[`${method}Sync`](...args);
|
|
1970
|
+
} catch (err) {
|
|
1971
|
+
return callback(err);
|
|
1972
|
+
}
|
|
1973
|
+
callback(null, ret);
|
|
1974
|
+
};
|
|
1975
|
+
});
|
|
1976
|
+
return newFs;
|
|
1977
|
+
}
|
|
1978
|
+
function toPromise(method) {
|
|
1979
|
+
return (...args) => new Promise((resolve, reject) => {
|
|
1980
|
+
args.push((err, result) => {
|
|
1981
|
+
if (err) {
|
|
1982
|
+
reject(err);
|
|
1983
|
+
} else {
|
|
1984
|
+
resolve(result);
|
|
1985
|
+
}
|
|
1986
|
+
});
|
|
1987
|
+
method(...args);
|
|
1988
|
+
});
|
|
1989
|
+
}
|
|
1990
|
+
function toSync(method) {
|
|
1991
|
+
return (...args) => {
|
|
1992
|
+
let err;
|
|
1993
|
+
let result;
|
|
1994
|
+
args.push((_err, _result) => {
|
|
1995
|
+
err = _err;
|
|
1996
|
+
result = _result;
|
|
1997
|
+
});
|
|
1998
|
+
method(...args);
|
|
1999
|
+
if (err) {
|
|
2000
|
+
throw err;
|
|
2001
|
+
}
|
|
2002
|
+
return result;
|
|
2003
|
+
};
|
|
2004
|
+
}
|
|
2005
|
+
function toSyncOptions(options) {
|
|
2006
|
+
options = { ...options };
|
|
2007
|
+
options.fs = createSyncFs(options.fs || fs);
|
|
2008
|
+
if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
|
|
2009
|
+
throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
|
|
2010
|
+
}
|
|
2011
|
+
return options;
|
|
2012
|
+
}
|
|
2013
|
+
module.exports = {
|
|
2014
|
+
toPromise,
|
|
2015
|
+
toSync,
|
|
2016
|
+
toSyncOptions
|
|
2017
|
+
};
|
|
2018
|
+
}
|
|
2019
|
+
});
|
|
2020
|
+
|
|
2021
|
+
// node_modules/proper-lockfile/index.js
|
|
2022
|
+
var require_proper_lockfile = __commonJS({
|
|
2023
|
+
"node_modules/proper-lockfile/index.js"(exports, module) {
|
|
2024
|
+
"use strict";
|
|
2025
|
+
var lockfile2 = require_lockfile();
|
|
2026
|
+
var { toPromise, toSync, toSyncOptions } = require_adapter();
|
|
2027
|
+
async function lock(file, options) {
|
|
2028
|
+
const release = await toPromise(lockfile2.lock)(file, options);
|
|
2029
|
+
return toPromise(release);
|
|
2030
|
+
}
|
|
2031
|
+
function lockSync(file, options) {
|
|
2032
|
+
const release = toSync(lockfile2.lock)(file, toSyncOptions(options));
|
|
2033
|
+
return toSync(release);
|
|
2034
|
+
}
|
|
2035
|
+
function unlock(file, options) {
|
|
2036
|
+
return toPromise(lockfile2.unlock)(file, options);
|
|
2037
|
+
}
|
|
2038
|
+
function unlockSync(file, options) {
|
|
2039
|
+
return toSync(lockfile2.unlock)(file, toSyncOptions(options));
|
|
2040
|
+
}
|
|
2041
|
+
function check(file, options) {
|
|
2042
|
+
return toPromise(lockfile2.check)(file, options);
|
|
2043
|
+
}
|
|
2044
|
+
function checkSync(file, options) {
|
|
2045
|
+
return toSync(lockfile2.check)(file, toSyncOptions(options));
|
|
2046
|
+
}
|
|
2047
|
+
module.exports = lock;
|
|
2048
|
+
module.exports.lock = lock;
|
|
2049
|
+
module.exports.unlock = unlock;
|
|
2050
|
+
module.exports.lockSync = lockSync;
|
|
2051
|
+
module.exports.unlockSync = unlockSync;
|
|
2052
|
+
module.exports.check = check;
|
|
2053
|
+
module.exports.checkSync = checkSync;
|
|
2054
|
+
}
|
|
2055
|
+
});
|
|
2056
|
+
|
|
2057
|
+
// src/settings-transaction.ts
|
|
2058
|
+
var settings_transaction_exports = {};
|
|
2059
|
+
__export(settings_transaction_exports, {
|
|
2060
|
+
updateSettingsTransaction: () => updateSettingsTransaction
|
|
2061
|
+
});
|
|
2062
|
+
import { mkdir as mkdir2 } from "node:fs/promises";
|
|
2063
|
+
import { dirname as dirname2 } from "node:path";
|
|
2064
|
+
import { isDeepStrictEqual } from "node:util";
|
|
2065
|
+
async function persistently(operation) {
|
|
2066
|
+
try {
|
|
2067
|
+
return await operation();
|
|
2068
|
+
} catch (cause) {
|
|
2069
|
+
throw new SettingsPersistenceError(cause);
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
function typedSettingsLayer(schema, value) {
|
|
2073
|
+
return isJsonObject(value) && !("$schema" in value) && Value.Check(schema, value);
|
|
2074
|
+
}
|
|
2075
|
+
function parseExistingLayer(path, scope, text, layerSchema) {
|
|
2076
|
+
if (text === void 0) {
|
|
2077
|
+
return {
|
|
2078
|
+
status: "valid",
|
|
2079
|
+
settings: {},
|
|
2080
|
+
schemaReference: void 0
|
|
2081
|
+
};
|
|
2082
|
+
}
|
|
2083
|
+
const parsedLayer = parseSettingsLayer(path, scope, text, layerSchema);
|
|
2084
|
+
if (parsedLayer.settings === void 0) {
|
|
2085
|
+
return { status: "invalid", diagnostics: parsedLayer.diagnostics };
|
|
2086
|
+
}
|
|
2087
|
+
return {
|
|
2088
|
+
status: "valid",
|
|
2089
|
+
settings: parsedLayer.settings,
|
|
2090
|
+
schemaReference: parsedLayer.schemaReference
|
|
2091
|
+
};
|
|
2092
|
+
}
|
|
2093
|
+
function invalidExisting(diagnostics) {
|
|
2094
|
+
return {
|
|
2095
|
+
status: "invalid-existing",
|
|
2096
|
+
message: diagnostics[0]?.message ?? "The existing settings are invalid.",
|
|
2097
|
+
diagnostics
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
2100
|
+
function invalidUpdate(message, issues) {
|
|
2101
|
+
return { status: "invalid-update", message, issues };
|
|
2102
|
+
}
|
|
2103
|
+
async function withInterprocessLocks(paths, operation, index = 0) {
|
|
2104
|
+
const path = paths[index];
|
|
2105
|
+
if (path === void 0) return operation();
|
|
2106
|
+
await persistently(() => mkdir2(dirname2(path), { recursive: true }));
|
|
2107
|
+
const release = await persistently(
|
|
2108
|
+
() => import_proper_lockfile.default.lock(path, {
|
|
2109
|
+
realpath: false,
|
|
2110
|
+
retries: {
|
|
2111
|
+
retries: 20,
|
|
2112
|
+
factor: 1.25,
|
|
2113
|
+
minTimeout: 10,
|
|
2114
|
+
maxTimeout: 100,
|
|
2115
|
+
randomize: true
|
|
2116
|
+
}
|
|
2117
|
+
})
|
|
2118
|
+
);
|
|
2119
|
+
try {
|
|
2120
|
+
return await withInterprocessLocks(paths, operation, index + 1);
|
|
2121
|
+
} finally {
|
|
2122
|
+
await persistently(release);
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
async function runSettingsTransaction(definition, options) {
|
|
2126
|
+
const layerSchema = createSettingsFileSchema(definition);
|
|
2127
|
+
const expectedSchema = formatJson(layerSchema);
|
|
2128
|
+
const installedSchema = await persistently(
|
|
2129
|
+
() => readTextIfPresentAsync(options.paths.global.schemaPath)
|
|
2130
|
+
);
|
|
2131
|
+
if (installedSchema !== expectedSchema) {
|
|
2132
|
+
return {
|
|
2133
|
+
status: "conflict",
|
|
2134
|
+
reason: "schema-changed",
|
|
2135
|
+
message: "The installed settings schema changed; reload the extension before saving."
|
|
2136
|
+
};
|
|
2137
|
+
}
|
|
2138
|
+
const globalText = await persistently(
|
|
2139
|
+
() => readTextIfPresentAsync(options.paths.global.configPath)
|
|
2140
|
+
);
|
|
2141
|
+
const projectText = options.scope === "project" ? await persistently(() => readTextIfPresentAsync(options.paths.project.configPath)) : void 0;
|
|
2142
|
+
const revision = options.scope === "global" ? createSettingsRevision(globalText) : createSettingsRevision(globalText, projectText);
|
|
2143
|
+
if (options.expectedRevision !== void 0 && options.expectedRevision !== revision) {
|
|
2144
|
+
return {
|
|
2145
|
+
status: "conflict",
|
|
2146
|
+
reason: "settings-changed",
|
|
2147
|
+
message: "The settings changed after they were loaded; reload before saving."
|
|
2148
|
+
};
|
|
2149
|
+
}
|
|
2150
|
+
const globalResult = parseExistingLayer(
|
|
2151
|
+
options.paths.global.configPath,
|
|
2152
|
+
"global",
|
|
2153
|
+
globalText,
|
|
2154
|
+
layerSchema
|
|
2155
|
+
);
|
|
2156
|
+
if (globalResult.status === "invalid") return invalidExisting(globalResult.diagnostics);
|
|
2157
|
+
const globalApplied = applySettingsLayer(
|
|
2158
|
+
definition.schema,
|
|
2159
|
+
definition.defaultSettings,
|
|
2160
|
+
globalResult,
|
|
2161
|
+
options.paths.global.configPath,
|
|
2162
|
+
"global"
|
|
2163
|
+
);
|
|
2164
|
+
if (globalApplied.diagnostic !== void 0) {
|
|
2165
|
+
return invalidExisting([globalApplied.diagnostic]);
|
|
2166
|
+
}
|
|
2167
|
+
let currentLayer = globalResult;
|
|
2168
|
+
let validationBase = definition.defaultSettings;
|
|
2169
|
+
if (options.scope === "project") {
|
|
2170
|
+
const projectResult = parseExistingLayer(
|
|
2171
|
+
options.paths.project.configPath,
|
|
2172
|
+
"project",
|
|
2173
|
+
projectText,
|
|
2174
|
+
layerSchema
|
|
2175
|
+
);
|
|
2176
|
+
if (projectResult.status === "invalid") return invalidExisting(projectResult.diagnostics);
|
|
2177
|
+
const projectApplied = applySettingsLayer(
|
|
2178
|
+
definition.schema,
|
|
2179
|
+
globalApplied.settings,
|
|
2180
|
+
projectResult,
|
|
2181
|
+
options.paths.project.configPath,
|
|
2182
|
+
"project"
|
|
2183
|
+
);
|
|
2184
|
+
if (projectApplied.diagnostic !== void 0) {
|
|
2185
|
+
return invalidExisting([projectApplied.diagnostic]);
|
|
2186
|
+
}
|
|
2187
|
+
currentLayer = projectResult;
|
|
2188
|
+
validationBase = globalApplied.settings;
|
|
2189
|
+
}
|
|
2190
|
+
const currentForUpdate = cloneJson(currentLayer.settings);
|
|
2191
|
+
if (!typedSettingsLayer(layerSchema, currentForUpdate)) {
|
|
2192
|
+
throw new TypeError("A validated settings layer unexpectedly failed its encoded schema.");
|
|
2193
|
+
}
|
|
2194
|
+
const candidate = options.update(currentForUpdate);
|
|
2195
|
+
let candidateJson;
|
|
2196
|
+
try {
|
|
2197
|
+
candidateJson = Value.Parse(JsonValueSchema, candidate);
|
|
2198
|
+
} catch {
|
|
2199
|
+
return invalidUpdate("The settings updater must return a JSON object.", [
|
|
2200
|
+
{ path: "/", message: "Expected a JSON object" }
|
|
2201
|
+
]);
|
|
2202
|
+
}
|
|
2203
|
+
if (!isJsonObject(candidateJson)) {
|
|
2204
|
+
return invalidUpdate("The settings updater must return a JSON object.", [
|
|
2205
|
+
{ path: "/", message: "Expected a JSON object" }
|
|
2206
|
+
]);
|
|
2207
|
+
}
|
|
2208
|
+
if ("$schema" in candidateJson) {
|
|
2209
|
+
return invalidUpdate("The settings updater cannot modify $schema metadata.", [
|
|
2210
|
+
{ path: "/$schema", message: "$schema is reserved for editor metadata" }
|
|
2211
|
+
]);
|
|
2212
|
+
}
|
|
2213
|
+
if (!Value.Check(layerSchema, candidateJson)) {
|
|
2214
|
+
return invalidUpdate(
|
|
2215
|
+
"The settings update does not match the extension schema.",
|
|
2216
|
+
settingsValidationIssues(layerSchema, candidateJson)
|
|
2217
|
+
);
|
|
2218
|
+
}
|
|
2219
|
+
const nextLayer = cloneJson(candidateJson);
|
|
2220
|
+
const resolved = mergeSettings(validationBase, nextLayer);
|
|
2221
|
+
if (!Value.Check(definition.schema, resolved)) {
|
|
2222
|
+
return invalidUpdate(
|
|
2223
|
+
"The settings update conflicts with the resolved configuration.",
|
|
2224
|
+
settingsValidationIssues(definition.schema, resolved)
|
|
2225
|
+
);
|
|
2226
|
+
}
|
|
2227
|
+
try {
|
|
2228
|
+
Value.Decode(Value.Clone(definition.schema), resolved);
|
|
2229
|
+
} catch {
|
|
2230
|
+
return invalidUpdate("The settings update could not be decoded.", [
|
|
2231
|
+
{ path: "/", message: "The resolved settings codec rejected the update" }
|
|
2232
|
+
]);
|
|
2233
|
+
}
|
|
2234
|
+
if (isDeepStrictEqual(currentLayer.settings, nextLayer)) {
|
|
2235
|
+
return { status: "unchanged", revision };
|
|
2236
|
+
}
|
|
2237
|
+
const targetPaths = options.scope === "global" ? options.paths.global : options.paths.project;
|
|
2238
|
+
const schemaReference = currentLayer.schemaReference ?? (options.scope === "global" ? targetPaths.schemaReference : definition.schemaId);
|
|
2239
|
+
const content = formatJson(createSettingsDocument(definition.id, nextLayer, schemaReference));
|
|
2240
|
+
await persistently(() => writeTextAtomicallyAsync(targetPaths.configPath, content));
|
|
2241
|
+
const nextRevision = options.scope === "global" ? createSettingsRevision(content) : createSettingsRevision(globalText, content);
|
|
2242
|
+
return { status: "updated", revision: nextRevision };
|
|
2243
|
+
}
|
|
2244
|
+
async function updateSettingsTransaction(definition, options) {
|
|
2245
|
+
if (options.scope === "project" && !options.projectTrusted) {
|
|
2246
|
+
return {
|
|
2247
|
+
status: "blocked",
|
|
2248
|
+
reason: "project-untrusted",
|
|
2249
|
+
message: "Project settings can only be updated for a trusted project."
|
|
2250
|
+
};
|
|
2251
|
+
}
|
|
2252
|
+
const lockPaths = options.scope === "global" ? [options.paths.global.configPath] : [options.paths.global.configPath, options.paths.project.configPath].sort();
|
|
2253
|
+
try {
|
|
2254
|
+
return await withInterprocessLocks(
|
|
2255
|
+
lockPaths,
|
|
2256
|
+
() => runSettingsTransaction(definition, options)
|
|
2257
|
+
);
|
|
2258
|
+
} catch (cause) {
|
|
2259
|
+
if (cause instanceof SettingsPersistenceError) {
|
|
2260
|
+
return {
|
|
2261
|
+
status: "failed",
|
|
2262
|
+
message: `The ${options.scope} settings transaction failed.`
|
|
2263
|
+
};
|
|
2264
|
+
}
|
|
2265
|
+
if (cause instanceof Error) throw cause;
|
|
2266
|
+
throw new Error("The settings transaction threw a non-Error value.", { cause });
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
var import_proper_lockfile, SettingsPersistenceError;
|
|
2270
|
+
var init_settings_transaction = __esm({
|
|
2271
|
+
"src/settings-transaction.ts"() {
|
|
2272
|
+
"use strict";
|
|
2273
|
+
import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
2274
|
+
init_file_system();
|
|
2275
|
+
init_json_value();
|
|
2276
|
+
init_typebox_runtime();
|
|
2277
|
+
init_schema_document();
|
|
2278
|
+
init_settings_layer();
|
|
2279
|
+
init_settings_merge();
|
|
2280
|
+
init_settings_revision();
|
|
2281
|
+
SettingsPersistenceError = class extends Error {
|
|
2282
|
+
constructor(cause) {
|
|
2283
|
+
super("The settings transaction could not access persistent storage.", { cause });
|
|
2284
|
+
}
|
|
2285
|
+
};
|
|
2286
|
+
}
|
|
2287
|
+
});
|
|
2288
|
+
|
|
2289
|
+
// src/pi-host-paths.ts
|
|
2290
|
+
import { homedir } from "node:os";
|
|
2291
|
+
import { join } from "node:path";
|
|
2292
|
+
var PI_CONFIG_DIR_NAME = ".pi";
|
|
2293
|
+
var PI_AGENT_DIR_ENV = "PI_CODING_AGENT_DIR";
|
|
2294
|
+
function getPiAgentDir(env = process.env, homeDirectory = homedir()) {
|
|
2295
|
+
const configured = env[PI_AGENT_DIR_ENV];
|
|
2296
|
+
if (configured === void 0 || configured.length === 0) {
|
|
2297
|
+
return join(homeDirectory, PI_CONFIG_DIR_NAME, "agent");
|
|
2298
|
+
}
|
|
2299
|
+
if (configured === "~") {
|
|
2300
|
+
return homeDirectory;
|
|
2301
|
+
}
|
|
2302
|
+
if (configured.startsWith("~/") || process.platform === "win32" && configured.startsWith("~\\")) {
|
|
2303
|
+
return join(homeDirectory, configured.slice(2));
|
|
2304
|
+
}
|
|
2305
|
+
return configured;
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
// src/paths.ts
|
|
2309
|
+
import { join as join2 } from "node:path";
|
|
2310
|
+
var EXTENSION_SETTINGS_DIRECTORY = "extension-settings";
|
|
2311
|
+
var EXTENSION_SETTINGS_SCHEMA_DIRECTORY = "schemas";
|
|
2312
|
+
function resolveGlobalSettingsPaths(agentDir, settingsId) {
|
|
2313
|
+
const settingsDirectory = join2(agentDir, EXTENSION_SETTINGS_DIRECTORY);
|
|
2314
|
+
return {
|
|
2315
|
+
configPath: join2(settingsDirectory, `${settingsId}.json`),
|
|
2316
|
+
schemaPath: join2(
|
|
2317
|
+
settingsDirectory,
|
|
2318
|
+
EXTENSION_SETTINGS_SCHEMA_DIRECTORY,
|
|
2319
|
+
`${settingsId}.schema.json`
|
|
2320
|
+
),
|
|
2321
|
+
schemaReference: `./${EXTENSION_SETTINGS_SCHEMA_DIRECTORY}/${settingsId}.schema.json`
|
|
2322
|
+
};
|
|
2323
|
+
}
|
|
2324
|
+
function resolveProjectSettingsPaths(cwd, configDirName, settingsId) {
|
|
2325
|
+
const settingsDirectory = join2(cwd, configDirName, EXTENSION_SETTINGS_DIRECTORY);
|
|
2326
|
+
return {
|
|
2327
|
+
configPath: join2(settingsDirectory, `${settingsId}.json`),
|
|
2328
|
+
schemaPath: join2(
|
|
2329
|
+
settingsDirectory,
|
|
2330
|
+
EXTENSION_SETTINGS_SCHEMA_DIRECTORY,
|
|
2331
|
+
`${settingsId}.schema.json`
|
|
2332
|
+
),
|
|
2333
|
+
schemaReference: `./${EXTENSION_SETTINGS_SCHEMA_DIRECTORY}/${settingsId}.schema.json`
|
|
2334
|
+
};
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
// src/settings-loader.ts
|
|
2338
|
+
init_file_system();
|
|
2339
|
+
init_json_value();
|
|
2340
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
2341
|
+
init_schema_document();
|
|
2342
|
+
init_settings_layer();
|
|
2343
|
+
init_settings_revision();
|
|
2344
|
+
init_typebox_runtime();
|
|
2345
|
+
function bundledSchemaContent(source) {
|
|
2346
|
+
if (source.kind === "content") return source.content;
|
|
2347
|
+
try {
|
|
2348
|
+
return readFileSync2(source.url, "utf8");
|
|
2349
|
+
} catch {
|
|
2350
|
+
return void 0;
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
function readLayer(path, scope, layerSchema) {
|
|
2354
|
+
try {
|
|
2355
|
+
const content = readTextIfPresent(path);
|
|
2356
|
+
const parsed = content === void 0 ? { settings: void 0, schemaReference: void 0, diagnostics: [] } : parseSettingsLayer(path, scope, content, layerSchema);
|
|
2357
|
+
return { ...parsed, source: { status: "available", content } };
|
|
2358
|
+
} catch {
|
|
2359
|
+
return {
|
|
2360
|
+
settings: void 0,
|
|
2361
|
+
diagnostics: [
|
|
2362
|
+
{
|
|
2363
|
+
code: "config-read-failed",
|
|
2364
|
+
severity: "error",
|
|
2365
|
+
scope,
|
|
2366
|
+
path,
|
|
2367
|
+
message: `${scope} settings could not be read and were ignored`
|
|
2368
|
+
}
|
|
2369
|
+
],
|
|
2370
|
+
schemaReference: void 0,
|
|
2371
|
+
source: { status: "unavailable" }
|
|
2372
|
+
};
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
function loadSettings(definition, options) {
|
|
2376
|
+
const diagnostics = [];
|
|
2377
|
+
const globalPaths = resolveGlobalSettingsPaths(options.agentDir, definition.id);
|
|
2378
|
+
const projectPaths = options.project === void 0 ? void 0 : resolveProjectSettingsPaths(
|
|
2379
|
+
options.project.cwd,
|
|
2380
|
+
options.project.configDirName,
|
|
2381
|
+
definition.id
|
|
2382
|
+
);
|
|
2383
|
+
const layerSchema = createSettingsFileSchema(definition);
|
|
2384
|
+
const expectedSchema = formatJson(layerSchema);
|
|
2385
|
+
const sourceSchema = bundledSchemaContent(options.bundledSchema);
|
|
2386
|
+
let schemaStatus = "unavailable";
|
|
2387
|
+
let scaffoldedGlobalConfig = false;
|
|
2388
|
+
if (sourceSchema === void 0) {
|
|
2389
|
+
diagnostics.push({
|
|
2390
|
+
code: "bundled-schema-read-failed",
|
|
2391
|
+
severity: "error",
|
|
2392
|
+
scope: "schema",
|
|
2393
|
+
path: globalPaths.schemaPath,
|
|
2394
|
+
message: "The bundled settings schema could not be read"
|
|
2395
|
+
});
|
|
2396
|
+
} else if (sourceSchema !== expectedSchema) {
|
|
2397
|
+
diagnostics.push({
|
|
2398
|
+
code: "bundled-schema-stale",
|
|
2399
|
+
severity: "error",
|
|
2400
|
+
scope: "schema",
|
|
2401
|
+
path: globalPaths.schemaPath,
|
|
2402
|
+
message: "The bundled settings schema is stale; run the artifact generator"
|
|
2403
|
+
});
|
|
2404
|
+
} else {
|
|
2405
|
+
try {
|
|
2406
|
+
schemaStatus = writeTextAtomically(globalPaths.schemaPath, sourceSchema);
|
|
2407
|
+
} catch {
|
|
2408
|
+
diagnostics.push({
|
|
2409
|
+
code: "schema-install-failed",
|
|
2410
|
+
severity: "error",
|
|
2411
|
+
scope: "schema",
|
|
2412
|
+
path: globalPaths.schemaPath,
|
|
2413
|
+
message: "The local editor schema could not be installed"
|
|
2414
|
+
});
|
|
2415
|
+
}
|
|
2416
|
+
if (schemaStatus !== "unavailable") {
|
|
2417
|
+
try {
|
|
2418
|
+
scaffoldedGlobalConfig = writeTextIfMissing(
|
|
2419
|
+
globalPaths.configPath,
|
|
2420
|
+
() => formatJson(createDefaultSettingsDocument(definition))
|
|
2421
|
+
) === "created";
|
|
2422
|
+
} catch {
|
|
2423
|
+
diagnostics.push({
|
|
2424
|
+
code: "config-scaffold-failed",
|
|
2425
|
+
severity: "error",
|
|
2426
|
+
scope: "global",
|
|
2427
|
+
path: globalPaths.configPath,
|
|
2428
|
+
message: "The default global settings file could not be scaffolded"
|
|
2429
|
+
});
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
}
|
|
2433
|
+
const globalLayer = readLayer(globalPaths.configPath, "global", layerSchema);
|
|
2434
|
+
diagnostics.push(...globalLayer.diagnostics);
|
|
2435
|
+
const globalApplied = applySettingsLayer(
|
|
2436
|
+
definition.schema,
|
|
2437
|
+
definition.defaultSettings,
|
|
2438
|
+
globalLayer,
|
|
2439
|
+
globalPaths.configPath,
|
|
2440
|
+
"global"
|
|
2441
|
+
);
|
|
2442
|
+
if (globalApplied.diagnostic !== void 0) diagnostics.push(globalApplied.diagnostic);
|
|
2443
|
+
let resolved = globalApplied.settings;
|
|
2444
|
+
let projectSettingsLayer;
|
|
2445
|
+
let usedProjectConfig = false;
|
|
2446
|
+
let projectRevision;
|
|
2447
|
+
if (projectPaths !== void 0 && options.project?.trusted === true) {
|
|
2448
|
+
const projectLayer = readLayer(projectPaths.configPath, "project", layerSchema);
|
|
2449
|
+
diagnostics.push(...projectLayer.diagnostics);
|
|
2450
|
+
const projectApplied = applySettingsLayer(
|
|
2451
|
+
definition.schema,
|
|
2452
|
+
resolved,
|
|
2453
|
+
projectLayer,
|
|
2454
|
+
projectPaths.configPath,
|
|
2455
|
+
"project"
|
|
2456
|
+
);
|
|
2457
|
+
if (projectApplied.diagnostic !== void 0) diagnostics.push(projectApplied.diagnostic);
|
|
2458
|
+
if (projectLayer.settings !== void 0 && projectApplied.diagnostic === void 0) {
|
|
2459
|
+
resolved = projectApplied.settings;
|
|
2460
|
+
projectSettingsLayer = projectLayer.settings;
|
|
2461
|
+
usedProjectConfig = true;
|
|
2462
|
+
}
|
|
2463
|
+
if (globalLayer.source.status === "available" && projectLayer.source.status === "available") {
|
|
2464
|
+
projectRevision = createSettingsRevision(
|
|
2465
|
+
globalLayer.source.content,
|
|
2466
|
+
projectLayer.source.content
|
|
2467
|
+
);
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
return {
|
|
2471
|
+
settings: Value.Decode(Value.Clone(definition.schema), resolved),
|
|
2472
|
+
globalSettingsLayer: globalApplied.diagnostic === void 0 ? globalLayer.settings : void 0,
|
|
2473
|
+
projectSettingsLayer,
|
|
2474
|
+
diagnostics,
|
|
2475
|
+
globalConfigPath: globalPaths.configPath,
|
|
2476
|
+
projectConfigPath: projectPaths?.configPath,
|
|
2477
|
+
globalRevision: globalLayer.source.status === "available" ? createSettingsRevision(globalLayer.source.content) : void 0,
|
|
2478
|
+
projectRevision,
|
|
2479
|
+
usedGlobalConfig: globalLayer.settings !== void 0 && globalApplied.diagnostic === void 0,
|
|
2480
|
+
usedProjectConfig,
|
|
2481
|
+
scaffoldedGlobalConfig,
|
|
2482
|
+
schemaStatus
|
|
2483
|
+
};
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
// src/pi.ts
|
|
2487
|
+
function getPiGlobalSettingsPath(extensionId) {
|
|
2488
|
+
return resolveGlobalSettingsPaths(getPiAgentDir(), extensionId).configPath;
|
|
2489
|
+
}
|
|
2490
|
+
function getPiProjectSettingsPath(extensionId, cwd) {
|
|
2491
|
+
return resolveProjectSettingsPaths(cwd, PI_CONFIG_DIR_NAME, extensionId).configPath;
|
|
2492
|
+
}
|
|
2493
|
+
function loadPiExtensionSettings(definition, context, options) {
|
|
2494
|
+
return loadSettings(definition, {
|
|
2495
|
+
agentDir: getPiAgentDir(),
|
|
2496
|
+
bundledSchema: options.bundledSchema,
|
|
2497
|
+
project: {
|
|
2498
|
+
cwd: context.cwd,
|
|
2499
|
+
configDirName: PI_CONFIG_DIR_NAME,
|
|
2500
|
+
trusted: context.isProjectTrusted()
|
|
2501
|
+
}
|
|
2502
|
+
});
|
|
2503
|
+
}
|
|
2504
|
+
async function withFileMutationQueues(paths, operation, withFileMutationQueue, index = 0) {
|
|
2505
|
+
const path = paths[index];
|
|
2506
|
+
if (path === void 0) return operation();
|
|
2507
|
+
return withFileMutationQueue(
|
|
2508
|
+
path,
|
|
2509
|
+
() => withFileMutationQueues(paths, operation, withFileMutationQueue, index + 1)
|
|
2510
|
+
);
|
|
2511
|
+
}
|
|
2512
|
+
async function updatePiExtensionSettings(definition, context, options) {
|
|
2513
|
+
const [{ updateSettingsTransaction: updateSettingsTransaction2 }, { withFileMutationQueue }] = await Promise.all([
|
|
2514
|
+
Promise.resolve().then(() => (init_settings_transaction(), settings_transaction_exports)),
|
|
2515
|
+
import("@earendil-works/pi-coding-agent")
|
|
2516
|
+
]);
|
|
2517
|
+
const global2 = resolveGlobalSettingsPaths(getPiAgentDir(), definition.id);
|
|
2518
|
+
const project = resolveProjectSettingsPaths(context.cwd, PI_CONFIG_DIR_NAME, definition.id);
|
|
2519
|
+
const projectTrusted = context.isProjectTrusted();
|
|
2520
|
+
const paths = options.scope === "global" ? [global2.configPath] : [global2.configPath, project.configPath].sort();
|
|
2521
|
+
return withFileMutationQueues(
|
|
2522
|
+
paths,
|
|
2523
|
+
() => updateSettingsTransaction2(definition, {
|
|
2524
|
+
...options,
|
|
2525
|
+
paths: { global: global2, project },
|
|
2526
|
+
projectTrusted
|
|
2527
|
+
}),
|
|
2528
|
+
withFileMutationQueue
|
|
2529
|
+
);
|
|
2530
|
+
}
|
|
2531
|
+
export {
|
|
2532
|
+
getPiGlobalSettingsPath,
|
|
2533
|
+
getPiProjectSettingsPath,
|
|
2534
|
+
loadPiExtensionSettings,
|
|
2535
|
+
updatePiExtensionSettings
|
|
2536
|
+
};
|
|
2537
|
+
//# sourceMappingURL=pi.ts.map
|