diff --git a/node_modules/@elgato-stream-deck/core/CHANGELOG.md b/node_modules/@elgato-stream-deck/core/CHANGELOG.md new file mode 100644 index 0000000..5b33ea6 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/CHANGELOG.md @@ -0,0 +1,353 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [7.3.2](https://github.com/julusian/node-elgato-stream-deck/compare/v7.3.1...v7.3.2) (2025-07-14) + +**Note:** Version bump only for package @elgato-stream-deck/core + + + + + +## [7.3.1](https://github.com/julusian/node-elgato-stream-deck/compare/v7.3.0...v7.3.1) (2025-05-30) + +**Note:** Version bump only for package @elgato-stream-deck/core + + + + + +# [7.3.0](https://github.com/julusian/node-elgato-stream-deck/compare/v7.2.0...v7.3.0) (2025-05-30) + + +### Features + +* prepared buffers ([#102](https://github.com/julusian/node-elgato-stream-deck/issues/102)) ([026cbf3](https://github.com/julusian/node-elgato-stream-deck/commit/026cbf37f643096002a5a8385f26e59d5a390d24)) +* support network dock ([#115](https://github.com/julusian/node-elgato-stream-deck/issues/115)) ([58b8994](https://github.com/julusian/node-elgato-stream-deck/commit/58b899456dcf8e84c930c9f9943373aa1b931299)) + + + + + +# [7.2.0](https://github.com/julusian/node-elgato-stream-deck/compare/v7.1.2...v7.2.0) (2025-05-24) + + +### Features + +* add 6 module, 15 module and 32 module ([ca874d8](https://github.com/julusian/node-elgato-stream-deck/commit/ca874d8f857a944871f4aecb97699b8b1cf945f0)) +* add mk2 scissor ([025961d](https://github.com/julusian/node-elgato-stream-deck/commit/025961d1dd9db21afa0c4c5764ae86a0ca977353)) + + + + + +## [7.1.2](https://github.com/julusian/node-elgato-stream-deck/compare/v7.1.1...v7.1.2) (2024-12-09) + + +### Bug Fixes + +* studio clearPanel over usb ([6282b1b](https://github.com/julusian/node-elgato-stream-deck/commit/6282b1b401ce5a17955c3dc01e0757773efa520c)) + + + + + +## [7.1.1](https://github.com/julusian/node-elgato-stream-deck/compare/v7.1.0...v7.1.1) (2024-11-14) + + +### Bug Fixes + +* simplify firmware versions ([1b94c63](https://github.com/julusian/node-elgato-stream-deck/commit/1b94c63a6742bfe47d424acdf4c70927d62066b2)) + + + + + +# [7.1.0](https://github.com/julusian/node-elgato-stream-deck/compare/v7.0.2...v7.1.0) (2024-11-14) + + +### Bug Fixes + +* fillKeyColor ([234fa8f](https://github.com/julusian/node-elgato-stream-deck/commit/234fa8f0cc8c5755f356d2a01f75c5374f616d00)) +* studio right encoder led ring offset ([024fd2a](https://github.com/julusian/node-elgato-stream-deck/commit/024fd2a108ac0adeb6cd8d152b507da32c410fa2)) +* studio right encoder led ring offset ([65839d8](https://github.com/julusian/node-elgato-stream-deck/commit/65839d8a1ea70ba8d85475b0d9950629dab1551c)) + + +### Features + +* additional studio firmware versions ([46c49d7](https://github.com/julusian/node-elgato-stream-deck/commit/46c49d7cc91263931ff2a0e3d9a50b2e20f96a44)) +* additional studio firmware versions (usb) ([4e2e5df](https://github.com/julusian/node-elgato-stream-deck/commit/4e2e5df1811427d78f4515b3e313a39e4625bbb7)) + + + + + +## [7.0.2](https://github.com/julusian/node-elgato-stream-deck/compare/v7.0.1...v7.0.2) (2024-09-16) + +**Note:** Version bump only for package @elgato-stream-deck/core + + + + + +## [7.0.1](https://github.com/julusian/node-elgato-stream-deck/compare/v7.0.0...v7.0.1) (2024-09-10) + + +### Bug Fixes + +* disable `SUPPORTS_RGB_KEY_FILL` for some models [#101](https://github.com/julusian/node-elgato-stream-deck/issues/101) ([d752b41](https://github.com/julusian/node-elgato-stream-deck/commit/d752b41726a37f3740ef5dafd85ec72408b19433)) + + + + + +# [7.0.0](https://github.com/julusian/node-elgato-stream-deck/compare/v7.0.0-0...v7.0.0) (2024-09-08) + + +### Features + +* streamdeck studio support ([#100](https://github.com/julusian/node-elgato-stream-deck/issues/100)) ([baf506d](https://github.com/julusian/node-elgato-stream-deck/commit/baf506da9f4a1e38bc8f7f393743491c21c59835)) + + + + + +# [7.0.0-0](https://github.com/julusian/node-elgato-stream-deck/compare/v6.2.2...v7.0.0-0) (2024-08-26) + +### Features + +* target nodejs 18 ([5fe6c09](https://github.com/julusian/node-elgato-stream-deck/commit/5fe6c092ba46e09a1814ff627ec2991359dadd6c)) +* rework how device functionality is exposed +* rework events structure + + + +## [6.2.2](https://github.com/julusian/node-elgato-stream-deck/compare/v6.2.1...v6.2.2) (2024-07-11) + +**Note:** Version bump only for package @elgato-stream-deck/core + + + + + +## [6.2.1](https://github.com/julusian/node-elgato-stream-deck/compare/v6.2.0...v6.2.1) (2024-07-11) + + +### Bug Fixes + +* val.readUint8 is not a function ([#95](https://github.com/julusian/node-elgato-stream-deck/issues/95)) ([d80b765](https://github.com/julusian/node-elgato-stream-deck/commit/d80b76572cb02589549315eaee92de7c08f963eb)) + + + + + +# [6.2.0](https://github.com/julusian/node-elgato-stream-deck/compare/v6.0.0...v6.2.0) (2024-04-30) + + +### Bug Fixes + +* clear neo screen as part of `clearPanel` ([53b88e5](https://github.com/julusian/node-elgato-stream-deck/commit/53b88e5772cd7e8f0fb9716e6e7f4d714e5c029f)) +* support longer serial numbers [#76](https://github.com/julusian/node-elgato-stream-deck/issues/76) ([545cb6e](https://github.com/julusian/node-elgato-stream-deck/commit/545cb6eaa2eccecc5f94e47973465e7b1a43f664)) + + +### Features + +* add `KEY_SPACING_VERTICAL` and `KEY_SPACING_HORIZONTAL` properties ([d69e5c7](https://github.com/julusian/node-elgato-stream-deck/commit/d69e5c74fe027e3763eee645b1639c367de19155)) +* neo lcd drawing ([7d13bc0](https://github.com/julusian/node-elgato-stream-deck/commit/7d13bc03306fccad119b4f203c9106bc93d5515b)) +* **node:** expose path of opened device [#65](https://github.com/julusian/node-elgato-stream-deck/issues/65) ([45ebbe5](https://github.com/julusian/node-elgato-stream-deck/commit/45ebbe5a9e721f3a89d027d977193f7aa322f6ce)) +* refactor image generation to be more modular ([4f62a9d](https://github.com/julusian/node-elgato-stream-deck/commit/4f62a9d05d7abb4d44779281cdc2285c66623f3a)) +* refactor streamdeck plus lcd image generation (needs testing) ([e32eaa5](https://github.com/julusian/node-elgato-stream-deck/commit/e32eaa53e47b6c43a5bf4ffa0a55afd9eee7be87)) +* support for streamdeck neo ([65197a7](https://github.com/julusian/node-elgato-stream-deck/commit/65197a7735d86ebd1883f96a5f7719b2bd1c95fb)) + + + + + +# [6.1.0](https://github.com/julusian/node-elgato-stream-deck/compare/v6.0.0...v6.1.0) (2024-04-21) + + +### Features + +* add `KEY_SPACING_VERTICAL` and `KEY_SPACING_HORIZONTAL` properties ([d69e5c7](https://github.com/julusian/node-elgato-stream-deck/commit/d69e5c74fe027e3763eee645b1639c367de19155)) +* **node:** expose path of opened device [#65](https://github.com/julusian/node-elgato-stream-deck/issues/65) ([45ebbe5](https://github.com/julusian/node-elgato-stream-deck/commit/45ebbe5a9e721f3a89d027d977193f7aa322f6ce)) + + + + + +# [6.0.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.7.3...v6.0.0) (2023-11-29) + + +### Features + +* use async node-hid ([#75](https://github.com/julusian/node-elgato-stream-deck/issues/75)) ([9938244](https://github.com/julusian/node-elgato-stream-deck/commit/9938244f1c61618ce821fe574127c5ae81211c72)) + + + + + +## [5.7.3](https://github.com/julusian/node-elgato-stream-deck/compare/v5.7.2...v5.7.3) (2023-06-20) + + +### Bug Fixes + +* streamdeck mini unable to be opened on windows ([f8b174a](https://github.com/julusian/node-elgato-stream-deck/commit/f8b174a31a1afabf6f8aa1b69ed52809f5f6316b)) + + + + + +# [5.7.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.6.0-alpha.0...v5.7.0) (2022-11-15) + + +### Features + +* streamdeck plus ([#59](https://github.com/julusian/node-elgato-stream-deck/issues/59)) ([37479d8](https://github.com/julusian/node-elgato-stream-deck/commit/37479d8a14bffe6eb421164bbaad1161dc302502)) + + +### Reverts + +* Revert "chore: switch to yarn3" ([45f6137](https://github.com/julusian/node-elgato-stream-deck/commit/45f613755a274c350b7819d30856cf7aa27f27e3)) + + + + + +# [5.6.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.6.0-alpha.0...v5.6.0) (2022-09-30) + +**Note:** Version bump only for package @elgato-stream-deck/core + + + + + +# [5.6.0-alpha.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.5.0...v5.6.0-alpha.0) (2022-09-25) + +**Note:** Version bump only for package @elgato-stream-deck/core + + + + + +# [5.5.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.5.0-alpha.1...v5.5.0) (2022-07-25) + +**Note:** Version bump only for package @elgato-stream-deck/core + + + + + +# [5.5.0-alpha.1](https://github.com/julusian/node-elgato-stream-deck/compare/v5.5.0-alpha.0...v5.5.0-alpha.1) (2022-07-25) + + +### Bug Fixes + +* mini-v2 ([b5bce79](https://github.com/julusian/node-elgato-stream-deck/commit/b5bce799c8b46f4d882e6b80e073445be3261b8b)) + + + + + +# [5.5.0-alpha.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.4.0...v5.5.0-alpha.0) (2022-07-08) + + +### Bug Fixes + +* optimise coordinate manipulation for buffers ([4ca3b66](https://github.com/julusian/node-elgato-stream-deck/commit/4ca3b66a03b17c1d495a726d89a90a3890b23ddc)) + + +### Features + +* implement mini-v2 ([4993389](https://github.com/julusian/node-elgato-stream-deck/commit/49933898efb8772a008f8427eca15d4a1b20448d)) + + + + + +# [5.4.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.4.0-alpha.0...v5.4.0) (2022-05-10) + + +### Bug Fixes + +* add missing tslib dependency ([6b53699](https://github.com/julusian/node-elgato-stream-deck/commit/6b536994bea3686b4b03fccadafeb2a532e63f4d)) + + + + + +# [5.4.0-alpha.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.3.1...v5.4.0-alpha.0) (2022-04-12) + + +### Features + +* support for the pedal (untested) ([ccc4389](https://github.com/julusian/node-elgato-stream-deck/commit/ccc4389844c67194060f32e741c41407713c4cf7)) + + + + + +# [5.2.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.2.0-alpha.1...v5.2.0) (2022-01-25) + +**Note:** Version bump only for package @elgato-stream-deck/core + + + + + +# [5.2.0-alpha.1](https://github.com/julusian/node-elgato-stream-deck/compare/v5.2.0-alpha.0...v5.2.0-alpha.1) (2022-01-19) + +**Note:** Version bump only for package @elgato-stream-deck/core + + + + + +# [5.2.0-alpha.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.1.2...v5.2.0-alpha.0) (2022-01-18) + + +### Features + +* add PRODUCT_NAME property ([fbe3d14](https://github.com/julusian/node-elgato-stream-deck/commit/fbe3d1476e5ce2c472cc738e0694c968a558e102)) + + + + + +## [5.1.2](https://github.com/julusian/node-elgato-stream-deck/compare/v5.1.1...v5.1.2) (2021-12-02) + + +### Bug Fixes + +* fillPanelBuffer not waiting for write [#28](https://github.com/julusian/node-elgato-stream-deck/issues/28) ([020a047](https://github.com/julusian/node-elgato-stream-deck/commit/020a047dceb8816f5b884d1aef3de07482c5d8c3)) + + + + + +## [5.1.1](https://github.com/julusian/node-elgato-stream-deck/compare/v5.1.0...v5.1.1) (2021-07-19) + + +### Bug Fixes + +* mk2 is different to v2 ([71feace](https://github.com/julusian/node-elgato-stream-deck/commit/71feace86e0c097ea2b375b4981c252628f7eb4b)) + + + + + +# [5.1.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.0.0...v5.1.0) (2021-07-19) + + +### Features + +* support streamdeck mk2 (15 key, new style) ([a239503](https://github.com/julusian/node-elgato-stream-deck/commit/a239503b2edf7d4a6dae780ffa5e7dfe481d8cd8)) + + + + + +# [5.0.0](https://github.com/julusian/node-elgato-stream-deck/compare/v4.0.0...v5.0.0) (2021-03-07) + +Initial release diff --git a/node_modules/@elgato-stream-deck/core/LICENSE b/node_modules/@elgato-stream-deck/core/LICENSE new file mode 100644 index 0000000..772f57c --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Julian Waller + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@elgato-stream-deck/core/README.md b/node_modules/@elgato-stream-deck/core/README.md new file mode 100644 index 0000000..5530302 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/README.md @@ -0,0 +1,16 @@ +# @elgato-stream-deck/core + +![Node CI](https://github.com/Julusian/node-elgato-stream-deck/workflows/Node%20CI/badge.svg) +[![codecov](https://codecov.io/gh/Julusian/node-elgato-stream-deck/branch/master/graph/badge.svg?token=Hl4QXGZJMF)](https://codecov.io/gh/Julusian/node-elgato-stream-deck) + +[![npm version](https://img.shields.io/npm/v/@elgato-stream-deck/core.svg)](https://npm.im/@elgato-stream-deck/core) +[![license](https://img.shields.io/npm/l/@elgato-stream-deck/core.svg)](https://npm.im/@elgato-stream-deck/core) + +[`@elgato-stream-deck/core`](https://github.com/julusian/node-elgato-stream-deck) is a shared library for interfacing +with the various models of the [Elgato Stream Deck](https://www.elgato.com/en/gaming/stream-deck). + +You should not be importing this package directly, instead you will want to do so via one of the wrapper libraries to provide the appropriate HID bindings for your target platform: + +- [`@elgato-stream-deck/node`](https://npm.im/@elgato-stream-deck/node) +- [`@elgato-stream-deck/webhid`](https://npm.im/@elgato-stream-deck/webhid) +- [`@elgato-stream-deck/tcp`](https://npm.im/@elgato-stream-deck/tcp) diff --git a/node_modules/@elgato-stream-deck/core/dist/controlDefinition.d.ts b/node_modules/@elgato-stream-deck/core/dist/controlDefinition.d.ts new file mode 100644 index 0000000..38a0d47 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/controlDefinition.d.ts @@ -0,0 +1,47 @@ +import type { Dimension } from './id.js'; +export interface StreamDeckControlDefinitionBase { + type: 'button' | 'encoder' | 'lcd-segment'; + row: number; + column: number; +} +export interface StreamDeckButtonControlDefinitionBase extends StreamDeckControlDefinitionBase { + type: 'button'; + index: number; + hidIndex: number; + feedbackType: 'none' | 'rgb' | 'lcd'; +} +export interface StreamDeckButtonControlDefinitionNoFeedback extends StreamDeckButtonControlDefinitionBase { + feedbackType: 'none'; +} +export interface StreamDeckButtonControlDefinitionRgbFeedback extends StreamDeckButtonControlDefinitionBase { + feedbackType: 'rgb'; +} +export interface StreamDeckButtonControlDefinitionLcdFeedback extends StreamDeckButtonControlDefinitionBase { + feedbackType: 'lcd'; + pixelSize: Dimension; +} +export type StreamDeckButtonControlDefinition = StreamDeckButtonControlDefinitionNoFeedback | StreamDeckButtonControlDefinitionRgbFeedback | StreamDeckButtonControlDefinitionLcdFeedback; +export interface StreamDeckEncoderControlDefinition extends StreamDeckControlDefinitionBase { + type: 'encoder'; + index: number; + hidIndex: number; + /** Whether the encoder has a central led */ + hasLed: boolean; + /** The number of steps in encoder led rings (if any) */ + ledRingSteps: number; + /** Encoding offset of the ring leds */ + lcdRingOffset?: number; +} +export interface StreamDeckLcdSegmentControlDefinition extends StreamDeckControlDefinitionBase { + type: 'lcd-segment'; + id: 0; + columnSpan: number; + rowSpan: number; + pixelSize: Dimension; + /** + * Whether the LCD segment supports drawing regions + */ + drawRegions: boolean; +} +export type StreamDeckControlDefinition = StreamDeckButtonControlDefinition | StreamDeckEncoderControlDefinition | StreamDeckLcdSegmentControlDefinition; +//# sourceMappingURL=controlDefinition.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/controlDefinition.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/controlDefinition.d.ts.map new file mode 100644 index 0000000..af3014f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/controlDefinition.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"controlDefinition.d.ts","sourceRoot":"","sources":["../src/controlDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC,MAAM,WAAW,+BAA+B;IAC/C,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,aAAa,CAAA;IAE1C,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,qCAAsC,SAAQ,+BAA+B;IAC7F,IAAI,EAAE,QAAQ,CAAA;IAEd,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAEhB,YAAY,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAA;CACpC;AACD,MAAM,WAAW,2CAA4C,SAAQ,qCAAqC;IACzG,YAAY,EAAE,MAAM,CAAA;CACpB;AACD,MAAM,WAAW,4CAA6C,SAAQ,qCAAqC;IAC1G,YAAY,EAAE,KAAK,CAAA;CACnB;AAED,MAAM,WAAW,4CAA6C,SAAQ,qCAAqC;IAC1G,YAAY,EAAE,KAAK,CAAA;IAEnB,SAAS,EAAE,SAAS,CAAA;CACpB;AAED,MAAM,MAAM,iCAAiC,GAC1C,2CAA2C,GAC3C,4CAA4C,GAC5C,4CAA4C,CAAA;AAE/C,MAAM,WAAW,kCAAmC,SAAQ,+BAA+B;IAC1F,IAAI,EAAE,SAAS,CAAA;IAEf,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAEhB,4CAA4C;IAC5C,MAAM,EAAE,OAAO,CAAA;IAEf,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAA;IACpB,uCAAuC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,qCAAsC,SAAQ,+BAA+B;IAC7F,IAAI,EAAE,aAAa,CAAA;IACnB,EAAE,EAAE,CAAC,CAAA;IAEL,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IAEf,SAAS,EAAE,SAAS,CAAA;IAEpB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,MAAM,2BAA2B,GACpC,iCAAiC,GACjC,kCAAkC,GAClC,qCAAqC,CAAA"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/controlDefinition.js b/node_modules/@elgato-stream-deck/core/dist/controlDefinition.js new file mode 100644 index 0000000..f985a72 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/controlDefinition.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=controlDefinition.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/controlDefinition.js.map b/node_modules/@elgato-stream-deck/core/dist/controlDefinition.js.map new file mode 100644 index 0000000..8ebb34f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/controlDefinition.js.map @@ -0,0 +1 @@ +{"version":3,"file":"controlDefinition.js","sourceRoot":"","sources":["../src/controlDefinition.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/controlsGenerator.d.ts b/node_modules/@elgato-stream-deck/core/dist/controlsGenerator.d.ts new file mode 100644 index 0000000..aa2f6bc --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/controlsGenerator.d.ts @@ -0,0 +1,5 @@ +import type { StreamDeckButtonControlDefinition, StreamDeckControlDefinition } from './controlDefinition.js'; +import type { Dimension } from './id.js'; +export declare function generateButtonsGrid(width: number, height: number, pixelSize: Dimension, rtl?: boolean, columnOffset?: number, rowOffset?: number): StreamDeckButtonControlDefinition[]; +export declare function freezeDefinitions(controls: StreamDeckControlDefinition[]): Readonly; +//# sourceMappingURL=controlsGenerator.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/controlsGenerator.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/controlsGenerator.d.ts.map new file mode 100644 index 0000000..a03000b --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/controlsGenerator.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"controlsGenerator.d.ts","sourceRoot":"","sources":["../src/controlsGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iCAAiC,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAA;AAC5G,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,GAAG,UAAQ,EACX,YAAY,SAAI,EAChB,SAAS,SAAI,GACX,iCAAiC,EAAE,CAqBrC;AASD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,2BAA2B,EAAE,GAAG,QAAQ,CAAC,2BAA2B,EAAE,CAAC,CAElH"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/controlsGenerator.js b/node_modules/@elgato-stream-deck/core/dist/controlsGenerator.js new file mode 100644 index 0000000..6e07943 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/controlsGenerator.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.generateButtonsGrid = generateButtonsGrid; +exports.freezeDefinitions = freezeDefinitions; +function generateButtonsGrid(width, height, pixelSize, rtl = false, columnOffset = 0, rowOffset = 0) { + const controls = []; + for (let row = 0; row < height; row++) { + for (let column = 0; column < width; column++) { + const index = row * width + column; + const hidIndex = rtl ? flipKeyIndex(width, index) : index; + controls.push({ + type: 'button', + row: row + rowOffset, + column: column + columnOffset, + index, + hidIndex, + feedbackType: 'lcd', + pixelSize, + }); + } + } + return controls; +} +function flipKeyIndex(columns, keyIndex) { + // Horizontal flip + const half = (columns - 1) / 2; + const diff = ((keyIndex % columns) - half) * -half; + return keyIndex + diff; +} +function freezeDefinitions(controls) { + return Object.freeze(controls.map((control) => Object.freeze(control))); +} +//# sourceMappingURL=controlsGenerator.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/controlsGenerator.js.map b/node_modules/@elgato-stream-deck/core/dist/controlsGenerator.js.map new file mode 100644 index 0000000..2ce2347 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/controlsGenerator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"controlsGenerator.js","sourceRoot":"","sources":["../src/controlsGenerator.ts"],"names":[],"mappings":";;AAGA,kDA4BC;AASD,8CAEC;AAvCD,SAAgB,mBAAmB,CAClC,KAAa,EACb,MAAc,EACd,SAAoB,EACpB,GAAG,GAAG,KAAK,EACX,YAAY,GAAG,CAAC,EAChB,SAAS,GAAG,CAAC;IAEb,MAAM,QAAQ,GAAwC,EAAE,CAAA;IAExD,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC;QACvC,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC;YAC/C,MAAM,KAAK,GAAG,GAAG,GAAG,KAAK,GAAG,MAAM,CAAA;YAClC,MAAM,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;YAEzD,QAAQ,CAAC,IAAI,CAAC;gBACb,IAAI,EAAE,QAAQ;gBACd,GAAG,EAAE,GAAG,GAAG,SAAS;gBACpB,MAAM,EAAE,MAAM,GAAG,YAAY;gBAC7B,KAAK;gBACL,QAAQ;gBACR,YAAY,EAAE,KAAK;gBACnB,SAAS;aACT,CAAC,CAAA;QACH,CAAC;IACF,CAAC;IAED,OAAO,QAAQ,CAAA;AAChB,CAAC;AAED,SAAS,YAAY,CAAC,OAAe,EAAE,QAAgB;IACtD,kBAAkB;IAClB,MAAM,IAAI,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;IAC9B,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAA;IAClD,OAAO,QAAQ,GAAG,IAAI,CAAA;AACvB,CAAC;AAED,SAAgB,iBAAiB,CAAC,QAAuC;IACxE,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AACxE,CAAC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/hid-device.d.ts b/node_modules/@elgato-stream-deck/core/dist/hid-device.d.ts new file mode 100644 index 0000000..2d18958 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/hid-device.d.ts @@ -0,0 +1,27 @@ +import type { EventEmitter } from 'eventemitter3'; +export interface HIDDeviceEvents { + error: [data: any]; + input: [keys: Uint8Array]; +} +/** + * The expected interface for a HIDDevice. + * This is to be implemented by any wrapping libraries to translate their platform specific devices into a common and simpler form + */ +export interface HIDDevice extends EventEmitter { + close(): Promise; + sendFeatureReport(data: Uint8Array): Promise; + getFeatureReport(reportId: number, reportLength: number): Promise; + sendReports(buffers: Uint8Array[]): Promise; + getDeviceInfo(): Promise; + getChildDeviceInfo(): Promise; +} +export interface HIDDeviceInfo { + readonly path: string | undefined; + readonly productId: number; + readonly vendorId: number; +} +export interface ChildHIDDeviceInfo extends HIDDeviceInfo { + readonly serialNumber: string; + readonly tcpPort: number; +} +//# sourceMappingURL=hid-device.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/hid-device.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/hid-device.d.ts.map new file mode 100644 index 0000000..35ad678 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/hid-device.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hid-device.d.ts","sourceRoot":"","sources":["../src/hid-device.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAClB,KAAK,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,SAAU,SAAQ,YAAY,CAAC,eAAe,CAAC;IAC/D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAEtB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClD,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IAE7E,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEjD,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC,CAAA;IAEvC,kBAAkB,IAAI,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAA;CACxD;AAED,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACxD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACxB"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/hid-device.js b/node_modules/@elgato-stream-deck/core/dist/hid-device.js new file mode 100644 index 0000000..888a97a --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/hid-device.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=hid-device.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/hid-device.js.map b/node_modules/@elgato-stream-deck/core/dist/hid-device.js.map new file mode 100644 index 0000000..b8a6682 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/hid-device.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hid-device.js","sourceRoot":"","sources":["../src/hid-device.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/id.d.ts b/node_modules/@elgato-stream-deck/core/dist/id.d.ts new file mode 100644 index 0000000..ee0468e --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/id.d.ts @@ -0,0 +1,27 @@ +export type KeyIndex = number; +export type EncoderIndex = number; +export type Dimension = { + width: number; + height: number; +}; +export declare enum DeviceModelId { + ORIGINAL = "original", + ORIGINALV2 = "originalv2", + ORIGINALMK2 = "original-mk2", + ORIGINALMK2SCISSOR = "original-mk2-scissor", + MINI = "mini", + XL = "xl", + PEDAL = "pedal", + PLUS = "plus", + NEO = "neo", + STUDIO = "studio", + MODULE6 = "6-module", + MODULE15 = "15-module", + MODULE32 = "32-module", + NETWORK_DOCK = "network-dock", + GALLEON_K100 = "galleon-k100" +} +export declare const MODEL_NAMES: { + [key in DeviceModelId]: string; +}; +//# sourceMappingURL=id.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/id.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/id.d.ts.map new file mode 100644 index 0000000..9c7b950 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/id.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../src/id.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAA;AAE7B,MAAM,MAAM,YAAY,GAAG,MAAM,CAAA;AAEjC,MAAM,MAAM,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAEzD,oBAAY,aAAa;IACxB,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,WAAW,iBAAiB;IAC5B,kBAAkB,yBAAyB;IAC3C,IAAI,SAAS;IACb,EAAE,OAAO;IACT,KAAK,UAAU;IACf,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,OAAO,aAAa;IACpB,QAAQ,cAAc;IACtB,QAAQ,cAAc;IACtB,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;CAC7B;AAED,eAAO,MAAM,WAAW,EAAE;KAAG,GAAG,IAAI,aAAa,GAAG,MAAM;CAgBzD,CAAA"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/id.js b/node_modules/@elgato-stream-deck/core/dist/id.js new file mode 100644 index 0000000..8a204e4 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/id.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MODEL_NAMES = exports.DeviceModelId = void 0; +var DeviceModelId; +(function (DeviceModelId) { + DeviceModelId["ORIGINAL"] = "original"; + DeviceModelId["ORIGINALV2"] = "originalv2"; + DeviceModelId["ORIGINALMK2"] = "original-mk2"; + DeviceModelId["ORIGINALMK2SCISSOR"] = "original-mk2-scissor"; + DeviceModelId["MINI"] = "mini"; + DeviceModelId["XL"] = "xl"; + DeviceModelId["PEDAL"] = "pedal"; + DeviceModelId["PLUS"] = "plus"; + DeviceModelId["NEO"] = "neo"; + DeviceModelId["STUDIO"] = "studio"; + DeviceModelId["MODULE6"] = "6-module"; + DeviceModelId["MODULE15"] = "15-module"; + DeviceModelId["MODULE32"] = "32-module"; + DeviceModelId["NETWORK_DOCK"] = "network-dock"; + DeviceModelId["GALLEON_K100"] = "galleon-k100"; +})(DeviceModelId || (exports.DeviceModelId = DeviceModelId = {})); +exports.MODEL_NAMES = { + [DeviceModelId.ORIGINAL]: 'Stream Deck', + [DeviceModelId.MINI]: 'Stream Deck Mini', + [DeviceModelId.XL]: 'Stream Deck XL', + [DeviceModelId.ORIGINALV2]: 'Stream Deck', + [DeviceModelId.ORIGINALMK2]: 'Stream Deck MK.2', + [DeviceModelId.ORIGINALMK2SCISSOR]: 'Stream Deck MK.2 (Scissor)', + [DeviceModelId.PLUS]: 'Stream Deck +', + [DeviceModelId.PEDAL]: 'Stream Deck Pedal', + [DeviceModelId.NEO]: 'Stream Deck Neo', + [DeviceModelId.STUDIO]: 'Stream Deck Studio', + [DeviceModelId.MODULE6]: 'Stream Deck 6 Module', + [DeviceModelId.MODULE15]: 'Stream Deck 15 Module', + [DeviceModelId.MODULE32]: 'Stream Deck 32 Module', + [DeviceModelId.NETWORK_DOCK]: 'Stream Deck Network Dock', + [DeviceModelId.GALLEON_K100]: 'Galleon K100 SD', +}; +//# sourceMappingURL=id.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/id.js.map b/node_modules/@elgato-stream-deck/core/dist/id.js.map new file mode 100644 index 0000000..7ed8b02 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/id.js.map @@ -0,0 +1 @@ +{"version":3,"file":"id.js","sourceRoot":"","sources":["../src/id.ts"],"names":[],"mappings":";;;AAMA,IAAY,aAgBX;AAhBD,WAAY,aAAa;IACxB,sCAAqB,CAAA;IACrB,0CAAyB,CAAA;IACzB,6CAA4B,CAAA;IAC5B,4DAA2C,CAAA;IAC3C,8BAAa,CAAA;IACb,0BAAS,CAAA;IACT,gCAAe,CAAA;IACf,8BAAa,CAAA;IACb,4BAAW,CAAA;IACX,kCAAiB,CAAA;IACjB,qCAAoB,CAAA;IACpB,uCAAsB,CAAA;IACtB,uCAAsB,CAAA;IACtB,8CAA6B,CAAA;IAC7B,8CAA6B,CAAA;AAC9B,CAAC,EAhBW,aAAa,6BAAb,aAAa,QAgBxB;AAEY,QAAA,WAAW,GAAuC;IAC9D,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,aAAa;IACvC,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,kBAAkB;IACxC,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,gBAAgB;IACpC,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,aAAa;IACzC,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,kBAAkB;IAC/C,CAAC,aAAa,CAAC,kBAAkB,CAAC,EAAE,4BAA4B;IAChE,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,eAAe;IACrC,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,mBAAmB;IAC1C,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,iBAAiB;IACtC,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,oBAAoB;IAC5C,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,sBAAsB;IAC/C,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,uBAAuB;IACjD,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,uBAAuB;IACjD,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE,0BAA0B;IACxD,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE,iBAAiB;CAC/C,CAAA"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/index.d.ts b/node_modules/@elgato-stream-deck/core/dist/index.d.ts new file mode 100644 index 0000000..1ff833d --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/index.d.ts @@ -0,0 +1,49 @@ +import type { HIDDevice } from './hid-device.js'; +import { DeviceModelId } from './id.js'; +import type { StreamDeck } from './types.js'; +import type { OpenStreamDeckOptions } from './models/base.js'; +import type { PropertiesService } from './services/properties/interface.js'; +export * from './types.js'; +export * from './id.js'; +export * from './controlDefinition.js'; +export type { PreparedBuffer } from './preparedBuffer.js'; +export type { HIDDevice, HIDDeviceInfo, HIDDeviceEvents, ChildHIDDeviceInfo } from './hid-device.js'; +export type { OpenStreamDeckOptions } from './models/base.js'; +export { StreamDeckProxy } from './proxy.js'; +export type { PropertiesService } from './services/properties/interface.js'; +export { uint8ArrayToDataView } from './util.js'; +export { parseAllFirmwareVersionsHelper } from './services/properties/all-firmware.js'; +/** Elgato vendor id */ +export declare const VENDOR_ID = 4057; +/** Corsair vendor id */ +export declare const CORSAIR_VENDOR_ID = 6940; +export declare enum DeviceModelType { + STREAMDECK = "streamdeck", + PEDAL = "pedal", + NETWORK_DOCK = "network-dock" +} +export interface DeviceModelSpec { + id: DeviceModelId; + type: DeviceModelType; + productIds: number[]; + vendorId: number; + productName: string; + /** + * If needing to filter by usage + */ + hidUsage?: number; + /** + * If needing to filter by interface number + */ + hidInterface?: number; + factory: (device: HIDDevice, options: Required, tcpPropertiesService?: PropertiesService) => StreamDeck | Promise; + hasNativeTcp: boolean; +} +/** List of all the known models, and the classes to use them */ +export declare const DEVICE_MODELS2: { + [key in DeviceModelId]: Omit; +}; +/** @deprecated maybe? */ +export declare const DEVICE_MODELS: DeviceModelSpec[]; +export declare function getStreamDeckModelName(modelId: DeviceModelId): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/index.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/index.d.ts.map new file mode 100644 index 0000000..04551d8 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iB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O,EAAE,QAAQ,CAAC,qBAAqB,CAAC,EACxC,oBAAoB,CAAC,EAAE,iBAAiB,KACpC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IAErC,YAAY,EAAE,OAAO,CAAA;CACrB;AAED,gEAAgE;AAChE,eAAO,MAAM,cAAc,EAAE;KAAG,GAAG,IAAI,aAAa,GAAG,IAAI,CAAC,eAAe,EAAE,IAAI,GAAG,aAAa,CAAC;CA4HjG,CAAA;AAED,yBAAyB;AACzB,eAAO,MAAM,aAAa,EAAE,eAAe,EAKzC,CAAA;AAEF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAErE"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/index.js b/node_modules/@elgato-stream-deck/core/dist/index.js new file mode 100644 index 0000000..60d94a7 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/index.js @@ -0,0 +1,154 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DEVICE_MODELS = exports.DEVICE_MODELS2 = exports.DeviceModelType = exports.CORSAIR_VENDOR_ID = exports.VENDOR_ID = exports.parseAllFirmwareVersionsHelper = exports.uint8ArrayToDataView = exports.StreamDeckProxy = void 0; +exports.getStreamDeckModelName = getStreamDeckModelName; +const tslib_1 = require("tslib"); +const id_js_1 = require("./id.js"); +const original_js_1 = require("./models/original.js"); +const _6_key_js_1 = require("./models/6-key.js"); +const _32_key_js_1 = require("./models/32-key.js"); +const _15_key_js_1 = require("./models/15-key.js"); +const plus_js_1 = require("./models/plus.js"); +const pedal_js_1 = require("./models/pedal.js"); +const neo_js_1 = require("./models/neo.js"); +const studio_js_1 = require("./models/studio.js"); +const network_dock_js_1 = require("./models/network-dock.js"); +const galleon_k100_js_1 = require("./models/galleon-k100.js"); +tslib_1.__exportStar(require("./types.js"), exports); +tslib_1.__exportStar(require("./id.js"), exports); +tslib_1.__exportStar(require("./controlDefinition.js"), exports); +var proxy_js_1 = require("./proxy.js"); +Object.defineProperty(exports, "StreamDeckProxy", { enumerable: true, get: function () { return proxy_js_1.StreamDeckProxy; } }); +var util_js_1 = require("./util.js"); +Object.defineProperty(exports, "uint8ArrayToDataView", { enumerable: true, get: function () { return util_js_1.uint8ArrayToDataView; } }); +var all_firmware_js_1 = require("./services/properties/all-firmware.js"); +Object.defineProperty(exports, "parseAllFirmwareVersionsHelper", { enumerable: true, get: function () { return all_firmware_js_1.parseAllFirmwareVersionsHelper; } }); +/** Elgato vendor id */ +exports.VENDOR_ID = 0x0fd9; +/** Corsair vendor id */ +exports.CORSAIR_VENDOR_ID = 0x1b1c; +var DeviceModelType; +(function (DeviceModelType) { + DeviceModelType["STREAMDECK"] = "streamdeck"; + DeviceModelType["PEDAL"] = "pedal"; + DeviceModelType["NETWORK_DOCK"] = "network-dock"; +})(DeviceModelType || (exports.DeviceModelType = DeviceModelType = {})); +/** List of all the known models, and the classes to use them */ +exports.DEVICE_MODELS2 = { + [id_js_1.DeviceModelId.ORIGINAL]: { + type: DeviceModelType.STREAMDECK, + productIds: [0x0060], + vendorId: exports.VENDOR_ID, + factory: original_js_1.StreamDeckOriginalFactory, + hasNativeTcp: false, + }, + [id_js_1.DeviceModelId.MINI]: { + type: DeviceModelType.STREAMDECK, + productIds: [0x0063, 0x0090, 0x00b3], + vendorId: exports.VENDOR_ID, + factory: (...args) => (0, _6_key_js_1.StreamDeck6KeyFactory)(id_js_1.DeviceModelId.MINI, ...args), + hasNativeTcp: false, + }, + [id_js_1.DeviceModelId.XL]: { + type: DeviceModelType.STREAMDECK, + productIds: [0x006c, 0x008f], + vendorId: exports.VENDOR_ID, + factory: (...args) => (0, _32_key_js_1.StreamDeck32KeyFactory)(id_js_1.DeviceModelId.XL, ...args), + hasNativeTcp: false, + }, + [id_js_1.DeviceModelId.ORIGINALV2]: { + type: DeviceModelType.STREAMDECK, + productIds: [0x006d], + vendorId: exports.VENDOR_ID, + factory: (...args) => (0, _15_key_js_1.StreamDeck15KeyFactory)(id_js_1.DeviceModelId.ORIGINALV2, ...args), + hasNativeTcp: false, + }, + [id_js_1.DeviceModelId.ORIGINALMK2]: { + type: DeviceModelType.STREAMDECK, + productIds: [0x0080], + vendorId: exports.VENDOR_ID, + factory: (...args) => (0, _15_key_js_1.StreamDeck15KeyFactory)(id_js_1.DeviceModelId.ORIGINALMK2, ...args), + hasNativeTcp: false, + }, + [id_js_1.DeviceModelId.ORIGINALMK2SCISSOR]: { + type: DeviceModelType.STREAMDECK, + productIds: [0x00a5], + vendorId: exports.VENDOR_ID, + factory: (...args) => (0, _15_key_js_1.StreamDeck15KeyFactory)(id_js_1.DeviceModelId.ORIGINALMK2SCISSOR, ...args), + hasNativeTcp: false, + }, + [id_js_1.DeviceModelId.PLUS]: { + type: DeviceModelType.STREAMDECK, + productIds: [0x0084], + vendorId: exports.VENDOR_ID, + factory: plus_js_1.StreamDeckPlusFactory, + hasNativeTcp: false, + }, + [id_js_1.DeviceModelId.PEDAL]: { + type: DeviceModelType.PEDAL, + productIds: [0x0086], + vendorId: exports.VENDOR_ID, + factory: pedal_js_1.StreamDeckPedalFactory, + hasNativeTcp: false, + }, + [id_js_1.DeviceModelId.NEO]: { + type: DeviceModelType.STREAMDECK, + productIds: [0x009a], + vendorId: exports.VENDOR_ID, + factory: neo_js_1.StreamDeckNeoFactory, + hasNativeTcp: false, + }, + [id_js_1.DeviceModelId.STUDIO]: { + type: DeviceModelType.STREAMDECK, + productIds: [0x00aa], + vendorId: exports.VENDOR_ID, + factory: studio_js_1.StreamDeckStudioFactory, + hasNativeTcp: true, + }, + [id_js_1.DeviceModelId.MODULE6]: { + type: DeviceModelType.STREAMDECK, + productIds: [0x00b8], + vendorId: exports.VENDOR_ID, + factory: (...args) => (0, _6_key_js_1.StreamDeck6KeyFactory)(id_js_1.DeviceModelId.MODULE6, ...args), + hasNativeTcp: false, + }, + [id_js_1.DeviceModelId.MODULE15]: { + type: DeviceModelType.STREAMDECK, + productIds: [0x00b9], + vendorId: exports.VENDOR_ID, + factory: (...args) => (0, _15_key_js_1.StreamDeck15KeyFactory)(id_js_1.DeviceModelId.MODULE15, ...args), + hasNativeTcp: false, + }, + [id_js_1.DeviceModelId.MODULE32]: { + type: DeviceModelType.STREAMDECK, + productIds: [0x00ba], + vendorId: exports.VENDOR_ID, + factory: (...args) => (0, _32_key_js_1.StreamDeck32KeyFactory)(id_js_1.DeviceModelId.MODULE32, ...args), + hasNativeTcp: false, + }, + [id_js_1.DeviceModelId.NETWORK_DOCK]: { + type: DeviceModelType.NETWORK_DOCK, + productIds: [0xffff], // Note: This isn't a real product id, but matches what is reported when querying the device + vendorId: exports.VENDOR_ID, + factory: network_dock_js_1.NetworkDockFactory, + hasNativeTcp: true, + }, + [id_js_1.DeviceModelId.GALLEON_K100]: { + type: DeviceModelType.STREAMDECK, + productIds: [0x2b18], + vendorId: exports.CORSAIR_VENDOR_ID, + factory: galleon_k100_js_1.GalleonK100Factory, + hidUsage: 0x01, + hidInterface: 0, + hasNativeTcp: false, + }, +}; +/** @deprecated maybe? */ +exports.DEVICE_MODELS = Object.entries(exports.DEVICE_MODELS2).map(([id, spec]) => { + const modelId = id; + return { id: modelId, productName: id_js_1.MODEL_NAMES[modelId], ...spec }; +}); +function getStreamDeckModelName(modelId) { + return id_js_1.MODEL_NAMES[modelId] || 'Unknown Stream Deck'; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/index.js.map b/node_modules/@elgato-stream-deck/core/dist/index.js.map new file mode 100644 index 0000000..4d8faad --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAqMA,wDAEC;;AAtMD,mCAAoD;AAGpD,sDAAgE;AAChE,iDAAyD;AACzD,mDAA2D;AAC3D,mDAA2D;AAC3D,8CAAwD;AACxD,gDAA0D;AAC1D,4CAAsD;AACtD,kDAA4D;AAE5D,8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;QACnB,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,IAAA,mCAAsB,EAAC,qBAAa,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC;QAE7E,YAAY,EAAE,KAAK;KACnB;IACD,CAAC,qBAAa,CAAC,YAAY,CAAC,EAAE;QAC7B,IAAI,EAAE,eAAe,CAAC,YAAY;QAClC,UAAU,EAAE,CAAC,MAAM,CAAC,EAAE,4FAA4F;QAClH,QAAQ,EAAE,iBAAS;QACnB,OAAO,EAAE,oCAAkB;QAE3B,YAAY,EAAE,IAAI;KAClB;IACD,CAAC,qBAAa,CAAC,YAAY,CAAC,EAAE;QAC7B,IAAI,EAAE,eAAe,CAAC,UAAU;QAChC,UAAU,EAAE,CAAC,MAAM,CAAC;QACpB,QAAQ,EAAE,yBAAiB;QAC3B,OAAO,EAAE,oCAAkB;QAE3B,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,CAAC;QAEf,YAAY,EAAE,KAAK;KACnB;CACD,CAAA;AAED,yBAAyB;AACZ,QAAA,aAAa,GAAsB,MAAM,CAAC,OAAO,CAC7D,sBAAc,CACd,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE;IACpB,MAAM,OAAO,GAAG,EAA0B,CAAA;IAC1C,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,mBAAW,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,EAAE,CAAA;AACnE,CAAC,CAAC,CAAA;AAEF,SAAgB,sBAAsB,CAAC,OAAsB;IAC5D,OAAO,mBAAW,CAAC,OAAO,CAAC,IAAI,qBAAqB,CAAA;AACrD,CAAC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/15-key.d.ts b/node_modules/@elgato-stream-deck/core/dist/models/15-key.d.ts new file mode 100644 index 0000000..ecb3324 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/15-key.d.ts @@ -0,0 +1,7 @@ +import type { HIDDevice } from '../hid-device.js'; +import type { OpenStreamDeckOptions } from './base.js'; +import { StreamDeckBase } from './base.js'; +import { type DeviceModelId } from '../id.js'; +import type { PropertiesService } from '../services/properties/interface.js'; +export declare function StreamDeck15KeyFactory(model: DeviceModelId, device: HIDDevice, options: Required, _tcpPropertiesService?: PropertiesService): StreamDeckBase; +//# sourceMappingURL=15-key.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/15-key.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/models/15-key.d.ts.map new file mode 100644 index 0000000..d8a36db --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/15-key.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"15-key.d.ts","sourceRoot":"","sources":["../../src/models/15-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAG1C,OAAO,EAAE,KAAK,aAAa,EAAe,MAAM,UAAU,CAAA;AAE1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAe5E,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,QAAQ,CAAC,qBAAqB,CAAC,EACxC,qBAAqB,CAAC,EAAE,iBAAiB,GACvC,cAAc,CAUhB"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/15-key.js b/node_modules/@elgato-stream-deck/core/dist/models/15-key.js new file mode 100644 index 0000000..3a51922 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/15-key.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamDeck15KeyFactory = StreamDeck15KeyFactory; +const base_js_1 = require("./base.js"); +const generic_gen2_js_1 = require("./generic-gen2.js"); +const id_js_1 = require("../id.js"); +const controlsGenerator_js_1 = require("../controlsGenerator.js"); +const base15KeyProperties = { + SUPPORTS_RGB_KEY_FILL: false, // TODO - verify SUPPORTS_RGB_KEY_FILL + CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)((0, controlsGenerator_js_1.generateButtonsGrid)(5, 3, { width: 72, height: 72 })), + KEY_SPACING_HORIZONTAL: 25, + KEY_SPACING_VERTICAL: 25, + FULLSCREEN_PANELS: 0, + HAS_NFC_READER: false, + SUPPORTS_CHILD_DEVICES: false, +}; +function StreamDeck15KeyFactory(model, device, options, _tcpPropertiesService) { + const properties = { + ...base15KeyProperties, + MODEL: model, + PRODUCT_NAME: id_js_1.MODEL_NAMES[model], + }; + const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, properties, null); + return new base_js_1.StreamDeckBase(device, options, services); +} +//# sourceMappingURL=15-key.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/15-key.js.map b/node_modules/@elgato-stream-deck/core/dist/models/15-key.js.map new file mode 100644 index 0000000..4bc1af7 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/15-key.js.map @@ -0,0 +1 @@ +{"version":3,"file":"15-key.js","sourceRoot":"","sources":["../../src/models/15-key.ts"],"names":[],"mappings":";;AAsBA,wDAeC;AAnCD,uCAA0C;AAE1C,uDAA4D;AAC5D,oCAA0D;AAC1D,kEAAgF;AAGhF,MAAM,mBAAmB,GAA6D;IACrF,qBAAqB,EAAE,KAAK,EAAE,sCAAsC;IAEpE,QAAQ,EAAE,IAAA,wCAAiB,EAAC,IAAA,0CAAmB,EAAC,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAEjF,sBAAsB,EAAE,EAAE;IAC1B,oBAAoB,EAAE,EAAE;IAExB,iBAAiB,EAAE,CAAC;IACpB,cAAc,EAAE,KAAK;IACrB,sBAAsB,EAAE,KAAK;CAC7B,CAAA;AAED,SAAgB,sBAAsB,CACrC,KAAoB,EACpB,MAAiB,EACjB,OAAwC,EACxC,qBAAyC;IAEzC,MAAM,UAAU,GAA6B;QAC5C,GAAG,mBAAmB;QACtB,KAAK,EAAE,KAAK;QACZ,YAAY,EAAE,mBAAW,CAAC,KAAK,CAAC;KAChC,CAAA;IAED,MAAM,QAAQ,GAAG,IAAA,0CAAwB,EAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;IAE5E,OAAO,IAAI,wBAAc,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;AACrD,CAAC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/32-key.d.ts b/node_modules/@elgato-stream-deck/core/dist/models/32-key.d.ts new file mode 100644 index 0000000..9d46df1 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/32-key.d.ts @@ -0,0 +1,7 @@ +import type { HIDDevice } from '../hid-device.js'; +import type { OpenStreamDeckOptions } from './base.js'; +import { StreamDeckBase } from './base.js'; +import { type DeviceModelId } from '../id.js'; +import type { PropertiesService } from '../services/properties/interface.js'; +export declare function StreamDeck32KeyFactory(model: DeviceModelId, device: HIDDevice, options: Required, _tcpPropertiesService?: PropertiesService): StreamDeckBase; +//# sourceMappingURL=32-key.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/32-key.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/models/32-key.d.ts.map new file mode 100644 index 0000000..0d03638 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/32-key.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"32-key.d.ts","sourceRoot":"","sources":["../../src/models/32-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAG1C,OAAO,EAAE,KAAK,aAAa,EAAe,MAAM,UAAU,CAAA;AAE1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAe5E,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,QAAQ,CAAC,qBAAqB,CAAC,EACxC,qBAAqB,CAAC,EAAE,iBAAiB,GACvC,cAAc,CAShB"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/32-key.js b/node_modules/@elgato-stream-deck/core/dist/models/32-key.js new file mode 100644 index 0000000..5d81415 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/32-key.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamDeck32KeyFactory = StreamDeck32KeyFactory; +const base_js_1 = require("./base.js"); +const generic_gen2_js_1 = require("./generic-gen2.js"); +const id_js_1 = require("../id.js"); +const controlsGenerator_js_1 = require("../controlsGenerator.js"); +const base32KeyProperties = { + SUPPORTS_RGB_KEY_FILL: false, // rev2 doesn't support it, even though rev1 does + CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)((0, controlsGenerator_js_1.generateButtonsGrid)(8, 4, { width: 96, height: 96 })), + KEY_SPACING_HORIZONTAL: 32, + KEY_SPACING_VERTICAL: 39, + FULLSCREEN_PANELS: 0, + HAS_NFC_READER: false, + SUPPORTS_CHILD_DEVICES: false, +}; +function StreamDeck32KeyFactory(model, device, options, _tcpPropertiesService) { + const properties = { + ...base32KeyProperties, + MODEL: model, + PRODUCT_NAME: id_js_1.MODEL_NAMES[model], + }; + const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, properties, null); + return new base_js_1.StreamDeckBase(device, options, services); +} +//# sourceMappingURL=32-key.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/32-key.js.map b/node_modules/@elgato-stream-deck/core/dist/models/32-key.js.map new file mode 100644 index 0000000..1c818a3 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/32-key.js.map @@ -0,0 +1 @@ +{"version":3,"file":"32-key.js","sourceRoot":"","sources":["../../src/models/32-key.ts"],"names":[],"mappings":";;AAsBA,wDAcC;AAlCD,uCAA0C;AAE1C,uDAA4D;AAC5D,oCAA0D;AAC1D,kEAAgF;AAGhF,MAAM,mBAAmB,GAA6D;IACrF,qBAAqB,EAAE,KAAK,EAAE,iDAAiD;IAE/E,QAAQ,EAAE,IAAA,wCAAiB,EAAC,IAAA,0CAAmB,EAAC,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAEjF,sBAAsB,EAAE,EAAE;IAC1B,oBAAoB,EAAE,EAAE;IAExB,iBAAiB,EAAE,CAAC;IACpB,cAAc,EAAE,KAAK;IACrB,sBAAsB,EAAE,KAAK;CAC7B,CAAA;AAED,SAAgB,sBAAsB,CACrC,KAAoB,EACpB,MAAiB,EACjB,OAAwC,EACxC,qBAAyC;IAEzC,MAAM,UAAU,GAA6B;QAC5C,GAAG,mBAAmB;QACtB,KAAK,EAAE,KAAK;QACZ,YAAY,EAAE,mBAAW,CAAC,KAAK,CAAC;KAChC,CAAA;IACD,MAAM,QAAQ,GAAG,IAAA,0CAAwB,EAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;IAE5E,OAAO,IAAI,wBAAc,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;AACrD,CAAC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/6-key.d.ts b/node_modules/@elgato-stream-deck/core/dist/models/6-key.d.ts new file mode 100644 index 0000000..c8df207 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/6-key.d.ts @@ -0,0 +1,6 @@ +import type { HIDDevice } from '../hid-device.js'; +import type { OpenStreamDeckOptions, StreamDeckBase } from './base.js'; +import { type DeviceModelId } from '../id.js'; +import type { PropertiesService } from '../services/properties/interface.js'; +export declare function StreamDeck6KeyFactory(model: DeviceModelId, device: HIDDevice, options: Required, _tcpPropertiesService?: PropertiesService): StreamDeckBase; +//# sourceMappingURL=6-key.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/6-key.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/models/6-key.d.ts.map new file mode 100644 index 0000000..457d365 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/6-key.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"6-key.d.ts","sourceRoot":"","sources":["../../src/models/6-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAGtE,OAAO,EAAE,KAAK,aAAa,EAAe,MAAM,UAAU,CAAA;AAI1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAa5E,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,QAAQ,CAAC,qBAAqB,CAAC,EACxC,qBAAqB,CAAC,EAAE,iBAAiB,GACvC,cAAc,CAehB"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/6-key.js b/node_modules/@elgato-stream-deck/core/dist/models/6-key.js new file mode 100644 index 0000000..1dc05b3 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/6-key.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamDeck6KeyFactory = StreamDeck6KeyFactory; +const generic_gen1_js_1 = require("./generic-gen1.js"); +const id_js_1 = require("../id.js"); +const controlsGenerator_js_1 = require("../controlsGenerator.js"); +const imageWriter_js_1 = require("../services/imageWriter/imageWriter.js"); +const headerGenerator_js_1 = require("../services/imageWriter/headerGenerator.js"); +const base6KeyProperties = { + SUPPORTS_RGB_KEY_FILL: false, // TODO - verify this + CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)((0, controlsGenerator_js_1.generateButtonsGrid)(3, 2, { width: 80, height: 80 })), + KEY_SPACING_HORIZONTAL: 28, + KEY_SPACING_VERTICAL: 28, + FULLSCREEN_PANELS: 0, +}; +function StreamDeck6KeyFactory(model, device, options, _tcpPropertiesService) { + const properties = { + ...base6KeyProperties, + MODEL: model, + PRODUCT_NAME: id_js_1.MODEL_NAMES[model], + }; + return (0, generic_gen1_js_1.StreamDeckGen1Factory)(device, options, properties, new imageWriter_js_1.StreamdeckDefaultImageWriter(new headerGenerator_js_1.StreamdeckGen1ImageHeaderGenerator()), { colorMode: 'bgr', rotate: true, yFlip: true }, 2835); +} +//# sourceMappingURL=6-key.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/6-key.js.map b/node_modules/@elgato-stream-deck/core/dist/models/6-key.js.map new file mode 100644 index 0000000..a5f9843 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/6-key.js.map @@ -0,0 +1 @@ +{"version":3,"file":"6-key.js","sourceRoot":"","sources":["../../src/models/6-key.ts"],"names":[],"mappings":";;AAqBA,sDAoBC;AAtCD,uDAAyD;AACzD,oCAA0D;AAC1D,kEAAgF;AAChF,2EAAqF;AACrF,mFAA+F;AAG/F,MAAM,kBAAkB,GAA6D;IACpF,qBAAqB,EAAE,KAAK,EAAE,qBAAqB;IAEnD,QAAQ,EAAE,IAAA,wCAAiB,EAAC,IAAA,0CAAmB,EAAC,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAEjF,sBAAsB,EAAE,EAAE;IAC1B,oBAAoB,EAAE,EAAE;IAExB,iBAAiB,EAAE,CAAC;CACpB,CAAA;AAED,SAAgB,qBAAqB,CACpC,KAAoB,EACpB,MAAiB,EACjB,OAAwC,EACxC,qBAAyC;IAEzC,MAAM,UAAU,GAA6B;QAC5C,GAAG,kBAAkB;QACrB,KAAK,EAAE,KAAK;QACZ,YAAY,EAAE,mBAAW,CAAC,KAAK,CAAC;KAChC,CAAA;IAED,OAAO,IAAA,uCAAqB,EAC3B,MAAM,EACN,OAAO,EACP,UAAU,EACV,IAAI,6CAA4B,CAAC,IAAI,uDAAkC,EAAE,CAAC,EAC1E,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAC/C,IAAI,CACJ,CAAA;AACF,CAAC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/base.d.ts b/node_modules/@elgato-stream-deck/core/dist/models/base.d.ts new file mode 100644 index 0000000..a9f132b --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/base.d.ts @@ -0,0 +1,82 @@ +import { EventEmitter } from 'eventemitter3'; +import type { HIDDevice, HIDDeviceInfo } from '../hid-device.js'; +import type { DeviceModelId, Dimension, KeyIndex } from '../id.js'; +import type { FillImageOptions, FillPanelDimensionsOptions, FillPanelOptions, StreamDeck, StreamDeckEvents, StreamDeckTcpChildDeviceInfo } from '../types.js'; +import type { ButtonsLcdDisplayService } from '../services/buttonsLcdDisplay/interface.js'; +import type { StreamDeckButtonControlDefinition, StreamDeckControlDefinition } from '../controlDefinition.js'; +import type { LcdSegmentDisplayService } from '../services/lcdSegmentDisplay/interface.js'; +import type { PropertiesService } from '../services/properties/interface.js'; +import type { CallbackHook } from '../services/callback-hook.js'; +import type { StreamDeckInputService } from '../services/input/interface.js'; +import type { EncoderLedService } from '../services/encoderLed/interface.js'; +import { type PreparedBuffer } from '../preparedBuffer.js'; +export type EncodeJPEGHelper = (buffer: Uint8Array, width: number, height: number) => Promise; +export interface OpenStreamDeckOptions { + encodeJPEG?: EncodeJPEGHelper; +} +export type StreamDeckProperties = Readonly<{ + MODEL: DeviceModelId; + PRODUCT_NAME: string; + KEY_DATA_OFFSET: number; + SUPPORTS_RGB_KEY_FILL: boolean; + CONTROLS: Readonly; + /** + * TODO - rework this + * @deprecated + */ + KEY_SPACING_HORIZONTAL: number; + /** + * TODO - rework this + * @deprecated + */ + KEY_SPACING_VERTICAL: number; + FULLSCREEN_PANELS: number; + HAS_NFC_READER: boolean; + /** Whether this device supports child devices */ + SUPPORTS_CHILD_DEVICES: boolean; +}>; +export interface StreamDeckServicesDefinition { + deviceProperties: StreamDeckProperties; + events: CallbackHook; + properties: PropertiesService; + buttonsLcd: ButtonsLcdDisplayService; + inputService: StreamDeckInputService; + lcdSegmentDisplay: LcdSegmentDisplayService | null; + encoderLed: EncoderLedService | null; +} +export declare class StreamDeckBase extends EventEmitter implements StreamDeck { + #private; + get CONTROLS(): Readonly; + get MODEL(): DeviceModelId; + get PRODUCT_NAME(): string; + get HAS_NFC_READER(): boolean; + protected readonly device: HIDDevice; + protected readonly deviceProperties: Readonly; + constructor(device: HIDDevice, _options: Readonly>, services: StreamDeckServicesDefinition); + protected checkValidKeyIndex(keyIndex: KeyIndex, feedbackType: StreamDeckButtonControlDefinition['feedbackType'] | null): void; + calculateFillPanelDimensions(options?: FillPanelDimensionsOptions): Dimension | null; + close(): Promise; + getHidDeviceInfo(): Promise; + setBrightness(percentage: number): Promise; + resetToLogo(): Promise; + getFirmwareVersion(): Promise; + getAllFirmwareVersions(): Promise>; + getSerialNumber(): Promise; + sendPreparedBuffer(buffer: PreparedBuffer): Promise; + fillKeyColor(keyIndex: KeyIndex, r: number, g: number, b: number): Promise; + fillKeyBuffer(keyIndex: KeyIndex, imageBuffer: Uint8Array, options?: FillImageOptions): Promise; + prepareFillKeyBuffer(keyIndex: KeyIndex, imageBuffer: Uint8Array | Uint8ClampedArray, options?: FillImageOptions, jsonSafe?: boolean): Promise; + fillPanelBuffer(imageBuffer: Uint8Array, options?: FillPanelOptions): Promise; + prepareFillPanelBuffer(imageBuffer: Uint8Array | Uint8ClampedArray, options?: FillPanelOptions, jsonSafe?: boolean): Promise; + clearKey(keyIndex: KeyIndex): Promise; + clearPanel(): Promise; + fillLcd(...args: Parameters): ReturnType; + fillLcdRegion(...args: Parameters): ReturnType; + prepareFillLcdRegion(...args: Parameters): ReturnType; + clearLcdSegment(...args: Parameters): ReturnType; + setEncoderColor(...args: Parameters): ReturnType; + setEncoderRingSingleColor(...args: Parameters): ReturnType; + setEncoderRingColors(...args: Parameters): ReturnType; + getChildDeviceInfo(): Promise; +} +//# sourceMappingURL=base.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/base.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/models/base.d.ts.map new file mode 100644 index 0000000..1309d91 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/base.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/models/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAClE,OAAO,KAAK,EACX,gBAAgB,EAChB,0BAA0B,EAC1B,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,4BAA4B,EAC5B,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAA;AAC1F,OAAO,KAAK,EAAE,iCAAiC,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAA;AAC7G,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAA;AAC1F,OAAO,KAAK,EAAE,iBAAiB,EAA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eAAe,CAC3B,GAAG,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,GAChD,UAAU,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAK/B,yBAAyB,CACrC,GAAG,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC,GAC1D,UAAU,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC;IAKzC,oBAAoB,CAChC,GAAG,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC,GACrD,UAAU,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;IAMpC,kBAAkB,IAAI,OAAO,CAAC,4BAA4B,GAAG,IAAI,CAAC;CAY/E"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/base.js b/node_modules/@elgato-stream-deck/core/dist/models/base.js new file mode 100644 index 0000000..f75af40 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/base.js @@ -0,0 +1,167 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamDeckBase = void 0; +const eventemitter3_1 = require("eventemitter3"); +const index_js_1 = require("../index.js"); +const preparedBuffer_js_1 = require("../preparedBuffer.js"); +class StreamDeckBase extends eventemitter3_1.EventEmitter { + get CONTROLS() { + return this.deviceProperties.CONTROLS; + } + // get KEY_SPACING_HORIZONTAL(): number { + // return this.deviceProperties.KEY_SPACING_HORIZONTAL + // } + // get KEY_SPACING_VERTICAL(): number { + // return this.deviceProperties.KEY_SPACING_VERTICAL + // } + get MODEL() { + return this.deviceProperties.MODEL; + } + get PRODUCT_NAME() { + return this.deviceProperties.PRODUCT_NAME; + } + get HAS_NFC_READER() { + return this.deviceProperties.HAS_NFC_READER; + } + device; + deviceProperties; + // readonly #options: Readonly> + #propertiesService; + #buttonsLcdService; + #lcdSegmentDisplayService; + #inputService; + #encoderLedService; + constructor(device, _options, services) { + super(); + this.device = device; + this.deviceProperties = services.deviceProperties; + // this.#options = options + this.#propertiesService = services.properties; + this.#buttonsLcdService = services.buttonsLcd; + this.#lcdSegmentDisplayService = services.lcdSegmentDisplay; + this.#inputService = services.inputService; + this.#encoderLedService = services.encoderLed; + // propogate events + services.events?.listen((key, ...args) => this.emit(key, ...args)); + this.device.on('input', (data) => this.#inputService.handleInput(data)); + this.device.on('error', (err) => { + this.emit('error', err); + }); + } + checkValidKeyIndex(keyIndex, feedbackType) { + const buttonControl = this.deviceProperties.CONTROLS.find((control) => control.type === 'button' && control.index === keyIndex); + if (!buttonControl) { + throw new TypeError(`Expected a valid keyIndex`); + } + if (feedbackType && buttonControl.feedbackType !== feedbackType) { + throw new TypeError(`Expected a keyIndex with expected feedbackType`); + } + } + calculateFillPanelDimensions(options) { + return this.#buttonsLcdService.calculateFillPanelDimensions(options); + } + async close() { + return this.device.close(); + } + async getHidDeviceInfo() { + return this.device.getDeviceInfo(); + } + async setBrightness(percentage) { + return this.#propertiesService.setBrightness(percentage); + } + async resetToLogo() { + return this.#propertiesService.resetToLogo(); + } + async getFirmwareVersion() { + return this.#propertiesService.getFirmwareVersion(); + } + async getAllFirmwareVersions() { + return this.#propertiesService.getAllFirmwareVersions(); + } + async getSerialNumber() { + return this.#propertiesService.getSerialNumber(); + } + async sendPreparedBuffer(buffer) { + const packets = (0, preparedBuffer_js_1.unwrapPreparedBufferToBuffer)(this.deviceProperties.MODEL, buffer); + await this.device.sendReports(packets); + } + async fillKeyColor(keyIndex, r, g, b) { + this.checkValidKeyIndex(keyIndex, null); + await this.#buttonsLcdService.fillKeyColor(keyIndex, r, g, b); + } + async fillKeyBuffer(keyIndex, imageBuffer, options) { + this.checkValidKeyIndex(keyIndex, 'lcd'); + await this.#buttonsLcdService.fillKeyBuffer(keyIndex, imageBuffer, options); + } + async prepareFillKeyBuffer(keyIndex, imageBuffer, options, jsonSafe) { + return this.#buttonsLcdService.prepareFillKeyBuffer(keyIndex, imageBuffer, options, jsonSafe); + } + async fillPanelBuffer(imageBuffer, options) { + await this.#buttonsLcdService.fillPanelBuffer(imageBuffer, options); + } + async prepareFillPanelBuffer(imageBuffer, options, jsonSafe) { + return this.#buttonsLcdService.prepareFillPanelBuffer(imageBuffer, options, jsonSafe); + } + async clearKey(keyIndex) { + this.checkValidKeyIndex(keyIndex, null); + await this.#buttonsLcdService.clearKey(keyIndex); + } + async clearPanel() { + const ps = []; + ps.push(this.#buttonsLcdService.clearPanel()); + if (this.#lcdSegmentDisplayService) + ps.push(this.#lcdSegmentDisplayService.clearAllLcdSegments()); + if (this.#encoderLedService) + ps.push(this.#encoderLedService.clearAll()); + await Promise.all(ps); + } + async fillLcd(...args) { + if (!this.#lcdSegmentDisplayService) + throw new Error('Not supported for this model'); + return this.#lcdSegmentDisplayService.fillLcd(...args); + } + async fillLcdRegion(...args) { + if (!this.#lcdSegmentDisplayService) + throw new Error('Not supported for this model'); + return this.#lcdSegmentDisplayService.fillLcdRegion(...args); + } + async prepareFillLcdRegion(...args) { + if (!this.#lcdSegmentDisplayService) + throw new Error('Not supported for this model'); + return this.#lcdSegmentDisplayService.prepareFillLcdRegion(...args); + } + async clearLcdSegment(...args) { + if (!this.#lcdSegmentDisplayService) + throw new Error('Not supported for this model'); + return this.#lcdSegmentDisplayService.clearLcdSegment(...args); + } + async setEncoderColor(...args) { + if (!this.#encoderLedService) + throw new Error('Not supported for this model'); + return this.#encoderLedService.setEncoderColor(...args); + } + async setEncoderRingSingleColor(...args) { + if (!this.#encoderLedService) + throw new Error('Not supported for this model'); + return this.#encoderLedService.setEncoderRingSingleColor(...args); + } + async setEncoderRingColors(...args) { + if (!this.#encoderLedService) + throw new Error('Not supported for this model'); + return this.#encoderLedService.setEncoderRingColors(...args); + } + async getChildDeviceInfo() { + const info = await this.device.getChildDeviceInfo(); + if (!info) + return null; + const model = index_js_1.DEVICE_MODELS.find((m) => m.productIds.includes(info.productId) && m.vendorId === info.vendorId); + if (!model) + return null; + return { + ...info, + model: model.id, + }; + } +} +exports.StreamDeckBase = StreamDeckBase; +//# sourceMappingURL=base.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/base.js.map b/node_modules/@elgato-stream-deck/core/dist/models/base.js.map new file mode 100644 index 0000000..7011fae --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/base.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/models/base.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAiB5C,0CAA2C;AAE3C,4DAAwF;AA4CxF,MAAa,cAAe,SAAQ,4BAA8B;IACjE,IAAI,QAAQ;QACX,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAA;IACtC,CAAC;IAED,yCAAyC;IACzC,uDAAuD;IACvD,IAAI;IACJ,uCAAuC;IACvC,qDAAqD;IACrD,IAAI;IAEJ,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAA;IACnC,CAAC;IACD,IAAI,YAAY;QACf,OAAO,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAA;IAC1C,CAAC;IAED,IAAI,cAAc;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAA;IAC5C,CAAC;IAEkB,MAAM,CAAW;IACjB,gBAAgB,CAAgC;IACnE,+DAA+D;IACtD,kBAAkB,CAAmB;IACrC,kBAAkB,CAA0B;IAC5C,yBAAyB,CAAiC;IAC1D,aAAa,CAAwB;IACrC,kBAAkB,CAA0B;IAErD,YACC,MAAiB,EACjB,QAAmD,EACnD,QAAsC;QAEtC,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC,gBAAgB,CAAA;QACjD,0BAA0B;QAC1B,IAAI,CAAC,kBAAkB,GAAG,QAAQ,CAAC,UAAU,CAAA;QAC7C,IAAI,CAAC,kBAAkB,GAAG,QAAQ,CAAC,UAAU,CAAA;QAC7C,IAAI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rC,GAAG,IAAyD;QAE5D,IAAI,CAAC,IAAI,CAAC,kBAAkB;YAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;QAE7E,OAAO,IAAI,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,GAAG,IAAI,CAAC,CAAA;IAClE,CAAC;IACM,KAAK,CAAC,oBAAoB,CAChC,GAAG,IAAoD;QAEvD,IAAI,CAAC,IAAI,CAAC,kBAAkB;YAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;QAE7E,OAAO,IAAI,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC,CAAA;IAC7D,CAAC;IAEM,KAAK,CAAC,kBAAkB;QAC9B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAA;QACnD,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAA;QAEtB,MAAM,KAAK,GAAG,wBAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC9G,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAA;QAEvB,OAAO;YACN,GAAG,IAAI;YACP,KAAK,EAAE,KAAK,CAAC,EAAE;SACf,CAAA;IACF,CAAC;CACD;AAjOD,wCAiOC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/galleon-k100.d.ts b/node_modules/@elgato-stream-deck/core/dist/models/galleon-k100.d.ts new file mode 100644 index 0000000..8df2359 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/galleon-k100.d.ts @@ -0,0 +1,6 @@ +import type { HIDDevice } from '../hid-device.js'; +import type { OpenStreamDeckOptions } from './base.js'; +import { StreamDeckBase } from './base.js'; +import type { PropertiesService } from '../services/properties/interface.js'; +export declare function GalleonK100Factory(device: HIDDevice, options: Required, _tcpPropertiesService?: PropertiesService): Promise; +//# sourceMappingURL=galleon-k100.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/galleon-k100.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/models/galleon-k100.d.ts.map new file mode 100644 index 0000000..415dba9 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/galleon-k100.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"galleon-k100.d.ts","sourceRoot":"","sources":["../../src/models/galleon-k100.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAgC,MAAM,WAAW,CAAA;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAK1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAiE5E,wBAAsB,kBAAkB,CACvC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,QAAQ,CAAC,qBAAqB,CAAC,EACxC,qBAAqB,CAAC,EAAE,iBAAiB,GACvC,OAAO,CAAC,cAAc,CAAC,CAWzB"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/galleon-k100.js b/node_modules/@elgato-stream-deck/core/dist/models/galleon-k100.js new file mode 100644 index 0000000..6b10e3b --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/galleon-k100.js @@ -0,0 +1,88 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.GalleonK100Factory = GalleonK100Factory; +const base_js_1 = require("./base.js"); +const generic_gen2_js_1 = require("./generic-gen2.js"); +const id_js_1 = require("../id.js"); +const controlsGenerator_js_1 = require("../controlsGenerator.js"); +const galleonK100_js_1 = require("../services/encoderLed/galleonK100.js"); +const generic_js_1 = require("../services/lcdSegmentDisplay/generic.js"); +const k100Controls = (0, controlsGenerator_js_1.generateButtonsGrid)(3, 4, { width: 160, height: 160 }, false, 0, 2); +k100Controls.push({ + type: 'encoder', + row: 0, + column: 0, + index: 0, + hidIndex: 0, + hasLed: false, + ledRingSteps: 4, + lcdRingOffset: 3, +}, { + type: 'encoder', + row: 0, + column: 2, + index: 1, + hidIndex: 1, + hasLed: false, + ledRingSteps: 4, + lcdRingOffset: 1, +}, { + type: 'lcd-segment', + row: 1, + column: 0, + columnSpan: 3, + rowSpan: 1, + id: 0, + pixelSize: Object.freeze({ + width: 720, + height: 384, + }), + drawRegions: true, +}); +const galleonK100Properties = { + MODEL: id_js_1.DeviceModelId.GALLEON_K100, + PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.GALLEON_K100], + SUPPORTS_RGB_KEY_FILL: true, + CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)(k100Controls), + KEY_SPACING_HORIZONTAL: 64, + KEY_SPACING_VERTICAL: 64, + FULLSCREEN_PANELS: 0, + HAS_NFC_READER: false, + SUPPORTS_CHILD_DEVICES: false, +}; +const lcdSegmentControls = galleonK100Properties.CONTROLS.filter((control) => control.type === 'lcd-segment'); +async function GalleonK100Factory(device, options, _tcpPropertiesService) { + const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, galleonK100Properties, null, true); + services.encoderLed = new galleonK100_js_1.GalleonK100EncoderLedService(device, galleonK100Properties.CONTROLS); + services.lcdSegmentDisplay = new generic_js_1.StreamdeckDefaultLcdService(options.encodeJPEG, device, lcdSegmentControls); + const streamDeck = new GalleonK100StreamDeck(device, options, services); + // Wait for the device to be ready + await new Promise((resolve) => setTimeout(resolve, 200)); + return streamDeck; +} +class GalleonK100StreamDeck extends base_js_1.StreamDeckBase { + #pingInterval; + constructor(device, options, services) { + super(device, options, services); + // Stop the ping upon error + device.on('error', () => this.#stopPing()); + this.#pingInterval = setInterval(this.#sendPing, 500); + this.#sendPing(); + } + async close() { + this.#stopPing(); + return super.close(); + } + #sendPing = () => { + this.device.sendFeatureReport(new Uint8Array([0x03, 0x27])).catch((e) => { + // Emit as an error on the streamdeck + this.emit('error', e); + this.#stopPing(); + }); + }; + #stopPing() { + // Stop pinging + clearInterval(this.#pingInterval); + } +} +//# sourceMappingURL=galleon-k100.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/galleon-k100.js.map b/node_modules/@elgato-stream-deck/core/dist/models/galleon-k100.js.map new file mode 100644 index 0000000..bb22ca0 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/galleon-k100.js.map @@ -0,0 +1 @@ +{"version":3,"file":"galleon-k100.js","sourceRoot":"","sources":["../../src/models/galleon-k100.ts"],"names":[],"mappings":";;AAwEA,gDAeC;AArFD,uCAA0C;AAE1C,uDAA4D;AAC5D,oCAAqD;AACrD,kEAAgF;AAGhF,0EAAoF;AACpF,yEAAsF;AAEtF,MAAM,YAAY,GAAkC,IAAA,0CAAmB,EAAC,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;AACvH,YAAY,CAAC,IAAI,CAChB;IACC,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IAEX,MAAM,EAAE,KAAK;IACb,YAAY,EAAE,CAAC;IACf,aAAa,EAAE,CAAC;CAChB,EACD;IACC,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IAEX,MAAM,EAAE,KAAK;IACb,YAAY,EAAE,CAAC;IACf,aAAa,EAAE,CAAC;CAChB,EACD;IACC,IAAI,EAAE,aAAa;IACnB,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC;IACT,UAAU,EAAE,CAA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C,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;IAExD,OAAO,UAAU,CAAA;AAClB,CAAC;AAED,MAAM,qBAAsB,SAAQ,wBAAc;IACxC,aAAa,CAAgB;IAEtC,YACC,MAAiB,EACjB,OAAkD,EAClD,QAAsC;QAEtC,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;QAEhC,2BAA2B;QAC3B,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAA;QAE1C,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;QACrD,IAAI,CAAC,SAAS,EAAE,CAAA;IACjB,CAAC;IAEM,KAAK,CAAC,KAAK;QACjB,IAAI,CAAC,SAAS,EAAE,CAAA;QAEhB,OAAO,KAAK,CAAC,KAAK,EAAE,CAAA;IACrB,CAAC;IAED,SAAS,GAAG,GAAS,EAAE;QACtB,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACvE,qCAAqC;YACrC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;YACrB,IAAI,CAAC,SAAS,EAAE,CAAA;QACjB,CAAC,CAAC,CAAA;IACH,CAAC,CAAA;IAED,SAAS;QACR,eAAe;QACf,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;IAClC,CAAC;CACD"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/generic-gen1.d.ts b/node_modules/@elgato-stream-deck/core/dist/models/generic-gen1.d.ts new file mode 100644 index 0000000..0015f2d --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/generic-gen1.d.ts @@ -0,0 +1,8 @@ +import type { HIDDevice } from '../hid-device.js'; +import type { OpenStreamDeckOptions, StreamDeckProperties } from './base.js'; +import { StreamDeckBase } from './base.js'; +import type { StreamdeckImageWriter } from '../services/imageWriter/types.js'; +import type { FillImageTargetOptions } from '../util.js'; +export type StreamDeckGen1Properties = Omit; +export declare function StreamDeckGen1Factory(device: HIDDevice, options: Required, properties: StreamDeckGen1Properties, imageWriter: StreamdeckImageWriter, targetOptions: FillImageTargetOptions, bmpImagePPM: number): StreamDeckBase; +//# sourceMappingURL=generic-gen1.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/generic-gen1.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/models/generic-gen1.d.ts.map new file mode 100644 index 0000000..895c66b --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/generic-gen1.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"generic-gen1.d.ts","sourceRoot":"","sources":["../../src/models/generic-gen1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAiBxD,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAC1C,oBAAoB,EACpB,iBAAiB,GAAG,gBAAgB,GAAG,wBAAwB,CAC/D,CAAA;AAED,wBAAgB,qBAAqB,CACpC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,QAAQ,CAAC,qBAAqB,CAAC,EACxC,UAAU,EAAE,wBAAwB,EACpC,WAAW,EAAE,qBAAqB,EAClC,aAAa,EAAE,sBAAsB,EACrC,WAAW,EAAE,MAAM,GACjB,cAAc,CAmBhB"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/generic-gen1.js b/node_modules/@elgato-stream-deck/core/dist/models/generic-gen1.js new file mode 100644 index 0000000..112df79 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/generic-gen1.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamDeckGen1Factory = StreamDeckGen1Factory; +const base_js_1 = require("./base.js"); +const gen1_js_1 = require("../services/properties/gen1.js"); +const default_js_1 = require("../services/buttonsLcdDisplay/default.js"); +const bitmap_js_1 = require("../services/imagePacker/bitmap.js"); +const callback_hook_js_1 = require("../services/callback-hook.js"); +const gen1_js_2 = require("../services/input/gen1.js"); +function extendDevicePropertiesForGen1(rawProps) { + return { + ...rawProps, + KEY_DATA_OFFSET: 0, + HAS_NFC_READER: false, + SUPPORTS_CHILD_DEVICES: false, + }; +} +function StreamDeckGen1Factory(device, options, properties, imageWriter, targetOptions, bmpImagePPM) { + const fullProperties = extendDevicePropertiesForGen1(properties); + const events = new callback_hook_js_1.CallbackHook(); + return new base_js_1.StreamDeckBase(device, options, { + deviceProperties: fullProperties, + events, + properties: new gen1_js_1.Gen1PropertiesService(device), + buttonsLcd: new default_js_1.DefaultButtonsLcdService(imageWriter, new bitmap_js_1.BitmapButtonLcdImagePacker(targetOptions, bmpImagePPM), device, fullProperties), + lcdSegmentDisplay: null, + inputService: new gen1_js_2.ButtonOnlyInputService(fullProperties, events), + encoderLed: null, + }); +} +//# sourceMappingURL=generic-gen1.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/generic-gen1.js.map b/node_modules/@elgato-stream-deck/core/dist/models/generic-gen1.js.map new file mode 100644 index 0000000..caa2c3f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/generic-gen1.js.map @@ -0,0 +1 @@ +{"version":3,"file":"generic-gen1.js","sourceRoot":"","sources":["../../src/models/generic-gen1.ts"],"names":[],"mappings":";;AA0BA,sDA0BC;AAlDD,uCAA0C;AAG1C,4DAAsE;AACtE,yEAAmF;AACnF,iEAA8E;AAC9E,mEAA2D;AAE3D,uDAAkE;AAElE,SAAS,6BAA6B,CAAC,QAAkC;IACxE,OAAO;QACN,GAAG,QAAQ;QACX,eAAe,EAAE,CAAC;QAClB,cAAc,EAAE,KAAK;QACrB,sBAAsB,EAAE,KAAK;KAC7B,CAAA;AACF,CAAC;AAOD,SAAgB,qBAAqB,CACpC,MAAiB,EACjB,OAAwC,EACxC,UAAoC,EACpC,WAAkC,EAClC,aAAqC,EACrC,WAAmB;IAEnB,MAAM,cAAc,GAAG,6BAA6B,CAAC,UAAU,CAAC,CAAA;IAEhE,MAAM,MAAM,GAAG,IAAI,+BAAY,EAAoB,CAAA;IAEnD,OAAO,IAAI,wBAAc,CAAC,MAAM,EAAE,OAAO,EAAE;QAC1C,gBAAgB,EAAE,cAAc;QAChC,MAAM;QACN,UAAU,EAAE,IAAI,+BAAqB,CAAC,MAAM,CAAC;QAC7C,UAAU,EAAE,IAAI,qCAAwB,CACvC,WAAW,EACX,IAAI,sCAA0B,CAAC,aAAa,EAAE,WAAW,CAAC,EAC1D,MAAM,EACN,cAAc,CACd;QACD,iBAAiB,EAAE,IAAI;QACvB,YAAY,EAAE,IAAI,gCAAsB,CAAC,cAAc,EAAE,MAAM,CAAC;QAChE,UAAU,EAAE,IAAI;KAChB,CAAC,CAAA;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/generic-gen2.d.ts b/node_modules/@elgato-stream-deck/core/dist/models/generic-gen2.d.ts new file mode 100644 index 0000000..31620cf --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/generic-gen2.d.ts @@ -0,0 +1,6 @@ +import type { HIDDevice } from '../hid-device.js'; +import type { OpenStreamDeckOptions, StreamDeckProperties, StreamDeckServicesDefinition } from './base.js'; +import type { PropertiesService } from '../services/properties/interface.js'; +export type StreamDeckGen2Properties = Omit; +export declare function createBaseGen2Properties(device: HIDDevice, options: Required, properties: StreamDeckGen2Properties, propertiesService: PropertiesService | null, disableXYFlip?: boolean): StreamDeckServicesDefinition; +//# sourceMappingURL=generic-gen2.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/generic-gen2.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/models/generic-gen2.d.ts.map new file mode 100644 index 0000000..5bf1cfb --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/generic-gen2.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"generic-gen2.d.ts","sourceRoot":"","sources":["../../src/models/generic-gen2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,MAAM,WAAW,CAAA;AAS1G,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAS5E,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAA;AAEpF,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,QAAQ,CAAC,qBAAqB,CAAC,EACxC,UAAU,EAAE,wBAAwB,EACpC,iBAAiB,EAAE,iBAAiB,GAAG,IAAI,EAC3C,aAAa,CAAC,EAAE,OAAO,GACrB,4BAA4B,CAmB9B"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/generic-gen2.js b/node_modules/@elgato-stream-deck/core/dist/models/generic-gen2.js new file mode 100644 index 0000000..5313733 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/generic-gen2.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createBaseGen2Properties = createBaseGen2Properties; +const imageWriter_js_1 = require("../services/imageWriter/imageWriter.js"); +const headerGenerator_js_1 = require("../services/imageWriter/headerGenerator.js"); +const default_js_1 = require("../services/buttonsLcdDisplay/default.js"); +const callback_hook_js_1 = require("../services/callback-hook.js"); +const gen2_js_1 = require("../services/properties/gen2.js"); +const jpeg_js_1 = require("../services/imagePacker/jpeg.js"); +const gen2_js_2 = require("../services/input/gen2.js"); +function extendDevicePropertiesForGen2(rawProps) { + return { + ...rawProps, + KEY_DATA_OFFSET: 3, + }; +} +function createBaseGen2Properties(device, options, properties, propertiesService, disableXYFlip) { + const fullProperties = extendDevicePropertiesForGen2(properties); + const events = new callback_hook_js_1.CallbackHook(); + return { + deviceProperties: fullProperties, + events, + properties: propertiesService ?? new gen2_js_1.Gen2PropertiesService(device), + buttonsLcd: new default_js_1.DefaultButtonsLcdService(new imageWriter_js_1.StreamdeckDefaultImageWriter(new headerGenerator_js_1.StreamdeckGen2ImageHeaderGenerator()), new jpeg_js_1.JpegButtonLcdImagePacker(options.encodeJPEG, !disableXYFlip), device, fullProperties), + lcdSegmentDisplay: null, + inputService: new gen2_js_2.Gen2InputService(fullProperties, events), + encoderLed: null, + }; +} +//# sourceMappingURL=generic-gen2.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/generic-gen2.js.map b/node_modules/@elgato-stream-deck/core/dist/models/generic-gen2.js.map new file mode 100644 index 0000000..6ca06e6 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/generic-gen2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"generic-gen2.js","sourceRoot":"","sources":["../../src/models/generic-gen2.ts"],"names":[],"mappings":";;AAqBA,4DAyBC;AA5CD,2EAAqF;AACrF,mFAA+F;AAC/F,yEAAmF;AACnF,mEAA2D;AAE3D,4DAAsE;AACtE,6DAA0E;AAC1E,uDAA4D;AAG5D,SAAS,6BAA6B,CAAC,QAAkC;IACxE,OAAO;QACN,GAAG,QAAQ;QACX,eAAe,EAAE,CAAC;KAClB,CAAA;AACF,CAAC;AAID,SAAgB,wBAAwB,CACvC,MAAiB,EACjB,OAAwC,EACxC,UAAoC,EACpC,iBAA2C,EAC3C,aAAuB;IAEvB,MAAM,cAAc,GAAG,6BAA6B,CAAC,UAAU,CAAC,CAAA;IAEhE,MAAM,MAAM,GAAG,IAAI,+BAAY,EAAoB,CAAA;IAEnD,OAAO;QACN,gBAAgB,EAAE,cAAc;QAChC,MAAM;QACN,UAAU,EAAE,iBAAiB,IAAI,IAAI,+BAAqB,CAAC,MAAM,CAAC;QAClE,UAAU,EAAE,IAAI,qCAAwB,CACvC,IAAI,6CAA4B,CAAC,IAAI,uDAAkC,EAAE,CAAC,EAC1E,IAAI,kCAAwB,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,aAAa,CAAC,EAChE,MAAM,EACN,cAAc,CACd;QACD,iBAAiB,EAAE,IAAI;QACvB,YAAY,EAAE,IAAI,0BAAgB,CAAC,cAAc,EAAE,MAAM,CAAC;QAC1D,UAAU,EAAE,IAAI;KAChB,CAAA;AACF,CAAC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/neo.d.ts b/node_modules/@elgato-stream-deck/core/dist/models/neo.d.ts new file mode 100644 index 0000000..9516cfc --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/neo.d.ts @@ -0,0 +1,5 @@ +import type { HIDDevice } from '../hid-device.js'; +import type { OpenStreamDeckOptions } from './base.js'; +import { StreamDeckBase } from './base.js'; +export declare function StreamDeckNeoFactory(device: HIDDevice, options: Required): StreamDeckBase; +//# sourceMappingURL=neo.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/neo.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/models/neo.d.ts.map new file mode 100644 index 0000000..845104f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/neo.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"neo.d.ts","sourceRoot":"","sources":["../../src/models/neo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AA8D1C,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,qBAAqB,CAAC,GAAG,cAAc,CAKhH"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/neo.js b/node_modules/@elgato-stream-deck/core/dist/models/neo.js new file mode 100644 index 0000000..8a34dec --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/neo.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamDeckNeoFactory = StreamDeckNeoFactory; +const base_js_1 = require("./base.js"); +const id_js_1 = require("../id.js"); +const generic_gen2_js_1 = require("./generic-gen2.js"); +const controlsGenerator_js_1 = require("../controlsGenerator.js"); +const neo_js_1 = require("../services/lcdSegmentDisplay/neo.js"); +const neoControls = (0, controlsGenerator_js_1.generateButtonsGrid)(4, 2, { width: 96, height: 96 }); +neoControls.push({ + type: 'button', + row: 2, + column: 0, + index: 8, + hidIndex: 8, + feedbackType: 'rgb', +}, { + type: 'lcd-segment', + row: 2, + column: 1, + columnSpan: 2, + rowSpan: 1, + id: 0, + pixelSize: { + width: 248, + height: 58, + }, + drawRegions: false, +}, { + type: 'button', + row: 2, + column: 3, + index: 9, + hidIndex: 9, + feedbackType: 'rgb', +}); +const neoProperties = { + MODEL: id_js_1.DeviceModelId.NEO, + PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.NEO], + CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)(neoControls), + KEY_SPACING_HORIZONTAL: 30, + KEY_SPACING_VERTICAL: 30, + FULLSCREEN_PANELS: 0, + HAS_NFC_READER: false, + SUPPORTS_CHILD_DEVICES: false, + SUPPORTS_RGB_KEY_FILL: true, +}; +const lcdSegmentControls = neoProperties.CONTROLS.filter((control) => control.type === 'lcd-segment'); +function StreamDeckNeoFactory(device, options) { + const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, neoProperties, null); + services.lcdSegmentDisplay = new neo_js_1.StreamDeckNeoLcdService(options.encodeJPEG, device, lcdSegmentControls); + return new base_js_1.StreamDeckBase(device, options, services); +} +//# sourceMappingURL=neo.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/neo.js.map b/node_modules/@elgato-stream-deck/core/dist/models/neo.js.map new file mode 100644 index 0000000..14a1541 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/neo.js.map @@ -0,0 +1 @@ +{"version":3,"file":"neo.js","sourceRoot":"","sources":["../../src/models/neo.ts"],"names":[],"mappings":";;AAgEA,oDAKC;AAnED,uCAA0C;AAC1C,oCAAqD;AAErD,uDAA4D;AAC5D,kEAAgF;AAEhF,iEAA8E;AAE9E,MAAM,WAAW,GAAkC,IAAA,0CAAmB,EAAC,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAA;AACvG,WAAW,CAAC,IAAI,CACf;IACC,IAAI,EAAE,QAAQ;IACd,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,YAAY,EAAE,KAAK;CACnB,EACD;IACC,IAAI,EAAE,aAAa;IACnB,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC;IACT,UAAU,EAAE,CAAC;IACb,OAAO,EAAE,CAAC;IAEV,EAAE,EAAE,CAAC;IAEL,SAAS,EAAE;QACV,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,EAAE;KACV;IAED,WAAW,EAAE,KAAK;CAClB,EACD;IACC,IAAI,EAAE,QAAQ;IACd,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,YAAY,EAAE,KAAK;CACnB,CACD,CAAA;AAED,MAAM,aAAa,GAA6B;IAC/C,KAAK,EAAE,qBAAa,CAAC,GAAG;IACxB,YAAY,EAAE,mBAAW,CAAC,qBAAa,CAAC,GAAG,CAAC;IAE5C,QAAQ,EAAE,IAAA,wCAAiB,EAAC,WAAW,CAAC;IAExC,sBAAsB,EAAE,EAAE;IAC1B,oBAAoB,EAAE,EAAE;IAExB,iBAAiB,EAAE,CAAC;IACpB,cAAc,EAAE,KAAK;IACrB,sBAAsB,EAAE,KAAK;IAC7B,qBAAqB,EAAE,IAAI;CAC3B,CAAA;AACD,MAAM,kBAAkB,GAAG,aAAa,CAAC,QAAQ,CAAC,MAAM,CACvD,CAAC,OAAO,EAAoD,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,aAAa,CAC7F,CAAA;AAED,SAAgB,oBAAoB,CAAC,MAAiB,EAAE,OAAwC;IAC/F,MAAM,QAAQ,GAAG,IAAA,0CAAwB,EAAC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,CAAC,CAAA;IAC/E,QAAQ,CAAC,iBAAiB,GAAG,IAAI,gCAAuB,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,kBAAkB,CAAC,CAAA;IAExG,OAAO,IAAI,wBAAc,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;AACrD,CAAC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/network-dock.d.ts b/node_modules/@elgato-stream-deck/core/dist/models/network-dock.d.ts new file mode 100644 index 0000000..fa507dd --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/network-dock.d.ts @@ -0,0 +1,6 @@ +import type { HIDDevice } from '../hid-device.js'; +import type { OpenStreamDeckOptions } from './base.js'; +import { StreamDeckBase } from './base.js'; +import type { PropertiesService } from '../services/properties/interface.js'; +export declare function NetworkDockFactory(device: HIDDevice, options: Required, _tcpPropertiesService?: PropertiesService): StreamDeckBase; +//# sourceMappingURL=network-dock.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/network-dock.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/models/network-dock.d.ts.map new file mode 100644 index 0000000..ee24228 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/network-dock.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"network-dock.d.ts","sourceRoot":"","sources":["../../src/models/network-dock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAwB,MAAM,WAAW,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAG1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAwB5E,wBAAgB,kBAAkB,CACjC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,QAAQ,CAAC,qBAAqB,CAAC,EACxC,qBAAqB,CAAC,EAAE,iBAAiB,GACvC,cAAc,CAYhB"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/network-dock.js b/node_modules/@elgato-stream-deck/core/dist/models/network-dock.js new file mode 100644 index 0000000..8c2dc84 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/network-dock.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NetworkDockFactory = NetworkDockFactory; +const base_js_1 = require("./base.js"); +const id_js_1 = require("../id.js"); +const controlsGenerator_js_1 = require("../controlsGenerator.js"); +const callback_hook_js_1 = require("../services/callback-hook.js"); +const fake_js_1 = require("../services/buttonsLcdDisplay/fake.js"); +const fake_js_2 = require("../services/input/fake.js"); +const network_dock_js_1 = require("../services/properties/network-dock.js"); +const networkDockProperties = { + MODEL: id_js_1.DeviceModelId.NETWORK_DOCK, + PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.NETWORK_DOCK], + KEY_DATA_OFFSET: 0, + SUPPORTS_RGB_KEY_FILL: false, + CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)([]), + KEY_SPACING_HORIZONTAL: 0, + KEY_SPACING_VERTICAL: 0, + FULLSCREEN_PANELS: 0, + HAS_NFC_READER: false, + SUPPORTS_CHILD_DEVICES: true, +}; +function NetworkDockFactory(device, options, _tcpPropertiesService) { + const events = new callback_hook_js_1.CallbackHook(); + return new base_js_1.StreamDeckBase(device, options, { + deviceProperties: networkDockProperties, + events, + properties: new network_dock_js_1.NetworkDockPropertiesService(device), + buttonsLcd: new fake_js_1.FakeLcdService(), + lcdSegmentDisplay: null, + inputService: new fake_js_2.FakeInputService(), + encoderLed: null, + }); +} +//# sourceMappingURL=network-dock.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/network-dock.js.map b/node_modules/@elgato-stream-deck/core/dist/models/network-dock.js.map new file mode 100644 index 0000000..2e72c38 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/network-dock.js.map @@ -0,0 +1 @@ +{"version":3,"file":"network-dock.js","sourceRoot":"","sources":["../../src/models/network-dock.ts"],"names":[],"mappings":";;AA6BA,gDAgBC;AA3CD,uCAA0C;AAC1C,oCAAqD;AACrD,kEAA2D;AAG3D,mEAA2D;AAC3D,mEAAsE;AACtE,uDAA4D;AAC5D,4EAAqF;AAErF,MAAM,qBAAqB,GAAyB;IACnD,KAAK,EAAE,qBAAa,CAAC,YAAY;IACjC,YAAY,EAAE,mBAAW,CAAC,qBAAa,CAAC,YAAY,CAAC;IACrD,eAAe,EAAE,CAAC;IAElB,qBAAqB,EAAE,KAAK;IAE5B,QAAQ,EAAE,IAAA,wCAAiB,EAAC,EAAE,CAAC;IAE/B,sBAAsB,EAAE,CAAC;IACzB,oBAAoB,EAAE,CAAC;IAEvB,iBAAiB,EAAE,CAAC;IACpB,cAAc,EAAE,KAAK;IACrB,sBAAsB,EAAE,IAAI;CAC5B,CAAA;AAED,SAAgB,kBAAkB,CACjC,MAAiB,EACjB,OAAwC,EACxC,qBAAyC;IAEzC,MAAM,MAAM,GAAG,IAAI,+BAAY,EAAoB,CAAA;IAEnD,OAAO,IAAI,wBAAc,CAAC,MAAM,EAAE,OAAO,EAAE;QAC1C,gBAAgB,EAAE,qBAAqB;QACvC,MAAM;QACN,UAAU,EAAE,IAAI,8CAA4B,CAAC,MAAM,CAAC;QACpD,UAAU,EAAE,IAAI,wBAAc,EAAE;QAChC,iBAAiB,EAAE,IAAI;QACvB,YAAY,EAAE,IAAI,0BAAgB,EAAE;QACpC,UAAU,EAAE,IAAI;KAChB,CAAC,CAAA;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/original.d.ts b/node_modules/@elgato-stream-deck/core/dist/models/original.d.ts new file mode 100644 index 0000000..b9c3a19 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/original.d.ts @@ -0,0 +1,4 @@ +import type { HIDDevice } from '../hid-device.js'; +import type { OpenStreamDeckOptions, StreamDeckBase } from './base.js'; +export declare function StreamDeckOriginalFactory(device: HIDDevice, options: Required): StreamDeckBase; +//# sourceMappingURL=original.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/original.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/models/original.d.ts.map new file mode 100644 index 0000000..91525b6 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/original.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"original.d.ts","sourceRoot":"","sources":["../../src/models/original.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAoBtE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,qBAAqB,CAAC,GAAG,cAAc,CASrH"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/original.js b/node_modules/@elgato-stream-deck/core/dist/models/original.js new file mode 100644 index 0000000..2e1902a --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/original.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamDeckOriginalFactory = StreamDeckOriginalFactory; +const generic_gen1_js_1 = require("./generic-gen1.js"); +const id_js_1 = require("../id.js"); +const imageWriter_js_1 = require("../services/imageWriter/imageWriter.js"); +const controlsGenerator_js_1 = require("../controlsGenerator.js"); +const originalProperties = { + MODEL: id_js_1.DeviceModelId.ORIGINAL, + PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.ORIGINAL], + SUPPORTS_RGB_KEY_FILL: false, + CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)((0, controlsGenerator_js_1.generateButtonsGrid)(5, 3, { width: 72, height: 72 }, true)), + KEY_SPACING_HORIZONTAL: 25, + KEY_SPACING_VERTICAL: 25, + FULLSCREEN_PANELS: 0, +}; +function StreamDeckOriginalFactory(device, options) { + return (0, generic_gen1_js_1.StreamDeckGen1Factory)(device, options, originalProperties, new imageWriter_js_1.StreamdeckOriginalImageWriter(), { colorMode: 'bgr', xFlip: true }, 3780); +} +//# sourceMappingURL=original.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/original.js.map b/node_modules/@elgato-stream-deck/core/dist/models/original.js.map new file mode 100644 index 0000000..f5d4b00 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/original.js.map @@ -0,0 +1 @@ +{"version":3,"file":"original.js","sourceRoot":"","sources":["../../src/models/original.ts"],"names":[],"mappings":";;AAqBA,8DASC;AA3BD,uDAAyD;AACzD,oCAAqD;AACrD,2EAAsF;AACtF,kEAAgF;AAEhF,MAAM,kBAAkB,GAA6B;IACpD,KAAK,EAAE,qBAAa,CAAC,QAAQ;IAC7B,YAAY,EAAE,mBAAW,CAAC,qBAAa,CAAC,QAAQ,CAAC;IACjD,qBAAqB,EAAE,KAAK;IAE5B,QAAQ,EAAE,IAAA,wCAAiB,EAAC,IAAA,0CAAmB,EAAC,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IAEvF,sBAAsB,EAAE,EAAE;IAC1B,oBAAoB,EAAE,EAAE;IAExB,iBAAiB,EAAE,CAAC;CACpB,CAAA;AAED,SAAgB,yBAAyB,CAAC,MAAiB,EAAE,OAAwC;IACpG,OAAO,IAAA,uCAAqB,EAC3B,MAAM,EACN,OAAO,EACP,kBAAkB,EAClB,IAAI,8CAA6B,EAAE,EACnC,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EACjC,IAAI,CACJ,CAAA;AACF,CAAC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/pedal.d.ts b/node_modules/@elgato-stream-deck/core/dist/models/pedal.d.ts new file mode 100644 index 0000000..cee9985 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/pedal.d.ts @@ -0,0 +1,5 @@ +import type { HIDDevice } from '../hid-device.js'; +import type { OpenStreamDeckOptions } from './base.js'; +import { StreamDeckBase } from './base.js'; +export declare function StreamDeckPedalFactory(device: HIDDevice, options: Required): StreamDeckBase; +//# sourceMappingURL=pedal.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/pedal.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/models/pedal.d.ts.map new file mode 100644 index 0000000..52dae82 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/pedal.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pedal.d.ts","sourceRoot":"","sources":["../../src/models/pedal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAwB,MAAM,WAAW,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAqD1C,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,qBAAqB,CAAC,GAAG,cAAc,CAYlH"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/pedal.js b/node_modules/@elgato-stream-deck/core/dist/models/pedal.js new file mode 100644 index 0000000..75a225f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/pedal.js @@ -0,0 +1,61 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamDeckPedalFactory = StreamDeckPedalFactory; +const base_js_1 = require("./base.js"); +const id_js_1 = require("../id.js"); +const controlsGenerator_js_1 = require("../controlsGenerator.js"); +const pedal_js_1 = require("../services/properties/pedal.js"); +const fake_js_1 = require("../services/buttonsLcdDisplay/fake.js"); +const callback_hook_js_1 = require("../services/callback-hook.js"); +const gen1_js_1 = require("../services/input/gen1.js"); +const pedalControls = [ + { + type: 'button', + row: 0, + column: 0, + index: 0, + hidIndex: 0, + feedbackType: 'none', + }, + { + type: 'button', + row: 0, + column: 1, + index: 1, + hidIndex: 1, + feedbackType: 'none', + }, + { + type: 'button', + row: 0, + column: 2, + index: 2, + hidIndex: 2, + feedbackType: 'none', + }, +]; +const pedalProperties = { + MODEL: id_js_1.DeviceModelId.PEDAL, + PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.PEDAL], + KEY_DATA_OFFSET: 3, + SUPPORTS_RGB_KEY_FILL: false, + CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)(pedalControls), + KEY_SPACING_HORIZONTAL: 0, + KEY_SPACING_VERTICAL: 0, + FULLSCREEN_PANELS: 0, + HAS_NFC_READER: false, + SUPPORTS_CHILD_DEVICES: false, +}; +function StreamDeckPedalFactory(device, options) { + const events = new callback_hook_js_1.CallbackHook(); + return new base_js_1.StreamDeckBase(device, options, { + deviceProperties: pedalProperties, + events, + properties: new pedal_js_1.PedalPropertiesService(device), + buttonsLcd: new fake_js_1.FakeLcdService(), + lcdSegmentDisplay: null, + inputService: new gen1_js_1.ButtonOnlyInputService(pedalProperties, events), + encoderLed: null, + }); +} +//# sourceMappingURL=pedal.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/pedal.js.map b/node_modules/@elgato-stream-deck/core/dist/models/pedal.js.map new file mode 100644 index 0000000..70a37e6 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/pedal.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pedal.js","sourceRoot":"","sources":["../../src/models/pedal.ts"],"names":[],"mappings":";;AAuDA,wDAYC;AAjED,uCAA0C;AAC1C,oCAAqD;AAErD,kEAA2D;AAC3D,8DAAwE;AACxE,mEAAsE;AAEtE,mEAA2D;AAC3D,uDAAkE;AAElE,MAAM,aAAa,GAAkC;IACpD;QACC,IAAI,EAAE,QAAQ;QACd,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,CAAC;QACX,YAAY,EAAE,MAAM;KACpB;IACD;QACC,IAAI,EAAE,QAAQ;QACd,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,CAAC;QACX,YAAY,EAAE,MAAM;KACpB;IACD;QACC,IAAI,EAAE,QAAQ;QACd,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,CAAC;QACX,YAAY,EAAE,MAAM;KACpB;CACD,CAAA;AAED,MAAM,eAAe,GAAyB;IAC7C,KAAK,EAAE,qBAAa,CAAC,KAAK;IAC1B,YAAY,EAAE,mBAAW,CAAC,qBAAa,CAAC,KAAK,CAAC;IAC9C,eAAe,EAAE,CAAC;IAClB,qBAAqB,EAAE,KAAK;IAE5B,QAAQ,EAAE,IAAA,wCAAiB,EAAC,aAAa,CAAC;IAE1C,sBAAsB,EAAE,CAAC;IACzB,oBAAoB,EAAE,CAAC;IAEvB,iBAAiB,EAAE,CAAC;IACpB,cAAc,EAAE,KAAK;IACrB,sBAAsB,EAAE,KAAK;CAC7B,CAAA;AAED,SAAgB,sBAAsB,CAAC,MAAiB,EAAE,OAAwC;IACjG,MAAM,MAAM,GAAG,IAAI,+BAAY,EAAoB,CAAA;IAEnD,OAAO,IAAI,wBAAc,CAAC,MAAM,EAAE,OAAO,EAAE;QAC1C,gBAAgB,EAAE,eAAe;QACjC,MAAM;QACN,UAAU,EAAE,IAAI,iCAAsB,CAAC,MAAM,CAAC;QAC9C,UAAU,EAAE,IAAI,wBAAc,EAAE;QAChC,iBAAiB,EAAE,IAAI;QACvB,YAAY,EAAE,IAAI,gCAAsB,CAAC,eAAe,EAAE,MAAM,CAAC;QACjE,UAAU,EAAE,IAAI;KAChB,CAAC,CAAA;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/plus.d.ts b/node_modules/@elgato-stream-deck/core/dist/models/plus.d.ts new file mode 100644 index 0000000..c8fac15 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/plus.d.ts @@ -0,0 +1,5 @@ +import type { HIDDevice } from '../hid-device.js'; +import type { OpenStreamDeckOptions } from './base.js'; +import { StreamDeckBase } from './base.js'; +export declare function StreamDeckPlusFactory(device: HIDDevice, options: Required): StreamDeckBase; +//# sourceMappingURL=plus.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/plus.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/models/plus.d.ts.map new file mode 100644 index 0000000..48dfc8a --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/plus.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"plus.d.ts","sourceRoot":"","sources":["../../src/models/plus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAsF1C,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,qBAAqB,CAAC,GAAG,cAAc,CAKjH"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/plus.js b/node_modules/@elgato-stream-deck/core/dist/models/plus.js new file mode 100644 index 0000000..8a862db --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/plus.js @@ -0,0 +1,72 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamDeckPlusFactory = StreamDeckPlusFactory; +const base_js_1 = require("./base.js"); +const generic_gen2_js_1 = require("./generic-gen2.js"); +const id_js_1 = require("../id.js"); +const controlsGenerator_js_1 = require("../controlsGenerator.js"); +const generic_js_1 = require("../services/lcdSegmentDisplay/generic.js"); +const plusControls = (0, controlsGenerator_js_1.generateButtonsGrid)(4, 2, { width: 120, height: 120 }); +plusControls.push({ + type: 'lcd-segment', + row: 2, + column: 0, + columnSpan: 4, + rowSpan: 1, + id: 0, + pixelSize: Object.freeze({ + width: 800, + height: 100, + }), + drawRegions: true, +}, { + type: 'encoder', + row: 3, + column: 0, + index: 0, + hidIndex: 0, + hasLed: false, + ledRingSteps: 0, +}, { + type: 'encoder', + row: 3, + column: 1, + index: 1, + hidIndex: 1, + hasLed: false, + ledRingSteps: 0, +}, { + type: 'encoder', + row: 3, + column: 2, + index: 2, + hidIndex: 2, + hasLed: false, + ledRingSteps: 0, +}, { + type: 'encoder', + row: 3, + column: 3, + index: 3, + hidIndex: 3, + hasLed: false, + ledRingSteps: 0, +}); +const plusProperties = { + MODEL: id_js_1.DeviceModelId.PLUS, + PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.PLUS], + SUPPORTS_RGB_KEY_FILL: true, + CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)(plusControls), + KEY_SPACING_HORIZONTAL: 99, + KEY_SPACING_VERTICAL: 40, + FULLSCREEN_PANELS: 0, + HAS_NFC_READER: false, + SUPPORTS_CHILD_DEVICES: false, +}; +const lcdSegmentControls = plusProperties.CONTROLS.filter((control) => control.type === 'lcd-segment'); +function StreamDeckPlusFactory(device, options) { + const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, plusProperties, null, true); + services.lcdSegmentDisplay = new generic_js_1.StreamdeckDefaultLcdService(options.encodeJPEG, device, lcdSegmentControls); + return new base_js_1.StreamDeckBase(device, options, services); +} +//# sourceMappingURL=plus.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/plus.js.map b/node_modules/@elgato-stream-deck/core/dist/models/plus.js.map new file mode 100644 index 0000000..3aeac65 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/plus.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plus.js","sourceRoot":"","sources":["../../src/models/plus.ts"],"names":[],"mappings":";;AAwFA,sDAKC;AA3FD,uCAA0C;AAE1C,uDAA4D;AAC5D,oCAAqD;AACrD,kEAAgF;AAEhF,yEAAsF;AAEtF,MAAM,YAAY,GAAkC,IAAA,0CAAmB,EAAC,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;AAC1G,YAAY,CAAC,IAAI,CAChB;IACC,IAAI,EAAE,aAAa;IACnB,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC;IACT,UAAU,EAAE,CAAC;IACb,OAAO,EAAE,CAAC;IAEV,EAAE,EAAE,CAAC;IAEL,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QACxB,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG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B,qBAAqB,CAAC,MAAiB,EAAE,OAAwC;IAChG,MAAM,QAAQ,GAAG,IAAA,0CAAwB,EAAC,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IACtF,QAAQ,CAAC,iBAAiB,GAAG,IAAI,wCAA2B,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,kBAAkB,CAAC,CAAA;IAE5G,OAAO,IAAI,wBAAc,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;AACrD,CAAC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/studio.d.ts b/node_modules/@elgato-stream-deck/core/dist/models/studio.d.ts new file mode 100644 index 0000000..117cae2 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/studio.d.ts @@ -0,0 +1,7 @@ +import type { HIDDevice } from '../hid-device.js'; +import { StreamDeckBase, type OpenStreamDeckOptions } from './base.js'; +import { type StreamDeckGen2Properties } from './generic-gen2.js'; +import type { PropertiesService } from '../services/properties/interface.js'; +export declare const studioProperties: StreamDeckGen2Properties; +export declare function StreamDeckStudioFactory(device: HIDDevice, options: Required, propertiesService?: PropertiesService): StreamDeckBase; +//# sourceMappingURL=studio.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/studio.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/models/studio.d.ts.map new file mode 100644 index 0000000..4bbc9c2 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/studio.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"studio.d.ts","sourceRoot":"","sources":["../../src/models/studio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACtE,OAAO,EAA4B,KAAK,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAI3F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AA6B5E,eAAO,MAAM,gBAAgB,EAAE,wBAc9B,CAAA;AAED,wBAAgB,uBAAuB,CACtC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,QAAQ,CAAC,qBAAqB,CAAC,EACxC,iBAAiB,CAAC,EAAE,iBAAiB,GACnC,cAAc,CAWhB"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/studio.js b/node_modules/@elgato-stream-deck/core/dist/models/studio.js new file mode 100644 index 0000000..2e86256 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/studio.js @@ -0,0 +1,49 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.studioProperties = void 0; +exports.StreamDeckStudioFactory = StreamDeckStudioFactory; +const base_js_1 = require("./base.js"); +const generic_gen2_js_1 = require("./generic-gen2.js"); +const id_js_1 = require("../id.js"); +const controlsGenerator_js_1 = require("../controlsGenerator.js"); +const studio_js_1 = require("../services/properties/studio.js"); +const studio_js_2 = require("../services/encoderLed/studio.js"); +const studioControls = [ + { + type: 'encoder', + row: 0, + column: 0, + index: 0, + hidIndex: 0, + hasLed: true, + ledRingSteps: 24, + }, + ...(0, controlsGenerator_js_1.generateButtonsGrid)(16, 2, { width: 144, height: 112 }, false, 1), + { + type: 'encoder', + row: 0, + column: 17, + index: 1, + hidIndex: 1, + hasLed: true, + ledRingSteps: 24, + lcdRingOffset: 12, + }, +]; +exports.studioProperties = { + MODEL: id_js_1.DeviceModelId.STUDIO, + PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.STUDIO], + SUPPORTS_RGB_KEY_FILL: true, + CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)(studioControls), + KEY_SPACING_HORIZONTAL: 0, // TODO + KEY_SPACING_VERTICAL: 0, // TODO + FULLSCREEN_PANELS: 2, + HAS_NFC_READER: true, + SUPPORTS_CHILD_DEVICES: true, +}; +function StreamDeckStudioFactory(device, options, propertiesService) { + const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, exports.studioProperties, propertiesService ?? new studio_js_1.StudioPropertiesService(device), true); + services.encoderLed = new studio_js_2.StudioEncoderLedService(device, studioControls); + return new base_js_1.StreamDeckBase(device, options, services); +} +//# sourceMappingURL=studio.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/models/studio.js.map b/node_modules/@elgato-stream-deck/core/dist/models/studio.js.map new file mode 100644 index 0000000..90271b6 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/models/studio.js.map @@ -0,0 +1 @@ +{"version":3,"file":"studio.js","sourceRoot":"","sources":["../../src/models/studio.ts"],"names":[],"mappings":";;;AAmDA,0DAeC;AAjED,uCAAsE;AACtE,uDAA2F;AAC3F,oCAAqD;AACrD,kEAAgF;AAGhF,gEAA0E;AAC1E,gEAA0E;AAE1E,MAAM,cAAc,GAAkC;IACrD;QACC,IAAI,EAAE,SAAS;QACf,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,CAAC;QAEX,MAAM,EAAE,IAAI;QACZ,YAAY,EAAE,EAAE;KAChB;IACD,GAAG,IAAA,0CAAmB,EAAC,EAAE,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACpE;QACC,IAAI,EAAE,SAAS;QACf,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,EAAE;QACV,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,CAAC;QAEX,MAAM,EAAE,IAAI;QACZ,YAAY,EAAE,EAAE;QAChB,aAAa,EAAE,EAAE;KACjB;CACD,CAAA;AAEY,QAAA,gBAAgB,GAA6B;IACzD,KAAK,EAAE,qBAAa,CAAC,MAAM;IAC3B,YAAY,EAAE,mBAAW,CAAC,qBAAa,CAAC,MAAM,CAAC;IAC/C,qBAAqB,EAAE,IAAI;IAE3B,QAAQ,EAAE,IAAA,wCAAiB,EAAC,cAAc,CAAC;IAE3C,sBAAsB,EAAE,CAAC,EAAE,OAAO;IAClC,oBAAoB,EAAE,CAAC,EAAE,OAAO;IAEhC,iBAAiB,EAAE,CAAC;IAEpB,cAAc,EAAE,IAAI;IACpB,sBAAsB,EAAE,IAAI;CAC5B,CAAA;AAED,SAAgB,uBAAuB,CACtC,MAAiB,EACjB,OAAwC,EACxC,iBAAqC;IAErC,MAAM,QAAQ,GAAG,IAAA,0CAAwB,EACxC,MAAM,EACN,OAAO,EACP,wBAAgB,EAChB,iBAAiB,IAAI,IAAI,mCAAuB,CAAC,MAAM,CAAC,EACxD,IAAI,CACJ,CAAA;IACD,QAAQ,CAAC,UAAU,GAAG,IAAI,mCAAuB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;IAEzE,OAAO,IAAI,wBAAc,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;AACrD,CAAC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/preparedBuffer.d.ts b/node_modules/@elgato-stream-deck/core/dist/preparedBuffer.d.ts new file mode 100644 index 0000000..d16b457 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/preparedBuffer.d.ts @@ -0,0 +1,16 @@ +import type { DeviceModelId } from './id.js'; +/** + * This represents a buffer that has been prepared for sending to a Stream Deck. + * Note: The result is only guaranteed to be valid for this specific StreamDeck and the same library version, but is safe to store externally. + * If it sent to the wrong model, the result is undefined behaviour. + * + * This is an opaque type, and should not be viewed/inspected directly. + * + * It may be serialized to JSON, but only if it was generated with the `jsonSafe` flag set to `true`. + */ +export interface PreparedBuffer { + readonly __internal__: never; +} +export declare function wrapBufferToPreparedBuffer(modelId: DeviceModelId, type: string, buffers: Uint8Array[], jsonSafe: boolean): PreparedBuffer; +export declare function unwrapPreparedBufferToBuffer(modelId: DeviceModelId, prepared: PreparedBuffer): Uint8Array[]; +//# sourceMappingURL=preparedBuffer.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/preparedBuffer.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/preparedBuffer.d.ts.map new file mode 100644 index 0000000..b14e746 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/preparedBuffer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"preparedBuffer.d.ts","sourceRoot":"","sources":["../src/preparedBuffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAA;CAC5B;AASD,wBAAgB,0BAA0B,CACzC,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,UAAU,EAAE,EACrB,QAAQ,EAAE,OAAO,GACf,cAAc,CAmBhB;AAED,wBAAgB,4BAA4B,CAC3C,OAAO,EAAE,aAAa,EAEtB,QAAQ,EAAE,cAAc,GACtB,UAAU,EAAE,CA0Bd"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/preparedBuffer.js b/node_modules/@elgato-stream-deck/core/dist/preparedBuffer.js new file mode 100644 index 0000000..1f8894d --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/preparedBuffer.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.wrapBufferToPreparedBuffer = wrapBufferToPreparedBuffer; +exports.unwrapPreparedBufferToBuffer = unwrapPreparedBufferToBuffer; +function wrapBufferToPreparedBuffer(modelId, type, buffers, jsonSafe) { + let encodedBuffers = buffers; + if (jsonSafe) { + // Use Base64 encoding for binary-safe string conversion + if (typeof Buffer !== 'undefined') { + encodedBuffers = buffers.map((b) => Buffer.from(b).toString('base64')); + } + else { + encodedBuffers = buffers.map((b) => btoa(String.fromCharCode(...b))); + } + } + return { + if_you_change_this_you_will_break_everything: 'This is a encoded form of the buffer, exactly as the Stream Deck expects it. Do not touch this object, or you can crash your stream deck', + modelId, + type, + do_not_touch: encodedBuffers, + }; +} +function unwrapPreparedBufferToBuffer(modelId, +// type: string, +prepared) { + const preparedInternal = prepared; + if (preparedInternal.modelId !== modelId) + throw new Error('Prepared buffer is for a different model!'); + // if (preparedInternal.type !== type) throw new Error('Prepared buffer is for a different type!') + return preparedInternal.do_not_touch.map((b) => { + if (typeof b === 'string') { + // Decode from Base64 for binary-safe conversion + if (typeof Buffer !== 'undefined') { + // Fast path for Node.js + return Buffer.from(b, 'base64'); + } + else { + // Browser fallback + return new Uint8Array(atob(b) + .split('') + .map((char) => char.charCodeAt(0))); + } + } + else if (b instanceof Uint8Array) { + return b; + } + else { + throw new Error('Prepared buffer is not a string or Uint8Array!'); + } + }); +} +//# sourceMappingURL=preparedBuffer.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/preparedBuffer.js.map b/node_modules/@elgato-stream-deck/core/dist/preparedBuffer.js.map new file mode 100644 index 0000000..a103523 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/preparedBuffer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"preparedBuffer.js","sourceRoot":"","sources":["../src/preparedBuffer.ts"],"names":[],"mappings":";;AAsBA,gEAwBC;AAED,oEA8BC;AAxDD,SAAgB,0BAA0B,CACzC,OAAsB,EACtB,IAAY,EACZ,OAAqB,EACrB,QAAiB;IAEjB,IAAI,cAAc,GAA+C,OAAO,CAAA;IAExE,IAAI,QAAQ,EAAE,CAAC;QACd,wDAAwD;QACxD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YACnC,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAA;QACvE,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git a/node_modules/@elgato-stream-deck/core/dist/proxy.d.ts b/node_modules/@elgato-stream-deck/core/dist/proxy.d.ts new file mode 100644 index 0000000..c86d394 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/proxy.d.ts @@ -0,0 +1,63 @@ +import type { EventEmitter } from 'eventemitter3'; +import type { DeviceModelId } from './id.js'; +import type { StreamDeck, StreamDeckEvents } from './types.js'; +import type { StreamDeckControlDefinition } from './controlDefinition.js'; +/** + * A minimal proxy around a StreamDeck instance. + * This is intended to be used by libraries wrapping this that want to add more methods to the StreamDeck + */ +export declare class StreamDeckProxy implements StreamDeck { + protected readonly device: StreamDeck; + constructor(device: StreamDeck); + get CONTROLS(): Readonly; + get MODEL(): DeviceModelId; + get PRODUCT_NAME(): string; + get HAS_NFC_READER(): boolean; + calculateFillPanelDimensions(...args: Parameters): ReturnType; + close(): Promise; + getHidDeviceInfo(...args: Parameters): ReturnType; + sendPreparedBuffer(...args: Parameters): ReturnType; + fillKeyColor(...args: Parameters): ReturnType; + fillKeyBuffer(...args: Parameters): ReturnType; + prepareFillKeyBuffer(...args: Parameters): ReturnType; + fillPanelBuffer(...args: Parameters): ReturnType; + prepareFillPanelBuffer(...args: Parameters): ReturnType; + clearKey(...args: Parameters): ReturnType; + clearPanel(...args: Parameters): ReturnType; + setBrightness(...args: Parameters): ReturnType; + resetToLogo(...args: Parameters): ReturnType; + getFirmwareVersion(): Promise; + getAllFirmwareVersions(): ReturnType; + getSerialNumber(): Promise; + fillLcd(...args: Parameters): ReturnType; + setEncoderColor(...args: Parameters): ReturnType; + setEncoderRingSingleColor(...args: Parameters): ReturnType; + setEncoderRingColors(...args: Parameters): ReturnType; + fillLcdRegion(...args: Parameters): ReturnType; + prepareFillLcdRegion(...args: Parameters): ReturnType; + clearLcdSegment(...args: Parameters): ReturnType; + getChildDeviceInfo(...args: Parameters): ReturnType; + /** + * EventEmitter + */ + eventNames(): Array>; + listeners>(event: T): Array>; + listenerCount(event: EventEmitter.EventNames): number; + emit>(event: T, ...args: EventEmitter.EventArgs): boolean; + /** + * Add a listener for a given event. + */ + on>(event: T, fn: EventEmitter.EventListener, context?: unknown): this; + addListener>(event: T, fn: EventEmitter.EventListener, context?: unknown): this; + /** + * Add a one-time listener for a given event. + */ + once>(event: T, fn: EventEmitter.EventListener, context?: unknown): this; + /** + * Remove the listeners of a given event. + */ + removeListener>(event: T, fn?: EventEmitter.EventListener, context?: unknown, once?: boolean): this; + off>(event: T, fn?: EventEmitter.EventListener, context?: unknown, once?: boolean): this; + removeAllListeners(event?: EventEmitter.EventNames): this; +} +//# sourceMappingURL=proxy.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/proxy.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/proxy.d.ts.map new file mode 100644 index 0000000..d2ccf22 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/proxy.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAA;AAEzE;;;GAGG;AAEH,qBAAa,eAAgB,YAAW,UAAU;IACjD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;gBAEzB,MAAM,EAAE,UAAU;IAI9B,IAAW,QAAQ,IAAI,QAAQ,CAAC,2BAA2B,EAAE,CAAC,CAE7D;IAOD,IAAW,KAAK,IAAI,aAAa,CAEhC;IACD,IAAW,YAAY,IAAI,MAAM,CAEhC;IACD,IAAW,cAAc,IAAI,OAAO,CAEnC;IAEM,4BAA4B,CAClC,GAAG,IAAI,EAAE,UAAU,CA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O,CAAC,EAAE,OAAO,GACf,IAAI;IAKP;;OAEG;IACI,IAAI,CAAC,CAAC,SAAS,YAAY,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAC9D,KAAK,EAAE,CAAC,EACR,EAAE,EAAE,YAAY,CAAC,aAAa,CAAC,gBAAgB,EAAE,CAAC,CAAC,EACnD,OAAO,CAAC,EAAE,OAAO,GACf,IAAI;IAKP;;OAEG;IACI,cAAc,CAAC,CAAC,SAAS,YAAY,CAAC,UAAU,CAAC,gBAAgB,CAAC,EACxE,KAAK,EAAE,CAAC,EACR,EAAE,CAAC,EAAE,YAAY,CAAC,aAAa,CAAC,gBAAgB,EAAE,CAAC,CAAC,EACpD,OAAO,CAAC,EAAE,OAAO,EACjB,IAAI,CAAC,EAAE,OAAO,GACZ,IAAI;IAIA,GAAG,CAAC,CAAC,SAAS,YAAY,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAC7D,KAAK,EAAE,CAAC,EACR,EAAE,CAAC,EAAE,YAAY,CAAC,aAAa,CAAC,gBAAgB,EAAE,CAAC,CAAC,EACpD,OAAO,CAAC,EAAE,OAAO,EACjB,IAAI,CAAC,EAAE,OAAO,GACZ,IAAI;IAKA,kBAAkB,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,UAAU,CAAC,gBAAgB,CAAC,GAAG,IAAI;CAIlF"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/proxy.js b/node_modules/@elgato-stream-deck/core/dist/proxy.js new file mode 100644 index 0000000..3741e2f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/proxy.js @@ -0,0 +1,153 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamDeckProxy = void 0; +/** + * A minimal proxy around a StreamDeck instance. + * This is intended to be used by libraries wrapping this that want to add more methods to the StreamDeck + */ +class StreamDeckProxy { + device; + constructor(device) { + this.device = device; + } + get CONTROLS() { + return this.device.CONTROLS; + } + // public get KEY_SPACING_VERTICAL(): number { + // return this.device.KEY_SPACING_VERTICAL + // } + // public get KEY_SPACING_HORIZONTAL(): number { + // return this.device.KEY_SPACING_HORIZONTAL + // } + get MODEL() { + return this.device.MODEL; + } + get PRODUCT_NAME() { + return this.device.PRODUCT_NAME; + } + get HAS_NFC_READER() { + return this.device.HAS_NFC_READER; + } + calculateFillPanelDimensions(...args) { + return this.device.calculateFillPanelDimensions(...args); + } + async close() { + return this.device.close(); + } + async getHidDeviceInfo(...args) { + return this.device.getHidDeviceInfo(...args); + } + async sendPreparedBuffer(...args) { + return this.device.sendPreparedBuffer(...args); + } + async fillKeyColor(...args) { + return this.device.fillKeyColor(...args); + } + async fillKeyBuffer(...args) { + return this.device.fillKeyBuffer(...args); + } + async prepareFillKeyBuffer(...args) { + return this.device.prepareFillKeyBuffer(...args); + } + async fillPanelBuffer(...args) { + return this.device.fillPanelBuffer(...args); + } + async prepareFillPanelBuffer(...args) { + return this.device.prepareFillPanelBuffer(...args); + } + async clearKey(...args) { + return this.device.clearKey(...args); + } + async clearPanel(...args) { + return this.device.clearPanel(...args); + } + async setBrightness(...args) { + return this.device.setBrightness(...args); + } + async resetToLogo(...args) { + return this.device.resetToLogo(...args); + } + async getFirmwareVersion() { + return this.device.getFirmwareVersion(); + } + async getAllFirmwareVersions() { + return this.device.getAllFirmwareVersions(); + } + async getSerialNumber() { + return this.device.getSerialNumber(); + } + async fillLcd(...args) { + return this.device.fillLcd(...args); + } + async setEncoderColor(...args) { + return this.device.setEncoderColor(...args); + } + async setEncoderRingSingleColor(...args) { + return this.device.setEncoderRingSingleColor(...args); + } + async setEncoderRingColors(...args) { + return this.device.setEncoderRingColors(...args); + } + async fillLcdRegion(...args) { + return this.device.fillLcdRegion(...args); + } + async prepareFillLcdRegion(...args) { + return this.device.prepareFillLcdRegion(...args); + } + async clearLcdSegment(...args) { + return this.device.clearLcdSegment(...args); + } + async getChildDeviceInfo(...args) { + return this.device.getChildDeviceInfo(...args); + } + /** + * EventEmitter + */ + eventNames() { + return this.device.eventNames(); + } + listeners(event) { + return this.device.listeners(event); + } + listenerCount(event) { + return this.device.listenerCount(event); + } + emit(event, ...args) { + return this.device.emit(event, ...args); + } + /** + * Add a listener for a given event. + */ + on(event, fn, context) { + this.device.on(event, fn, context); + return this; + } + addListener(event, fn, context) { + this.device.addListener(event, fn, context); + return this; + } + /** + * Add a one-time listener for a given event. + */ + once(event, fn, context) { + this.device.once(event, fn, context); + return this; + } + /** + * Remove the listeners of a given event. + */ + removeListener(event, fn, context, once) { + this.device.removeListener(event, fn, context, once); + return this; + } + off(event, fn, context, once) { + this.device.off(event, fn, context, once); + return this; + } + removeAllListeners(event) { + this.device.removeAllListeners(event); + return this; + } +} +exports.StreamDeckProxy = StreamDeckProxy; +//# sourceMappingURL=proxy.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/proxy.js.map b/node_modules/@elgato-stream-deck/core/dist/proxy.js.map new file mode 100644 index 0000000..021199c --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/proxy.js.map @@ -0,0 +1 @@ +{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":";;;AAKA;;;GAGG;AAEH,MAAa,eAAe;IACR,MAAM,CAAY;IAErC,YAAY,MAAkB;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACrB,CAAC;IAED,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAA;IAC5B,CAAC;IACD,8CAA8C;IAC9C,2CAA2C;IAC3C,IAAI;IACJ,gDAAgD;IAChD,6CAA6C;IAC7C,IAAI;IACJ,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAA;IACzB,CAAC;IACD,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAA;IAChC,CAAC;IACD,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAA;IAClC,CAAC;I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AE,EAAE,OAAO,CAAC,CAAA;QAC3C,OAAO,IAAI,CAAA;IACZ,CAAC;IAED;;OAEG;IACI,IAAI,CACV,KAAQ,EACR,EAAmD,EACnD,OAAiB;QAEjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;QACpC,OAAO,IAAI,CAAA;IACZ,CAAC;IAED;;OAEG;IACI,cAAc,CACpB,KAAQ,EACR,EAAoD,EACpD,OAAiB,EACjB,IAAc;QAEd,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;QACpD,OAAO,IAAI,CAAA;IACZ,CAAC;IACM,GAAG,CACT,KAAQ,EACR,EAAoD,EACpD,OAAiB,EACjB,IAAc;QAEd,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;QACzC,OAAO,IAAI,CAAA;IACZ,CAAC;IAEM,kBAAkB,CAAC,KAAiD;QAC1E,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAA;QACrC,OAAO,IAAI,CAAA;IACZ,CAAC;CACD;AA7ND,0CA6NC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/default.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/default.d.ts new file mode 100644 index 0000000..641f157 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/default.d.ts @@ -0,0 +1,31 @@ +import type { HIDDevice } from '../../hid-device.js'; +import type { Dimension, KeyIndex } from '../../id.js'; +import type { StreamDeckProperties } from '../../models/base.js'; +import type { FillPanelDimensionsOptions, FillImageOptions, FillPanelOptions } from '../../types.js'; +import type { StreamdeckImageWriter } from '../imageWriter/types.js'; +import type { ButtonsLcdDisplayService } from './interface.js'; +import type { ButtonLcdImagePacker } from '../imagePacker/interface.js'; +import { type PreparedBuffer } from '../../preparedBuffer.js'; +export declare class DefaultButtonsLcdService implements ButtonsLcdDisplayService { + #private; + constructor(imageWriter: StreamdeckImageWriter, imagePacker: ButtonLcdImagePacker, device: Pick, deviceProperties: Readonly); + private getLcdButtonControls; + private calculateLcdGridSpan; + private calculateDimensionsFromGridSpan; + calculateFillPanelDimensions(options: FillPanelDimensionsOptions | undefined): Dimension | null; + clearPanel(): Promise; + clearKey(keyIndex: KeyIndex): Promise; + fillKeyColor(keyIndex: KeyIndex, r: number, g: number, b: number): Promise; + fillKeyBuffer(keyIndex: KeyIndex, imageBuffer: Uint8Array | Uint8ClampedArray, options?: FillImageOptions): Promise; + private prepareFillKeyBufferInner; + prepareFillKeyBuffer(keyIndex: KeyIndex, imageBuffer: Uint8Array | Uint8ClampedArray, options: FillImageOptions | undefined, jsonSafe: boolean | undefined): Promise; + fillPanelBuffer(imageBuffer: Uint8Array | Uint8ClampedArray, options?: FillPanelOptions): Promise; + private prepareFillPanelBufferInner; + prepareFillPanelBuffer(imageBuffer: Uint8Array | Uint8ClampedArray, options: FillPanelOptions | undefined, jsonSafe: boolean | undefined): Promise; + private sendKeyRgb; + private fillImageRangeControl; + private prepareFillImageRangeControl; + private checkRGBValue; + private checkSourceFormat; +} +//# sourceMappingURL=default.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/default.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/default.d.ts.map new file mode 100644 index 0000000..91055ef --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/default.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../src/services/buttonsLcdDisplay/default.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,SAA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,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,UAAU,GAAG,iBAAiB,EAC3C,OAAO,EAAE,gBAAgB,GAAG,SAAS,EACrC,QAAQ,EAAE,OAAO,GAAG,SAAS,GAC3B,OAAO,CAAC,cAAc,CAAC;IAKb,eAAe,CAC3B,WAAW,EAAE,UAAU,GAAG,iBAAiB,EAC3C,OAAO,CAAC,EAAE,gBAAgB,GACxB,OAAO,CAAC,IAAI,CAAC;YAKF,2BAA2B;IAsD5B,sBAAsB,CAClC,WAAW,EAAE,UAAU,GAAG,iBAAiB,EAC3C,OAAO,EAAE,gBAAgB,GAAG,SAAS,EACrC,QAAQ,EAAE,OAAO,GAAG,SAAS,GAC3B,OAAO,CAAC,cAAc,CAAC;YAKZ,UAAU;YAIV,qBAAqB;YASrB,4BAA4B;IAiB1C,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,iBAAiB;CAazB"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/default.js b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/default.js new file mode 100644 index 0000000..340a530 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/default.js @@ -0,0 +1,241 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DefaultButtonsLcdService = void 0; +const preparedBuffer_js_1 = require("../../preparedBuffer.js"); +class DefaultButtonsLcdService { + #imageWriter; + #imagePacker; + #device; + #deviceProperties; + constructor(imageWriter, imagePacker, device, deviceProperties) { + this.#imageWriter = imageWriter; + this.#imagePacker = imagePacker; + this.#device = device; + this.#deviceProperties = deviceProperties; + } + getLcdButtonControls() { + return this.#deviceProperties.CONTROLS.filter((control) => control.type === 'button' && control.feedbackType === 'lcd'); + } + calculateLcdGridSpan(buttonsLcd) { + if (buttonsLcd.length === 0) + return null; + const allRowValues = buttonsLcd.map((button) => button.row); + const allColumnValues = buttonsLcd.map((button) => button.column); + return { + minRow: Math.min(...allRowValues), + maxRow: Math.max(...allRowValues), + minCol: Math.min(...allColumnValues), + maxCol: Math.max(...allColumnValues), + }; + } + calculateDimensionsFromGridSpan(gridSpan, buttonPixelSize, withPadding) { + if (withPadding) { + // TODO: Implement padding + throw new Error('Not implemented'); + } + else { + const rowCount = gridSpan.maxRow - gridSpan.minRow + 1; + const columnCount = gridSpan.maxCol - gridSpan.minCol + 1; + // TODO: Consider that different rows/columns could have different dimensions + return { + width: columnCount * buttonPixelSize.width, + height: rowCount * buttonPixelSize.height, + }; + } + } + calculateFillPanelDimensions(options) { + const buttonLcdControls = this.getLcdButtonControls(); + const gridSpan = this.calculateLcdGridSpan(buttonLcdControls); + if (!gridSpan || buttonLcdControls.length === 0) + return null; + return this.calculateDimensionsFromGridSpan(gridSpan, buttonLcdControls[0].pixelSize, options?.withPadding); + } + async clearPanel() { + const ps = []; + if (this.#deviceProperties.FULLSCREEN_PANELS > 0) { + // TODO - should this be a separate property? + for (let screenIndex = 0; screenIndex < this.#deviceProperties.FULLSCREEN_PANELS; screenIndex++) { + ps.push(this.#device.sendFeatureReport(new Uint8Array([0x03, 0x05, screenIndex, 0, 0, 0]))); + } + // TODO - clear rgb? + } + else { + for (const control of this.#deviceProperties.CONTROLS) { + if (control.type !== 'button') + continue; + switch (control.feedbackType) { + case 'rgb': + ps.push(this.sendKeyRgb(control.hidIndex, 0, 0, 0)); + break; + case 'lcd': + if (this.#deviceProperties.SUPPORTS_RGB_KEY_FILL) { + ps.push(this.sendKeyRgb(control.hidIndex, 0, 0, 0)); + } + else { + const pixels = new Uint8Array(control.pixelSize.width * control.pixelSize.height * 3); + // TODO - caching? + ps.push(this.fillImageRangeControl(control, pixels, { + format: 'rgb', + offset: 0, + stride: control.pixelSize.width * 3, + })); + } + break; + case 'none': + // Do nothing + break; + } + } + } + await Promise.all(ps); + } + async clearKey(keyIndex) { + const control = this.#deviceProperties.CONTROLS.find((control) => control.type === 'button' && control.index === keyIndex); + if (!control || control.feedbackType === 'none') + throw new TypeError(`Expected a valid keyIndex`); + if (this.#deviceProperties.SUPPORTS_RGB_KEY_FILL || control.feedbackType === 'rgb') { + await this.sendKeyRgb(keyIndex, 0, 0, 0); + } + else { + const pixels = new Uint8Array(control.pixelSize.width * control.pixelSize.height * 3); + // TODO - caching? + await this.fillImageRangeControl(control, pixels, { + format: 'rgb', + offset: 0, + stride: control.pixelSize.width * 3, + }); + } + } + async fillKeyColor(keyIndex, r, g, b) { + this.checkRGBValue(r); + this.checkRGBValue(g); + this.checkRGBValue(b); + const control = this.#deviceProperties.CONTROLS.find((control) => control.type === 'button' && control.index === keyIndex); + if (!control || control.feedbackType === 'none') + throw new TypeError(`Expected a valid keyIndex`); + if (this.#deviceProperties.SUPPORTS_RGB_KEY_FILL || control.feedbackType === 'rgb') { + await this.sendKeyRgb(keyIndex, r, g, b); + } + else { + // rgba is excessive here, but it makes the fill easier as it can be done in a 32bit uint + const pixelCount = control.pixelSize.width * control.pixelSize.height; + const pixels = new Uint8Array(pixelCount * 4); + const view = new DataView(pixels.buffer, pixels.byteOffset, pixels.byteLength); + // write first pixel + view.setUint8(0, r); + view.setUint8(1, g); + view.setUint8(2, b); + view.setUint8(3, 255); + // read computed pixel + const sample = view.getUint32(0); + // fill with computed pixel + for (let i = 1; i < pixelCount; i++) { + view.setUint32(i * 4, sample); + } + await this.fillImageRangeControl(control, pixels, { + format: 'rgba', + offset: 0, + stride: control.pixelSize.width * 4, + }); + } + } + async fillKeyBuffer(keyIndex, imageBuffer, options) { + const packets = await this.prepareFillKeyBufferInner(keyIndex, imageBuffer, options); + await this.#device.sendReports(packets); + } + async prepareFillKeyBufferInner(keyIndex, imageBuffer, options) { + const sourceFormat = options?.format ?? 'rgb'; + this.checkSourceFormat(sourceFormat); + const control = this.#deviceProperties.CONTROLS.find((control) => control.type === 'button' && control.index === keyIndex); + if (!control || control.feedbackType === 'none') + throw new TypeError(`Expected a valid keyIndex`); + if (control.feedbackType !== 'lcd') + throw new TypeError(`keyIndex ${control.index} does not support lcd feedback`); + const imageSize = control.pixelSize.width * control.pixelSize.height * sourceFormat.length; + if (imageBuffer.length !== imageSize) { + throw new RangeError(`Expected image buffer of length ${imageSize}, got length ${imageBuffer.length}`); + } + return this.prepareFillImageRangeControl(control, imageBuffer, { + format: sourceFormat, + offset: 0, + stride: control.pixelSize.width * sourceFormat.length, + }); + } + async prepareFillKeyBuffer(keyIndex, imageBuffer, options, jsonSafe) { + const packets = await this.prepareFillKeyBufferInner(keyIndex, imageBuffer, options); + return (0, preparedBuffer_js_1.wrapBufferToPreparedBuffer)(this.#deviceProperties.MODEL, 'fill-key', packets, jsonSafe ?? false); + } + async fillPanelBuffer(imageBuffer, options) { + const packets = await this.prepareFillPanelBufferInner(imageBuffer, options); + await this.#device.sendReports(packets); + } + async prepareFillPanelBufferInner(imageBuffer, options) { + const sourceFormat = options?.format ?? 'rgb'; + this.checkSourceFormat(sourceFormat); + const buttonLcdControls = this.getLcdButtonControls(); + const panelGridSpan = this.calculateLcdGridSpan(buttonLcdControls); + if (!panelGridSpan || buttonLcdControls.length === 0) { + throw new Error(`Panel does not support being filled`); + } + const panelDimensions = this.calculateDimensionsFromGridSpan(panelGridSpan, buttonLcdControls[0].pixelSize, options?.withPadding); + const expectedByteCount = sourceFormat.length * panelDimensions.width * panelDimensions.height; + if (imageBuffer.length !== expectedByteCount) { + throw new RangeError(`Expected image buffer of length ${expectedByteCount}, got length ${imageBuffer.length}`); + } + const stride = panelDimensions.width * sourceFormat.length; + const ps = []; + for (const control of buttonLcdControls) { + const controlRow = control.row - panelGridSpan.minRow; + const controlCol = control.column - panelGridSpan.minCol; + // TODO: Consider that different rows/columns could have different dimensions + const iconSize = control.pixelSize.width * sourceFormat.length; + const rowOffset = stride * controlRow * control.pixelSize.height; + const colOffset = controlCol * iconSize; + // TODO: Implement padding + ps.push(this.prepareFillImageRangeControl(control, imageBuffer, { + format: sourceFormat, + offset: rowOffset + colOffset, + stride, + })); + } + const packets = await Promise.all(ps); + return packets.flat(); + } + async prepareFillPanelBuffer(imageBuffer, options, jsonSafe) { + const packets = await this.prepareFillPanelBufferInner(imageBuffer, options); + return (0, preparedBuffer_js_1.wrapBufferToPreparedBuffer)(this.#deviceProperties.MODEL, 'fill-panel', packets, jsonSafe ?? false); + } + async sendKeyRgb(keyIndex, red, green, blue) { + await this.#device.sendFeatureReport(new Uint8Array([0x03, 0x06, keyIndex, red, green, blue])); + } + async fillImageRangeControl(buttonControl, imageBuffer, sourceOptions) { + const packets = await this.prepareFillImageRangeControl(buttonControl, imageBuffer, sourceOptions); + await this.#device.sendReports(packets); + } + async prepareFillImageRangeControl(buttonControl, imageBuffer, sourceOptions) { + if (buttonControl.feedbackType !== 'lcd') + throw new TypeError(`keyIndex ${buttonControl.index} does not support lcd feedback`); + const byteBuffer = await this.#imagePacker.convertPixelBuffer(imageBuffer, sourceOptions, buttonControl.pixelSize); + return this.#imageWriter.generateFillImageWrites({ keyIndex: buttonControl.hidIndex }, byteBuffer); + } + checkRGBValue(value) { + if (value < 0 || value > 255) { + throw new TypeError('Expected a valid color RGB value 0 - 255'); + } + } + checkSourceFormat(format) { + switch (format) { + case 'rgb': + case 'rgba': + case 'bgr': + case 'bgra': + break; + default: { + const fmt = format; + throw new TypeError(`Expected a known color format not "${fmt}"`); + } + } + } +} +exports.DefaultButtonsLcdService = DefaultButtonsLcdService; +//# sourceMappingURL=default.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/default.js.map b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/default.js.map new file mode 100644 index 0000000..3d480ca --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/default.js.map @@ -0,0 +1 @@ +{"version":3,"file":"default.js","sourceRoot":"","sources":["../../../src/services/buttonsLcdDisplay/default.ts"],"names":[],"mappings":";;;AAWA,+DAAyF;AAEzF,MAAa,wBAAwB;IAC3B,YAAY,CAAuB;IACnC,YAAY,CAAsB;I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aAAa,CAAC,KAAa;QAClC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC;YAC9B,MAAM,IAAI,SAAS,CAAC,0CAA0C,CAAC,CAAA;QAChE,CAAC;IACF,CAAC;IAEO,iBAAiB,CAAC,MAAuC;QAChE,QAAQ,MAAM,EAAE,CAAC;YAChB,KAAK,KAAK,CAAC;YACX,KAAK,MAAM,CAAC;YACZ,KAAK,KAAK,CAAC;YACX,KAAK,MAAM;gBACV,MAAK;YACN,OAAO,CAAC,CAAC,CAAC;gBACT,MAAM,GAAG,GAAU,MAAM,CAAA;gBACzB,MAAM,IAAI,SAAS,CAAC,sCAAsC,GAAa,GAAG,CAAC,CAAA;YAC5E,CAAC;QACF,CAAC;IACF,CAAC;CACD;AApVD,4DAoVC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/fake.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/fake.d.ts new file mode 100644 index 0000000..2d39ba5 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/fake.d.ts @@ -0,0 +1,15 @@ +import type { Dimension, KeyIndex } from '../../id.js'; +import type { ButtonsLcdDisplayService } from './interface.js'; +import type { FillPanelDimensionsOptions, FillImageOptions, FillPanelOptions } from '../../types.js'; +import type { PreparedBuffer } from '../../preparedBuffer.js'; +export declare class FakeLcdService implements ButtonsLcdDisplayService { + calculateFillPanelDimensions(_options?: FillPanelDimensionsOptions): Dimension | null; + clearKey(_keyIndex: number): Promise; + clearPanel(): Promise; + fillKeyColor(_keyIndex: number, _r: number, _g: number, _b: number): Promise; + fillKeyBuffer(_keyIndex: number, _imageBuffer: Uint8Array, _options?: FillImageOptions): Promise; + prepareFillKeyBuffer(_keyIndex: KeyIndex, _imageBuffer: Uint8Array | Uint8ClampedArray, _options: FillImageOptions | undefined, _jsonSafe: boolean | undefined): Promise; + fillPanelBuffer(_imageBuffer: Uint8Array, _options?: FillPanelOptions): Promise; + prepareFillPanelBuffer(_imageBuffer: Uint8Array | Uint8ClampedArray, _options: FillPanelOptions | undefined, _jsonSafe: boolean | undefined): Promise; +} +//# sourceMappingURL=fake.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/fake.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/fake.d.ts.map new file mode 100644 index 0000000..dbf6b47 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/fake.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fake.d.ts","sourceRoot":"","sources":["../../../src/services/buttonsLcdDisplay/fake.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,KAAK,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACpG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE7D,qBAAa,cAAe,YAAW,wBAAwB;IACvD,4BAA4B,CAAC,QAAQ,CAAC,EAAE,0BAA0B,GAAG,SAAS,GAAG,IAAI;IAI/E,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAG1C,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAG3B,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAGlF,aAAa,CACzB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,UAAU,EACxB,QAAQ,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,IAAI,CAAC;IAGH,oBAAoB,CAChC,SAAS,EAAE,QAAQ,EACnB,YAAY,EAAE,UAAU,GAAG,iBAAiB,EAC5C,QAAQ,EAAE,gBAAgB,GAAG,SAAS,EACtC,SAAS,EAAE,OAAO,GAAG,SAAS,GAC5B,OAAO,CAAC,cAAc,CAAC;IAIb,eAAe,CAAC,YAAY,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAGrF,sBAAsB,CAClC,YAAY,EAAE,UAAU,GAAG,iBAAiB,EAC5C,QAAQ,EAAE,gBAAgB,GAAG,SAAS,EACtC,SAAS,EAAE,OAAO,GAAG,SAAS,GAC5B,OAAO,CAAC,cAAc,CAAC;CAI1B"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/fake.js b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/fake.js new file mode 100644 index 0000000..72a23e8 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/fake.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FakeLcdService = void 0; +class FakeLcdService { + calculateFillPanelDimensions(_options) { + // Not supported + return null; + } + async clearKey(_keyIndex) { + // Not supported + } + async clearPanel() { + // Not supported + } + async fillKeyColor(_keyIndex, _r, _g, _b) { + // Not supported + } + async fillKeyBuffer(_keyIndex, _imageBuffer, _options) { + // Not supported + } + async prepareFillKeyBuffer(_keyIndex, _imageBuffer, _options, _jsonSafe) { + // Not supported + throw new Error('Not supported'); + } + async fillPanelBuffer(_imageBuffer, _options) { + // Not supported + } + async prepareFillPanelBuffer(_imageBuffer, _options, _jsonSafe) { + // Not supported + throw new Error('Not supported'); + } +} +exports.FakeLcdService = FakeLcdService; +//# sourceMappingURL=fake.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/fake.js.map b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/fake.js.map new file mode 100644 index 0000000..a67bf09 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/fake.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fake.js","sourceRoot":"","sources":["../../../src/services/buttonsLcdDisplay/fake.ts"],"names":[],"mappings":";;;AAKA,MAAa,cAAc;IACnB,4BAA4B,CAAC,QAAqC;QACxE,gBAAgB;QAChB,OAAO,IAAI,CAAA;IACZ,CAAC;IACM,KAAK,CAAC,QAAQ,CAAC,SAAiB;QACtC,gBAAgB;IACjB,CAAC;IACM,KAAK,CAAC,UAAU;QACtB,gBAAgB;IACjB,CAAC;IACM,KAAK,CAAC,YAAY,CAAC,SAAiB,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU;QAC9E,gBAAgB;IACjB,CAAC;IACM,KAAK,CAAC,aAAa,CACzB,SAAiB,EACjB,YAAwB,EACxB,QAA2B;QAE3B,gBAAgB;IACjB,CAAC;IACM,KAAK,CAAC,oBAAoB,CAChC,SAAmB,EACnB,YAA4C,EAC5C,QAAsC,EACtC,SAA8B;QAE9B,gBAAgB;QAChB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;IACjC,CAAC;IACM,KAAK,CAAC,eAAe,CAAC,YAAwB,EAAE,QAA2B;QACjF,gBAAgB;IACjB,CAAC;IACM,KAAK,CAAC,sBAAsB,CAClC,YAA4C,EAC5C,QAAsC,EACtC,SAA8B;QAE9B,gBAAgB;QAChB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;IACjC,CAAC;CACD;AAzCD,wCAyCC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/interface.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/interface.d.ts new file mode 100644 index 0000000..ec81e0c --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/interface.d.ts @@ -0,0 +1,20 @@ +import type { Dimension, KeyIndex } from '../../id.js'; +import type { FillImageOptions, FillPanelDimensionsOptions, FillPanelOptions } from '../../types.js'; +import type { PreparedBuffer } from '../../preparedBuffer.js'; +export interface GridSpan { + minRow: number; + maxRow: number; + minCol: number; + maxCol: number; +} +export interface ButtonsLcdDisplayService { + calculateFillPanelDimensions(options: FillPanelDimensionsOptions | undefined): Dimension | null; + clearPanel(): Promise; + clearKey(keyIndex: KeyIndex): Promise; + fillKeyColor(keyIndex: KeyIndex, r: number, g: number, b: number): Promise; + fillKeyBuffer(keyIndex: KeyIndex, imageBuffer: Uint8Array, options?: FillImageOptions): Promise; + prepareFillKeyBuffer(keyIndex: KeyIndex, imageBuffer: Uint8Array | Uint8ClampedArray, options: FillImageOptions | undefined, jsonSafe: boolean | undefined): Promise; + fillPanelBuffer(imageBuffer: Uint8Array, options: FillPanelOptions | undefined): Promise; + prepareFillPanelBuffer(imageBuffer: Uint8Array | Uint8ClampedArray, options: FillPanelOptions | undefined, jsonSafe: boolean | undefined): Promise; +} +//# sourceMappingURL=interface.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/interface.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/interface.d.ts.map new file mode 100644 index 0000000..a3d30b1 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/interface.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/services/buttonsLcdDisplay/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACpG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE7D,MAAM,WAAW,QAAQ;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,wBAAwB;IACxC,4BAA4B,CAAC,OAAO,EAAE,0BAA0B,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,CAAA;IAE/F,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE3C,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAChF,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACrG,oBAAoB,CACnB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,UAAU,GAAG,iBAAiB,EAC3C,OAAO,EAAE,gBAAgB,GAAG,SAAS,EACrC,QAAQ,EAAE,OAAO,GAAG,SAAS,GAC3B,OAAO,CAAC,cAAc,CAAC,CAAA;IAE1B,eAAe,CAAC,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,gBAAgB,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9F,sBAAsB,CACrB,WAAW,EAAE,UAAU,GAAG,iBAAiB,EAC3C,OAAO,EAAE,gBAAgB,GAAG,SAAS,EACrC,QAAQ,EAAE,OAAO,GAAG,SAAS,GAC3B,OAAO,CAAC,cAAc,CAAC,CAAA;CAC1B"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/interface.js b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/interface.js new file mode 100644 index 0000000..d549d1f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/interface.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=interface.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/interface.js.map b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/interface.js.map new file mode 100644 index 0000000..198c64e --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/buttonsLcdDisplay/interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../src/services/buttonsLcdDisplay/interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/callback-hook.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/callback-hook.d.ts new file mode 100644 index 0000000..94667fc --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/callback-hook.d.ts @@ -0,0 +1,15 @@ +type EmitEventFn = (key: K, ...args: TEvents[K]) => void; +/** + * A simple helper that allows for the delayed registering of a listener, to avoid dependency cycles + */ +export declare class CallbackHook { + #private; + emit(key: T, ...args: TEvents[T]): void; + listen(fn: EmitEventFn): void; +} +export {}; +//# sourceMappingURL=callback-hook.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/callback-hook.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/callback-hook.d.ts.map new file mode 100644 index 0000000..38e6a72 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/callback-hook.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"callback-hook.d.ts","sourceRoot":"","sources":["../../src/services/callback-hook.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,CAAC,OAAO,SAAS;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,EAAE,CAAA;CAAE,EAAE,CAAC,SAAS,MAAM,OAAO,IAAI,CACnF,GAAG,EAAE,CAAC,EACN,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,KACf,IAAI,CAAA;AAET;;GAEG;AACH,qBAAa,YAAY,CAAC,OAAO,SAAS;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,EAAE,CAAA;CAAE;;IAG/D,IAAI,CAAC,CAAC,SAAS,MAAM,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI;IAMhE,MAAM,CAAC,EAAE,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,GAAG,IAAI;CAGrD"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/callback-hook.js b/node_modules/@elgato-stream-deck/core/dist/services/callback-hook.js new file mode 100644 index 0000000..dd8a1c7 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/callback-hook.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CallbackHook = void 0; +/** + * A simple helper that allows for the delayed registering of a listener, to avoid dependency cycles + */ +class CallbackHook { + #listener = null; + emit(key, ...args) { + if (!this.#listener) + throw new Error('No listener setup'); + this.#listener(key, ...args); + } + listen(fn) { + this.#listener = fn; + } +} +exports.CallbackHook = CallbackHook; +//# sourceMappingURL=callback-hook.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/callback-hook.js.map b/node_modules/@elgato-stream-deck/core/dist/services/callback-hook.js.map new file mode 100644 index 0000000..5ce49f6 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/callback-hook.js.map @@ -0,0 +1 @@ +{"version":3,"file":"callback-hook.js","sourceRoot":"","sources":["../../src/services/callback-hook.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACH,MAAa,YAAY;IACxB,SAAS,GAA+C,IAAI,CAAA;IAE5D,IAAI,CAA0B,GAAM,EAAE,GAAG,IAAgB;QACxD,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;QAEzD,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;IAC7B,CAAC;IAED,MAAM,CAAC,EAAuC;QAC7C,IAAI,CAAC,SAAS,GAAG,EAAE,CAAA;IACpB,CAAC;CACD;AAZD,oCAYC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/galleonK100.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/galleonK100.d.ts new file mode 100644 index 0000000..b6a8eea --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/galleonK100.d.ts @@ -0,0 +1,13 @@ +import type { EncoderIndex } from '../../id.js'; +import type { StreamDeckControlDefinition } from '../../controlDefinition.js'; +import type { HIDDevice } from '../../hid-device.js'; +import type { EncoderLedService } from './interface.js'; +export declare class GalleonK100EncoderLedService implements EncoderLedService { + #private; + constructor(device: HIDDevice, allControls: Readonly); + clearAll(): Promise; + setEncoderColor(encoder: EncoderIndex, _red: number, _green: number, _blue: number): Promise; + setEncoderRingSingleColor(encoder: EncoderIndex, red: number, green: number, blue: number): Promise; + setEncoderRingColors(encoder: EncoderIndex, colors: number[] | Uint8Array): Promise; +} +//# sourceMappingURL=galleonK100.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/galleonK100.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/galleonK100.d.ts.map new file mode 100644 index 0000000..71af109 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/galleonK100.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"galleonK100.d.ts","sourceRoot":"","sources":["../../../src/services/encoderLed/galleonK100.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,2BAA2B,EAAsC,MAAM,4BAA4B,CAAA;AACjH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,qBAAa,4BAA6B,YAAW,iBAAiB;;gBAIzD,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAC,2BAA2B,EAAE,CAAC;IAOtE,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAUzB,eAAe,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOlG,yBAAyB,CACrC,OAAO,EAAE,YAAY,EACrB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC;IAgBH,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CA8CtG"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/galleonK100.js b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/galleonK100.js new file mode 100644 index 0000000..f5ec24d --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/galleonK100.js @@ -0,0 +1,75 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.GalleonK100EncoderLedService = void 0; +class GalleonK100EncoderLedService { + #device; + #encoderControls; + constructor(device, allControls) { + this.#device = device; + this.#encoderControls = allControls.filter((control) => control.type === 'encoder'); + } + async clearAll() { + const ps = []; + for (const control of this.#encoderControls) { + if (control.ledRingSteps > 0) + ps.push(this.setEncoderRingSingleColor(control.index, 0, 0, 0)); + } + await Promise.all(ps); + } + async setEncoderColor(encoder, _red, _green, _blue) { + const control = this.#encoderControls.find((c) => c.index === encoder); + if (!control) + throw new Error(`Invalid encoder index ${encoder}`); + throw new Error('Encoder does not have an LED'); + } + async setEncoderRingSingleColor(encoder, red, green, blue) { + const control = this.#encoderControls.find((c) => c.index === encoder); + if (!control) + throw new Error(`Invalid encoder index ${encoder}`); + if (control.ledRingSteps <= 0) + throw new Error('Encoder does not have an LED ring'); + // Assume them all the same number of steps + const offset = (1 - encoder) * control.ledRingSteps; + const ps = []; + for (let i = 0; i < control.ledRingSteps; i++) { + ps.push(this.#sendEncoderPixelColor(offset + i, red, green, blue)); + } + await Promise.all(ps); + } + async setEncoderRingColors(encoder, colors) { + const control = this.#encoderControls.find((c) => c.index === encoder); + if (!control) + throw new Error(`Invalid encoder index ${encoder}`); + if (control.ledRingSteps <= 0) + throw new Error('Encoder does not have an LED ring'); + if (colors.length !== control.ledRingSteps * 3) + throw new Error('Invalid colors length'); + let colorsArray = colors instanceof Uint8Array ? Array.from(colors) : colors; + // If there is an offset, repack the buffer to change the start point + if (control.lcdRingOffset) { + const oldColorsArray = colorsArray; + colorsArray = []; + colorsArray.push(...oldColorsArray.slice(control.lcdRingOffset * 3)); + colorsArray.push(...oldColorsArray.slice(0, control.lcdRingOffset * 3)); + } + // Assume them all the same number of steps + const offset = (1 - encoder) * control.ledRingSteps; + const ps = []; + for (let i = 0; i < control.ledRingSteps; i++) { + ps.push(this.#sendEncoderPixelColor(offset + i, colorsArray[i * 3], colorsArray[i * 3 + 1], colorsArray[i * 3 + 2])); + } + await Promise.all(ps); + } + async #sendEncoderPixelColor(index, red, green, blue) { + const buffer = new Uint8Array(6); + buffer[0] = 0x03; + buffer[1] = 0x24; + buffer[2] = index; + buffer[3] = red; + buffer[4] = green; + buffer[5] = blue; + await this.#device.sendFeatureReport(buffer); + } +} +exports.GalleonK100EncoderLedService = GalleonK100EncoderLedService; +//# sourceMappingURL=galleonK100.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/galleonK100.js.map b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/galleonK100.js.map new file mode 100644 index 0000000..450e8d6 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/galleonK100.js.map @@ -0,0 +1 @@ +{"version":3,"file":"galleonK100.js","sourceRoot":"","sources":["../../../src/services/encoderLed/galleonK100.ts"],"names":[],"mappings":";;;AAKA,MAAa,4BAA4B;IAC/B,OAAO,CAAW;IAClB,gBAAgB,CAAgD;IAEzE,YAAY,MAAiB,EAAE,WAAoD;QAClF,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QACrB,IAAI,CAAC,gBAAgB,GAAG,WAAW,CAAC,MAAM,CACzC,CAAC,OAAO,EAAiD,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,CACtF,CAAA;IACF,CAAC;IAEM,KAAK,CAAC,QAAQ;QACpB,MAAM,EAAE,GAAyB,EAAE,CAAA;QAEnC,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC7C,IAAI,OAAO,CAAC,YAAY,GAAG,CAAC;gBAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAC9F,CAAC;QAED,MAAM,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IACtB,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,OAAqB,EAAE,IAAY,EAAE,MAAc,EAAE,KAAa;QAC9F,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,CAAA;QACtE,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,OAAO,EAAE,CAAC,CAAA;QAEjE,MAAM,IA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E,GAAW,EAAE,KAAa,EAAE,IAAY;QACnF,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAA;QAChC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;QAChB,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;QAChB,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAA;QACjB,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;QACf,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAA;QACjB,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;QAChB,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAA;IAC7C,CAAC;CACD;AA/FD,oEA+FC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/interface.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/interface.d.ts new file mode 100644 index 0000000..548cf8d --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/interface.d.ts @@ -0,0 +1,8 @@ +import type { EncoderIndex } from '../../id.js'; +export interface EncoderLedService { + clearAll(): Promise; + setEncoderColor(encoder: EncoderIndex, red: number, green: number, blue: number): Promise; + setEncoderRingSingleColor(encoder: EncoderIndex, red: number, green: number, blue: number): Promise; + setEncoderRingColors(encoder: EncoderIndex, colors: number[] | Uint8Array): Promise; +} +//# sourceMappingURL=interface.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/interface.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/interface.d.ts.map new file mode 100644 index 0000000..86ff607 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/interface.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/services/encoderLed/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,MAAM,WAAW,iBAAiB;IACjC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAEzB,eAAe,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE/F,yBAAyB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEzG,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACzF"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/interface.js b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/interface.js new file mode 100644 index 0000000..d549d1f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/interface.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=interface.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/interface.js.map b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/interface.js.map new file mode 100644 index 0000000..0296515 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../src/services/encoderLed/interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/studio.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/studio.d.ts new file mode 100644 index 0000000..d687549 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/studio.d.ts @@ -0,0 +1,13 @@ +import type { EncoderIndex } from '../../id.js'; +import type { StreamDeckControlDefinition } from '../../controlDefinition.js'; +import type { HIDDevice } from '../../hid-device.js'; +import type { EncoderLedService } from './interface.js'; +export declare class StudioEncoderLedService implements EncoderLedService { + #private; + constructor(device: HIDDevice, allControls: Readonly); + clearAll(): Promise; + setEncoderColor(encoder: EncoderIndex, red: number, green: number, blue: number): Promise; + setEncoderRingSingleColor(encoder: EncoderIndex, red: number, green: number, blue: number): Promise; + setEncoderRingColors(encoder: EncoderIndex, colors: number[] | Uint8Array): Promise; +} +//# sourceMappingURL=studio.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/studio.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/studio.d.ts.map new file mode 100644 index 0000000..882bed8 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/studio.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"studio.d.ts","sourceRoot":"","sources":["../../../src/services/encoderLed/studio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,2BAA2B,EAAsC,MAAM,4BAA4B,CAAA;AACjH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,qBAAa,uBAAwB,YAAW,iBAAiB;;gBAIpD,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAC,2BAA2B,EAAE,CAAC;IAOtE,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAWzB,eAAe,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB/F,yBAAyB,CACrC,OAAO,EAAE,YAAY,EACrB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC;IAoBH,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CA2BtG"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/studio.js b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/studio.js new file mode 100644 index 0000000..d351ec7 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/studio.js @@ -0,0 +1,79 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StudioEncoderLedService = void 0; +class StudioEncoderLedService { + #device; + #encoderControls; + constructor(device, allControls) { + this.#device = device; + this.#encoderControls = allControls.filter((control) => control.type === 'encoder'); + } + async clearAll() { + const ps = []; + for (const control of this.#encoderControls) { + if (control.hasLed) + ps.push(this.setEncoderColor(control.index, 0, 0, 0)); + if (control.ledRingSteps > 0) + ps.push(this.setEncoderRingSingleColor(control.index, 0, 0, 0)); + } + await Promise.all(ps); + } + async setEncoderColor(encoder, red, green, blue) { + const control = this.#encoderControls.find((c) => c.index === encoder); + if (!control) + throw new Error(`Invalid encoder index ${encoder}`); + if (!control.hasLed) + throw new Error('Encoder does not have an LED'); + const buffer = new Uint8Array(1024); + buffer[0] = 0x02; + buffer[1] = 0x10; + buffer[2] = encoder; + buffer[3] = red; + buffer[4] = green; + buffer[5] = blue; + await this.#device.sendReports([buffer]); + } + async setEncoderRingSingleColor(encoder, red, green, blue) { + const control = this.#encoderControls.find((c) => c.index === encoder); + if (!control) + throw new Error(`Invalid encoder index ${encoder}`); + if (control.ledRingSteps <= 0) + throw new Error('Encoder does not have an LED ring'); + const buffer = new Uint8Array(1024); + buffer[0] = 0x02; + buffer[1] = 0x0f; + buffer[2] = encoder; + for (let i = 0; i < control.ledRingSteps; i++) { + const offset = 3 + i * 3; + buffer[offset] = red; + buffer[offset + 1] = green; + buffer[offset + 2] = blue; + } + await this.#device.sendReports([buffer]); + } + async setEncoderRingColors(encoder, colors) { + const control = this.#encoderControls.find((c) => c.index === encoder); + if (!control) + throw new Error(`Invalid encoder index ${encoder}`); + if (control.ledRingSteps <= 0) + throw new Error('Encoder does not have an LED ring'); + if (colors.length !== control.ledRingSteps * 3) + throw new Error('Invalid colors length'); + let colorsBuffer = colors instanceof Uint8Array ? colors : new Uint8Array(colors); + // If there is an offset, repack the buffer to change the start point + if (control.lcdRingOffset) { + const oldColorsBuffer = colorsBuffer; + colorsBuffer = new Uint8Array(oldColorsBuffer.length); + colorsBuffer.set(oldColorsBuffer.slice(control.lcdRingOffset * 3), 0); + colorsBuffer.set(oldColorsBuffer.slice(0, control.lcdRingOffset * 3), control.lcdRingOffset * 3); + } + const buffer = new Uint8Array(1024); + buffer[0] = 0x02; + buffer[1] = 0x0f; + buffer[2] = encoder; + buffer.set(colorsBuffer, 3); + await this.#device.sendReports([buffer]); + } +} +exports.StudioEncoderLedService = StudioEncoderLedService; +//# sourceMappingURL=studio.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/studio.js.map b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/studio.js.map new file mode 100644 index 0000000..c6abded --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/encoderLed/studio.js.map @@ -0,0 +1 @@ +{"version":3,"file":"studio.js","sourceRoot":"","sources":["../../../src/services/encoderLed/studio.ts"],"names":[],"mappings":";;;AAKA,MAAa,uBAAuB;IAC1B,OAAO,CAAW;IAClB,gBAAgB,CAAgD;IAEzE,YAAY,MAAiB,EAAE,WAAoD;QAClF,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QACrB,IAAI,CAAC,gBAAgB,GAAG,WAAW,CAAC,MAAM,CACzC,CAAC,OAAO,EAAiD,EAAE,CAAC,OAAO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,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA;QAE3B,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IACzC,CAAC;CACD;AA1FD,0DA0FC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/bitmap.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/bitmap.d.ts new file mode 100644 index 0000000..5270998 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/bitmap.d.ts @@ -0,0 +1,9 @@ +import type { ButtonLcdImagePacker, InternalFillImageOptions } from './interface.js'; +import type { FillImageTargetOptions } from '../../util.js'; +import type { Dimension } from '../../id.js'; +export declare class BitmapButtonLcdImagePacker implements ButtonLcdImagePacker { + #private; + constructor(targetOptions: FillImageTargetOptions, bmpImagePPM: number); + convertPixelBuffer(sourceBuffer: Uint8Array, sourceOptions: InternalFillImageOptions, targetSize: Dimension): Promise; +} +//# sourceMappingURL=bitmap.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/bitmap.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/bitmap.d.ts.map new file mode 100644 index 0000000..4f4fa6a --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/bitmap.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bitmap.d.ts","sourceRoot":"","sources":["../../../src/services/imagePacker/bitmap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AACpF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAE3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,qBAAa,0BAA2B,YAAW,oBAAoB;;gBAI1D,aAAa,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM;IAKzD,kBAAkB,CAC9B,YAAY,EAAE,UAAU,EACxB,aAAa,EAAE,wBAAwB,EACvC,UAAU,EAAE,SAAS,GACnB,OAAO,CAAC,UAAU,CAAC;CAkBtB"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/bitmap.js b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/bitmap.js new file mode 100644 index 0000000..f40bf38 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/bitmap.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BitmapButtonLcdImagePacker = void 0; +const util_js_1 = require("../../util.js"); +class BitmapButtonLcdImagePacker { + #targetOptions; + #bmpImagePPM; + constructor(targetOptions, bmpImagePPM) { + this.#targetOptions = targetOptions; + this.#bmpImagePPM = bmpImagePPM; + } + async convertPixelBuffer(sourceBuffer, sourceOptions, targetSize) { + const byteBuffer = (0, util_js_1.transformImageBuffer)(sourceBuffer, sourceOptions, this.#targetOptions, util_js_1.BMP_HEADER_LENGTH, targetSize.width, targetSize.height); + (0, util_js_1.writeBMPHeader)(byteBuffer, targetSize.width, targetSize.height, byteBuffer.length - util_js_1.BMP_HEADER_LENGTH, this.#bmpImagePPM); + return byteBuffer; + } +} +exports.BitmapButtonLcdImagePacker = BitmapButtonLcdImagePacker; +//# sourceMappingURL=bitmap.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/bitmap.js.map b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/bitmap.js.map new file mode 100644 index 0000000..316c035 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/bitmap.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bitmap.js","sourceRoot":"","sources":["../../../src/services/imagePacker/bitmap.ts"],"names":[],"mappings":";;;AAEA,2CAAuF;AAGvF,MAAa,0BAA0B;IAC7B,cAAc,CAAwB;IACtC,YAAY,CAAQ;IAE7B,YAAY,aAAqC,EAAE,WAAmB;QACrE,IAAI,CAAC,cAAc,GAAG,aAAa,CAAA;QACnC,IAAI,CAAC,YAAY,GAAG,WAAW,CAAA;IAChC,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAC9B,YAAwB,EACxB,aAAuC,EACvC,UAAqB;QAErB,MAAM,UAAU,GAAG,IAAA,8BAAoB,EACtC,YAAY,EACZ,aAAa,EACb,IAAI,CAAC,cAAc,EACnB,2BAAiB,EACjB,UAAU,CAAC,KAAK,EAChB,UAAU,CAAC,MAAM,CACjB,CAAA;QACD,IAAA,wBAAc,EACb,UAAU,EACV,UAAU,CAAC,KAAK,EAChB,UAAU,CAAC,MAAM,EACjB,UAAU,CAAC,MAAM,GAAG,2BAAiB,EACrC,IAAI,CAAC,YAAY,CACjB,CAAA;QACD,OAAO,UAAU,CAAA;IAClB,CAAC;CACD;AA/BD,gEA+BC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/interface.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/interface.d.ts new file mode 100644 index 0000000..d10c818 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/interface.d.ts @@ -0,0 +1,10 @@ +import type { Dimension } from '../../id.js'; +import type { FillImageOptions } from '../../types.js'; +export interface InternalFillImageOptions extends FillImageOptions { + offset: number; + stride: number; +} +export interface ButtonLcdImagePacker { + convertPixelBuffer(sourceBuffer: Uint8Array | Uint8ClampedArray, sourceOptions: InternalFillImageOptions, targetSize: Dimension): Promise; +} +//# sourceMappingURL=interface.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/interface.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/interface.d.ts.map new file mode 100644 index 0000000..cf205c8 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/interface.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/services/imagePacker/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB;IACjE,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,oBAAoB;IACpC,kBAAkB,CACjB,YAAY,EAAE,UAAU,GAAG,iBAAiB,EAC5C,aAAa,EAAE,wBAAwB,EACvC,UAAU,EAAE,SAAS,GACnB,OAAO,CAAC,UAAU,CAAC,CAAA;CACtB"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/interface.js b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/interface.js new file mode 100644 index 0000000..d549d1f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/interface.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=interface.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/interface.js.map b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/interface.js.map new file mode 100644 index 0000000..caf0da3 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../src/services/imagePacker/interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/jpeg.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/jpeg.d.ts new file mode 100644 index 0000000..724436e --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/jpeg.d.ts @@ -0,0 +1,9 @@ +import type { ButtonLcdImagePacker, InternalFillImageOptions } from './interface.js'; +import type { EncodeJPEGHelper } from '../../models/base.js'; +import type { Dimension } from '../../id.js'; +export declare class JpegButtonLcdImagePacker implements ButtonLcdImagePacker { + #private; + constructor(encodeJPEG: EncodeJPEGHelper, xyFlip: boolean); + convertPixelBuffer(sourceBuffer: Uint8Array, sourceOptions: InternalFillImageOptions, targetSize: Dimension): Promise; +} +//# sourceMappingURL=jpeg.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/jpeg.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/jpeg.d.ts.map new file mode 100644 index 0000000..f9bd716 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/jpeg.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"jpeg.d.ts","sourceRoot":"","sources":["../../../src/services/imagePacker/jpeg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAEpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,qBAAa,wBAAyB,YAAW,oBAAoB;;gBAIxD,UAAU,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO;IAK5C,kBAAkB,CAC9B,YAAY,EAAE,UAAU,EACxB,aAAa,EAAE,wBAAwB,EACvC,UAAU,EAAE,SAAS,GACnB,OAAO,CAAC,UAAU,CAAC;CAYtB"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/jpeg.js b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/jpeg.js new file mode 100644 index 0000000..e4b3014 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/jpeg.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.JpegButtonLcdImagePacker = void 0; +const util_js_1 = require("../../util.js"); +class JpegButtonLcdImagePacker { + #encodeJPEG; + #xyFlip; + constructor(encodeJPEG, xyFlip) { + this.#encodeJPEG = encodeJPEG; + this.#xyFlip = xyFlip; + } + async convertPixelBuffer(sourceBuffer, sourceOptions, targetSize) { + const byteBuffer = (0, util_js_1.transformImageBuffer)(sourceBuffer, sourceOptions, { colorMode: 'rgba', xFlip: this.#xyFlip, yFlip: this.#xyFlip }, 0, targetSize.width, targetSize.height); + return this.#encodeJPEG(byteBuffer, targetSize.width, targetSize.height); + } +} +exports.JpegButtonLcdImagePacker = JpegButtonLcdImagePacker; +//# sourceMappingURL=jpeg.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/jpeg.js.map b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/jpeg.js.map new file mode 100644 index 0000000..e874ce1 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imagePacker/jpeg.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jpeg.js","sourceRoot":"","sources":["../../../src/services/imagePacker/jpeg.ts"],"names":[],"mappings":";;;AACA,2CAAoD;AAIpD,MAAa,wBAAwB;IAC3B,WAAW,CAAkB;IAC7B,OAAO,CAAS;IAEzB,YAAY,UAA4B,EAAE,MAAe;QACxD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAA;QAC7B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACtB,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAC9B,YAAwB,EACxB,aAAuC,EACvC,UAAqB;QAErB,MAAM,UAAU,GAAG,IAAA,8BAAoB,EACtC,YAAY,EACZ,aAAa,EACb,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,EAC/D,CAAC,EACD,UAAU,CAAC,KAAK,EAChB,UAAU,CAAC,MAAM,CACjB,CAAA;QAED,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;IACzE,CAAC;CACD;AAzBD,4DAyBC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/headerGenerator.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/headerGenerator.d.ts new file mode 100644 index 0000000..f401170 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/headerGenerator.d.ts @@ -0,0 +1,24 @@ +import type { StreamdeckImageHeaderGenerator, StreamdeckImageWriterProps } from './types.js'; +export declare class StreamdeckGen1ImageHeaderGenerator implements StreamdeckImageHeaderGenerator { + getFillImageCommandHeaderLength(): number; + writeFillImageCommandHeader(buffer: Uint8Array, props: StreamdeckImageWriterProps, partIndex: number, isLast: boolean, _bodyLength: number): void; +} +export declare class StreamdeckGen2ImageHeaderGenerator implements StreamdeckImageHeaderGenerator { + getFillImageCommandHeaderLength(): number; + writeFillImageCommandHeader(buffer: Uint8Array, props: StreamdeckImageWriterProps, partIndex: number, isLast: boolean, bodyLength: number): void; +} +export interface StreamdeckPlusHeaderProps { + x: number; + y: number; + width: number; + height: number; +} +export declare class StreamdeckDefaultLcdImageHeaderGenerator implements StreamdeckImageHeaderGenerator { + getFillImageCommandHeaderLength(): number; + writeFillImageCommandHeader(buffer: Uint8Array, props: StreamdeckPlusHeaderProps, partIndex: number, isLast: boolean, bodyLength: number): void; +} +export declare class StreamdeckNeoLcdImageHeaderGenerator implements StreamdeckImageHeaderGenerator { + getFillImageCommandHeaderLength(): number; + writeFillImageCommandHeader(buffer: Uint8Array, _props: never, partIndex: number, isLast: boolean, bodyLength: number): void; +} +//# sourceMappingURL=headerGenerator.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/headerGenerator.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/headerGenerator.d.ts.map new file mode 100644 index 0000000..9d57526 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/headerGenerator.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"headerGenerator.d.ts","sourceRoot":"","sources":["../../../src/services/imageWriter/headerGenerator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,8BAA8B,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AAE5F,qBAAa,kCAAmC,YAAW,8BAA8B;IACxF,+BAA+B,IAAI,MAAM;IAIzC,2BAA2B,CAC1B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,0BAA0B,EACjC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,EACf,WAAW,EAAE,MAAM,GACjB,IAAI;CASP;AAED,qBAAa,kCAAmC,YAAW,8BAA8B;IACxF,+BAA+B,IAAI,MAAM;IAIzC,2BAA2B,CAC1B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,0BAA0B,EACjC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,MAAM,GAChB,IAAI;CAUP;AAED,MAAM,WAAW,yBAAyB;IACzC,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACd;AACD,qBAAa,wCAAyC,YAAW,8BAA8B,CAAC,yBAAyB,CAAC;IACzH,+BAA+B,IAAI,MAAM;IAIzC,2BAA2B,CAC1B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,yBAAyB,EAChC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,MAAM,GAChB,IAAI;CAaP;AAED,qBAAa,oCAAqC,YAAW,8BAA8B,CAAC,IAAI,CAAC;IAChG,+BAA+B,IAAI,MAAM;IAIzC,2BAA2B,CAC1B,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,KAAK,EACb,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,MAAM,GAChB,IAAI;CAUP"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/headerGenerator.js b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/headerGenerator.js new file mode 100644 index 0000000..e1e9d83 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/headerGenerator.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamdeckNeoLcdImageHeaderGenerator = exports.StreamdeckDefaultLcdImageHeaderGenerator = exports.StreamdeckGen2ImageHeaderGenerator = exports.StreamdeckGen1ImageHeaderGenerator = void 0; +const util_js_1 = require("../../util.js"); +class StreamdeckGen1ImageHeaderGenerator { + getFillImageCommandHeaderLength() { + return 16; + } + writeFillImageCommandHeader(buffer, props, partIndex, isLast, _bodyLength) { + const bufferView = (0, util_js_1.uint8ArrayToDataView)(buffer); + bufferView.setUint8(0, 0x02); + bufferView.setUint8(1, 0x01); + bufferView.setUint16(2, partIndex, true); + bufferView.setUint8(4, isLast ? 1 : 0); + bufferView.setUint8(5, props.keyIndex + 1); + } +} +exports.StreamdeckGen1ImageHeaderGenerator = StreamdeckGen1ImageHeaderGenerator; +class StreamdeckGen2ImageHeaderGenerator { + getFillImageCommandHeaderLength() { + return 8; + } + writeFillImageCommandHeader(buffer, props, partIndex, isLast, bodyLength) { + const bufferView = (0, util_js_1.uint8ArrayToDataView)(buffer); + bufferView.setUint8(0, 0x02); + bufferView.setUint8(1, 0x07); + bufferView.setUint8(2, props.keyIndex); + bufferView.setUint8(3, isLast ? 1 : 0); + bufferView.setUint16(4, bodyLength, true); + bufferView.setUint16(6, partIndex++, true); + } +} +exports.StreamdeckGen2ImageHeaderGenerator = StreamdeckGen2ImageHeaderGenerator; +class StreamdeckDefaultLcdImageHeaderGenerator { + getFillImageCommandHeaderLength() { + return 16; + } + writeFillImageCommandHeader(buffer, props, partIndex, isLast, bodyLength) { + const bufferView = (0, util_js_1.uint8ArrayToDataView)(buffer); + bufferView.setUint8(0, 0x02); + bufferView.setUint8(1, 0x0c); + bufferView.setUint16(2, props.x, true); + bufferView.setUint16(4, props.y, true); + bufferView.setUint16(6, props.width, true); + bufferView.setUint16(8, props.height, true); + bufferView.setUint8(10, isLast ? 1 : 0); + bufferView.setUint16(11, partIndex, true); + bufferView.setUint16(13, bodyLength, true); + } +} +exports.StreamdeckDefaultLcdImageHeaderGenerator = StreamdeckDefaultLcdImageHeaderGenerator; +class StreamdeckNeoLcdImageHeaderGenerator { + getFillImageCommandHeaderLength() { + return 8; + } + writeFillImageCommandHeader(buffer, _props, partIndex, isLast, bodyLength) { + const bufferView = (0, util_js_1.uint8ArrayToDataView)(buffer); + bufferView.setUint8(0, 0x02); + bufferView.setUint8(1, 0x0b); + bufferView.setUint8(2, 0); + bufferView.setUint8(3, isLast ? 1 : 0); + bufferView.setUint16(4, bodyLength, true); + bufferView.setUint16(6, partIndex, true); + } +} +exports.StreamdeckNeoLcdImageHeaderGenerator = StreamdeckNeoLcdImageHeaderGenerator; +//# sourceMappingURL=headerGenerator.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/headerGenerator.js.map b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/headerGenerator.js.map new file mode 100644 index 0000000..b90fb6e --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/headerGenerator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"headerGenerator.js","sourceRoot":"","sources":["../../../src/services/imageWriter/headerGenerator.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AAGpD,MAAa,kCAAkC;IAC9C,+BAA+B;QAC9B,OAAO,EAAE,CAAA;IACV,CAAC;IAED,2BAA2B,CAC1B,MAAkB,EAClB,KAAiC,EACjC,SAAiB,EACjB,MAAe,EACf,WAAmB;QAEnB,MAAM,UAAU,GAAG,IAAA,8BAAoB,EAAC,MAAM,CAAC,CA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C,CAAC,EAAE,CAAC,CAAC,CAAA;QACzB,UAAU,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACtC,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;QACzC,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;IACzC,CAAC;CACD;AArBD,oFAqBC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/imageWriter.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/imageWriter.d.ts new file mode 100644 index 0000000..798b981 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/imageWriter.d.ts @@ -0,0 +1,11 @@ +import type { StreamdeckImageHeaderGenerator, StreamdeckImageWriter, StreamdeckImageWriterProps } from './types.js'; +export declare class StreamdeckOriginalImageWriter implements StreamdeckImageWriter { + private readonly headerGenerator; + generateFillImageWrites(props: StreamdeckImageWriterProps, byteBuffer: Uint8Array): Uint8Array[]; +} +export declare class StreamdeckDefaultImageWriter implements StreamdeckImageWriter { + private readonly headerGenerator; + constructor(headerGenerator: StreamdeckImageHeaderGenerator); + generateFillImageWrites(props: TProps, byteBuffer: Uint8Array): Uint8Array[]; +} +//# sourceMappingURL=imageWriter.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/imageWriter.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/imageWriter.d.ts.map new file mode 100644 index 0000000..108998d --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/imageWriter.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"imageWriter.d.ts","sourceRoot":"","sources":["../../../src/services/imageWriter/imageWriter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,8BAA8B,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AAEnH,qBAAa,6BAA8B,YAAW,qBAAqB;IAC1E,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA2C;IAEpE,uBAAuB,CAAC,KAAK,EAAE,0BAA0B,EAAE,UAAU,EAAE,UAAU,GAAG,UAAU,EAAE;CAkBvG;AAED,qBAAa,4BAA4B,CACxC,MAAM,GAAG,0BAA0B,CAClC,YAAW,qBAAqB,CAAC,MAAM,CAAC;IACzC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAwC;gBAE5D,eAAe,EAAE,8BAA8B,CAAC,MAAM,CAAC;IAI5D,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,UAAU,EAAE;CA6BnF"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/imageWriter.js b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/imageWriter.js new file mode 100644 index 0000000..f39556f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/imageWriter.js @@ -0,0 +1,46 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamdeckDefaultImageWriter = exports.StreamdeckOriginalImageWriter = void 0; +const headerGenerator_js_1 = require("./headerGenerator.js"); +class StreamdeckOriginalImageWriter { + headerGenerator = new headerGenerator_js_1.StreamdeckGen1ImageHeaderGenerator(); + generateFillImageWrites(props, byteBuffer) { + const MAX_PACKET_SIZE = 8191; + const PACKET_HEADER_LENGTH = this.headerGenerator.getFillImageCommandHeaderLength(); + // The original uses larger packets, and splits the payload equally across 2 + const packet1Bytes = byteBuffer.length / 2; + const packet1 = new Uint8Array(MAX_PACKET_SIZE); + this.headerGenerator.writeFillImageCommandHeader(packet1, props, 0x01, false, packet1Bytes); + packet1.set(byteBuffer.subarray(0, packet1Bytes), PACKET_HEADER_LENGTH); + const packet2 = new Uint8Array(MAX_PACKET_SIZE); + this.headerGenerator.writeFillImageCommandHeader(packet2, props, 0x02, true, packet1Bytes); + packet2.set(byteBuffer.subarray(packet1Bytes), PACKET_HEADER_LENGTH); + return [packet1, packet2]; + } +} +exports.StreamdeckOriginalImageWriter = StreamdeckOriginalImageWriter; +class StreamdeckDefaultImageWriter { + headerGenerator; + constructor(headerGenerator) { + this.headerGenerator = headerGenerator; + } + generateFillImageWrites(props, byteBuffer) { + const MAX_PACKET_SIZE = 1024; + const PACKET_HEADER_LENGTH = this.headerGenerator.getFillImageCommandHeaderLength(); + const MAX_PAYLOAD_SIZE = MAX_PACKET_SIZE - PACKET_HEADER_LENGTH; + const result = []; + let remainingBytes = byteBuffer.length; + for (let part = 0; remainingBytes > 0; part++) { + const packet = new Uint8Array(MAX_PACKET_SIZE); + const byteCount = Math.min(remainingBytes, MAX_PAYLOAD_SIZE); + this.headerGenerator.writeFillImageCommandHeader(packet, props, part, remainingBytes <= MAX_PAYLOAD_SIZE, byteCount); + const byteOffset = byteBuffer.length - remainingBytes; + remainingBytes -= byteCount; + packet.set(byteBuffer.subarray(byteOffset, byteOffset + byteCount), PACKET_HEADER_LENGTH); + result.push(packet); + } + return result; + } +} +exports.StreamdeckDefaultImageWriter = StreamdeckDefaultImageWriter; +//# sourceMappingURL=imageWriter.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/imageWriter.js.map b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/imageWriter.js.map new file mode 100644 index 0000000..42da0b0 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/imageWriter.js.map @@ -0,0 +1 @@ +{"version":3,"file":"imageWriter.js","sourceRoot":"","sources":["../../../src/services/imageWriter/imageWriter.ts"],"names":[],"mappings":";;;AAAA,6DAAyE;AAGzE,MAAa,6BAA6B;IACxB,eAAe,GAAG,IAAI,uDAAkC,EAAE,CAAA;IAEpE,uBAAuB,CAAC,KAAiC,EAAE,UAAsB;QACvF,MAAM,eAAe,GAAG,IAAI,C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c,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC;YAC/C,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,eAAe,CAAC,CAAA;YAE9C,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAA;YAC5D,IAAI,CAAC,eAAe,CAAC,2BAA2B,CAC/C,MAAM,EACN,KAAK,EACL,IAAI,EACJ,cAAc,IAAI,gBAAgB,EAClC,SAAS,CACT,CAAA;YAED,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,GAAG,cAAc,CAAA;YACrD,cAAc,IAAI,SAAS,CAAA;YAC3B,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC,EAAE,oBAAoB,CAAC,CAAA;YAEzF,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACpB,CAAC;QAED,OAAO,MAAM,CAAA;IACd,CAAC;CACD;AAtCD,oEAsCC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/types.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/types.d.ts new file mode 100644 index 0000000..5898c41 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/types.d.ts @@ -0,0 +1,12 @@ +import type { KeyIndex } from '../../id.js'; +export interface StreamdeckImageWriterProps { + keyIndex: KeyIndex; +} +export interface StreamdeckImageWriter { + generateFillImageWrites(props: TProps, byteBuffer: Uint8Array): Uint8Array[]; +} +export interface StreamdeckImageHeaderGenerator { + getFillImageCommandHeaderLength(): number; + writeFillImageCommandHeader(buffer: Uint8Array, props: TProps, partIndex: number, isLast: boolean, bodyLength: number): void; +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/types.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/types.d.ts.map new file mode 100644 index 0000000..0944fe6 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/imageWriter/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,EAAE,QAAQ,CAAA;CAClB;AAED,MAAM,WAAW,qBAAqB,CAAC,MAAM,GAAG,0BAA0B;IACzE,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,UAAU,EAAE,CAAA;CAC5E;AAED,MAAM,WAAW,8BAA8B,CAAC,MAAM,GAAG,0BAA0B;IAClF,+BAA+B,IAAI,MAAM,CAAA;IACzC,2BAA2B,CAC1B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,MAAM,GAChB,IAAI,CAAA;CACP"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/types.js b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/types.js new file mode 100644 index 0000000..11e638d --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/types.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/types.js.map b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/types.js.map new file mode 100644 index 0000000..ce40486 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/imageWriter/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/imageWriter/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/input/fake.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/input/fake.d.ts new file mode 100644 index 0000000..dfb224b --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/input/fake.d.ts @@ -0,0 +1,5 @@ +import type { StreamDeckInputService } from './interface.js'; +export declare class FakeInputService implements StreamDeckInputService { + handleInput(_data: Uint8Array): void; +} +//# sourceMappingURL=fake.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/input/fake.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/input/fake.d.ts.map new file mode 100644 index 0000000..8bf06e3 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/input/fake.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fake.d.ts","sourceRoot":"","sources":["../../../src/services/input/fake.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAE5D,qBAAa,gBAAiB,YAAW,sBAAsB;IAC9D,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;CAGpC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/input/fake.js b/node_modules/@elgato-stream-deck/core/dist/services/input/fake.js new file mode 100644 index 0000000..effb095 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/input/fake.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FakeInputService = void 0; +class FakeInputService { + handleInput(_data) { + // Noop + } +} +exports.FakeInputService = FakeInputService; +//# sourceMappingURL=fake.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/input/fake.js.map b/node_modules/@elgato-stream-deck/core/dist/services/input/fake.js.map new file mode 100644 index 0000000..edc2b5e --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/input/fake.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fake.js","sourceRoot":"","sources":["../../../src/services/input/fake.ts"],"names":[],"mappings":";;;AAEA,MAAa,gBAAgB;IAC5B,WAAW,CAAC,KAAiB;QAC5B,OAAO;IACR,CAAC;CACD;AAJD,4CAIC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/input/gen1.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/input/gen1.d.ts new file mode 100644 index 0000000..03af508 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/input/gen1.d.ts @@ -0,0 +1,11 @@ +import type { StreamDeckProperties } from '../../models/base.js'; +import type { StreamDeckInputService } from './interface.js'; +import type { StreamDeckEvents } from '../../types.js'; +import type { CallbackHook } from '../callback-hook.js'; +export declare class ButtonOnlyInputService implements StreamDeckInputService { + #private; + protected readonly deviceProperties: Readonly; + constructor(deviceProperties: Readonly, eventSource: CallbackHook); + handleInput(data: Uint8Array): void; +} +//# sourceMappingURL=gen1.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/input/gen1.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/input/gen1.d.ts.map new file mode 100644 index 0000000..f9ecfe5 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/input/gen1.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"gen1.d.ts","sourceRoot":"","sources":["../../../src/services/input/gen1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAGvD,qBAAa,sBAAuB,YAAW,sBAAsB;;IACpE,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAA;gBAIvD,gBAAgB,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EAAE,WAAW,EAAE,YAAY,CAAC,gBAAgB,CAAC;IAUzG,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;CAkBnC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/input/gen1.js b/node_modules/@elgato-stream-deck/core/dist/services/input/gen1.js new file mode 100644 index 0000000..cc090ba --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/input/gen1.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ButtonOnlyInputService = void 0; +class ButtonOnlyInputService { + deviceProperties; + #keyState; + #eventSource; + constructor(deviceProperties, eventSource) { + this.deviceProperties = deviceProperties; + this.#eventSource = eventSource; + const maxButtonIndex = this.deviceProperties.CONTROLS.filter((control) => control.type === 'button').map((control) => control.index); + this.#keyState = new Array(Math.max(-1, ...maxButtonIndex) + 1).fill(false); + } + handleInput(data) { + const dataOffset = this.deviceProperties.KEY_DATA_OFFSET || 0; + for (const control of this.deviceProperties.CONTROLS) { + if (control.type !== 'button') + continue; + const keyPressed = Boolean(data[dataOffset + control.hidIndex]); + const stateChanged = keyPressed !== this.#keyState[control.index]; + if (stateChanged) { + this.#keyState[control.index] = keyPressed; + if (keyPressed) { + this.#eventSource.emit('down', control); + } + else { + this.#eventSource.emit('up', control); + } + } + } + } +} +exports.ButtonOnlyInputService = ButtonOnlyInputService; +//# sourceMappingURL=gen1.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/input/gen1.js.map b/node_modules/@elgato-stream-deck/core/dist/services/input/gen1.js.map new file mode 100644 index 0000000..6df4ece --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/input/gen1.js.map @@ -0,0 +1 @@ +{"version":3,"file":"gen1.js","sourceRoot":"","sources":["../../../src/services/input/gen1.ts"],"names":[],"mappings":";;;AAMA,MAAa,sBAAsB;IACf,gBAAgB,CAAgC;IAC1D,SAAS,CAAW;IACpB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,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;gBACtC,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;CACD;AAjCD,wDAiCC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/input/gen2.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/input/gen2.d.ts new file mode 100644 index 0000000..29add45 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/input/gen2.d.ts @@ -0,0 +1,10 @@ +import type { StreamDeckProperties } from '../../models/base.js'; +import type { StreamDeckEvents } from '../../types.js'; +import type { CallbackHook } from '../callback-hook.js'; +import { ButtonOnlyInputService } from './gen1.js'; +export declare class Gen2InputService extends ButtonOnlyInputService { + #private; + constructor(deviceProperties: Readonly, eventSource: CallbackHook); + handleInput(data: Uint8Array): void; +} +//# sourceMappingURL=gen2.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/input/gen2.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/input/gen2.d.ts.map new file mode 100644 index 0000000..16de34d --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/input/gen2.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"gen2.d.ts","sourceRoot":"","sources":["../../../src/services/input/gen2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,KAAK,EAAe,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAKvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAGlD,qBAAa,gBAAiB,SAAQ,sBAAsB;;gBAM/C,gBAAgB,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EAAE,WAAW,EAAE,YAAY,CAAC,gBAAgB,CAAC;IAezG,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;CAoFnC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/input/gen2.js b/node_modules/@elgato-stream-deck/core/dist/services/input/gen2.js new file mode 100644 index 0000000..0cb9bd4 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/input/gen2.js @@ -0,0 +1,101 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Gen2InputService = void 0; +const gen1_js_1 = require("./gen1.js"); +const util_js_1 = require("../../util.js"); +class Gen2InputService extends gen1_js_1.ButtonOnlyInputService { + #eventSource; + #encoderControls; + #encoderState; + #lcdSegmentControls; + constructor(deviceProperties, eventSource) { + super(deviceProperties, eventSource); + this.#eventSource = eventSource; + this.#encoderControls = deviceProperties.CONTROLS.filter((control) => control.type === 'encoder'); + const maxIndex = Math.max(-1, ...this.#encoderControls.map((control) => control.index)); + this.#encoderState = new Array(maxIndex + 1).fill(false); + this.#lcdSegmentControls = deviceProperties.CONTROLS.filter((control) => control.type === 'lcd-segment'); + } + handleInput(data) { + const inputType = data[0]; + switch (inputType) { + case 0x00: // Button + super.handleInput(data); + break; + case 0x02: // LCD + this.#handleLcdSegmentInput(data); + break; + case 0x03: // Encoder + this.#handleEncoderInput(data); + break; + case 0x04: // NFC + this.#handleNfcRead(data); + break; + } + } + #handleLcdSegmentInput(data) { + // Future: This will need to handle selecting the correct control + const lcdSegmentControl = this.#lcdSegmentControls.find((control) => control.id === 0); + if (!lcdSegmentControl) + return; + const bufferView = (0, util_js_1.uint8ArrayToDataView)(data); + const position = { + x: bufferView.getUint16(5, true), + y: bufferView.getUint16(7, true), + }; + switch (data[3]) { + case 1: // short press + this.#eventSource.emit('lcdShortPress', lcdSegmentControl, position); + break; + case 2: // long press + this.#eventSource.emit('lcdLongPress', lcdSegmentControl, position); + break; + case 3: { + // swipe + const positionTo = { + x: bufferView.getUint16(9, true), + y: bufferView.getUint16(11, true), + }; + this.#eventSource.emit('lcdSwipe', lcdSegmentControl, position, positionTo); + break; + } + } + } + #handleEncoderInput(data) { + switch (data[3]) { + case 0x00: // press/release + for (const encoderControl of this.#encoderControls) { + const keyPressed = Boolean(data[4 + encoderControl.hidIndex]); + const stateChanged = keyPressed !== this.#encoderState[encoderControl.index]; + if (stateChanged) { + this.#encoderState[encoderControl.index] = keyPressed; + if (keyPressed) { + this.#eventSource.emit('down', encoderControl); + } + else { + this.#eventSource.emit('up', encoderControl); + } + } + } + break; + case 0x01: // rotate + for (const encoderControl of this.#encoderControls) { + const intArray = new Int8Array(data.buffer, data.byteOffset, data.byteLength); + const value = intArray[4 + encoderControl.hidIndex]; + if (value !== 0) { + this.#eventSource.emit('rotate', encoderControl, value); + } + } + break; + } + } + #handleNfcRead(data) { + if (!this.deviceProperties.HAS_NFC_READER) + return; + const length = data[1] + data[2] * 256; + const id = new TextDecoder('ascii').decode(data.subarray(3, 3 + length)); + this.#eventSource.emit('nfcRead', id); + } +} +exports.Gen2InputService = Gen2InputService; +//# sourceMappingURL=gen2.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/input/gen2.js.map b/node_modules/@elgato-stream-deck/core/dist/services/input/gen2.js.map new file mode 100644 index 0000000..5de34ab --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/input/gen2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"gen2.js","sourceRoot":"","sources":["../../../src/services/input/gen2.ts"],"names":[],"mappings":";;;AAOA,uCAAkD;AAClD,2CAAoD;AAEpD,MAAa,gBAAiB,SAAQ,gCAAsB;IAClD,YAAY,CAAgC;IAC5C,gBAAgB,CAAgD;IAChE,aAAa,CAAW;IACxB,mBAAmB,CAAmD;IAE/E,YAAY,gBAAgD,EAAE,WAA2C;QACxG,KAAK,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAA;QAEpC,IAAI,CAAC,YAAY,GAAG,WAAW,CAAA;QAC/B,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CACvD,CAAC,OAAO,EAAiD,EAAE,CA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AY,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;IACtC,CAAC;CACD;AAzGD,4CAyGC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/input/interface.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/input/interface.d.ts new file mode 100644 index 0000000..34ab0f6 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/input/interface.d.ts @@ -0,0 +1,4 @@ +export interface StreamDeckInputService { + handleInput(data: Uint8Array): void; +} +//# sourceMappingURL=interface.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/input/interface.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/input/interface.d.ts.map new file mode 100644 index 0000000..afe6614 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/input/interface.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/services/input/interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACtC,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAA;CACnC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/input/interface.js b/node_modules/@elgato-stream-deck/core/dist/services/input/interface.js new file mode 100644 index 0000000..d549d1f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/input/interface.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=interface.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/input/interface.js.map b/node_modules/@elgato-stream-deck/core/dist/services/input/interface.js.map new file mode 100644 index 0000000..8eeb8ae --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/input/interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../src/services/input/interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/generic.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/generic.d.ts new file mode 100644 index 0000000..81cea16 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/generic.d.ts @@ -0,0 +1,18 @@ +import type { StreamDeckLcdSegmentControlDefinition } from '../../controlDefinition.js'; +import type { HIDDevice } from '../../hid-device.js'; +import type { LcdSegmentDisplayService } from './interface.js'; +import type { FillImageOptions, FillLcdImageOptions } from '../../types.js'; +import type { EncodeJPEGHelper } from '../../models/base.js'; +import { type PreparedBuffer } from '../../preparedBuffer.js'; +export declare class StreamdeckDefaultLcdService implements LcdSegmentDisplayService { + #private; + constructor(encodeJPEG: EncodeJPEGHelper, device: HIDDevice, lcdControls: Readonly); + fillLcd(index: number, buffer: Uint8Array | Uint8ClampedArray, sourceOptions: FillImageOptions): Promise; + fillLcdRegion(index: number, x: number, y: number, imageBuffer: Uint8Array, sourceOptions: FillLcdImageOptions): Promise; + prepareFillLcdRegion(index: number, x: number, y: number, imageBuffer: Uint8Array, sourceOptions: FillLcdImageOptions, jsonSafe?: boolean): Promise; + clearLcdSegment(index: number): Promise; + clearAllLcdSegments(): Promise; + private prepareFillControlRegion; + private convertFillLcdBuffer; +} +//# sourceMappingURL=generic.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/generic.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/generic.d.ts.map new file mode 100644 index 0000000..9f4a23a --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/generic.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"generic.d.ts","sourceRoot":"","sources":["../../../src/services/lcdSegmentDisplay/generic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAA;AACvF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAIpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAE3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAA8B,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAGzF,qBAAa,2BAA4B,YAAW,wBAAwB;;gBAQ1E,UAAU,EAAE,gBAAgB,EAC5B,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,QAAQ,CAAC,qCAAqC,EAAE,CAAC;IAOlD,OAAO,CACnB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,UAAU,GAAG,iBAAiB,EACtC,aAAa,EAAE,gBAAgB,GAC7B,OAAO,CAAC,IAAI,CAAC;IAYH,aAAa,CACzB,KAAK,EAAE,MAAM,EACb,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,UAAU,EACvB,aAAa,EAAE,mBAAmB,GAChC,OAAO,CAAC,IAAI,CAAC;IAQH,oBAAoB,CAChC,KAAK,EAAE,MAAM,EACb,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,UAAU,EACvB,aAAa,EAAE,mBAAmB,EAClC,QAAQ,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,cAAc,CAAC;IAQb,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc7C,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;YASnC,wBAAwB;YA2BxB,oBAAoB;CAqBlC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/generic.js b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/generic.js new file mode 100644 index 0000000..0c6cad4 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/generic.js @@ -0,0 +1,91 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamdeckDefaultLcdService = void 0; +const headerGenerator_js_1 = require("../imageWriter/headerGenerator.js"); +const imageWriter_js_1 = require("../imageWriter/imageWriter.js"); +const util_js_1 = require("../../util.js"); +const preparedBuffer_js_1 = require("../../preparedBuffer.js"); +const id_js_1 = require("../../id.js"); +class StreamdeckDefaultLcdService { + #encodeJPEG; + #device; + #lcdControls; + #lcdImageWriter = new imageWriter_js_1.StreamdeckDefaultImageWriter(new headerGenerator_js_1.StreamdeckDefaultLcdImageHeaderGenerator()); + constructor(encodeJPEG, device, lcdControls) { + this.#encodeJPEG = encodeJPEG; + this.#device = device; + this.#lcdControls = lcdControls; + } + async fillLcd(index, buffer, sourceOptions) { + const lcdControl = this.#lcdControls.find((control) => control.id === index); + if (!lcdControl) + throw new Error(`Invalid lcd segment index ${index}`); + const packets = await this.prepareFillControlRegion(lcdControl, 0, 0, buffer, { + format: sourceOptions.format, + width: lcdControl.pixelSize.width, + height: lcdControl.pixelSize.height, + }); + await this.#device.sendReports(packets); + } + async fillLcdRegion(index, x, y, imageBuffer, sourceOptions) { + const lcdControl = this.#lcdControls.find((control) => control.id === index); + if (!lcdControl) + throw new Error(`Invalid lcd segment index ${index}`); + const packets = await this.prepareFillControlRegion(lcdControl, x, y, imageBuffer, sourceOptions); + await this.#device.sendReports(packets); + } + async prepareFillLcdRegion(index, x, y, imageBuffer, sourceOptions, jsonSafe) { + const lcdControl = this.#lcdControls.find((control) => control.id === index); + if (!lcdControl) + throw new Error(`Invalid lcd segment index ${index}`); + const packets = await this.prepareFillControlRegion(lcdControl, x, y, imageBuffer, sourceOptions); + return (0, preparedBuffer_js_1.wrapBufferToPreparedBuffer)(id_js_1.DeviceModelId.PLUS, 'fill-lcd-region', packets, jsonSafe ?? false); + } + async clearLcdSegment(index) { + const lcdControl = this.#lcdControls.find((control) => control.id === index); + if (!lcdControl) + throw new Error(`Invalid lcd segment index ${index}`); + const buffer = new Uint8Array(lcdControl.pixelSize.width * lcdControl.pixelSize.height * 4); + const packets = await this.prepareFillControlRegion(lcdControl, 0, 0, buffer, { + format: 'rgba', + width: lcdControl.pixelSize.width, + height: lcdControl.pixelSize.height, + }); + await this.#device.sendReports(packets); + } + async clearAllLcdSegments() { + const ps = []; + for (const control of this.#lcdControls) { + ps.push(this.clearLcdSegment(control.id)); + } + await Promise.all(ps); + } + async prepareFillControlRegion(lcdControl, x, y, imageBuffer, sourceOptions) { + // Basic bounds checking + const maxSize = lcdControl.pixelSize; + if (x < 0 || x + sourceOptions.width > maxSize.width) { + throw new TypeError(`Image will not fit within the lcd segment`); + } + if (y < 0 || y + sourceOptions.height > maxSize.height) { + throw new TypeError(`Image will not fit within the lcd segment`); + } + const imageSize = sourceOptions.width * sourceOptions.height * sourceOptions.format.length; + if (imageBuffer.length !== imageSize) { + throw new RangeError(`Expected image buffer of length ${imageSize}, got length ${imageBuffer.length}`); + } + // A lot of this drawing code is heavily based on the normal button + const byteBuffer = await this.convertFillLcdBuffer(imageBuffer, sourceOptions); + return this.#lcdImageWriter.generateFillImageWrites({ ...sourceOptions, x, y }, byteBuffer); + } + async convertFillLcdBuffer(sourceBuffer, sourceOptions) { + const sourceOptions2 = { + format: sourceOptions.format, + offset: 0, + stride: sourceOptions.width * sourceOptions.format.length, + }; + const byteBuffer = (0, util_js_1.transformImageBuffer)(sourceBuffer, sourceOptions2, { colorMode: 'rgba' }, 0, sourceOptions.width, sourceOptions.height); + return this.#encodeJPEG(byteBuffer, sourceOptions.width, sourceOptions.height); + } +} +exports.StreamdeckDefaultLcdService = StreamdeckDefaultLcdService; +//# sourceMappingURL=generic.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/generic.js.map b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/generic.js.map new file mode 100644 index 0000000..07c7587 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/generic.js.map @@ -0,0 +1 @@ +{"version":3,"file":"generic.js","sourceRoot":"","sources":["../../../src/services/lcdSegmentDisplay/generic.ts"],"names":[],"mappings":";;;AAGA,0EAA4F;AAC5F,kEAA4E;AAG5E,2CAAoD;AAEpD,+DAAyF;AACzF,uCAA2C;AAE3C,MAAa,2BAA2B;IAC9B,WAAW,CAAkB;IAC7B,OAAO,CAAW;IAClB,YAAY,CAAmD;IAE/D,eAAe,GAAG,IAAI,6CAA4B,CAAC,IAAI,6DAAwC,EAAE,CAAC,CAAA;IAE3G,YACC,UAA4B,EAC5B,MAAiB,EACjB,WAA8D;QAE9D,IAAI,CAAC,WAAW,GAAG,UAAU,CAAA;QAC7B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QACrB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAA;IAChC,CAAC;IAEM,KAAK,CAAC,OAAO,CACnB,KAAa,EACb,MAAsC,EACtC,aAA+B;QAE/B,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,KAAK,CAAC,CAAA;QAC5E,IAAI,CAAC,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,KAAK,EAAE,CAAC,CAAA;QAEtE,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE;YAC7E,MAAM,EAAE,aAAa,CAAC,MAAM;YAC5B,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,KAAK;YACjC,MAAM,EAAE,UAAU,CAAC,SAAS,CAAC,MAAM;SACnC,CAAC,CAAA;QACF,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;IACxC,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,KAAa,EACb,CAAS,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AAI,SAAS,CAAC,2CAA2C,CAAC,CAAA;QACjE,CAAC;QAED,MAAM,SAAS,GAAG,aAAa,CAAC,KAAK,GAAG,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,MAAM,CAAA;QAC1F,IAAI,WAAW,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YACtC,MAAM,IAAI,UAAU,CAAC,mCAAmC,SAAS,gBAAgB,WAAW,CAAC,MAAM,EAAE,CAAC,CAAA;QACvG,CAAC;QAED,mEAAmE;QACnE,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAA;QAE9E,OAAO,IAAI,CAAC,eAAe,CAAC,uBAAuB,CAAC,EAAE,GAAG,aAAa,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,UAAU,CAAC,CAAA;IAC5F,CAAC;IAEO,KAAK,CAAC,oBAAoB,CACjC,YAA4C,EAC5C,aAAkC;QAElC,MAAM,cAAc,GAA6B;YAChD,MAAM,EAAE,aAAa,CAAC,MAAM;YAC5B,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,aAAa,CAAC,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC,MAAM;SACzD,CAAA;QAED,MAAM,UAAU,GAAG,IAAA,8BAAoB,EACtC,YAAY,EACZ,cAAc,EACd,EAAE,SAAS,EAAE,MAAM,EAAE,EACrB,CAAC,EACD,aAAa,CAAC,KAAK,EACnB,aAAa,CAAC,MAAM,CACpB,CAAA;QAED,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC/E,CAAC;CACD;AArID,kEAqIC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/interface.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/interface.d.ts new file mode 100644 index 0000000..8a17eb4 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/interface.d.ts @@ -0,0 +1,41 @@ +import type { PreparedBuffer } from '../../preparedBuffer.js'; +import type { FillImageOptions, FillLcdImageOptions } from '../../types.js'; +export interface LcdSegmentDisplayService { + /** + * Fill the whole lcd segment + * @param {number} lcdIndex The id of the lcd segment to draw to + * @param {Buffer} imageBuffer The image to write + * @param {Object} sourceOptions Options to control the write + */ + fillLcd(lcdIndex: number, imageBuffer: Uint8Array | Uint8ClampedArray, sourceOptions: FillImageOptions): Promise; + /** + * Fill a region of the lcd segment, ignoring the boundaries of the encoders + * @param {number} lcdIndex The id of the lcd segment to draw to + * @param {number} x The x position to draw to + * @param {number} y The y position to draw to + * @param {Buffer} imageBuffer The image to write + * @param {Object} sourceOptions Options to control the write + */ + fillLcdRegion(lcdIndex: number, x: number, y: number, imageBuffer: Uint8Array | Uint8ClampedArray, sourceOptions: FillLcdImageOptions): Promise; + /** + * Prepare to fill region of the lcd with an image in a Buffer. + * Note: The result is only guaranteed to be valid for this specific StreamDeck and the same library version, but is safe to store externally. + * + * @param {number} lcdIndex The id of the lcd segment to draw to + * @param {number} x The x position to draw to + * @param {number} y The y position to draw to + * @param {Buffer} imageBuffer The image to write + * @param {Object} sourceOptions Options to control the write + */ + prepareFillLcdRegion(lcdIndex: number, x: number, y: number, imageBuffer: Uint8Array, sourceOptions: FillLcdImageOptions, jsonSafe?: boolean): Promise; + /** + * Clear the lcd segment to black + * @param {number} lcdIndex The id of the lcd segment to clear + */ + clearLcdSegment(lcdIndex: number): Promise; + /** + * Clear all lcd segment to black + */ + clearAllLcdSegments(): Promise; +} +//# sourceMappingURL=interface.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/interface.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/interface.d.ts.map new file mode 100644 index 0000000..5482e87 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/interface.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/services/lcdSegmentDisplay/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAE3E,MAAM,WAAW,wBAAwB;IACxC;;;;;OAKG;IACH,OAAO,CACN,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,UAAU,GAAG,iBAAiB,EAC3C,aAAa,EAAE,gBAAgB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAAA;IAEhB;;;;;;;OAOG;IACH,aAAa,CACZ,QAAQ,EAAE,MAAM,EAChB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,UAAU,GAAG,iBAAiB,EAC3C,aAAa,EAAE,mBAAmB,GAChC,OAAO,CAAC,IAAI,CAAC,CAAA;IAEhB;;;;;;;;;OASG;IACH,oBAAoB,CACnB,QAAQ,EAAE,MAAM,EAChB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,UAAU,EACvB,aAAa,EAAE,mBAAmB,EAClC,QAAQ,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,cAAc,CAAC,CAAA;IAE1B;;;OAGG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEhD;;OAEG;IACH,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACpC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/interface.js b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/interface.js new file mode 100644 index 0000000..d549d1f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/interface.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=interface.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/interface.js.map b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/interface.js.map new file mode 100644 index 0000000..b16f21f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../src/services/lcdSegmentDisplay/interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/neo.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/neo.d.ts new file mode 100644 index 0000000..045b926 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/neo.d.ts @@ -0,0 +1,17 @@ +import type { StreamDeckLcdSegmentControlDefinition } from '../../controlDefinition.js'; +import type { HIDDevice } from '../../hid-device.js'; +import type { LcdSegmentDisplayService } from './interface.js'; +import type { FillLcdImageOptions, FillImageOptions } from '../../types.js'; +import type { EncodeJPEGHelper } from '../../models/base.js'; +import type { PreparedBuffer } from '../../preparedBuffer.js'; +export declare class StreamDeckNeoLcdService implements LcdSegmentDisplayService { + #private; + constructor(encodeJPEG: EncodeJPEGHelper, device: HIDDevice, lcdControls: Readonly); + fillLcdRegion(_index: number, _x: number, _y: number, _imageBuffer: Uint8Array, _sourceOptions: FillLcdImageOptions): Promise; + prepareFillLcdRegion(_index: number, _x: number, _y: number, _imageBuffer: Uint8Array, _sourceOptions: FillLcdImageOptions, _jsonSafe?: boolean): Promise; + fillLcd(index: number, imageBuffer: Uint8Array, sourceOptions: FillImageOptions): Promise; + clearLcdSegment(index: number): Promise; + clearAllLcdSegments(): Promise; + private convertFillLcdBuffer; +} +//# sourceMappingURL=neo.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/neo.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/neo.d.ts.map new file mode 100644 index 0000000..04be7ed --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/neo.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"neo.d.ts","sourceRoot":"","sources":["../../../src/services/lcdSegmentDisplay/neo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAA;AACvF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAKpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAE3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE7D,qBAAa,uBAAwB,YAAW,wBAAwB;;gBAQtE,UAAU,EAAE,gBAAgB,EAC5B,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,QAAQ,CAAC,qCAAqC,EAAE,CAAC;IAOzD,aAAa,CAClB,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,YAAY,EAAE,UAAU,EACxB,cAAc,EAAE,mBAAmB,GACjC,OAAO,CAAC,IAAI,CAAC;IAIH,oBAAoB,CAChC,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,YAAY,EAAE,UAAU,EACxB,cAAc,EAAE,mBAAmB,EACnC,SAAS,CAAC,EAAE,OAAO,GACjB,OAAO,CAAC,cAAc,CAAC;IAIb,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB/F,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW7C,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;YASnC,oBAAoB;CAsBlC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/neo.js b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/neo.js new file mode 100644 index 0000000..4bed477 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/neo.js @@ -0,0 +1,63 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamDeckNeoLcdService = void 0; +const headerGenerator_js_1 = require("../imageWriter/headerGenerator.js"); +const imageWriter_js_1 = require("../imageWriter/imageWriter.js"); +const util_js_1 = require("../../util.js"); +class StreamDeckNeoLcdService { + #encodeJPEG; + #device; + #lcdControls; + #lcdImageWriter = new imageWriter_js_1.StreamdeckDefaultImageWriter(new headerGenerator_js_1.StreamdeckNeoLcdImageHeaderGenerator()); + constructor(encodeJPEG, device, lcdControls) { + this.#encodeJPEG = encodeJPEG; + this.#device = device; + this.#lcdControls = lcdControls; + } + async fillLcdRegion(_index, _x, _y, _imageBuffer, _sourceOptions) { + throw new Error('Not supported for this model'); + } + async prepareFillLcdRegion(_index, _x, _y, _imageBuffer, _sourceOptions, _jsonSafe) { + throw new Error('Not supported for this model'); + } + async fillLcd(index, imageBuffer, sourceOptions) { + const lcdControl = this.#lcdControls.find((control) => control.id === index); + if (!lcdControl) + throw new Error(`Invalid lcd segment index ${index}`); + const imageSize = lcdControl.pixelSize.width * lcdControl.pixelSize.height * sourceOptions.format.length; + if (imageBuffer.length !== imageSize) { + throw new RangeError(`Expected image buffer of length ${imageSize}, got length ${imageBuffer.length}`); + } + // A lot of this drawing code is heavily based on the normal button + const byteBuffer = await this.convertFillLcdBuffer(imageBuffer, lcdControl.pixelSize, sourceOptions); + const packets = this.#lcdImageWriter.generateFillImageWrites(null, byteBuffer); + await this.#device.sendReports(packets); + } + async clearLcdSegment(index) { + const lcdControl = this.#lcdControls.find((control) => control.id === index); + if (!lcdControl) + throw new Error(`Invalid lcd segment index ${index}`); + const buffer = new Uint8Array(lcdControl.pixelSize.width * lcdControl.pixelSize.height * 4); + await this.fillLcd(index, buffer, { + format: 'rgba', + }); + } + async clearAllLcdSegments() { + const ps = []; + for (const control of this.#lcdControls) { + ps.push(this.clearLcdSegment(control.id)); + } + await Promise.all(ps); + } + async convertFillLcdBuffer(sourceBuffer, size, sourceOptions) { + const sourceOptions2 = { + format: sourceOptions.format, + offset: 0, + stride: size.width * sourceOptions.format.length, + }; + const byteBuffer = (0, util_js_1.transformImageBuffer)(sourceBuffer, sourceOptions2, { colorMode: 'rgba', xFlip: true, yFlip: true }, 0, size.width, size.height); + return this.#encodeJPEG(byteBuffer, size.width, size.height); + } +} +exports.StreamDeckNeoLcdService = StreamDeckNeoLcdService; +//# sourceMappingURL=neo.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/neo.js.map b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/neo.js.map new file mode 100644 index 0000000..6c22db6 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/lcdSegmentDisplay/neo.js.map @@ -0,0 +1 @@ +{"version":3,"file":"neo.js","sourceRoot":"","sources":["../../../src/services/lcdSegmentDisplay/neo.ts"],"names":[],"mappings":";;;AAIA,0EAAwF;AACxF,kEAA4E;AAG5E,2CAAoD;AAIpD,MAAa,uBAAuB;IAC1B,WAAW,CAAkB;IAC7B,OAAO,CAAW;IAClB,YAAY,CAAmD;IAE/D,eAAe,GAAG,IAAI,6CAA4B,CAAO,IAAI,yDAAoC,EAAE,CAAC,CAAA;IAE7G,YACC,UAA4B,EAC5B,MAAiB,EACjB,WAA8D;QAE9D,IAAI,CAAC,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AAI,EAAE,EAC/C,CAAC,EACD,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,MAAM,CACX,CAAA;QAED,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IAC7D,CAAC;CACD;AAhGD,0DAgGC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/all-firmware.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/properties/all-firmware.d.ts new file mode 100644 index 0000000..2f46836 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/all-firmware.d.ts @@ -0,0 +1,6 @@ +export declare function parseAllFirmwareVersionsHelper(reportData: { + ap2: Uint8Array | null; + encoderAp2: Uint8Array | null; + encoderLd: Uint8Array | null; +}): Promise>; +//# sourceMappingURL=all-firmware.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/all-firmware.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/properties/all-firmware.d.ts.map new file mode 100644 index 0000000..0770633 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/all-firmware.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"all-firmware.d.ts","sourceRoot":"","sources":["../../../src/services/properties/all-firmware.ts"],"names":[],"mappings":"AAEA,wBAAsB,8BAA8B,CAAC,UAAU,EAAE;IAEhE,GAAG,EAAE,UAAU,GAAG,IAAI,CAAA;IACtB,UAAU,EAAE,UAAU,GAAG,IAAI,CAAA;IAC7B,SAAS,EAAE,UAAU,GAAG,IAAI,CAAA;CAC5B,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA0BlC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/all-firmware.js b/node_modules/@elgato-stream-deck/core/dist/services/properties/all-firmware.js new file mode 100644 index 0000000..1e61465 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/all-firmware.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseAllFirmwareVersionsHelper = parseAllFirmwareVersionsHelper; +const util_js_1 = require("../../util.js"); +async function parseAllFirmwareVersionsHelper(reportData) { + const decoder = new TextDecoder('ascii'); + const versions = {}; + if (reportData.ap2) { + const ap2DataDataView = (0, util_js_1.uint8ArrayToDataView)(reportData.ap2); + versions.AP2 = decoder.decode(reportData.ap2.subarray(6, 6 + 8)); + versions.AP2_CHECKSUM = ap2DataDataView.getUint32(2, false).toString(16); + } + if (reportData.encoderLd && (reportData.encoderLd[0] === 0x18 || reportData.encoderLd[1] === 0x18)) { + const encoderLdDataView = (0, util_js_1.uint8ArrayToDataView)(reportData.encoderLd); + // Sample just the first encoder, they should all be the same + versions.ENCODER_LD = decoder.decode(reportData.encoderLd.subarray(2, 2 + 8)); + versions.ENCODER_LD_CHECKSUM = encoderLdDataView.getUint32(10, false).toString(16); + } + if (reportData.encoderAp2 && (reportData.encoderAp2[0] === 0x18 || reportData.encoderAp2[1] === 0x18)) { + const encoderAp2DataView = (0, util_js_1.uint8ArrayToDataView)(reportData.encoderAp2); + // Sample just the first encoder, they should all be the same + versions.ENCODER_AP2 = decoder.decode(reportData.encoderAp2.subarray(2, 2 + 8)); + versions.ENCODER_AP2_CHECKSUM = encoderAp2DataView.getUint32(10, false).toString(16); + } + return versions; +} +//# sourceMappingURL=all-firmware.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/all-firmware.js.map b/node_modules/@elgato-stream-deck/core/dist/services/properties/all-firmware.js.map new file mode 100644 index 0000000..33c7c9f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/all-firmware.js.map @@ -0,0 +1 @@ +{"version":3,"file":"all-firmware.js","sourceRoot":"","sources":["../../../src/services/properties/all-firmware.ts"],"names":[],"mappings":";;AAEA,wEA+BC;AAjCD,2CAAoD;AAE7C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GAAG,IAAA,8BAAoB,EAAC,UAAU,CAAC,UAAU,CAAC,CAAA;QACtE,6DAA6D;QAC7D,QAAQ,CAAC,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QAC/E,QAAQ,CAAC,oBAAoB,GAAG,kBAAkB,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IACrF,CAAC;IAED,OAAO,QAAQ,CAAA;AAChB,CAAC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/gen1.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/properties/gen1.d.ts new file mode 100644 index 0000000..f4aa97e --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/gen1.d.ts @@ -0,0 +1,12 @@ +import type { HIDDevice } from '../../hid-device.js'; +import type { PropertiesService } from './interface.js'; +export declare class Gen1PropertiesService implements PropertiesService { + #private; + constructor(device: HIDDevice); + setBrightness(percentage: number): Promise; + resetToLogo(): Promise; + getFirmwareVersion(): Promise; + getAllFirmwareVersions(): Promise>; + getSerialNumber(): Promise; +} +//# sourceMappingURL=gen1.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/gen1.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/properties/gen1.d.ts.map new file mode 100644 index 0000000..25b0a50 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/gen1.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"gen1.d.ts","sourceRoot":"","sources":["../../../src/services/properties/gen1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,qBAAa,qBAAsB,YAAW,iBAAiB;;gBAGlD,MAAM,EAAE,SAAS;IAIhB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAchD,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAU5B,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAYrC,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAKzD,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;CAU/C"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/gen1.js b/node_modules/@elgato-stream-deck/core/dist/services/properties/gen1.js new file mode 100644 index 0000000..040aecb --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/gen1.js @@ -0,0 +1,59 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Gen1PropertiesService = void 0; +class Gen1PropertiesService { + #device; + constructor(device) { + this.#device = device; + } + async setBrightness(percentage) { + if (percentage < 0 || percentage > 100) { + throw new RangeError('Expected brightness percentage to be between 0 and 100'); + } + // prettier-ignore + const brightnessCommandBuffer = new Uint8Array([ + 0x05, + 0x55, 0xaa, 0xd1, 0x01, percentage, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]); + await this.#device.sendFeatureReport(brightnessCommandBuffer); + } + async resetToLogo() { + // prettier-ignore + const resetCommandBuffer = new Uint8Array([ + 0x0b, + 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]); + await this.#device.sendFeatureReport(resetCommandBuffer); + } + async getFirmwareVersion() { + let val; + try { + val = await this.#device.getFeatureReport(4, 32); + } + catch (_e) { + // In case some devices can't handle the different report length + val = await this.#device.getFeatureReport(4, 17); + } + const end = val.indexOf(0, 5); + return new TextDecoder('ascii').decode(val.subarray(5, end === -1 ? undefined : end)); + } + async getAllFirmwareVersions() { + // Not supported for gen1 models + return {}; + } + async getSerialNumber() { + let val; + try { + val = await this.#device.getFeatureReport(3, 32); + } + catch (_e) { + // In case some devices can't handle the different report length + val = await this.#device.getFeatureReport(3, 17); + } + return new TextDecoder('ascii').decode(val.subarray(5, 17)); + } +} +exports.Gen1PropertiesService = Gen1PropertiesService; +//# sourceMappingURL=gen1.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/gen1.js.map b/node_modules/@elgato-stream-deck/core/dist/services/properties/gen1.js.map new file mode 100644 index 0000000..4bfbb33 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/gen1.js.map @@ -0,0 +1 @@ +{"version":3,"file":"gen1.js","sourceRoot":"","sources":["../../../src/services/properties/gen1.ts"],"names":[],"mappings":";;;AAGA,MAAa,qBAAqB;IACxB,OAAO,CAAW;IAE3B,YAAY,MAAiB;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACtB,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,UAAkB;QAC5C,IAAI,UAAU,GAAG,CAAC,IAAI,UAAU,GAAG,GAAG,EAAE,CAAC;YACxC,MAAM,IAAI,UAAU,CAAC,wDAAwD,CAAC,CAAA;QAC/E,CAAC;QAED,kBAAkB;QAClB,MAAM,uBAAuB,GAAG,IAAI,UAAU,CAAC;YAC9C,IAAI;YACJ,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;YACpD,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;SAC9C,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,uBAAuB,CAAC,CAAA;IAC9D,CAAC;IAEM,KAAK,CAAC,WAAW;QACvB,kBAAkB;QAClB,MAAM,kBAAk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AAG,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QACjD,CAAC;QACD,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;IAC5D,CAAC;CACD;AA1DD,sDA0DC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/gen2.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/properties/gen2.d.ts new file mode 100644 index 0000000..94b86cc --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/gen2.d.ts @@ -0,0 +1,12 @@ +import type { HIDDevice } from '../../hid-device.js'; +import type { PropertiesService } from './interface.js'; +export declare class Gen2PropertiesService implements PropertiesService { + protected readonly device: HIDDevice; + constructor(device: HIDDevice); + setBrightness(percentage: number): Promise; + resetToLogo(): Promise; + getFirmwareVersion(): Promise; + getAllFirmwareVersions(): Promise>; + getSerialNumber(): Promise; +} +//# sourceMappingURL=gen2.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/gen2.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/properties/gen2.d.ts.map new file mode 100644 index 0000000..3cf4682 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/gen2.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"gen2.d.ts","sourceRoot":"","sources":["../../../src/services/properties/gen2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,qBAAa,qBAAsB,YAAW,iBAAiB;IAC9D,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;gBAExB,MAAM,EAAE,SAAS;IAIhB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBhD,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAY5B,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAMrC,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAOzD,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;CAK/C"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/gen2.js b/node_modules/@elgato-stream-deck/core/dist/services/properties/gen2.js new file mode 100644 index 0000000..10098f2 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/gen2.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Gen2PropertiesService = void 0; +class Gen2PropertiesService { + device; + constructor(device) { + this.device = device; + } + async setBrightness(percentage) { + if (percentage < 0 || percentage > 100) { + throw new RangeError('Expected brightness percentage to be between 0 and 100'); + } + // prettier-ignore + const brightnessCommandBuffer = new Uint8Array([ + 0x03, + 0x08, percentage, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]); + await this.device.sendFeatureReport(brightnessCommandBuffer); + } + async resetToLogo() { + // prettier-ignore + const resetCommandBuffer = new Uint8Array([ + 0x03, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]); + await this.device.sendFeatureReport(resetCommandBuffer); + } + async getFirmwareVersion() { + const val = await this.device.getFeatureReport(5, 32); + const end = val[1] + 2; + return new TextDecoder('ascii').decode(val.subarray(6, end)); + } + async getAllFirmwareVersions() { + return { + AP2: await this.getFirmwareVersion(), + // TODO AP2_CHECKSUM - uint32be after length + }; + } + async getSerialNumber() { + const val = await this.device.getFeatureReport(6, 32); + const end = val[1] + 2; + return new TextDecoder('ascii').decode(val.subarray(2, end)); + } +} +exports.Gen2PropertiesService = Gen2PropertiesService; +//# sourceMappingURL=gen2.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/gen2.js.map b/node_modules/@elgato-stream-deck/core/dist/services/properties/gen2.js.map new file mode 100644 index 0000000..769b8c6 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/gen2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"gen2.js","sourceRoot":"","sources":["../../../src/services/properties/gen2.ts"],"names":[],"mappings":";;;AAGA,MAAa,qBAAqB;IACd,MAAM,CAAW;IAEpC,YAAY,MAAiB;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACrB,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,UAAkB;QAC5C,IAAI,UAAU,GAAG,CAAC,IAAI,UAAU,GAAG,GAAG,EAAE,CAAC;YACxC,MAAM,IAAI,UAAU,CAAC,wDAAwD,CAAC,CAAA;QAC/E,CAAC;QAED,kBAAkB;QAClB,MAAM,uBAAuB,GAAG,IAAI,UAAU,CAAC;YAC9C,IAAI;YACJ,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;YACpD,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;YAC9C,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;YAC9C,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EA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,CAAC,gBAAgB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QACrD,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QACtB,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;IAC7D,CAAC;CACD;AArDD,sDAqDC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/interface.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/properties/interface.d.ts new file mode 100644 index 0000000..9a20cfa --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/interface.d.ts @@ -0,0 +1,8 @@ +export interface PropertiesService { + setBrightness(percentage: number): Promise; + resetToLogo(): Promise; + getFirmwareVersion(): Promise; + getAllFirmwareVersions(): Promise>; + getSerialNumber(): Promise; +} +//# sourceMappingURL=interface.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/interface.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/properties/interface.d.ts.map new file mode 100644 index 0000000..4b31ffb --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/interface.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/services/properties/interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IACjC,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEhD,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAE5B,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;IAErC,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAEzD,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;CAClC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/interface.js b/node_modules/@elgato-stream-deck/core/dist/services/properties/interface.js new file mode 100644 index 0000000..d549d1f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/interface.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=interface.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/interface.js.map b/node_modules/@elgato-stream-deck/core/dist/services/properties/interface.js.map new file mode 100644 index 0000000..4474ce7 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../src/services/properties/interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/network-dock.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/properties/network-dock.d.ts new file mode 100644 index 0000000..e9ca9f1 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/network-dock.d.ts @@ -0,0 +1,12 @@ +import type { HIDDevice } from '../../hid-device.js'; +import type { PropertiesService } from './interface.js'; +export declare class NetworkDockPropertiesService implements PropertiesService { + #private; + constructor(device: HIDDevice); + setBrightness(_percentage: number): Promise; + resetToLogo(): Promise; + getFirmwareVersion(): Promise; + getAllFirmwareVersions(): Promise>; + getSerialNumber(): Promise; +} +//# sourceMappingURL=network-dock.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/network-dock.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/properties/network-dock.d.ts.map new file mode 100644 index 0000000..b229f5b --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/network-dock.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"network-dock.d.ts","sourceRoot":"","sources":["../../../src/services/properties/network-dock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,qBAAa,4BAA6B,YAAW,iBAAiB;;gBAGzD,MAAM,EAAE,SAAS;IAIhB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjD,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAMrC,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAUzD,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;CAM/C"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/network-dock.js b/node_modules/@elgato-stream-deck/core/dist/services/properties/network-dock.js new file mode 100644 index 0000000..8338b33 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/network-dock.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NetworkDockPropertiesService = void 0; +const all_firmware_js_1 = require("./all-firmware.js"); +class NetworkDockPropertiesService { + #device; + constructor(device) { + this.#device = device; + } + async setBrightness(_percentage) { + // Noop + } + async resetToLogo() { + // Noop + } + async getFirmwareVersion() { + const data = await this.#device.getFeatureReport(0x83, -1); + return new TextDecoder('ascii').decode(data.subarray(8, 16)); + } + async getAllFirmwareVersions() { + const [ap2Data] = await Promise.all([this.#device.getFeatureReport(0x83, -1)]); + return (0, all_firmware_js_1.parseAllFirmwareVersionsHelper)({ + ap2: ap2Data.slice(2), + encoderAp2: null, + encoderLd: null, + }); + } + async getSerialNumber() { + const data = await this.#device.getFeatureReport(0x84, -1); + const length = data[3]; + return new TextDecoder('ascii').decode(data.subarray(4, 4 + length)); + } +} +exports.NetworkDockPropertiesService = NetworkDockPropertiesService; +//# sourceMappingURL=network-dock.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/network-dock.js.map b/node_modules/@elgato-stream-deck/core/dist/services/properties/network-dock.js.map new file mode 100644 index 0000000..af81c0a --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/network-dock.js.map @@ -0,0 +1 @@ +{"version":3,"file":"network-dock.js","sourceRoot":"","sources":["../../../src/services/properties/network-dock.ts"],"names":[],"mappings":";;;AACA,uDAAkE;AAGlE,MAAa,4BAA4B;IAC/B,OAAO,CAAW;IAE3B,YAAY,MAAiB;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACtB,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,WAAmB;QAC7C,OAAO;IACR,CAAC;IAEM,KAAK,CAAC,WAAW;QACvB,OAAO;IACR,CAAC;IAEM,KAAK,CAAC,kBAAkB;QAC9B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;QAE1D,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;IAC7D,CAAC;IAEM,KAAK,CAAC,sBAAsB;QAClC,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAE9E,OAAO,IAAA,gDAA8B,EAAC;YACrC,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;YACrB,UAAU,EAAE,IAAI;YAChB,SAAS,EAAE,IAAI;SACf,CAAC,CAAA;IACH,CAAC;IAEM,KAAK,CAAC,eAAe;QAC3B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;QAE1D,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACtB,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAA;IACrE,CAAC;CACD;AArCD,oEAqCC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/pedal.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/properties/pedal.d.ts new file mode 100644 index 0000000..c88683b --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/pedal.d.ts @@ -0,0 +1,12 @@ +import type { HIDDevice } from '../../hid-device.js'; +import type { PropertiesService } from './interface.js'; +export declare class PedalPropertiesService implements PropertiesService { + #private; + constructor(device: HIDDevice); + setBrightness(_percentage: number): Promise; + resetToLogo(): Promise; + getFirmwareVersion(): Promise; + getAllFirmwareVersions(): Promise>; + getSerialNumber(): Promise; +} +//# sourceMappingURL=pedal.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/pedal.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/properties/pedal.d.ts.map new file mode 100644 index 0000000..4b6242f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/pedal.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pedal.d.ts","sourceRoot":"","sources":["../../../src/services/properties/pedal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,qBAAa,sBAAuB,YAAW,iBAAiB;;gBAGnD,MAAM,EAAE,SAAS;IAIhB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjD,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAMrC,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAMzD,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;CAI/C"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/pedal.js b/node_modules/@elgato-stream-deck/core/dist/services/properties/pedal.js new file mode 100644 index 0000000..f3db41f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/pedal.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PedalPropertiesService = void 0; +class PedalPropertiesService { + #device; + constructor(device) { + this.#device = device; + } + async setBrightness(_percentage) { + // Not supported + } + async resetToLogo() { + // Not supported + } + async getFirmwareVersion() { + const val = await this.#device.getFeatureReport(5, 32); + const end = val.indexOf(0, 6); + return new TextDecoder('ascii').decode(val.subarray(6, end === -1 ? undefined : end)); + } + async getAllFirmwareVersions() { + return { + AP2: await this.getFirmwareVersion(), + }; + } + async getSerialNumber() { + const val = await this.#device.getFeatureReport(6, 32); + return new TextDecoder('ascii').decode(val.subarray(2, 14)); + } +} +exports.PedalPropertiesService = PedalPropertiesService; +//# sourceMappingURL=pedal.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/pedal.js.map b/node_modules/@elgato-stream-deck/core/dist/services/properties/pedal.js.map new file mode 100644 index 0000000..7b56c7a --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/pedal.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pedal.js","sourceRoot":"","sources":["../../../src/services/properties/pedal.ts"],"names":[],"mappings":";;;AAGA,MAAa,sBAAsB;IACzB,OAAO,CAAW;IAE3B,YAAY,MAAiB;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACtB,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,WAAmB;QAC7C,gBAAgB;IACjB,CAAC;IAEM,KAAK,CAAC,WAAW;QACvB,gBAAgB;IACjB,CAAC;IAEM,KAAK,CAAC,kBAAkB;QAC9B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QACtD,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QAC7B,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IACtF,CAAC;IAEM,KAAK,CAAC,sBAAsB;QAClC,OAAO;YACN,GAAG,EAAE,MAAM,IAAI,CAAC,kBAAkB,EAAE;SACpC,CAAA;IACF,CAAC;IAEM,KAAK,CAAC,eAAe;QAC3B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QACtD,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;IAC5D,CAAC;CACD;AA/BD,wDA+BC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/studio.d.ts b/node_modules/@elgato-stream-deck/core/dist/services/properties/studio.d.ts new file mode 100644 index 0000000..cc47f6f --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/studio.d.ts @@ -0,0 +1,5 @@ +import { Gen2PropertiesService } from './gen2.js'; +export declare class StudioPropertiesService extends Gen2PropertiesService { + getAllFirmwareVersions(): Promise>; +} +//# sourceMappingURL=studio.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/studio.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/services/properties/studio.d.ts.map new file mode 100644 index 0000000..2159a84 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/studio.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"studio.d.ts","sourceRoot":"","sources":["../../../src/services/properties/studio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,qBAAqB;IACpD,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAatE"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/studio.js b/node_modules/@elgato-stream-deck/core/dist/services/properties/studio.js new file mode 100644 index 0000000..c5bc136 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/studio.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StudioPropertiesService = void 0; +const all_firmware_js_1 = require("./all-firmware.js"); +const gen2_js_1 = require("./gen2.js"); +class StudioPropertiesService extends gen2_js_1.Gen2PropertiesService { + async getAllFirmwareVersions() { + const [ap2Data, encoderAp2Data, encoderLdData] = await Promise.all([ + this.device.getFeatureReport(0x05, 32), + this.device.getFeatureReport(0x11, 32), + this.device.getFeatureReport(0x13, 32), + ]); + return (0, all_firmware_js_1.parseAllFirmwareVersionsHelper)({ + ap2: ap2Data, + encoderAp2: encoderAp2Data, + encoderLd: encoderLdData, + }); + } +} +exports.StudioPropertiesService = StudioPropertiesService; +//# sourceMappingURL=studio.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/services/properties/studio.js.map b/node_modules/@elgato-stream-deck/core/dist/services/properties/studio.js.map new file mode 100644 index 0000000..397bd04 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/services/properties/studio.js.map @@ -0,0 +1 @@ +{"version":3,"file":"studio.js","sourceRoot":"","sources":["../../../src/services/properties/studio.ts"],"names":[],"mappings":";;;AAAA,uDAAkE;AAClE,uCAAiD;AAEjD,MAAa,uBAAwB,SAAQ,+BAAqB;IAC1D,KAAK,CAAC,sBAAsB;QAClC,MAAM,CAAC,OAAO,EAAE,cAAc,EAAE,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAClE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC;YACtC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC;YACtC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC;SACtC,CAAC,CAAA;QAEF,OAAO,IAAA,gDAA8B,EAAC;YACrC,GAAG,EAAE,OAAO;YACZ,UAAU,EAAE,cAAc;YAC1B,SAAS,EAAE,aAAa;SACxB,CAAC,CAAA;IACH,CAAC;CACD;AAdD,0DAcC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/tsconfig.build.tsbuildinfo b/node_modules/@elgato-stream-deck/core/dist/tsconfig.build.tsbuildinfo new file mode 100644 index 0000000..cddf4aa --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/tsconfig.build.tsbuildinfo @@ -0,0 +1 @@ +{"root":["../src/controlDefinition.ts","../src/controlsGenerator.ts","../src/hid-device.ts","../src/id.ts","../src/index.ts","../src/preparedBuffer.ts","../src/proxy.ts","../src/types.ts","../src/util.ts","../src/models/15-key.ts","../src/models/32-key.ts","../src/models/6-key.ts","../src/models/base.ts","../src/models/galleon-k100.ts","../src/models/generic-gen1.ts","../src/models/generic-gen2.ts","../src/models/neo.ts","../src/models/network-dock.ts","../src/models/original.ts","../src/models/pedal.ts","../src/models/plus.ts","../src/models/studio.ts","../src/services/callback-hook.ts","../src/services/buttonsLcdDisplay/default.ts","../src/services/buttonsLcdDisplay/fake.ts","../src/services/buttonsLcdDisplay/interface.ts","../src/services/encoderLed/galleonK100.ts","../src/services/encoderLed/interface.ts","../src/services/encoderLed/studio.ts","../src/services/imagePacker/bitmap.ts","../src/services/imagePacker/interface.ts","../src/services/imagePacker/jpeg.ts","../src/services/imageWriter/headerGenerator.ts","../src/services/imageWriter/imageWriter.ts","../src/services/imageWriter/types.ts","../src/services/input/fake.ts","../src/services/input/gen1.ts","../src/services/input/gen2.ts","../src/services/input/interface.ts","../src/services/lcdSegmentDisplay/generic.ts","../src/services/lcdSegmentDisplay/interface.ts","../src/services/lcdSegmentDisplay/neo.ts","../src/services/properties/all-firmware.ts","../src/services/properties/gen1.ts","../src/services/properties/gen2.ts","../src/services/properties/interface.ts","../src/services/properties/network-dock.ts","../src/services/properties/pedal.ts","../src/services/properties/studio.ts"],"version":"5.9.3"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/types.d.ts b/node_modules/@elgato-stream-deck/core/dist/types.d.ts new file mode 100644 index 0000000..50e6d73 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/types.d.ts @@ -0,0 +1,204 @@ +import type { EventEmitter } from 'eventemitter3'; +import type { DeviceModelId, Dimension, EncoderIndex, KeyIndex } from './id.js'; +import type { HIDDeviceInfo } from './hid-device.js'; +import type { StreamDeckButtonControlDefinition, StreamDeckControlDefinition, StreamDeckEncoderControlDefinition, StreamDeckLcdSegmentControlDefinition } from './controlDefinition.js'; +import type { PreparedBuffer } from './preparedBuffer.js'; +export interface StreamDeckTcpChildDeviceInfo extends HIDDeviceInfo { + readonly model: DeviceModelId; + readonly serialNumber: string; + readonly tcpPort: number; +} +export interface FillImageOptions { + format: 'rgb' | 'rgba' | 'bgr' | 'bgra'; +} +export interface FillPanelOptions extends FillImageOptions, FillPanelDimensionsOptions { +} +export interface FillPanelDimensionsOptions { + withPadding?: boolean; +} +export interface FillLcdImageOptions extends FillImageOptions { + width: number; + height: number; +} +export interface LcdPosition { + x: number; + y: number; +} +export type StreamDeckEvents = { + down: [control: StreamDeckButtonControlDefinition | StreamDeckEncoderControlDefinition]; + up: [control: StreamDeckButtonControlDefinition | StreamDeckEncoderControlDefinition]; + error: [err: unknown]; + rotate: [control: StreamDeckEncoderControlDefinition, amount: number]; + lcdShortPress: [control: StreamDeckLcdSegmentControlDefinition, position: LcdPosition]; + lcdLongPress: [control: StreamDeckLcdSegmentControlDefinition, position: LcdPosition]; + lcdSwipe: [control: StreamDeckLcdSegmentControlDefinition, from: LcdPosition, to: LcdPosition]; + nfcRead: [id: string]; +}; +export interface StreamDeck extends EventEmitter { + /** List of the controls on this streamdeck */ + readonly CONTROLS: Readonly; + /** The model of this device */ + readonly MODEL: DeviceModelId; + /** The name of the product/model */ + readonly PRODUCT_NAME: string; + /** Whether this device has a nfc reader */ + readonly HAS_NFC_READER: boolean; + /** + * Calculate the dimensions to use for `fillPanelBuffer`, to fill the whole button lcd panel with a single image. + * @param options Options to control the write + * @returns The dimensions to use for the image, or null if there is no panel + */ + calculateFillPanelDimensions(options?: FillPanelDimensionsOptions): Dimension | null; + /** + * Close the device + */ + close(): Promise; + /** + * Get information about the underlying HID device + */ + getHidDeviceInfo(): Promise; + /** + * Send a prepared buffer operation + * + * @param {PreparedBuffer} buffer The prepared buffer to draw + */ + sendPreparedBuffer(buffer: PreparedBuffer): Promise; + /** + * Fills the given key with a solid color. + * + * @param {number} keyIndex The key to fill + * @param {number} r The color's red value. 0 - 255 + * @param {number} g The color's green value. 0 - 255 + * @param {number} b The color's blue value. 0 -255 + */ + fillKeyColor(keyIndex: KeyIndex, r: number, g: number, b: number): Promise; + /** + * Fills the given key with an image in a Buffer. + * + * @param {number} keyIndex The key to fill + * @param {Buffer} imageBuffer The image to write + * @param {Object} options Options to control the write + */ + fillKeyBuffer(keyIndex: KeyIndex, imageBuffer: Uint8Array | Uint8ClampedArray, options?: FillImageOptions): Promise; + /** + * Prepare to fill the given key with an image in a Buffer. + * Note: The result is only guaranteed to be valid for this specific StreamDeck and the same library version, but is safe to store externally. + * + * @param {number} keyIndex The key to fill + * @param {Buffer} imageBuffer The image to write + * @param {Object} options Options to control the write + * @param {boolean} jsonSafe Whether the result should be packed to be safe to json serialize + */ + prepareFillKeyBuffer(keyIndex: KeyIndex, imageBuffer: Uint8Array | Uint8ClampedArray, options?: FillImageOptions, jsonSafe?: boolean): Promise; + /** + * Fills the whole panel with an image in a Buffer. + * + * @param {Buffer} imageBuffer The image to write + * @param {Object} options Options to control the write + */ + fillPanelBuffer(imageBuffer: Uint8Array | Uint8ClampedArray, options?: FillPanelOptions): Promise; + /** + * Prepare to fill the whole panel with an image in a Buffer. + * Note: The result is only guaranteed to be valid for this specific StreamDeck and the same library version, but is safe to store externally. + * + * @param {Buffer} imageBuffer The image to write + * @param {Object} options Options to control the write + * @param {boolean} jsonSafe Whether the result should be packed to be safe to json serialize + */ + prepareFillPanelBuffer(imageBuffer: Uint8Array | Uint8ClampedArray, options?: FillPanelOptions, jsonSafe?: boolean): Promise; + /** + * Fill the whole lcd segment + * @param {number} lcdIndex The id of the lcd segment to draw to + * @param {Buffer} imageBuffer The image to write + * @param {Object} sourceOptions Options to control the write + */ + fillLcd(lcdIndex: number, imageBuffer: Uint8Array | Uint8ClampedArray, sourceOptions: FillImageOptions): Promise; + /** + * Fills the primary led of an encoder + * @param {number} index The encoder to fill + * @param {number} r The color's red value. 0 - 255 + * @param {number} g The color's green value. 0 - 255 + * @param {number} b The color's blue value. 0 -255 + */ + setEncoderColor(index: EncoderIndex, r: number, g: number, b: number): Promise; + /** + * Fills the led ring of an encoder with a single color + * @param {number} index The encoder to fill + * @param {number} r The color's red value. 0 - 255 + * @param {number} g The color's green value. 0 - 255 + * @param {number} b The color's blue value. 0 -255 + */ + setEncoderRingSingleColor(index: EncoderIndex, r: number, g: number, b: number): Promise; + /** + * Fill the led ring of an encoder + * @param index The encoder to fill + * @param colors rgb packed pixel values for the encoder ring + */ + setEncoderRingColors(index: EncoderIndex, colors: number[] | Uint8Array): Promise; + /** + * Fill a region of the lcd segment, ignoring the boundaries of the encoders + * @param {number} lcdIndex The id of the lcd segment to draw to + * @param {number} x The x position to draw to + * @param {number} y The y position to draw to + * @param {Buffer} imageBuffer The image to write + * @param {Object} sourceOptions Options to control the write + */ + fillLcdRegion(lcdIndex: number, x: number, y: number, imageBuffer: Uint8Array, sourceOptions: FillLcdImageOptions): Promise; + /** + * Prepare to fill region of the lcd with an image in a Buffer. + * Note: The result is only guaranteed to be valid for this specific StreamDeck and the same library version, but is safe to store externally. + * + * @param {number} lcdIndex The id of the lcd segment to draw to + * @param {number} x The x position to draw to + * @param {number} y The y position to draw to + * @param {Buffer} imageBuffer The image to write + * @param {Object} sourceOptions Options to control the write + * @param {boolean} jsonSafe Whether the result should be packed to be safe to json serialize + */ + prepareFillLcdRegion(lcdIndex: number, x: number, y: number, imageBuffer: Uint8Array, sourceOptions: FillLcdImageOptions, jsonSafe?: boolean): Promise; + /** + * Clear the lcd segment to black + * @param {number} lcdIndex The id of the lcd segment to clear + */ + clearLcdSegment(lcdIndex: number): Promise; + /** + * Clears the given key. + * + * @param {number} keyIndex The key to clear + */ + clearKey(keyIndex: KeyIndex): Promise; + /** + * Clears all keys. + */ + clearPanel(): Promise; + /** + * Sets the brightness of the keys on the Stream Deck + * + * @param {number} percentage The percentage brightness + */ + setBrightness(percentage: number): Promise; + /** + * Resets the display to the startup logo + */ + resetToLogo(): Promise; + /** + * Get firmware version from Stream Deck + */ + getFirmwareVersion(): Promise; + /** + * Get all the firmware versions from a Stream Deck + * Some models have secondary firmware blobs + * The exact names of these varies per model and hardware revision + */ + getAllFirmwareVersions(): Promise>; + /** + * Get serial number from Stream Deck + */ + getSerialNumber(): Promise; + /** + * Get information about a child device connected to this Stream Deck, if any is connected + * Note: This is only available for the Stream Deck Studio, but is safe to call for other models + */ + getChildDeviceInfo(): Promise; +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/types.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/types.d.ts.map new file mode 100644 index 0000000..f116fe8 --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AAA;CAClE"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/types.js b/node_modules/@elgato-stream-deck/core/dist/types.js new file mode 100644 index 0000000..11e638d --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/types.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/types.js.map b/node_modules/@elgato-stream-deck/core/dist/types.js.map new file mode 100644 index 0000000..c768b79 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/util.d.ts b/node_modules/@elgato-stream-deck/core/dist/util.d.ts new file mode 100644 index 0000000..b824d9e --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/util.d.ts @@ -0,0 +1,12 @@ +import type { InternalFillImageOptions } from './services/imagePacker/interface.js'; +export interface FillImageTargetOptions { + colorMode: 'bgr' | 'rgba'; + xFlip?: boolean; + yFlip?: boolean; + rotate?: boolean; +} +export declare function transformImageBuffer(imageBuffer: Uint8Array | Uint8ClampedArray, sourceOptions: InternalFillImageOptions, targetOptions: FillImageTargetOptions, destPadding: number, imageWidth: number, imageHeight: number): Uint8Array; +export declare const BMP_HEADER_LENGTH = 54; +export declare function writeBMPHeader(buf: Uint8Array, imageWidth: number, imageHeight: number, imageBytes: number, imagePPM: number): void; +export declare function uint8ArrayToDataView(buffer: Uint8Array | Uint8ClampedArray): DataView; +//# sourceMappingURL=util.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/util.d.ts.map b/node_modules/@elgato-stream-deck/core/dist/util.d.ts.map new file mode 100644 index 0000000..1a08bd2 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/util.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAA;AAEnF,MAAM,WAAW,sBAAsB;IACtC,SAAS,EAAE,KAAK,GAAG,MAAM,CAAA;IACzB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,wBAAgB,oBAAoB,CACnC,WAAW,EAAE,UAAU,GAAG,iBAAiB,EAC3C,aAAa,EAAE,wBAAwB,EACvC,aAAa,EAAE,sBAAsB,EACrC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GACjB,UAAU,CA6CZ;AAED,eAAO,MAAM,iBAAiB,KAAK,CAAA;AACnC,wBAAgB,cAAc,CAC7B,GAAG,EAAE,UAAU,EACf,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACd,IAAI,CAwBN;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,iBAAiB,GAAG,QAAQ,CAErF"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/util.js b/node_modules/@elgato-stream-deck/core/dist/util.js new file mode 100644 index 0000000..d6ddbe8 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/util.js @@ -0,0 +1,73 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BMP_HEADER_LENGTH = void 0; +exports.transformImageBuffer = transformImageBuffer; +exports.writeBMPHeader = writeBMPHeader; +exports.uint8ArrayToDataView = uint8ArrayToDataView; +function transformImageBuffer(imageBuffer, sourceOptions, targetOptions, destPadding, imageWidth, imageHeight) { + const imageBufferView = uint8ArrayToDataView(imageBuffer); + const byteBuffer = new Uint8Array(destPadding + imageWidth * imageHeight * targetOptions.colorMode.length); + const byteBufferView = uint8ArrayToDataView(byteBuffer); + const flipColours = sourceOptions.format.substring(0, 3) !== targetOptions.colorMode.substring(0, 3); + for (let y = 0; y < imageHeight; y++) { + const rowOffset = destPadding + imageWidth * targetOptions.colorMode.length * y; + for (let x = 0; x < imageWidth; x++) { + // Apply x/y flips + let x2 = targetOptions.xFlip ? imageWidth - x - 1 : x; + let y2 = targetOptions.yFlip ? imageHeight - y - 1 : y; + if (targetOptions.rotate) { + // Swap x and y + const tmpX = x2; + x2 = y2; + y2 = tmpX; + } + const srcOffset = y2 * sourceOptions.stride + sourceOptions.offset + x2 * sourceOptions.format.length; + const red = imageBufferView.getUint8(srcOffset); + const green = imageBufferView.getUint8(srcOffset + 1); + const blue = imageBufferView.getUint8(srcOffset + 2); + const targetOffset = rowOffset + x * targetOptions.colorMode.length; + if (flipColours) { + byteBufferView.setUint8(targetOffset, blue); + byteBufferView.setUint8(targetOffset + 1, green); + byteBufferView.setUint8(targetOffset + 2, red); + } + else { + byteBufferView.setUint8(targetOffset, red); + byteBufferView.setUint8(targetOffset + 1, green); + byteBufferView.setUint8(targetOffset + 2, blue); + } + if (targetOptions.colorMode.length === 4) { + byteBufferView.setUint8(targetOffset + 3, 255); + } + } + } + return byteBuffer; +} +exports.BMP_HEADER_LENGTH = 54; +function writeBMPHeader(buf, imageWidth, imageHeight, imageBytes, imagePPM) { + const bufView = uint8ArrayToDataView(buf); + // Uses header format BITMAPINFOHEADER https://en.wikipedia.org/wiki/BMP_file_format + // Bitmap file header + bufView.setUint8(0, 0x42); // B + bufView.setUint8(1, 0x4d); // M + bufView.setUint32(2, imageBytes + 54, true); + bufView.setInt16(6, 0, true); + bufView.setInt16(8, 0, true); + bufView.setUint32(10, 54, true); // Full header size + // DIB header (BITMAPINFOHEADER) + bufView.setUint32(14, 40, true); // DIB header size + bufView.setInt32(18, imageWidth, true); + bufView.setInt32(22, imageHeight, true); + bufView.setInt16(26, 1, true); // Color planes + bufView.setInt16(28, 24, true); // Bit depth + bufView.setInt32(30, 0, true); // Compression + bufView.setInt32(34, imageBytes, true); // Image size + bufView.setInt32(38, imagePPM, true); // Horizontal resolution ppm + bufView.setInt32(42, imagePPM, true); // Vertical resolution ppm + bufView.setInt32(46, 0, true); // Colour pallette size + bufView.setInt32(50, 0, true); // 'Important' Colour count +} +function uint8ArrayToDataView(buffer) { + return new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength); +} +//# sourceMappingURL=util.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/dist/util.js.map b/node_modules/@elgato-stream-deck/core/dist/util.js.map new file mode 100644 index 0000000..8d783ea --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/dist/util.js.map @@ -0,0 +1 @@ +{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;AASA,oDAoDC;AAGD,wCA8BC;AAED,oDAEC;AAzFD,SAAgB,oBAAoB,CACnC,WAA2C,EAC3C,aAAuC,EACvC,aAAqC,EACrC,WAAmB,EACnB,UAAkB,EAClB,WAAmB;IAEnB,MAAM,eAAe,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAA;IAEzD,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;IAC1G,MAAM,cAAc,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAA;IAEvD,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAEpG,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,aAAa,CAAC,SAAS,CA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AAkB;IAClD,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;IACtC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,CAAA;IACvC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA,CAAC,eAAe;IAC7C,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,CAAA,CAAC,YAAY;IAC3C,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA,CAAC,cAAc;IAC5C,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA,CAAC,aAAa;IACpD,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA,CAAC,4BAA4B;IACjE,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA,CAAC,0BAA0B;IAC/D,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA,CAAC,uBAAuB;IACrD,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA,CAAC,2BAA2B;AAC1D,CAAC;AAED,SAAgB,oBAAoB,CAAC,MAAsC;IAC1E,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;AACzE,CAAC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/core/package.json b/node_modules/@elgato-stream-deck/core/package.json new file mode 100644 index 0000000..c3b2296 --- /dev/null +++ b/node_modules/@elgato-stream-deck/core/package.json @@ -0,0 +1,58 @@ +{ + "name": "@elgato-stream-deck/core", + "version": "7.5.2", + "description": "An npm module for interfacing with the Elgato Stream Deck", + "main": "dist/index.js", + "typings": "dist/index.d.ts", + "license": "MIT", + "homepage": "https://github.com/julusian/node-elgato-stream-deck#readme", + "repository": { + "type": "git", + "url": "https://github.com/Julusian/node-elgato-stream-deck", + "directory": "packages/core" + }, + "bugs": { + "url": "https://github.com/julusian/node-elgato-stream-deck/issues" + }, + "author": { + "name": "Julian Waller", + "email": "git@julusian.co.uk" + }, + "contributors": [ + { + "name": "Håkon Nessjøen", + "email": "haakon@bitfocus.io" + }, + { + "name": "Richard Fox", + "twitter": "ProbablePrime" + }, + { + "name": "Chris Hanel", + "twitter": "chrishanel", + "email": "chrishanel@gmail.com", + "url": "http://www.chrishanel.com/" + } + ], + "keywords": [ + "elgato", + "stream", + "deck", + "streamdeck", + "hid", + "usb", + "hardware", + "interface", + "controller" + ], + "files": [ + "dist" + ], + "engines": { + "node": ">=18.18" + }, + "dependencies": { + "eventemitter3": "^5.0.4", + "tslib": "^2.8.1" + } +} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node-lib/CHANGELOG.md b/node_modules/@elgato-stream-deck/node-lib/CHANGELOG.md new file mode 100644 index 0000000..5777778 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node-lib/CHANGELOG.md @@ -0,0 +1,67 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [7.3.2](https://github.com/julusian/node-elgato-stream-deck/compare/v7.3.1...v7.3.2) (2025-07-14) + +**Note:** Version bump only for package @elgato-stream-deck/node-lib + + + + + +## [7.3.1](https://github.com/julusian/node-elgato-stream-deck/compare/v7.3.0...v7.3.1) (2025-05-30) + +**Note:** Version bump only for package @elgato-stream-deck/node-lib + + + + + +# [7.3.0](https://github.com/julusian/node-elgato-stream-deck/compare/v7.2.0...v7.3.0) (2025-05-30) + +**Note:** Version bump only for package @elgato-stream-deck/node-lib + + + + + +# [7.2.0](https://github.com/julusian/node-elgato-stream-deck/compare/v7.1.2...v7.2.0) (2025-05-24) + +**Note:** Version bump only for package @elgato-stream-deck/node-lib + + + + + +## [7.1.2](https://github.com/julusian/node-elgato-stream-deck/compare/v7.1.1...v7.1.2) (2024-12-09) + +**Note:** Version bump only for package @elgato-stream-deck/node-lib + + + + + +## [7.1.1](https://github.com/julusian/node-elgato-stream-deck/compare/v7.1.0...v7.1.1) (2024-11-14) + +**Note:** Version bump only for package @elgato-stream-deck/node-lib + + + + + +## [7.0.2](https://github.com/julusian/node-elgato-stream-deck/compare/v7.0.1...v7.0.2) (2024-09-16) + +**Note:** Version bump only for package @elgato-stream-deck/node-lib + + + + + +# [7.0.0](https://github.com/julusian/node-elgato-stream-deck/compare/v7.0.0-0...v7.0.0) (2024-09-08) + + +### Features + +* streamdeck studio support ([#100](https://github.com/julusian/node-elgato-stream-deck/issues/100)) ([baf506d](https://github.com/julusian/node-elgato-stream-deck/commit/baf506da9f4a1e38bc8f7f393743491c21c59835)) diff --git a/node_modules/@elgato-stream-deck/node-lib/LICENSE b/node_modules/@elgato-stream-deck/node-lib/LICENSE new file mode 100644 index 0000000..ebc5513 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node-lib/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Julian Waller + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@elgato-stream-deck/node-lib/README.md b/node_modules/@elgato-stream-deck/node-lib/README.md new file mode 100644 index 0000000..9d97977 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node-lib/README.md @@ -0,0 +1,20 @@ +# @elgato-stream-deck/node-lib + +![Node CI](https://github.com/Julusian/node-elgato-stream-deck/workflows/Node%20CI/badge.svg) +[![codecov](https://codecov.io/gh/Julusian/node-elgato-stream-deck/branch/master/graph/badge.svg?token=Hl4QXGZJMF)](https://codecov.io/gh/Julusian/node-elgato-stream-deck) + +[![npm version](https://img.shields.io/npm/v/@elgato-stream-deck/node-lib.svg)](https://npm.im/@elgato-stream-deck/node-lib) +[![license](https://img.shields.io/npm/l/@elgato-stream-deck/node-lib.svg)](https://npm.im/@elgato-stream-deck/node-lib) + +[`@elgato-stream-deck/node-lib`](https://github.com/julusian/node-elgato-stream-deck) is an internal library, used for interfacing +with the various models of the [Elgato Stream Deck](https://www.elgato.com/en/gaming/stream-deck) through node. + +## Intended use + +This is an internal helper library of the @elgato-stream-deck projects, it should not be used by others or directly. + +## Contributing + +The elgato-stream-deck team enthusiastically welcomes contributions and project participation! There's a bunch of things you can do if you want to contribute! Please don't hesitate to jump in if you'd like to, or even ask us questions if something isn't clear. + +Please refer to the [Changelog](CHANGELOG.md) for project history details, too. diff --git a/node_modules/@elgato-stream-deck/node-lib/dist/jpeg.d.ts b/node_modules/@elgato-stream-deck/node-lib/dist/jpeg.d.ts new file mode 100644 index 0000000..9d05449 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node-lib/dist/jpeg.d.ts @@ -0,0 +1,13 @@ +export interface JPEGEncodeOptions { + quality: number; + subsampling?: number; +} +/** + * The default JPEG encoder. + * `@julusian/jpeg-turbo` will be used if it can be found, otherwise it will fall back to `jpeg-js` + * @param buffer The buffer to convert + * @param width Width of the image + * @param height Hieght of the image + */ +export declare function encodeJPEG(buffer: Uint8Array, width: number, height: number, options: JPEGEncodeOptions | undefined): Promise; +//# sourceMappingURL=jpeg.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node-lib/dist/jpeg.d.ts.map b/node_modules/@elgato-stream-deck/node-lib/dist/jpeg.d.ts.map new file mode 100644 index 0000000..f8eed15 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node-lib/dist/jpeg.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"jpeg.d.ts","sourceRoot":"","sources":["../src/jpeg.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACpB;AAID;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC/B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,GAAG,SAAS,GACpC,OAAO,CAAC,UAAU,CAAC,CAgCrB"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node-lib/dist/jpeg.js b/node_modules/@elgato-stream-deck/node-lib/dist/jpeg.js new file mode 100644 index 0000000..4a6a046 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node-lib/dist/jpeg.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encodeJPEG = encodeJPEG; +const jpegJS = require("jpeg-js"); +const DEFAULT_QUALITY = 95; +/** + * The default JPEG encoder. + * `@julusian/jpeg-turbo` will be used if it can be found, otherwise it will fall back to `jpeg-js` + * @param buffer The buffer to convert + * @param width Width of the image + * @param height Hieght of the image + */ +async function encodeJPEG(buffer, width, height, options) { + try { + const jpegTurbo = await Promise.resolve().then(() => require('@julusian/jpeg-turbo')); + // Try using jpeg-turbo if it is available + if (jpegTurbo.bufferSize && !!jpegTurbo.compress) { + const encodeOptions = { + format: jpegTurbo.FORMAT_RGBA, + width, + height, + quality: DEFAULT_QUALITY, + ...options, + }; + if (buffer.length === width * height * 4) { + const tmpBuffer = Buffer.alloc(jpegTurbo.bufferSize(encodeOptions)); + return jpegTurbo.compress(Buffer.from(buffer), tmpBuffer, encodeOptions); // Future: avoid rewrap + } + } + } + catch (_e) { + // TODO - log error + } + // If jpeg-turbo is unavailable or fails, then fallback to jpeg-js + const jpegBuffer2 = jpegJS.encode({ + width, + height, + data: buffer, + }, options ? options.quality : DEFAULT_QUALITY); + return jpegBuffer2.data; +} +//# sourceMappingURL=jpeg.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node-lib/dist/jpeg.js.map b/node_modules/@elgato-stream-deck/node-lib/dist/jpeg.js.map new file mode 100644 index 0000000..3a8a6df --- /dev/null +++ b/node_modules/@elgato-stream-deck/node-lib/dist/jpeg.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jpeg.js","sourceRoot":"","sources":["../src/jpeg.ts"],"names":[],"mappings":";;AAiBA,gCAqCC;AAtDD,kCAAiC;AAQjC,MAAM,eAAe,GAAG,EAAE,CAAA;AAE1B;;;;;;GAMG;AACI,KAAK,UAAU,UAAU,CAC/B,MAAkB,EAClB,KAAa,EACb,MAAc,EACd,OAAsC;IAEtC,IAAI,CAAC;QACJ,MAAM,SAAS,GAAG,2CAAa,sBAAsB,EAAC,CAAA;QAEtD,0CAA0C;QAC1C,IAAI,SAAS,CAAC,UAAU,IAAI,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;YAClD,MAAM,aAAa,GAAkB;gBACpC,MAAM,EAAE,SAAS,CAAC,WAAW;gBAC7B,KAAK;gBACL,MAAM;gBACN,OAAO,EAAE,eAAe;gBACxB,GAAG,OAAO;aACV,CAAA;YACD,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1C,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAA;gBACnE,OAAO,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,aAAa,CAAC,CAAA,CAAC,uBAAuB;YACjG,CAAC;QACF,CAAC;IACF,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;QACb,mBAAmB;IACpB,CAAC;IAED,kEAAkE;IAClE,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAChC;QACC,KAAK;QACL,MAAM;QACN,IAAI,EAAE,MAAM;KACZ,EACD,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAC3C,CAAA;IACD,OAAO,WAAW,CAAC,IAAI,CAAA;AACxB,CAAC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node-lib/dist/lib.d.ts b/node_modules/@elgato-stream-deck/node-lib/dist/lib.d.ts new file mode 100644 index 0000000..f67988b --- /dev/null +++ b/node_modules/@elgato-stream-deck/node-lib/dist/lib.d.ts @@ -0,0 +1,2 @@ +export * from './jpeg.js'; +//# sourceMappingURL=lib.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node-lib/dist/lib.d.ts.map b/node_modules/@elgato-stream-deck/node-lib/dist/lib.d.ts.map new file mode 100644 index 0000000..8328343 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node-lib/dist/lib.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node-lib/dist/lib.js b/node_modules/@elgato-stream-deck/node-lib/dist/lib.js new file mode 100644 index 0000000..087c967 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node-lib/dist/lib.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./jpeg.js"), exports); +//# sourceMappingURL=lib.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node-lib/dist/lib.js.map b/node_modules/@elgato-stream-deck/node-lib/dist/lib.js.map new file mode 100644 index 0000000..02d8e1f --- /dev/null +++ b/node_modules/@elgato-stream-deck/node-lib/dist/lib.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":";;;AAAA,oDAAyB"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node-lib/dist/tsconfig.build.tsbuildinfo b/node_modules/@elgato-stream-deck/node-lib/dist/tsconfig.build.tsbuildinfo new file mode 100644 index 0000000..5740a93 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node-lib/dist/tsconfig.build.tsbuildinfo @@ -0,0 +1 @@ +{"root":["../src/jpeg.ts","../src/lib.ts"],"version":"5.9.3"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node-lib/package.json b/node_modules/@elgato-stream-deck/node-lib/package.json new file mode 100644 index 0000000..620aa5c --- /dev/null +++ b/node_modules/@elgato-stream-deck/node-lib/package.json @@ -0,0 +1,46 @@ +{ + "name": "@elgato-stream-deck/node-lib", + "version": "7.5.2", + "description": "Helpers for a npm module for interfacing with the Elgato Stream Deck", + "main": "dist/lib.js", + "typings": "dist/lib.d.ts", + "license": "MIT", + "homepage": "https://github.com/julusian/node-elgato-stream-deck#readme", + "repository": { + "type": "git", + "url": "https://github.com/Julusian/node-elgato-stream-deck", + "directory": "packages/node-lib" + }, + "bugs": { + "url": "https://github.com/julusian/node-elgato-stream-deck/issues" + }, + "author": { + "name": "Julian Waller", + "email": "git@julusian.co.uk" + }, + "keywords": [ + "elgato", + "stream", + "deck", + "streamdeck", + "hid", + "usb", + "hardware", + "interface", + "controller" + ], + "files": [ + "dist", + "udev" + ], + "engines": { + "node": ">=18.18" + }, + "dependencies": { + "jpeg-js": "^0.4.4", + "tslib": "^2.8.1" + }, + "peerDependencies": { + "@julusian/jpeg-turbo": "^1.1.2 || ^2.0.0 || ^3.0.0" + } +} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node/CHANGELOG.md b/node_modules/@elgato-stream-deck/node/CHANGELOG.md new file mode 100644 index 0000000..ac5eb0b --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/CHANGELOG.md @@ -0,0 +1,375 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [7.3.2](https://github.com/julusian/node-elgato-stream-deck/compare/v7.3.1...v7.3.2) (2025-07-14) + +**Note:** Version bump only for package @elgato-stream-deck/node + + + + + +## [7.3.1](https://github.com/julusian/node-elgato-stream-deck/compare/v7.3.0...v7.3.1) (2025-05-30) + +**Note:** Version bump only for package @elgato-stream-deck/node + + + + + +# [7.3.0](https://github.com/julusian/node-elgato-stream-deck/compare/v7.2.0...v7.3.0) (2025-05-30) + + +### Features + +* prepared buffers ([#102](https://github.com/julusian/node-elgato-stream-deck/issues/102)) ([026cbf3](https://github.com/julusian/node-elgato-stream-deck/commit/026cbf37f643096002a5a8385f26e59d5a390d24)) + + + + + +# [7.2.0](https://github.com/julusian/node-elgato-stream-deck/compare/v7.1.2...v7.2.0) (2025-05-24) + + +### Features + +* add 6 module, 15 module and 32 module ([ca874d8](https://github.com/julusian/node-elgato-stream-deck/commit/ca874d8f857a944871f4aecb97699b8b1cf945f0)) + + + + + +## [7.1.2](https://github.com/julusian/node-elgato-stream-deck/compare/v7.1.1...v7.1.2) (2024-12-09) + +**Note:** Version bump only for package @elgato-stream-deck/node + + + + + +## [7.1.1](https://github.com/julusian/node-elgato-stream-deck/compare/v7.1.0...v7.1.1) (2024-11-14) + +**Note:** Version bump only for package @elgato-stream-deck/node + + + + + +# [7.1.0](https://github.com/julusian/node-elgato-stream-deck/compare/v7.0.2...v7.1.0) (2024-11-14) + + +### Bug Fixes + +* udev rules [#106](https://github.com/julusian/node-elgato-stream-deck/issues/106) ([ba41a75](https://github.com/julusian/node-elgato-stream-deck/commit/ba41a759cd9b86e6de1574230a0209229392ebef)) + + +### Features + +* additional studio firmware versions (usb) ([4e2e5df](https://github.com/julusian/node-elgato-stream-deck/commit/4e2e5df1811427d78f4515b3e313a39e4625bbb7)) + + + + + +## [7.0.2](https://github.com/julusian/node-elgato-stream-deck/compare/v7.0.1...v7.0.2) (2024-09-16) + +**Note:** Version bump only for package @elgato-stream-deck/node + + + + + +## [7.0.1](https://github.com/julusian/node-elgato-stream-deck/compare/v7.0.0...v7.0.1) (2024-09-10) + +**Note:** Version bump only for package @elgato-stream-deck/node + + + + + +# [7.0.0](https://github.com/julusian/node-elgato-stream-deck/compare/v7.0.0-0...v7.0.0) (2024-09-08) + + +### Features + +* streamdeck studio support ([#100](https://github.com/julusian/node-elgato-stream-deck/issues/100)) ([baf506d](https://github.com/julusian/node-elgato-stream-deck/commit/baf506da9f4a1e38bc8f7f393743491c21c59835)) + + + + + +# [7.0.0-0](https://github.com/julusian/node-elgato-stream-deck/compare/v6.2.2...v7.0.0-0) (2024-08-26) + + +### Features + +* target nodejs 18 ([5fe6c09](https://github.com/julusian/node-elgato-stream-deck/commit/5fe6c092ba46e09a1814ff627ec2991359dadd6c)) +* rework how device functionality is exposed +* rework events structure + + + + +## [6.2.2](https://github.com/julusian/node-elgato-stream-deck/compare/v6.2.1...v6.2.2) (2024-07-11) + + +### Bug Fixes + +* build error ([e23aa8b](https://github.com/julusian/node-elgato-stream-deck/commit/e23aa8b61a570b08dcaf53461bbf9ad857371d8c)) + + + + + +## [6.2.1](https://github.com/julusian/node-elgato-stream-deck/compare/v6.2.0...v6.2.1) (2024-07-11) + +**Note:** Version bump only for package @elgato-stream-deck/node + + + + + +# [6.2.0](https://github.com/julusian/node-elgato-stream-deck/compare/v6.0.0...v6.2.0) (2024-04-30) + + +### Bug Fixes + +* rework udev rules [#88](https://github.com/julusian/node-elgato-stream-deck/issues/88) ([d6054a7](https://github.com/julusian/node-elgato-stream-deck/commit/d6054a79781239dc8c845d2f866335621297d9c2)) +* update examples to run and better support plus and neo ([219e37c](https://github.com/julusian/node-elgato-stream-deck/commit/219e37cdf77963cc59c4de810fdb555e30194408)) + + +### Features + +* neo lcd drawing ([7d13bc0](https://github.com/julusian/node-elgato-stream-deck/commit/7d13bc03306fccad119b4f203c9106bc93d5515b)) +* **node:** expose path of opened device [#65](https://github.com/julusian/node-elgato-stream-deck/issues/65) ([45ebbe5](https://github.com/julusian/node-elgato-stream-deck/commit/45ebbe5a9e721f3a89d027d977193f7aa322f6ce)) +* support for streamdeck neo ([65197a7](https://github.com/julusian/node-elgato-stream-deck/commit/65197a7735d86ebd1883f96a5f7719b2bd1c95fb)) + + + + + +# [6.1.0](https://github.com/julusian/node-elgato-stream-deck/compare/v6.0.0...v6.1.0) (2024-04-21) + + +### Bug Fixes + +* rework udev rules [#88](https://github.com/julusian/node-elgato-stream-deck/issues/88) ([d6054a7](https://github.com/julusian/node-elgato-stream-deck/commit/d6054a79781239dc8c845d2f866335621297d9c2)) + + +### Features + +* **node:** expose path of opened device [#65](https://github.com/julusian/node-elgato-stream-deck/issues/65) ([45ebbe5](https://github.com/julusian/node-elgato-stream-deck/commit/45ebbe5a9e721f3a89d027d977193f7aa322f6ce)) + + + + + +# [6.0.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.7.3...v6.0.0) (2023-11-29) + + +### Features + +* use async node-hid ([#75](https://github.com/julusian/node-elgato-stream-deck/issues/75)) ([9938244](https://github.com/julusian/node-elgato-stream-deck/commit/9938244f1c61618ce821fe574127c5ae81211c72)) + + + + + +## [5.7.3](https://github.com/julusian/node-elgato-stream-deck/compare/v5.7.2...v5.7.3) (2023-06-20) + +**Note:** Version bump only for package @elgato-stream-deck/node + + + + + +## [5.7.2](https://github.com/julusian/node-elgato-stream-deck/compare/v5.7.1...v5.7.2) (2023-01-17) + + +### Bug Fixes + +* **node:** avoid duplicates in `listStreamDecks` [#32](https://github.com/julusian/node-elgato-stream-deck/issues/32) ([660eb39](https://github.com/julusian/node-elgato-stream-deck/commit/660eb39b3ed19febd2c95074a43034ca1b9e9dd3)) + + + + + +# [5.7.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.6.0-alpha.0...v5.7.0) (2022-11-15) + + +### Features + +* streamdeck plus ([#59](https://github.com/julusian/node-elgato-stream-deck/issues/59)) ([37479d8](https://github.com/julusian/node-elgato-stream-deck/commit/37479d8a14bffe6eb421164bbaad1161dc302502)) + + +### Reverts + +* Revert "chore: switch to yarn3" ([45f6137](https://github.com/julusian/node-elgato-stream-deck/commit/45f613755a274c350b7819d30856cf7aa27f27e3)) + + + + + +# [5.6.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.6.0-alpha.0...v5.6.0) (2022-09-30) + +**Note:** Version bump only for package @elgato-stream-deck/node + + + + + +# [5.6.0-alpha.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.5.0...v5.6.0-alpha.0) (2022-09-25) + +**Note:** Version bump only for package @elgato-stream-deck/node + + + + + +# [5.5.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.5.0-alpha.1...v5.5.0) (2022-07-25) + +**Note:** Version bump only for package @elgato-stream-deck/node + + + + + +# [5.5.0-alpha.1](https://github.com/julusian/node-elgato-stream-deck/compare/v5.5.0-alpha.0...v5.5.0-alpha.1) (2022-07-25) + +**Note:** Version bump only for package @elgato-stream-deck/node + + + + + +# [5.5.0-alpha.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.4.0...v5.5.0-alpha.0) (2022-07-08) + + +### Bug Fixes + +* support @julusian/jpeg-turbo 2.x ([9a0a718](https://github.com/julusian/node-elgato-stream-deck/commit/9a0a718bab6cd77b8803b5e3e42396183b83d892)) + + + + + +# [5.4.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.4.0-alpha.0...v5.4.0) (2022-05-10) + + +### Bug Fixes + +* add missing tslib dependency ([6b53699](https://github.com/julusian/node-elgato-stream-deck/commit/6b536994bea3686b4b03fccadafeb2a532e63f4d)) +* UDEV rules example markdown. Missing * after hidraw ([#43](https://github.com/julusian/node-elgato-stream-deck/issues/43)) ([6f94093](https://github.com/julusian/node-elgato-stream-deck/commit/6f94093444951104b37064d1bf7a815ffef0aa60)) + + + + + +# [5.4.0-alpha.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.3.1...v5.4.0-alpha.0) (2022-04-12) + + +### Features + +* support for the pedal (untested) ([ccc4389](https://github.com/julusian/node-elgato-stream-deck/commit/ccc4389844c67194060f32e741c41407713c4cf7)) + + + + + +## [5.3.1](https://github.com/julusian/node-elgato-stream-deck/compare/v5.3.0...v5.3.1) (2022-02-21) + + +### Bug Fixes + +* ensure build before publish ([786ad79](https://github.com/julusian/node-elgato-stream-deck/commit/786ad798b5d6472cd35f3c895c901073edeea378)) + + + + + +# [5.3.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.2.0...v5.3.0) (2022-02-21) + + +### Features + +* allow the original 15 key to be used in webhid ([7ff5624](https://github.com/julusian/node-elgato-stream-deck/commit/7ff562446b77d17b119f27570937513f02338f28)) +* use hidraw backend on linux, as modern (2 year old) kernels support it for all models now ([596e426](https://github.com/julusian/node-elgato-stream-deck/commit/596e426da1d67c268056bd5b37730d13bbc569f1)) + + + + + +# [5.2.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.2.0-alpha.1...v5.2.0) (2022-01-25) + +**Note:** Version bump only for package @elgato-stream-deck/node + + + + + +# [5.2.0-alpha.1](https://github.com/julusian/node-elgato-stream-deck/compare/v5.2.0-alpha.0...v5.2.0-alpha.1) (2022-01-19) + +**Note:** Version bump only for package @elgato-stream-deck/node + + + + + +# [5.2.0-alpha.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.1.2...v5.2.0-alpha.0) (2022-01-18) + + +### Features + +* add method to get info about a hid device, if it is a streamdeck ([1791e37](https://github.com/julusian/node-elgato-stream-deck/commit/1791e370e830c0fff7e3169e30cb0871675fdf86)) + + + + + +## [5.1.2](https://github.com/julusian/node-elgato-stream-deck/compare/v5.1.1...v5.1.2) (2021-12-02) + +**Note:** Version bump only for package @elgato-stream-deck/node + + + + + +## [5.1.1](https://github.com/julusian/node-elgato-stream-deck/compare/v5.1.0...v5.1.1) (2021-07-19) + + +### Bug Fixes + +* mk2 is different to v2 ([71feace](https://github.com/julusian/node-elgato-stream-deck/commit/71feace86e0c097ea2b375b4981c252628f7eb4b)) + + + + + +# [5.1.0](https://github.com/julusian/node-elgato-stream-deck/compare/v5.0.0...v5.1.0) (2021-07-19) + + +### Features + +* support streamdeck mk2 (15 key, new style) ([a239503](https://github.com/julusian/node-elgato-stream-deck/commit/a239503b2edf7d4a6dae780ffa5e7dfe481d8cd8)) + + + + + +# [5.0.0](https://github.com/julusian/node-elgato-stream-deck/compare/v4.0.0...v5.0.0) (2021-03-07) + +This is a major overhaul of [elgato-stream-deck](https://npmjs.com/package/elgato-stream-deck) to allow for support for webhid to be added cleanly. +The major changes are listed below, and should be reviewed when updating. + +The most notable changes are the api now returns promises for every operation, and various methods have been renamed to be more consistent + +### Features +* convert most methods to return promises, as webhid uses them even though node-hid doesnt. ([7b1883b](https://github.com/julusian/node-elgato-stream-deck/commit/7b1883be9ff91293aeef95cd1c0f087d795a4fb1)) +* lerna ([c942fb9](https://github.com/julusian/node-elgato-stream-deck/commit/c942fb970727944eb3b614b98fd996f2531b0c53)) +* publish demo to github pages ([44428a2](https://github.com/julusian/node-elgato-stream-deck/commit/44428a23619538de9de5a50975e30a6957efc44b)) +* refactor into a separate node package ([0e68e20](https://github.com/julusian/node-elgato-stream-deck/commit/0e68e206acf99024fa3673a3c8c26a52b08f83b1)) +* remove exit-hook due to it potentially 'claiming' error handling ([a4aca6b](https://github.com/julusian/node-elgato-stream-deck/commit/a4aca6bb14d0cdbf3e0ac4d01b016b5e85e32890)) +* use eventemitter3 instead of node eventemitter ([31e6bc3](https://github.com/julusian/node-elgato-stream-deck/commit/31e6bc300c963d45c103fa0de9788c458637c684)) +* rename api methods to be clearer ([e8777bb](https://github.com/julusian/node-elgato-stream-deck/commit/e8777bbb3ac5b549d91f9062dd8b3e1a4b28021b)) diff --git a/node_modules/@elgato-stream-deck/node/LICENSE b/node_modules/@elgato-stream-deck/node/LICENSE new file mode 100644 index 0000000..772f57c --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Julian Waller + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@elgato-stream-deck/node/README.md b/node_modules/@elgato-stream-deck/node/README.md new file mode 100644 index 0000000..e970a7b --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/README.md @@ -0,0 +1,136 @@ +# @elgato-stream-deck/node + +![Node CI](https://github.com/Julusian/node-elgato-stream-deck/workflows/Node%20CI/badge.svg) +[![codecov](https://codecov.io/gh/Julusian/node-elgato-stream-deck/branch/master/graph/badge.svg?token=Hl4QXGZJMF)](https://codecov.io/gh/Julusian/node-elgato-stream-deck) + +[![npm version](https://img.shields.io/npm/v/@elgato-stream-deck/node.svg)](https://npm.im/@elgato-stream-deck/node) +[![license](https://img.shields.io/npm/l/@elgato-stream-deck/node.svg)](https://npm.im/@elgato-stream-deck/node) + +[`@elgato-stream-deck/node`](https://github.com/julusian/node-elgato-stream-deck) is a shared library for interfacing +with the various models of the [Elgato Stream Deck](https://www.elgato.com/en/gaming/stream-deck). + +## Intended use + +This library has nothing to do with the streamdeck software produced by Elgato. There is nothing here to install and run. This is a library to help developers make alternatives to that software + +## Install + +`$ npm install --save @elgato-stream-deck/node` + +`$ npm install --save @julusian/jpeg-turbo@^2.0.0` (Optional) + +It is recommended to install `@julusian/jpeg-turbo` to greatly improve performance for writing images to the StreamDeck XL or the Original-v2. Without doing so `jpeg-js` will be used instead, but image transfers will be noticably more cpu intensive and slower. `jpeg-turbo` has prebuilt binaries, but is not installed by default to ensure installation is easy for users who do not need the performance for the XL or the Original-v2. + +### Native dependencies + +All of this library's native dependencies ship with prebuilt binaries, so having a full compiler toolchain should not be necessary to install `@elgato-stream-deck/node`. + +However, in the event that installation _does_ fail (**or if you are on a platform that our dependencies don't provide prebuilt binaries for, such as a Raspberry Pi**), you will need to install a compiler toolchain to enable npm to build some of `@elgato-stream-deck/node`'s dependencies from source. Expand the details block below for full instructions on how to do so. + +
+ Compiling dependencies from source + +* Windows + * Install [`windows-build-tools`](https://github.com/felixrieseberg/windows-build-tools): + ```bash + npm install --global windows-build-tools + ``` +* MacOS + * Install the Xcode Command Line Tools: + ```bash + xcode-select --install + ``` +* Linux (**including Raspberry Pi**) + * Follow the instructions for Linux in the ["Compiling from source"](https://github.com/node-hid/node-hid#compiling-from-source) steps for + * Try installing `@elgato-stream-deck/node` + * If you still have issues, ensure everything is updated and try again: + ```bash + sudo apt-get update && sudo apt-get upgrade + ``` +
+ +## Linux + +On linux, the udev subsystem blocks access to the StreamDeck without some special configuration. +Copy one of the following files into `/etc/udev/rules.d/` and reload the rules with `sudo udevadm control --reload-rules` + +- Use the [headless server](./udev/50-elgato-stream-deck-headless.rules) version when your software will be running as a system service, and is not related to a logged in user +- Use the [desktop user](./udev/50-elgato-stream-deck-user.rules) version when your software is run by a user session on a distribution using systemd + +Unplug and replug the device and it should be usable + +## Features + +- Multiplatform support: Windows 7-10, MacOS, Linux, and even Raspberry Pi! +- Support for every StreamDeck model (Original, Mini & XL) +- Key `down` and key `up` events +- Fill keys with images or solid RGB colors +- Fill the entire panel with a single image, spread across all keys +- Set the Stream Deck brightness +- TypeScript support + +## API + +The root methods exposed by the library are as follows. For more information it is recommended to rely on the typescript typings for hints or to browse through the source to see what methods are available + +```typescript +/** + * Scan for and list detected devices + */ +export function listStreamDecks(): Promise + +/** + * Get the info of a device if the given path is a streamdeck + */ +export function getStreamDeckInfo(path: string): Promise + +/** + * Open a streamdeck + * @param devicePath The path of the device to open. + * @param userOptions Options to customise the device behvaiour + */ +export function openStreamDeck(devicePath: string, userOptions?: OpenStreamDeckOptionsNode): Promise +``` + +The `StreamDeck` type can be found [here](/packages/core/src/types.ts#L48). + +## Example + +```typescript +import { openStreamDeck, listStreamDecks } from '@elgato-stream-deck/node' + +// List the connected streamdecks +const devices = await listStreamDecks() +if (devices.length === 0) throw new Error('No streamdecks connected!') + +// You must provide the devicePath yourself as the first argument to the constructor. +// For example: const myStreamDeck = new StreamDeck('\\\\?\\hid#vid_05f3&pid_0405&mi_00#7&56cf813&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}') +// On linux the equivalent would be: const myStreamDeck = new StreamDeck('0001:0021:00') +const myStreamDeck = await openStreamDeck(devices[0].path) + +myStreamDeck.on('down', (keyIndex) => { + console.log('key %d down', keyIndex) +}) + +myStreamDeck.on('up', (keyIndex) => { + console.log('key %d up', keyIndex) +}) + +// Fired whenever an error is detected by the `node-hid` library. +// Always add a listener for this event! If you don't, errors will be silently dropped. +myStreamDeck.on('error', (error) => { + console.error(error) +}) + +// Fill the first button form the left in the first row with a solid red color. This is asynchronous. +await myStreamDeck.fillKeyColor(4, 255, 0, 0) +console.log('Successfully wrote a red square to key 4.') +``` + +Some more complex demos can be found in the [examples](/packages/node/examples/) folder. + +## Contributing + +The elgato-stream-deck team enthusiastically welcomes contributions and project participation! There's a bunch of things you can do if you want to contribute! Please don't hesitate to jump in if you'd like to, or even ask us questions if something isn't clear. + +Please refer to the [Changelog](CHANGELOG.md) for project history details, too. diff --git a/node_modules/@elgato-stream-deck/node/dist/hid-device.d.ts b/node_modules/@elgato-stream-deck/node/dist/hid-device.d.ts new file mode 100644 index 0000000..6fcf6bf --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/dist/hid-device.d.ts @@ -0,0 +1,30 @@ +import type { DeviceModelId, HIDDevice, HIDDeviceEvents, HIDDeviceInfo } from '@elgato-stream-deck/core'; +import type { ChildHIDDeviceInfo } from '@elgato-stream-deck/core/dist/hid-device'; +import { EventEmitter } from 'eventemitter3'; +import type { HIDAsync } from 'node-hid'; +/** + * Information about a found streamdeck + */ +export interface StreamDeckDeviceInfo { + /** The model of the device */ + model: DeviceModelId; + /** The connected path of the device in the usb tree */ + path: string; + /** The serialNumber of the device. If set it can be used as a unique hardware identifier */ + serialNumber?: string; +} +/** + * The wrapped node-hid HIDDevice. + * This translates it into the common format expected by @elgato-stream-deck/core + */ +export declare class NodeHIDDevice extends EventEmitter implements HIDDevice { + private device; + constructor(device: HIDAsync); + close(): Promise; + sendFeatureReport(data: Uint8Array): Promise; + getFeatureReport(reportId: number, reportLength: number): Promise; + sendReports(buffers: Uint8Array[]): Promise; + getDeviceInfo(): Promise; + getChildDeviceInfo(): Promise; +} +//# sourceMappingURL=hid-device.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node/dist/hid-device.d.ts.map b/node_modules/@elgato-stream-deck/node/dist/hid-device.d.ts.map new file mode 100644 index 0000000..652b852 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/dist/hid-device.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hid-device.d.ts","sourceRoot":"","sources":["../src/hid-device.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAA;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAA+B,MAAM,UAAU,CAAA;AAErE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,8BAA8B;IAC9B,KAAK,EAAE,aAAa,CAAA;IACpB,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAA;IACZ,4FAA4F;IAC5F,YAAY,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;GAGG;AACH,qBAAa,aAAc,SAAQ,YAAY,CAAC,eAAe,CAAE,YAAW,SAAS;IACpF,OAAO,CAAC,MAAM,CAAU;gBAEZ,MAAM,EAAE,QAAQ;IAef,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAGlD,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAG7E,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQjD,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC;IAUvC,kBAAkB,IAAI,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;CAIrE"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node/dist/hid-device.js b/node_modules/@elgato-stream-deck/node/dist/hid-device.js new file mode 100644 index 0000000..3aee3f9 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/dist/hid-device.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NodeHIDDevice = void 0; +const eventemitter3_1 = require("eventemitter3"); +/** + * The wrapped node-hid HIDDevice. + * This translates it into the common format expected by @elgato-stream-deck/core + */ +class NodeHIDDevice extends eventemitter3_1.EventEmitter { + device; + constructor(device) { + super(); + this.device = device; + this.device.on('error', (error) => this.emit('error', error)); + this.device.on('data', (data) => { + // Button press + if (data[0] === 0x01) { + const keyData = data.subarray(1); + this.emit('input', keyData); + } + }); + } + async close() { + await this.device.close(); + } + async sendFeatureReport(data) { + await this.device.sendFeatureReport(Buffer.from(data)); // Future: avoid re-wrap + } + async getFeatureReport(reportId, reportLength) { + return this.device.getFeatureReport(reportId, reportLength); + } + async sendReports(buffers) { + const ps = []; + for (const data of buffers) { + ps.push(this.device.write(Buffer.from(data))); // Future: avoid re-wrap + } + await Promise.all(ps); + } + async getDeviceInfo() { + const info = await this.device.getDeviceInfo(); + return { + path: info.path, + productId: info.productId, + vendorId: info.vendorId, + }; + } + async getChildDeviceInfo() { + // Not supported + return null; + } +} +exports.NodeHIDDevice = NodeHIDDevice; +//# sourceMappingURL=hid-device.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node/dist/hid-device.js.map b/node_modules/@elgato-stream-deck/node/dist/hid-device.js.map new file mode 100644 index 0000000..5255325 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/dist/hid-device.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hid-device.js","sourceRoot":"","sources":["../src/hid-device.ts"],"names":[],"mappings":";;;AAEA,iDAA4C;AAe5C;;;GAGG;AACH,MAAa,aAAc,SAAQ,4BAA6B;IACvD,MAAM,CAAU;IAExB,YAAY,MAAgB;QAC3B,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;QAE7D,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAA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B,CAAA;IACF,CAAC;IAEM,KAAK,CAAC,kBAAkB;QAC9B,gBAAgB;QAChB,OAAO,IAAI,CAAA;IACZ,CAAC;CACD;AAlDD,sCAkDC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node/dist/index.d.ts b/node_modules/@elgato-stream-deck/node/dist/index.d.ts new file mode 100644 index 0000000..d392274 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/dist/index.d.ts @@ -0,0 +1,29 @@ +import type { OpenStreamDeckOptions, StreamDeck } from '@elgato-stream-deck/core'; +import * as HID from 'node-hid'; +import { StreamDeckDeviceInfo } from './hid-device.js'; +import { JPEGEncodeOptions } from '@elgato-stream-deck/node-lib'; +export { VENDOR_ID, CORSAIR_VENDOR_ID, DeviceModelId, KeyIndex, StreamDeck, StreamDeckProxy, LcdPosition, Dimension, StreamDeckControlDefinitionBase, StreamDeckButtonControlDefinition, StreamDeckButtonControlDefinitionNoFeedback, StreamDeckButtonControlDefinitionRgbFeedback, StreamDeckButtonControlDefinitionLcdFeedback, StreamDeckEncoderControlDefinition, StreamDeckLcdSegmentControlDefinition, StreamDeckControlDefinition, StreamDeckTcpChildDeviceInfo, OpenStreamDeckOptions, PreparedBuffer, getStreamDeckModelName, } from '@elgato-stream-deck/core'; +export { StreamDeckDeviceInfo, JPEGEncodeOptions }; +export interface OpenStreamDeckOptionsNode extends OpenStreamDeckOptions { + jpegOptions?: JPEGEncodeOptions; + resetToLogoOnClose?: boolean; +} +/** + * Scan for and list detected devices + */ +export declare function listStreamDecks(): Promise; +/** + * If the provided device is a streamdeck, get the info about it + */ +export declare function getStreamDeckDeviceInfo(dev: HID.Device): StreamDeckDeviceInfo | null; +/** + * Get the info of a device if the given path is a streamdeck + */ +export declare function getStreamDeckInfo(path: string): Promise; +/** + * Open a streamdeck + * @param devicePath The path of the device to open. + * @param userOptions Options to customise the device behvaiour + */ +export declare function openStreamDeck(devicePath: string, userOptions?: OpenStreamDeckOptionsNode): Promise; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node/dist/index.d.ts.map b/node_modules/@elgato-stream-deck/node/dist/index.d.ts.map new file mode 100644 index 0000000..618c59c --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/dist/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAEjF,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAiB,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAErE,OAAO,EAAc,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAE5E,OAAO,EACN,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,UAAU,EACV,eAAe,EACf,WAAW,EACX,SAAS,EACT,+BAA+B,EAC/B,iCAAiC,EACjC,2CAA2C,EAC3C,4CAA4C,EAC5C,4CAA4C,EAC5C,kCAAkC,EAClC,qCAAqC,EACrC,2BAA2B,EAC3B,4BAA4B,EAC5B,qBAAqB,EACrB,cAAc,EACd,sBAAsB,GACtB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,CAAA;AAElD,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB;IACvE,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAC/B,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC,CASvE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAYpF;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAG/F;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,UAAU,CAAC,CAgCrH"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node/dist/index.js b/node_modules/@elgato-stream-deck/node/dist/index.js new file mode 100644 index 0000000..9230839 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/dist/index.js @@ -0,0 +1,89 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getStreamDeckModelName = exports.StreamDeckProxy = exports.DeviceModelId = exports.CORSAIR_VENDOR_ID = exports.VENDOR_ID = void 0; +exports.listStreamDecks = listStreamDecks; +exports.getStreamDeckDeviceInfo = getStreamDeckDeviceInfo; +exports.getStreamDeckInfo = getStreamDeckInfo; +exports.openStreamDeck = openStreamDeck; +const core_1 = require("@elgato-stream-deck/core"); +const HID = require("node-hid"); +const hid_device_js_1 = require("./hid-device.js"); +const wrapper_js_1 = require("./wrapper.js"); +const node_lib_1 = require("@elgato-stream-deck/node-lib"); +var core_2 = require("@elgato-stream-deck/core"); +Object.defineProperty(exports, "VENDOR_ID", { enumerable: true, get: function () { return core_2.VENDOR_ID; } }); +Object.defineProperty(exports, "CORSAIR_VENDOR_ID", { enumerable: true, get: function () { return core_2.CORSAIR_VENDOR_ID; } }); +Object.defineProperty(exports, "DeviceModelId", { enumerable: true, get: function () { return core_2.DeviceModelId; } }); +Object.defineProperty(exports, "StreamDeckProxy", { enumerable: true, get: function () { return core_2.StreamDeckProxy; } }); +Object.defineProperty(exports, "getStreamDeckModelName", { enumerable: true, get: function () { return core_2.getStreamDeckModelName; } }); +/** + * Scan for and list detected devices + */ +async function listStreamDecks() { + const devices = {}; + for (const dev of await HID.devicesAsync()) { + if (dev.path && !devices[dev.path]) { + const info = getStreamDeckDeviceInfo(dev); + if (info) + devices[dev.path] = info; + } + } + return Object.values(devices); +} +/** + * If the provided device is a streamdeck, get the info about it + */ +function getStreamDeckDeviceInfo(dev) { + const model = core_1.DEVICE_MODELS.find((m) => m.productIds.includes(dev.productId) && m.vendorId === dev.vendorId); + if (!model || !dev.path) + return null; + if (model.hidUsage !== undefined && dev.usage !== model.hidUsage) + return null; + if (model.hidInterface !== undefined && dev.interface !== model.hidInterface) + return null; + return { + model: model.id, + path: dev.path, + serialNumber: dev.serialNumber, + }; +} +/** + * Get the info of a device if the given path is a streamdeck + */ +async function getStreamDeckInfo(path) { + const allDevices = await listStreamDecks(); + return allDevices.find((dev) => dev.path === path); +} +/** + * Open a streamdeck + * @param devicePath The path of the device to open. + * @param userOptions Options to customise the device behvaiour + */ +async function openStreamDeck(devicePath, userOptions) { + // Clone the options, to ensure they dont get changed + const jpegOptions = userOptions?.jpegOptions + ? { ...userOptions.jpegOptions } + : undefined; + const options = { + encodeJPEG: async (buffer, width, height) => (0, node_lib_1.encodeJPEG)(buffer, width, height, jpegOptions), + ...userOptions, + }; + let device; + try { + const hidDevice = await HID.HIDAsync.open(devicePath); + device = new hid_device_js_1.NodeHIDDevice(hidDevice); + const deviceInfo = await device.getDeviceInfo(); + const model = core_1.DEVICE_MODELS.find((m) => deviceInfo.vendorId === m.vendorId && m.productIds.includes(deviceInfo.productId)); + if (!model) { + throw new Error('Stream Deck is of unexpected type.'); + } + const rawSteamdeck = await Promise.resolve(model.factory(device, options)); + return new wrapper_js_1.StreamDeckNode(rawSteamdeck, userOptions?.resetToLogoOnClose ?? false); + } + catch (e) { + if (device) + await device.close().catch(() => null); // Suppress error + throw e; + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node/dist/index.js.map b/node_modules/@elgato-stream-deck/node/dist/index.js.map new file mode 100644 index 0000000..cef07a6 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAwCA,0CASC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AQ,CAAC,UAAU,CAAC,SAAS,CAAC,CACxF,CAAA;QACD,IAAI,CAAC,KAAK,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;QACtD,CAAC;QAED,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;QAC1E,OAAO,IAAI,2BAAc,CAAC,YAAY,EAAE,WAAW,EAAE,kBAAkB,IAAI,KAAK,CAAC,CAAA;IAClF,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACZ,IAAI,MAAM;YAAE,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA,CAAC,iBAAiB;QACpE,MAAM,CAAC,CAAA;IACR,CAAC;AACF,CAAC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node/dist/tsconfig.build.tsbuildinfo b/node_modules/@elgato-stream-deck/node/dist/tsconfig.build.tsbuildinfo new file mode 100644 index 0000000..f89b03e --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/dist/tsconfig.build.tsbuildinfo @@ -0,0 +1 @@ +{"root":["../src/hid-device.ts","../src/index.ts","../src/wrapper.ts"],"version":"5.9.3"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node/dist/wrapper.d.ts b/node_modules/@elgato-stream-deck/node/dist/wrapper.d.ts new file mode 100644 index 0000000..fe77985 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/dist/wrapper.d.ts @@ -0,0 +1,8 @@ +import type { StreamDeck } from '@elgato-stream-deck/core'; +import { StreamDeckProxy } from '@elgato-stream-deck/core'; +export declare class StreamDeckNode extends StreamDeckProxy { + private readonly resetToLogoOnClose; + constructor(device: StreamDeck, resetToLogoOnClose: boolean); + close(): Promise; +} +//# sourceMappingURL=wrapper.d.ts.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node/dist/wrapper.d.ts.map b/node_modules/@elgato-stream-deck/node/dist/wrapper.d.ts.map new file mode 100644 index 0000000..4a50bc5 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/dist/wrapper.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../src/wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE1D,qBAAa,cAAe,SAAQ,eAAe;IAGjD,OAAO,CAAC,QAAQ,CAAC,kBAAkB;gBADnC,MAAM,EAAE,UAAU,EACD,kBAAkB,EAAE,OAAO;IAKhC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAMnC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node/dist/wrapper.js b/node_modules/@elgato-stream-deck/node/dist/wrapper.js new file mode 100644 index 0000000..940857d --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/dist/wrapper.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamDeckNode = void 0; +const core_1 = require("@elgato-stream-deck/core"); +class StreamDeckNode extends core_1.StreamDeckProxy { + resetToLogoOnClose; + constructor(device, resetToLogoOnClose) { + super(device); + this.resetToLogoOnClose = resetToLogoOnClose; + } + async close() { + if (this.resetToLogoOnClose) { + await this.resetToLogo(); + } + await super.close(); + } +} +exports.StreamDeckNode = StreamDeckNode; +//# sourceMappingURL=wrapper.js.map \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node/dist/wrapper.js.map b/node_modules/@elgato-stream-deck/node/dist/wrapper.js.map new file mode 100644 index 0000000..c6a87bd --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/dist/wrapper.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../src/wrapper.ts"],"names":[],"mappings":";;;AACA,mDAA0D;AAE1D,MAAa,cAAe,SAAQ,sBAAe;IAGhC;IAFlB,YACC,MAAkB,EACD,kBAA2B;QAE5C,KAAK,CAAC,MAAM,CAAC,CAAA;QAFI,uBAAkB,GAAlB,kBAAkB,CAAS;IAG7C,CAAC;IAEM,KAAK,CAAC,KAAK;QACjB,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC7B,MAAM,IAAI,CAAC,WAAW,EAAE,CAAA;QACzB,CAAC;QACD,MAAM,KAAK,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;CACD;AAdD,wCAcC"} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node/package.json b/node_modules/@elgato-stream-deck/node/package.json new file mode 100644 index 0000000..4509c93 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/package.json @@ -0,0 +1,63 @@ +{ + "name": "@elgato-stream-deck/node", + "version": "7.5.2", + "description": "An npm module for interfacing with the Elgato Stream Deck in node", + "main": "dist/index.js", + "typings": "dist/index.d.ts", + "license": "MIT", + "homepage": "https://github.com/julusian/node-elgato-stream-deck#readme", + "repository": { + "type": "git", + "url": "https://github.com/Julusian/node-elgato-stream-deck", + "directory": "packages/node" + }, + "bugs": { + "url": "https://github.com/julusian/node-elgato-stream-deck/issues" + }, + "author": { + "name": "Julian Waller", + "email": "git@julusian.co.uk" + }, + "contributors": [ + { + "name": "Håkon Nessjøen", + "email": "haakon@bitfocus.io" + }, + { + "name": "Richard Fox", + "twitter": "ProbablePrime" + }, + { + "name": "Chris Hanel", + "twitter": "chrishanel", + "email": "chrishanel@gmail.com", + "url": "http://www.chrishanel.com/" + } + ], + "keywords": [ + "elgato", + "stream", + "deck", + "streamdeck", + "hid", + "usb", + "hardware", + "interface", + "controller" + ], + "files": [ + "dist", + "udev", + "udev-generator-rules.json" + ], + "engines": { + "node": ">=18.18" + }, + "dependencies": { + "@elgato-stream-deck/core": "7.5.2", + "@elgato-stream-deck/node-lib": "7.5.2", + "eventemitter3": "^5.0.4", + "node-hid": "^3.2.0", + "tslib": "^2.8.1" + } +} \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node/udev-generator-rules.json b/node_modules/@elgato-stream-deck/node/udev-generator-rules.json new file mode 100644 index 0000000..33a0eef --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/udev-generator-rules.json @@ -0,0 +1,29 @@ +[ + { + "vendorId": 4057, + "productIds": [ + 96, + 99, + 144, + 179, + 108, + 143, + 109, + 128, + 165, + 132, + 134, + 154, + 170, + 184, + 185, + 186 + ] + }, + { + "vendorId": 6940, + "productIds": [ + 11032 + ] + } +] \ No newline at end of file diff --git a/node_modules/@elgato-stream-deck/node/udev/50-elgato-stream-deck-headless.rules b/node_modules/@elgato-stream-deck/node/udev/50-elgato-stream-deck-headless.rules new file mode 100644 index 0000000..c70d876 --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/udev/50-elgato-stream-deck-headless.rules @@ -0,0 +1,19 @@ +SUBSYSTEM=="input", GROUP="input", MODE="0660" + +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0060", MODE:="660", GROUP="plugdev" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0063", MODE:="660", GROUP="plugdev" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006c", MODE:="660", GROUP="plugdev" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006d", MODE:="660", GROUP="plugdev" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0080", MODE:="660", GROUP="plugdev" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0084", MODE:="660", GROUP="plugdev" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0086", MODE:="660", GROUP="plugdev" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="008f", MODE:="660", GROUP="plugdev" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0090", MODE:="660", GROUP="plugdev" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="009a", MODE:="660", GROUP="plugdev" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="00a5", MODE:="660", GROUP="plugdev" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="00aa", MODE:="660", GROUP="plugdev" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="00b3", MODE:="660", GROUP="plugdev" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="00b8", MODE:="660", GROUP="plugdev" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="00b9", MODE:="660", GROUP="plugdev" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="00ba", MODE:="660", GROUP="plugdev" +KERNEL=="hidraw*", ATTRS{idVendor}=="1b1c", ATTRS{idProduct}=="2b18", MODE:="660", GROUP="plugdev" diff --git a/node_modules/@elgato-stream-deck/node/udev/50-elgato-stream-deck-user.rules b/node_modules/@elgato-stream-deck/node/udev/50-elgato-stream-deck-user.rules new file mode 100644 index 0000000..c1126ce --- /dev/null +++ b/node_modules/@elgato-stream-deck/node/udev/50-elgato-stream-deck-user.rules @@ -0,0 +1,19 @@ +SUBSYSTEM=="input", GROUP="input", MODE="0660" + +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0060", MODE:="660", TAG+="uaccess" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0063", MODE:="660", TAG+="uaccess" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006c", MODE:="660", TAG+="uaccess" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006d", MODE:="660", TAG+="uaccess" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0080", MODE:="660", TAG+="uaccess" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0084", MODE:="660", TAG+="uaccess" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0086", MODE:="660", TAG+="uaccess" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="008f", MODE:="660", TAG+="uaccess" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0090", MODE:="660", TAG+="uaccess" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="009a", MODE:="660", TAG+="uaccess" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="00a5", MODE:="660", TAG+="uaccess" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="00aa", MODE:="660", TAG+="uaccess" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="00b3", MODE:="660", TAG+="uaccess" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="00b8", MODE:="660", TAG+="uaccess" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="00b9", MODE:="660", TAG+="uaccess" +KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="00ba", MODE:="660", TAG+="uaccess" +KERNEL=="hidraw*", ATTRS{idVendor}=="1b1c", ATTRS{idProduct}=="2b18", MODE:="660", TAG+="uaccess" diff --git a/node_modules/@isaacs/fs-minipass/LICENSE b/node_modules/@isaacs/fs-minipass/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@isaacs/fs-minipass/README.md b/node_modules/@isaacs/fs-minipass/README.md new file mode 100644 index 0000000..dac96e7 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/README.md @@ -0,0 +1,71 @@ +# fs-minipass + +Filesystem streams based on [minipass](http://npm.im/minipass). + +4 classes are exported: + +- ReadStream +- ReadStreamSync +- WriteStream +- WriteStreamSync + +When using `ReadStreamSync`, all of the data is made available +immediately upon consuming the stream. Nothing is buffered in memory +when the stream is constructed. If the stream is piped to a writer, +then it will synchronously `read()` and emit data into the writer as +fast as the writer can consume it. (That is, it will respect +backpressure.) If you call `stream.read()` then it will read the +entire file and return the contents. + +When using `WriteStreamSync`, every write is flushed to the file +synchronously. If your writes all come in a single tick, then it'll +write it all out in a single tick. It's as synchronous as you are. + +The async versions work much like their node builtin counterparts, +with the exception of introducing significantly less Stream machinery +overhead. + +## USAGE + +It's just streams, you pipe them or read() them or write() to them. + +```js +import { ReadStream, WriteStream } from 'fs-minipass' +// or: const { ReadStream, WriteStream } = require('fs-minipass') +const readStream = new ReadStream('file.txt') +const writeStream = new WriteStream('output.txt') +writeStream.write('some file header or whatever\n') +readStream.pipe(writeStream) +``` + +## ReadStream(path, options) + +Path string is required, but somewhat irrelevant if an open file +descriptor is passed in as an option. + +Options: + +- `fd` Pass in a numeric file descriptor, if the file is already open. +- `readSize` The size of reads to do, defaults to 16MB +- `size` The size of the file, if known. Prevents zero-byte read() + call at the end. +- `autoClose` Set to `false` to prevent the file descriptor from being + closed when the file is done being read. + +## WriteStream(path, options) + +Path string is required, but somewhat irrelevant if an open file +descriptor is passed in as an option. + +Options: + +- `fd` Pass in a numeric file descriptor, if the file is already open. +- `mode` The mode to create the file with. Defaults to `0o666`. +- `start` The position in the file to start reading. If not + specified, then the file will start writing at position zero, and be + truncated by default. +- `autoClose` Set to `false` to prevent the file descriptor from being + closed when the stream is ended. +- `flags` Flags to use when opening the file. Irrelevant if `fd` is + passed in, since file won't be opened in that case. Defaults to + `'a'` if a `pos` is specified, or `'w'` otherwise. diff --git a/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts new file mode 100644 index 0000000..38e8ccd --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts @@ -0,0 +1,118 @@ +/// +/// +/// +import EE from 'events'; +import { Minipass } from 'minipass'; +declare const _autoClose: unique symbol; +declare const _close: unique symbol; +declare const _ended: unique symbol; +declare const _fd: unique symbol; +declare const _finished: unique symbol; +declare const _flags: unique symbol; +declare const _flush: unique symbol; +declare const _handleChunk: unique symbol; +declare const _makeBuf: unique symbol; +declare const _mode: unique symbol; +declare const _needDrain: unique symbol; +declare const _onerror: unique symbol; +declare const _onopen: unique symbol; +declare const _onread: unique symbol; +declare const _onwrite: unique symbol; +declare const _open: unique symbol; +declare const _path: unique symbol; +declare const _pos: unique symbol; +declare const _queue: unique symbol; +declare const _read: unique symbol; +declare const _readSize: unique symbol; +declare const _reading: unique symbol; +declare const _remain: unique symbol; +declare const _size: unique symbol; +declare const _write: unique symbol; +declare const _writing: unique symbol; +declare const _defaultFlag: unique symbol; +declare const _errored: unique symbol; +export type ReadStreamOptions = Minipass.Options & { + fd?: number; + readSize?: number; + size?: number; + autoClose?: boolean; +}; +export type ReadStreamEvents = Minipass.Events & { + open: [fd: number]; +}; +export declare class ReadStream extends Minipass { + [_errored]: boolean; + [_fd]?: number; + [_path]: string; + [_readSize]: number; + [_reading]: boolean; + [_size]: number; + [_remain]: number; + [_autoClose]: boolean; + constructor(path: string, opt: ReadStreamOptions); + get fd(): number | undefined; + get path(): string; + write(): void; + end(): void; + [_open](): void; + [_onopen](er?: NodeJS.ErrnoException | null, fd?: number): void; + [_makeBuf](): Buffer; + [_read](): void; + [_onread](er?: NodeJS.ErrnoException | null, br?: number, buf?: Buffer): void; + [_close](): void; + [_onerror](er: NodeJS.ErrnoException): void; + [_handleChunk](br: number, buf: Buffer): boolean; + emit(ev: Event, ...args: ReadStreamEvents[Event]): boolean; +} +export declare class ReadStreamSync extends ReadStream { + [_open](): void; + [_read](): void; + [_close](): void; +} +export type WriteStreamOptions = { + fd?: number; + autoClose?: boolean; + mode?: number; + captureRejections?: boolean; + start?: number; + flags?: string; +}; +export declare class WriteStream extends EE { + readable: false; + writable: boolean; + [_errored]: boolean; + [_writing]: boolean; + [_ended]: boolean; + [_queue]: Buffer[]; + [_needDrain]: boolean; + [_path]: string; + [_mode]: number; + [_autoClose]: boolean; + [_fd]?: number; + [_defaultFlag]: boolean; + [_flags]: string; + [_finished]: boolean; + [_pos]?: number; + constructor(path: string, opt: WriteStreamOptions); + emit(ev: string, ...args: any[]): boolean; + get fd(): number | undefined; + get path(): string; + [_onerror](er: NodeJS.ErrnoException): void; + [_open](): void; + [_onopen](er?: null | NodeJS.ErrnoException, fd?: number): void; + end(buf: string, enc?: BufferEncoding): this; + end(buf?: Buffer, enc?: undefined): this; + write(buf: string, enc?: BufferEncoding): boolean; + write(buf: Buffer, enc?: undefined): boolean; + [_write](buf: Buffer): void; + [_onwrite](er?: null | NodeJS.ErrnoException, bw?: number): void; + [_flush](): void; + [_close](): void; +} +export declare class WriteStreamSync extends WriteStream { + [_open](): void; + [_close](): void; + [_write](buf: Buffer): void; +} +export {}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts.map b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000..3e2c703 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAInC,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,GAAG,eAAgB,CAAA;AACzB,QAAA,MAAM,SAAS,eAAsB,CAAA;AACrC,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,YAAY,eAAyB,CAAA;AAC3C,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,IAAI,eAAiB,CAAA;AAC3B,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,SAAS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EAAE,IAAI,GAAG,MAAM,CAAC,cAAc,EAAE,EAAE,CAAC,EAAE,MAAM;IAwBzD,CAAC,MAAM,CAAC;IAgBR,CAAC,MAAM,CAAC;CAST;AAED,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,CAAC,KAAK,CAAC,IAAI,IAAI;IAsBf,CAAC,MAAM,CAAC;IASR,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM;CAmBrB"} \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js new file mode 100644 index 0000000..2b3178c --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js @@ -0,0 +1,430 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WriteStreamSync = exports.WriteStream = exports.ReadStreamSync = exports.ReadStream = void 0; +const events_1 = __importDefault(require("events")); +const fs_1 = __importDefault(require("fs")); +const minipass_1 = require("minipass"); +const writev = fs_1.default.writev; +const _autoClose = Symbol('_autoClose'); +const _close = Symbol('_close'); +const _ended = Symbol('_ended'); +const _fd = Symbol('_fd'); +const _finished = Symbol('_finished'); +const _flags = Symbol('_flags'); +const _flush = Symbol('_flush'); +const _handleChunk = Symbol('_handleChunk'); +const _makeBuf = Symbol('_makeBuf'); +const _mode = Symbol('_mode'); +const _needDrain = Symbol('_needDrain'); +const _onerror = Symbol('_onerror'); +const _onopen = Symbol('_onopen'); +const _onread = Symbol('_onread'); +const _onwrite = Symbol('_onwrite'); +const _open = Symbol('_open'); +const _path = Symbol('_path'); +const _pos = Symbol('_pos'); +const _queue = Symbol('_queue'); +const _read = Symbol('_read'); +const _readSize = Symbol('_readSize'); +const _reading = Symbol('_reading'); +const _remain = Symbol('_remain'); +const _size = Symbol('_size'); +const _write = Symbol('_write'); +const _writing = Symbol('_writing'); +const _defaultFlag = Symbol('_defaultFlag'); +const _errored = Symbol('_errored'); +class ReadStream extends minipass_1.Minipass { + [_errored] = false; + [_fd]; + [_path]; + [_readSize]; + [_reading] = false; + [_size]; + [_remain]; + [_autoClose]; + constructor(path, opt) { + opt = opt || {}; + super(opt); + this.readable = true; + this.writable = false; + if (typeof path !== 'string') { + throw new TypeError('path must be a string'); + } + this[_errored] = false; + this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined; + this[_path] = path; + this[_readSize] = opt.readSize || 16 * 1024 * 1024; + this[_reading] = false; + this[_size] = typeof opt.size === 'number' ? opt.size : Infinity; + this[_remain] = this[_size]; + this[_autoClose] = + typeof opt.autoClose === 'boolean' ? opt.autoClose : true; + if (typeof this[_fd] === 'number') { + this[_read](); + } + else { + this[_open](); + } + } + get fd() { + return this[_fd]; + } + get path() { + return this[_path]; + } + //@ts-ignore + write() { + throw new TypeError('this is a readable stream'); + } + //@ts-ignore + end() { + throw new TypeError('this is a readable stream'); + } + [_open]() { + fs_1.default.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd)); + } + [_onopen](er, fd) { + if (er) { + this[_onerror](er); + } + else { + this[_fd] = fd; + this.emit('open', fd); + this[_read](); + } + } + [_makeBuf]() { + return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain])); + } + [_read]() { + if (!this[_reading]) { + this[_reading] = true; + const buf = this[_makeBuf](); + /* c8 ignore start */ + if (buf.length === 0) { + return process.nextTick(() => this[_onread](null, 0, buf)); + } + /* c8 ignore stop */ + fs_1.default.read(this[_fd], buf, 0, buf.length, null, (er, br, b) => this[_onread](er, br, b)); + } + } + [_onread](er, br, buf) { + this[_reading] = false; + if (er) { + this[_onerror](er); + } + else if (this[_handleChunk](br, buf)) { + this[_read](); + } + } + [_close]() { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd]; + this[_fd] = undefined; + fs_1.default.close(fd, er => er ? this.emit('error', er) : this.emit('close')); + } + } + [_onerror](er) { + this[_reading] = true; + this[_close](); + this.emit('error', er); + } + [_handleChunk](br, buf) { + let ret = false; + // no effect if infinite + this[_remain] -= br; + if (br > 0) { + ret = super.write(br < buf.length ? buf.subarray(0, br) : buf); + } + if (br === 0 || this[_remain] <= 0) { + ret = false; + this[_close](); + super.end(); + } + return ret; + } + emit(ev, ...args) { + switch (ev) { + case 'prefinish': + case 'finish': + return false; + case 'drain': + if (typeof this[_fd] === 'number') { + this[_read](); + } + return false; + case 'error': + if (this[_errored]) { + return false; + } + this[_errored] = true; + return super.emit(ev, ...args); + default: + return super.emit(ev, ...args); + } + } +} +exports.ReadStream = ReadStream; +class ReadStreamSync extends ReadStream { + [_open]() { + let threw = true; + try { + this[_onopen](null, fs_1.default.openSync(this[_path], 'r')); + threw = false; + } + finally { + if (threw) { + this[_close](); + } + } + } + [_read]() { + let threw = true; + try { + if (!this[_reading]) { + this[_reading] = true; + do { + const buf = this[_makeBuf](); + /* c8 ignore start */ + const br = buf.length === 0 + ? 0 + : fs_1.default.readSync(this[_fd], buf, 0, buf.length, null); + /* c8 ignore stop */ + if (!this[_handleChunk](br, buf)) { + break; + } + } while (true); + this[_reading] = false; + } + threw = false; + } + finally { + if (threw) { + this[_close](); + } + } + } + [_close]() { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd]; + this[_fd] = undefined; + fs_1.default.closeSync(fd); + this.emit('close'); + } + } +} +exports.ReadStreamSync = ReadStreamSync; +class WriteStream extends events_1.default { + readable = false; + writable = true; + [_errored] = false; + [_writing] = false; + [_ended] = false; + [_queue] = []; + [_needDrain] = false; + [_path]; + [_mode]; + [_autoClose]; + [_fd]; + [_defaultFlag]; + [_flags]; + [_finished] = false; + [_pos]; + constructor(path, opt) { + opt = opt || {}; + super(opt); + this[_path] = path; + this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined; + this[_mode] = opt.mode === undefined ? 0o666 : opt.mode; + this[_pos] = typeof opt.start === 'number' ? opt.start : undefined; + this[_autoClose] = + typeof opt.autoClose === 'boolean' ? opt.autoClose : true; + // truncating makes no sense when writing into the middle + const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w'; + this[_defaultFlag] = opt.flags === undefined; + this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags; + if (this[_fd] === undefined) { + this[_open](); + } + } + emit(ev, ...args) { + if (ev === 'error') { + if (this[_errored]) { + return false; + } + this[_errored] = true; + } + return super.emit(ev, ...args); + } + get fd() { + return this[_fd]; + } + get path() { + return this[_path]; + } + [_onerror](er) { + this[_close](); + this[_writing] = true; + this.emit('error', er); + } + [_open]() { + fs_1.default.open(this[_path], this[_flags], this[_mode], (er, fd) => this[_onopen](er, fd)); + } + [_onopen](er, fd) { + if (this[_defaultFlag] && + this[_flags] === 'r+' && + er && + er.code === 'ENOENT') { + this[_flags] = 'w'; + this[_open](); + } + else if (er) { + this[_onerror](er); + } + else { + this[_fd] = fd; + this.emit('open', fd); + if (!this[_writing]) { + this[_flush](); + } + } + } + end(buf, enc) { + if (buf) { + //@ts-ignore + this.write(buf, enc); + } + this[_ended] = true; + // synthetic after-write logic, where drain/finish live + if (!this[_writing] && + !this[_queue].length && + typeof this[_fd] === 'number') { + this[_onwrite](null, 0); + } + return this; + } + write(buf, enc) { + if (typeof buf === 'string') { + buf = Buffer.from(buf, enc); + } + if (this[_ended]) { + this.emit('error', new Error('write() after end()')); + return false; + } + if (this[_fd] === undefined || this[_writing] || this[_queue].length) { + this[_queue].push(buf); + this[_needDrain] = true; + return false; + } + this[_writing] = true; + this[_write](buf); + return true; + } + [_write](buf) { + fs_1.default.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => this[_onwrite](er, bw)); + } + [_onwrite](er, bw) { + if (er) { + this[_onerror](er); + } + else { + if (this[_pos] !== undefined && typeof bw === 'number') { + this[_pos] += bw; + } + if (this[_queue].length) { + this[_flush](); + } + else { + this[_writing] = false; + if (this[_ended] && !this[_finished]) { + this[_finished] = true; + this[_close](); + this.emit('finish'); + } + else if (this[_needDrain]) { + this[_needDrain] = false; + this.emit('drain'); + } + } + } + } + [_flush]() { + if (this[_queue].length === 0) { + if (this[_ended]) { + this[_onwrite](null, 0); + } + } + else if (this[_queue].length === 1) { + this[_write](this[_queue].pop()); + } + else { + const iovec = this[_queue]; + this[_queue] = []; + writev(this[_fd], iovec, this[_pos], (er, bw) => this[_onwrite](er, bw)); + } + } + [_close]() { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd]; + this[_fd] = undefined; + fs_1.default.close(fd, er => er ? this.emit('error', er) : this.emit('close')); + } + } +} +exports.WriteStream = WriteStream; +class WriteStreamSync extends WriteStream { + [_open]() { + let fd; + // only wrap in a try{} block if we know we'll retry, to avoid + // the rethrow obscuring the error's source frame in most cases. + if (this[_defaultFlag] && this[_flags] === 'r+') { + try { + fd = fs_1.default.openSync(this[_path], this[_flags], this[_mode]); + } + catch (er) { + if (er?.code === 'ENOENT') { + this[_flags] = 'w'; + return this[_open](); + } + else { + throw er; + } + } + } + else { + fd = fs_1.default.openSync(this[_path], this[_flags], this[_mode]); + } + this[_onopen](null, fd); + } + [_close]() { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd]; + this[_fd] = undefined; + fs_1.default.closeSync(fd); + this.emit('close'); + } + } + [_write](buf) { + // throw the original, but try to close if it fails + let threw = true; + try { + this[_onwrite](null, fs_1.default.writeSync(this[_fd], buf, 0, buf.length, this[_pos])); + threw = false; + } + finally { + if (threw) { + try { + this[_close](); + } + catch { + // ok error + } + } + } + } +} +exports.WriteStreamSync = WriteStreamSync; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js.map b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js.map new file mode 100644 index 0000000..caee495 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAu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A;QACf,CAAC;gBAAS,CAAC;YACT,IAAI,KAAK,EAAE,CAAC;gBACV,IAAI,CAAC;oBACH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAA;gBAChB,CAAC;gBAAC,MAAM,CAAC;oBACP,WAAW;gBACb,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAnDD,0CAmDC","sourcesContent":["import EE from 'events'\nimport fs from 'fs'\nimport { Minipass } from 'minipass'\n\nconst writev = fs.writev\n\nconst _autoClose = Symbol('_autoClose')\nconst _close = Symbol('_close')\nconst _ended = Symbol('_ended')\nconst _fd = Symbol('_fd')\nconst _finished = Symbol('_finished')\nconst _flags = Symbol('_flags')\nconst _flush = Symbol('_flush')\nconst _handleChunk = Symbol('_handleChunk')\nconst _makeBuf = Symbol('_makeBuf')\nconst _mode = Symbol('_mode')\nconst _needDrain = Symbol('_needDrain')\nconst _onerror = Symbol('_onerror')\nconst _onopen = Symbol('_onopen')\nconst _onread = Symbol('_onread')\nconst _onwrite = Symbol('_onwrite')\nconst _open = Symbol('_open')\nconst _path = Symbol('_path')\nconst _pos = Symbol('_pos')\nconst _queue = Symbol('_queue')\nconst _read = Symbol('_read')\nconst _readSize = Symbol('_readSize')\nconst _reading = Symbol('_reading')\nconst _remain = Symbol('_remain')\nconst _size = Symbol('_size')\nconst _write = Symbol('_write')\nconst _writing = Symbol('_writing')\nconst _defaultFlag = Symbol('_defaultFlag')\nconst _errored = Symbol('_errored')\n\nexport type ReadStreamOptions =\n Minipass.Options & {\n fd?: number\n readSize?: number\n size?: number\n autoClose?: boolean\n }\n\nexport type ReadStreamEvents = Minipass.Events & {\n open: [fd: number]\n}\n\nexport class ReadStream extends Minipass<\n Minipass.ContiguousData,\n Buffer,\n ReadStreamEvents\n> {\n [_errored]: boolean = false;\n [_fd]?: number;\n [_path]: string;\n [_readSize]: number;\n [_reading]: boolean = false;\n [_size]: number;\n [_remain]: number;\n [_autoClose]: boolean\n\n constructor(path: string, opt: ReadStreamOptions) {\n opt = opt || {}\n super(opt)\n\n this.readable = true\n this.writable = false\n\n if (typeof path !== 'string') {\n throw new TypeError('path must be a string')\n }\n\n this[_errored] = false\n this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined\n this[_path] = path\n this[_readSize] = opt.readSize || 16 * 1024 * 1024\n this[_reading] = false\n this[_size] = typeof opt.size === 'number' ? opt.size : Infinity\n this[_remain] = this[_size]\n this[_autoClose] =\n typeof opt.autoClose === 'boolean' ? opt.autoClose : true\n\n if (typeof this[_fd] === 'number') {\n this[_read]()\n } else {\n this[_open]()\n }\n }\n\n get fd() {\n return this[_fd]\n }\n\n get path() {\n return this[_path]\n }\n\n //@ts-ignore\n write() {\n throw new TypeError('this is a readable stream')\n }\n\n //@ts-ignore\n end() {\n throw new TypeError('this is a readable stream')\n }\n\n [_open]() {\n fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd))\n }\n\n [_onopen](er?: NodeJS.ErrnoException | null, fd?: number) {\n if (er) {\n this[_onerror](er)\n } else {\n this[_fd] = fd\n this.emit('open', fd as number)\n this[_read]()\n }\n }\n\n [_makeBuf]() {\n return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain]))\n }\n\n [_read]() {\n if (!this[_reading]) {\n this[_reading] = true\n const buf = this[_makeBuf]()\n /* c8 ignore start */\n if (buf.length === 0) {\n return process.nextTick(() => this[_onread](null, 0, buf))\n }\n /* c8 ignore stop */\n fs.read(this[_fd] as number, buf, 0, buf.length, null, (er, br, b) =>\n this[_onread](er, br, b),\n )\n }\n }\n\n [_onread](er?: NodeJS.ErrnoException | null, br?: number, buf?: Buffer) {\n this[_reading] = false\n if (er) {\n this[_onerror](er)\n } else if (this[_handleChunk](br as number, buf as Buffer)) {\n this[_read]()\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.close(fd, er =>\n er ? this.emit('error', er) : this.emit('close'),\n )\n }\n }\n\n [_onerror](er: NodeJS.ErrnoException) {\n this[_reading] = true\n this[_close]()\n this.emit('error', er)\n }\n\n [_handleChunk](br: number, buf: Buffer) {\n let ret = false\n // no effect if infinite\n this[_remain] -= br\n if (br > 0) {\n ret = super.write(br < buf.length ? buf.subarray(0, br) : buf)\n }\n\n if (br === 0 || this[_remain] <= 0) {\n ret = false\n this[_close]()\n super.end()\n }\n\n return ret\n }\n\n emit(\n ev: Event,\n ...args: ReadStreamEvents[Event]\n ): boolean {\n switch (ev) {\n case 'prefinish':\n case 'finish':\n return false\n\n case 'drain':\n if (typeof this[_fd] === 'number') {\n this[_read]()\n }\n return false\n\n case 'error':\n if (this[_errored]) {\n return false\n }\n this[_errored] = true\n return super.emit(ev, ...args)\n\n default:\n return super.emit(ev, ...args)\n }\n }\n}\n\nexport class ReadStreamSync extends ReadStream {\n [_open]() {\n let threw = true\n try {\n this[_onopen](null, fs.openSync(this[_path], 'r'))\n threw = false\n } finally {\n if (threw) {\n this[_close]()\n }\n }\n }\n\n [_read]() {\n let threw = true\n try {\n if (!this[_reading]) {\n this[_reading] = true\n do {\n const buf = this[_makeBuf]()\n /* c8 ignore start */\n const br =\n buf.length === 0\n ? 0\n : fs.readSync(this[_fd] as number, buf, 0, buf.length, null)\n /* c8 ignore stop */\n if (!this[_handleChunk](br, buf)) {\n break\n }\n } while (true)\n this[_reading] = false\n }\n threw = false\n } finally {\n if (threw) {\n this[_close]()\n }\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.closeSync(fd)\n this.emit('close')\n }\n }\n}\n\nexport type WriteStreamOptions = {\n fd?: number\n autoClose?: boolean\n mode?: number\n captureRejections?: boolean\n start?: number\n flags?: string\n}\n\nexport class WriteStream extends EE {\n readable: false = false\n writable: boolean = true;\n [_errored]: boolean = false;\n [_writing]: boolean = false;\n [_ended]: boolean = false;\n [_queue]: Buffer[] = [];\n [_needDrain]: boolean = false;\n [_path]: string;\n [_mode]: number;\n [_autoClose]: boolean;\n [_fd]?: number;\n [_defaultFlag]: boolean;\n [_flags]: string;\n [_finished]: boolean = false;\n [_pos]?: number\n\n constructor(path: string, opt: WriteStreamOptions) {\n opt = opt || {}\n super(opt)\n this[_path] = path\n this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined\n this[_mode] = opt.mode === undefined ? 0o666 : opt.mode\n this[_pos] = typeof opt.start === 'number' ? opt.start : undefined\n this[_autoClose] =\n typeof opt.autoClose === 'boolean' ? opt.autoClose : true\n\n // truncating makes no sense when writing into the middle\n const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w'\n this[_defaultFlag] = opt.flags === undefined\n this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags\n\n if (this[_fd] === undefined) {\n this[_open]()\n }\n }\n\n emit(ev: string, ...args: any[]) {\n if (ev === 'error') {\n if (this[_errored]) {\n return false\n }\n this[_errored] = true\n }\n return super.emit(ev, ...args)\n }\n\n get fd() {\n return this[_fd]\n }\n\n get path() {\n return this[_path]\n }\n\n [_onerror](er: NodeJS.ErrnoException) {\n this[_close]()\n this[_writing] = true\n this.emit('error', er)\n }\n\n [_open]() {\n fs.open(this[_path], this[_flags], this[_mode], (er, fd) =>\n this[_onopen](er, fd),\n )\n }\n\n [_onopen](er?: null | NodeJS.ErrnoException, fd?: number) {\n if (\n this[_defaultFlag] &&\n this[_flags] === 'r+' &&\n er &&\n er.code === 'ENOENT'\n ) {\n this[_flags] = 'w'\n this[_open]()\n } else if (er) {\n this[_onerror](er)\n } else {\n this[_fd] = fd\n this.emit('open', fd)\n if (!this[_writing]) {\n this[_flush]()\n }\n }\n }\n\n end(buf: string, enc?: BufferEncoding): this\n end(buf?: Buffer, enc?: undefined): this\n end(buf?: Buffer | string, enc?: BufferEncoding): this {\n if (buf) {\n //@ts-ignore\n this.write(buf, enc)\n }\n\n this[_ended] = true\n\n // synthetic after-write logic, where drain/finish live\n if (\n !this[_writing] &&\n !this[_queue].length &&\n typeof this[_fd] === 'number'\n ) {\n this[_onwrite](null, 0)\n }\n return this\n }\n\n write(buf: string, enc?: BufferEncoding): boolean\n write(buf: Buffer, enc?: undefined): boolean\n write(buf: Buffer | string, enc?: BufferEncoding): boolean {\n if (typeof buf === 'string') {\n buf = Buffer.from(buf, enc)\n }\n\n if (this[_ended]) {\n this.emit('error', new Error('write() after end()'))\n return false\n }\n\n if (this[_fd] === undefined || this[_writing] || this[_queue].length) {\n this[_queue].push(buf)\n this[_needDrain] = true\n return false\n }\n\n this[_writing] = true\n this[_write](buf)\n return true\n }\n\n [_write](buf: Buffer) {\n fs.write(\n this[_fd] as number,\n buf,\n 0,\n buf.length,\n this[_pos],\n (er, bw) => this[_onwrite](er, bw),\n )\n }\n\n [_onwrite](er?: null | NodeJS.ErrnoException, bw?: number) {\n if (er) {\n this[_onerror](er)\n } else {\n if (this[_pos] !== undefined && typeof bw === 'number') {\n this[_pos] += bw\n }\n if (this[_queue].length) {\n this[_flush]()\n } else {\n this[_writing] = false\n\n if (this[_ended] && !this[_finished]) {\n this[_finished] = true\n this[_close]()\n this.emit('finish')\n } else if (this[_needDrain]) {\n this[_needDrain] = false\n this.emit('drain')\n }\n }\n }\n }\n\n [_flush]() {\n if (this[_queue].length === 0) {\n if (this[_ended]) {\n this[_onwrite](null, 0)\n }\n } else if (this[_queue].length === 1) {\n this[_write](this[_queue].pop() as Buffer)\n } else {\n const iovec = this[_queue]\n this[_queue] = []\n writev(this[_fd] as number, iovec, this[_pos] as number, (er, bw) =>\n this[_onwrite](er, bw),\n )\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.close(fd, er =>\n er ? this.emit('error', er) : this.emit('close'),\n )\n }\n }\n}\n\nexport class WriteStreamSync extends WriteStream {\n [_open](): void {\n let fd\n // only wrap in a try{} block if we know we'll retry, to avoid\n // the rethrow obscuring the error's source frame in most cases.\n if (this[_defaultFlag] && this[_flags] === 'r+') {\n try {\n fd = fs.openSync(this[_path], this[_flags], this[_mode])\n } catch (er) {\n if ((er as NodeJS.ErrnoException)?.code === 'ENOENT') {\n this[_flags] = 'w'\n return this[_open]()\n } else {\n throw er\n }\n }\n } else {\n fd = fs.openSync(this[_path], this[_flags], this[_mode])\n }\n\n this[_onopen](null, fd)\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.closeSync(fd)\n this.emit('close')\n }\n }\n\n [_write](buf: Buffer) {\n // throw the original, but try to close if it fails\n let threw = true\n try {\n this[_onwrite](\n null,\n fs.writeSync(this[_fd] as number, buf, 0, buf.length, this[_pos]),\n )\n threw = false\n } finally {\n if (threw) {\n try {\n this[_close]()\n } catch {\n // ok error\n }\n }\n }\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json b/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json new file mode 100644 index 0000000..5bbefff --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts b/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts new file mode 100644 index 0000000..54aebe1 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts @@ -0,0 +1,118 @@ +/// +/// +/// +import EE from 'events'; +import { Minipass } from 'minipass'; +declare const _autoClose: unique symbol; +declare const _close: unique symbol; +declare const _ended: unique symbol; +declare const _fd: unique symbol; +declare const _finished: unique symbol; +declare const _flags: unique symbol; +declare const _flush: unique symbol; +declare const _handleChunk: unique symbol; +declare const _makeBuf: unique symbol; +declare const _mode: unique symbol; +declare const _needDrain: unique symbol; +declare const _onerror: unique symbol; +declare const _onopen: unique symbol; +declare const _onread: unique symbol; +declare const _onwrite: unique symbol; +declare const _open: unique symbol; +declare const _path: unique symbol; +declare const _pos: unique symbol; +declare const _queue: unique symbol; +declare const _read: unique symbol; +declare const _readSize: unique symbol; +declare const _reading: unique symbol; +declare const _remain: unique symbol; +declare const _size: unique symbol; +declare const _write: unique symbol; +declare const _writing: unique symbol; +declare const _defaultFlag: unique symbol; +declare const _errored: unique symbol; +export type ReadStreamOptions = Minipass.Options & { + fd?: number; + readSize?: number; + size?: number; + autoClose?: boolean; +}; +export type ReadStreamEvents = Minipass.Events & { + open: [fd: number]; +}; +export declare class ReadStream extends Minipass { + [_errored]: boolean; + [_fd]?: number; + [_path]: string; + [_readSize]: number; + [_reading]: boolean; + [_size]: number; + [_remain]: number; + [_autoClose]: boolean; + constructor(path: string, opt: ReadStreamOptions); + get fd(): number | undefined; + get path(): string; + write(): void; + end(): void; + [_open](): void; + [_onopen](er?: NodeJS.ErrnoException | null, fd?: number): void; + [_makeBuf](): Buffer; + [_read](): void; + [_onread](er?: NodeJS.ErrnoException | null, br?: number, buf?: Buffer): void; + [_close](): void; + [_onerror](er: NodeJS.ErrnoException): void; + [_handleChunk](br: number, buf: Buffer): boolean; + emit(ev: Event, ...args: ReadStreamEvents[Event]): boolean; +} +export declare class ReadStreamSync extends ReadStream { + [_open](): void; + [_read](): void; + [_close](): void; +} +export type WriteStreamOptions = { + fd?: number; + autoClose?: boolean; + mode?: number; + captureRejections?: boolean; + start?: number; + flags?: string; +}; +export declare class WriteStream extends EE { + readable: false; + writable: boolean; + [_errored]: boolean; + [_writing]: boolean; + [_ended]: boolean; + [_queue]: Buffer[]; + [_needDrain]: boolean; + [_path]: string; + [_mode]: number; + [_autoClose]: boolean; + [_fd]?: number; + [_defaultFlag]: boolean; + [_flags]: string; + [_finished]: boolean; + [_pos]?: number; + constructor(path: string, opt: WriteStreamOptions); + emit(ev: string, ...args: any[]): boolean; + get fd(): number | undefined; + get path(): string; + [_onerror](er: NodeJS.ErrnoException): void; + [_open](): void; + [_onopen](er?: null | NodeJS.ErrnoException, fd?: number): void; + end(buf: string, enc?: BufferEncoding): this; + end(buf?: Buffer, enc?: undefined): this; + write(buf: string, enc?: BufferEncoding): boolean; + write(buf: Buffer, enc?: undefined): boolean; + [_write](buf: Buffer): void; + [_onwrite](er?: null | NodeJS.ErrnoException, bw?: number): void; + [_flush](): void; + [_close](): void; +} +export declare class WriteStreamSync extends WriteStream { + [_open](): void; + [_close](): void; + [_write](buf: Buffer): void; +} +export {}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts.map b/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts.map new file mode 100644 index 0000000..3e2c703 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAInC,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,GAAG,eAAgB,CAAA;AACzB,QAAA,MAAM,SAAS,eAAsB,CAAA;AACrC,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,YAAY,eAAyB,CAAA;AAC3C,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,KAAK,eAAkB,CAAA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AM,EAAE,GAAG,CAAC,EAAE,SAAS,GAAG,OAAO;IAsB5C,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM;IAWpB,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,cAAc,EAAE,EAAE,CAAC,EAAE,MAAM;IAwBzD,CAAC,MAAM,CAAC;IAgBR,CAAC,MAAM,CAAC;CAST;AAED,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,CAAC,KAAK,CAAC,IAAI,IAAI;IAsBf,CAAC,MAAM,CAAC;IASR,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM;CAmBrB"} \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/dist/esm/index.js b/node_modules/@isaacs/fs-minipass/dist/esm/index.js new file mode 100644 index 0000000..287a0f6 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/esm/index.js @@ -0,0 +1,420 @@ +import EE from 'events'; +import fs from 'fs'; +import { Minipass } from 'minipass'; +const writev = fs.writev; +const _autoClose = Symbol('_autoClose'); +const _close = Symbol('_close'); +const _ended = Symbol('_ended'); +const _fd = Symbol('_fd'); +const _finished = Symbol('_finished'); +const _flags = Symbol('_flags'); +const _flush = Symbol('_flush'); +const _handleChunk = Symbol('_handleChunk'); +const _makeBuf = Symbol('_makeBuf'); +const _mode = Symbol('_mode'); +const _needDrain = Symbol('_needDrain'); +const _onerror = Symbol('_onerror'); +const _onopen = Symbol('_onopen'); +const _onread = Symbol('_onread'); +const _onwrite = Symbol('_onwrite'); +const _open = Symbol('_open'); +const _path = Symbol('_path'); +const _pos = Symbol('_pos'); +const _queue = Symbol('_queue'); +const _read = Symbol('_read'); +const _readSize = Symbol('_readSize'); +const _reading = Symbol('_reading'); +const _remain = Symbol('_remain'); +const _size = Symbol('_size'); +const _write = Symbol('_write'); +const _writing = Symbol('_writing'); +const _defaultFlag = Symbol('_defaultFlag'); +const _errored = Symbol('_errored'); +export class ReadStream extends Minipass { + [_errored] = false; + [_fd]; + [_path]; + [_readSize]; + [_reading] = false; + [_size]; + [_remain]; + [_autoClose]; + constructor(path, opt) { + opt = opt || {}; + super(opt); + this.readable = true; + this.writable = false; + if (typeof path !== 'string') { + throw new TypeError('path must be a string'); + } + this[_errored] = false; + this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined; + this[_path] = path; + this[_readSize] = opt.readSize || 16 * 1024 * 1024; + this[_reading] = false; + this[_size] = typeof opt.size === 'number' ? opt.size : Infinity; + this[_remain] = this[_size]; + this[_autoClose] = + typeof opt.autoClose === 'boolean' ? opt.autoClose : true; + if (typeof this[_fd] === 'number') { + this[_read](); + } + else { + this[_open](); + } + } + get fd() { + return this[_fd]; + } + get path() { + return this[_path]; + } + //@ts-ignore + write() { + throw new TypeError('this is a readable stream'); + } + //@ts-ignore + end() { + throw new TypeError('this is a readable stream'); + } + [_open]() { + fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd)); + } + [_onopen](er, fd) { + if (er) { + this[_onerror](er); + } + else { + this[_fd] = fd; + this.emit('open', fd); + this[_read](); + } + } + [_makeBuf]() { + return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain])); + } + [_read]() { + if (!this[_reading]) { + this[_reading] = true; + const buf = this[_makeBuf](); + /* c8 ignore start */ + if (buf.length === 0) { + return process.nextTick(() => this[_onread](null, 0, buf)); + } + /* c8 ignore stop */ + fs.read(this[_fd], buf, 0, buf.length, null, (er, br, b) => this[_onread](er, br, b)); + } + } + [_onread](er, br, buf) { + this[_reading] = false; + if (er) { + this[_onerror](er); + } + else if (this[_handleChunk](br, buf)) { + this[_read](); + } + } + [_close]() { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd]; + this[_fd] = undefined; + fs.close(fd, er => er ? this.emit('error', er) : this.emit('close')); + } + } + [_onerror](er) { + this[_reading] = true; + this[_close](); + this.emit('error', er); + } + [_handleChunk](br, buf) { + let ret = false; + // no effect if infinite + this[_remain] -= br; + if (br > 0) { + ret = super.write(br < buf.length ? buf.subarray(0, br) : buf); + } + if (br === 0 || this[_remain] <= 0) { + ret = false; + this[_close](); + super.end(); + } + return ret; + } + emit(ev, ...args) { + switch (ev) { + case 'prefinish': + case 'finish': + return false; + case 'drain': + if (typeof this[_fd] === 'number') { + this[_read](); + } + return false; + case 'error': + if (this[_errored]) { + return false; + } + this[_errored] = true; + return super.emit(ev, ...args); + default: + return super.emit(ev, ...args); + } + } +} +export class ReadStreamSync extends ReadStream { + [_open]() { + let threw = true; + try { + this[_onopen](null, fs.openSync(this[_path], 'r')); + threw = false; + } + finally { + if (threw) { + this[_close](); + } + } + } + [_read]() { + let threw = true; + try { + if (!this[_reading]) { + this[_reading] = true; + do { + const buf = this[_makeBuf](); + /* c8 ignore start */ + const br = buf.length === 0 + ? 0 + : fs.readSync(this[_fd], buf, 0, buf.length, null); + /* c8 ignore stop */ + if (!this[_handleChunk](br, buf)) { + break; + } + } while (true); + this[_reading] = false; + } + threw = false; + } + finally { + if (threw) { + this[_close](); + } + } + } + [_close]() { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd]; + this[_fd] = undefined; + fs.closeSync(fd); + this.emit('close'); + } + } +} +export class WriteStream extends EE { + readable = false; + writable = true; + [_errored] = false; + [_writing] = false; + [_ended] = false; + [_queue] = []; + [_needDrain] = false; + [_path]; + [_mode]; + [_autoClose]; + [_fd]; + [_defaultFlag]; + [_flags]; + [_finished] = false; + [_pos]; + constructor(path, opt) { + opt = opt || {}; + super(opt); + this[_path] = path; + this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined; + this[_mode] = opt.mode === undefined ? 0o666 : opt.mode; + this[_pos] = typeof opt.start === 'number' ? opt.start : undefined; + this[_autoClose] = + typeof opt.autoClose === 'boolean' ? opt.autoClose : true; + // truncating makes no sense when writing into the middle + const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w'; + this[_defaultFlag] = opt.flags === undefined; + this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags; + if (this[_fd] === undefined) { + this[_open](); + } + } + emit(ev, ...args) { + if (ev === 'error') { + if (this[_errored]) { + return false; + } + this[_errored] = true; + } + return super.emit(ev, ...args); + } + get fd() { + return this[_fd]; + } + get path() { + return this[_path]; + } + [_onerror](er) { + this[_close](); + this[_writing] = true; + this.emit('error', er); + } + [_open]() { + fs.open(this[_path], this[_flags], this[_mode], (er, fd) => this[_onopen](er, fd)); + } + [_onopen](er, fd) { + if (this[_defaultFlag] && + this[_flags] === 'r+' && + er && + er.code === 'ENOENT') { + this[_flags] = 'w'; + this[_open](); + } + else if (er) { + this[_onerror](er); + } + else { + this[_fd] = fd; + this.emit('open', fd); + if (!this[_writing]) { + this[_flush](); + } + } + } + end(buf, enc) { + if (buf) { + //@ts-ignore + this.write(buf, enc); + } + this[_ended] = true; + // synthetic after-write logic, where drain/finish live + if (!this[_writing] && + !this[_queue].length && + typeof this[_fd] === 'number') { + this[_onwrite](null, 0); + } + return this; + } + write(buf, enc) { + if (typeof buf === 'string') { + buf = Buffer.from(buf, enc); + } + if (this[_ended]) { + this.emit('error', new Error('write() after end()')); + return false; + } + if (this[_fd] === undefined || this[_writing] || this[_queue].length) { + this[_queue].push(buf); + this[_needDrain] = true; + return false; + } + this[_writing] = true; + this[_write](buf); + return true; + } + [_write](buf) { + fs.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => this[_onwrite](er, bw)); + } + [_onwrite](er, bw) { + if (er) { + this[_onerror](er); + } + else { + if (this[_pos] !== undefined && typeof bw === 'number') { + this[_pos] += bw; + } + if (this[_queue].length) { + this[_flush](); + } + else { + this[_writing] = false; + if (this[_ended] && !this[_finished]) { + this[_finished] = true; + this[_close](); + this.emit('finish'); + } + else if (this[_needDrain]) { + this[_needDrain] = false; + this.emit('drain'); + } + } + } + } + [_flush]() { + if (this[_queue].length === 0) { + if (this[_ended]) { + this[_onwrite](null, 0); + } + } + else if (this[_queue].length === 1) { + this[_write](this[_queue].pop()); + } + else { + const iovec = this[_queue]; + this[_queue] = []; + writev(this[_fd], iovec, this[_pos], (er, bw) => this[_onwrite](er, bw)); + } + } + [_close]() { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd]; + this[_fd] = undefined; + fs.close(fd, er => er ? this.emit('error', er) : this.emit('close')); + } + } +} +export class WriteStreamSync extends WriteStream { + [_open]() { + let fd; + // only wrap in a try{} block if we know we'll retry, to avoid + // the rethrow obscuring the error's source frame in most cases. + if (this[_defaultFlag] && this[_flags] === 'r+') { + try { + fd = fs.openSync(this[_path], this[_flags], this[_mode]); + } + catch (er) { + if (er?.code === 'ENOENT') { + this[_flags] = 'w'; + return this[_open](); + } + else { + throw er; + } + } + } + else { + fd = fs.openSync(this[_path], this[_flags], this[_mode]); + } + this[_onopen](null, fd); + } + [_close]() { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd]; + this[_fd] = undefined; + fs.closeSync(fd); + this.emit('close'); + } + } + [_write](buf) { + // throw the original, but try to close if it fails + let threw = true; + try { + this[_onwrite](null, fs.writeSync(this[_fd], buf, 0, buf.length, this[_pos])); + threw = false; + } + finally { + if (threw) { + try { + this[_close](); + } + catch { + // ok error + } + } + } + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/dist/esm/index.js.map b/node_modules/@isaacs/fs-minipass/dist/esm/index.js.map new file mode 100644 index 0000000..2ef8b14 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,QAAQ,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAA;AAExB,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AACvC,MA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AC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import EE from 'events'\nimport fs from 'fs'\nimport { Minipass } from 'minipass'\n\nconst writev = fs.writev\n\nconst _autoClose = Symbol('_autoClose')\nconst _close = Symbol('_close')\nconst _ended = Symbol('_ended')\nconst _fd = Symbol('_fd')\nconst _finished = Symbol('_finished')\nconst _flags = Symbol('_flags')\nconst _flush = Symbol('_flush')\nconst _handleChunk = Symbol('_handleChunk')\nconst _makeBuf = Symbol('_makeBuf')\nconst _mode = Symbol('_mode')\nconst _needDrain = Symbol('_needDrain')\nconst _onerror = Symbol('_onerror')\nconst _onopen = Symbol('_onopen')\nconst _onread = Symbol('_onread')\nconst _onwrite = Symbol('_onwrite')\nconst _open = Symbol('_open')\nconst _path = Symbol('_path')\nconst _pos = Symbol('_pos')\nconst _queue = Symbol('_queue')\nconst _read = Symbol('_read')\nconst _readSize = Symbol('_readSize')\nconst _reading = Symbol('_reading')\nconst _remain = Symbol('_remain')\nconst _size = Symbol('_size')\nconst _write = Symbol('_write')\nconst _writing = Symbol('_writing')\nconst _defaultFlag = Symbol('_defaultFlag')\nconst _errored = Symbol('_errored')\n\nexport type ReadStreamOptions =\n Minipass.Options & {\n fd?: number\n readSize?: number\n size?: number\n autoClose?: boolean\n }\n\nexport type ReadStreamEvents = Minipass.Events & {\n open: [fd: number]\n}\n\nexport class ReadStream extends Minipass<\n Minipass.ContiguousData,\n Buffer,\n ReadStreamEvents\n> {\n [_errored]: boolean = false;\n [_fd]?: number;\n [_path]: string;\n [_readSize]: number;\n [_reading]: boolean = false;\n [_size]: number;\n [_remain]: number;\n [_autoClose]: boolean\n\n constructor(path: string, opt: ReadStreamOptions) {\n opt = opt || {}\n super(opt)\n\n this.readable = true\n this.writable = false\n\n if (typeof path !== 'string') {\n throw new TypeError('path must be a string')\n }\n\n this[_errored] = false\n this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined\n this[_path] = path\n this[_readSize] = opt.readSize || 16 * 1024 * 1024\n this[_reading] = false\n this[_size] = typeof opt.size === 'number' ? opt.size : Infinity\n this[_remain] = this[_size]\n this[_autoClose] =\n typeof opt.autoClose === 'boolean' ? opt.autoClose : true\n\n if (typeof this[_fd] === 'number') {\n this[_read]()\n } else {\n this[_open]()\n }\n }\n\n get fd() {\n return this[_fd]\n }\n\n get path() {\n return this[_path]\n }\n\n //@ts-ignore\n write() {\n throw new TypeError('this is a readable stream')\n }\n\n //@ts-ignore\n end() {\n throw new TypeError('this is a readable stream')\n }\n\n [_open]() {\n fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd))\n }\n\n [_onopen](er?: NodeJS.ErrnoException | null, fd?: number) {\n if (er) {\n this[_onerror](er)\n } else {\n this[_fd] = fd\n this.emit('open', fd as number)\n this[_read]()\n }\n }\n\n [_makeBuf]() {\n return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain]))\n }\n\n [_read]() {\n if (!this[_reading]) {\n this[_reading] = true\n const buf = this[_makeBuf]()\n /* c8 ignore start */\n if (buf.length === 0) {\n return process.nextTick(() => this[_onread](null, 0, buf))\n }\n /* c8 ignore stop */\n fs.read(this[_fd] as number, buf, 0, buf.length, null, (er, br, b) =>\n this[_onread](er, br, b),\n )\n }\n }\n\n [_onread](er?: NodeJS.ErrnoException | null, br?: number, buf?: Buffer) {\n this[_reading] = false\n if (er) {\n this[_onerror](er)\n } else if (this[_handleChunk](br as number, buf as Buffer)) {\n this[_read]()\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.close(fd, er =>\n er ? this.emit('error', er) : this.emit('close'),\n )\n }\n }\n\n [_onerror](er: NodeJS.ErrnoException) {\n this[_reading] = true\n this[_close]()\n this.emit('error', er)\n }\n\n [_handleChunk](br: number, buf: Buffer) {\n let ret = false\n // no effect if infinite\n this[_remain] -= br\n if (br > 0) {\n ret = super.write(br < buf.length ? buf.subarray(0, br) : buf)\n }\n\n if (br === 0 || this[_remain] <= 0) {\n ret = false\n this[_close]()\n super.end()\n }\n\n return ret\n }\n\n emit(\n ev: Event,\n ...args: ReadStreamEvents[Event]\n ): boolean {\n switch (ev) {\n case 'prefinish':\n case 'finish':\n return false\n\n case 'drain':\n if (typeof this[_fd] === 'number') {\n this[_read]()\n }\n return false\n\n case 'error':\n if (this[_errored]) {\n return false\n }\n this[_errored] = true\n return super.emit(ev, ...args)\n\n default:\n return super.emit(ev, ...args)\n }\n }\n}\n\nexport class ReadStreamSync extends ReadStream {\n [_open]() {\n let threw = true\n try {\n this[_onopen](null, fs.openSync(this[_path], 'r'))\n threw = false\n } finally {\n if (threw) {\n this[_close]()\n }\n }\n }\n\n [_read]() {\n let threw = true\n try {\n if (!this[_reading]) {\n this[_reading] = true\n do {\n const buf = this[_makeBuf]()\n /* c8 ignore start */\n const br =\n buf.length === 0\n ? 0\n : fs.readSync(this[_fd] as number, buf, 0, buf.length, null)\n /* c8 ignore stop */\n if (!this[_handleChunk](br, buf)) {\n break\n }\n } while (true)\n this[_reading] = false\n }\n threw = false\n } finally {\n if (threw) {\n this[_close]()\n }\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.closeSync(fd)\n this.emit('close')\n }\n }\n}\n\nexport type WriteStreamOptions = {\n fd?: number\n autoClose?: boolean\n mode?: number\n captureRejections?: boolean\n start?: number\n flags?: string\n}\n\nexport class WriteStream extends EE {\n readable: false = false\n writable: boolean = true;\n [_errored]: boolean = false;\n [_writing]: boolean = false;\n [_ended]: boolean = false;\n [_queue]: Buffer[] = [];\n [_needDrain]: boolean = false;\n [_path]: string;\n [_mode]: number;\n [_autoClose]: boolean;\n [_fd]?: number;\n [_defaultFlag]: boolean;\n [_flags]: string;\n [_finished]: boolean = false;\n [_pos]?: number\n\n constructor(path: string, opt: WriteStreamOptions) {\n opt = opt || {}\n super(opt)\n this[_path] = path\n this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined\n this[_mode] = opt.mode === undefined ? 0o666 : opt.mode\n this[_pos] = typeof opt.start === 'number' ? opt.start : undefined\n this[_autoClose] =\n typeof opt.autoClose === 'boolean' ? opt.autoClose : true\n\n // truncating makes no sense when writing into the middle\n const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w'\n this[_defaultFlag] = opt.flags === undefined\n this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags\n\n if (this[_fd] === undefined) {\n this[_open]()\n }\n }\n\n emit(ev: string, ...args: any[]) {\n if (ev === 'error') {\n if (this[_errored]) {\n return false\n }\n this[_errored] = true\n }\n return super.emit(ev, ...args)\n }\n\n get fd() {\n return this[_fd]\n }\n\n get path() {\n return this[_path]\n }\n\n [_onerror](er: NodeJS.ErrnoException) {\n this[_close]()\n this[_writing] = true\n this.emit('error', er)\n }\n\n [_open]() {\n fs.open(this[_path], this[_flags], this[_mode], (er, fd) =>\n this[_onopen](er, fd),\n )\n }\n\n [_onopen](er?: null | NodeJS.ErrnoException, fd?: number) {\n if (\n this[_defaultFlag] &&\n this[_flags] === 'r+' &&\n er &&\n er.code === 'ENOENT'\n ) {\n this[_flags] = 'w'\n this[_open]()\n } else if (er) {\n this[_onerror](er)\n } else {\n this[_fd] = fd\n this.emit('open', fd)\n if (!this[_writing]) {\n this[_flush]()\n }\n }\n }\n\n end(buf: string, enc?: BufferEncoding): this\n end(buf?: Buffer, enc?: undefined): this\n end(buf?: Buffer | string, enc?: BufferEncoding): this {\n if (buf) {\n //@ts-ignore\n this.write(buf, enc)\n }\n\n this[_ended] = true\n\n // synthetic after-write logic, where drain/finish live\n if (\n !this[_writing] &&\n !this[_queue].length &&\n typeof this[_fd] === 'number'\n ) {\n this[_onwrite](null, 0)\n }\n return this\n }\n\n write(buf: string, enc?: BufferEncoding): boolean\n write(buf: Buffer, enc?: undefined): boolean\n write(buf: Buffer | string, enc?: BufferEncoding): boolean {\n if (typeof buf === 'string') {\n buf = Buffer.from(buf, enc)\n }\n\n if (this[_ended]) {\n this.emit('error', new Error('write() after end()'))\n return false\n }\n\n if (this[_fd] === undefined || this[_writing] || this[_queue].length) {\n this[_queue].push(buf)\n this[_needDrain] = true\n return false\n }\n\n this[_writing] = true\n this[_write](buf)\n return true\n }\n\n [_write](buf: Buffer) {\n fs.write(\n this[_fd] as number,\n buf,\n 0,\n buf.length,\n this[_pos],\n (er, bw) => this[_onwrite](er, bw),\n )\n }\n\n [_onwrite](er?: null | NodeJS.ErrnoException, bw?: number) {\n if (er) {\n this[_onerror](er)\n } else {\n if (this[_pos] !== undefined && typeof bw === 'number') {\n this[_pos] += bw\n }\n if (this[_queue].length) {\n this[_flush]()\n } else {\n this[_writing] = false\n\n if (this[_ended] && !this[_finished]) {\n this[_finished] = true\n this[_close]()\n this.emit('finish')\n } else if (this[_needDrain]) {\n this[_needDrain] = false\n this.emit('drain')\n }\n }\n }\n }\n\n [_flush]() {\n if (this[_queue].length === 0) {\n if (this[_ended]) {\n this[_onwrite](null, 0)\n }\n } else if (this[_queue].length === 1) {\n this[_write](this[_queue].pop() as Buffer)\n } else {\n const iovec = this[_queue]\n this[_queue] = []\n writev(this[_fd] as number, iovec, this[_pos] as number, (er, bw) =>\n this[_onwrite](er, bw),\n )\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.close(fd, er =>\n er ? this.emit('error', er) : this.emit('close'),\n )\n }\n }\n}\n\nexport class WriteStreamSync extends WriteStream {\n [_open](): void {\n let fd\n // only wrap in a try{} block if we know we'll retry, to avoid\n // the rethrow obscuring the error's source frame in most cases.\n if (this[_defaultFlag] && this[_flags] === 'r+') {\n try {\n fd = fs.openSync(this[_path], this[_flags], this[_mode])\n } catch (er) {\n if ((er as NodeJS.ErrnoException)?.code === 'ENOENT') {\n this[_flags] = 'w'\n return this[_open]()\n } else {\n throw er\n }\n }\n } else {\n fd = fs.openSync(this[_path], this[_flags], this[_mode])\n }\n\n this[_onopen](null, fd)\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.closeSync(fd)\n this.emit('close')\n }\n }\n\n [_write](buf: Buffer) {\n // throw the original, but try to close if it fails\n let threw = true\n try {\n this[_onwrite](\n null,\n fs.writeSync(this[_fd] as number, buf, 0, buf.length, this[_pos]),\n )\n threw = false\n } finally {\n if (threw) {\n try {\n this[_close]()\n } catch {\n // ok error\n }\n }\n }\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/dist/esm/package.json b/node_modules/@isaacs/fs-minipass/dist/esm/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/@isaacs/fs-minipass/node_modules/minipass/LICENSE.md b/node_modules/@isaacs/fs-minipass/node_modules/minipass/LICENSE.md new file mode 100644 index 0000000..c5402b9 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/node_modules/minipass/LICENSE.md @@ -0,0 +1,55 @@ +# Blue Oak Model License + +Version 1.0.0 + +## Purpose + +This license gives everyone as much permission to work with +this software as possible, while protecting contributors +from liability. + +## Acceptance + +In order to receive this license, you must agree to its +rules. The rules of this license are both obligations +under that agreement and conditions to your license. +You must not do anything with this software that triggers +a rule that you cannot or will not follow. + +## Copyright + +Each contributor licenses you to do everything with this +software that would otherwise infringe that contributor's +copyright in it. + +## Notices + +You must ensure that everyone who gets a copy of +any part of this software from you, with or without +changes, also gets the text of this license or a link to +. + +## Excuse + +If anyone notifies you in writing that you have not +complied with [Notices](#notices), you can keep your +license by taking all practical steps to comply within 30 +days after the notice. If you do not do so, your license +ends immediately. + +## Patent + +Each contributor licenses you to do everything with this +software that would otherwise infringe any patent claims +they can license or become able to license. + +## Reliability + +No contributor can revoke this license. + +## No Liability + +***As far as the law allows, this software comes as is, +without any warranty or condition, and no contributor +will be liable to anyone for any damages related to this +software or this license, under any kind of legal claim.*** diff --git a/node_modules/@isaacs/fs-minipass/node_modules/minipass/README.md b/node_modules/@isaacs/fs-minipass/node_modules/minipass/README.md new file mode 100644 index 0000000..1126330 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/node_modules/minipass/README.md @@ -0,0 +1,825 @@ +# minipass + +A _very_ minimal implementation of a [PassThrough +stream](https://nodejs.org/api/stream.html#stream_class_stream_passthrough) + +[It's very +fast](https://docs.google.com/spreadsheets/d/1K_HR5oh3r80b8WVMWCPPjfuWXUgfkmhlX7FGI6JJ8tY/edit?usp=sharing) +for objects, strings, and buffers. + +Supports `pipe()`ing (including multi-`pipe()` and backpressure +transmission), buffering data until either a `data` event handler +or `pipe()` is added (so you don't lose the first chunk), and +most other cases where PassThrough is a good idea. + +There is a `read()` method, but it's much more efficient to +consume data from this stream via `'data'` events or by calling +`pipe()` into some other stream. Calling `read()` requires the +buffer to be flattened in some cases, which requires copying +memory. + +If you set `objectMode: true` in the options, then whatever is +written will be emitted. Otherwise, it'll do a minimal amount of +Buffer copying to ensure proper Streams semantics when `read(n)` +is called. + +`objectMode` can only be set at instantiation. Attempting to +write something other than a String or Buffer without having set +`objectMode` in the options will throw an error. + +This is not a `through` or `through2` stream. It doesn't +transform the data, it just passes it right through. If you want +to transform the data, extend the class, and override the +`write()` method. Once you're done transforming the data however +you want, call `super.write()` with the transform output. + +For some examples of streams that extend Minipass in various +ways, check out: + +- [minizlib](http://npm.im/minizlib) +- [fs-minipass](http://npm.im/fs-minipass) +- [tar](http://npm.im/tar) +- [minipass-collect](http://npm.im/minipass-collect) +- [minipass-flush](http://npm.im/minipass-flush) +- [minipass-pipeline](http://npm.im/minipass-pipeline) +- [tap](http://npm.im/tap) +- [tap-parser](http://npm.im/tap-parser) +- [treport](http://npm.im/treport) +- [minipass-fetch](http://npm.im/minipass-fetch) +- [pacote](http://npm.im/pacote) +- [make-fetch-happen](http://npm.im/make-fetch-happen) +- [cacache](http://npm.im/cacache) +- [ssri](http://npm.im/ssri) +- [npm-registry-fetch](http://npm.im/npm-registry-fetch) +- [minipass-json-stream](http://npm.im/minipass-json-stream) +- [minipass-sized](http://npm.im/minipass-sized) + +## Usage in TypeScript + +The `Minipass` class takes three type template definitions: + +- `RType` the type being read, which defaults to `Buffer`. If + `RType` is `string`, then the constructor _must_ get an options + object specifying either an `encoding` or `objectMode: true`. + If it's anything other than `string` or `Buffer`, then it + _must_ get an options object specifying `objectMode: true`. +- `WType` the type being written. If `RType` is `Buffer` or + `string`, then this defaults to `ContiguousData` (Buffer, + string, ArrayBuffer, or ArrayBufferView). Otherwise, it + defaults to `RType`. +- `Events` type mapping event names to the arguments emitted + with that event, which extends `Minipass.Events`. + +To declare types for custom events in subclasses, extend the +third parameter with your own event signatures. For example: + +```js +import { Minipass } from 'minipass' + +// a NDJSON stream that emits 'jsonError' when it can't stringify +export interface Events extends Minipass.Events { + jsonError: [e: Error] +} + +export class NDJSONStream extends Minipass { + constructor() { + super({ objectMode: true }) + } + + // data is type `any` because that's WType + write(data, encoding, cb) { + try { + const json = JSON.stringify(data) + return super.write(json + '\n', encoding, cb) + } catch (er) { + if (!er instanceof Error) { + er = Object.assign(new Error('json stringify failed'), { + cause: er, + }) + } + // trying to emit with something OTHER than an error will + // fail, because we declared the event arguments type. + this.emit('jsonError', er) + } + } +} + +const s = new NDJSONStream() +s.on('jsonError', e => { + // here, TS knows that e is an Error +}) +``` + +Emitting/handling events that aren't declared in this way is +fine, but the arguments will be typed as `unknown`. + +## Differences from Node.js Streams + +There are several things that make Minipass streams different +from (and in some ways superior to) Node.js core streams. + +Please read these caveats if you are familiar with node-core +streams and intend to use Minipass streams in your programs. + +You can avoid most of these differences entirely (for a very +small performance penalty) by setting `{async: true}` in the +constructor options. + +### Timing + +Minipass streams are designed to support synchronous use-cases. +Thus, data is emitted as soon as it is available, always. It is +buffered until read, but no longer. Another way to look at it is +that Minipass streams are exactly as synchronous as the logic +that writes into them. + +This can be surprising if your code relies on +`PassThrough.write()` always providing data on the next tick +rather than the current one, or being able to call `resume()` and +not have the entire buffer disappear immediately. + +However, without this synchronicity guarantee, there would be no +way for Minipass to achieve the speeds it does, or support the +synchronous use cases that it does. Simply put, waiting takes +time. + +This non-deferring approach makes Minipass streams much easier to +reason about, especially in the context of Promises and other +flow-control mechanisms. + +Example: + +```js +// hybrid module, either works +import { Minipass } from 'minipass' +// or: +const { Minipass } = require('minipass') + +const stream = new Minipass() +stream.on('data', () => console.log('data event')) +console.log('before write') +stream.write('hello') +console.log('after write') +// output: +// before write +// data event +// after write +``` + +### Exception: Async Opt-In + +If you wish to have a Minipass stream with behavior that more +closely mimics Node.js core streams, you can set the stream in +async mode either by setting `async: true` in the constructor +options, or by setting `stream.async = true` later on. + +```js +// hybrid module, either works +import { Minipass } from 'minipass' +// or: +const { Minipass } = require('minipass') + +const asyncStream = new Minipass({ async: true }) +asyncStream.on('data', () => console.log('data event')) +console.log('before write') +asyncStream.write('hello') +console.log('after write') +// output: +// before write +// after write +// data event <-- this is deferred until the next tick +``` + +Switching _out_ of async mode is unsafe, as it could cause data +corruption, and so is not enabled. Example: + +```js +import { Minipass } from 'minipass' +const stream = new Minipass({ encoding: 'utf8' }) +stream.on('data', chunk => console.log(chunk)) +stream.async = true +console.log('before writes') +stream.write('hello') +setStreamSyncAgainSomehow(stream) // <-- this doesn't actually exist! +stream.write('world') +console.log('after writes') +// hypothetical output would be: +// before writes +// world +// after writes +// hello +// NOT GOOD! +``` + +To avoid this problem, once set into async mode, any attempt to +make the stream sync again will be ignored. + +```js +const { Minipass } = require('minipass') +const stream = new Minipass({ encoding: 'utf8' }) +stream.on('data', chunk => console.log(chunk)) +stream.async = true +console.log('before writes') +stream.write('hello') +stream.async = false // <-- no-op, stream already async +stream.write('world') +console.log('after writes') +// actual output: +// before writes +// after writes +// hello +// world +``` + +### No High/Low Water Marks + +Node.js core streams will optimistically fill up a buffer, +returning `true` on all writes until the limit is hit, even if +the data has nowhere to go. Then, they will not attempt to draw +more data in until the buffer size dips below a minimum value. + +Minipass streams are much simpler. The `write()` method will +return `true` if the data has somewhere to go (which is to say, +given the timing guarantees, that the data is already there by +the time `write()` returns). + +If the data has nowhere to go, then `write()` returns false, and +the data sits in a buffer, to be drained out immediately as soon +as anyone consumes it. + +Since nothing is ever buffered unnecessarily, there is much less +copying data, and less bookkeeping about buffer capacity levels. + +### Hazards of Buffering (or: Why Minipass Is So Fast) + +Since data written to a Minipass stream is immediately written +all the way through the pipeline, and `write()` always returns +true/false based on whether the data was fully flushed, +backpressure is communicated immediately to the upstream caller. +This minimizes buffering. + +Consider this case: + +```js +const { PassThrough } = require('stream') +const p1 = new PassThrough({ highWaterMark: 1024 }) +const p2 = new PassThrough({ highWaterMark: 1024 }) +const p3 = new PassThrough({ highWaterMark: 1024 }) +const p4 = new PassThrough({ highWaterMark: 1024 }) + +p1.pipe(p2).pipe(p3).pipe(p4) +p4.on('data', () => console.log('made it through')) + +// this returns false and buffers, then writes to p2 on next tick (1) +// p2 returns false and buffers, pausing p1, then writes to p3 on next tick (2) +// p3 returns false and buffers, pausing p2, then writes to p4 on next tick (3) +// p4 returns false and buffers, pausing p3, then emits 'data' and 'drain' +// on next tick (4) +// p3 sees p4's 'drain' event, and calls resume(), emitting 'resume' and +// 'drain' on next tick (5) +// p2 sees p3's 'drain', calls resume(), emits 'resume' and 'drain' on next tick (6) +// p1 sees p2's 'drain', calls resume(), emits 'resume' and 'drain' on next +// tick (7) + +p1.write(Buffer.alloc(2048)) // returns false +``` + +Along the way, the data was buffered and deferred at each stage, +and multiple event deferrals happened, for an unblocked pipeline +where it was perfectly safe to write all the way through! + +Furthermore, setting a `highWaterMark` of `1024` might lead +someone reading the code to think an advisory maximum of 1KiB is +being set for the pipeline. However, the actual advisory +buffering level is the _sum_ of `highWaterMark` values, since +each one has its own bucket. + +Consider the Minipass case: + +```js +const m1 = new Minipass() +const m2 = new Minipass() +const m3 = new Minipass() +const m4 = new Minipass() + +m1.pipe(m2).pipe(m3).pipe(m4) +m4.on('data', () => console.log('made it through')) + +// m1 is flowing, so it writes the data to m2 immediately +// m2 is flowing, so it writes the data to m3 immediately +// m3 is flowing, so it writes the data to m4 immediately +// m4 is flowing, so it fires the 'data' event immediately, returns true +// m4's write returned true, so m3 is still flowing, returns true +// m3's write returned true, so m2 is still flowing, returns true +// m2's write returned true, so m1 is still flowing, returns true +// No event deferrals or buffering along the way! + +m1.write(Buffer.alloc(2048)) // returns true +``` + +It is extremely unlikely that you _don't_ want to buffer any data +written, or _ever_ buffer data that can be flushed all the way +through. Neither node-core streams nor Minipass ever fail to +buffer written data, but node-core streams do a lot of +unnecessary buffering and pausing. + +As always, the faster implementation is the one that does less +stuff and waits less time to do it. + +### Immediately emit `end` for empty streams (when not paused) + +If a stream is not paused, and `end()` is called before writing +any data into it, then it will emit `end` immediately. + +If you have logic that occurs on the `end` event which you don't +want to potentially happen immediately (for example, closing file +descriptors, moving on to the next entry in an archive parse +stream, etc.) then be sure to call `stream.pause()` on creation, +and then `stream.resume()` once you are ready to respond to the +`end` event. + +However, this is _usually_ not a problem because: + +### Emit `end` When Asked + +One hazard of immediately emitting `'end'` is that you may not +yet have had a chance to add a listener. In order to avoid this +hazard, Minipass streams safely re-emit the `'end'` event if a +new listener is added after `'end'` has been emitted. + +Ie, if you do `stream.on('end', someFunction)`, and the stream +has already emitted `end`, then it will call the handler right +away. (You can think of this somewhat like attaching a new +`.then(fn)` to a previously-resolved Promise.) + +To prevent calling handlers multiple times who would not expect +multiple ends to occur, all listeners are removed from the +`'end'` event whenever it is emitted. + +### Emit `error` When Asked + +The most recent error object passed to the `'error'` event is +stored on the stream. If a new `'error'` event handler is added, +and an error was previously emitted, then the event handler will +be called immediately (or on `process.nextTick` in the case of +async streams). + +This makes it much more difficult to end up trying to interact +with a broken stream, if the error handler is added after an +error was previously emitted. + +### Impact of "immediate flow" on Tee-streams + +A "tee stream" is a stream piping to multiple destinations: + +```js +const tee = new Minipass() +t.pipe(dest1) +t.pipe(dest2) +t.write('foo') // goes to both destinations +``` + +Since Minipass streams _immediately_ process any pending data +through the pipeline when a new pipe destination is added, this +can have surprising effects, especially when a stream comes in +from some other function and may or may not have data in its +buffer. + +```js +// WARNING! WILL LOSE DATA! +const src = new Minipass() +src.write('foo') +src.pipe(dest1) // 'foo' chunk flows to dest1 immediately, and is gone +src.pipe(dest2) // gets nothing! +``` + +One solution is to create a dedicated tee-stream junction that +pipes to both locations, and then pipe to _that_ instead. + +```js +// Safe example: tee to both places +const src = new Minipass() +src.write('foo') +const tee = new Minipass() +tee.pipe(dest1) +tee.pipe(dest2) +src.pipe(tee) // tee gets 'foo', pipes to both locations +``` + +The same caveat applies to `on('data')` event listeners. The +first one added will _immediately_ receive all of the data, +leaving nothing for the second: + +```js +// WARNING! WILL LOSE DATA! +const src = new Minipass() +src.write('foo') +src.on('data', handler1) // receives 'foo' right away +src.on('data', handler2) // nothing to see here! +``` + +Using a dedicated tee-stream can be used in this case as well: + +```js +// Safe example: tee to both data handlers +const src = new Minipass() +src.write('foo') +const tee = new Minipass() +tee.on('data', handler1) +tee.on('data', handler2) +src.pipe(tee) +``` + +All of the hazards in this section are avoided by setting `{ +async: true }` in the Minipass constructor, or by setting +`stream.async = true` afterwards. Note that this does add some +overhead, so should only be done in cases where you are willing +to lose a bit of performance in order to avoid having to refactor +program logic. + +## USAGE + +It's a stream! Use it like a stream and it'll most likely do what +you want. + +```js +import { Minipass } from 'minipass' +const mp = new Minipass(options) // options is optional +mp.write('foo') +mp.pipe(someOtherStream) +mp.end('bar') +``` + +### OPTIONS + +- `encoding` How would you like the data coming _out_ of the + stream to be encoded? Accepts any values that can be passed to + `Buffer.toString()`. +- `objectMode` Emit data exactly as it comes in. This will be + flipped on by default if you write() something other than a + string or Buffer at any point. Setting `objectMode: true` will + prevent setting any encoding value. +- `async` Defaults to `false`. Set to `true` to defer data + emission until next tick. This reduces performance slightly, + but makes Minipass streams use timing behavior closer to Node + core streams. See [Timing](#timing) for more details. +- `signal` An `AbortSignal` that will cause the stream to unhook + itself from everything and become as inert as possible. Note + that providing a `signal` parameter will make `'error'` events + no longer throw if they are unhandled, but they will still be + emitted to handlers if any are attached. + +### API + +Implements the user-facing portions of Node.js's `Readable` and +`Writable` streams. + +### Methods + +- `write(chunk, [encoding], [callback])` - Put data in. (Note + that, in the base Minipass class, the same data will come out.) + Returns `false` if the stream will buffer the next write, or + true if it's still in "flowing" mode. +- `end([chunk, [encoding]], [callback])` - Signal that you have + no more data to write. This will queue an `end` event to be + fired when all the data has been consumed. +- `pause()` - No more data for a while, please. This also + prevents `end` from being emitted for empty streams until the + stream is resumed. +- `resume()` - Resume the stream. If there's data in the buffer, + it is all discarded. Any buffered events are immediately + emitted. +- `pipe(dest)` - Send all output to the stream provided. When + data is emitted, it is immediately written to any and all pipe + destinations. (Or written on next tick in `async` mode.) +- `unpipe(dest)` - Stop piping to the destination stream. This is + immediate, meaning that any asynchronously queued data will + _not_ make it to the destination when running in `async` mode. + - `options.end` - Boolean, end the destination stream when the + source stream ends. Default `true`. + - `options.proxyErrors` - Boolean, proxy `error` events from + the source stream to the destination stream. Note that errors + are _not_ proxied after the pipeline terminates, either due + to the source emitting `'end'` or manually unpiping with + `src.unpipe(dest)`. Default `false`. +- `on(ev, fn)`, `emit(ev, fn)` - Minipass streams are + EventEmitters. Some events are given special treatment, + however. (See below under "events".) +- `promise()` - Returns a Promise that resolves when the stream + emits `end`, or rejects if the stream emits `error`. +- `collect()` - Return a Promise that resolves on `end` with an + array containing each chunk of data that was emitted, or + rejects if the stream emits `error`. Note that this consumes + the stream data. +- `concat()` - Same as `collect()`, but concatenates the data + into a single Buffer object. Will reject the returned promise + if the stream is in objectMode, or if it goes into objectMode + by the end of the data. +- `read(n)` - Consume `n` bytes of data out of the buffer. If `n` + is not provided, then consume all of it. If `n` bytes are not + available, then it returns null. **Note** consuming streams in + this way is less efficient, and can lead to unnecessary Buffer + copying. +- `destroy([er])` - Destroy the stream. If an error is provided, + then an `'error'` event is emitted. If the stream has a + `close()` method, and has not emitted a `'close'` event yet, + then `stream.close()` will be called. Any Promises returned by + `.promise()`, `.collect()` or `.concat()` will be rejected. + After being destroyed, writing to the stream will emit an + error. No more data will be emitted if the stream is destroyed, + even if it was previously buffered. + +### Properties + +- `bufferLength` Read-only. Total number of bytes buffered, or in + the case of objectMode, the total number of objects. +- `encoding` Read-only. The encoding that has been set. +- `flowing` Read-only. Boolean indicating whether a chunk written + to the stream will be immediately emitted. +- `emittedEnd` Read-only. Boolean indicating whether the end-ish + events (ie, `end`, `prefinish`, `finish`) have been emitted. + Note that listening on any end-ish event will immediateyl + re-emit it if it has already been emitted. +- `writable` Whether the stream is writable. Default `true`. Set + to `false` when `end()` +- `readable` Whether the stream is readable. Default `true`. +- `pipes` An array of Pipe objects referencing streams that this + stream is piping into. +- `destroyed` A getter that indicates whether the stream was + destroyed. +- `paused` True if the stream has been explicitly paused, + otherwise false. +- `objectMode` Indicates whether the stream is in `objectMode`. +- `aborted` Readonly property set when the `AbortSignal` + dispatches an `abort` event. + +### Events + +- `data` Emitted when there's data to read. Argument is the data + to read. This is never emitted while not flowing. If a listener + is attached, that will resume the stream. +- `end` Emitted when there's no more data to read. This will be + emitted immediately for empty streams when `end()` is called. + If a listener is attached, and `end` was already emitted, then + it will be emitted again. All listeners are removed when `end` + is emitted. +- `prefinish` An end-ish event that follows the same logic as + `end` and is emitted in the same conditions where `end` is + emitted. Emitted after `'end'`. +- `finish` An end-ish event that follows the same logic as `end` + and is emitted in the same conditions where `end` is emitted. + Emitted after `'prefinish'`. +- `close` An indication that an underlying resource has been + released. Minipass does not emit this event, but will defer it + until after `end` has been emitted, since it throws off some + stream libraries otherwise. +- `drain` Emitted when the internal buffer empties, and it is + again suitable to `write()` into the stream. +- `readable` Emitted when data is buffered and ready to be read + by a consumer. +- `resume` Emitted when stream changes state from buffering to + flowing mode. (Ie, when `resume` is called, `pipe` is called, + or a `data` event listener is added.) + +### Static Methods + +- `Minipass.isStream(stream)` Returns `true` if the argument is a + stream, and false otherwise. To be considered a stream, the + object must be either an instance of Minipass, or an + EventEmitter that has either a `pipe()` method, or both + `write()` and `end()` methods. (Pretty much any stream in + node-land will return `true` for this.) + +## EXAMPLES + +Here are some examples of things you can do with Minipass +streams. + +### simple "are you done yet" promise + +```js +mp.promise().then( + () => { + // stream is finished + }, + er => { + // stream emitted an error + } +) +``` + +### collecting + +```js +mp.collect().then(all => { + // all is an array of all the data emitted + // encoding is supported in this case, so + // so the result will be a collection of strings if + // an encoding is specified, or buffers/objects if not. + // + // In an async function, you may do + // const data = await stream.collect() +}) +``` + +### collecting into a single blob + +This is a bit slower because it concatenates the data into one +chunk for you, but if you're going to do it yourself anyway, it's +convenient this way: + +```js +mp.concat().then(onebigchunk => { + // onebigchunk is a string if the stream + // had an encoding set, or a buffer otherwise. +}) +``` + +### iteration + +You can iterate over streams synchronously or asynchronously in +platforms that support it. + +Synchronous iteration will end when the currently available data +is consumed, even if the `end` event has not been reached. In +string and buffer mode, the data is concatenated, so unless +multiple writes are occurring in the same tick as the `read()`, +sync iteration loops will generally only have a single iteration. + +To consume chunks in this way exactly as they have been written, +with no flattening, create the stream with the `{ objectMode: +true }` option. + +```js +const mp = new Minipass({ objectMode: true }) +mp.write('a') +mp.write('b') +for (let letter of mp) { + console.log(letter) // a, b +} +mp.write('c') +mp.write('d') +for (let letter of mp) { + console.log(letter) // c, d +} +mp.write('e') +mp.end() +for (let letter of mp) { + console.log(letter) // e +} +for (let letter of mp) { + console.log(letter) // nothing +} +``` + +Asynchronous iteration will continue until the end event is reached, +consuming all of the data. + +```js +const mp = new Minipass({ encoding: 'utf8' }) + +// some source of some data +let i = 5 +const inter = setInterval(() => { + if (i-- > 0) mp.write(Buffer.from('foo\n', 'utf8')) + else { + mp.end() + clearInterval(inter) + } +}, 100) + +// consume the data with asynchronous iteration +async function consume() { + for await (let chunk of mp) { + console.log(chunk) + } + return 'ok' +} + +consume().then(res => console.log(res)) +// logs `foo\n` 5 times, and then `ok` +``` + +### subclass that `console.log()`s everything written into it + +```js +class Logger extends Minipass { + write(chunk, encoding, callback) { + console.log('WRITE', chunk, encoding) + return super.write(chunk, encoding, callback) + } + end(chunk, encoding, callback) { + console.log('END', chunk, encoding) + return super.end(chunk, encoding, callback) + } +} + +someSource.pipe(new Logger()).pipe(someDest) +``` + +### same thing, but using an inline anonymous class + +```js +// js classes are fun +someSource + .pipe( + new (class extends Minipass { + emit(ev, ...data) { + // let's also log events, because debugging some weird thing + console.log('EMIT', ev) + return super.emit(ev, ...data) + } + write(chunk, encoding, callback) { + console.log('WRITE', chunk, encoding) + return super.write(chunk, encoding, callback) + } + end(chunk, encoding, callback) { + console.log('END', chunk, encoding) + return super.end(chunk, encoding, callback) + } + })() + ) + .pipe(someDest) +``` + +### subclass that defers 'end' for some reason + +```js +class SlowEnd extends Minipass { + emit(ev, ...args) { + if (ev === 'end') { + console.log('going to end, hold on a sec') + setTimeout(() => { + console.log('ok, ready to end now') + super.emit('end', ...args) + }, 100) + return true + } else { + return super.emit(ev, ...args) + } + } +} +``` + +### transform that creates newline-delimited JSON + +```js +class NDJSONEncode extends Minipass { + write(obj, cb) { + try { + // JSON.stringify can throw, emit an error on that + return super.write(JSON.stringify(obj) + '\n', 'utf8', cb) + } catch (er) { + this.emit('error', er) + } + } + end(obj, cb) { + if (typeof obj === 'function') { + cb = obj + obj = undefined + } + if (obj !== undefined) { + this.write(obj) + } + return super.end(cb) + } +} +``` + +### transform that parses newline-delimited JSON + +```js +class NDJSONDecode extends Minipass { + constructor(options) { + // always be in object mode, as far as Minipass is concerned + super({ objectMode: true }) + this._jsonBuffer = '' + } + write(chunk, encoding, cb) { + if ( + typeof chunk === 'string' && + typeof encoding === 'string' && + encoding !== 'utf8' + ) { + chunk = Buffer.from(chunk, encoding).toString() + } else if (Buffer.isBuffer(chunk)) { + chunk = chunk.toString() + } + if (typeof encoding === 'function') { + cb = encoding + } + const jsonData = (this._jsonBuffer + chunk).split('\n') + this._jsonBuffer = jsonData.pop() + for (let i = 0; i < jsonData.length; i++) { + try { + // JSON.parse can throw, emit an error on that + super.write(JSON.parse(jsonData[i])) + } catch (er) { + this.emit('error', er) + continue + } + } + if (cb) cb() + } +} +``` diff --git a/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/commonjs/index.d.ts b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/commonjs/index.d.ts new file mode 100644 index 0000000..3e75b57 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/commonjs/index.d.ts @@ -0,0 +1,545 @@ +import { EventEmitter } from 'node:events'; +import { StringDecoder } from 'node:string_decoder'; +/** + * Same as StringDecoder, but exposing the `lastNeed` flag on the type + */ +type SD = StringDecoder & { + lastNeed: boolean; +}; +export type { SD, Pipe, PipeProxyErrors }; +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +export declare const isStream: (s: any) => s is Minipass | NodeJS.ReadStream | NodeJS.WriteStream | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; +}) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; +}) | (NodeJS.ReadStream & { + fd: number; +}) | (NodeJS.WriteStream & { + fd: number; +}); +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +export declare const isReadable: (s: any) => s is Minipass.Readable; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +export declare const isWritable: (s: any) => s is Minipass.Readable; +declare const EOF: unique symbol; +declare const MAYBE_EMIT_END: unique symbol; +declare const EMITTED_END: unique symbol; +declare const EMITTING_END: unique symbol; +declare const EMITTED_ERROR: unique symbol; +declare const CLOSED: unique symbol; +declare const READ: unique symbol; +declare const FLUSH: unique symbol; +declare const FLUSHCHUNK: unique symbol; +declare const ENCODING: unique symbol; +declare const DECODER: unique symbol; +declare const FLOWING: unique symbol; +declare const PAUSED: unique symbol; +declare const RESUME: unique symbol; +declare const BUFFER: unique symbol; +declare const PIPES: unique symbol; +declare const BUFFERLENGTH: unique symbol; +declare const BUFFERPUSH: unique symbol; +declare const BUFFERSHIFT: unique symbol; +declare const OBJECTMODE: unique symbol; +declare const DESTROYED: unique symbol; +declare const ERROR: unique symbol; +declare const EMITDATA: unique symbol; +declare const EMITEND: unique symbol; +declare const EMITEND2: unique symbol; +declare const ASYNC: unique symbol; +declare const ABORT: unique symbol; +declare const ABORTED: unique symbol; +declare const SIGNAL: unique symbol; +declare const DATALISTENERS: unique symbol; +declare const DISCARDED: unique symbol; +/** + * Options that may be passed to stream.pipe() + */ +export interface PipeOptions { + /** + * end the destination stream when the source stream ends + */ + end?: boolean; + /** + * proxy errors from the source stream to the destination stream + */ + proxyErrors?: boolean; +} +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +declare class Pipe { + src: Minipass; + dest: Minipass; + opts: PipeOptions; + ondrain: () => any; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); + unpipe(): void; + proxyErrors(_er: any): void; + end(): void; +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +declare class PipeProxyErrors extends Pipe { + unpipe(): void; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); +} +export declare namespace Minipass { + /** + * Encoding used to create a stream that outputs strings rather than + * Buffer objects. + */ + export type Encoding = BufferEncoding | 'buffer' | null; + /** + * Any stream that Minipass can pipe into + */ + export type Writable = Minipass | NodeJS.WriteStream | (NodeJS.WriteStream & { + fd: number; + }) | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }); + /** + * Any stream that can be read from + */ + export type Readable = Minipass | NodeJS.ReadStream | (NodeJS.ReadStream & { + fd: number; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }); + /** + * Utility type that can be iterated sync or async + */ + export type DualIterable = Iterable & AsyncIterable; + type EventArguments = Record; + /** + * The listing of events that a Minipass class can emit. + * Extend this when extending the Minipass class, and pass as + * the third template argument. The key is the name of the event, + * and the value is the argument list. + * + * Any undeclared events will still be allowed, but the handler will get + * arguments as `unknown[]`. + */ + export interface Events extends EventArguments { + readable: []; + data: [chunk: RType]; + error: [er: unknown]; + abort: [reason: unknown]; + drain: []; + resume: []; + end: []; + finish: []; + prefinish: []; + close: []; + [DESTROYED]: [er?: unknown]; + [ERROR]: [er: unknown]; + } + /** + * String or buffer-like data that can be joined and sliced + */ + export type ContiguousData = Buffer | ArrayBufferLike | ArrayBufferView | string; + export type BufferOrString = Buffer | string; + /** + * Options passed to the Minipass constructor. + */ + export type SharedOptions = { + /** + * Defer all data emission and other events until the end of the + * current tick, similar to Node core streams + */ + async?: boolean; + /** + * A signal which will abort the stream + */ + signal?: AbortSignal; + /** + * Output string encoding. Set to `null` or `'buffer'` (or omit) to + * emit Buffer objects rather than strings. + * + * Conflicts with `objectMode` + */ + encoding?: BufferEncoding | null | 'buffer'; + /** + * Output data exactly as it was written, supporting non-buffer/string + * data (such as arbitrary objects, falsey values, etc.) + * + * Conflicts with `encoding` + */ + objectMode?: boolean; + }; + /** + * Options for a string encoded output + */ + export type EncodingOptions = SharedOptions & { + encoding: BufferEncoding; + objectMode?: false; + }; + /** + * Options for contiguous data buffer output + */ + export type BufferOptions = SharedOptions & { + encoding?: null | 'buffer'; + objectMode?: false; + }; + /** + * Options for objectMode arbitrary output + */ + export type ObjectModeOptions = SharedOptions & { + objectMode: true; + encoding?: null; + }; + /** + * Utility type to determine allowed options based on read type + */ + export type Options = ObjectModeOptions | (T extends string ? EncodingOptions : T extends Buffer ? BufferOptions : SharedOptions); + export {}; +} +/** + * Main export, the Minipass class + * + * `RType` is the type of data emitted, defaults to Buffer + * + * `WType` is the type of data to be written, if RType is buffer or string, + * then any {@link Minipass.ContiguousData} is allowed. + * + * `Events` is the set of event handler signatures that this object + * will emit, see {@link Minipass.Events} + */ +export declare class Minipass = Minipass.Events> extends EventEmitter implements Minipass.DualIterable { + [FLOWING]: boolean; + [PAUSED]: boolean; + [PIPES]: Pipe[]; + [BUFFER]: RType[]; + [OBJECTMODE]: boolean; + [ENCODING]: BufferEncoding | null; + [ASYNC]: boolean; + [DECODER]: SD | null; + [EOF]: boolean; + [EMITTED_END]: boolean; + [EMITTING_END]: boolean; + [CLOSED]: boolean; + [EMITTED_ERROR]: unknown; + [BUFFERLENGTH]: number; + [DESTROYED]: boolean; + [SIGNAL]?: AbortSignal; + [ABORTED]: boolean; + [DATALISTENERS]: number; + [DISCARDED]: boolean; + /** + * true if the stream can be written + */ + writable: boolean; + /** + * true if the stream can be read + */ + readable: boolean; + /** + * If `RType` is Buffer, then options do not need to be provided. + * Otherwise, an options object must be provided to specify either + * {@link Minipass.SharedOptions.objectMode} or + * {@link Minipass.SharedOptions.encoding}, as appropriate. + */ + constructor(...args: [Minipass.ObjectModeOptions] | (RType extends Buffer ? [] | [Minipass.Options] : [Minipass.Options])); + /** + * The amount of data stored in the buffer waiting to be read. + * + * For Buffer strings, this will be the total byte length. + * For string encoding streams, this will be the string character length, + * according to JavaScript's `string.length` logic. + * For objectMode streams, this is a count of the items waiting to be + * emitted. + */ + get bufferLength(): number; + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding(): BufferEncoding | null; + /** + * @deprecated - This is a read only property + */ + set encoding(_enc: BufferEncoding | null); + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc: Minipass.Encoding): void; + /** + * True if this is an objectMode stream + */ + get objectMode(): boolean; + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om: boolean); + /** + * true if this is an async stream + */ + get ['async'](): boolean; + /** + * Set to true to make this stream async. + * + * Once set, it cannot be unset, as this would potentially cause incorrect + * behavior. Ie, a sync stream can be made async, but an async stream + * cannot be safely made sync. + */ + set ['async'](a: boolean); + [ABORT](): void; + /** + * True if the stream has been aborted. + */ + get aborted(): boolean; + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_: boolean); + /** + * Write data into the stream + * + * If the chunk written is a string, and encoding is not specified, then + * `utf8` will be assumed. If the stream encoding matches the encoding of + * a written string, and the state of the string decoder allows it, then + * the string will be passed through to either the output or the internal + * buffer without any processing. Otherwise, it will be turned into a + * Buffer object for processing into the desired encoding. + * + * If provided, `cb` function is called immediately before return for + * sync streams, or on next tick for async streams, because for this + * base class, a chunk is considered "processed" once it is accepted + * and either emitted or buffered. That is, the callback does not indicate + * that the chunk has been eventually emitted, though of course child + * classes can override this function to do whatever processing is required + * and call `super.write(...)` only once processing is completed. + */ + write(chunk: WType, cb?: () => void): boolean; + write(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): boolean; + /** + * Low-level explicit read method. + * + * In objectMode, the argument is ignored, and one item is returned if + * available. + * + * `n` is the number of bytes (or in the case of encoding streams, + * characters) to consume. If `n` is not provided, then the entire buffer + * is returned, or `null` is returned if no data is available. + * + * If `n` is greater that the amount of data in the internal buffer, + * then `null` is returned. + */ + read(n?: number | null): RType | null; + [READ](n: number | null, chunk: RType): RType; + /** + * End the stream, optionally providing a final write. + * + * See {@link Minipass#write} for argument descriptions + */ + end(cb?: () => void): this; + end(chunk: WType, cb?: () => void): this; + end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this; + [RESUME](): void; + /** + * Resume the stream if it is currently in a paused state + * + * If called when there are no pipe destinations or `data` event listeners, + * this will place the stream in a "discarded" state, where all data will + * be thrown away. The discarded state is removed if a pipe destination or + * data handler is added, if pause() is called, or if any synchronous or + * asynchronous iteration is started. + */ + resume(): void; + /** + * Pause the stream + */ + pause(): void; + /** + * true if the stream has been forcibly destroyed + */ + get destroyed(): boolean; + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing(): boolean; + /** + * true if the stream is currently in a paused state + */ + get paused(): boolean; + [BUFFERPUSH](chunk: RType): void; + [BUFFERSHIFT](): RType; + [FLUSH](noDrain?: boolean): void; + [FLUSHCHUNK](chunk: RType): boolean; + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest: W, opts?: PipeOptions): W; + /** + * Fully unhook a piped destination stream. + * + * If the destination stream was the only consumer of this stream (ie, + * there are no other piped destinations or `'data'` event listeners) + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + unpipe(dest: W): void; + /** + * Alias for {@link Minipass#on} + */ + addListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.on`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * - Adding a 'data' event handler will trigger the flow of data + * + * - Adding a 'readable' event handler when there is data waiting to be read + * will cause 'readable' to be emitted immediately. + * + * - Adding an 'endish' event handler ('end', 'finish', etc.) which has + * already passed will cause the event to be emitted immediately and all + * handlers removed. + * + * - Adding an 'error' event handler after an error has been emitted will + * cause the event to be re-emitted immediately with the error previously + * raised. + */ + on(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.off` + * + * If a 'data' event handler is removed, and it was the last consumer + * (ie, there are no pipe destinations or other 'data' event listeners), + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + off(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.removeAllListeners` + * + * If all 'data' event handlers are removed, and they were the last consumer + * (ie, there are no pipe destinations), then the flow of data will stop + * until there is another consumer or {@link Minipass#resume} is explicitly + * called. + */ + removeAllListeners(ev?: Event): this; + /** + * true if the 'end' event has been emitted + */ + get emittedEnd(): boolean; + [MAYBE_EMIT_END](): void; + /** + * Mostly identical to `EventEmitter.emit`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * If the stream has been destroyed, and the event is something other + * than 'close' or 'error', then `false` is returned and no handlers + * are called. + * + * If the event is 'end', and has already been emitted, then the event + * is ignored. If the stream is in a paused or non-flowing state, then + * the event will be deferred until data flow resumes. If the stream is + * async, then handlers will be called on the next tick rather than + * immediately. + * + * If the event is 'close', and 'end' has not yet been emitted, then + * the event will be deferred until after 'end' is emitted. + * + * If the event is 'error', and an AbortSignal was provided for the stream, + * and there are no listeners, then the event is ignored, matching the + * behavior of node core streams in the presense of an AbortSignal. + * + * If the event is 'finish' or 'prefinish', then all listeners will be + * removed after emitting the event, to prevent double-firing. + */ + emit(ev: Event, ...args: Events[Event]): boolean; + [EMITDATA](data: RType): boolean; + [EMITEND](): boolean; + [EMITEND2](): boolean; + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + collect(): Promise; + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + concat(): Promise; + /** + * Return a void Promise that resolves once the stream ends. + */ + promise(): Promise; + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator](): AsyncGenerator; + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator](): Generator; + /** + * Destroy a stream, preventing it from being used for any further purpose. + * + * If the stream has a `close()` method, then it will be called on + * destruction. + * + * After destruction, any attempt to write data, read data, or emit most + * events will be ignored. + * + * If an error argument is provided, then it will be emitted in an + * 'error' event. + */ + destroy(er?: unknown): this; + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream(): (s: any) => s is Minipass | NodeJS.ReadStream | NodeJS.WriteStream | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }) | (NodeJS.ReadStream & { + fd: number; + }) | (NodeJS.WriteStream & { + fd: number; + }); +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/commonjs/index.d.ts.map b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000..7bce611 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist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E,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAezD;IAED;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,CAU7B;IAED;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAM7B;IAED;;;;OAIG;IACH,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CA4D1D;IAED;;;;;OAKG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAiChD;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO,QAwBnB;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ;;;;;;;;;;;OAElB;CACF","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe {\n src: Minipass\n dest: Minipass\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = (er: Error) => this.dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable = Iterable & AsyncIterable\n\n type EventArguments = Record\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events = Minipass.Events\n >\n extends EventEmitter\n implements Minipass.DualIterable\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options]\n : [Minipass.Options])\n ) {\n const options: Minipass.Options = (args[0] ||\n {}) as Minipass.Options\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this as Minipass, dest, opts)\n : new PipeProxyErrors(this as Minipass, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n [Symbol.asyncDispose]: async () => {},\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n [Symbol.dispose]: () => {},\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/commonjs/index.js b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/commonjs/index.js new file mode 100644 index 0000000..91f3a5c --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/commonjs/index.js @@ -0,0 +1,1038 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Minipass = exports.isWritable = exports.isReadable = exports.isStream = void 0; +const proc = typeof process === 'object' && process + ? process + : { + stdout: null, + stderr: null, + }; +const node_events_1 = require("node:events"); +const node_stream_1 = __importDefault(require("node:stream")); +const node_string_decoder_1 = require("node:string_decoder"); +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +const isStream = (s) => !!s && + typeof s === 'object' && + (s instanceof Minipass || + s instanceof node_stream_1.default || + (0, exports.isReadable)(s) || + (0, exports.isWritable)(s)) +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +; +exports.isStream = isStream; +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +const isReadable = (s) => !!s && + typeof s === 'object' && + s instanceof node_events_1.EventEmitter && + typeof s.pipe === 'function' && + // node core Writable streams have a pipe() method, but it throws + s.pipe !== node_stream_1.default.Writable.prototype.pipe +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +; +exports.isReadable = isReadable; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +const isWritable = (s) => !!s && + typeof s === 'object' && + s instanceof node_events_1.EventEmitter && + typeof s.write === 'function' && + typeof s.end === 'function'; +exports.isWritable = isWritable; +const EOF = Symbol('EOF'); +const MAYBE_EMIT_END = Symbol('maybeEmitEnd'); +const EMITTED_END = Symbol('emittedEnd'); +const EMITTING_END = Symbol('emittingEnd'); +const EMITTED_ERROR = Symbol('emittedError'); +const CLOSED = Symbol('closed'); +const READ = Symbol('read'); +const FLUSH = Symbol('flush'); +const FLUSHCHUNK = Symbol('flushChunk'); +const ENCODING = Symbol('encoding'); +const DECODER = Symbol('decoder'); +const FLOWING = Symbol('flowing'); +const PAUSED = Symbol('paused'); +const RESUME = Symbol('resume'); +const BUFFER = Symbol('buffer'); +const PIPES = Symbol('pipes'); +const BUFFERLENGTH = Symbol('bufferLength'); +const BUFFERPUSH = Symbol('bufferPush'); +const BUFFERSHIFT = Symbol('bufferShift'); +const OBJECTMODE = Symbol('objectMode'); +// internal event when stream is destroyed +const DESTROYED = Symbol('destroyed'); +// internal event when stream has an error +const ERROR = Symbol('error'); +const EMITDATA = Symbol('emitData'); +const EMITEND = Symbol('emitEnd'); +const EMITEND2 = Symbol('emitEnd2'); +const ASYNC = Symbol('async'); +const ABORT = Symbol('abort'); +const ABORTED = Symbol('aborted'); +const SIGNAL = Symbol('signal'); +const DATALISTENERS = Symbol('dataListeners'); +const DISCARDED = Symbol('discarded'); +const defer = (fn) => Promise.resolve().then(fn); +const nodefer = (fn) => fn(); +const isEndish = (ev) => ev === 'end' || ev === 'finish' || ev === 'prefinish'; +const isArrayBufferLike = (b) => b instanceof ArrayBuffer || + (!!b && + typeof b === 'object' && + b.constructor && + b.constructor.name === 'ArrayBuffer' && + b.byteLength >= 0); +const isArrayBufferView = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b); +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +class Pipe { + src; + dest; + opts; + ondrain; + constructor(src, dest, opts) { + this.src = src; + this.dest = dest; + this.opts = opts; + this.ondrain = () => src[RESUME](); + this.dest.on('drain', this.ondrain); + } + unpipe() { + this.dest.removeListener('drain', this.ondrain); + } + // only here for the prototype + /* c8 ignore start */ + proxyErrors(_er) { } + /* c8 ignore stop */ + end() { + this.unpipe(); + if (this.opts.end) + this.dest.end(); + } +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +class PipeProxyErrors extends Pipe { + unpipe() { + this.src.removeListener('error', this.proxyErrors); + super.unpipe(); + } + constructor(src, dest, opts) { + super(src, dest, opts); + this.proxyErrors = (er) => this.dest.emit('error', er); + src.on('error', this.proxyErrors); + } +} +const isObjectModeOptions = (o) => !!o.objectMode; +const isEncodingOptions = (o) => !o.objectMode && !!o.encoding && o.encoding !== 'buffer'; +/** + * Main export, the Minipass class + * + * `RType` is the type of data emitted, defaults to Buffer + * + * `WType` is the type of data to be written, if RType is buffer or string, + * then any {@link Minipass.ContiguousData} is allowed. + * + * `Events` is the set of event handler signatures that this object + * will emit, see {@link Minipass.Events} + */ +class Minipass extends node_events_1.EventEmitter { + [FLOWING] = false; + [PAUSED] = false; + [PIPES] = []; + [BUFFER] = []; + [OBJECTMODE]; + [ENCODING]; + [ASYNC]; + [DECODER]; + [EOF] = false; + [EMITTED_END] = false; + [EMITTING_END] = false; + [CLOSED] = false; + [EMITTED_ERROR] = null; + [BUFFERLENGTH] = 0; + [DESTROYED] = false; + [SIGNAL]; + [ABORTED] = false; + [DATALISTENERS] = 0; + [DISCARDED] = false; + /** + * true if the stream can be written + */ + writable = true; + /** + * true if the stream can be read + */ + readable = true; + /** + * If `RType` is Buffer, then options do not need to be provided. + * Otherwise, an options object must be provided to specify either + * {@link Minipass.SharedOptions.objectMode} or + * {@link Minipass.SharedOptions.encoding}, as appropriate. + */ + constructor(...args) { + const options = (args[0] || + {}); + super(); + if (options.objectMode && typeof options.encoding === 'string') { + throw new TypeError('Encoding and objectMode may not be used together'); + } + if (isObjectModeOptions(options)) { + this[OBJECTMODE] = true; + this[ENCODING] = null; + } + else if (isEncodingOptions(options)) { + this[ENCODING] = options.encoding; + this[OBJECTMODE] = false; + } + else { + this[OBJECTMODE] = false; + this[ENCODING] = null; + } + this[ASYNC] = !!options.async; + this[DECODER] = this[ENCODING] + ? new node_string_decoder_1.StringDecoder(this[ENCODING]) + : null; + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposeBuffer === true) { + Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] }); + } + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposePipes === true) { + Object.defineProperty(this, 'pipes', { get: () => this[PIPES] }); + } + const { signal } = options; + if (signal) { + this[SIGNAL] = signal; + if (signal.aborted) { + this[ABORT](); + } + else { + signal.addEventListener('abort', () => this[ABORT]()); + } + } + } + /** + * The amount of data stored in the buffer waiting to be read. + * + * For Buffer strings, this will be the total byte length. + * For string encoding streams, this will be the string character length, + * according to JavaScript's `string.length` logic. + * For objectMode streams, this is a count of the items waiting to be + * emitted. + */ + get bufferLength() { + return this[BUFFERLENGTH]; + } + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding() { + return this[ENCODING]; + } + /** + * @deprecated - This is a read only property + */ + set encoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * True if this is an objectMode stream + */ + get objectMode() { + return this[OBJECTMODE]; + } + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om) { + throw new Error('objectMode must be set at instantiation time'); + } + /** + * true if this is an async stream + */ + get ['async']() { + return this[ASYNC]; + } + /** + * Set to true to make this stream async. + * + * Once set, it cannot be unset, as this would potentially cause incorrect + * behavior. Ie, a sync stream can be made async, but an async stream + * cannot be safely made sync. + */ + set ['async'](a) { + this[ASYNC] = this[ASYNC] || !!a; + } + // drop everything and get out of the flow completely + [ABORT]() { + this[ABORTED] = true; + this.emit('abort', this[SIGNAL]?.reason); + this.destroy(this[SIGNAL]?.reason); + } + /** + * True if the stream has been aborted. + */ + get aborted() { + return this[ABORTED]; + } + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_) { } + write(chunk, encoding, cb) { + if (this[ABORTED]) + return false; + if (this[EOF]) + throw new Error('write after end'); + if (this[DESTROYED]) { + this.emit('error', Object.assign(new Error('Cannot call write after a stream was destroyed'), { code: 'ERR_STREAM_DESTROYED' })); + return true; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (!encoding) + encoding = 'utf8'; + const fn = this[ASYNC] ? defer : nodefer; + // convert array buffers and typed array views into buffers + // at some point in the future, we may want to do the opposite! + // leave strings and buffers as-is + // anything is only allowed if in object mode, so throw + if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) { + if (isArrayBufferView(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength); + } + else if (isArrayBufferLike(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk); + } + else if (typeof chunk !== 'string') { + throw new Error('Non-contiguous data written to non-objectMode stream'); + } + } + // handle object mode up front, since it's simpler + // this yields better performance, fewer checks later. + if (this[OBJECTMODE]) { + // maybe impossible? + /* c8 ignore start */ + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + /* c8 ignore stop */ + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // at this point the chunk is a buffer or string + // don't buffer it up or send it to the decoder + if (!chunk.length) { + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // fast-path writing strings of same encoding to a stream with + // an empty buffer, skipping the buffer/decoder dance + if (typeof chunk === 'string' && + // unless it is a string already ready for us to use + !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)) { + //@ts-ignore - sinful unsafe type change + chunk = Buffer.from(chunk, encoding); + } + if (Buffer.isBuffer(chunk) && this[ENCODING]) { + //@ts-ignore - sinful unsafe type change + chunk = this[DECODER].write(chunk); + } + // Note: flushing CAN potentially switch us into not-flowing mode + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + /** + * Low-level explicit read method. + * + * In objectMode, the argument is ignored, and one item is returned if + * available. + * + * `n` is the number of bytes (or in the case of encoding streams, + * characters) to consume. If `n` is not provided, then the entire buffer + * is returned, or `null` is returned if no data is available. + * + * If `n` is greater that the amount of data in the internal buffer, + * then `null` is returned. + */ + read(n) { + if (this[DESTROYED]) + return null; + this[DISCARDED] = false; + if (this[BUFFERLENGTH] === 0 || + n === 0 || + (n && n > this[BUFFERLENGTH])) { + this[MAYBE_EMIT_END](); + return null; + } + if (this[OBJECTMODE]) + n = null; + if (this[BUFFER].length > 1 && !this[OBJECTMODE]) { + // not object mode, so if we have an encoding, then RType is string + // otherwise, must be Buffer + this[BUFFER] = [ + (this[ENCODING] + ? this[BUFFER].join('') + : Buffer.concat(this[BUFFER], this[BUFFERLENGTH])), + ]; + } + const ret = this[READ](n || null, this[BUFFER][0]); + this[MAYBE_EMIT_END](); + return ret; + } + [READ](n, chunk) { + if (this[OBJECTMODE]) + this[BUFFERSHIFT](); + else { + const c = chunk; + if (n === c.length || n === null) + this[BUFFERSHIFT](); + else if (typeof c === 'string') { + this[BUFFER][0] = c.slice(n); + chunk = c.slice(0, n); + this[BUFFERLENGTH] -= n; + } + else { + this[BUFFER][0] = c.subarray(n); + chunk = c.subarray(0, n); + this[BUFFERLENGTH] -= n; + } + } + this.emit('data', chunk); + if (!this[BUFFER].length && !this[EOF]) + this.emit('drain'); + return chunk; + } + end(chunk, encoding, cb) { + if (typeof chunk === 'function') { + cb = chunk; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (chunk !== undefined) + this.write(chunk, encoding); + if (cb) + this.once('end', cb); + this[EOF] = true; + this.writable = false; + // if we haven't written anything, then go ahead and emit, + // even if we're not reading. + // we'll re-emit if a new 'end' listener is added anyway. + // This makes MP more suitable to write-only use cases. + if (this[FLOWING] || !this[PAUSED]) + this[MAYBE_EMIT_END](); + return this; + } + // don't let the internal resume be overwritten + [RESUME]() { + if (this[DESTROYED]) + return; + if (!this[DATALISTENERS] && !this[PIPES].length) { + this[DISCARDED] = true; + } + this[PAUSED] = false; + this[FLOWING] = true; + this.emit('resume'); + if (this[BUFFER].length) + this[FLUSH](); + else if (this[EOF]) + this[MAYBE_EMIT_END](); + else + this.emit('drain'); + } + /** + * Resume the stream if it is currently in a paused state + * + * If called when there are no pipe destinations or `data` event listeners, + * this will place the stream in a "discarded" state, where all data will + * be thrown away. The discarded state is removed if a pipe destination or + * data handler is added, if pause() is called, or if any synchronous or + * asynchronous iteration is started. + */ + resume() { + return this[RESUME](); + } + /** + * Pause the stream + */ + pause() { + this[FLOWING] = false; + this[PAUSED] = true; + this[DISCARDED] = false; + } + /** + * true if the stream has been forcibly destroyed + */ + get destroyed() { + return this[DESTROYED]; + } + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing() { + return this[FLOWING]; + } + /** + * true if the stream is currently in a paused state + */ + get paused() { + return this[PAUSED]; + } + [BUFFERPUSH](chunk) { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] += 1; + else + this[BUFFERLENGTH] += chunk.length; + this[BUFFER].push(chunk); + } + [BUFFERSHIFT]() { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] -= 1; + else + this[BUFFERLENGTH] -= this[BUFFER][0].length; + return this[BUFFER].shift(); + } + [FLUSH](noDrain = false) { + do { } while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && + this[BUFFER].length); + if (!noDrain && !this[BUFFER].length && !this[EOF]) + this.emit('drain'); + } + [FLUSHCHUNK](chunk) { + this.emit('data', chunk); + return this[FLOWING]; + } + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest, opts) { + if (this[DESTROYED]) + return dest; + this[DISCARDED] = false; + const ended = this[EMITTED_END]; + opts = opts || {}; + if (dest === proc.stdout || dest === proc.stderr) + opts.end = false; + else + opts.end = opts.end !== false; + opts.proxyErrors = !!opts.proxyErrors; + // piping an ended stream ends immediately + if (ended) { + if (opts.end) + dest.end(); + } + else { + // "as" here just ignores the WType, which pipes don't care about, + // since they're only consuming from us, and writing to the dest + this[PIPES].push(!opts.proxyErrors + ? new Pipe(this, dest, opts) + : new PipeProxyErrors(this, dest, opts)); + if (this[ASYNC]) + defer(() => this[RESUME]()); + else + this[RESUME](); + } + return dest; + } + /** + * Fully unhook a piped destination stream. + * + * If the destination stream was the only consumer of this stream (ie, + * there are no other piped destinations or `'data'` event listeners) + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + unpipe(dest) { + const p = this[PIPES].find(p => p.dest === dest); + if (p) { + if (this[PIPES].length === 1) { + if (this[FLOWING] && this[DATALISTENERS] === 0) { + this[FLOWING] = false; + } + this[PIPES] = []; + } + else + this[PIPES].splice(this[PIPES].indexOf(p), 1); + p.unpipe(); + } + } + /** + * Alias for {@link Minipass#on} + */ + addListener(ev, handler) { + return this.on(ev, handler); + } + /** + * Mostly identical to `EventEmitter.on`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * - Adding a 'data' event handler will trigger the flow of data + * + * - Adding a 'readable' event handler when there is data waiting to be read + * will cause 'readable' to be emitted immediately. + * + * - Adding an 'endish' event handler ('end', 'finish', etc.) which has + * already passed will cause the event to be emitted immediately and all + * handlers removed. + * + * - Adding an 'error' event handler after an error has been emitted will + * cause the event to be re-emitted immediately with the error previously + * raised. + */ + on(ev, handler) { + const ret = super.on(ev, handler); + if (ev === 'data') { + this[DISCARDED] = false; + this[DATALISTENERS]++; + if (!this[PIPES].length && !this[FLOWING]) { + this[RESUME](); + } + } + else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) { + super.emit('readable'); + } + else if (isEndish(ev) && this[EMITTED_END]) { + super.emit(ev); + this.removeAllListeners(ev); + } + else if (ev === 'error' && this[EMITTED_ERROR]) { + const h = handler; + if (this[ASYNC]) + defer(() => h.call(this, this[EMITTED_ERROR])); + else + h.call(this, this[EMITTED_ERROR]); + } + return ret; + } + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev, handler) { + return this.off(ev, handler); + } + /** + * Mostly identical to `EventEmitter.off` + * + * If a 'data' event handler is removed, and it was the last consumer + * (ie, there are no pipe destinations or other 'data' event listeners), + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + off(ev, handler) { + const ret = super.off(ev, handler); + // if we previously had listeners, and now we don't, and we don't + // have any pipes, then stop the flow, unless it's been explicitly + // put in a discarded flowing state via stream.resume(). + if (ev === 'data') { + this[DATALISTENERS] = this.listeners('data').length; + if (this[DATALISTENERS] === 0 && + !this[DISCARDED] && + !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * Mostly identical to `EventEmitter.removeAllListeners` + * + * If all 'data' event handlers are removed, and they were the last consumer + * (ie, there are no pipe destinations), then the flow of data will stop + * until there is another consumer or {@link Minipass#resume} is explicitly + * called. + */ + removeAllListeners(ev) { + const ret = super.removeAllListeners(ev); + if (ev === 'data' || ev === undefined) { + this[DATALISTENERS] = 0; + if (!this[DISCARDED] && !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * true if the 'end' event has been emitted + */ + get emittedEnd() { + return this[EMITTED_END]; + } + [MAYBE_EMIT_END]() { + if (!this[EMITTING_END] && + !this[EMITTED_END] && + !this[DESTROYED] && + this[BUFFER].length === 0 && + this[EOF]) { + this[EMITTING_END] = true; + this.emit('end'); + this.emit('prefinish'); + this.emit('finish'); + if (this[CLOSED]) + this.emit('close'); + this[EMITTING_END] = false; + } + } + /** + * Mostly identical to `EventEmitter.emit`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * If the stream has been destroyed, and the event is something other + * than 'close' or 'error', then `false` is returned and no handlers + * are called. + * + * If the event is 'end', and has already been emitted, then the event + * is ignored. If the stream is in a paused or non-flowing state, then + * the event will be deferred until data flow resumes. If the stream is + * async, then handlers will be called on the next tick rather than + * immediately. + * + * If the event is 'close', and 'end' has not yet been emitted, then + * the event will be deferred until after 'end' is emitted. + * + * If the event is 'error', and an AbortSignal was provided for the stream, + * and there are no listeners, then the event is ignored, matching the + * behavior of node core streams in the presense of an AbortSignal. + * + * If the event is 'finish' or 'prefinish', then all listeners will be + * removed after emitting the event, to prevent double-firing. + */ + emit(ev, ...args) { + const data = args[0]; + // error and close are only events allowed after calling destroy() + if (ev !== 'error' && + ev !== 'close' && + ev !== DESTROYED && + this[DESTROYED]) { + return false; + } + else if (ev === 'data') { + return !this[OBJECTMODE] && !data + ? false + : this[ASYNC] + ? (defer(() => this[EMITDATA](data)), true) + : this[EMITDATA](data); + } + else if (ev === 'end') { + return this[EMITEND](); + } + else if (ev === 'close') { + this[CLOSED] = true; + // don't emit close before 'end' and 'finish' + if (!this[EMITTED_END] && !this[DESTROYED]) + return false; + const ret = super.emit('close'); + this.removeAllListeners('close'); + return ret; + } + else if (ev === 'error') { + this[EMITTED_ERROR] = data; + super.emit(ERROR, data); + const ret = !this[SIGNAL] || this.listeners('error').length + ? super.emit('error', data) + : false; + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'resume') { + const ret = super.emit('resume'); + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'finish' || ev === 'prefinish') { + const ret = super.emit(ev); + this.removeAllListeners(ev); + return ret; + } + // Some other unknown event + const ret = super.emit(ev, ...args); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITDATA](data) { + for (const p of this[PIPES]) { + if (p.dest.write(data) === false) + this.pause(); + } + const ret = this[DISCARDED] ? false : super.emit('data', data); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITEND]() { + if (this[EMITTED_END]) + return false; + this[EMITTED_END] = true; + this.readable = false; + return this[ASYNC] + ? (defer(() => this[EMITEND2]()), true) + : this[EMITEND2](); + } + [EMITEND2]() { + if (this[DECODER]) { + const data = this[DECODER].end(); + if (data) { + for (const p of this[PIPES]) { + p.dest.write(data); + } + if (!this[DISCARDED]) + super.emit('data', data); + } + } + for (const p of this[PIPES]) { + p.end(); + } + const ret = super.emit('end'); + this.removeAllListeners('end'); + return ret; + } + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + async collect() { + const buf = Object.assign([], { + dataLength: 0, + }); + if (!this[OBJECTMODE]) + buf.dataLength = 0; + // set the promise first, in case an error is raised + // by triggering the flow here. + const p = this.promise(); + this.on('data', c => { + buf.push(c); + if (!this[OBJECTMODE]) + buf.dataLength += c.length; + }); + await p; + return buf; + } + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + async concat() { + if (this[OBJECTMODE]) { + throw new Error('cannot concat in objectMode'); + } + const buf = await this.collect(); + return (this[ENCODING] + ? buf.join('') + : Buffer.concat(buf, buf.dataLength)); + } + /** + * Return a void Promise that resolves once the stream ends. + */ + async promise() { + return new Promise((resolve, reject) => { + this.on(DESTROYED, () => reject(new Error('stream destroyed'))); + this.on('error', er => reject(er)); + this.on('end', () => resolve()); + }); + } + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = async () => { + this.pause(); + stopped = true; + return { value: undefined, done: true }; + }; + const next = () => { + if (stopped) + return stop(); + const res = this.read(); + if (res !== null) + return Promise.resolve({ done: false, value: res }); + if (this[EOF]) + return stop(); + let resolve; + let reject; + const onerr = (er) => { + this.off('data', ondata); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + stop(); + reject(er); + }; + const ondata = (value) => { + this.off('error', onerr); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + this.pause(); + resolve({ value, done: !!this[EOF] }); + }; + const onend = () => { + this.off('error', onerr); + this.off('data', ondata); + this.off(DESTROYED, ondestroy); + stop(); + resolve({ done: true, value: undefined }); + }; + const ondestroy = () => onerr(new Error('stream destroyed')); + return new Promise((res, rej) => { + reject = rej; + resolve = res; + this.once(DESTROYED, ondestroy); + this.once('error', onerr); + this.once('end', onend); + this.once('data', ondata); + }); + }; + return { + next, + throw: stop, + return: stop, + [Symbol.asyncIterator]() { + return this; + }, + [Symbol.asyncDispose]: async () => { }, + }; + } + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = () => { + this.pause(); + this.off(ERROR, stop); + this.off(DESTROYED, stop); + this.off('end', stop); + stopped = true; + return { done: true, value: undefined }; + }; + const next = () => { + if (stopped) + return stop(); + const value = this.read(); + return value === null ? stop() : { done: false, value }; + }; + this.once('end', stop); + this.once(ERROR, stop); + this.once(DESTROYED, stop); + return { + next, + throw: stop, + return: stop, + [Symbol.iterator]() { + return this; + }, + [Symbol.dispose]: () => { }, + }; + } + /** + * Destroy a stream, preventing it from being used for any further purpose. + * + * If the stream has a `close()` method, then it will be called on + * destruction. + * + * After destruction, any attempt to write data, read data, or emit most + * events will be ignored. + * + * If an error argument is provided, then it will be emitted in an + * 'error' event. + */ + destroy(er) { + if (this[DESTROYED]) { + if (er) + this.emit('error', er); + else + this.emit(DESTROYED); + return this; + } + this[DESTROYED] = true; + this[DISCARDED] = true; + // throw away all buffered data, it's never coming out + this[BUFFER].length = 0; + this[BUFFERLENGTH] = 0; + const wc = this; + if (typeof wc.close === 'function' && !this[CLOSED]) + wc.close(); + if (er) + this.emit('error', er); + // if no error to emit, still reject pending promises + else + this.emit(DESTROYED); + return this; + } + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream() { + return exports.isStream; + } +} +exports.Minipass = Minipass; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/commonjs/index.js.map b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/commonjs/index.js.map new file mode 100644 index 0000000..1687b4c --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,MAAM,IAAI,GACR,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO;IACpC,CAAC,CAAC,OAAO;IACT,CAAC,CAAC;QACE,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;KACb,CAAA;AACP,6CAA0C;AAC1C,8DAAgC;AAChC,6DAAmD;AASnD;;;GAGG;AACI,MAAM,QAAQ,GAAG,CACtB,CAAM,EACsC,EAAE,CAC9C,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,CAAC,YAAY,QAAQ;QACpB,CAAC,YAAY,qBAAM;QACnB,IAAA,QAAA,UAAU,EAAC,CAAC,CAAC;QACb,IAAA,QAAA,UAAU,EAAC,CAAC,CAAC,CAAC;AAElB;;GAEG;AAJe,CAAA;AARL,QAAA,QAAQ,GAAR,QAAQ,CAQH;AAElB;;GAEG;AACI,MAAM,UAAU,GAAG,CAAC,CAAM,EAA0B,EAAE,CAC3D,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,YAAY,0BAAY;IACzB,OAAQ,CAAuB,CAAC,IAAI,KAAK,UAAU;IACnD,iEAAiE;IAChE,CAAuB,CAAC,IAAI,KAAK,qBAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI;AAElE;;GAEG;AAJ+D,CAAA;AANrD,QAAA,UAAU,GAAV,UAAU,CAM2C;AAElE;;GAEG;AACI,MAAM,UAAU,GAAG,CAAC,CAAM,EAA0B,EAAE,CAC3D,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,YAAY,0BAAY;IACzB,OAAQ,CAAuB,C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,CAAA;;gBACzB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YACzB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;QACtB,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;QAEtB,sDAAsD;QACtD,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;QACvB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;QAEtB,MAAM,EAAE,GAAG,IAEV,CAAA;QACD,IAAI,OAAO,EAAE,CAAC,KAAK,KAAK,UAAU,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,EAAE,CAAC,KAAK,EAAE,CAAA;QAE/D,IAAI,EAAE;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;QAC9B,qDAAqD;;YAChD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAEzB,OAAO,IAAI,CAAA;IAAA,CACZ;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ,GAAG;QACpB,OAAO,QAAA,QAAQ,CAAA;IAAA,CAChB;CACF","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe {\n src: Minipass\n dest: Minipass\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = (er: Error) => this.dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable = Iterable & AsyncIterable\n\n type EventArguments = Record\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events = Minipass.Events\n >\n extends EventEmitter\n implements Minipass.DualIterable\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options]\n : [Minipass.Options])\n ) {\n const options: Minipass.Options = (args[0] ||\n {}) as Minipass.Options\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this as Minipass, dest, opts)\n : new PipeProxyErrors(this as Minipass, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n [Symbol.asyncDispose]: async () => {},\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n [Symbol.dispose]: () => {},\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/commonjs/package.json b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/commonjs/package.json new file mode 100644 index 0000000..5bbefff --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/esm/index.d.ts b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/esm/index.d.ts new file mode 100644 index 0000000..3e75b57 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/esm/index.d.ts @@ -0,0 +1,545 @@ +import { EventEmitter } from 'node:events'; +import { StringDecoder } from 'node:string_decoder'; +/** + * Same as StringDecoder, but exposing the `lastNeed` flag on the type + */ +type SD = StringDecoder & { + lastNeed: boolean; +}; +export type { SD, Pipe, PipeProxyErrors }; +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +export declare const isStream: (s: any) => s is Minipass | NodeJS.ReadStream | NodeJS.WriteStream | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; +}) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; +}) | (NodeJS.ReadStream & { + fd: number; +}) | (NodeJS.WriteStream & { + fd: number; +}); +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +export declare const isReadable: (s: any) => s is Minipass.Readable; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +export declare const isWritable: (s: any) => s is Minipass.Readable; +declare const EOF: unique symbol; +declare const MAYBE_EMIT_END: unique symbol; +declare const EMITTED_END: unique symbol; +declare const EMITTING_END: unique symbol; +declare const EMITTED_ERROR: unique symbol; +declare const CLOSED: unique symbol; +declare const READ: unique symbol; +declare const FLUSH: unique symbol; +declare const FLUSHCHUNK: unique symbol; +declare const ENCODING: unique symbol; +declare const DECODER: unique symbol; +declare const FLOWING: unique symbol; +declare const PAUSED: unique symbol; +declare const RESUME: unique symbol; +declare const BUFFER: unique symbol; +declare const PIPES: unique symbol; +declare const BUFFERLENGTH: unique symbol; +declare const BUFFERPUSH: unique symbol; +declare const BUFFERSHIFT: unique symbol; +declare const OBJECTMODE: unique symbol; +declare const DESTROYED: unique symbol; +declare const ERROR: unique symbol; +declare const EMITDATA: unique symbol; +declare const EMITEND: unique symbol; +declare const EMITEND2: unique symbol; +declare const ASYNC: unique symbol; +declare const ABORT: unique symbol; +declare const ABORTED: unique symbol; +declare const SIGNAL: unique symbol; +declare const DATALISTENERS: unique symbol; +declare const DISCARDED: unique symbol; +/** + * Options that may be passed to stream.pipe() + */ +export interface PipeOptions { + /** + * end the destination stream when the source stream ends + */ + end?: boolean; + /** + * proxy errors from the source stream to the destination stream + */ + proxyErrors?: boolean; +} +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +declare class Pipe { + src: Minipass; + dest: Minipass; + opts: PipeOptions; + ondrain: () => any; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); + unpipe(): void; + proxyErrors(_er: any): void; + end(): void; +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +declare class PipeProxyErrors extends Pipe { + unpipe(): void; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); +} +export declare namespace Minipass { + /** + * Encoding used to create a stream that outputs strings rather than + * Buffer objects. + */ + export type Encoding = BufferEncoding | 'buffer' | null; + /** + * Any stream that Minipass can pipe into + */ + export type Writable = Minipass | NodeJS.WriteStream | (NodeJS.WriteStream & { + fd: number; + }) | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }); + /** + * Any stream that can be read from + */ + export type Readable = Minipass | NodeJS.ReadStream | (NodeJS.ReadStream & { + fd: number; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }); + /** + * Utility type that can be iterated sync or async + */ + export type DualIterable = Iterable & AsyncIterable; + type EventArguments = Record; + /** + * The listing of events that a Minipass class can emit. + * Extend this when extending the Minipass class, and pass as + * the third template argument. The key is the name of the event, + * and the value is the argument list. + * + * Any undeclared events will still be allowed, but the handler will get + * arguments as `unknown[]`. + */ + export interface Events extends EventArguments { + readable: []; + data: [chunk: RType]; + error: [er: unknown]; + abort: [reason: unknown]; + drain: []; + resume: []; + end: []; + finish: []; + prefinish: []; + close: []; + [DESTROYED]: [er?: unknown]; + [ERROR]: [er: unknown]; + } + /** + * String or buffer-like data that can be joined and sliced + */ + export type ContiguousData = Buffer | ArrayBufferLike | ArrayBufferView | string; + export type BufferOrString = Buffer | string; + /** + * Options passed to the Minipass constructor. + */ + export type SharedOptions = { + /** + * Defer all data emission and other events until the end of the + * current tick, similar to Node core streams + */ + async?: boolean; + /** + * A signal which will abort the stream + */ + signal?: AbortSignal; + /** + * Output string encoding. Set to `null` or `'buffer'` (or omit) to + * emit Buffer objects rather than strings. + * + * Conflicts with `objectMode` + */ + encoding?: BufferEncoding | null | 'buffer'; + /** + * Output data exactly as it was written, supporting non-buffer/string + * data (such as arbitrary objects, falsey values, etc.) + * + * Conflicts with `encoding` + */ + objectMode?: boolean; + }; + /** + * Options for a string encoded output + */ + export type EncodingOptions = SharedOptions & { + encoding: BufferEncoding; + objectMode?: false; + }; + /** + * Options for contiguous data buffer output + */ + export type BufferOptions = SharedOptions & { + encoding?: null | 'buffer'; + objectMode?: false; + }; + /** + * Options for objectMode arbitrary output + */ + export type ObjectModeOptions = SharedOptions & { + objectMode: true; + encoding?: null; + }; + /** + * Utility type to determine allowed options based on read type + */ + export type Options = ObjectModeOptions | (T extends string ? EncodingOptions : T extends Buffer ? BufferOptions : SharedOptions); + export {}; +} +/** + * Main export, the Minipass class + * + * `RType` is the type of data emitted, defaults to Buffer + * + * `WType` is the type of data to be written, if RType is buffer or string, + * then any {@link Minipass.ContiguousData} is allowed. + * + * `Events` is the set of event handler signatures that this object + * will emit, see {@link Minipass.Events} + */ +export declare class Minipass = Minipass.Events> extends EventEmitter implements Minipass.DualIterable { + [FLOWING]: boolean; + [PAUSED]: boolean; + [PIPES]: Pipe[]; + [BUFFER]: RType[]; + [OBJECTMODE]: boolean; + [ENCODING]: BufferEncoding | null; + [ASYNC]: boolean; + [DECODER]: SD | null; + [EOF]: boolean; + [EMITTED_END]: boolean; + [EMITTING_END]: boolean; + [CLOSED]: boolean; + [EMITTED_ERROR]: unknown; + [BUFFERLENGTH]: number; + [DESTROYED]: boolean; + [SIGNAL]?: AbortSignal; + [ABORTED]: boolean; + [DATALISTENERS]: number; + [DISCARDED]: boolean; + /** + * true if the stream can be written + */ + writable: boolean; + /** + * true if the stream can be read + */ + readable: boolean; + /** + * If `RType` is Buffer, then options do not need to be provided. + * Otherwise, an options object must be provided to specify either + * {@link Minipass.SharedOptions.objectMode} or + * {@link Minipass.SharedOptions.encoding}, as appropriate. + */ + constructor(...args: [Minipass.ObjectModeOptions] | (RType extends Buffer ? [] | [Minipass.Options] : [Minipass.Options])); + /** + * The amount of data stored in the buffer waiting to be read. + * + * For Buffer strings, this will be the total byte length. + * For string encoding streams, this will be the string character length, + * according to JavaScript's `string.length` logic. + * For objectMode streams, this is a count of the items waiting to be + * emitted. + */ + get bufferLength(): number; + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding(): BufferEncoding | null; + /** + * @deprecated - This is a read only property + */ + set encoding(_enc: BufferEncoding | null); + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc: Minipass.Encoding): void; + /** + * True if this is an objectMode stream + */ + get objectMode(): boolean; + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om: boolean); + /** + * true if this is an async stream + */ + get ['async'](): boolean; + /** + * Set to true to make this stream async. + * + * Once set, it cannot be unset, as this would potentially cause incorrect + * behavior. Ie, a sync stream can be made async, but an async stream + * cannot be safely made sync. + */ + set ['async'](a: boolean); + [ABORT](): void; + /** + * True if the stream has been aborted. + */ + get aborted(): boolean; + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_: boolean); + /** + * Write data into the stream + * + * If the chunk written is a string, and encoding is not specified, then + * `utf8` will be assumed. If the stream encoding matches the encoding of + * a written string, and the state of the string decoder allows it, then + * the string will be passed through to either the output or the internal + * buffer without any processing. Otherwise, it will be turned into a + * Buffer object for processing into the desired encoding. + * + * If provided, `cb` function is called immediately before return for + * sync streams, or on next tick for async streams, because for this + * base class, a chunk is considered "processed" once it is accepted + * and either emitted or buffered. That is, the callback does not indicate + * that the chunk has been eventually emitted, though of course child + * classes can override this function to do whatever processing is required + * and call `super.write(...)` only once processing is completed. + */ + write(chunk: WType, cb?: () => void): boolean; + write(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): boolean; + /** + * Low-level explicit read method. + * + * In objectMode, the argument is ignored, and one item is returned if + * available. + * + * `n` is the number of bytes (or in the case of encoding streams, + * characters) to consume. If `n` is not provided, then the entire buffer + * is returned, or `null` is returned if no data is available. + * + * If `n` is greater that the amount of data in the internal buffer, + * then `null` is returned. + */ + read(n?: number | null): RType | null; + [READ](n: number | null, chunk: RType): RType; + /** + * End the stream, optionally providing a final write. + * + * See {@link Minipass#write} for argument descriptions + */ + end(cb?: () => void): this; + end(chunk: WType, cb?: () => void): this; + end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this; + [RESUME](): void; + /** + * Resume the stream if it is currently in a paused state + * + * If called when there are no pipe destinations or `data` event listeners, + * this will place the stream in a "discarded" state, where all data will + * be thrown away. The discarded state is removed if a pipe destination or + * data handler is added, if pause() is called, or if any synchronous or + * asynchronous iteration is started. + */ + resume(): void; + /** + * Pause the stream + */ + pause(): void; + /** + * true if the stream has been forcibly destroyed + */ + get destroyed(): boolean; + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing(): boolean; + /** + * true if the stream is currently in a paused state + */ + get paused(): boolean; + [BUFFERPUSH](chunk: RType): void; + [BUFFERSHIFT](): RType; + [FLUSH](noDrain?: boolean): void; + [FLUSHCHUNK](chunk: RType): boolean; + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest: W, opts?: PipeOptions): W; + /** + * Fully unhook a piped destination stream. + * + * If the destination stream was the only consumer of this stream (ie, + * there are no other piped destinations or `'data'` event listeners) + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + unpipe(dest: W): void; + /** + * Alias for {@link Minipass#on} + */ + addListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.on`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * - Adding a 'data' event handler will trigger the flow of data + * + * - Adding a 'readable' event handler when there is data waiting to be read + * will cause 'readable' to be emitted immediately. + * + * - Adding an 'endish' event handler ('end', 'finish', etc.) which has + * already passed will cause the event to be emitted immediately and all + * handlers removed. + * + * - Adding an 'error' event handler after an error has been emitted will + * cause the event to be re-emitted immediately with the error previously + * raised. + */ + on(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.off` + * + * If a 'data' event handler is removed, and it was the last consumer + * (ie, there are no pipe destinations or other 'data' event listeners), + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + off(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.removeAllListeners` + * + * If all 'data' event handlers are removed, and they were the last consumer + * (ie, there are no pipe destinations), then the flow of data will stop + * until there is another consumer or {@link Minipass#resume} is explicitly + * called. + */ + removeAllListeners(ev?: Event): this; + /** + * true if the 'end' event has been emitted + */ + get emittedEnd(): boolean; + [MAYBE_EMIT_END](): void; + /** + * Mostly identical to `EventEmitter.emit`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * If the stream has been destroyed, and the event is something other + * than 'close' or 'error', then `false` is returned and no handlers + * are called. + * + * If the event is 'end', and has already been emitted, then the event + * is ignored. If the stream is in a paused or non-flowing state, then + * the event will be deferred until data flow resumes. If the stream is + * async, then handlers will be called on the next tick rather than + * immediately. + * + * If the event is 'close', and 'end' has not yet been emitted, then + * the event will be deferred until after 'end' is emitted. + * + * If the event is 'error', and an AbortSignal was provided for the stream, + * and there are no listeners, then the event is ignored, matching the + * behavior of node core streams in the presense of an AbortSignal. + * + * If the event is 'finish' or 'prefinish', then all listeners will be + * removed after emitting the event, to prevent double-firing. + */ + emit(ev: Event, ...args: Events[Event]): boolean; + [EMITDATA](data: RType): boolean; + [EMITEND](): boolean; + [EMITEND2](): boolean; + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + collect(): Promise; + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + concat(): Promise; + /** + * Return a void Promise that resolves once the stream ends. + */ + promise(): Promise; + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator](): AsyncGenerator; + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator](): Generator; + /** + * Destroy a stream, preventing it from being used for any further purpose. + * + * If the stream has a `close()` method, then it will be called on + * destruction. + * + * After destruction, any attempt to write data, read data, or emit most + * events will be ignored. + * + * If an error argument is provided, then it will be emitted in an + * 'error' event. + */ + destroy(er?: unknown): this; + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream(): (s: any) => s is Minipass | NodeJS.ReadStream | NodeJS.WriteStream | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }) | (NodeJS.ReadStream & { + fd: number; + }) | (NodeJS.WriteStream & { + fd: number; + }); +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/esm/index.d.ts.map b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/esm/index.d.ts.map new file mode 100644 index 0000000..7bce611 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD;;GAEG;AACH,KAAK,EAAE,GAAG,aAAa,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAA;AAE/C,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAA;AAEzC;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;EAQH,CAAA;AAElB;;GAEG;AACH,eAAO,MAAM,UAAU,oCAM2C,CAAA;AAElE;;GAEG;AACH,eAAO,MAAM,UAAU,oCAK6B,CAAA;AAEpD,QAAA,MAAM,GAAG,eAAgB,CAAA;AACzB,QAAA,MAAM,cAAc,eAAyB,CAAA;AAC7C,QAAA,MAAM,WAAW,eAAuB,CAAA;AACxC,QAAA,MAAM,YAAY,eAAwB,CAAA;AAC1C,QAAA,MAAM,aAAa,eAAyB,CAAA;AAC5C,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,IAAI,eAAiB,CAAA;AAC3B,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA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,CAAC,cAAc,CAAC,SAef;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,IAAI,CAAC,KAAK,SAAS,MAAM,MAAM,EAC7B,EAAE,EAAE,KAAK,EACT,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GACrB,OAAO,CAgDT;IAED,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,KAAK,WAOrB;IAED,CAAC,OAAO,CAAC,YAQR;IAED,CAAC,QAAQ,CAAC,YAiBT;IAED;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAezD;IAED;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,CAU7B;IAED;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAM7B;IAED;;;;OAIG;IACH,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CA4D1D;IAED;;;;;OAKG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAiChD;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO,QAwBnB;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ;;;;;;;;;;;OAElB;CACF","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe {\n src: Minipass\n dest: Minipass\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = (er: Error) => this.dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable = Iterable & AsyncIterable\n\n type EventArguments = Record\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events = Minipass.Events\n >\n extends EventEmitter\n implements Minipass.DualIterable\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options]\n : [Minipass.Options])\n ) {\n const options: Minipass.Options = (args[0] ||\n {}) as Minipass.Options\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this as Minipass, dest, opts)\n : new PipeProxyErrors(this as Minipass, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n [Symbol.asyncDispose]: async () => {},\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n [Symbol.dispose]: () => {},\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/esm/index.js b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/esm/index.js new file mode 100644 index 0000000..5df5546 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/esm/index.js @@ -0,0 +1,1020 @@ +const proc = typeof process === 'object' && process + ? process + : { + stdout: null, + stderr: null, + }; +import { EventEmitter } from 'node:events'; +import Stream from 'node:stream'; +import { StringDecoder } from 'node:string_decoder'; +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +export const isStream = (s) => !!s && + typeof s === 'object' && + (s instanceof Minipass || + s instanceof Stream || + isReadable(s) || + isWritable(s)); +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +export const isReadable = (s) => !!s && + typeof s === 'object' && + s instanceof EventEmitter && + typeof s.pipe === 'function' && + // node core Writable streams have a pipe() method, but it throws + s.pipe !== Stream.Writable.prototype.pipe; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +export const isWritable = (s) => !!s && + typeof s === 'object' && + s instanceof EventEmitter && + typeof s.write === 'function' && + typeof s.end === 'function'; +const EOF = Symbol('EOF'); +const MAYBE_EMIT_END = Symbol('maybeEmitEnd'); +const EMITTED_END = Symbol('emittedEnd'); +const EMITTING_END = Symbol('emittingEnd'); +const EMITTED_ERROR = Symbol('emittedError'); +const CLOSED = Symbol('closed'); +const READ = Symbol('read'); +const FLUSH = Symbol('flush'); +const FLUSHCHUNK = Symbol('flushChunk'); +const ENCODING = Symbol('encoding'); +const DECODER = Symbol('decoder'); +const FLOWING = Symbol('flowing'); +const PAUSED = Symbol('paused'); +const RESUME = Symbol('resume'); +const BUFFER = Symbol('buffer'); +const PIPES = Symbol('pipes'); +const BUFFERLENGTH = Symbol('bufferLength'); +const BUFFERPUSH = Symbol('bufferPush'); +const BUFFERSHIFT = Symbol('bufferShift'); +const OBJECTMODE = Symbol('objectMode'); +// internal event when stream is destroyed +const DESTROYED = Symbol('destroyed'); +// internal event when stream has an error +const ERROR = Symbol('error'); +const EMITDATA = Symbol('emitData'); +const EMITEND = Symbol('emitEnd'); +const EMITEND2 = Symbol('emitEnd2'); +const ASYNC = Symbol('async'); +const ABORT = Symbol('abort'); +const ABORTED = Symbol('aborted'); +const SIGNAL = Symbol('signal'); +const DATALISTENERS = Symbol('dataListeners'); +const DISCARDED = Symbol('discarded'); +const defer = (fn) => Promise.resolve().then(fn); +const nodefer = (fn) => fn(); +const isEndish = (ev) => ev === 'end' || ev === 'finish' || ev === 'prefinish'; +const isArrayBufferLike = (b) => b instanceof ArrayBuffer || + (!!b && + typeof b === 'object' && + b.constructor && + b.constructor.name === 'ArrayBuffer' && + b.byteLength >= 0); +const isArrayBufferView = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b); +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +class Pipe { + src; + dest; + opts; + ondrain; + constructor(src, dest, opts) { + this.src = src; + this.dest = dest; + this.opts = opts; + this.ondrain = () => src[RESUME](); + this.dest.on('drain', this.ondrain); + } + unpipe() { + this.dest.removeListener('drain', this.ondrain); + } + // only here for the prototype + /* c8 ignore start */ + proxyErrors(_er) { } + /* c8 ignore stop */ + end() { + this.unpipe(); + if (this.opts.end) + this.dest.end(); + } +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +class PipeProxyErrors extends Pipe { + unpipe() { + this.src.removeListener('error', this.proxyErrors); + super.unpipe(); + } + constructor(src, dest, opts) { + super(src, dest, opts); + this.proxyErrors = (er) => this.dest.emit('error', er); + src.on('error', this.proxyErrors); + } +} +const isObjectModeOptions = (o) => !!o.objectMode; +const isEncodingOptions = (o) => !o.objectMode && !!o.encoding && o.encoding !== 'buffer'; +/** + * Main export, the Minipass class + * + * `RType` is the type of data emitted, defaults to Buffer + * + * `WType` is the type of data to be written, if RType is buffer or string, + * then any {@link Minipass.ContiguousData} is allowed. + * + * `Events` is the set of event handler signatures that this object + * will emit, see {@link Minipass.Events} + */ +export class Minipass extends EventEmitter { + [FLOWING] = false; + [PAUSED] = false; + [PIPES] = []; + [BUFFER] = []; + [OBJECTMODE]; + [ENCODING]; + [ASYNC]; + [DECODER]; + [EOF] = false; + [EMITTED_END] = false; + [EMITTING_END] = false; + [CLOSED] = false; + [EMITTED_ERROR] = null; + [BUFFERLENGTH] = 0; + [DESTROYED] = false; + [SIGNAL]; + [ABORTED] = false; + [DATALISTENERS] = 0; + [DISCARDED] = false; + /** + * true if the stream can be written + */ + writable = true; + /** + * true if the stream can be read + */ + readable = true; + /** + * If `RType` is Buffer, then options do not need to be provided. + * Otherwise, an options object must be provided to specify either + * {@link Minipass.SharedOptions.objectMode} or + * {@link Minipass.SharedOptions.encoding}, as appropriate. + */ + constructor(...args) { + const options = (args[0] || + {}); + super(); + if (options.objectMode && typeof options.encoding === 'string') { + throw new TypeError('Encoding and objectMode may not be used together'); + } + if (isObjectModeOptions(options)) { + this[OBJECTMODE] = true; + this[ENCODING] = null; + } + else if (isEncodingOptions(options)) { + this[ENCODING] = options.encoding; + this[OBJECTMODE] = false; + } + else { + this[OBJECTMODE] = false; + this[ENCODING] = null; + } + this[ASYNC] = !!options.async; + this[DECODER] = this[ENCODING] + ? new StringDecoder(this[ENCODING]) + : null; + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposeBuffer === true) { + Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] }); + } + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposePipes === true) { + Object.defineProperty(this, 'pipes', { get: () => this[PIPES] }); + } + const { signal } = options; + if (signal) { + this[SIGNAL] = signal; + if (signal.aborted) { + this[ABORT](); + } + else { + signal.addEventListener('abort', () => this[ABORT]()); + } + } + } + /** + * The amount of data stored in the buffer waiting to be read. + * + * For Buffer strings, this will be the total byte length. + * For string encoding streams, this will be the string character length, + * according to JavaScript's `string.length` logic. + * For objectMode streams, this is a count of the items waiting to be + * emitted. + */ + get bufferLength() { + return this[BUFFERLENGTH]; + } + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding() { + return this[ENCODING]; + } + /** + * @deprecated - This is a read only property + */ + set encoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * True if this is an objectMode stream + */ + get objectMode() { + return this[OBJECTMODE]; + } + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om) { + throw new Error('objectMode must be set at instantiation time'); + } + /** + * true if this is an async stream + */ + get ['async']() { + return this[ASYNC]; + } + /** + * Set to true to make this stream async. + * + * Once set, it cannot be unset, as this would potentially cause incorrect + * behavior. Ie, a sync stream can be made async, but an async stream + * cannot be safely made sync. + */ + set ['async'](a) { + this[ASYNC] = this[ASYNC] || !!a; + } + // drop everything and get out of the flow completely + [ABORT]() { + this[ABORTED] = true; + this.emit('abort', this[SIGNAL]?.reason); + this.destroy(this[SIGNAL]?.reason); + } + /** + * True if the stream has been aborted. + */ + get aborted() { + return this[ABORTED]; + } + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_) { } + write(chunk, encoding, cb) { + if (this[ABORTED]) + return false; + if (this[EOF]) + throw new Error('write after end'); + if (this[DESTROYED]) { + this.emit('error', Object.assign(new Error('Cannot call write after a stream was destroyed'), { code: 'ERR_STREAM_DESTROYED' })); + return true; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (!encoding) + encoding = 'utf8'; + const fn = this[ASYNC] ? defer : nodefer; + // convert array buffers and typed array views into buffers + // at some point in the future, we may want to do the opposite! + // leave strings and buffers as-is + // anything is only allowed if in object mode, so throw + if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) { + if (isArrayBufferView(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength); + } + else if (isArrayBufferLike(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk); + } + else if (typeof chunk !== 'string') { + throw new Error('Non-contiguous data written to non-objectMode stream'); + } + } + // handle object mode up front, since it's simpler + // this yields better performance, fewer checks later. + if (this[OBJECTMODE]) { + // maybe impossible? + /* c8 ignore start */ + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + /* c8 ignore stop */ + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // at this point the chunk is a buffer or string + // don't buffer it up or send it to the decoder + if (!chunk.length) { + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // fast-path writing strings of same encoding to a stream with + // an empty buffer, skipping the buffer/decoder dance + if (typeof chunk === 'string' && + // unless it is a string already ready for us to use + !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)) { + //@ts-ignore - sinful unsafe type change + chunk = Buffer.from(chunk, encoding); + } + if (Buffer.isBuffer(chunk) && this[ENCODING]) { + //@ts-ignore - sinful unsafe type change + chunk = this[DECODER].write(chunk); + } + // Note: flushing CAN potentially switch us into not-flowing mode + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + /** + * Low-level explicit read method. + * + * In objectMode, the argument is ignored, and one item is returned if + * available. + * + * `n` is the number of bytes (or in the case of encoding streams, + * characters) to consume. If `n` is not provided, then the entire buffer + * is returned, or `null` is returned if no data is available. + * + * If `n` is greater that the amount of data in the internal buffer, + * then `null` is returned. + */ + read(n) { + if (this[DESTROYED]) + return null; + this[DISCARDED] = false; + if (this[BUFFERLENGTH] === 0 || + n === 0 || + (n && n > this[BUFFERLENGTH])) { + this[MAYBE_EMIT_END](); + return null; + } + if (this[OBJECTMODE]) + n = null; + if (this[BUFFER].length > 1 && !this[OBJECTMODE]) { + // not object mode, so if we have an encoding, then RType is string + // otherwise, must be Buffer + this[BUFFER] = [ + (this[ENCODING] + ? this[BUFFER].join('') + : Buffer.concat(this[BUFFER], this[BUFFERLENGTH])), + ]; + } + const ret = this[READ](n || null, this[BUFFER][0]); + this[MAYBE_EMIT_END](); + return ret; + } + [READ](n, chunk) { + if (this[OBJECTMODE]) + this[BUFFERSHIFT](); + else { + const c = chunk; + if (n === c.length || n === null) + this[BUFFERSHIFT](); + else if (typeof c === 'string') { + this[BUFFER][0] = c.slice(n); + chunk = c.slice(0, n); + this[BUFFERLENGTH] -= n; + } + else { + this[BUFFER][0] = c.subarray(n); + chunk = c.subarray(0, n); + this[BUFFERLENGTH] -= n; + } + } + this.emit('data', chunk); + if (!this[BUFFER].length && !this[EOF]) + this.emit('drain'); + return chunk; + } + end(chunk, encoding, cb) { + if (typeof chunk === 'function') { + cb = chunk; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (chunk !== undefined) + this.write(chunk, encoding); + if (cb) + this.once('end', cb); + this[EOF] = true; + this.writable = false; + // if we haven't written anything, then go ahead and emit, + // even if we're not reading. + // we'll re-emit if a new 'end' listener is added anyway. + // This makes MP more suitable to write-only use cases. + if (this[FLOWING] || !this[PAUSED]) + this[MAYBE_EMIT_END](); + return this; + } + // don't let the internal resume be overwritten + [RESUME]() { + if (this[DESTROYED]) + return; + if (!this[DATALISTENERS] && !this[PIPES].length) { + this[DISCARDED] = true; + } + this[PAUSED] = false; + this[FLOWING] = true; + this.emit('resume'); + if (this[BUFFER].length) + this[FLUSH](); + else if (this[EOF]) + this[MAYBE_EMIT_END](); + else + this.emit('drain'); + } + /** + * Resume the stream if it is currently in a paused state + * + * If called when there are no pipe destinations or `data` event listeners, + * this will place the stream in a "discarded" state, where all data will + * be thrown away. The discarded state is removed if a pipe destination or + * data handler is added, if pause() is called, or if any synchronous or + * asynchronous iteration is started. + */ + resume() { + return this[RESUME](); + } + /** + * Pause the stream + */ + pause() { + this[FLOWING] = false; + this[PAUSED] = true; + this[DISCARDED] = false; + } + /** + * true if the stream has been forcibly destroyed + */ + get destroyed() { + return this[DESTROYED]; + } + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing() { + return this[FLOWING]; + } + /** + * true if the stream is currently in a paused state + */ + get paused() { + return this[PAUSED]; + } + [BUFFERPUSH](chunk) { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] += 1; + else + this[BUFFERLENGTH] += chunk.length; + this[BUFFER].push(chunk); + } + [BUFFERSHIFT]() { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] -= 1; + else + this[BUFFERLENGTH] -= this[BUFFER][0].length; + return this[BUFFER].shift(); + } + [FLUSH](noDrain = false) { + do { } while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && + this[BUFFER].length); + if (!noDrain && !this[BUFFER].length && !this[EOF]) + this.emit('drain'); + } + [FLUSHCHUNK](chunk) { + this.emit('data', chunk); + return this[FLOWING]; + } + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest, opts) { + if (this[DESTROYED]) + return dest; + this[DISCARDED] = false; + const ended = this[EMITTED_END]; + opts = opts || {}; + if (dest === proc.stdout || dest === proc.stderr) + opts.end = false; + else + opts.end = opts.end !== false; + opts.proxyErrors = !!opts.proxyErrors; + // piping an ended stream ends immediately + if (ended) { + if (opts.end) + dest.end(); + } + else { + // "as" here just ignores the WType, which pipes don't care about, + // since they're only consuming from us, and writing to the dest + this[PIPES].push(!opts.proxyErrors + ? new Pipe(this, dest, opts) + : new PipeProxyErrors(this, dest, opts)); + if (this[ASYNC]) + defer(() => this[RESUME]()); + else + this[RESUME](); + } + return dest; + } + /** + * Fully unhook a piped destination stream. + * + * If the destination stream was the only consumer of this stream (ie, + * there are no other piped destinations or `'data'` event listeners) + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + unpipe(dest) { + const p = this[PIPES].find(p => p.dest === dest); + if (p) { + if (this[PIPES].length === 1) { + if (this[FLOWING] && this[DATALISTENERS] === 0) { + this[FLOWING] = false; + } + this[PIPES] = []; + } + else + this[PIPES].splice(this[PIPES].indexOf(p), 1); + p.unpipe(); + } + } + /** + * Alias for {@link Minipass#on} + */ + addListener(ev, handler) { + return this.on(ev, handler); + } + /** + * Mostly identical to `EventEmitter.on`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * - Adding a 'data' event handler will trigger the flow of data + * + * - Adding a 'readable' event handler when there is data waiting to be read + * will cause 'readable' to be emitted immediately. + * + * - Adding an 'endish' event handler ('end', 'finish', etc.) which has + * already passed will cause the event to be emitted immediately and all + * handlers removed. + * + * - Adding an 'error' event handler after an error has been emitted will + * cause the event to be re-emitted immediately with the error previously + * raised. + */ + on(ev, handler) { + const ret = super.on(ev, handler); + if (ev === 'data') { + this[DISCARDED] = false; + this[DATALISTENERS]++; + if (!this[PIPES].length && !this[FLOWING]) { + this[RESUME](); + } + } + else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) { + super.emit('readable'); + } + else if (isEndish(ev) && this[EMITTED_END]) { + super.emit(ev); + this.removeAllListeners(ev); + } + else if (ev === 'error' && this[EMITTED_ERROR]) { + const h = handler; + if (this[ASYNC]) + defer(() => h.call(this, this[EMITTED_ERROR])); + else + h.call(this, this[EMITTED_ERROR]); + } + return ret; + } + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev, handler) { + return this.off(ev, handler); + } + /** + * Mostly identical to `EventEmitter.off` + * + * If a 'data' event handler is removed, and it was the last consumer + * (ie, there are no pipe destinations or other 'data' event listeners), + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + off(ev, handler) { + const ret = super.off(ev, handler); + // if we previously had listeners, and now we don't, and we don't + // have any pipes, then stop the flow, unless it's been explicitly + // put in a discarded flowing state via stream.resume(). + if (ev === 'data') { + this[DATALISTENERS] = this.listeners('data').length; + if (this[DATALISTENERS] === 0 && + !this[DISCARDED] && + !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * Mostly identical to `EventEmitter.removeAllListeners` + * + * If all 'data' event handlers are removed, and they were the last consumer + * (ie, there are no pipe destinations), then the flow of data will stop + * until there is another consumer or {@link Minipass#resume} is explicitly + * called. + */ + removeAllListeners(ev) { + const ret = super.removeAllListeners(ev); + if (ev === 'data' || ev === undefined) { + this[DATALISTENERS] = 0; + if (!this[DISCARDED] && !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * true if the 'end' event has been emitted + */ + get emittedEnd() { + return this[EMITTED_END]; + } + [MAYBE_EMIT_END]() { + if (!this[EMITTING_END] && + !this[EMITTED_END] && + !this[DESTROYED] && + this[BUFFER].length === 0 && + this[EOF]) { + this[EMITTING_END] = true; + this.emit('end'); + this.emit('prefinish'); + this.emit('finish'); + if (this[CLOSED]) + this.emit('close'); + this[EMITTING_END] = false; + } + } + /** + * Mostly identical to `EventEmitter.emit`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * If the stream has been destroyed, and the event is something other + * than 'close' or 'error', then `false` is returned and no handlers + * are called. + * + * If the event is 'end', and has already been emitted, then the event + * is ignored. If the stream is in a paused or non-flowing state, then + * the event will be deferred until data flow resumes. If the stream is + * async, then handlers will be called on the next tick rather than + * immediately. + * + * If the event is 'close', and 'end' has not yet been emitted, then + * the event will be deferred until after 'end' is emitted. + * + * If the event is 'error', and an AbortSignal was provided for the stream, + * and there are no listeners, then the event is ignored, matching the + * behavior of node core streams in the presense of an AbortSignal. + * + * If the event is 'finish' or 'prefinish', then all listeners will be + * removed after emitting the event, to prevent double-firing. + */ + emit(ev, ...args) { + const data = args[0]; + // error and close are only events allowed after calling destroy() + if (ev !== 'error' && + ev !== 'close' && + ev !== DESTROYED && + this[DESTROYED]) { + return false; + } + else if (ev === 'data') { + return !this[OBJECTMODE] && !data + ? false + : this[ASYNC] + ? (defer(() => this[EMITDATA](data)), true) + : this[EMITDATA](data); + } + else if (ev === 'end') { + return this[EMITEND](); + } + else if (ev === 'close') { + this[CLOSED] = true; + // don't emit close before 'end' and 'finish' + if (!this[EMITTED_END] && !this[DESTROYED]) + return false; + const ret = super.emit('close'); + this.removeAllListeners('close'); + return ret; + } + else if (ev === 'error') { + this[EMITTED_ERROR] = data; + super.emit(ERROR, data); + const ret = !this[SIGNAL] || this.listeners('error').length + ? super.emit('error', data) + : false; + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'resume') { + const ret = super.emit('resume'); + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'finish' || ev === 'prefinish') { + const ret = super.emit(ev); + this.removeAllListeners(ev); + return ret; + } + // Some other unknown event + const ret = super.emit(ev, ...args); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITDATA](data) { + for (const p of this[PIPES]) { + if (p.dest.write(data) === false) + this.pause(); + } + const ret = this[DISCARDED] ? false : super.emit('data', data); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITEND]() { + if (this[EMITTED_END]) + return false; + this[EMITTED_END] = true; + this.readable = false; + return this[ASYNC] + ? (defer(() => this[EMITEND2]()), true) + : this[EMITEND2](); + } + [EMITEND2]() { + if (this[DECODER]) { + const data = this[DECODER].end(); + if (data) { + for (const p of this[PIPES]) { + p.dest.write(data); + } + if (!this[DISCARDED]) + super.emit('data', data); + } + } + for (const p of this[PIPES]) { + p.end(); + } + const ret = super.emit('end'); + this.removeAllListeners('end'); + return ret; + } + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + async collect() { + const buf = Object.assign([], { + dataLength: 0, + }); + if (!this[OBJECTMODE]) + buf.dataLength = 0; + // set the promise first, in case an error is raised + // by triggering the flow here. + const p = this.promise(); + this.on('data', c => { + buf.push(c); + if (!this[OBJECTMODE]) + buf.dataLength += c.length; + }); + await p; + return buf; + } + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + async concat() { + if (this[OBJECTMODE]) { + throw new Error('cannot concat in objectMode'); + } + const buf = await this.collect(); + return (this[ENCODING] + ? buf.join('') + : Buffer.concat(buf, buf.dataLength)); + } + /** + * Return a void Promise that resolves once the stream ends. + */ + async promise() { + return new Promise((resolve, reject) => { + this.on(DESTROYED, () => reject(new Error('stream destroyed'))); + this.on('error', er => reject(er)); + this.on('end', () => resolve()); + }); + } + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = async () => { + this.pause(); + stopped = true; + return { value: undefined, done: true }; + }; + const next = () => { + if (stopped) + return stop(); + const res = this.read(); + if (res !== null) + return Promise.resolve({ done: false, value: res }); + if (this[EOF]) + return stop(); + let resolve; + let reject; + const onerr = (er) => { + this.off('data', ondata); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + stop(); + reject(er); + }; + const ondata = (value) => { + this.off('error', onerr); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + this.pause(); + resolve({ value, done: !!this[EOF] }); + }; + const onend = () => { + this.off('error', onerr); + this.off('data', ondata); + this.off(DESTROYED, ondestroy); + stop(); + resolve({ done: true, value: undefined }); + }; + const ondestroy = () => onerr(new Error('stream destroyed')); + return new Promise((res, rej) => { + reject = rej; + resolve = res; + this.once(DESTROYED, ondestroy); + this.once('error', onerr); + this.once('end', onend); + this.once('data', ondata); + }); + }; + return { + next, + throw: stop, + return: stop, + [Symbol.asyncIterator]() { + return this; + }, + [Symbol.asyncDispose]: async () => { }, + }; + } + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = () => { + this.pause(); + this.off(ERROR, stop); + this.off(DESTROYED, stop); + this.off('end', stop); + stopped = true; + return { done: true, value: undefined }; + }; + const next = () => { + if (stopped) + return stop(); + const value = this.read(); + return value === null ? stop() : { done: false, value }; + }; + this.once('end', stop); + this.once(ERROR, stop); + this.once(DESTROYED, stop); + return { + next, + throw: stop, + return: stop, + [Symbol.iterator]() { + return this; + }, + [Symbol.dispose]: () => { }, + }; + } + /** + * Destroy a stream, preventing it from being used for any further purpose. + * + * If the stream has a `close()` method, then it will be called on + * destruction. + * + * After destruction, any attempt to write data, read data, or emit most + * events will be ignored. + * + * If an error argument is provided, then it will be emitted in an + * 'error' event. + */ + destroy(er) { + if (this[DESTROYED]) { + if (er) + this.emit('error', er); + else + this.emit(DESTROYED); + return this; + } + this[DESTROYED] = true; + this[DISCARDED] = true; + // throw away all buffered data, it's never coming out + this[BUFFER].length = 0; + this[BUFFERLENGTH] = 0; + const wc = this; + if (typeof wc.close === 'function' && !this[CLOSED]) + wc.close(); + if (er) + this.emit('error', er); + // if no error to emit, still reject pending promises + else + this.emit(DESTROYED); + return this; + } + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream() { + return isStream; + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/esm/index.js.map b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/esm/index.js.map new file mode 100644 index 0000000..4d87920 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GACR,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO;IACpC,CAAC,CAAC,OAAO;IACT,CAAC,CAAC;QACE,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;KACb,CAAA;AACP,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AASnD;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,CAAM,EACsC,EAAE,CAC9C,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,CAAC,YAAY,QAAQ;QACpB,CAAC,YAAY,MAAM;QACnB,UAAU,CAAC,CAAC,CAAC;QACb,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;AAElB;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAM,EAA0B,EAAE,CAC3D,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,YAAY,YAAY;IACzB,OAAQ,CAAuB,CAAC,IAAI,KAAK,UAAU;IACnD,iEAAiE;IAChE,CAAuB,CAAC,IAAI,KAAK,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAA;AAElE;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAM,EAA0B,EAAE,CAC3D,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,YAAY,YAAY;IACzB,OAAQ,CAAuB,CAAC,KAAK,KAAK,UAAU;IACpD,OAAQ,CAAuB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IAAI,CAAA;QACb,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;QACtB,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;QAEtB,sDAAsD;QACtD,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;QACvB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;QAEtB,MAAM,EAAE,GAAG,IAEV,CAAA;QACD,IAAI,OAAO,EAAE,CAAC,KAAK,KAAK,UAAU,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,EAAE,CAAC,KAAK,EAAE,CAAA;QAE/D,IAAI,EAAE;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;QAC9B,qDAAqD;;YAChD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAEzB,OAAO,IAAI,CAAA;IAAA,CACZ;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ,GAAG;QACpB,OAAO,QAAQ,CAAA;IAAA,CAChB;CACF","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe {\n src: Minipass\n dest: Minipass\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = (er: Error) => this.dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable = Iterable & AsyncIterable\n\n type EventArguments = Record\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events = Minipass.Events\n >\n extends EventEmitter\n implements Minipass.DualIterable\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options]\n : [Minipass.Options])\n ) {\n const options: Minipass.Options = (args[0] ||\n {}) as Minipass.Options\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this as Minipass, dest, opts)\n : new PipeProxyErrors(this as Minipass, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n [Symbol.asyncDispose]: async () => {},\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n [Symbol.dispose]: () => {},\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/esm/package.json b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/esm/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/@isaacs/fs-minipass/node_modules/minipass/package.json b/node_modules/@isaacs/fs-minipass/node_modules/minipass/package.json new file mode 100644 index 0000000..800f215 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/node_modules/minipass/package.json @@ -0,0 +1,77 @@ +{ + "name": "minipass", + "version": "7.1.3", + "description": "minimal implementation of a PassThrough stream", + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js", + "type": "module", + "tshy": { + "selfLink": false, + "compiler": "tsgo", + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + } + }, + "files": [ + "dist" + ], + "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "prepare": "tshy", + "pretest": "npm run prepare", + "presnap": "npm run prepare", + "test": "tap", + "snap": "tap", + "format": "prettier --write . --loglevel warn", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" + }, + "prettier": { + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + }, + "devDependencies": { + "@types/end-of-stream": "^1.4.2", + "@types/node": "^25.2.3", + "end-of-stream": "^1.4.0", + "node-abort-controller": "^3.1.1", + "prettier": "^3.8.1", + "tap": "^21.6.1", + "through2": "^2.0.3", + "tshy": "^3.3.2", + "typedoc": "^0.28.17" + }, + "repository": "https://github.com/isaacs/minipass", + "keywords": [ + "passthrough", + "stream" + ], + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=16 || 14 >=14.17" + } +} diff --git a/node_modules/@isaacs/fs-minipass/package.json b/node_modules/@isaacs/fs-minipass/package.json new file mode 100644 index 0000000..cc4576c --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/package.json @@ -0,0 +1,72 @@ +{ + "name": "@isaacs/fs-minipass", + "version": "4.0.1", + "main": "./dist/commonjs/index.js", + "scripts": { + "prepare": "tshy", + "pretest": "npm run prepare", + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "format": "prettier --write . --loglevel warn", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" + }, + "keywords": [], + "author": "Isaac Z. Schlueter", + "license": "ISC", + "repository": { + "type": "git", + "url": "https://github.com/npm/fs-minipass.git" + }, + "description": "fs read and write streams based on minipass", + "dependencies": { + "minipass": "^7.0.4" + }, + "devDependencies": { + "@types/node": "^20.11.30", + "mutate-fs": "^2.1.1", + "prettier": "^3.2.5", + "tap": "^18.7.1", + "tshy": "^1.12.0", + "typedoc": "^0.25.12" + }, + "files": [ + "dist" + ], + "engines": { + "node": ">=18.0.0" + }, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + } + }, + "types": "./dist/commonjs/index.d.ts", + "type": "module", + "prettier": { + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + } +} diff --git a/node_modules/@julusian/jpeg-turbo/CMakeLists.txt b/node_modules/@julusian/jpeg-turbo/CMakeLists.txt new file mode 100644 index 0000000..b77bb73 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/CMakeLists.txt @@ -0,0 +1,90 @@ +cmake_minimum_required(VERSION 3.15) +cmake_policy(SET CMP0091 NEW) +cmake_policy(SET CMP0042 NEW) +if(POLICY CMP0135) + cmake_policy(SET CMP0135 NEW) # DOWNLOAD_EXTRACT_TIMESTAMP +endif() +include(ExternalProject) + +project (jpeg-turbo) + +# define NPI_VERSION +add_definitions(-DNAPI_VERSION=10) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +include_directories(${CMAKE_JS_INC}) + +set(SOURCE_FILES + "src/buffersize.cc" + "src/buffersize.h" + "src/compress.cc" + "src/compress.h" + "src/decompress.cc" + "src/decompress.h" + "src/enums.cc" + "src/enums.h" + "src/util.cc" + "src/util.h" + "src/exports.cc" + "src/consts.h" +) + +set(libjpeg-turbo_version "3.1.3") +set(libjpeg-turbo_url "https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/${libjpeg-turbo_version}/libjpeg-turbo-${libjpeg-turbo_version}.tar.gz") +set(libjpeg-turbo_sha256 "075920b826834ac4ddf97661cc73491047855859affd671d52079c6867c1c6c0") + +if(UNIX AND NOT APPLE) + # build shared on linux, to avoid conflicts with libjpeg built into electron + set(ENABLE_SHARED 1) + set(ENABLE_STATIC 0) + +else() + # build static elsewhere + set(ENABLE_SHARED 0) + set(ENABLE_STATIC 1) +endif() + +# Download and build libjpeg-turbo +ExternalProject_Add(libjpeg-turbo + URL ${libjpeg-turbo_url} + URL_HASH SHA256=${libjpeg-turbo_sha256} + CMAKE_ARGS -DENABLE_SHARED=${ENABLE_SHARED} -DENABLE_STATIC=${ENABLE_STATIC} -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} -DREQUIRE_SIMD=ON ${LIBJPEG_TURBO_OPTIONS} + INSTALL_COMMAND "" +) +ExternalProject_Get_Property(libjpeg-turbo SOURCE_DIR) +set(JPEG_INCLUDE_DIR ${SOURCE_DIR}/src) +ExternalProject_Get_Property(libjpeg-turbo BINARY_DIR) +set(JPEG_LIB_DIR ${BINARY_DIR}) +set(JPEG_LIB turbojpeg) + +if (MSVC) + # Windows uses a different path for some reason + set(JPEG_LIB_DIR ${JPEG_LIB_DIR}/Release) + set(JPEG_LIB turbojpeg-static) +endif() + + +set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) +set(CMAKE_INSTALL_RPATH "$ORIGIN") + +add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC}) +set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node") +target_include_directories(${PROJECT_NAME} PRIVATE ${JPEG_INCLUDE_DIR}) +target_link_directories(${PROJECT_NAME} PRIVATE ${JPEG_LIB_DIR}) +target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB} ${JPEG_LIB}) +add_dependencies(${PROJECT_NAME} libjpeg-turbo) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) + +if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET) + # Generate node.lib + execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS}) +endif() + +if(UNIX AND NOT APPLE) + # copy built lib into build dir + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${JPEG_LIB_DIR}/libturbojpeg.so.0 ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE} + ) +endif() diff --git a/node_modules/@julusian/jpeg-turbo/LICENSE b/node_modules/@julusian/jpeg-turbo/LICENSE new file mode 100644 index 0000000..86d6b5d --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/LICENSE @@ -0,0 +1,13 @@ +Copyright © Simo Kinnunen. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/node_modules/@julusian/jpeg-turbo/README.md b/node_modules/@julusian/jpeg-turbo/README.md new file mode 100644 index 0000000..d4bc8b5 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/README.md @@ -0,0 +1,207 @@ +# @julusian/jpeg-turbo + +![Node CI](https://github.com/Julusian/node-jpeg-turbo/workflows/Node%20CI/badge.svg) +[![npm](https://img.shields.io/npm/v/@julusian/jpeg-turbo.svg)](https://www.npmjs.com/package/@julusian/jpeg-turbo) +[![npm](https://img.shields.io/npm/dm/@julusian/jpeg-turbo.svg)](https://www.npmjs.com/package/@julusian/jpeg-turbo) +[![npm](https://img.shields.io/npm/l/@julusian/jpeg-turbo.svg)](LICENSE) + +This is a fork of [jpeg-turbo](https://github.com/sorccu/node-jpeg-turbo) with the intention of being maintained and bringing support for new versions of node + +**node-jpeg-turbo** provides minimal [libjpeg-turbo](http://libjpeg-turbo.org/) bindings for [Node.js](https://nodejs.org/). It is very, very fast compared to other alternatives, such as [node-imagemagick-native](https://github.com/mash/node-imagemagick-native) or [jpeg-js](https://github.com/eugeneware/jpeg-js). + +Please ask if you need more methods exposed. + +## Requirements + +All versions of Node still in [_active_ Long-term Support](https://github.com/nodejs/LTS#lts-schedule) and the current development version are supported. Older versions may or may not work; they are not and will not be supported. + +We provide prebuilds for some platforms, meaning that you should not have to compile native bindings from source very often. The bindings are hosted at and automatically installed from our [GitHub Releases](https://github.com/julusian/node-jpeg-turbo). + +### If you must build from source + +First, if you're building from the repo, make sure to init and update submodules or you'll get confusing errors about missing targets when building. We include `libjpeg-turbo` as a submodule. + +```bash +git submodule init +git submodule update +``` + +(or just use `git clone --recursive` when cloning the repo) + +We build `libjpeg-turbo` directly with `cmake`, so both `cmake` and `nasm` are required on your machine. `nasm` is only required on x86 and x86_64 architectures. + +To install: + +**On OS X** + +```bash +brew install nasm +brew install cmake +``` + +**On Ubuntu/Debian** + +```bash +apt-get install nasm cmake +``` + +**On Windows** + +Download and install the latest from [here](https://cmake.org/download/). Make sure to select the option to put it on path for all users. + +Download Win32 or Win64 nasm from [here](https://www.nasm.us/) and make sure it's found in path as nasm.exe. Use the "for general use" version. If the .exe doesn't run, or complains about a missing `MSVCR100.dll`, you can install the missing VS2010 Redist x64 from [KB2977003](https://www.microsoft.com/en-gb/download/details.aspx?id=14632). The .exe should work fine after installing the redistributable. + +To verify your nasm setup, run: + +```sh +nasm +``` + +This should give the output: + +> nasm: fatal: no input file specified + +Next, you need to make sure that you have a build environment set up. An easy way to do that is to use [windows-build-tools](https://github.com/felixrieseberg/windows-build-tools). + +Now, just to make sure things are set up properly, run: + +``` +npm config get msvs_version +``` + +If the output is `2015` or newer, you're good. If it's anything else, or not set, you must run: + +``` +npm config set -g msvs_version 2015 +``` + +Alternatively, you can specify the option at install time with `--msvs_version=2015`. + +**Others** + +Search your package manager for `nasm`. + +## Installation + +Make sure you've got the [requirements](#requirements) installed first. + +Using [yarn](https://yarnpkg.com/): + +```sh +yarn add @julusian/jpeg-turbo +``` + +Using [npm](https://www.npmjs.com/): + +```sh +npm install --save @julusian/jpeg-turbo +``` + +## API + +### `jpg.bufferSize(options)` → `Number` + +If you'd like to preallocate a `Buffer` for `jpg.compressSync()`, use this method to get the worst-case upper bound. The `options` argument is fully compatible with the `jpg.compressSync()` method, so that you can pass the same options to both functions. + +- **options** is an Object with the following properties: + - **width** Required. The width of the image. + - **height** Required. The height of the image. + - **subsampling** Optional. The subsampling method to use. Defaults to `jpg.SAMP_420`. +- **Returns** The `Number` of bytes required in a worst-case scenario. + +```js +var fs = require("fs"); +var jpg = require("@julusian/jpeg-turbo"); + +var raw = fs.readFileSync("raw.rgba"); + +var options = { + format: jpg.FORMAT_RGBA, + width: 1080, + height: 1920, + subsampling: jpg.SAMP_444, +}; + +var preallocated = new Buffer(jpg.bufferSize(options)); + +var encoded = jpg.compressSync(raw, preallocated, options); +``` + +### `jpg.compressSync(raw[, out], options)` → `Object` + +Compresses (i.e. encodes) the raw pixel data into a JPG. This method is not capable of resizing the image. + +For efficiency reasons you may choose to encode into a preallocated `Buffer`. While fast, it has a number of drawbacks. Namely, you'll have to be careful not to reuse the buffer in async processing before processing (e.g. saving, displaying or transmitting) the entire encoded image. Otherwise you risk corrupting the image. Also, it wastes a huge amount of space compared to on-demand allocation. + +- **raw** is a `Buffer` with the raw pixel data in `options.format`. +- **out** is an optional preallocated `Buffer` for the encoded image. The size of the buffer is checked. See `jpg.bufferSize()` for an example of how to preallocate a sufficient `Buffer`. If not given, memory is allocated and reallocated as needed, which eliminates most of the wasted space but is slower and lacks consistency with varying source images. +- **options** is an Object with the following properties: + - **format** Required. The format of the `raw` pixel data (e.g. `jpg.FORMAT_RGBA`). + - **width** Required. The width of the image. + - **height** Required. The height of the image. + - **subsampling** Optional. The subsampling method to use. Defaults to `jpg.SAMP_420`. + - **quality** Optional. The desired JPG quality. Defaults to 80. +- **Returns** An `Object` with the following properties: + - **data** The encoded image as a `Buffer`. Note that the buffer may actually be a slice of the preallocated `Buffer`, if given. _**Be careful not to reuse the preallocated buffer before you've finished processing the encoded image, as it may corrupt the image.**_ + - **size** The size of the used space in the buffer + +```js +var fs = require("fs"); +var jpg = require("@julusian/jpeg-turbo"); + +var raw = fs.readFileSync("raw.rgba"); + +var options = { + format: jpg.FORMAT_RGBA, + width: 1080, + height: 1920, + subsampling: jpg.SAMP_444, +}; + +var encoded = jpg.compressSync(raw, options); +``` + +See `jpg.bufferSize()` for an example of preallocated `Buffer` usage. + +### `jpg.decompressSync(image[, out], options)` → `Object` + +Decompresses (i.e. decodes) the JPG image into raw pixel data. + +- **image** is a `Buffer` with the JPG image data. +- **out** is an optional preallocated `Buffer` for the decoded image. The size of the buffer is checked, and should be at least `width * height * bytes_per_pixel` or larger. If not given, one is created for you. The only benefit of providing the `Buffer` yourself is that you can reuse the same buffer between multiple `jpg.decompressSync()` calls. Note that this can lead to issues with concurrency. See `jpg.compressSync()` for related discussion. +- **options** is an Object with the following properties: + - **format** Required. The desired format of the `raw` pixel data (e.g. `jpg.FORMAT_RGBA`). + - **out** _Deprecated._ Use the `out` argument instead. +- **Returns** An `Object` with the following properties: + - **data** A `Buffer` with the raw pixel data. + - **width** The width of the image. + - **height** The height of the image. + - **subsampling** The subsampling method used in the JPG. + - **size** _Deprecated._ Use `data.length` instead. + - **bpp** The number of bytes per pixel. + +```js +var fs = require("fs"); +var jpg = require("@julusian/jpeg-turbo"); + +var image = fs.readFileSync("image.jpg"); + +var options = { + format: jpg.FORMAT_RGBA, +}; + +var decoded = jpg.decompressSync(image, options); +``` + +## Thanks + +- https://github.com/A2K/node-jpeg-turbo-scaler +- https://github.com/mash/node-imagemagick-native +- https://github.com/google/skia/blob/master/gyp/libjpeg-turbo.gyp +- https://github.com/openstf/android-libjpeg-turbo + +## License + +See [LICENSE](LICENSE). + +Copyright © Julian Waller. All Rights Reserved. diff --git a/node_modules/@julusian/jpeg-turbo/binding-options.js b/node_modules/@julusian/jpeg-turbo/binding-options.js new file mode 100644 index 0000000..7d71e8e --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/binding-options.js @@ -0,0 +1,4 @@ +module.exports = { + name: "jpeg-turbo", + napi_versions: [10], +}; diff --git a/node_modules/@julusian/jpeg-turbo/index.js b/node_modules/@julusian/jpeg-turbo/index.js new file mode 100644 index 0000000..6ec1b71 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/index.js @@ -0,0 +1,38 @@ +const binding = require("pkg-prebuilds")( + __dirname, + require("./binding-options") +); + +// Copy exports so that we can customize them on the JS side without +// overwriting the binding itself. +Object.keys(binding).forEach(function (key) { + module.exports[key] = binding[key]; +}); + +// Convenience wrapper for Buffer slicing. +module.exports.compressSync = function (buffer, optionalOutBuffer, options) { + var out = binding.compressSync(buffer, optionalOutBuffer, options); + return out.data.slice(0, out.size); +}; + +// Convenience wrapper for Buffer slicing. +module.exports.compress = function (a, b, c) { + return binding.compress(a, b, c).then((out) => { + return out.data.slice(0, out.size); + }); +}; + +// Convenience wrapper for Buffer slicing. +module.exports.decompressSync = function (buffer, optionalOutBuffer, options) { + var out = binding.decompressSync(buffer, optionalOutBuffer, options); + out.data = out.data.slice(0, out.size); + return out; +}; + +// Convenience wrapper for Buffer slicing. +module.exports.decompress = function (a, b, c) { + return binding.decompress(a, b, c).then((out) => { + out.data = out.data.slice(0, out.size); + return out; + }); +}; diff --git a/node_modules/@julusian/jpeg-turbo/module.d.ts b/node_modules/@julusian/jpeg-turbo/module.d.ts new file mode 100644 index 0000000..df587eb --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/module.d.ts @@ -0,0 +1,65 @@ +export type Format = number; +export const FORMAT_RGB: Format; +export const FORMAT_BGR: Format; +export const FORMAT_RGBX: Format; +export const FORMAT_BGRX: Format; +export const FORMAT_XRGB: Format; +export const FORMAT_XBGR: Format; +export const FORMAT_GRAY: Format; +export const FORMAT_RGBA: Format; +export const FORMAT_BGRA: Format; +export const FORMAT_ABGR: Format; +export const FORMAT_ARGB: Format; + +export type SubSampling = number; +export const SAMP_444: SubSampling; +export const SAMP_422: SubSampling; +export const SAMP_420: SubSampling; +export const SAMP_GRAY: SubSampling; +export const SAMP_440: SubSampling; + +export interface BufferSizeOptions { + width: number; + height: number; + subsampling?: SubSampling; +} + +export interface EncodeOptions extends BufferSizeOptions { + format: Format; + stride?: number; + quality?: number; +} + +export function bufferSize(options: BufferSizeOptions): number; + +export function compressSync(raw: Buffer, options: EncodeOptions): Buffer; +export function compressSync(raw: Buffer, preallocatedOut: Buffer, options: EncodeOptions): Buffer; + +export function compress(raw: Buffer, options: EncodeOptions): Promise; +export function compress( + raw: Buffer, + preallocatedOut: Buffer, + options: EncodeOptions +): Promise; + +export interface DecodeOptions { + format: Format; +} + +export interface DecompressReturn { + data: Buffer; + width: number; + height: number; + size: number; + format: any; +} + +export function decompressSync(image: Buffer, preallocatedOut: Buffer, options?: DecodeOptions): DecompressReturn; +export function decompressSync(image: Buffer, options?: DecodeOptions): DecompressReturn; + +export function decompress( + image: Buffer, + preallocatedOut: Buffer, + options?: DecodeOptions +): Promise; +export function decompress(image: Buffer, options?: DecodeOptions): Promise; diff --git a/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/LICENSE.md b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/LICENSE.md new file mode 100644 index 0000000..819d91a --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/LICENSE.md @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright (c) 2017 [Node.js API collaborators](https://github.com/nodejs/node-addon-api#collaborators) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/README.md b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/README.md new file mode 100644 index 0000000..39df5a9 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/README.md @@ -0,0 +1,95 @@ +# **node-addon-api module** + +[![codecov](https://codecov.io/gh/nodejs/node-addon-api/branch/main/graph/badge.svg)](https://app.codecov.io/gh/nodejs/node-addon-api/tree/main) + +[![NPM](https://nodei.co/npm/node-addon-api.png?downloads=true&downloadRank=true)](https://nodei.co/npm/node-addon-api/) [![NPM](https://nodei.co/npm-dl/node-addon-api.png?months=6&height=1)](https://nodei.co/npm/node-addon-api/) + +This module contains **header-only C++ wrapper classes** which simplify +the use of the C based [Node-API](https://nodejs.org/dist/latest/docs/api/n-api.html) +provided by Node.js when using C++. It provides a C++ object model +and exception handling semantics with low overhead. + +- [API References](doc/README.md) +- [Badges](#badges) +- [Contributing](#contributing) +- [License](#license) + +## API References + +API references are available in the [doc](doc/README.md) directory. + + +## Current version: 8.6.0 + + +(See [CHANGELOG.md](CHANGELOG.md) for complete Changelog) + +node-addon-api is based on [Node-API](https://nodejs.org/api/n-api.html) and supports using different Node-API versions. +This allows addons built with it to run with Node.js versions which support the targeted Node-API version. +**However** the node-addon-api support model is to support only the active LTS Node.js versions. This means that +every year there will be a new major which drops support for the Node.js LTS version which has gone out of service. + +The oldest Node.js version supported by the current version of node-addon-api is Node.js 18.x. + +## Badges + +The use of badges is recommended to indicate the minimum version of Node-API +required for the module. This helps to determine which Node.js major versions are +supported. Addon maintainers can consult the [Node-API support matrix][] to determine +which Node.js versions provide a given Node-API version. The following badges are +available: + +![Node-API v1 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v1%20Badge.svg) +![Node-API v2 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v2%20Badge.svg) +![Node-API v3 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v3%20Badge.svg) +![Node-API v4 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v4%20Badge.svg) +![Node-API v5 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v5%20Badge.svg) +![Node-API v6 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v6%20Badge.svg) +![Node-API v7 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v7%20Badge.svg) +![Node-API v8 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v8%20Badge.svg) +![Node-API v9 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v9%20Badge.svg) +![Node-API Experimental Version Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20Experimental%20Version%20Badge.svg) + +## Contributing + +We love contributions from the community to **node-addon-api**! +See [CONTRIBUTING.md](CONTRIBUTING.md) for more details on our philosophy around extending this module. + +## Team members + +### Active + +| Name | GitHub Link | +| ------------------- | ----------------------------------------------------- | +| Anna Henningsen | [addaleax](https://github.com/addaleax) | +| Chengzhong Wu | [legendecas](https://github.com/legendecas) | +| Jack Xia | [JckXia](https://github.com/JckXia) | +| Kevin Eady | [KevinEady](https://github.com/KevinEady) | +| Michael Dawson | [mhdawson](https://github.com/mhdawson) | +| Nicola Del Gobbo | [NickNaso](https://github.com/NickNaso) | +| Vladimir Morozov | [vmoroz](https://github.com/vmoroz) | + +
+ +Emeritus + +### Emeritus + +| Name | GitHub Link | +| ------------------- | ----------------------------------------------------- | +| Arunesh Chandra | [aruneshchandra](https://github.com/aruneshchandra) | +| Benjamin Byholm | [kkoopa](https://github.com/kkoopa) | +| Gabriel Schulhof | [gabrielschulhof](https://github.com/gabrielschulhof) | +| Hitesh Kanwathirtha | [digitalinfinity](https://github.com/digitalinfinity) | +| Jason Ginchereau | [jasongin](https://github.com/jasongin) | +| Jim Schlight | [jschlight](https://github.com/jschlight) | +| Sampson Gao | [sampsongao](https://github.com/sampsongao) | +| Taylor Woll | [boingoing](https://github.com/boingoing) | + +
+ +## License + +Licensed under [MIT](./LICENSE.md) + +[Node-API support matrix]: https://nodejs.org/dist/latest/docs/api/n-api.html#node-api-version-matrix diff --git a/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/common.gypi b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/common.gypi new file mode 100644 index 0000000..5fda7e7 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/common.gypi @@ -0,0 +1,21 @@ +{ + 'variables': { + 'NAPI_VERSION%': " +inline PropertyDescriptor PropertyDescriptor::Accessor( + const char* utf8name, + Getter getter, + napi_property_attributes attributes, + void* /*data*/) { + using CbData = details::CallbackData; + // TODO: Delete when the function is destroyed + auto callbackData = new CbData({getter, nullptr}); + + return PropertyDescriptor({utf8name, + nullptr, + nullptr, + CbData::Wrapper, + nullptr, + nullptr, + attributes, + callbackData}); +} + +template +inline PropertyDescriptor PropertyDescriptor::Accessor( + const std::string& utf8name, + Getter getter, + napi_property_attributes attributes, + void* data) { + return Accessor(utf8name.c_str(), getter, attributes, data); +} + +template +inline PropertyDescriptor PropertyDescriptor::Accessor( + napi_value name, + Getter getter, + napi_property_attributes attributes, + void* /*data*/) { + using CbData = details::CallbackData; + // TODO: Delete when the function is destroyed + auto callbackData = new CbData({getter, nullptr}); + + return PropertyDescriptor({nullptr, + name, + nullptr, + CbData::Wrapper, + nullptr, + nullptr, + attributes, + callbackData}); +} + +template +inline PropertyDescriptor PropertyDescriptor::Accessor( + Name name, Getter getter, napi_property_attributes attributes, void* data) { + napi_value nameValue = name; + return PropertyDescriptor::Accessor(nameValue, getter, attributes, data); +} + +template +inline PropertyDescriptor PropertyDescriptor::Accessor( + const char* utf8name, + Getter getter, + Setter setter, + napi_property_attributes attributes, + void* /*data*/) { + using CbData = details::AccessorCallbackData; + // TODO: Delete when the function is destroyed + auto callbackData = new CbData({getter, setter, nullptr}); + + return PropertyDescriptor({utf8name, + nullptr, + nullptr, + CbData::GetterWrapper, + CbData::SetterWrapper, + nullptr, + attributes, + callbackData}); +} + +template +inline PropertyDescriptor PropertyDescriptor::Accessor( + const std::string& utf8name, + Getter getter, + Setter setter, + napi_property_attributes attributes, + void* data) { + return Accessor(utf8name.c_str(), getter, setter, attributes, data); +} + +template +inline PropertyDescriptor PropertyDescriptor::Accessor( + napi_value name, + Getter getter, + Setter setter, + napi_property_attributes attributes, + void* /*data*/) { + using CbData = details::AccessorCallbackData; + // TODO: Delete when the function is destroyed + auto callbackData = new CbData({getter, setter, nullptr}); + + return PropertyDescriptor({nullptr, + name, + nullptr, + CbData::GetterWrapper, + CbData::SetterWrapper, + nullptr, + attributes, + callbackData}); +} + +template +inline PropertyDescriptor PropertyDescriptor::Accessor( + Name name, + Getter getter, + Setter setter, + napi_property_attributes attributes, + void* data) { + napi_value nameValue = name; + return PropertyDescriptor::Accessor( + nameValue, getter, setter, attributes, data); +} + +template +inline PropertyDescriptor PropertyDescriptor::Function( + const char* utf8name, + Callable cb, + napi_property_attributes attributes, + void* /*data*/) { + using ReturnType = decltype(cb(CallbackInfo(nullptr, nullptr))); + using CbData = details::CallbackData; + // TODO: Delete when the function is destroyed + auto callbackData = new CbData({cb, nullptr}); + + return PropertyDescriptor({utf8name, + nullptr, + CbData::Wrapper, + nullptr, + nullptr, + nullptr, + attributes, + callbackData}); +} + +template +inline PropertyDescriptor PropertyDescriptor::Function( + const std::string& utf8name, + Callable cb, + napi_property_attributes attributes, + void* data) { + return Function(utf8name.c_str(), cb, attributes, data); +} + +template +inline PropertyDescriptor PropertyDescriptor::Function( + napi_value name, + Callable cb, + napi_property_attributes attributes, + void* /*data*/) { + using ReturnType = decltype(cb(CallbackInfo(nullptr, nullptr))); + using CbData = details::CallbackData; + // TODO: Delete when the function is destroyed + auto callbackData = new CbData({cb, nullptr}); + + return PropertyDescriptor({nullptr, + name, + CbData::Wrapper, + nullptr, + nullptr, + nullptr, + attributes, + callbackData}); +} + +template +inline PropertyDescriptor PropertyDescriptor::Function( + Name name, Callable cb, napi_property_attributes attributes, void* data) { + napi_value nameValue = name; + return PropertyDescriptor::Function(nameValue, cb, attributes, data); +} + +#endif // !SRC_NAPI_INL_DEPRECATED_H_ diff --git a/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/napi-inl.h b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/napi-inl.h new file mode 100644 index 0000000..0f1717e --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/napi-inl.h @@ -0,0 +1,7108 @@ +#ifndef SRC_NAPI_INL_H_ +#define SRC_NAPI_INL_H_ + +//////////////////////////////////////////////////////////////////////////////// +// Node-API C++ Wrapper Classes +// +// Inline header-only implementations for "Node-API" ABI-stable C APIs for +// Node.js. +//////////////////////////////////////////////////////////////////////////////// + +// Note: Do not include this file directly! Include "napi.h" instead. +// This should be a no-op and is intended for better IDE integration. +#include "napi.h" + +#include +#include +#include +#if NAPI_HAS_THREADS +#include +#endif // NAPI_HAS_THREADS +#include +#include + +#if defined(__clang__) || defined(__GNUC__) +#define NAPI_NO_SANITIZE_VPTR __attribute__((no_sanitize("vptr"))) +#else +#define NAPI_NO_SANITIZE_VPTR +#endif + +namespace Napi { + +#ifdef NAPI_CPP_CUSTOM_NAMESPACE +namespace NAPI_CPP_CUSTOM_NAMESPACE { +#endif + +// Helpers to handle functions exposed from C++ and internal constants. +namespace details { + +// New napi_status constants not yet available in all supported versions of +// Node.js releases. Only necessary when they are used in napi.h and napi-inl.h. +constexpr int napi_no_external_buffers_allowed = 22; + +template +inline void default_basic_finalizer(node_addon_api_basic_env /*env*/, + void* data, + void* /*hint*/) { + delete static_cast(data); +} + +// Attach a data item to an object and delete it when the object gets +// garbage-collected. +// TODO: Replace this code with `napi_add_finalizer()` whenever it becomes +// available on all supported versions of Node.js. +template < + typename FreeType, + node_addon_api_basic_finalize finalizer = default_basic_finalizer> +inline napi_status AttachData(napi_env env, + napi_value obj, + FreeType* data, + void* hint = nullptr) { + napi_status status; +#if (NAPI_VERSION < 5) + napi_value symbol, external; + status = napi_create_symbol(env, nullptr, &symbol); + if (status == napi_ok) { + status = napi_create_external(env, data, finalizer, hint, &external); + if (status == napi_ok) { + napi_property_descriptor desc = {nullptr, + symbol, + nullptr, + nullptr, + nullptr, + external, + napi_default, + nullptr}; + status = napi_define_properties(env, obj, 1, &desc); + } + } +#else // NAPI_VERSION >= 5 + status = napi_add_finalizer(env, obj, data, finalizer, hint, nullptr); +#endif + return status; +} + +// For use in JS to C++ callback wrappers to catch any Napi::Error exceptions +// and rethrow them as JavaScript exceptions before returning from the callback. +template +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS_ALL +inline napi_value WrapCallback(napi_env env, Callable callback) { +#else +inline napi_value WrapCallback(napi_env, Callable callback) { +#endif +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS + try { + return callback(); + } catch (const Error& e) { + e.ThrowAsJavaScriptException(); + return nullptr; + } +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS_ALL + catch (const std::exception& e) { + Napi::Error::New(env, e.what()).ThrowAsJavaScriptException(); + return nullptr; + } catch (...) { + Napi::Error::New(env, "A native exception was thrown") + .ThrowAsJavaScriptException(); + return nullptr; + } +#endif // NODE_ADDON_API_CPP_EXCEPTIONS_ALL +#else // NODE_ADDON_API_CPP_EXCEPTIONS + // When C++ exceptions are disabled, errors are immediately thrown as JS + // exceptions, so there is no need to catch and rethrow them here. + return callback(); +#endif // NODE_ADDON_API_CPP_EXCEPTIONS +} + +// For use in JS to C++ void callback wrappers to catch any Napi::Error +// exceptions and rethrow them as JavaScript exceptions before returning from +// the callback. +template +inline void WrapVoidCallback(Callable callback) { +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS + try { + callback(); + } catch (const Error& e) { + e.ThrowAsJavaScriptException(); + } +#else // NAPI_CPP_EXCEPTIONS + // When C++ exceptions are disabled, errors are immediately thrown as JS + // exceptions, so there is no need to catch and rethrow them here. + callback(); +#endif // NAPI_CPP_EXCEPTIONS +} + +// For use in JS to C++ void callback wrappers to catch _any_ thrown exception +// and rethrow them as JavaScript exceptions before returning from the callback, +// wrapping in an Napi::Error as needed. +template +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS_ALL +inline void WrapVoidCallback(napi_env env, Callable callback) { +#else +inline void WrapVoidCallback(napi_env, Callable callback) { +#endif +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS + try { + callback(); + } catch (const Error& e) { + e.ThrowAsJavaScriptException(); + } +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS_ALL + catch (const std::exception& e) { + Napi::Error::New(env, e.what()).ThrowAsJavaScriptException(); + } catch (...) { + Napi::Error::New(env, "A native exception was thrown") + .ThrowAsJavaScriptException(); + } +#endif // NODE_ADDON_API_CPP_EXCEPTIONS_ALL +#else + // When C++ exceptions are disabled, there is no need to catch and rethrow C++ + // exceptions. JS errors should be thrown with + // `Error::ThrowAsJavaScriptException`. + callback(); +#endif // NODE_ADDON_API_CPP_EXCEPTIONS +} + +template +struct CallbackData { + static inline napi_value Wrapper(napi_env env, napi_callback_info info) { + return details::WrapCallback(env, [&] { + CallbackInfo callbackInfo(env, info); + CallbackData* callbackData = + static_cast(callbackInfo.Data()); + callbackInfo.SetData(callbackData->data); + return callbackData->callback(callbackInfo); + }); + } + + Callable callback; + void* data; +}; + +template +struct CallbackData { + static inline napi_value Wrapper(napi_env env, napi_callback_info info) { + return details::WrapCallback(env, [&] { + CallbackInfo callbackInfo(env, info); + CallbackData* callbackData = + static_cast(callbackInfo.Data()); + callbackInfo.SetData(callbackData->data); + callbackData->callback(callbackInfo); + return nullptr; + }); + } + + Callable callback; + void* data; +}; + +template +napi_value TemplatedVoidCallback(napi_env env, + napi_callback_info info) NAPI_NOEXCEPT { + return details::WrapCallback(env, [&] { + CallbackInfo cbInfo(env, info); + Callback(cbInfo); + return nullptr; + }); +} + +template +napi_value TemplatedCallback(napi_env env, + napi_callback_info info) NAPI_NOEXCEPT { + return details::WrapCallback(env, [&] { + CallbackInfo cbInfo(env, info); + // MSVC requires to copy 'Callback' function pointer to a local variable + // before invoking it. + auto callback = Callback; + return callback(cbInfo); + }); +} + +template +napi_value TemplatedInstanceCallback(napi_env env, + napi_callback_info info) NAPI_NOEXCEPT { + return details::WrapCallback(env, [&] { + CallbackInfo cbInfo(env, info); + T* instance = T::Unwrap(cbInfo.This().As()); + return instance ? (instance->*UnwrapCallback)(cbInfo) : Napi::Value(); + }); +} + +template +napi_value TemplatedInstanceVoidCallback(napi_env env, napi_callback_info info) + NAPI_NOEXCEPT { + return details::WrapCallback(env, [&] { + CallbackInfo cbInfo(env, info); + T* instance = T::Unwrap(cbInfo.This().As()); + if (instance) (instance->*UnwrapCallback)(cbInfo); + return nullptr; + }); +} + +template +struct FinalizeData { +#ifdef NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER + template >> +#endif + static inline void Wrapper(node_addon_api_basic_env env, + void* data, + void* finalizeHint) NAPI_NOEXCEPT { + WrapVoidCallback([&] { + FinalizeData* finalizeData = static_cast(finalizeHint); + finalizeData->callback(env, static_cast(data)); + delete finalizeData; + }); + } + +#ifdef NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER + template >, + typename = void> + static inline void Wrapper(node_addon_api_basic_env env, + void* data, + void* finalizeHint) NAPI_NOEXCEPT { +#ifdef NODE_ADDON_API_REQUIRE_BASIC_FINALIZERS + static_assert(false, + "NODE_ADDON_API_REQUIRE_BASIC_FINALIZERS defined: Finalizer " + "must be basic."); +#endif + napi_status status = + node_api_post_finalizer(env, WrapperGC, data, finalizeHint); + NAPI_FATAL_IF_FAILED( + status, "FinalizeData::Wrapper", "node_api_post_finalizer failed"); + } +#endif + +#ifdef NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER + template >> +#endif + static inline void WrapperWithHint(node_addon_api_basic_env env, + void* data, + void* finalizeHint) NAPI_NOEXCEPT { + WrapVoidCallback([&] { + FinalizeData* finalizeData = static_cast(finalizeHint); + finalizeData->callback(env, static_cast(data), finalizeData->hint); + delete finalizeData; + }); + } + +#ifdef NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER + template >, + typename = void> + static inline void WrapperWithHint(node_addon_api_basic_env env, + void* data, + void* finalizeHint) NAPI_NOEXCEPT { +#ifdef NODE_ADDON_API_REQUIRE_BASIC_FINALIZERS + static_assert(false, + "NODE_ADDON_API_REQUIRE_BASIC_FINALIZERS defined: Finalizer " + "must be basic."); +#endif + napi_status status = + node_api_post_finalizer(env, WrapperGCWithHint, data, finalizeHint); + NAPI_FATAL_IF_FAILED( + status, "FinalizeData::Wrapper", "node_api_post_finalizer failed"); + } +#endif + + static inline void WrapperGCWithoutData(napi_env env, + void* /*data*/, + void* finalizeHint) NAPI_NOEXCEPT { + WrapVoidCallback(env, [&] { + FinalizeData* finalizeData = static_cast(finalizeHint); + finalizeData->callback(env); + delete finalizeData; + }); + } + + static inline void WrapperGC(napi_env env, + void* data, + void* finalizeHint) NAPI_NOEXCEPT { + WrapVoidCallback(env, [&] { + FinalizeData* finalizeData = static_cast(finalizeHint); + finalizeData->callback(env, static_cast(data)); + delete finalizeData; + }); + } + + static inline void WrapperGCWithHint(napi_env env, + void* data, + void* finalizeHint) NAPI_NOEXCEPT { + WrapVoidCallback(env, [&] { + FinalizeData* finalizeData = static_cast(finalizeHint); + finalizeData->callback(env, static_cast(data), finalizeData->hint); + delete finalizeData; + }); + } + + Finalizer callback; + Hint* hint; +}; + +#if (NAPI_VERSION > 3 && NAPI_HAS_THREADS) +template , + typename FinalizerDataType = void> +struct ThreadSafeFinalize { + static inline void Wrapper(napi_env env, + void* rawFinalizeData, + void* /* rawContext */) { + if (rawFinalizeData == nullptr) return; + + ThreadSafeFinalize* finalizeData = + static_cast(rawFinalizeData); + finalizeData->callback(Env(env)); + delete finalizeData; + } + + static inline void FinalizeWrapperWithData(napi_env env, + void* rawFinalizeData, + void* /* rawContext */) { + if (rawFinalizeData == nullptr) return; + + ThreadSafeFinalize* finalizeData = + static_cast(rawFinalizeData); + finalizeData->callback(Env(env), finalizeData->data); + delete finalizeData; + } + + static inline void FinalizeWrapperWithContext(napi_env env, + void* rawFinalizeData, + void* rawContext) { + if (rawFinalizeData == nullptr) return; + + ThreadSafeFinalize* finalizeData = + static_cast(rawFinalizeData); + finalizeData->callback(Env(env), static_cast(rawContext)); + delete finalizeData; + } + + static inline void FinalizeFinalizeWrapperWithDataAndContext( + napi_env env, void* rawFinalizeData, void* rawContext) { + if (rawFinalizeData == nullptr) return; + + ThreadSafeFinalize* finalizeData = + static_cast(rawFinalizeData); + finalizeData->callback( + Env(env), finalizeData->data, static_cast(rawContext)); + delete finalizeData; + } + + FinalizerDataType* data; + Finalizer callback; +}; + +template +inline typename std::enable_if(nullptr)>::type +CallJsWrapper(napi_env env, napi_value jsCallback, void* context, void* data) { + details::WrapVoidCallback(env, [&]() { + call(env, + Function(env, jsCallback), + static_cast(context), + static_cast(data)); + }); +} + +template +inline typename std::enable_if(nullptr)>::type +CallJsWrapper(napi_env env, + napi_value jsCallback, + void* /*context*/, + void* /*data*/) { + details::WrapVoidCallback(env, [&]() { + if (jsCallback != nullptr) { + Function(env, jsCallback).Call(0, nullptr); + } + }); +} + +#if NAPI_VERSION > 4 + +template +napi_value DefaultCallbackWrapper(napi_env /*env*/, std::nullptr_t /*cb*/) { + return nullptr; +} + +template +napi_value DefaultCallbackWrapper(napi_env /*env*/, Napi::Function cb) { + return cb; +} + +#else +template +napi_value DefaultCallbackWrapper(napi_env env, Napi::Function cb) { + if (cb.IsEmpty()) { + return TSFN::EmptyFunctionFactory(env); + } + return cb; +} +#endif // NAPI_VERSION > 4 +#endif // NAPI_VERSION > 3 && NAPI_HAS_THREADS + +template +struct AccessorCallbackData { + static inline napi_value GetterWrapper(napi_env env, + napi_callback_info info) { + return details::WrapCallback(env, [&] { + CallbackInfo callbackInfo(env, info); + AccessorCallbackData* callbackData = + static_cast(callbackInfo.Data()); + callbackInfo.SetData(callbackData->data); + return callbackData->getterCallback(callbackInfo); + }); + } + + static inline napi_value SetterWrapper(napi_env env, + napi_callback_info info) { + return details::WrapCallback(env, [&] { + CallbackInfo callbackInfo(env, info); + AccessorCallbackData* callbackData = + static_cast(callbackInfo.Data()); + callbackInfo.SetData(callbackData->data); + callbackData->setterCallback(callbackInfo); + return nullptr; + }); + } + + Getter getterCallback; + Setter setterCallback; + void* data; +}; + +// Debugging-purpose C++-style variant of sprintf(). +inline std::string StringFormat(const char* format, ...) { + std::string result; + va_list args; + va_start(args, format); + int len = vsnprintf(nullptr, 0, format, args); + result.resize(len); + vsnprintf(&result[0], len + 1, format, args); + va_end(args); + return result; +} + +template +class HasExtendedFinalizer { + private: + template + struct SFINAE {}; + template + static char test(SFINAE*); + template + static int test(...); + + public: + static constexpr bool value = sizeof(test(0)) == sizeof(char); +}; + +template +class HasBasicFinalizer { + private: + template + struct SFINAE {}; + template + static char test(SFINAE*); + template + static int test(...); + + public: + static constexpr bool value = sizeof(test(0)) == sizeof(char); +}; + +} // namespace details + +#ifndef NODE_ADDON_API_DISABLE_DEPRECATED +#include "napi-inl.deprecated.h" +#endif // !NODE_ADDON_API_DISABLE_DEPRECATED + +//////////////////////////////////////////////////////////////////////////////// +// Module registration +//////////////////////////////////////////////////////////////////////////////// + +// Register an add-on based on an initializer function. +#define NODE_API_MODULE(modname, regfunc) \ + static napi_value __napi_##regfunc(napi_env env, napi_value exports) { \ + return Napi::RegisterModule(env, exports, regfunc); \ + } \ + NAPI_MODULE(modname, __napi_##regfunc) + +// Register an add-on based on a subclass of `Addon` with a custom Node.js +// module name. +#define NODE_API_NAMED_ADDON(modname, classname) \ + static napi_value __napi_##classname(napi_env env, napi_value exports) { \ + return Napi::RegisterModule(env, exports, &classname::Init); \ + } \ + NAPI_MODULE(modname, __napi_##classname) + +// Register an add-on based on a subclass of `Addon` with the Node.js module +// name given by node-gyp from the `target_name` in binding.gyp. +#define NODE_API_ADDON(classname) \ + NODE_API_NAMED_ADDON(NODE_GYP_MODULE_NAME, classname) + +// Adapt the NAPI_MODULE registration function: +// - Wrap the arguments in NAPI wrappers. +// - Catch any NAPI errors and rethrow as JS exceptions. +inline napi_value RegisterModule(napi_env env, + napi_value exports, + ModuleRegisterCallback registerCallback) { + return details::WrapCallback(env, [&] { + return napi_value( + registerCallback(Napi::Env(env), Napi::Object(env, exports))); + }); +} + +//////////////////////////////////////////////////////////////////////////////// +// Maybe class +//////////////////////////////////////////////////////////////////////////////// + +template +bool Maybe::IsNothing() const { + return !_has_value; +} + +template +bool Maybe::IsJust() const { + return _has_value; +} + +template +void Maybe::Check() const { + NAPI_CHECK(IsJust(), "Napi::Maybe::Check", "Maybe value is Nothing."); +} + +template +T Maybe::Unwrap() const { + NAPI_CHECK(IsJust(), "Napi::Maybe::Unwrap", "Maybe value is Nothing."); + return _value; +} + +template +T Maybe::UnwrapOr(const T& default_value) const { + return _has_value ? _value : default_value; +} + +template +bool Maybe::UnwrapTo(T* out) const { + if (IsJust()) { + *out = _value; + return true; + }; + return false; +} + +template +bool Maybe::operator==(const Maybe& other) const { + return (IsJust() == other.IsJust()) && + (!IsJust() || Unwrap() == other.Unwrap()); +} + +template +bool Maybe::operator!=(const Maybe& other) const { + return !operator==(other); +} + +template +Maybe::Maybe() : _has_value(false) {} + +template +Maybe::Maybe(const T& t) : _has_value(true), _value(t) {} + +template +inline Maybe Nothing() { + return Maybe(); +} + +template +inline Maybe Just(const T& t) { + return Maybe(t); +} + +//////////////////////////////////////////////////////////////////////////////// +// BasicEnv / Env class +//////////////////////////////////////////////////////////////////////////////// + +inline BasicEnv::BasicEnv(node_addon_api_basic_env env) : _env(env) {} + +inline BasicEnv::operator node_addon_api_basic_env() const { + return _env; +} + +inline Env::Env(napi_env env) : BasicEnv(env) {} + +inline Env::operator napi_env() const { + return const_cast(_env); +} + +inline Object Env::Global() const { + napi_value value; + napi_status status = napi_get_global(*this, &value); + NAPI_THROW_IF_FAILED(*this, status, Object()); + return Object(*this, value); +} + +inline Value Env::Undefined() const { + napi_value value; + napi_status status = napi_get_undefined(*this, &value); + NAPI_THROW_IF_FAILED(*this, status, Value()); + return Value(*this, value); +} + +inline Value Env::Null() const { + napi_value value; + napi_status status = napi_get_null(*this, &value); + NAPI_THROW_IF_FAILED(*this, status, Value()); + return Value(*this, value); +} + +inline bool Env::IsExceptionPending() const { + bool result; + napi_status status = napi_is_exception_pending(*this, &result); + if (status != napi_ok) + result = false; // Checking for a pending exception shouldn't throw. + return result; +} + +inline Error Env::GetAndClearPendingException() const { + napi_value value; + napi_status status = napi_get_and_clear_last_exception(*this, &value); + if (status != napi_ok) { + // Don't throw another exception when failing to get the exception! + return Error(); + } + return Error(*this, value); +} + +inline MaybeOrValue Env::RunScript(const char* utf8script) const { + String script = String::New(*this, utf8script); + return RunScript(script); +} + +inline MaybeOrValue Env::RunScript(const std::string& utf8script) const { + return RunScript(utf8script.c_str()); +} + +inline MaybeOrValue Env::RunScript(String script) const { + napi_value result; + napi_status status = napi_run_script(*this, script, &result); + NAPI_RETURN_OR_THROW_IF_FAILED( + *this, status, Napi::Value(*this, result), Napi::Value); +} + +#if NAPI_VERSION > 2 +template +void BasicEnv::CleanupHook::Wrapper(void* data) NAPI_NOEXCEPT { + auto* cleanupData = static_cast< + typename Napi::BasicEnv::CleanupHook::CleanupData*>(data); + cleanupData->hook(); + delete cleanupData; +} + +template +void BasicEnv::CleanupHook::WrapperWithArg(void* data) + NAPI_NOEXCEPT { + auto* cleanupData = static_cast< + typename Napi::BasicEnv::CleanupHook::CleanupData*>(data); + cleanupData->hook(static_cast(cleanupData->arg)); + delete cleanupData; +} +#endif // NAPI_VERSION > 2 + +#if NAPI_VERSION > 5 +template fini> +inline void BasicEnv::SetInstanceData(T* data) const { + napi_status status = napi_set_instance_data( + _env, + data, + [](napi_env env, void* data, void*) { fini(env, static_cast(data)); }, + nullptr); + NAPI_FATAL_IF_FAILED( + status, "BasicEnv::SetInstanceData", "invalid arguments"); +} + +template fini> +inline void BasicEnv::SetInstanceData(DataType* data, HintType* hint) const { + napi_status status = napi_set_instance_data( + _env, + data, + [](napi_env env, void* data, void* hint) { + fini(env, static_cast(data), static_cast(hint)); + }, + hint); + NAPI_FATAL_IF_FAILED( + status, "BasicEnv::SetInstanceData", "invalid arguments"); +} + +template +inline T* BasicEnv::GetInstanceData() const { + void* data = nullptr; + + napi_status status = napi_get_instance_data(_env, &data); + NAPI_FATAL_IF_FAILED( + status, "BasicEnv::GetInstanceData", "invalid arguments"); + + return static_cast(data); +} + +template +void BasicEnv::DefaultFini(Env, T* data) { + delete data; +} + +template +void BasicEnv::DefaultFiniWithHint(Env, DataType* data, HintType*) { + delete data; +} +#endif // NAPI_VERSION > 5 + +#if NAPI_VERSION > 8 +inline const char* BasicEnv::GetModuleFileName() const { + const char* result; + napi_status status = node_api_get_module_file_name(_env, &result); + NAPI_FATAL_IF_FAILED( + status, "BasicEnv::GetModuleFileName", "invalid arguments"); + return result; +} +#endif // NAPI_VERSION > 8 +//////////////////////////////////////////////////////////////////////////////// +// Value class +//////////////////////////////////////////////////////////////////////////////// + +inline Value::Value() : _env(nullptr), _value(nullptr) {} + +inline Value::Value(napi_env env, napi_value value) + : _env(env), _value(value) {} + +inline Value::operator napi_value() const { + return _value; +} + +inline bool Value::operator==(const Value& other) const { + return StrictEquals(other); +} + +inline bool Value::operator!=(const Value& other) const { + return !this->operator==(other); +} + +inline bool Value::StrictEquals(const Value& other) const { + bool result; + napi_status status = napi_strict_equals(_env, *this, other, &result); + NAPI_THROW_IF_FAILED(_env, status, false); + return result; +} + +inline Napi::Env Value::Env() const { + return Napi::Env(_env); +} + +inline bool Value::IsEmpty() const { + return _value == nullptr; +} + +inline napi_valuetype Value::Type() const { + if (IsEmpty()) { + return napi_undefined; + } + + napi_valuetype type; + napi_status status = napi_typeof(_env, _value, &type); + NAPI_THROW_IF_FAILED(_env, status, napi_undefined); + return type; +} + +inline bool Value::IsUndefined() const { + return Type() == napi_undefined; +} + +inline bool Value::IsNull() const { + return Type() == napi_null; +} + +inline bool Value::IsBoolean() const { + return Type() == napi_boolean; +} + +inline bool Value::IsNumber() const { + return Type() == napi_number; +} + +#if NAPI_VERSION > 5 +inline bool Value::IsBigInt() const { + return Type() == napi_bigint; +} +#endif // NAPI_VERSION > 5 + +#if (NAPI_VERSION > 4) +inline bool Value::IsDate() const { + if (IsEmpty()) { + return false; + } + + bool result; + napi_status status = napi_is_date(_env, _value, &result); + NAPI_THROW_IF_FAILED(_env, status, false); + return result; +} +#endif + +inline bool Value::IsString() const { + return Type() == napi_string; +} + +inline bool Value::IsSymbol() const { + return Type() == napi_symbol; +} + +inline bool Value::IsArray() const { + if (IsEmpty()) { + return false; + } + + bool result; + napi_status status = napi_is_array(_env, _value, &result); + NAPI_THROW_IF_FAILED(_env, status, false); + return result; +} + +inline bool Value::IsArrayBuffer() const { + if (IsEmpty()) { + return false; + } + + bool result; + napi_status status = napi_is_arraybuffer(_env, _value, &result); + NAPI_THROW_IF_FAILED(_env, status, false); + return result; +} + +inline bool Value::IsTypedArray() const { + if (IsEmpty()) { + return false; + } + + bool result; + napi_status status = napi_is_typedarray(_env, _value, &result); + NAPI_THROW_IF_FAILED(_env, status, false); + return result; +} + +inline bool Value::IsObject() const { + return Type() == napi_object || IsFunction(); +} + +inline bool Value::IsFunction() const { + return Type() == napi_function; +} + +inline bool Value::IsPromise() const { + if (IsEmpty()) { + return false; + } + + bool result; + napi_status status = napi_is_promise(_env, _value, &result); + NAPI_THROW_IF_FAILED(_env, status, false); + return result; +} + +inline bool Value::IsDataView() const { + if (IsEmpty()) { + return false; + } + + bool result; + napi_status status = napi_is_dataview(_env, _value, &result); + NAPI_THROW_IF_FAILED(_env, status, false); + return result; +} + +inline bool Value::IsBuffer() const { + if (IsEmpty()) { + return false; + } + + bool result; + napi_status status = napi_is_buffer(_env, _value, &result); + NAPI_THROW_IF_FAILED(_env, status, false); + return result; +} + +inline bool Value::IsExternal() const { + return Type() == napi_external; +} + +#ifdef NODE_API_EXPERIMENTAL_HAS_SHAREDARRAYBUFFER +inline bool Value::IsSharedArrayBuffer() const { + if (IsEmpty()) { + return false; + } + + bool result; + napi_status status = node_api_is_sharedarraybuffer(_env, _value, &result); + NAPI_THROW_IF_FAILED(_env, status, false); + return result; +} +#endif + +template +inline T Value::As() const { +#ifdef NODE_ADDON_API_ENABLE_TYPE_CHECK_ON_AS + T::CheckCast(_env, _value); +#endif + return T(_env, _value); +} + +template +inline T Value::UnsafeAs() const { + return T(_env, _value); +} + +// static +inline void Value::CheckCast(napi_env /* env */, napi_value value) { + NAPI_CHECK(value != nullptr, "Value::CheckCast", "empty value"); +} + +inline MaybeOrValue Value::ToBoolean() const { + napi_value result; + napi_status status = napi_coerce_to_bool(_env, _value, &result); + NAPI_RETURN_OR_THROW_IF_FAILED( + _env, status, Napi::Boolean(_env, result), Napi::Boolean); +} + +inline MaybeOrValue Value::ToNumber() const { + napi_value result; + napi_status status = napi_coerce_to_number(_env, _value, &result); + NAPI_RETURN_OR_THROW_IF_FAILED( + _env, status, Napi::Number(_env, result), Napi::Number); +} + +inline MaybeOrValue Value::ToString() const { + napi_value result; + napi_status status = napi_coerce_to_string(_env, _value, &result); + NAPI_RETURN_OR_THROW_IF_FAILED( + _env, status, Napi::String(_env, result), Napi::String); +} + +inline MaybeOrValue Value::ToObject() const { + napi_value result; + napi_status status = napi_coerce_to_object(_env, _value, &result); + NAPI_RETURN_OR_THROW_IF_FAILED( + _env, status, Napi::Object(_env, result), Napi::Object); +} + +//////////////////////////////////////////////////////////////////////////////// +// Boolean class +//////////////////////////////////////////////////////////////////////////////// + +inline Boolean Boolean::New(napi_env env, bool val) { + napi_value value; + napi_status status = napi_get_boolean(env, val, &value); + NAPI_THROW_IF_FAILED(env, status, Boolean()); + return Boolean(env, value); +} + +inline void Boolean::CheckCast(napi_env env, napi_value value) { + NAPI_CHECK(value != nullptr, "Boolean::CheckCast", "empty value"); + + napi_valuetype type; + napi_status status = napi_typeof(env, value, &type); + NAPI_CHECK(status == napi_ok, "Boolean::CheckCast", "napi_typeof failed"); + NAPI_INTERNAL_CHECK_EQ(type, napi_boolean, "%d", "Boolean::CheckCast"); +} + +inline Boolean::Boolean() : Napi::Value() {} + +inline Boolean::Boolean(napi_env env, napi_value value) + : Napi::Value(env, value) {} + +inline Boolean::operator bool() const { + return Value(); +} + +inline bool Boolean::Value() const { + bool result; + napi_status status = napi_get_value_bool(_env, _value, &result); + NAPI_THROW_IF_FAILED(_env, status, false); + return result; +} + +//////////////////////////////////////////////////////////////////////////////// +// Number class +//////////////////////////////////////////////////////////////////////////////// + +inline Number Number::New(napi_env env, double val) { + napi_value value; + napi_status status = napi_create_double(env, val, &value); + NAPI_THROW_IF_FAILED(env, status, Number()); + return Number(env, value); +} + +inline void Number::CheckCast(napi_env env, napi_value value) { + NAPI_CHECK(value != nullptr, "Number::CheckCast", "empty value"); + + napi_valuetype type; + napi_status status = napi_typeof(env, value, &type); + NAPI_CHECK(status == napi_ok, "Number::CheckCast", "napi_typeof failed"); + NAPI_INTERNAL_CHECK_EQ(type, napi_number, "%d", "Number::CheckCast"); +} + +inline Number::Number() : Value() {} + +inline Number::Number(napi_env env, napi_value value) : Value(env, value) {} + +inline Number::operator int32_t() const { + return Int32Value(); +} + +inline Number::operator uint32_t() const { + return Uint32Value(); +} + +inline Number::operator int64_t() const { + return Int64Value(); +} + +inline Number::operator float() const { + return FloatValue(); +} + +inline Number::operator double() const { + return DoubleValue(); +} + +inline int32_t Number::Int32Value() const { + int32_t result; + napi_status status = napi_get_value_int32(_env, _value, &result); + NAPI_THROW_IF_FAILED(_env, status, 0); + return result; +} + +inline uint32_t Number::Uint32Value() const { + uint32_t result; + napi_status status = napi_get_value_uint32(_env, _value, &result); + NAPI_THROW_IF_FAILED(_env, status, 0); + return result; +} + +inline int64_t Number::Int64Value() const { + int64_t result; + napi_status status = napi_get_value_int64(_env, _value, &result); + NAPI_THROW_IF_FAILED(_env, status, 0); + return result; +} + +inline float Number::FloatValue() const { + return static_cast(DoubleValue()); +} + +inline double Number::DoubleValue() const { + double result; + napi_status status = napi_get_value_double(_env, _value, &result); + NAPI_THROW_IF_FAILED(_env, status, 0); + return result; +} + +#if NAPI_VERSION > 5 +//////////////////////////////////////////////////////////////////////////////// +// BigInt Class +//////////////////////////////////////////////////////////////////////////////// + +inline BigInt BigInt::New(napi_env env, int64_t val) { + napi_value value; + napi_status status = napi_create_bigint_int64(env, val, &value); + NAPI_THROW_IF_FAILED(env, status, BigInt()); + return BigInt(env, value); +} + +inline BigInt BigInt::New(napi_env env, uint64_t val) { + napi_value value; + napi_status status = napi_create_bigint_uint64(env, val, &value); + NAPI_THROW_IF_FAILED(env, status, BigInt()); + return BigInt(env, value); +} + +inline BigInt BigInt::New(napi_env env, + int sign_bit, + size_t word_count, + const uint64_t* words) { + napi_value value; + napi_status status = + napi_create_bigint_words(env, sign_bit, word_count, words, &value); + NAPI_THROW_IF_FAILED(env, status, BigInt()); + return BigInt(env, value); +} + +inline void BigInt::CheckCast(napi_env env, napi_value value) { + NAPI_CHECK(value != nullptr, "BigInt::CheckCast", "empty value"); + + napi_valuetype type; + napi_status status = napi_typeof(env, value, &type); + NAPI_CHECK(status == napi_ok, "BigInt::CheckCast", "napi_typeof failed"); + NAPI_INTERNAL_CHECK_EQ(type, napi_bigint, "%d", "BigInt::CheckCast"); +} + +inline BigInt::BigInt() : Value() {} + +inline BigInt::BigInt(napi_env env, napi_value value) : Value(env, value) {} + +inline int64_t BigInt::Int64Value(bool* lossless) const { + int64_t result; + napi_status status = + napi_get_value_bigint_int64(_env, _value, &result, lossless); + NAPI_THROW_IF_FAILED(_env, status, 0); + return result; +} + +inline uint64_t BigInt::Uint64Value(bool* lossless) const { + uint64_t result; + napi_status status = + napi_get_value_bigint_uint64(_env, _value, &result, lossless); + NAPI_THROW_IF_FAILED(_env, status, 0); + return result; +} + +inline size_t BigInt::WordCount() const { + size_t word_count; + napi_status status = + napi_get_value_bigint_words(_env, _value, nullptr, &word_count, nullptr); + NAPI_THROW_IF_FAILED(_env, status, 0); + return word_count; +} + +inline void BigInt::ToWords(int* sign_bit, + size_t* word_count, + uint64_t* words) { + napi_status status = + napi_get_value_bigint_words(_env, _value, sign_bit, word_count, words); + NAPI_THROW_IF_FAILED_VOID(_env, status); +} +#endif // NAPI_VERSION > 5 + +#if (NAPI_VERSION > 4) +//////////////////////////////////////////////////////////////////////////////// +// Date Class +//////////////////////////////////////////////////////////////////////////////// + +inline Date Date::New(napi_env env, double val) { + napi_value value; + napi_status status = napi_create_date(env, val, &value); + NAPI_THROW_IF_FAILED(env, status, Date()); + return Date(env, value); +} + +inline void Date::CheckCast(napi_env env, napi_value value) { + NAPI_CHECK(value != nullptr, "Date::CheckCast", "empty value"); + + bool result; + napi_status status = napi_is_date(env, value, &result); + NAPI_CHECK(status == napi_ok, "Date::CheckCast", "napi_is_date failed"); + NAPI_CHECK(result, "Date::CheckCast", "value is not date"); +} + +inline Date::Date() : Value() {} + +inline Date::Date(napi_env env, napi_value value) : Value(env, value) {} + +inline Date::operator double() const { + return ValueOf(); +} + +inline double Date::ValueOf() const { + double result; + napi_status status = napi_get_date_value(_env, _value, &result); + NAPI_THROW_IF_FAILED(_env, status, 0); + return result; +} +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Name class +//////////////////////////////////////////////////////////////////////////////// +inline void Name::CheckCast(napi_env env, napi_value value) { + NAPI_CHECK(value != nullptr, "Name::CheckCast", "empty value"); + + napi_valuetype type; + napi_status status = napi_typeof(env, value, &type); + NAPI_CHECK(status == napi_ok, "Name::CheckCast", "napi_typeof failed"); + NAPI_INTERNAL_CHECK(type == napi_string || type == napi_symbol, + "Name::CheckCast", + "value is not napi_string or napi_symbol, got %d.", + type); +} + +inline Name::Name() : Value() {} + +inline Name::Name(napi_env env, napi_value value) : Value(env, value) {} + +//////////////////////////////////////////////////////////////////////////////// +// String class +//////////////////////////////////////////////////////////////////////////////// + +inline String String::New(napi_env env, const std::string& val) { + return String::New(env, val.c_str(), val.size()); +} + +inline String String::New(napi_env env, const std::u16string& val) { + return String::New(env, val.c_str(), val.size()); +} + +inline String String::New(napi_env env, const char* val) { + // TODO(@gabrielschulhof) Remove if-statement when core's error handling is + // available in all supported versions. + if (val == nullptr) { + // Throw an error that looks like it came from core. + NAPI_THROW_IF_FAILED(env, napi_invalid_arg, String()); + } + napi_value value; + napi_status status = + napi_create_string_utf8(env, val, std::strlen(val), &value); + NAPI_THROW_IF_FAILED(env, status, String()); + return String(env, value); +} + +inline String String::New(napi_env env, const char16_t* val) { + napi_value value; + // TODO(@gabrielschulhof) Remove if-statement when core's error handling is + // available in all supported versions. + if (val == nullptr) { + // Throw an error that looks like it came from core. + NAPI_THROW_IF_FAILED(env, napi_invalid_arg, String()); + } + napi_status status = + napi_create_string_utf16(env, val, std::u16string(val).size(), &value); + NAPI_THROW_IF_FAILED(env, status, String()); + return String(env, value); +} + +inline String String::New(napi_env env, const char* val, size_t length) { + napi_value value; + napi_status status = napi_create_string_utf8(env, val, length, &value); + NAPI_THROW_IF_FAILED(env, status, String()); + return String(env, value); +} + +inline String String::New(napi_env env, const char16_t* val, size_t length) { + napi_value value; + napi_status status = napi_create_string_utf16(env, val, length, &value); + NAPI_THROW_IF_FAILED(env, status, String()); + return String(env, value); +} + +inline void String::CheckCast(napi_env env, napi_value value) { + NAPI_CHECK(value != nullptr, "String::CheckCast", "empty value"); + + napi_valuetype type; + napi_status status = napi_typeof(env, value, &type); + NAPI_CHECK(status == napi_ok, "String::CheckCast", "napi_typeof failed"); + NAPI_INTERNAL_CHECK_EQ(type, napi_string, "%d", "String::CheckCast"); +} + +inline String::String() : Name() {} + +inline String::String(napi_env env, napi_value value) : Name(env, value) {} + +inline String::operator std::string() const { + return Utf8Value(); +} + +inline String::operator std::u16string() const { + return Utf16Value(); +} + +inline std::string String::Utf8Value() const { + size_t length; + napi_status status = + napi_get_value_string_utf8(_env, _value, nullptr, 0, &length); + NAPI_THROW_IF_FAILED(_env, status, ""); + + std::string value; + value.reserve(length + 1); + value.resize(length); + status = napi_get_value_string_utf8( + _env, _value, &value[0], value.capacity(), nullptr); + NAPI_THROW_IF_FAILED(_env, status, ""); + return value; +} + +inline std::u16string String::Utf16Value() const { + size_t length; + napi_status status = + napi_get_value_string_utf16(_env, _value, nullptr, 0, &length); + NAPI_THROW_IF_FAILED(_env, status, NAPI_WIDE_TEXT("")); + + std::u16string value; + value.reserve(length + 1); + value.resize(length); + status = napi_get_value_string_utf16( + _env, _value, &value[0], value.capacity(), nullptr); + NAPI_THROW_IF_FAILED(_env, status, NAPI_WIDE_TEXT("")); + return value; +} + +//////////////////////////////////////////////////////////////////////////////// +// Symbol class +//////////////////////////////////////////////////////////////////////////////// + +inline Symbol Symbol::New(napi_env env, const char* description) { + napi_value descriptionValue = description != nullptr + ? String::New(env, description) + : static_cast(nullptr); + return Symbol::New(env, descriptionValue); +} + +inline Symbol Symbol::New(napi_env env, const std::string& description) { + napi_value descriptionValue = String::New(env, description); + return Symbol::New(env, descriptionValue); +} + +inline Symbol Symbol::New(napi_env env, String description) { + napi_value descriptionValue = description; + return Symbol::New(env, descriptionValue); +} + +inline Symbol Symbol::New(napi_env env, napi_value description) { + napi_value value; + napi_status status = napi_create_symbol(env, description, &value); + NAPI_THROW_IF_FAILED(env, status, Symbol()); + return Symbol(env, value); +} + +inline MaybeOrValue Symbol::WellKnown(napi_env env, + const std::string& name) { + // No need to check if the return value is a symbol or undefined. + // Well known symbols are definite and it is an develop time error + // if the symbol does not exist. +#if defined(NODE_ADDON_API_ENABLE_MAYBE) + Value symbol_obj; + Value symbol_value; + if (Napi::Env(env).Global().Get("Symbol").UnwrapTo(&symbol_obj) && + symbol_obj.As().Get(name).UnwrapTo(&symbol_value)) { + return Just(symbol_value.UnsafeAs()); + } + return Nothing(); +#else + return Napi::Env(env) + .Global() + .Get("Symbol") + .As() + .Get(name) + .UnsafeAs(); +#endif +} + +inline MaybeOrValue Symbol::For(napi_env env, + const std::string& description) { + napi_value descriptionValue = String::New(env, description); + return Symbol::For(env, descriptionValue); +} + +inline MaybeOrValue Symbol::For(napi_env env, const char* description) { + napi_value descriptionValue = String::New(env, description); + return Symbol::For(env, descriptionValue); +} + +inline MaybeOrValue Symbol::For(napi_env env, String description) { + return Symbol::For(env, static_cast(description)); +} + +inline MaybeOrValue Symbol::For(napi_env env, napi_value description) { +#if defined(NODE_ADDON_API_ENABLE_MAYBE) + Value symbol_obj; + Value symbol_for_value; + Value symbol_value; + if (Napi::Env(env).Global().Get("Symbol").UnwrapTo(&symbol_obj) && + symbol_obj.As().Get("for").UnwrapTo(&symbol_for_value) && + symbol_for_value.As() + .Call(symbol_obj, {description}) + .UnwrapTo(&symbol_value)) { + return Just(symbol_value.As()); + } + return Nothing(); +#else + Object symbol_obj = Napi::Env(env).Global().Get("Symbol").As(); + return symbol_obj.Get("for") + .As() + .Call(symbol_obj, {description}) + .As(); +#endif +} + +inline void Symbol::CheckCast(napi_env env, napi_value value) { + NAPI_CHECK(value != nullptr, "Symbol::CheckCast", "empty value"); + + napi_valuetype type; + napi_status status = napi_typeof(env, value, &type); + NAPI_CHECK(status == napi_ok, "Symbol::CheckCast", "napi_typeof failed"); + NAPI_INTERNAL_CHECK_EQ(type, napi_symbol, "%d", "Symbol::CheckCast"); +} + +inline Symbol::Symbol() : Name() {} + +inline Symbol::Symbol(napi_env env, napi_value value) : Name(env, value) {} + +//////////////////////////////////////////////////////////////////////////////// +// Automagic value creation +//////////////////////////////////////////////////////////////////////////////// + +namespace details { +template +struct vf_number { + static Number From(napi_env env, T value) { + return Number::New(env, static_cast(value)); + } +}; + +template <> +struct vf_number { + static Boolean From(napi_env env, bool value) { + return Boolean::New(env, value); + } +}; + +struct vf_utf8_charp { + static String From(napi_env env, const char* value) { + return String::New(env, value); + } +}; + +struct vf_utf16_charp { + static String From(napi_env env, const char16_t* value) { + return String::New(env, value); + } +}; +struct vf_utf8_string { + static String From(napi_env env, const std::string& value) { + return String::New(env, value); + } +}; + +struct vf_utf16_string { + static String From(napi_env env, const std::u16string& value) { + return String::New(env, value); + } +}; + +template +struct vf_fallback { + static Value From(napi_env env, const T& value) { return Value(env, value); } +}; + +template +struct disjunction : std::false_type {}; +template +struct disjunction : B {}; +template +struct disjunction + : std::conditional>::type {}; + +template +struct can_make_string + : disjunction::type, + typename std::is_convertible::type, + typename std::is_convertible::type, + typename std::is_convertible::type> {}; +} // namespace details + +template +Value Value::From(napi_env env, const T& value) { + using Helper = typename std::conditional< + std::is_integral::value || std::is_floating_point::value, + details::vf_number, + typename std::conditional::value, + String, + details::vf_fallback>::type>::type; + return Helper::From(env, value); +} + +template +String String::From(napi_env env, const T& value) { + struct Dummy {}; + using Helper = typename std::conditional< + std::is_convertible::value, + details::vf_utf8_charp, + typename std::conditional< + std::is_convertible::value, + details::vf_utf16_charp, + typename std::conditional< + std::is_convertible::value, + details::vf_utf8_string, + typename std::conditional< + std::is_convertible::value, + details::vf_utf16_string, + Dummy>::type>::type>::type>::type; + return Helper::From(env, value); +} + +//////////////////////////////////////////////////////////////////////////////// +// TypeTaggable class +//////////////////////////////////////////////////////////////////////////////// + +inline TypeTaggable::TypeTaggable() : Value() {} + +inline TypeTaggable::TypeTaggable(napi_env _env, napi_value _value) + : Value(_env, _value) {} + +#if NAPI_VERSION >= 8 + +inline void TypeTaggable::TypeTag(const napi_type_tag* type_tag) const { + napi_status status = napi_type_tag_object(_env, _value, type_tag); + NAPI_THROW_IF_FAILED_VOID(_env, status); +} + +inline bool TypeTaggable::CheckTypeTag(const napi_type_tag* type_tag) const { + bool result; + napi_status status = + napi_check_object_type_tag(_env, _value, type_tag, &result); + NAPI_THROW_IF_FAILED(_env, status, false); + return result; +} + +#endif // NAPI_VERSION >= 8 + +//////////////////////////////////////////////////////////////////////////////// +// Object class +//////////////////////////////////////////////////////////////////////////////// + +template +inline Object::PropertyLValue::operator Value() const { + MaybeOrValue val = Object(_env, _object).Get(_key); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + return val.Unwrap(); +#else + return val; +#endif +} + +template +template +inline Object::PropertyLValue& Object::PropertyLValue::operator=( + ValueType value) { +#ifdef NODE_ADDON_API_ENABLE_MAYBE + MaybeOrValue result = +#endif + Object(_env, _object).Set(_key, value); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + result.Unwrap(); +#endif + return *this; +} + +template +inline Value Object::PropertyLValue::AsValue() const { + return Value(*this); +} + +template +inline Object::PropertyLValue::PropertyLValue(Object object, Key key) + : _env(object.Env()), _object(object), _key(key) {} + +inline Object Object::New(napi_env env) { + napi_value value; + napi_status status = napi_create_object(env, &value); + NAPI_THROW_IF_FAILED(env, status, Object()); + return Object(env, value); +} + +inline void Object::CheckCast(napi_env env, napi_value value) { + NAPI_CHECK(value != nullptr, "Object::CheckCast", "empty value"); + + napi_valuetype type; + napi_status status = napi_typeof(env, value, &type); + NAPI_CHECK(status == napi_ok, "Object::CheckCast", "napi_typeof failed"); + NAPI_INTERNAL_CHECK(type == napi_object || type == napi_function, + "Object::CheckCast", + "Expect napi_object or napi_function, but got %d.", + type); +} + +inline Object::Object() : TypeTaggable() {} + +inline Object::Object(napi_env env, napi_value value) + : TypeTaggable(env, value) {} + +inline Object::PropertyLValue Object::operator[]( + const char* utf8name) { + return PropertyLValue(*this, utf8name); +} + +inline Object::PropertyLValue Object::operator[]( + const std::string& utf8name) { + return PropertyLValue(*this, utf8name); +} + +inline Object::PropertyLValue Object::operator[](uint32_t index) { + return PropertyLValue(*this, index); +} + +inline Object::PropertyLValue Object::operator[](Value index) const { + return PropertyLValue(*this, index); +} + +inline MaybeOrValue Object::operator[](const char* utf8name) const { + return Get(utf8name); +} + +inline MaybeOrValue Object::operator[]( + const std::string& utf8name) const { + return Get(utf8name); +} + +inline MaybeOrValue Object::operator[](uint32_t index) const { + return Get(index); +} + +inline MaybeOrValue Object::Has(napi_value key) const { + bool result; + napi_status status = napi_has_property(_env, _value, key, &result); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, result, bool); +} + +inline MaybeOrValue Object::Has(Value key) const { + bool result; + napi_status status = napi_has_property(_env, _value, key, &result); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, result, bool); +} + +inline MaybeOrValue Object::Has(const char* utf8name) const { + bool result; + napi_status status = napi_has_named_property(_env, _value, utf8name, &result); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, result, bool); +} + +inline MaybeOrValue Object::Has(const std::string& utf8name) const { + return Has(utf8name.c_str()); +} + +inline MaybeOrValue Object::HasOwnProperty(napi_value key) const { + bool result; + napi_status status = napi_has_own_property(_env, _value, key, &result); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, result, bool); +} + +inline MaybeOrValue Object::HasOwnProperty(Value key) const { + bool result; + napi_status status = napi_has_own_property(_env, _value, key, &result); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, result, bool); +} + +inline MaybeOrValue Object::HasOwnProperty(const char* utf8name) const { + napi_value key; + napi_status status = + napi_create_string_utf8(_env, utf8name, std::strlen(utf8name), &key); + NAPI_MAYBE_THROW_IF_FAILED(_env, status, bool); + return HasOwnProperty(key); +} + +inline MaybeOrValue Object::HasOwnProperty( + const std::string& utf8name) const { + return HasOwnProperty(utf8name.c_str()); +} + +inline MaybeOrValue Object::Get(napi_value key) const { + napi_value result; + napi_status status = napi_get_property(_env, _value, key, &result); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, Value(_env, result), Value); +} + +inline MaybeOrValue Object::Get(Value key) const { + napi_value result; + napi_status status = napi_get_property(_env, _value, key, &result); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, Value(_env, result), Value); +} + +inline MaybeOrValue Object::Get(const char* utf8name) const { + napi_value result; + napi_status status = napi_get_named_property(_env, _value, utf8name, &result); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, Value(_env, result), Value); +} + +inline MaybeOrValue Object::Get(const std::string& utf8name) const { + return Get(utf8name.c_str()); +} + +template +inline MaybeOrValue Object::Set(napi_value key, + const ValueType& value) const { + napi_status status = + napi_set_property(_env, _value, key, Value::From(_env, value)); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, status == napi_ok, bool); +} + +template +inline MaybeOrValue Object::Set(Value key, const ValueType& value) const { + napi_status status = + napi_set_property(_env, _value, key, Value::From(_env, value)); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, status == napi_ok, bool); +} + +template +inline MaybeOrValue Object::Set(const char* utf8name, + const ValueType& value) const { + napi_status status = + napi_set_named_property(_env, _value, utf8name, Value::From(_env, value)); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, status == napi_ok, bool); +} + +template +inline MaybeOrValue Object::Set(const std::string& utf8name, + const ValueType& value) const { + return Set(utf8name.c_str(), value); +} + +inline MaybeOrValue Object::Delete(napi_value key) const { + bool result; + napi_status status = napi_delete_property(_env, _value, key, &result); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, result, bool); +} + +inline MaybeOrValue Object::Delete(Value key) const { + bool result; + napi_status status = napi_delete_property(_env, _value, key, &result); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, result, bool); +} + +inline MaybeOrValue Object::Delete(const char* utf8name) const { + return Delete(String::New(_env, utf8name)); +} + +inline MaybeOrValue Object::Delete(const std::string& utf8name) const { + return Delete(String::New(_env, utf8name)); +} + +inline MaybeOrValue Object::Has(uint32_t index) const { + bool result; + napi_status status = napi_has_element(_env, _value, index, &result); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, result, bool); +} + +inline MaybeOrValue Object::Get(uint32_t index) const { + napi_value value; + napi_status status = napi_get_element(_env, _value, index, &value); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, Value(_env, value), Value); +} + +template +inline MaybeOrValue Object::Set(uint32_t index, + const ValueType& value) const { + napi_status status = + napi_set_element(_env, _value, index, Value::From(_env, value)); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, status == napi_ok, bool); +} + +inline MaybeOrValue Object::Delete(uint32_t index) const { + bool result; + napi_status status = napi_delete_element(_env, _value, index, &result); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, result, bool); +} + +inline MaybeOrValue Object::GetPropertyNames() const { + napi_value result; + napi_status status = napi_get_property_names(_env, _value, &result); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, Array(_env, result), Array); +} + +inline MaybeOrValue Object::DefineProperty( + const PropertyDescriptor& property) const { + napi_status status = napi_define_properties( + _env, + _value, + 1, + reinterpret_cast(&property)); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, status == napi_ok, bool); +} + +inline MaybeOrValue Object::DefineProperties( + const std::initializer_list& properties) const { + napi_status status = napi_define_properties( + _env, + _value, + properties.size(), + reinterpret_cast(properties.begin())); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, status == napi_ok, bool); +} + +inline MaybeOrValue Object::DefineProperties( + const std::vector& properties) const { + napi_status status = napi_define_properties( + _env, + _value, + properties.size(), + reinterpret_cast(properties.data())); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, status == napi_ok, bool); +} + +inline MaybeOrValue Object::InstanceOf( + const Function& constructor) const { + bool result; + napi_status status = napi_instanceof(_env, _value, constructor, &result); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, result, bool); +} + +template +inline void Object::AddFinalizer(Finalizer finalizeCallback, T* data) const { + details::FinalizeData* finalizeData = + new details::FinalizeData( + {std::move(finalizeCallback), nullptr}); + napi_status status = + details::AttachData::Wrapper>( + _env, *this, data, finalizeData); + if (status != napi_ok) { + delete finalizeData; + NAPI_THROW_IF_FAILED_VOID(_env, status); + } +} + +template +inline void Object::AddFinalizer(Finalizer finalizeCallback, + T* data, + Hint* finalizeHint) const { + details::FinalizeData* finalizeData = + new details::FinalizeData( + {std::move(finalizeCallback), finalizeHint}); + napi_status status = details:: + AttachData::WrapperWithHint>( + _env, *this, data, finalizeData); + if (status != napi_ok) { + delete finalizeData; + NAPI_THROW_IF_FAILED_VOID(_env, status); + } +} + +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS +inline Object::const_iterator::const_iterator(const Object* object, + const Type type) { + _object = object; + _keys = object->GetPropertyNames(); + _index = type == Type::BEGIN ? 0 : _keys.Length(); +} + +inline Object::const_iterator Napi::Object::begin() const { + const_iterator it(this, Object::const_iterator::Type::BEGIN); + return it; +} + +inline Object::const_iterator Napi::Object::end() const { + const_iterator it(this, Object::const_iterator::Type::END); + return it; +} + +inline Object::const_iterator& Object::const_iterator::operator++() { + ++_index; + return *this; +} + +inline bool Object::const_iterator::operator==( + const const_iterator& other) const { + return _index == other._index; +} + +inline bool Object::const_iterator::operator!=( + const const_iterator& other) const { + return _index != other._index; +} + +inline const std::pair> +Object::const_iterator::operator*() const { + const Value key = _keys[_index]; + const PropertyLValue value = (*_object)[key]; + return {key, value}; +} + +inline Object::iterator::iterator(Object* object, const Type type) { + _object = object; + _keys = object->GetPropertyNames(); + _index = type == Type::BEGIN ? 0 : _keys.Length(); +} + +inline Object::iterator Napi::Object::begin() { + iterator it(this, Object::iterator::Type::BEGIN); + return it; +} + +inline Object::iterator Napi::Object::end() { + iterator it(this, Object::iterator::Type::END); + return it; +} + +inline Object::iterator& Object::iterator::operator++() { + ++_index; + return *this; +} + +inline bool Object::iterator::operator==(const iterator& other) const { + return _index == other._index; +} + +inline bool Object::iterator::operator!=(const iterator& other) const { + return _index != other._index; +} + +inline std::pair> +Object::iterator::operator*() { + Value key = _keys[_index]; + PropertyLValue value = (*_object)[key]; + return {key, value}; +} +#endif // NODE_ADDON_API_CPP_EXCEPTIONS + +#if NAPI_VERSION >= 8 +inline MaybeOrValue Object::Freeze() const { + napi_status status = napi_object_freeze(_env, _value); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, status == napi_ok, bool); +} + +inline MaybeOrValue Object::Seal() const { + napi_status status = napi_object_seal(_env, _value); + NAPI_RETURN_OR_THROW_IF_FAILED(_env, status, status == napi_ok, bool); +} +#endif // NAPI_VERSION >= 8 + +//////////////////////////////////////////////////////////////////////////////// +// External class +//////////////////////////////////////////////////////////////////////////////// + +template +inline External External::New(napi_env env, T* data) { + napi_value value; + napi_status status = + napi_create_external(env, data, nullptr, nullptr, &value); + NAPI_THROW_IF_FAILED(env, status, External()); + return External(env, value); +} + +template +template +inline External External::New(napi_env env, + T* data, + Finalizer finalizeCallback) { + napi_value value; + details::FinalizeData* finalizeData = + new details::FinalizeData( + {std::move(finalizeCallback), nullptr}); + napi_status status = + napi_create_external(env, + data, + details::FinalizeData::Wrapper, + finalizeData, + &value); + if (status != napi_ok) { + delete finalizeData; + NAPI_THROW_IF_FAILED(env, status, External()); + } + return External(env, value); +} + +template +template +inline External External::New(napi_env env, + T* data, + Finalizer finalizeCallback, + Hint* finalizeHint) { + napi_value value; + details::FinalizeData* finalizeData = + new details::FinalizeData( + {std::move(finalizeCallback), finalizeHint}); + napi_status status = napi_create_external( + env, + data, + details::FinalizeData::WrapperWithHint, + finalizeData, + &value); + if (status != napi_ok) { + delete finalizeData; + NAPI_THROW_IF_FAILED(env, status, External()); + } + return External(env, value); +} + +template +inline void External::CheckCast(napi_env env, napi_value value) { + NAPI_CHECK(value != nullptr, "External::CheckCast", "empty value"); + + napi_valuetype type; + napi_status status = napi_typeof(env, value, &type); + NAPI_CHECK(status == napi_ok, "External::CheckCast", "napi_typeof failed"); + NAPI_INTERNAL_CHECK_EQ(type, napi_external, "%d", "External::CheckCast"); +} + +template +inline External::External() : TypeTaggable() {} + +template +inline External::External(napi_env env, napi_value value) + : TypeTaggable(env, value) {} + +template +inline T* External::Data() const { + void* data; + napi_status status = napi_get_value_external(_env, _value, &data); + NAPI_THROW_IF_FAILED(_env, status, nullptr); + return reinterpret_cast(data); +} + +//////////////////////////////////////////////////////////////////////////////// +// Array class +//////////////////////////////////////////////////////////////////////////////// + +inline Array Array::New(napi_env env) { + napi_value value; + napi_status status = napi_create_array(env, &value); + NAPI_THROW_IF_FAILED(env, status, Array()); + return Array(env, value); +} + +inline Array Array::New(napi_env env, size_t length) { + napi_value value; + napi_status status = napi_create_array_with_length(env, length, &value); + NAPI_THROW_IF_FAILED(env, status, Array()); + return Array(env, value); +} + +inline void Array::CheckCast(napi_env env, napi_value value) { + NAPI_CHECK(value != nullptr, "Array::CheckCast", "empty value"); + + bool result; + napi_status status = napi_is_array(env, value, &result); + NAPI_CHECK(status == napi_ok, "Array::CheckCast", "napi_is_array failed"); + NAPI_CHECK(result, "Array::CheckCast", "value is not array"); +} + +inline Array::Array() : Object() {} + +inline Array::Array(napi_env env, napi_value value) : Object(env, value) {} + +inline uint32_t Array::Length() const { + uint32_t result; + napi_status status = napi_get_array_length(_env, _value, &result); + NAPI_THROW_IF_FAILED(_env, status, 0); + return result; +} + +#ifdef NODE_API_EXPERIMENTAL_HAS_SHAREDARRAYBUFFER +//////////////////////////////////////////////////////////////////////////////// +// SharedArrayBuffer class +//////////////////////////////////////////////////////////////////////////////// + +inline SharedArrayBuffer::SharedArrayBuffer() : Object() {} + +inline SharedArrayBuffer::SharedArrayBuffer(napi_env env, napi_value value) + : Object(env, value) {} + +inline void SharedArrayBuffer::CheckCast(napi_env env, napi_value value) { + NAPI_CHECK(value != nullptr, "SharedArrayBuffer::CheckCast", "empty value"); + + bool result; + napi_status status = node_api_is_sharedarraybuffer(env, value, &result); + NAPI_CHECK(status == napi_ok, + "SharedArrayBuffer::CheckCast", + "node_api_is_sharedarraybuffer failed"); + NAPI_CHECK( + result, "SharedArrayBuffer::CheckCast", "value is not sharedarraybuffer"); +} + +inline SharedArrayBuffer SharedArrayBuffer::New(napi_env env, + size_t byteLength) { + napi_value value; + void* data; + napi_status status = + node_api_create_sharedarraybuffer(env, byteLength, &data, &value); + NAPI_THROW_IF_FAILED(env, status, SharedArrayBuffer()); + + return SharedArrayBuffer(env, value); +} + +inline void* SharedArrayBuffer::Data() { + void* data; + napi_status status = napi_get_arraybuffer_info(_env, _value, &data, nullptr); + NAPI_THROW_IF_FAILED(_env, status, nullptr); + return data; +} + +inline size_t SharedArrayBuffer::ByteLength() { + size_t length; + napi_status status = + napi_get_arraybuffer_info(_env, _value, nullptr, &length); + NAPI_THROW_IF_FAILED(_env, status, 0); + return length; +} +#endif // NODE_API_EXPERIMENTAL_HAS_SHAREDARRAYBUFFER + +//////////////////////////////////////////////////////////////////////////////// +// ArrayBuffer class +//////////////////////////////////////////////////////////////////////////////// + +inline ArrayBuffer ArrayBuffer::New(napi_env env, size_t byteLength) { + napi_value value; + void* data; + napi_status status = napi_create_arraybuffer(env, byteLength, &data, &value); + NAPI_THROW_IF_FAILED(env, status, ArrayBuffer()); + + return ArrayBuffer(env, value); +} + +#ifndef NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED +inline ArrayBuffer ArrayBuffer::New(napi_env env, + void* externalData, + size_t byteLength) { + napi_value value; + napi_status status = napi_create_external_arraybuffer( + env, externalData, byteLength, nullptr, nullptr, &value); + NAPI_THROW_IF_FAILED(env, status, ArrayBuffer()); + + return ArrayBuffer(env, value); +} + +template +inline ArrayBuffer ArrayBuffer::New(napi_env env, + void* externalData, + size_t byteLength, + Finalizer finalizeCallback) { + napi_value value; + details::FinalizeData* finalizeData = + new details::FinalizeData( + {std::move(finalizeCallback), nullptr}); + napi_status status = napi_create_external_arraybuffer( + env, + externalData, + byteLength, + details::FinalizeData::Wrapper, + finalizeData, + &value); + if (status != napi_ok) { + delete finalizeData; + NAPI_THROW_IF_FAILED(env, status, ArrayBuffer()); + } + + return ArrayBuffer(env, value); +} + +template +inline ArrayBuffer ArrayBuffer::New(napi_env env, + void* externalData, + size_t byteLength, + Finalizer finalizeCallback, + Hint* finalizeHint) { + napi_value value; + details::FinalizeData* finalizeData = + new details::FinalizeData( + {std::move(finalizeCallback), finalizeHint}); + napi_status status = napi_create_external_arraybuffer( + env, + externalData, + byteLength, + details::FinalizeData::WrapperWithHint, + finalizeData, + &value); + if (status != napi_ok) { + delete finalizeData; + NAPI_THROW_IF_FAILED(env, status, ArrayBuffer()); + } + + return ArrayBuffer(env, value); +} +#endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED + +inline void ArrayBuffer::CheckCast(napi_env env, napi_value value) { + NAPI_CHECK(value != nullptr, "ArrayBuffer::CheckCast", "empty value"); + + bool result; + napi_status status = napi_is_arraybuffer(env, value, &result); + NAPI_CHECK(status == napi_ok, + "ArrayBuffer::CheckCast", + "napi_is_arraybuffer failed"); + NAPI_CHECK(result, "ArrayBuffer::CheckCast", "value is not arraybuffer"); +} + +inline ArrayBuffer::ArrayBuffer() : Object() {} + +inline ArrayBuffer::ArrayBuffer(napi_env env, napi_value value) + : Object(env, value) {} + +inline void* ArrayBuffer::Data() { + void* data; + napi_status status = napi_get_arraybuffer_info(_env, _value, &data, nullptr); + NAPI_THROW_IF_FAILED(_env, status, nullptr); + return data; +} + +inline size_t ArrayBuffer::ByteLength() { + size_t length; + napi_status status = + napi_get_arraybuffer_info(_env, _value, nullptr, &length); + NAPI_THROW_IF_FAILED(_env, status, 0); + return length; +} + +#if NAPI_VERSION >= 7 +inline bool ArrayBuffer::IsDetached() const { + bool detached; + napi_status status = napi_is_detached_arraybuffer(_env, _value, &detached); + NAPI_THROW_IF_FAILED(_env, status, false); + return detached; +} + +inline void ArrayBuffer::Detach() { + napi_status status = napi_detach_arraybuffer(_env, _value); + NAPI_THROW_IF_FAILED_VOID(_env, status); +} +#endif // NAPI_VERSION >= 7 + +//////////////////////////////////////////////////////////////////////////////// +// DataView class +//////////////////////////////////////////////////////////////////////////////// +inline DataView DataView::New(napi_env env, Napi::ArrayBuffer arrayBuffer) { + return New(env, arrayBuffer, 0, arrayBuffer.ByteLength()); +} + +inline DataView DataView::New(napi_env env, + Napi::ArrayBuffer arrayBuffer, + size_t byteOffset) { + if (byteOffset > arrayBuffer.ByteLength()) { + NAPI_THROW(RangeError::New( + env, "Start offset is outside the bounds of the buffer"), + DataView()); + } + return New( + env, arrayBuffer, byteOffset, arrayBuffer.ByteLength() - byteOffset); +} + +inline DataView DataView::New(napi_env env, + Napi::ArrayBuffer arrayBuffer, + size_t byteOffset, + size_t byteLength) { + if (byteOffset + byteLength > arrayBuffer.ByteLength()) { + NAPI_THROW(RangeError::New(env, "Invalid DataView length"), DataView()); + } + napi_value value; + napi_status status = + napi_create_dataview(env, byteLength, arrayBuffer, byteOffset, &value); + NAPI_THROW_IF_FAILED(env, status, DataView()); + return DataView(env, value); +} + +inline void DataView::CheckCast(napi_env env, napi_value value) { + NAPI_CHECK(value != nullptr, "DataView::CheckCast", "empty value"); + + bool result; + napi_status status = napi_is_dataview(env, value, &result); + NAPI_CHECK( + status == napi_ok, "DataView::CheckCast", "napi_is_dataview failed"); + NAPI_CHECK(result, "DataView::CheckCast", "value is not dataview"); +} + +inline DataView::DataView() : Object() {} + +inline DataView::DataView(napi_env env, napi_value value) : Object(env, value) { + napi_status status = napi_get_dataview_info(_env, + _value /* dataView */, + &_length /* byteLength */, + &_data /* data */, + nullptr /* arrayBuffer */, + nullptr /* byteOffset */); + NAPI_THROW_IF_FAILED_VOID(_env, status); +} + +inline Napi::ArrayBuffer DataView::ArrayBuffer() const { + napi_value arrayBuffer; + napi_status status = napi_get_dataview_info(_env, + _value /* dataView */, + nullptr /* byteLength */, + nullptr /* data */, + &arrayBuffer /* arrayBuffer */, + nullptr /* byteOffset */); + NAPI_THROW_IF_FAILED(_env, status, Napi::ArrayBuffer()); + return Napi::ArrayBuffer(_env, arrayBuffer); +} + +inline size_t DataView::ByteOffset() const { + size_t byteOffset; + napi_status status = napi_get_dataview_info(_env, + _value /* dataView */, + nullptr /* byteLength */, + nullptr /* data */, + nullptr /* arrayBuffer */, + &byteOffset /* byteOffset */); + NAPI_THROW_IF_FAILED(_env, status, 0); + return byteOffset; +} + +inline size_t DataView::ByteLength() const { + return _length; +} + +inline void* DataView::Data() const { + return _data; +} + +inline float DataView::GetFloat32(size_t byteOffset) const { + return ReadData(byteOffset); +} + +inline double DataView::GetFloat64(size_t byteOffset) const { + return ReadData(byteOffset); +} + +inline int8_t DataView::GetInt8(size_t byteOffset) const { + return ReadData(byteOffset); +} + +inline int16_t DataView::GetInt16(size_t byteOffset) const { + return ReadData(byteOffset); +} + +inline int32_t DataView::GetInt32(size_t byteOffset) const { + return ReadData(byteOffset); +} + +inline uint8_t DataView::GetUint8(size_t byteOffset) const { + return ReadData(byteOffset); +} + +inline uint16_t DataView::GetUint16(size_t byteOffset) const { + return ReadData(byteOffset); +} + +inline uint32_t DataView::GetUint32(size_t byteOffset) const { + return ReadData(byteOffset); +} + +inline void DataView::SetFloat32(size_t byteOffset, float value) const { + WriteData(byteOffset, value); +} + +inline void DataView::SetFloat64(size_t byteOffset, double value) const { + WriteData(byteOffset, value); +} + +inline void DataView::SetInt8(size_t byteOffset, int8_t value) const { + WriteData(byteOffset, value); +} + +inline void DataView::SetInt16(size_t byteOffset, int16_t value) const { + WriteData(byteOffset, value); +} + +inline void DataView::SetInt32(size_t byteOffset, int32_t value) const { + WriteData(byteOffset, value); +} + +inline void DataView::SetUint8(size_t byteOffset, uint8_t value) const { + WriteData(byteOffset, value); +} + +inline void DataView::SetUint16(size_t byteOffset, uint16_t value) const { + WriteData(byteOffset, value); +} + +inline void DataView::SetUint32(size_t byteOffset, uint32_t value) const { + WriteData(byteOffset, value); +} + +template +inline T DataView::ReadData(size_t byteOffset) const { + if (byteOffset + sizeof(T) > _length || + byteOffset + sizeof(T) < byteOffset) { // overflow + NAPI_THROW( + RangeError::New(_env, "Offset is outside the bounds of the DataView"), + 0); + } + + return *reinterpret_cast(static_cast(_data) + byteOffset); +} + +template +inline void DataView::WriteData(size_t byteOffset, T value) const { + if (byteOffset + sizeof(T) > _length || + byteOffset + sizeof(T) < byteOffset) { // overflow + NAPI_THROW_VOID( + RangeError::New(_env, "Offset is outside the bounds of the DataView")); + } + + *reinterpret_cast(static_cast(_data) + byteOffset) = value; +} + +//////////////////////////////////////////////////////////////////////////////// +// TypedArray class +//////////////////////////////////////////////////////////////////////////////// +inline void TypedArray::CheckCast(napi_env env, napi_value value) { + NAPI_CHECK(value != nullptr, "TypedArray::CheckCast", "empty value"); + + bool result; + napi_status status = napi_is_typedarray(env, value, &result); + NAPI_CHECK( + status == napi_ok, "TypedArray::CheckCast", "napi_is_typedarray failed"); + NAPI_CHECK(result, "TypedArray::CheckCast", "value is not typedarray"); +} + +inline TypedArray::TypedArray() + : Object(), _type(napi_typedarray_type::napi_int8_array), _length(0) {} + +inline TypedArray::TypedArray(napi_env env, napi_value value) + : Object(env, value), + _type(napi_typedarray_type::napi_int8_array), + _length(0) { + if (value != nullptr) { + napi_status status = + napi_get_typedarray_info(_env, + _value, + &const_cast(this)->_type, + &const_cast(this)->_length, + nullptr, + nullptr, + nullptr); + NAPI_THROW_IF_FAILED_VOID(_env, status); + } +} + +inline TypedArray::TypedArray(napi_env env, + napi_value value, + napi_typedarray_type type, + size_t length) + : Object(env, value), _type(type), _length(length) {} + +inline napi_typedarray_type TypedArray::TypedArrayType() const { + return _type; +} + +inline uint8_t TypedArray::ElementSize() const { + switch (_type) { + case napi_int8_array: + case napi_uint8_array: + case napi_uint8_clamped_array: + return 1; + case napi_int16_array: + case napi_uint16_array: + return 2; + case napi_int32_array: + case napi_uint32_array: + case napi_float32_array: + return 4; + case napi_float64_array: +#if (NAPI_VERSION > 5) + case napi_bigint64_array: + case napi_biguint64_array: +#endif // (NAPI_VERSION > 5) + return 8; + default: + return 0; + } +} + +inline size_t TypedArray::ElementLength() const { + return _length; +} + +inline size_t TypedArray::ByteOffset() const { + size_t byteOffset; + napi_status status = napi_get_typedarray_info( + _env, _value, nullptr, nullptr, nullptr, nullptr, &byteOffset); + NAPI_THROW_IF_FAILED(_env, status, 0); + return byteOffset; +} + +inline size_t TypedArray::ByteLength() const { + return ElementSize() * ElementLength(); +} + +inline Napi::ArrayBuffer TypedArray::ArrayBuffer() const { + napi_value arrayBuffer; + napi_status status = napi_get_typedarray_info( + _env, _value, nullptr, nullptr, nullptr, &arrayBuffer, nullptr); + NAPI_THROW_IF_FAILED(_env, status, Napi::ArrayBuffer()); + return Napi::ArrayBuffer(_env, arrayBuffer); +} + +//////////////////////////////////////////////////////////////////////////////// +// TypedArrayOf class +//////////////////////////////////////////////////////////////////////////////// +template +inline void TypedArrayOf::CheckCast(napi_env env, napi_value value) { + TypedArray::CheckCast(env, value); + napi_typedarray_type type; + napi_status status = napi_get_typedarray_info( + env, value, &type, nullptr, nullptr, nullptr, nullptr); + NAPI_CHECK(status == napi_ok, + "TypedArrayOf::CheckCast", + "napi_is_typedarray failed"); + + NAPI_INTERNAL_CHECK( + (type == TypedArrayTypeForPrimitiveType() || + (type == napi_uint8_clamped_array && std::is_same::value)), + "TypedArrayOf::CheckCast", + "Array type must match the template parameter, (Uint8 arrays may " + "optionally have the \"clamped\" array type.), got %d.", + type); +} + +template +inline TypedArrayOf TypedArrayOf::New(napi_env env, + size_t elementLength, + napi_typedarray_type type) { + Napi::ArrayBuffer arrayBuffer = + Napi::ArrayBuffer::New(env, elementLength * sizeof(T)); + return New(env, elementLength, arrayBuffer, 0, type); +} + +template +inline TypedArrayOf TypedArrayOf::New(napi_env env, + size_t elementLength, + Napi::ArrayBuffer arrayBuffer, + size_t bufferOffset, + napi_typedarray_type type) { + napi_value value; + napi_status status = napi_create_typedarray( + env, type, elementLength, arrayBuffer, bufferOffset, &value); + NAPI_THROW_IF_FAILED(env, status, TypedArrayOf()); + + return TypedArrayOf( + env, + value, + type, + elementLength, + reinterpret_cast(reinterpret_cast(arrayBuffer.Data()) + + bufferOffset)); +} + +template +inline TypedArrayOf::TypedArrayOf() : TypedArray(), _data(nullptr) {} + +template +inline TypedArrayOf::TypedArrayOf(napi_env env, napi_value value) + : TypedArray(env, value), _data(nullptr) { + napi_status status = napi_ok; + if (value != nullptr) { + void* data = nullptr; + status = napi_get_typedarray_info( + _env, _value, &_type, &_length, &data, nullptr, nullptr); + _data = static_cast(data); + } else { + _type = TypedArrayTypeForPrimitiveType(); + _length = 0; + } + NAPI_THROW_IF_FAILED_VOID(_env, status); +} + +template +inline TypedArrayOf::TypedArrayOf(napi_env env, + napi_value value, + napi_typedarray_type type, + size_t length, + T* data) + : TypedArray(env, value, type, length), _data(data) { + if (!(type == TypedArrayTypeForPrimitiveType() || + (type == napi_uint8_clamped_array && + std::is_same::value))) { + NAPI_THROW_VOID(TypeError::New( + env, + "Array type must match the template parameter. " + "(Uint8 arrays may optionally have the \"clamped\" array type.)")); + } +} + +template +inline T& TypedArrayOf::operator[](size_t index) { + return _data[index]; +} + +template +inline const T& TypedArrayOf::operator[](size_t index) const { + return _data[index]; +} + +template +inline T* TypedArrayOf::Data() { + return _data; +} + +template +inline const T* TypedArrayOf::Data() const { + return _data; +} + +//////////////////////////////////////////////////////////////////////////////// +// Function class +//////////////////////////////////////////////////////////////////////////////// + +template +inline napi_status CreateFunction(napi_env env, + const char* utf8name, + napi_callback cb, + CbData* data, + napi_value* result) { + napi_status status = + napi_create_function(env, utf8name, NAPI_AUTO_LENGTH, cb, data, result); + if (status == napi_ok) { + status = Napi::details::AttachData(env, *result, data); + } + + return status; +} + +template +inline Function Function::New(napi_env env, const char* utf8name, void* data) { + napi_value result = nullptr; + napi_status status = napi_create_function(env, + utf8name, + NAPI_AUTO_LENGTH, + details::TemplatedVoidCallback, + data, + &result); + NAPI_THROW_IF_FAILED(env, status, Function()); + return Function(env, result); +} + +template +inline Function Function::New(napi_env env, const char* utf8name, void* data) { + napi_value result = nullptr; + napi_status status = napi_create_function(env, + utf8name, + NAPI_AUTO_LENGTH, + details::TemplatedCallback, + data, + &result); + NAPI_THROW_IF_FAILED(env, status, Function()); + return Function(env, result); +} + +template +inline Function Function::New(napi_env env, + const std::string& utf8name, + void* data) { + return Function::New(env, utf8name.c_str(), data); +} + +template +inline Function Function::New(napi_env env, + const std::string& utf8name, + void* data) { + return Function::New(env, utf8name.c_str(), data); +} + +template +inline Function Function::New(napi_env env, + Callable cb, + const char* utf8name, + void* data) { + using ReturnType = decltype(cb(CallbackInfo(nullptr, nullptr))); + using CbData = details::CallbackData; + auto callbackData = new CbData{std::move(cb), data}; + + napi_value value; + napi_status status = + CreateFunction(env, utf8name, CbData::Wrapper, callbackData, &value); + if (status != napi_ok) { + delete callbackData; + NAPI_THROW_IF_FAILED(env, status, Function()); + } + + return Function(env, value); +} + +template +inline Function Function::New(napi_env env, + Callable cb, + const std::string& utf8name, + void* data) { + return New(env, cb, utf8name.c_str(), data); +} + +inline void Function::CheckCast(napi_env env, napi_value value) { + NAPI_CHECK(value != nullptr, "Function::CheckCast", "empty value"); + + napi_valuetype type; + napi_status status = napi_typeof(env, value, &type); + NAPI_CHECK(status == napi_ok, "Function::CheckCast", "napi_typeof failed"); + NAPI_INTERNAL_CHECK_EQ(type, napi_function, "%d", "Function::CheckCast"); +} + +inline Function::Function() : Object() {} + +inline Function::Function(napi_env env, napi_value value) + : Object(env, value) {} + +inline MaybeOrValue Function::operator()( + const std::initializer_list& args) const { + return Call(Env().Undefined(), args); +} + +inline MaybeOrValue Function::Call( + const std::initializer_list& args) const { + return Call(Env().Undefined(), args); +} + +inline MaybeOrValue Function::Call( + const std::vector& args) const { + return Call(Env().Undefined(), args); +} + +inline MaybeOrValue Function::Call( + const std::vector& args) const { + return Call(Env().Undefined(), args); +} + +inline MaybeOrValue Function::Call(size_t argc, + const napi_value* args) const { + return Call(Env().Undefined(), argc, args); +} + +inline MaybeOrValue Function::Call( + napi_value recv, const std::initializer_list& args) const { + return Call(recv, args.size(), args.begin()); +} + +inline MaybeOrValue Function::Call( + napi_value recv, const std::vector& args) const { + return Call(recv, args.size(), args.data()); +} + +inline MaybeOrValue Function::Call( + napi_value recv, const std::vector& args) const { + const size_t argc = args.size(); + const size_t stackArgsCount = 6; + napi_value stackArgs[stackArgsCount]; + std::vector heapArgs; + napi_value* argv; + if (argc <= stackArgsCount) { + argv = stackArgs; + } else { + heapArgs.resize(argc); + argv = heapArgs.data(); + } + + for (size_t index = 0; index < argc; index++) { + argv[index] = static_cast(args[index]); + } + + return Call(recv, argc, argv); +} + +inline MaybeOrValue Function::Call(napi_value recv, + size_t argc, + const napi_value* args) const { + napi_value result; + napi_status status = + napi_call_function(_env, recv, _value, argc, args, &result); + NAPI_RETURN_OR_THROW_IF_FAILED( + _env, status, Napi::Value(_env, result), Napi::Value); +} + +inline MaybeOrValue Function::MakeCallback( + napi_value recv, + const std::initializer_list& args, + napi_async_context context) const { + return MakeCallback(recv, args.size(), args.begin(), context); +} + +inline MaybeOrValue Function::MakeCallback( + napi_value recv, + const std::vector& args, + napi_async_context context) const { + return MakeCallback(recv, args.size(), args.data(), context); +} + +inline MaybeOrValue Function::MakeCallback( + napi_value recv, + size_t argc, + const napi_value* args, + napi_async_context context) const { + napi_value result; + napi_status status = + napi_make_callback(_env, context, recv, _value, argc, args, &result); + NAPI_RETURN_OR_THROW_IF_FAILED( + _env, status, Napi::Value(_env, result), Napi::Value); +} + +inline MaybeOrValue Function::New( + const std::initializer_list& args) const { + return New(args.size(), args.begin()); +} + +inline MaybeOrValue Function::New( + const std::vector& args) const { + return New(args.size(), args.data()); +} + +inline MaybeOrValue Function::New(size_t argc, + const napi_value* args) const { + napi_value result; + napi_status status = napi_new_instance(_env, _value, argc, args, &result); + NAPI_RETURN_OR_THROW_IF_FAILED( + _env, status, Napi::Object(_env, result), Napi::Object); +} + +//////////////////////////////////////////////////////////////////////////////// +// Promise class +//////////////////////////////////////////////////////////////////////////////// + +inline Promise::Deferred Promise::Deferred::New(napi_env env) { + return Promise::Deferred(env); +} + +inline Promise::Deferred::Deferred(napi_env env) : _env(env) { + napi_status status = napi_create_promise(_env, &_deferred, &_promise); + NAPI_THROW_IF_FAILED_VOID(_env, status); +} + +inline Promise Promise::Deferred::Promise() const { + return Napi::Promise(_env, _promise); +} + +inline Napi::Env Promise::Deferred::Env() const { + return Napi::Env(_env); +} + +inline void Promise::Deferred::Resolve(napi_value value) const { + napi_status status = napi_resolve_deferred(_env, _deferred, value); + NAPI_THROW_IF_FAILED_VOID(_env, status); +} + +inline void Promise::Deferred::Reject(napi_value value) const { + napi_status status = napi_reject_deferred(_env, _deferred, value); + NAPI_THROW_IF_FAILED_VOID(_env, status); +} + +inline void Promise::CheckCast(napi_env env, napi_value value) { + NAPI_CHECK(value != nullptr, "Promise::CheckCast", "empty value"); + + bool result; + napi_status status = napi_is_promise(env, value, &result); + NAPI_CHECK(status == napi_ok, "Promise::CheckCast", "napi_is_promise failed"); + NAPI_CHECK(result, "Promise::CheckCast", "value is not promise"); +} + +inline Promise::Promise() : Object() {} + +inline Promise::Promise(napi_env env, napi_value value) : Object(env, value) {} + +inline MaybeOrValue Promise::Then(napi_value onFulfilled) const { + EscapableHandleScope scope(_env); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + Value thenMethod; + if (!Get("then").UnwrapTo(&thenMethod)) { + return Nothing(); + } + MaybeOrValue result = + thenMethod.As().Call(*this, {onFulfilled}); + if (result.IsJust()) { + return Just(scope.Escape(result.Unwrap()).As()); + } + return Nothing(); +#else + Function thenMethod = Get("then").As(); + MaybeOrValue result = thenMethod.Call(*this, {onFulfilled}); + if (scope.Env().IsExceptionPending()) { + return Promise(); + } + return scope.Escape(result).As(); +#endif +} + +inline MaybeOrValue Promise::Then(napi_value onFulfilled, + napi_value onRejected) const { + EscapableHandleScope scope(_env); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + Value thenMethod; + if (!Get("then").UnwrapTo(&thenMethod)) { + return Nothing(); + } + MaybeOrValue result = + thenMethod.As().Call(*this, {onFulfilled, onRejected}); + if (result.IsJust()) { + return Just(scope.Escape(result.Unwrap()).As()); + } + return Nothing(); +#else + Function thenMethod = Get("then").As(); + MaybeOrValue result = + thenMethod.Call(*this, {onFulfilled, onRejected}); + if (scope.Env().IsExceptionPending()) { + return Promise(); + } + return scope.Escape(result).As(); +#endif +} + +inline MaybeOrValue Promise::Catch(napi_value onRejected) const { + EscapableHandleScope scope(_env); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + Value catchMethod; + if (!Get("catch").UnwrapTo(&catchMethod)) { + return Nothing(); + } + MaybeOrValue result = + catchMethod.As().Call(*this, {onRejected}); + if (result.IsJust()) { + return Just(scope.Escape(result.Unwrap()).As()); + } + return Nothing(); +#else + Function catchMethod = Get("catch").As(); + MaybeOrValue result = catchMethod.Call(*this, {onRejected}); + if (scope.Env().IsExceptionPending()) { + return Promise(); + } + return scope.Escape(result).As(); +#endif +} + +inline MaybeOrValue Promise::Then(const Function& onFulfilled) const { + return Then(static_cast(onFulfilled)); +} + +inline MaybeOrValue Promise::Then(const Function& onFulfilled, + const Function& onRejected) const { + return Then(static_cast(onFulfilled), + static_cast(onRejected)); +} + +inline MaybeOrValue Promise::Catch(const Function& onRejected) const { + return Catch(static_cast(onRejected)); +} + +//////////////////////////////////////////////////////////////////////////////// +// Buffer class +//////////////////////////////////////////////////////////////////////////////// + +template +inline Buffer Buffer::New(napi_env env, size_t length) { + napi_value value; + void* data; + napi_status status = + napi_create_buffer(env, length * sizeof(T), &data, &value); + NAPI_THROW_IF_FAILED(env, status, Buffer()); + return Buffer(env, value); +} + +#ifndef NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED +template +inline Buffer Buffer::New(napi_env env, T* data, size_t length) { + napi_value value; + napi_status status = napi_create_external_buffer( + env, length * sizeof(T), data, nullptr, nullptr, &value); + NAPI_THROW_IF_FAILED(env, status, Buffer()); + return Buffer(env, value); +} + +template +template +inline Buffer Buffer::New(napi_env env, + T* data, + size_t length, + Finalizer finalizeCallback) { + napi_value value; + details::FinalizeData* finalizeData = + new details::FinalizeData( + {std::move(finalizeCallback), nullptr}); + napi_status status = + napi_create_external_buffer(env, + length * sizeof(T), + data, + details::FinalizeData::Wrapper, + finalizeData, + &value); + if (status != napi_ok) { + delete finalizeData; + NAPI_THROW_IF_FAILED(env, status, Buffer()); + } + return Buffer(env, value); +} + +template +template +inline Buffer Buffer::New(napi_env env, + T* data, + size_t length, + Finalizer finalizeCallback, + Hint* finalizeHint) { + napi_value value; + details::FinalizeData* finalizeData = + new details::FinalizeData( + {std::move(finalizeCallback), finalizeHint}); + napi_status status = napi_create_external_buffer( + env, + length * sizeof(T), + data, + details::FinalizeData::WrapperWithHint, + finalizeData, + &value); + if (status != napi_ok) { + delete finalizeData; + NAPI_THROW_IF_FAILED(env, status, Buffer()); + } + return Buffer(env, value); +} +#endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED + +template +inline Buffer Buffer::NewOrCopy(napi_env env, T* data, size_t length) { +#ifndef NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED + napi_value value; + napi_status status = napi_create_external_buffer( + env, length * sizeof(T), data, nullptr, nullptr, &value); + if (status == details::napi_no_external_buffers_allowed) { +#endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED + // If we can't create an external buffer, we'll just copy the data. + return Buffer::Copy(env, data, length); +#ifndef NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED + } + NAPI_THROW_IF_FAILED(env, status, Buffer()); + return Buffer(env, value); +#endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED +} + +template +template +inline Buffer Buffer::NewOrCopy(napi_env env, + T* data, + size_t length, + Finalizer finalizeCallback) { + details::FinalizeData* finalizeData = + new details::FinalizeData( + {std::move(finalizeCallback), nullptr}); +#ifndef NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED + napi_value value; + napi_status status = + napi_create_external_buffer(env, + length * sizeof(T), + data, + details::FinalizeData::Wrapper, + finalizeData, + &value); + if (status == details::napi_no_external_buffers_allowed) { +#endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED + // If we can't create an external buffer, we'll just copy the data. + Buffer ret = Buffer::Copy(env, data, length); + details::FinalizeData::WrapperGC(env, data, finalizeData); + return ret; +#ifndef NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED + } + if (status != napi_ok) { + delete finalizeData; + NAPI_THROW_IF_FAILED(env, status, Buffer()); + } + return Buffer(env, value); +#endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED +} + +template +template +inline Buffer Buffer::NewOrCopy(napi_env env, + T* data, + size_t length, + Finalizer finalizeCallback, + Hint* finalizeHint) { + details::FinalizeData* finalizeData = + new details::FinalizeData( + {std::move(finalizeCallback), finalizeHint}); +#ifndef NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED + napi_value value; + napi_status status = napi_create_external_buffer( + env, + length * sizeof(T), + data, + details::FinalizeData::WrapperWithHint, + finalizeData, + &value); + if (status == details::napi_no_external_buffers_allowed) { +#endif + // If we can't create an external buffer, we'll just copy the data. + Buffer ret = Buffer::Copy(env, data, length); + details::FinalizeData::WrapperGCWithHint( + env, data, finalizeData); + return ret; +#ifndef NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED + } + if (status != napi_ok) { + delete finalizeData; + NAPI_THROW_IF_FAILED(env, status, Buffer()); + } + return Buffer(env, value); +#endif +} + +template +inline Buffer Buffer::Copy(napi_env env, const T* data, size_t length) { + napi_value value; + napi_status status = + napi_create_buffer_copy(env, length * sizeof(T), data, nullptr, &value); + NAPI_THROW_IF_FAILED(env, status, Buffer()); + return Buffer(env, value); +} + +template +inline void Buffer::CheckCast(napi_env env, napi_value value) { + NAPI_CHECK(value != nullptr, "Buffer::CheckCast", "empty value"); + + bool result; + napi_status status = napi_is_buffer(env, value, &result); + NAPI_CHECK(status == napi_ok, "Buffer::CheckCast", "napi_is_buffer failed"); + NAPI_CHECK(result, "Buffer::CheckCast", "value is not buffer"); +} + +template +inline Buffer::Buffer() : Uint8Array() {} + +template +inline Buffer::Buffer(napi_env env, napi_value value) + : Uint8Array(env, value) {} + +template +inline size_t Buffer::Length() const { + return ByteLength() / sizeof(T); +} + +template +inline T* Buffer::Data() const { + return reinterpret_cast(const_cast(Uint8Array::Data())); +} + +//////////////////////////////////////////////////////////////////////////////// +// Error class +//////////////////////////////////////////////////////////////////////////////// + +inline Error Error::New(napi_env env) { + napi_status status; + napi_value error = nullptr; + bool is_exception_pending; + napi_extended_error_info last_error_info_copy; + + { + // We must retrieve the last error info before doing anything else because + // doing anything else will replace the last error info. + const napi_extended_error_info* last_error_info; + status = napi_get_last_error_info(env, &last_error_info); + NAPI_FATAL_IF_FAILED(status, "Error::New", "napi_get_last_error_info"); + + // All fields of the `napi_extended_error_info` structure gets reset in + // subsequent Node-API function calls on the same `env`. This includes a + // call to `napi_is_exception_pending()`. So here it is necessary to make a + // copy of the information as the `error_code` field is used later on. + memcpy(&last_error_info_copy, + last_error_info, + sizeof(napi_extended_error_info)); + } + + status = napi_is_exception_pending(env, &is_exception_pending); + NAPI_FATAL_IF_FAILED(status, "Error::New", "napi_is_exception_pending"); + + // A pending exception takes precedence over any internal error status. + if (is_exception_pending) { + status = napi_get_and_clear_last_exception(env, &error); + NAPI_FATAL_IF_FAILED( + status, "Error::New", "napi_get_and_clear_last_exception"); + } else { + const char* error_message = last_error_info_copy.error_message != nullptr + ? last_error_info_copy.error_message + : "Error in native callback"; + + napi_value message; + status = napi_create_string_utf8( + env, error_message, std::strlen(error_message), &message); + NAPI_FATAL_IF_FAILED(status, "Error::New", "napi_create_string_utf8"); + + switch (last_error_info_copy.error_code) { + case napi_object_expected: + case napi_string_expected: + case napi_boolean_expected: + case napi_number_expected: + status = napi_create_type_error(env, nullptr, message, &error); + break; + default: + status = napi_create_error(env, nullptr, message, &error); + break; + } + NAPI_FATAL_IF_FAILED(status, "Error::New", "napi_create_error"); + } + + return Error(env, error); +} + +inline Error Error::New(napi_env env, const char* message) { + return Error::New( + env, message, std::strlen(message), napi_create_error); +} + +inline Error Error::New(napi_env env, const std::string& message) { + return Error::New( + env, message.c_str(), message.size(), napi_create_error); +} + +inline NAPI_NO_RETURN void Error::Fatal(const char* location, + const char* message) { + napi_fatal_error(location, NAPI_AUTO_LENGTH, message, NAPI_AUTO_LENGTH); +} + +inline Error::Error() : ObjectReference() {} + +inline Error::Error(napi_env env, napi_value value) + : ObjectReference(env, nullptr) { + if (value != nullptr) { + // Attempting to create a reference on the error object. + // If it's not a Object/Function/Symbol, this call will return an error + // status. + napi_status status = napi_create_reference(env, value, 1, &_ref); + + if (status != napi_ok) { + napi_value wrappedErrorObj; + + // Create an error object + status = napi_create_object(env, &wrappedErrorObj); + NAPI_FATAL_IF_FAILED(status, "Error::Error", "napi_create_object"); + + // property flag that we attach to show the error object is wrapped + napi_property_descriptor wrapObjFlag = { + ERROR_WRAP_VALUE(), // Unique GUID identifier since Symbol isn't a + // viable option + nullptr, + nullptr, + nullptr, + nullptr, + Value::From(env, value), + napi_enumerable, + nullptr}; + + status = napi_define_properties(env, wrappedErrorObj, 1, &wrapObjFlag); +#ifdef NODE_API_SWALLOW_UNTHROWABLE_EXCEPTIONS + if (status == napi_pending_exception) { + // Test if the pending exception was reported because the environment is + // shutting down. We assume that a status of napi_pending_exception + // coupled with the absence of an actual pending exception means that + // the environment is shutting down. If so, we replace the + // napi_pending_exception status with napi_ok. + bool is_exception_pending = false; + status = napi_is_exception_pending(env, &is_exception_pending); + if (status == napi_ok && !is_exception_pending) { + status = napi_ok; + } else { + status = napi_pending_exception; + } + } +#endif // NODE_API_SWALLOW_UNTHROWABLE_EXCEPTIONS + NAPI_FATAL_IF_FAILED(status, "Error::Error", "napi_define_properties"); + + // Create a reference on the newly wrapped object + status = napi_create_reference(env, wrappedErrorObj, 1, &_ref); + } + + // Avoid infinite recursion in the failure case. + NAPI_FATAL_IF_FAILED(status, "Error::Error", "napi_create_reference"); + } +} + +inline Object Error::Value() const { + if (_ref == nullptr) { + return Object(_env, nullptr); + } + + napi_value refValue; + napi_status status = napi_get_reference_value(_env, _ref, &refValue); + NAPI_THROW_IF_FAILED(_env, status, Object()); + + napi_valuetype type; + status = napi_typeof(_env, refValue, &type); + NAPI_THROW_IF_FAILED(_env, status, Object()); + + // If refValue isn't a symbol, then we proceed to whether the refValue has the + // wrapped error flag + if (type != napi_symbol) { + // We are checking if the object is wrapped + bool isWrappedObject = false; + + status = napi_has_property(_env, + refValue, + String::From(_env, ERROR_WRAP_VALUE()), + &isWrappedObject); + + // Don't care about status + if (isWrappedObject) { + napi_value unwrappedValue; + status = napi_get_property(_env, + refValue, + String::From(_env, ERROR_WRAP_VALUE()), + &unwrappedValue); + NAPI_THROW_IF_FAILED(_env, status, Object()); + + return Object(_env, unwrappedValue); + } + } + + return Object(_env, refValue); +} + +inline Error::Error(Error&& other) : ObjectReference(std::move(other)) {} + +inline Error& Error::operator=(Error&& other) { + static_cast*>(this)->operator=(std::move(other)); + return *this; +} + +inline Error::Error(const Error& other) : ObjectReference(other) {} + +inline Error& Error::operator=(const Error& other) { + Reset(); + + _env = other.Env(); + HandleScope scope(_env); + + napi_value value = other.Value(); + if (value != nullptr) { + napi_status status = napi_create_reference(_env, value, 1, &_ref); + NAPI_THROW_IF_FAILED(_env, status, *this); + } + + return *this; +} + +inline const std::string& Error::Message() const NAPI_NOEXCEPT { + if (_message.size() == 0 && _env != nullptr) { +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS + try { + _message = Get("message").As(); + } catch (...) { + // Catch all errors here, to include e.g. a std::bad_alloc from + // the std::string::operator=, because this method may not throw. + } +#else // NODE_ADDON_API_CPP_EXCEPTIONS +#if defined(NODE_ADDON_API_ENABLE_MAYBE) + Napi::Value message_val; + if (Get("message").UnwrapTo(&message_val)) { + _message = message_val.As(); + } +#else + _message = Get("message").As(); +#endif +#endif // NODE_ADDON_API_CPP_EXCEPTIONS + } + return _message; +} + +// we created an object on the &_ref +inline void Error::ThrowAsJavaScriptException() const { + HandleScope scope(_env); + if (!IsEmpty()) { +#ifdef NODE_API_SWALLOW_UNTHROWABLE_EXCEPTIONS + bool pendingException = false; + + // check if there is already a pending exception. If so don't try to throw a + // new one as that is not allowed/possible + napi_status status = napi_is_exception_pending(_env, &pendingException); + + if ((status != napi_ok) || + ((status == napi_ok) && (pendingException == false))) { + // We intentionally don't use `NAPI_THROW_*` macros here to ensure + // that there is no possible recursion as `ThrowAsJavaScriptException` + // is part of `NAPI_THROW_*` macro definition for noexcept. + + status = napi_throw(_env, Value()); + +#if (NAPI_VERSION >= 10) + napi_status expected_failure_mode = napi_cannot_run_js; +#else + napi_status expected_failure_mode = napi_pending_exception; +#endif + if (status == expected_failure_mode) { + // The environment must be terminating as we checked earlier and there + // was no pending exception. In this case continuing will result + // in a fatal error and there is nothing the author has done incorrectly + // in their code that is worth flagging through a fatal error + return; + } + } else { + status = napi_pending_exception; + } +#else + // We intentionally don't use `NAPI_THROW_*` macros here to ensure + // that there is no possible recursion as `ThrowAsJavaScriptException` + // is part of `NAPI_THROW_*` macro definition for noexcept. + + napi_status status = napi_throw(_env, Value()); +#endif + +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS + if (status != napi_ok) { + throw Error::New(_env); + } +#else // NODE_ADDON_API_CPP_EXCEPTIONS + NAPI_FATAL_IF_FAILED( + status, "Error::ThrowAsJavaScriptException", "napi_throw"); +#endif // NODE_ADDON_API_CPP_EXCEPTIONS + } +} + +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS + +inline const char* Error::what() const NAPI_NOEXCEPT { + return Message().c_str(); +} + +#endif // NODE_ADDON_API_CPP_EXCEPTIONS + +inline const char* Error::ERROR_WRAP_VALUE() NAPI_NOEXCEPT { + return "4bda9e7e-4913-4dbc-95de-891cbf66598e-errorVal"; +} + +template +inline TError Error::New(napi_env env, + const char* message, + size_t length, + create_error_fn create_error) { + napi_value str; + napi_status status = napi_create_string_utf8(env, message, length, &str); + NAPI_THROW_IF_FAILED(env, status, TError()); + + napi_value error; + status = create_error(env, nullptr, str, &error); + NAPI_THROW_IF_FAILED(env, status, TError()); + + return TError(env, error); +} + +inline TypeError TypeError::New(napi_env env, const char* message) { + return Error::New( + env, message, std::strlen(message), napi_create_type_error); +} + +inline TypeError TypeError::New(napi_env env, const std::string& message) { + return Error::New( + env, message.c_str(), message.size(), napi_create_type_error); +} + +inline TypeError::TypeError() : Error() {} + +inline TypeError::TypeError(napi_env env, napi_value value) + : Error(env, value) {} + +inline RangeError RangeError::New(napi_env env, const char* message) { + return Error::New( + env, message, std::strlen(message), napi_create_range_error); +} + +inline RangeError RangeError::New(napi_env env, const std::string& message) { + return Error::New( + env, message.c_str(), message.size(), napi_create_range_error); +} + +inline RangeError::RangeError() : Error() {} + +inline RangeError::RangeError(napi_env env, napi_value value) + : Error(env, value) {} + +#if NAPI_VERSION > 8 +inline SyntaxError SyntaxError::New(napi_env env, const char* message) { + return Error::New( + env, message, std::strlen(message), node_api_create_syntax_error); +} + +inline SyntaxError SyntaxError::New(napi_env env, const std::string& message) { + return Error::New( + env, message.c_str(), message.size(), node_api_create_syntax_error); +} + +inline SyntaxError::SyntaxError() : Error() {} + +inline SyntaxError::SyntaxError(napi_env env, napi_value value) + : Error(env, value) {} +#endif // NAPI_VERSION > 8 + +//////////////////////////////////////////////////////////////////////////////// +// Reference class +//////////////////////////////////////////////////////////////////////////////// + +template +inline Reference Reference::New(const T& value, + uint32_t initialRefcount) { + napi_env env = value.Env(); + napi_value val = value; + + if (val == nullptr) { + return Reference(env, nullptr); + } + + napi_ref ref; + napi_status status = napi_create_reference(env, value, initialRefcount, &ref); + NAPI_THROW_IF_FAILED(env, status, Reference()); + + return Reference(env, ref); +} + +template +inline Reference::Reference() + : _env(nullptr), _ref(nullptr), _suppressDestruct(false) {} + +template +inline Reference::Reference(napi_env env, napi_ref ref) + : _env(env), _ref(ref), _suppressDestruct(false) {} + +template +inline Reference::~Reference() { + if (_ref != nullptr) { + if (!_suppressDestruct) { + // TODO(legendecas): napi_delete_reference should be invoked immediately. + // Fix this when https://github.com/nodejs/node/pull/55620 lands. +#ifdef NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER + Env().PostFinalizer( + [](Napi::Env env, napi_ref ref) { napi_delete_reference(env, ref); }, + _ref); +#else + napi_delete_reference(_env, _ref); +#endif + } + + _ref = nullptr; + } +} + +template +inline Reference::Reference(Reference&& other) + : _env(other._env), + _ref(other._ref), + _suppressDestruct(other._suppressDestruct) { + other._env = nullptr; + other._ref = nullptr; + other._suppressDestruct = false; +} + +template +inline Reference& Reference::operator=(Reference&& other) { + Reset(); + _env = other._env; + _ref = other._ref; + _suppressDestruct = other._suppressDestruct; + other._env = nullptr; + other._ref = nullptr; + other._suppressDestruct = false; + return *this; +} + +template +inline Reference::Reference(const Reference& other) + : _env(other._env), _ref(nullptr), _suppressDestruct(false) { + HandleScope scope(_env); + + napi_value value = other.Value(); + if (value != nullptr) { + // Copying is a limited scenario (currently only used for Error object) and + // always creates a strong reference to the given value even if the incoming + // reference is weak. + napi_status status = napi_create_reference(_env, value, 1, &_ref); + NAPI_FATAL_IF_FAILED( + status, "Reference::Reference", "napi_create_reference"); + } +} + +template +inline Reference::operator napi_ref() const { + return _ref; +} + +template +inline bool Reference::operator==(const Reference& other) const { + HandleScope scope(_env); + return this->Value().StrictEquals(other.Value()); +} + +template +inline bool Reference::operator!=(const Reference& other) const { + return !this->operator==(other); +} + +template +inline Napi::Env Reference::Env() const { + return Napi::Env(_env); +} + +template +inline bool Reference::IsEmpty() const { + return _ref == nullptr; +} + +template +inline T Reference::Value() const { + if (_ref == nullptr) { + return T(_env, nullptr); + } + + napi_value value; + napi_status status = napi_get_reference_value(_env, _ref, &value); + NAPI_THROW_IF_FAILED(_env, status, T()); + return T(_env, value); +} + +template +inline uint32_t Reference::Ref() const { + uint32_t result; + napi_status status = napi_reference_ref(_env, _ref, &result); + NAPI_THROW_IF_FAILED(_env, status, 0); + return result; +} + +template +inline uint32_t Reference::Unref() const { + uint32_t result; + napi_status status = napi_reference_unref(_env, _ref, &result); + NAPI_THROW_IF_FAILED(_env, status, 0); + return result; +} + +template +inline void Reference::Reset() { + if (_ref != nullptr) { + napi_status status = napi_delete_reference(_env, _ref); + NAPI_THROW_IF_FAILED_VOID(_env, status); + _ref = nullptr; + } +} + +template +inline void Reference::Reset(const T& value, uint32_t refcount) { + Reset(); + _env = value.Env(); + + napi_value val = value; + if (val != nullptr) { + napi_status status = napi_create_reference(_env, value, refcount, &_ref); + NAPI_THROW_IF_FAILED_VOID(_env, status); + } +} + +template +inline void Reference::SuppressDestruct() { + _suppressDestruct = true; +} + +template +inline Reference Weak(T value) { + return Reference::New(value, 0); +} + +inline ObjectReference Weak(Object value) { + return Reference::New(value, 0); +} + +inline FunctionReference Weak(Function value) { + return Reference::New(value, 0); +} + +template +inline Reference Persistent(T value) { + return Reference::New(value, 1); +} + +inline ObjectReference Persistent(Object value) { + return Reference::New(value, 1); +} + +inline FunctionReference Persistent(Function value) { + return Reference::New(value, 1); +} + +//////////////////////////////////////////////////////////////////////////////// +// ObjectReference class +//////////////////////////////////////////////////////////////////////////////// + +inline ObjectReference::ObjectReference() : Reference() {} + +inline ObjectReference::ObjectReference(napi_env env, napi_ref ref) + : Reference(env, ref) {} + +inline ObjectReference::ObjectReference(Reference&& other) + : Reference(std::move(other)) {} + +inline ObjectReference& ObjectReference::operator=(Reference&& other) { + static_cast*>(this)->operator=(std::move(other)); + return *this; +} + +inline ObjectReference::ObjectReference(ObjectReference&& other) + : Reference(std::move(other)) {} + +inline ObjectReference& ObjectReference::operator=(ObjectReference&& other) { + static_cast*>(this)->operator=(std::move(other)); + return *this; +} + +inline ObjectReference::ObjectReference(const ObjectReference& other) + : Reference(other) {} + +inline MaybeOrValue ObjectReference::Get( + const char* utf8name) const { + EscapableHandleScope scope(_env); + MaybeOrValue result = Value().Get(utf8name); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + if (result.IsJust()) { + return Just(scope.Escape(result.Unwrap())); + } + return result; +#else + if (scope.Env().IsExceptionPending()) { + return Value(); + } + return scope.Escape(result); +#endif +} + +inline MaybeOrValue ObjectReference::Get( + const std::string& utf8name) const { + EscapableHandleScope scope(_env); + MaybeOrValue result = Value().Get(utf8name); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + if (result.IsJust()) { + return Just(scope.Escape(result.Unwrap())); + } + return result; +#else + if (scope.Env().IsExceptionPending()) { + return Value(); + } + return scope.Escape(result); +#endif +} + +inline MaybeOrValue ObjectReference::Set(const char* utf8name, + napi_value value) const { + HandleScope scope(_env); + return Value().Set(utf8name, value); +} + +inline MaybeOrValue ObjectReference::Set(const char* utf8name, + Napi::Value value) const { + HandleScope scope(_env); + return Value().Set(utf8name, value); +} + +inline MaybeOrValue ObjectReference::Set(const char* utf8name, + const char* utf8value) const { + HandleScope scope(_env); + return Value().Set(utf8name, utf8value); +} + +inline MaybeOrValue ObjectReference::Set(const char* utf8name, + bool boolValue) const { + HandleScope scope(_env); + return Value().Set(utf8name, boolValue); +} + +inline MaybeOrValue ObjectReference::Set(const char* utf8name, + double numberValue) const { + HandleScope scope(_env); + return Value().Set(utf8name, numberValue); +} + +inline MaybeOrValue ObjectReference::Set(const std::string& utf8name, + napi_value value) const { + HandleScope scope(_env); + return Value().Set(utf8name, value); +} + +inline MaybeOrValue ObjectReference::Set(const std::string& utf8name, + Napi::Value value) const { + HandleScope scope(_env); + return Value().Set(utf8name, value); +} + +inline MaybeOrValue ObjectReference::Set(const std::string& utf8name, + std::string& utf8value) const { + HandleScope scope(_env); + return Value().Set(utf8name, utf8value); +} + +inline MaybeOrValue ObjectReference::Set(const std::string& utf8name, + bool boolValue) const { + HandleScope scope(_env); + return Value().Set(utf8name, boolValue); +} + +inline MaybeOrValue ObjectReference::Set(const std::string& utf8name, + double numberValue) const { + HandleScope scope(_env); + return Value().Set(utf8name, numberValue); +} + +inline MaybeOrValue ObjectReference::Get(uint32_t index) const { + EscapableHandleScope scope(_env); + MaybeOrValue result = Value().Get(index); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + if (result.IsJust()) { + return Just(scope.Escape(result.Unwrap())); + } + return result; +#else + if (scope.Env().IsExceptionPending()) { + return Value(); + } + return scope.Escape(result); +#endif +} + +inline MaybeOrValue ObjectReference::Set(uint32_t index, + napi_value value) const { + HandleScope scope(_env); + return Value().Set(index, value); +} + +inline MaybeOrValue ObjectReference::Set(uint32_t index, + Napi::Value value) const { + HandleScope scope(_env); + return Value().Set(index, value); +} + +inline MaybeOrValue ObjectReference::Set(uint32_t index, + const char* utf8value) const { + HandleScope scope(_env); + return Value().Set(index, utf8value); +} + +inline MaybeOrValue ObjectReference::Set( + uint32_t index, const std::string& utf8value) const { + HandleScope scope(_env); + return Value().Set(index, utf8value); +} + +inline MaybeOrValue ObjectReference::Set(uint32_t index, + bool boolValue) const { + HandleScope scope(_env); + return Value().Set(index, boolValue); +} + +inline MaybeOrValue ObjectReference::Set(uint32_t index, + double numberValue) const { + HandleScope scope(_env); + return Value().Set(index, numberValue); +} + +//////////////////////////////////////////////////////////////////////////////// +// FunctionReference class +//////////////////////////////////////////////////////////////////////////////// + +inline FunctionReference::FunctionReference() : Reference() {} + +inline FunctionReference::FunctionReference(napi_env env, napi_ref ref) + : Reference(env, ref) {} + +inline FunctionReference::FunctionReference(Reference&& other) + : Reference(std::move(other)) {} + +inline FunctionReference& FunctionReference::operator=( + Reference&& other) { + static_cast*>(this)->operator=(std::move(other)); + return *this; +} + +inline FunctionReference::FunctionReference(FunctionReference&& other) + : Reference(std::move(other)) {} + +inline FunctionReference& FunctionReference::operator=( + FunctionReference&& other) { + static_cast*>(this)->operator=(std::move(other)); + return *this; +} + +inline MaybeOrValue FunctionReference::operator()( + const std::initializer_list& args) const { + EscapableHandleScope scope(_env); + MaybeOrValue result = Value()(args); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + if (result.IsJust()) { + return Just(scope.Escape(result.Unwrap())); + } + return result; +#else + if (scope.Env().IsExceptionPending()) { + return Value(); + } + return scope.Escape(result); +#endif +} + +inline MaybeOrValue FunctionReference::Call( + const std::initializer_list& args) const { + EscapableHandleScope scope(_env); + MaybeOrValue result = Value().Call(args); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + if (result.IsJust()) { + return Just(scope.Escape(result.Unwrap())); + } + return result; +#else + if (scope.Env().IsExceptionPending()) { + return Value(); + } + return scope.Escape(result); +#endif +} + +inline MaybeOrValue FunctionReference::Call( + const std::vector& args) const { + EscapableHandleScope scope(_env); + MaybeOrValue result = Value().Call(args); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + if (result.IsJust()) { + return Just(scope.Escape(result.Unwrap())); + } + return result; +#else + if (scope.Env().IsExceptionPending()) { + return Value(); + } + return scope.Escape(result); +#endif +} + +inline MaybeOrValue FunctionReference::Call( + napi_value recv, const std::initializer_list& args) const { + EscapableHandleScope scope(_env); + MaybeOrValue result = Value().Call(recv, args); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + if (result.IsJust()) { + return Just(scope.Escape(result.Unwrap())); + } + return result; +#else + if (scope.Env().IsExceptionPending()) { + return Value(); + } + return scope.Escape(result); +#endif +} + +inline MaybeOrValue FunctionReference::Call( + napi_value recv, const std::vector& args) const { + EscapableHandleScope scope(_env); + MaybeOrValue result = Value().Call(recv, args); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + if (result.IsJust()) { + return Just(scope.Escape(result.Unwrap())); + } + return result; +#else + if (scope.Env().IsExceptionPending()) { + return Value(); + } + return scope.Escape(result); +#endif +} + +inline MaybeOrValue FunctionReference::Call( + napi_value recv, size_t argc, const napi_value* args) const { + EscapableHandleScope scope(_env); + MaybeOrValue result = Value().Call(recv, argc, args); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + if (result.IsJust()) { + return Just(scope.Escape(result.Unwrap())); + } + return result; +#else + if (scope.Env().IsExceptionPending()) { + return Value(); + } + return scope.Escape(result); +#endif +} + +inline MaybeOrValue FunctionReference::MakeCallback( + napi_value recv, + const std::initializer_list& args, + napi_async_context context) const { + EscapableHandleScope scope(_env); + MaybeOrValue result = Value().MakeCallback(recv, args, context); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + if (result.IsJust()) { + return Just(scope.Escape(result.Unwrap())); + } + + return result; +#else + if (scope.Env().IsExceptionPending()) { + return Value(); + } + return scope.Escape(result); +#endif +} + +inline MaybeOrValue FunctionReference::MakeCallback( + napi_value recv, + const std::vector& args, + napi_async_context context) const { + EscapableHandleScope scope(_env); + MaybeOrValue result = Value().MakeCallback(recv, args, context); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + if (result.IsJust()) { + return Just(scope.Escape(result.Unwrap())); + } + return result; +#else + if (scope.Env().IsExceptionPending()) { + return Value(); + } + return scope.Escape(result); +#endif +} + +inline MaybeOrValue FunctionReference::MakeCallback( + napi_value recv, + size_t argc, + const napi_value* args, + napi_async_context context) const { + EscapableHandleScope scope(_env); + MaybeOrValue result = + Value().MakeCallback(recv, argc, args, context); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + if (result.IsJust()) { + return Just(scope.Escape(result.Unwrap())); + } + return result; +#else + if (scope.Env().IsExceptionPending()) { + return Value(); + } + return scope.Escape(result); +#endif +} + +inline MaybeOrValue FunctionReference::New( + const std::initializer_list& args) const { + EscapableHandleScope scope(_env); + MaybeOrValue result = Value().New(args); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + if (result.IsJust()) { + return Just(scope.Escape(result.Unwrap()).As()); + } + return result; +#else + if (scope.Env().IsExceptionPending()) { + return Object(); + } + return scope.Escape(result).As(); +#endif +} + +inline MaybeOrValue FunctionReference::New( + const std::vector& args) const { + EscapableHandleScope scope(_env); + MaybeOrValue result = Value().New(args); +#ifdef NODE_ADDON_API_ENABLE_MAYBE + if (result.IsJust()) { + return Just(scope.Escape(result.Unwrap()).As()); + } + return result; +#else + if (scope.Env().IsExceptionPending()) { + return Object(); + } + return scope.Escape(result).As(); +#endif +} + +//////////////////////////////////////////////////////////////////////////////// +// CallbackInfo class +//////////////////////////////////////////////////////////////////////////////// + +inline CallbackInfo::CallbackInfo(napi_env env, napi_callback_info info) + : _env(env), + _info(info), + _this(nullptr), + _dynamicArgs(nullptr), + _data(nullptr) { + _argc = _staticArgCount; + _argv = _staticArgs; + napi_status status = + napi_get_cb_info(env, info, &_argc, _argv, &_this, &_data); + NAPI_THROW_IF_FAILED_VOID(_env, status); + + if (_argc > _staticArgCount) { + // Use either a fixed-size array (on the stack) or a dynamically-allocated + // array (on the heap) depending on the number of args. + _dynamicArgs = new napi_value[_argc]; + _argv = _dynamicArgs; + + status = napi_get_cb_info(env, info, &_argc, _argv, nullptr, nullptr); + NAPI_THROW_IF_FAILED_VOID(_env, status); + } +} + +inline CallbackInfo::~CallbackInfo() { + if (_dynamicArgs != nullptr) { + delete[] _dynamicArgs; + } +} + +inline CallbackInfo::operator napi_callback_info() const { + return _info; +} + +inline Value CallbackInfo::NewTarget() const { + napi_value newTarget; + napi_status status = napi_get_new_target(_env, _info, &newTarget); + NAPI_THROW_IF_FAILED(_env, status, Value()); + return Value(_env, newTarget); +} + +inline bool CallbackInfo::IsConstructCall() const { + return !NewTarget().IsEmpty(); +} + +inline Napi::Env CallbackInfo::Env() const { + return Napi::Env(_env); +} + +inline size_t CallbackInfo::Length() const { + return _argc; +} + +inline const Value CallbackInfo::operator[](size_t index) const { + return index < _argc ? Value(_env, _argv[index]) : Env().Undefined(); +} + +inline Value CallbackInfo::This() const { + if (_this == nullptr) { + return Env().Undefined(); + } + return Object(_env, _this); +} + +inline void* CallbackInfo::Data() const { + return _data; +} + +inline void CallbackInfo::SetData(void* data) { + _data = data; +} + +//////////////////////////////////////////////////////////////////////////////// +// PropertyDescriptor class +//////////////////////////////////////////////////////////////////////////////// + +template +PropertyDescriptor PropertyDescriptor::Accessor( + const char* utf8name, napi_property_attributes attributes, void* data) { + napi_property_descriptor desc = napi_property_descriptor(); + + desc.utf8name = utf8name; + desc.getter = details::TemplatedCallback; + desc.attributes = attributes; + desc.data = data; + + return desc; +} + +template +PropertyDescriptor PropertyDescriptor::Accessor( + const std::string& utf8name, + napi_property_attributes attributes, + void* data) { + return Accessor(utf8name.c_str(), attributes, data); +} + +template +PropertyDescriptor PropertyDescriptor::Accessor( + Name name, napi_property_attributes attributes, void* data) { + napi_property_descriptor desc = napi_property_descriptor(); + + desc.name = name; + desc.getter = details::TemplatedCallback; + desc.attributes = attributes; + desc.data = data; + + return desc; +} + +template +PropertyDescriptor PropertyDescriptor::Accessor( + const char* utf8name, napi_property_attributes attributes, void* data) { + napi_property_descriptor desc = napi_property_descriptor(); + + desc.utf8name = utf8name; + desc.getter = details::TemplatedCallback; + desc.setter = details::TemplatedVoidCallback; + desc.attributes = attributes; + desc.data = data; + + return desc; +} + +template +PropertyDescriptor PropertyDescriptor::Accessor( + const std::string& utf8name, + napi_property_attributes attributes, + void* data) { + return Accessor(utf8name.c_str(), attributes, data); +} + +template +PropertyDescriptor PropertyDescriptor::Accessor( + Name name, napi_property_attributes attributes, void* data) { + napi_property_descriptor desc = napi_property_descriptor(); + + desc.name = name; + desc.getter = details::TemplatedCallback; + desc.setter = details::TemplatedVoidCallback; + desc.attributes = attributes; + desc.data = data; + + return desc; +} + +template +inline PropertyDescriptor PropertyDescriptor::Accessor( + Napi::Env env, + Napi::Object object, + const char* utf8name, + Getter getter, + napi_property_attributes attributes, + void* data) { + using CbData = details::CallbackData; + auto callbackData = new CbData({getter, data}); + + napi_status status = AttachData(env, object, callbackData); + if (status != napi_ok) { + delete callbackData; + NAPI_THROW_IF_FAILED(env, status, napi_property_descriptor()); + } + + return PropertyDescriptor({utf8name, + nullptr, + nullptr, + CbData::Wrapper, + nullptr, + nullptr, + attributes, + callbackData}); +} + +template +inline PropertyDescriptor PropertyDescriptor::Accessor( + Napi::Env env, + Napi::Object object, + const std::string& utf8name, + Getter getter, + napi_property_attributes attributes, + void* data) { + return Accessor(env, object, utf8name.c_str(), getter, attributes, data); +} + +template +inline PropertyDescriptor PropertyDescriptor::Accessor( + Napi::Env env, + Napi::Object object, + Name name, + Getter getter, + napi_property_attributes attributes, + void* data) { + using CbData = details::CallbackData; + auto callbackData = new CbData({getter, data}); + + napi_status status = AttachData(env, object, callbackData); + if (status != napi_ok) { + delete callbackData; + NAPI_THROW_IF_FAILED(env, status, napi_property_descriptor()); + } + + return PropertyDescriptor({nullptr, + name, + nullptr, + CbData::Wrapper, + nullptr, + nullptr, + attributes, + callbackData}); +} + +template +inline PropertyDescriptor PropertyDescriptor::Accessor( + Napi::Env env, + Napi::Object object, + const char* utf8name, + Getter getter, + Setter setter, + napi_property_attributes attributes, + void* data) { + using CbData = details::AccessorCallbackData; + auto callbackData = new CbData({getter, setter, data}); + + napi_status status = AttachData(env, object, callbackData); + if (status != napi_ok) { + delete callbackData; + NAPI_THROW_IF_FAILED(env, status, napi_property_descriptor()); + } + + return PropertyDescriptor({utf8name, + nullptr, + nullptr, + CbData::GetterWrapper, + CbData::SetterWrapper, + nullptr, + attributes, + callbackData}); +} + +template +inline PropertyDescriptor PropertyDescriptor::Accessor( + Napi::Env env, + Napi::Object object, + const std::string& utf8name, + Getter getter, + Setter setter, + napi_property_attributes attributes, + void* data) { + return Accessor( + env, object, utf8name.c_str(), getter, setter, attributes, data); +} + +template +inline PropertyDescriptor PropertyDescriptor::Accessor( + Napi::Env env, + Napi::Object object, + Name name, + Getter getter, + Setter setter, + napi_property_attributes attributes, + void* data) { + using CbData = details::AccessorCallbackData; + auto callbackData = new CbData({getter, setter, data}); + + napi_status status = AttachData(env, object, callbackData); + if (status != napi_ok) { + delete callbackData; + NAPI_THROW_IF_FAILED(env, status, napi_property_descriptor()); + } + + return PropertyDescriptor({nullptr, + name, + nullptr, + CbData::GetterWrapper, + CbData::SetterWrapper, + nullptr, + attributes, + callbackData}); +} + +template +inline PropertyDescriptor PropertyDescriptor::Function( + Napi::Env env, + Napi::Object /*object*/, + const char* utf8name, + Callable cb, + napi_property_attributes attributes, + void* data) { + return PropertyDescriptor({utf8name, + nullptr, + nullptr, + nullptr, + nullptr, + Napi::Function::New(env, cb, utf8name, data), + attributes, + nullptr}); +} + +template +inline PropertyDescriptor PropertyDescriptor::Function( + Napi::Env env, + Napi::Object object, + const std::string& utf8name, + Callable cb, + napi_property_attributes attributes, + void* data) { + return Function(env, object, utf8name.c_str(), cb, attributes, data); +} + +template +inline PropertyDescriptor PropertyDescriptor::Function( + Napi::Env env, + Napi::Object /*object*/, + Name name, + Callable cb, + napi_property_attributes attributes, + void* data) { + return PropertyDescriptor({nullptr, + name, + nullptr, + nullptr, + nullptr, + Napi::Function::New(env, cb, nullptr, data), + attributes, + nullptr}); +} + +inline PropertyDescriptor PropertyDescriptor::Value( + const char* utf8name, + napi_value value, + napi_property_attributes attributes) { + return PropertyDescriptor({utf8name, + nullptr, + nullptr, + nullptr, + nullptr, + value, + attributes, + nullptr}); +} + +inline PropertyDescriptor PropertyDescriptor::Value( + const std::string& utf8name, + napi_value value, + napi_property_attributes attributes) { + return Value(utf8name.c_str(), value, attributes); +} + +inline PropertyDescriptor PropertyDescriptor::Value( + napi_value name, napi_value value, napi_property_attributes attributes) { + return PropertyDescriptor( + {nullptr, name, nullptr, nullptr, nullptr, value, attributes, nullptr}); +} + +inline PropertyDescriptor PropertyDescriptor::Value( + Name name, Napi::Value value, napi_property_attributes attributes) { + napi_value nameValue = name; + napi_value valueValue = value; + return PropertyDescriptor::Value(nameValue, valueValue, attributes); +} + +inline PropertyDescriptor::PropertyDescriptor(napi_property_descriptor desc) + : _desc(desc) {} + +inline PropertyDescriptor::operator napi_property_descriptor&() { + return _desc; +} + +inline PropertyDescriptor::operator const napi_property_descriptor&() const { + return _desc; +} + +//////////////////////////////////////////////////////////////////////////////// +// InstanceWrap class +//////////////////////////////////////////////////////////////////////////////// + +template +inline void InstanceWrap::AttachPropData( + napi_env env, napi_value value, const napi_property_descriptor* prop) { + napi_status status; + if (!(prop->attributes & napi_static)) { + if (prop->method == T::InstanceVoidMethodCallbackWrapper) { + status = Napi::details::AttachData( + env, value, static_cast(prop->data)); + NAPI_THROW_IF_FAILED_VOID(env, status); + } else if (prop->method == T::InstanceMethodCallbackWrapper) { + status = Napi::details::AttachData( + env, value, static_cast(prop->data)); + NAPI_THROW_IF_FAILED_VOID(env, status); + } else if (prop->getter == T::InstanceGetterCallbackWrapper || + prop->setter == T::InstanceSetterCallbackWrapper) { + status = Napi::details::AttachData( + env, value, static_cast(prop->data)); + NAPI_THROW_IF_FAILED_VOID(env, status); + } + } +} + +template +inline ClassPropertyDescriptor InstanceWrap::InstanceMethod( + const char* utf8name, + InstanceVoidMethodCallback method, + napi_property_attributes attributes, + void* data) { + InstanceVoidMethodCallbackData* callbackData = + new InstanceVoidMethodCallbackData({method, data}); + + napi_property_descriptor desc = napi_property_descriptor(); + desc.utf8name = utf8name; + desc.method = T::InstanceVoidMethodCallbackWrapper; + desc.data = callbackData; + desc.attributes = attributes; + return desc; +} + +template +inline ClassPropertyDescriptor InstanceWrap::InstanceMethod( + const char* utf8name, + InstanceMethodCallback method, + napi_property_attributes attributes, + void* data) { + InstanceMethodCallbackData* callbackData = + new InstanceMethodCallbackData({method, data}); + + napi_property_descriptor desc = napi_property_descriptor(); + desc.utf8name = utf8name; + desc.method = T::InstanceMethodCallbackWrapper; + desc.data = callbackData; + desc.attributes = attributes; + return desc; +} + +template +inline ClassPropertyDescriptor InstanceWrap::InstanceMethod( + Symbol name, + InstanceVoidMethodCallback method, + napi_property_attributes attributes, + void* data) { + InstanceVoidMethodCallbackData* callbackData = + new InstanceVoidMethodCallbackData({method, data}); + + napi_property_descriptor desc = napi_property_descriptor(); + desc.name = name; + desc.method = T::InstanceVoidMethodCallbackWrapper; + desc.data = callbackData; + desc.attributes = attributes; + return desc; +} + +template +inline ClassPropertyDescriptor InstanceWrap::InstanceMethod( + Symbol name, + InstanceMethodCallback method, + napi_property_attributes attributes, + void* data) { + InstanceMethodCallbackData* callbackData = + new InstanceMethodCallbackData({method, data}); + + napi_property_descriptor desc = napi_property_descriptor(); + desc.name = name; + desc.method = T::InstanceMethodCallbackWrapper; + desc.data = callbackData; + desc.attributes = attributes; + return desc; +} + +template +template ::InstanceVoidMethodCallback method> +inline ClassPropertyDescriptor InstanceWrap::InstanceMethod( + const char* utf8name, napi_property_attributes attributes, void* data) { + napi_property_descriptor desc = napi_property_descriptor(); + desc.utf8name = utf8name; + desc.method = details::TemplatedInstanceVoidCallback; + desc.data = data; + desc.attributes = attributes; + return desc; +} + +template +template ::InstanceMethodCallback method> +inline ClassPropertyDescriptor InstanceWrap::InstanceMethod( + const char* utf8name, napi_property_attributes attributes, void* data) { + napi_property_descriptor desc = napi_property_descriptor(); + desc.utf8name = utf8name; + desc.method = details::TemplatedInstanceCallback; + desc.data = data; + desc.attributes = attributes; + return desc; +} + +template +template ::InstanceVoidMethodCallback method> +inline ClassPropertyDescriptor InstanceWrap::InstanceMethod( + Symbol name, napi_property_attributes attributes, void* data) { + napi_property_descriptor desc = napi_property_descriptor(); + desc.name = name; + desc.method = details::TemplatedInstanceVoidCallback; + desc.data = data; + desc.attributes = attributes; + return desc; +} + +template +template ::InstanceMethodCallback method> +inline ClassPropertyDescriptor InstanceWrap::InstanceMethod( + Symbol name, napi_property_attributes attributes, void* data) { + napi_property_descriptor desc = napi_property_descriptor(); + desc.name = name; + desc.method = details::TemplatedInstanceCallback; + desc.data = data; + desc.attributes = attributes; + return desc; +} + +template +inline ClassPropertyDescriptor InstanceWrap::InstanceAccessor( + const char* utf8name, + InstanceGetterCallback getter, + InstanceSetterCallback setter, + napi_property_attributes attributes, + void* data) { + InstanceAccessorCallbackData* callbackData = + new InstanceAccessorCallbackData({getter, setter, data}); + + napi_property_descriptor desc = napi_property_descriptor(); + desc.utf8name = utf8name; + desc.getter = getter != nullptr ? T::InstanceGetterCallbackWrapper : nullptr; + desc.setter = setter != nullptr ? T::InstanceSetterCallbackWrapper : nullptr; + desc.data = callbackData; + desc.attributes = attributes; + return desc; +} + +template +inline ClassPropertyDescriptor InstanceWrap::InstanceAccessor( + Symbol name, + InstanceGetterCallback getter, + InstanceSetterCallback setter, + napi_property_attributes attributes, + void* data) { + InstanceAccessorCallbackData* callbackData = + new InstanceAccessorCallbackData({getter, setter, data}); + + napi_property_descriptor desc = napi_property_descriptor(); + desc.name = name; + desc.getter = getter != nullptr ? T::InstanceGetterCallbackWrapper : nullptr; + desc.setter = setter != nullptr ? T::InstanceSetterCallbackWrapper : nullptr; + desc.data = callbackData; + desc.attributes = attributes; + return desc; +} + +template +template ::InstanceGetterCallback getter, + typename InstanceWrap::InstanceSetterCallback setter> +inline ClassPropertyDescriptor InstanceWrap::InstanceAccessor( + const char* utf8name, napi_property_attributes attributes, void* data) { + napi_property_descriptor desc = napi_property_descriptor(); + desc.utf8name = utf8name; + desc.getter = details::TemplatedInstanceCallback; + desc.setter = This::WrapSetter(This::SetterTag()); + desc.data = data; + desc.attributes = attributes; + return desc; +} + +template +template ::InstanceGetterCallback getter, + typename InstanceWrap::InstanceSetterCallback setter> +inline ClassPropertyDescriptor InstanceWrap::InstanceAccessor( + Symbol name, napi_property_attributes attributes, void* data) { + napi_property_descriptor desc = napi_property_descriptor(); + desc.name = name; + desc.getter = details::TemplatedInstanceCallback; + desc.setter = This::WrapSetter(This::SetterTag()); + desc.data = data; + desc.attributes = attributes; + return desc; +} + +template +inline ClassPropertyDescriptor InstanceWrap::InstanceValue( + const char* utf8name, + Napi::Value value, + napi_property_attributes attributes) { + napi_property_descriptor desc = napi_property_descriptor(); + desc.utf8name = utf8name; + desc.value = value; + desc.attributes = attributes; + return desc; +} + +template +inline ClassPropertyDescriptor InstanceWrap::InstanceValue( + Symbol name, Napi::Value value, napi_property_attributes attributes) { + napi_property_descriptor desc = napi_property_descriptor(); + desc.name = name; + desc.value = value; + desc.attributes = attributes; + return desc; +} + +template +inline napi_value InstanceWrap::InstanceVoidMethodCallbackWrapper( + napi_env env, napi_callback_info info) { + return details::WrapCallback(env, [&] { + CallbackInfo callbackInfo(env, info); + InstanceVoidMethodCallbackData* callbackData = + reinterpret_cast(callbackInfo.Data()); + callbackInfo.SetData(callbackData->data); + T* instance = T::Unwrap(callbackInfo.This().As()); + auto cb = callbackData->callback; + if (instance) (instance->*cb)(callbackInfo); + return nullptr; + }); +} + +template +inline napi_value InstanceWrap::InstanceMethodCallbackWrapper( + napi_env env, napi_callback_info info) { + return details::WrapCallback(env, [&] { + CallbackInfo callbackInfo(env, info); + InstanceMethodCallbackData* callbackData = + reinterpret_cast(callbackInfo.Data()); + callbackInfo.SetData(callbackData->data); + T* instance = T::Unwrap(callbackInfo.This().As()); + auto cb = callbackData->callback; + return instance ? (instance->*cb)(callbackInfo) : Napi::Value(); + }); +} + +template +inline napi_value InstanceWrap::InstanceGetterCallbackWrapper( + napi_env env, napi_callback_info info) { + return details::WrapCallback(env, [&] { + CallbackInfo callbackInfo(env, info); + InstanceAccessorCallbackData* callbackData = + reinterpret_cast(callbackInfo.Data()); + callbackInfo.SetData(callbackData->data); + T* instance = T::Unwrap(callbackInfo.This().As()); + auto cb = callbackData->getterCallback; + return instance ? (instance->*cb)(callbackInfo) : Napi::Value(); + }); +} + +template +inline napi_value InstanceWrap::InstanceSetterCallbackWrapper( + napi_env env, napi_callback_info info) { + return details::WrapCallback(env, [&] { + CallbackInfo callbackInfo(env, info); + InstanceAccessorCallbackData* callbackData = + reinterpret_cast(callbackInfo.Data()); + callbackInfo.SetData(callbackData->data); + T* instance = T::Unwrap(callbackInfo.This().As()); + auto cb = callbackData->setterCallback; + if (instance) (instance->*cb)(callbackInfo, callbackInfo[0]); + return nullptr; + }); +} + +template +template ::InstanceSetterCallback method> +inline napi_value InstanceWrap::WrappedMethod( + napi_env env, napi_callback_info info) NAPI_NOEXCEPT { + return details::WrapCallback(env, [&] { + const CallbackInfo cbInfo(env, info); + T* instance = T::Unwrap(cbInfo.This().As()); + if (instance) (instance->*method)(cbInfo, cbInfo[0]); + return nullptr; + }); +} + +//////////////////////////////////////////////////////////////////////////////// +// ObjectWrap class +//////////////////////////////////////////////////////////////////////////////// + +template +inline NAPI_NO_SANITIZE_VPTR ObjectWrap::ObjectWrap( + const Napi::CallbackInfo& callbackInfo) { + napi_env env = callbackInfo.Env(); + napi_value wrapper = callbackInfo.This(); + napi_status status; + napi_ref ref; + T* instance = static_cast(this); + status = napi_wrap(env, wrapper, instance, FinalizeCallback, nullptr, &ref); + NAPI_THROW_IF_FAILED_VOID(env, status); + + Reference* instanceRef = instance; + *instanceRef = Reference(env, ref); +} + +template +inline NAPI_NO_SANITIZE_VPTR ObjectWrap::~ObjectWrap() { + // If the JS object still exists at this point, remove the finalizer added + // through `napi_wrap()`. + if (!IsEmpty() && !_finalized) { + Object object = Value(); + // It is not valid to call `napi_remove_wrap()` with an empty `object`. + // This happens e.g. during garbage collection. + if (!object.IsEmpty() && _construction_failed) { + napi_remove_wrap(Env(), object, nullptr); + } + } +} + +// with RTTI turned on, modern compilers check to see if virtual function +// pointers are stripped of RTTI by void casts. this is intrinsic to how Unwrap +// works, so we inject a compiler pragma to turn off that check just for the +// affected methods. this compiler check is on by default in Android NDK 29. +template +inline NAPI_NO_SANITIZE_VPTR T* ObjectWrap::Unwrap(Object wrapper) { + void* unwrapped; + napi_status status = napi_unwrap(wrapper.Env(), wrapper, &unwrapped); + NAPI_THROW_IF_FAILED(wrapper.Env(), status, nullptr); + return static_cast(unwrapped); +} + +template +inline Function ObjectWrap::DefineClass( + Napi::Env env, + const char* utf8name, + const size_t props_count, + const napi_property_descriptor* descriptors, + void* data) { + napi_status status; + std::vector props(props_count); + + // We copy the descriptors to a local array because before defining the class + // we must replace static method property descriptors with value property + // descriptors such that the value is a function-valued `napi_value` created + // with `CreateFunction()`. + // + // This replacement could be made for instance methods as well, but V8 aborts + // if we do that, because it expects methods defined on the prototype template + // to have `FunctionTemplate`s. + for (size_t index = 0; index < props_count; index++) { + props[index] = descriptors[index]; + napi_property_descriptor* prop = &props[index]; + if (prop->method == T::StaticMethodCallbackWrapper) { + status = + CreateFunction(env, + utf8name, + prop->method, + static_cast(prop->data), + &(prop->value)); + NAPI_THROW_IF_FAILED(env, status, Function()); + prop->method = nullptr; + prop->data = nullptr; + } else if (prop->method == T::StaticVoidMethodCallbackWrapper) { + status = + CreateFunction(env, + utf8name, + prop->method, + static_cast(prop->data), + &(prop->value)); + NAPI_THROW_IF_FAILED(env, status, Function()); + prop->method = nullptr; + prop->data = nullptr; + } + } + + napi_value value; + status = napi_define_class(env, + utf8name, + NAPI_AUTO_LENGTH, + T::ConstructorCallbackWrapper, + data, + props_count, + props.data(), + &value); + NAPI_THROW_IF_FAILED(env, status, Function()); + + // After defining the class we iterate once more over the property descriptors + // and attach the data associated with accessors and instance methods to the + // newly created JavaScript class. + for (size_t idx = 0; idx < props_count; idx++) { + const napi_property_descriptor* prop = &props[idx]; + + if (prop->getter == T::StaticGetterCallbackWrapper || + prop->setter == T::StaticSetterCallbackWrapper) { + status = Napi::details::AttachData( + env, value, static_cast(prop->data)); + NAPI_THROW_IF_FAILED(env, status, Function()); + } else { + // InstanceWrap::AttachPropData is responsible for attaching the data + // of instance methods and accessors. + T::AttachPropData(env, value, prop); + } + } + + return Function(env, value); +} + +template +inline Function ObjectWrap::DefineClass( + Napi::Env env, + const char* utf8name, + const std::initializer_list>& properties, + void* data) { + return DefineClass( + env, + utf8name, + properties.size(), + reinterpret_cast(properties.begin()), + data); +} + +template +inline Function ObjectWrap::DefineClass( + Napi::Env env, + const char* utf8name, + const std::vector>& properties, + void* data) { + return DefineClass( + env, + utf8name, + properties.size(), + reinterpret_cast(properties.data()), + data); +} + +template +inline ClassPropertyDescriptor ObjectWrap::StaticMethod( + const char* utf8name, + StaticVoidMethodCallback method, + napi_property_attributes attributes, + void* data) { + StaticVoidMethodCallbackData* callbackData = + new StaticVoidMethodCallbackData({method, data}); + + napi_property_descriptor desc = napi_property_descriptor(); + desc.utf8name = utf8name; + desc.method = T::StaticVoidMethodCallbackWrapper; + desc.data = callbackData; + desc.attributes = + static_cast(attributes | napi_static); + return desc; +} + +template +inline ClassPropertyDescriptor ObjectWrap::StaticMethod( + const char* utf8name, + StaticMethodCallback method, + napi_property_attributes attributes, + void* data) { + StaticMethodCallbackData* callbackData = + new StaticMethodCallbackData({method, data}); + + napi_property_descriptor desc = napi_property_descriptor(); + desc.utf8name = utf8name; + desc.method = T::StaticMethodCallbackWrapper; + desc.data = callbackData; + desc.attributes = + static_cast(attributes | napi_static); + return desc; +} + +template +inline ClassPropertyDescriptor ObjectWrap::StaticMethod( + Symbol name, + StaticVoidMethodCallback method, + napi_property_attributes attributes, + void* data) { + StaticVoidMethodCallbackData* callbackData = + new StaticVoidMethodCallbackData({method, data}); + + napi_property_descriptor desc = napi_property_descriptor(); + desc.name = name; + desc.method = T::StaticVoidMethodCallbackWrapper; + desc.data = callbackData; + desc.attributes = + static_cast(attributes | napi_static); + return desc; +} + +template +inline ClassPropertyDescriptor ObjectWrap::StaticMethod( + Symbol name, + StaticMethodCallback method, + napi_property_attributes attributes, + void* data) { + StaticMethodCallbackData* callbackData = + new StaticMethodCallbackData({method, data}); + + napi_property_descriptor desc = napi_property_descriptor(); + desc.name = name; + desc.method = T::StaticMethodCallbackWrapper; + desc.data = callbackData; + desc.attributes = + static_cast(attributes | napi_static); + return desc; +} + +template +template ::StaticVoidMethodCallback method> +inline ClassPropertyDescriptor ObjectWrap::StaticMethod( + const char* utf8name, napi_property_attributes attributes, void* data) { + napi_property_descriptor desc = napi_property_descriptor(); + desc.utf8name = utf8name; + desc.method = details::TemplatedVoidCallback; + desc.data = data; + desc.attributes = + static_cast(attributes | napi_static); + return desc; +} + +template +template ::StaticVoidMethodCallback method> +inline ClassPropertyDescriptor ObjectWrap::StaticMethod( + Symbol name, napi_property_attributes attributes, void* data) { + napi_property_descriptor desc = napi_property_descriptor(); + desc.name = name; + desc.method = details::TemplatedVoidCallback; + desc.data = data; + desc.attributes = + static_cast(attributes | napi_static); + return desc; +} + +template +template ::StaticMethodCallback method> +inline ClassPropertyDescriptor ObjectWrap::StaticMethod( + const char* utf8name, napi_property_attributes attributes, void* data) { + napi_property_descriptor desc = napi_property_descriptor(); + desc.utf8name = utf8name; + desc.method = details::TemplatedCallback; + desc.data = data; + desc.attributes = + static_cast(attributes | napi_static); + return desc; +} + +template +template ::StaticMethodCallback method> +inline ClassPropertyDescriptor ObjectWrap::StaticMethod( + Symbol name, napi_property_attributes attributes, void* data) { + napi_property_descriptor desc = napi_property_descriptor(); + desc.name = name; + desc.method = details::TemplatedCallback; + desc.data = data; + desc.attributes = + static_cast(attributes | napi_static); + return desc; +} + +template +inline ClassPropertyDescriptor ObjectWrap::StaticAccessor( + const char* utf8name, + StaticGetterCallback getter, + StaticSetterCallback setter, + napi_property_attributes attributes, + void* data) { + StaticAccessorCallbackData* callbackData = + new StaticAccessorCallbackData({getter, setter, data}); + + napi_property_descriptor desc = napi_property_descriptor(); + desc.utf8name = utf8name; + desc.getter = getter != nullptr ? T::StaticGetterCallbackWrapper : nullptr; + desc.setter = setter != nullptr ? T::StaticSetterCallbackWrapper : nullptr; + desc.data = callbackData; + desc.attributes = + static_cast(attributes | napi_static); + return desc; +} + +template +inline ClassPropertyDescriptor ObjectWrap::StaticAccessor( + Symbol name, + StaticGetterCallback getter, + StaticSetterCallback setter, + napi_property_attributes attributes, + void* data) { + StaticAccessorCallbackData* callbackData = + new StaticAccessorCallbackData({getter, setter, data}); + + napi_property_descriptor desc = napi_property_descriptor(); + desc.name = name; + desc.getter = getter != nullptr ? T::StaticGetterCallbackWrapper : nullptr; + desc.setter = setter != nullptr ? T::StaticSetterCallbackWrapper : nullptr; + desc.data = callbackData; + desc.attributes = + static_cast(attributes | napi_static); + return desc; +} + +template +template ::StaticGetterCallback getter, + typename ObjectWrap::StaticSetterCallback setter> +inline ClassPropertyDescriptor ObjectWrap::StaticAccessor( + const char* utf8name, napi_property_attributes attributes, void* data) { + napi_property_descriptor desc = napi_property_descriptor(); + desc.utf8name = utf8name; + desc.getter = details::TemplatedCallback; + desc.setter = This::WrapStaticSetter(This::StaticSetterTag()); + desc.data = data; + desc.attributes = + static_cast(attributes | napi_static); + return desc; +} + +template +template ::StaticGetterCallback getter, + typename ObjectWrap::StaticSetterCallback setter> +inline ClassPropertyDescriptor ObjectWrap::StaticAccessor( + Symbol name, napi_property_attributes attributes, void* data) { + napi_property_descriptor desc = napi_property_descriptor(); + desc.name = name; + desc.getter = details::TemplatedCallback; + desc.setter = This::WrapStaticSetter(This::StaticSetterTag()); + desc.data = data; + desc.attributes = + static_cast(attributes | napi_static); + return desc; +} + +template +inline ClassPropertyDescriptor ObjectWrap::StaticValue( + const char* utf8name, + Napi::Value value, + napi_property_attributes attributes) { + napi_property_descriptor desc = napi_property_descriptor(); + desc.utf8name = utf8name; + desc.value = value; + desc.attributes = + static_cast(attributes | napi_static); + return desc; +} + +template +inline ClassPropertyDescriptor ObjectWrap::StaticValue( + Symbol name, Napi::Value value, napi_property_attributes attributes) { + napi_property_descriptor desc = napi_property_descriptor(); + desc.name = name; + desc.value = value; + desc.attributes = + static_cast(attributes | napi_static); + return desc; +} + +template +inline Value ObjectWrap::OnCalledAsFunction( + const Napi::CallbackInfo& callbackInfo) { + NAPI_THROW( + TypeError::New(callbackInfo.Env(), + "Class constructors cannot be invoked without 'new'"), + Napi::Value()); +} + +template +inline void ObjectWrap::Finalize(Napi::Env /*env*/) {} + +template +inline void ObjectWrap::Finalize(BasicEnv /*env*/) {} + +template +inline napi_value ObjectWrap::ConstructorCallbackWrapper( + napi_env env, napi_callback_info info) { + napi_value new_target; + napi_status status = napi_get_new_target(env, info, &new_target); + if (status != napi_ok) return nullptr; + + bool isConstructCall = (new_target != nullptr); + if (!isConstructCall) { + return details::WrapCallback( + env, [&] { return T::OnCalledAsFunction(CallbackInfo(env, info)); }); + } + + napi_value wrapper = details::WrapCallback(env, [&] { + CallbackInfo callbackInfo(env, info); + T* instance = new T(callbackInfo); +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS + instance->_construction_failed = false; +#else + if (callbackInfo.Env().IsExceptionPending()) { + // We need to clear the exception so that removing the wrap might work. + Error e = callbackInfo.Env().GetAndClearPendingException(); + delete instance; + e.ThrowAsJavaScriptException(); + } else { + instance->_construction_failed = false; + } +#endif // NODE_ADDON_API_CPP_EXCEPTIONS + return callbackInfo.This(); + }); + + return wrapper; +} + +template +inline napi_value ObjectWrap::StaticVoidMethodCallbackWrapper( + napi_env env, napi_callback_info info) { + return details::WrapCallback(env, [&] { + CallbackInfo callbackInfo(env, info); + StaticVoidMethodCallbackData* callbackData = + reinterpret_cast(callbackInfo.Data()); + callbackInfo.SetData(callbackData->data); + callbackData->callback(callbackInfo); + return nullptr; + }); +} + +template +inline napi_value ObjectWrap::StaticMethodCallbackWrapper( + napi_env env, napi_callback_info info) { + return details::WrapCallback(env, [&] { + CallbackInfo callbackInfo(env, info); + StaticMethodCallbackData* callbackData = + reinterpret_cast(callbackInfo.Data()); + callbackInfo.SetData(callbackData->data); + return callbackData->callback(callbackInfo); + }); +} + +template +inline napi_value ObjectWrap::StaticGetterCallbackWrapper( + napi_env env, napi_callback_info info) { + return details::WrapCallback(env, [&] { + CallbackInfo callbackInfo(env, info); + StaticAccessorCallbackData* callbackData = + reinterpret_cast(callbackInfo.Data()); + callbackInfo.SetData(callbackData->data); + return callbackData->getterCallback(callbackInfo); + }); +} + +template +inline napi_value ObjectWrap::StaticSetterCallbackWrapper( + napi_env env, napi_callback_info info) { + return details::WrapCallback(env, [&] { + CallbackInfo callbackInfo(env, info); + StaticAccessorCallbackData* callbackData = + reinterpret_cast(callbackInfo.Data()); + callbackInfo.SetData(callbackData->data); + callbackData->setterCallback(callbackInfo, callbackInfo[0]); + return nullptr; + }); +} + +template +inline void ObjectWrap::FinalizeCallback(node_addon_api_basic_env env, + void* data, + void* /*hint*/) { + // If the child class does not override _any_ Finalize() method, `env` will be + // unused because of the constexpr guards. Explicitly reference it here to + // bypass compiler warnings. + (void)env; + T* instance = static_cast(data); + + // Prevent ~ObjectWrap from calling napi_remove_wrap. + // The instance->_ref should be deleted with napi_delete_reference in + // ~Reference. + instance->_finalized = true; + + // If class overrides the basic finalizer, execute it. + if constexpr (details::HasBasicFinalizer::value) { +#ifndef NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER + HandleScope scope(env); +#endif + + instance->Finalize(Napi::BasicEnv(env)); + } + + // If class overrides the (extended) finalizer, either schedule it or + // execute it immediately (depending on experimental features enabled). + if constexpr (details::HasExtendedFinalizer::value) { +#ifdef NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER + // In experimental, attach via node_api_post_finalizer. + // `PostFinalizeCallback` is responsible for deleting the `T* instance`, + // after calling the user-provided finalizer. + napi_status status = + node_api_post_finalizer(env, PostFinalizeCallback, data, nullptr); + NAPI_FATAL_IF_FAILED(status, + "ObjectWrap::FinalizeCallback", + "node_api_post_finalizer failed"); +#else + // In non-experimental, this `FinalizeCallback` already executes from a + // non-basic environment. Execute the override directly. + // `PostFinalizeCallback` is responsible for deleting the `T* instance`, + // after calling the user-provided finalizer. + HandleScope scope(env); + PostFinalizeCallback(env, data, static_cast(nullptr)); +#endif + } + // If the instance does _not_ override the (extended) finalizer, delete the + // `T* instance` immediately. + else { + delete instance; + } +} + +template +inline void ObjectWrap::PostFinalizeCallback(napi_env env, + void* data, + void* /*hint*/) { + T* instance = static_cast(data); + instance->Finalize(Napi::Env(env)); + delete instance; +} + +template +template ::StaticSetterCallback method> +inline napi_value ObjectWrap::WrappedMethod( + napi_env env, napi_callback_info info) NAPI_NOEXCEPT { + return details::WrapCallback(env, [&] { + const CallbackInfo cbInfo(env, info); + // MSVC requires to copy 'method' function pointer to a local variable + // before invoking it. + auto m = method; + m(cbInfo, cbInfo[0]); + return nullptr; + }); +} + +//////////////////////////////////////////////////////////////////////////////// +// HandleScope class +//////////////////////////////////////////////////////////////////////////////// + +inline HandleScope::HandleScope(napi_env env, napi_handle_scope scope) + : _env(env), _scope(scope) {} + +inline HandleScope::HandleScope(Napi::Env env) : _env(env) { + napi_status status = napi_open_handle_scope(_env, &_scope); + NAPI_THROW_IF_FAILED_VOID(_env, status); +} + +inline HandleScope::~HandleScope() { + napi_status status = napi_close_handle_scope(_env, _scope); + NAPI_FATAL_IF_FAILED( + status, "HandleScope::~HandleScope", "napi_close_handle_scope"); +} + +inline HandleScope::operator napi_handle_scope() const { + return _scope; +} + +inline Napi::Env HandleScope::Env() const { + return Napi::Env(_env); +} + +//////////////////////////////////////////////////////////////////////////////// +// EscapableHandleScope class +//////////////////////////////////////////////////////////////////////////////// + +inline EscapableHandleScope::EscapableHandleScope( + napi_env env, napi_escapable_handle_scope scope) + : _env(env), _scope(scope) {} + +inline EscapableHandleScope::EscapableHandleScope(Napi::Env env) : _env(env) { + napi_status status = napi_open_escapable_handle_scope(_env, &_scope); + NAPI_THROW_IF_FAILED_VOID(_env, status); +} + +inline EscapableHandleScope::~EscapableHandleScope() { + napi_status status = napi_close_escapable_handle_scope(_env, _scope); + NAPI_FATAL_IF_FAILED(status, + "EscapableHandleScope::~EscapableHandleScope", + "napi_close_escapable_handle_scope"); +} + +inline EscapableHandleScope::operator napi_escapable_handle_scope() const { + return _scope; +} + +inline Napi::Env EscapableHandleScope::Env() const { + return Napi::Env(_env); +} + +inline Value EscapableHandleScope::Escape(napi_value escapee) { + napi_value result; + napi_status status = napi_escape_handle(_env, _scope, escapee, &result); + NAPI_THROW_IF_FAILED(_env, status, Value()); + return Value(_env, result); +} + +#if (NAPI_VERSION > 2) +//////////////////////////////////////////////////////////////////////////////// +// CallbackScope class +//////////////////////////////////////////////////////////////////////////////// + +inline CallbackScope::CallbackScope(napi_env env, napi_callback_scope scope) + : _env(env), _scope(scope) {} + +inline CallbackScope::CallbackScope(napi_env env, napi_async_context context) + : _env(env) { + napi_status status = + napi_open_callback_scope(_env, Object::New(env), context, &_scope); + NAPI_THROW_IF_FAILED_VOID(_env, status); +} + +inline CallbackScope::~CallbackScope() { + napi_status status = napi_close_callback_scope(_env, _scope); + NAPI_FATAL_IF_FAILED( + status, "CallbackScope::~CallbackScope", "napi_close_callback_scope"); +} + +inline CallbackScope::operator napi_callback_scope() const { + return _scope; +} + +inline Napi::Env CallbackScope::Env() const { + return Napi::Env(_env); +} +#endif + +//////////////////////////////////////////////////////////////////////////////// +// AsyncContext class +//////////////////////////////////////////////////////////////////////////////// + +inline AsyncContext::AsyncContext(napi_env env, const char* resource_name) + : AsyncContext(env, resource_name, Object::New(env)) {} + +inline AsyncContext::AsyncContext(napi_env env, + const char* resource_name, + const Object& resource) + : _env(env), _context(nullptr) { + napi_value resource_id; + napi_status status = napi_create_string_utf8( + _env, resource_name, NAPI_AUTO_LENGTH, &resource_id); + NAPI_THROW_IF_FAILED_VOID(_env, status); + + status = napi_async_init(_env, resource, resource_id, &_context); + NAPI_THROW_IF_FAILED_VOID(_env, status); +} + +inline AsyncContext::~AsyncContext() { + if (_context != nullptr) { + napi_async_destroy(_env, _context); + _context = nullptr; + } +} + +inline AsyncContext::AsyncContext(AsyncContext&& other) { + _env = other._env; + other._env = nullptr; + _context = other._context; + other._context = nullptr; +} + +inline AsyncContext& AsyncContext::operator=(AsyncContext&& other) { + _env = other._env; + other._env = nullptr; + _context = other._context; + other._context = nullptr; + return *this; +} + +inline AsyncContext::operator napi_async_context() const { + return _context; +} + +inline Napi::Env AsyncContext::Env() const { + return Napi::Env(_env); +} + +//////////////////////////////////////////////////////////////////////////////// +// AsyncWorker class +//////////////////////////////////////////////////////////////////////////////// + +#if NAPI_HAS_THREADS + +inline AsyncWorker::AsyncWorker(const Function& callback) + : AsyncWorker(callback, "generic") {} + +inline AsyncWorker::AsyncWorker(const Function& callback, + const char* resource_name) + : AsyncWorker(callback, resource_name, Object::New(callback.Env())) {} + +inline AsyncWorker::AsyncWorker(const Function& callback, + const char* resource_name, + const Object& resource) + : AsyncWorker( + Object::New(callback.Env()), callback, resource_name, resource) {} + +inline AsyncWorker::AsyncWorker(const Object& receiver, + const Function& callback) + : AsyncWorker(receiver, callback, "generic") {} + +inline AsyncWorker::AsyncWorker(const Object& receiver, + const Function& callback, + const char* resource_name) + : AsyncWorker( + receiver, callback, resource_name, Object::New(callback.Env())) {} + +inline AsyncWorker::AsyncWorker(const Object& receiver, + const Function& callback, + const char* resource_name, + const Object& resource) + : _env(callback.Env()), + _receiver(Napi::Persistent(receiver)), + _callback(Napi::Persistent(callback)), + _suppress_destruct(false) { + napi_value resource_id; + napi_status status = napi_create_string_latin1( + _env, resource_name, NAPI_AUTO_LENGTH, &resource_id); + NAPI_THROW_IF_FAILED_VOID(_env, status); + + status = napi_create_async_work(_env, + resource, + resource_id, + OnAsyncWorkExecute, + OnAsyncWorkComplete, + this, + &_work); + NAPI_THROW_IF_FAILED_VOID(_env, status); +} + +inline AsyncWorker::AsyncWorker(Napi::Env env) : AsyncWorker(env, "generic") {} + +inline AsyncWorker::AsyncWorker(Napi::Env env, const char* resource_name) + : AsyncWorker(env, resource_name, Object::New(env)) {} + +inline AsyncWorker::AsyncWorker(Napi::Env env, + const char* resource_name, + const Object& resource) + : _env(env), _receiver(), _callback(), _suppress_destruct(false) { + napi_value resource_id; + napi_status status = napi_create_string_latin1( + _env, resource_name, NAPI_AUTO_LENGTH, &resource_id); + NAPI_THROW_IF_FAILED_VOID(_env, status); + + status = napi_create_async_work(_env, + resource, + resource_id, + OnAsyncWorkExecute, + OnAsyncWorkComplete, + this, + &_work); + NAPI_THROW_IF_FAILED_VOID(_env, status); +} + +inline AsyncWorker::~AsyncWorker() { + if (_work != nullptr) { + napi_delete_async_work(_env, _work); + _work = nullptr; + } +} + +inline void AsyncWorker::Destroy() { + delete this; +} + +inline AsyncWorker::operator napi_async_work() const { + return _work; +} + +inline Napi::Env AsyncWorker::Env() const { + return Napi::Env(_env); +} + +inline void AsyncWorker::Queue() { + napi_status status = napi_queue_async_work(_env, _work); + NAPI_THROW_IF_FAILED_VOID(_env, status); +} + +inline void AsyncWorker::Cancel() { + napi_status status = napi_cancel_async_work(_env, _work); + NAPI_THROW_IF_FAILED_VOID(_env, status); +} + +inline ObjectReference& AsyncWorker::Receiver() { + return _receiver; +} + +inline FunctionReference& AsyncWorker::Callback() { + return _callback; +} + +inline void AsyncWorker::SuppressDestruct() { + _suppress_destruct = true; +} + +inline void AsyncWorker::OnOK() { + if (!_callback.IsEmpty()) { + _callback.Call(_receiver.Value(), GetResult(_callback.Env())); + } +} + +inline void AsyncWorker::OnError(const Error& e) { + if (!_callback.IsEmpty()) { + _callback.Call(_receiver.Value(), + std::initializer_list{e.Value()}); + } +} + +inline void AsyncWorker::SetError(const std::string& error) { + _error = error; +} + +inline std::vector AsyncWorker::GetResult(Napi::Env /*env*/) { + return {}; +} +// The OnAsyncWorkExecute method receives an napi_env argument. However, do NOT +// use it within this method, as it does not run on the JavaScript thread and +// must not run any method that would cause JavaScript to run. In practice, +// this means that almost any use of napi_env will be incorrect. +inline void AsyncWorker::OnAsyncWorkExecute(napi_env env, void* asyncworker) { + AsyncWorker* self = static_cast(asyncworker); + self->OnExecute(env); +} +// The OnExecute method receives an napi_env argument. However, do NOT +// use it within this method, as it does not run on the JavaScript thread and +// must not run any method that would cause JavaScript to run. In practice, +// this means that almost any use of napi_env will be incorrect. +inline void AsyncWorker::OnExecute(Napi::Env /*DO_NOT_USE*/) { +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS + try { + Execute(); + } catch (const std::exception& e) { + SetError(e.what()); + } +#else // NODE_ADDON_API_CPP_EXCEPTIONS + Execute(); +#endif // NODE_ADDON_API_CPP_EXCEPTIONS +} + +inline void AsyncWorker::OnAsyncWorkComplete(napi_env env, + napi_status status, + void* asyncworker) { + AsyncWorker* self = static_cast(asyncworker); + self->OnWorkComplete(env, status); +} +inline void AsyncWorker::OnWorkComplete(Napi::Env env, napi_status status) { + if (status != napi_cancelled) { + HandleScope scope(_env); + details::WrapCallback(env, [&] { + if (_error.size() == 0) { + OnOK(); + } else { + OnError(Error::New(_env, _error)); + } + return nullptr; + }); + } + if (!_suppress_destruct) { + Destroy(); + } +} + +#endif // NAPI_HAS_THREADS + +#if (NAPI_VERSION > 3 && NAPI_HAS_THREADS) +//////////////////////////////////////////////////////////////////////////////// +// TypedThreadSafeFunction class +//////////////////////////////////////////////////////////////////////////////// + +// Starting with NAPI 5, the JavaScript function `func` parameter of +// `napi_create_threadsafe_function` is optional. +#if NAPI_VERSION > 4 +// static, with Callback [missing] Resource [missing] Finalizer [missing] +template +template +inline TypedThreadSafeFunction +TypedThreadSafeFunction::New( + napi_env env, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context) { + TypedThreadSafeFunction tsfn; + + napi_status status = + napi_create_threadsafe_function(env, + nullptr, + nullptr, + String::From(env, resourceName), + maxQueueSize, + initialThreadCount, + nullptr, + nullptr, + context, + CallJsInternal, + &tsfn._tsfn); + if (status != napi_ok) { + NAPI_THROW_IF_FAILED( + env, status, TypedThreadSafeFunction()); + } + + return tsfn; +} + +// static, with Callback [missing] Resource [passed] Finalizer [missing] +template +template +inline TypedThreadSafeFunction +TypedThreadSafeFunction::New( + napi_env env, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context) { + TypedThreadSafeFunction tsfn; + + napi_status status = + napi_create_threadsafe_function(env, + nullptr, + resource, + String::From(env, resourceName), + maxQueueSize, + initialThreadCount, + nullptr, + nullptr, + context, + CallJsInternal, + &tsfn._tsfn); + if (status != napi_ok) { + NAPI_THROW_IF_FAILED( + env, status, TypedThreadSafeFunction()); + } + + return tsfn; +} + +// static, with Callback [missing] Resource [missing] Finalizer [passed] +template +template +inline TypedThreadSafeFunction +TypedThreadSafeFunction::New( + napi_env env, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback, + FinalizerDataType* data) { + TypedThreadSafeFunction tsfn; + + auto* finalizeData = new details:: + ThreadSafeFinalize( + {data, finalizeCallback}); + auto fini = + details::ThreadSafeFinalize:: + FinalizeFinalizeWrapperWithDataAndContext; + napi_status status = + napi_create_threadsafe_function(env, + nullptr, + nullptr, + String::From(env, resourceName), + maxQueueSize, + initialThreadCount, + finalizeData, + fini, + context, + CallJsInternal, + &tsfn._tsfn); + if (status != napi_ok) { + delete finalizeData; + NAPI_THROW_IF_FAILED( + env, status, TypedThreadSafeFunction()); + } + + return tsfn; +} + +// static, with Callback [missing] Resource [passed] Finalizer [passed] +template +template +inline TypedThreadSafeFunction +TypedThreadSafeFunction::New( + napi_env env, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback, + FinalizerDataType* data) { + TypedThreadSafeFunction tsfn; + + auto* finalizeData = new details:: + ThreadSafeFinalize( + {data, finalizeCallback}); + auto fini = + details::ThreadSafeFinalize:: + FinalizeFinalizeWrapperWithDataAndContext; + napi_status status = + napi_create_threadsafe_function(env, + nullptr, + resource, + String::From(env, resourceName), + maxQueueSize, + initialThreadCount, + finalizeData, + fini, + context, + CallJsInternal, + &tsfn._tsfn); + if (status != napi_ok) { + delete finalizeData; + NAPI_THROW_IF_FAILED( + env, status, TypedThreadSafeFunction()); + } + + return tsfn; +} +#endif + +// static, with Callback [passed] Resource [missing] Finalizer [missing] +template +template +inline TypedThreadSafeFunction +TypedThreadSafeFunction::New( + napi_env env, + const Function& callback, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context) { + TypedThreadSafeFunction tsfn; + + napi_status status = + napi_create_threadsafe_function(env, + callback, + nullptr, + String::From(env, resourceName), + maxQueueSize, + initialThreadCount, + nullptr, + nullptr, + context, + CallJsInternal, + &tsfn._tsfn); + if (status != napi_ok) { + NAPI_THROW_IF_FAILED( + env, status, TypedThreadSafeFunction()); + } + + return tsfn; +} + +// static, with Callback [passed] Resource [passed] Finalizer [missing] +template +template +inline TypedThreadSafeFunction +TypedThreadSafeFunction::New( + napi_env env, + const Function& callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context) { + TypedThreadSafeFunction tsfn; + + napi_status status = + napi_create_threadsafe_function(env, + callback, + resource, + String::From(env, resourceName), + maxQueueSize, + initialThreadCount, + nullptr, + nullptr, + context, + CallJsInternal, + &tsfn._tsfn); + if (status != napi_ok) { + NAPI_THROW_IF_FAILED( + env, status, TypedThreadSafeFunction()); + } + + return tsfn; +} + +// static, with Callback [passed] Resource [missing] Finalizer [passed] +template +template +inline TypedThreadSafeFunction +TypedThreadSafeFunction::New( + napi_env env, + const Function& callback, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback, + FinalizerDataType* data) { + TypedThreadSafeFunction tsfn; + + auto* finalizeData = new details:: + ThreadSafeFinalize( + {data, finalizeCallback}); + auto fini = + details::ThreadSafeFinalize:: + FinalizeFinalizeWrapperWithDataAndContext; + napi_status status = + napi_create_threadsafe_function(env, + callback, + nullptr, + String::From(env, resourceName), + maxQueueSize, + initialThreadCount, + finalizeData, + fini, + context, + CallJsInternal, + &tsfn._tsfn); + if (status != napi_ok) { + delete finalizeData; + NAPI_THROW_IF_FAILED( + env, status, TypedThreadSafeFunction()); + } + + return tsfn; +} + +// static, with: Callback [passed] Resource [passed] Finalizer [passed] +template +template +inline TypedThreadSafeFunction +TypedThreadSafeFunction::New( + napi_env env, + CallbackType callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback, + FinalizerDataType* data) { + TypedThreadSafeFunction tsfn; + + auto* finalizeData = new details:: + ThreadSafeFinalize( + {data, finalizeCallback}); + auto fini = + details::ThreadSafeFinalize:: + FinalizeFinalizeWrapperWithDataAndContext; + napi_status status = napi_create_threadsafe_function( + env, + details::DefaultCallbackWrapper< + CallbackType, + TypedThreadSafeFunction>(env, + callback), + resource, + String::From(env, resourceName), + maxQueueSize, + initialThreadCount, + finalizeData, + fini, + context, + CallJsInternal, + &tsfn._tsfn); + if (status != napi_ok) { + delete finalizeData; + NAPI_THROW_IF_FAILED( + env, status, TypedThreadSafeFunction()); + } + + return tsfn; +} + +template +inline TypedThreadSafeFunction:: + TypedThreadSafeFunction() + : _tsfn() {} + +template +inline TypedThreadSafeFunction:: + TypedThreadSafeFunction(napi_threadsafe_function tsfn) + : _tsfn(tsfn) {} + +template +inline TypedThreadSafeFunction:: +operator napi_threadsafe_function() const { + return _tsfn; +} + +template +inline napi_status +TypedThreadSafeFunction::BlockingCall( + DataType* data) const { + return napi_call_threadsafe_function(_tsfn, data, napi_tsfn_blocking); +} + +template +inline napi_status +TypedThreadSafeFunction::NonBlockingCall( + DataType* data) const { + return napi_call_threadsafe_function(_tsfn, data, napi_tsfn_nonblocking); +} + +template +inline void TypedThreadSafeFunction::Ref( + napi_env env) const { + if (_tsfn != nullptr) { + napi_status status = napi_ref_threadsafe_function(env, _tsfn); + NAPI_THROW_IF_FAILED_VOID(env, status); + } +} + +template +inline void TypedThreadSafeFunction::Unref( + napi_env env) const { + if (_tsfn != nullptr) { + napi_status status = napi_unref_threadsafe_function(env, _tsfn); + NAPI_THROW_IF_FAILED_VOID(env, status); + } +} + +template +inline napi_status +TypedThreadSafeFunction::Acquire() const { + return napi_acquire_threadsafe_function(_tsfn); +} + +template +inline napi_status +TypedThreadSafeFunction::Release() const { + return napi_release_threadsafe_function(_tsfn, napi_tsfn_release); +} + +template +inline napi_status +TypedThreadSafeFunction::Abort() const { + return napi_release_threadsafe_function(_tsfn, napi_tsfn_abort); +} + +template +inline ContextType* +TypedThreadSafeFunction::GetContext() const { + void* context; + napi_status status = napi_get_threadsafe_function_context(_tsfn, &context); + NAPI_FATAL_IF_FAILED(status, + "TypedThreadSafeFunction::GetContext", + "napi_get_threadsafe_function_context"); + return static_cast(context); +} + +// static +template +void TypedThreadSafeFunction::CallJsInternal( + napi_env env, napi_value jsCallback, void* context, void* data) { + details::CallJsWrapper( + env, jsCallback, context, data); +} + +#if NAPI_VERSION == 4 +// static +template +Napi::Function +TypedThreadSafeFunction::EmptyFunctionFactory( + Napi::Env env) { + return Napi::Function::New(env, [](const CallbackInfo& cb) {}); +} + +// static +template +Napi::Function +TypedThreadSafeFunction::FunctionOrEmpty( + Napi::Env env, Napi::Function& callback) { + if (callback.IsEmpty()) { + return EmptyFunctionFactory(env); + } + return callback; +} + +#else +// static +template +std::nullptr_t +TypedThreadSafeFunction::EmptyFunctionFactory( + Napi::Env /*env*/) { + return nullptr; +} + +// static +template +Napi::Function +TypedThreadSafeFunction::FunctionOrEmpty( + Napi::Env /*env*/, Napi::Function& callback) { + return callback; +} + +#endif + +//////////////////////////////////////////////////////////////////////////////// +// ThreadSafeFunction class +//////////////////////////////////////////////////////////////////////////////// + +// static +template +inline ThreadSafeFunction ThreadSafeFunction::New(napi_env env, + const Function& callback, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount) { + return New( + env, callback, Object(), resourceName, maxQueueSize, initialThreadCount); +} + +// static +template +inline ThreadSafeFunction ThreadSafeFunction::New(napi_env env, + const Function& callback, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context) { + return New(env, + callback, + Object(), + resourceName, + maxQueueSize, + initialThreadCount, + context); +} + +// static +template +inline ThreadSafeFunction ThreadSafeFunction::New(napi_env env, + const Function& callback, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + Finalizer finalizeCallback) { + return New(env, + callback, + Object(), + resourceName, + maxQueueSize, + initialThreadCount, + finalizeCallback); +} + +// static +template +inline ThreadSafeFunction ThreadSafeFunction::New(napi_env env, + const Function& callback, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + Finalizer finalizeCallback, + FinalizerDataType* data) { + return New(env, + callback, + Object(), + resourceName, + maxQueueSize, + initialThreadCount, + finalizeCallback, + data); +} + +// static +template +inline ThreadSafeFunction ThreadSafeFunction::New(napi_env env, + const Function& callback, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback) { + return New(env, + callback, + Object(), + resourceName, + maxQueueSize, + initialThreadCount, + context, + finalizeCallback); +} + +// static +template +inline ThreadSafeFunction ThreadSafeFunction::New(napi_env env, + const Function& callback, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback, + FinalizerDataType* data) { + return New(env, + callback, + Object(), + resourceName, + maxQueueSize, + initialThreadCount, + context, + finalizeCallback, + data); +} + +// static +template +inline ThreadSafeFunction ThreadSafeFunction::New(napi_env env, + const Function& callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount) { + return New(env, + callback, + resource, + resourceName, + maxQueueSize, + initialThreadCount, + static_cast(nullptr) /* context */); +} + +// static +template +inline ThreadSafeFunction ThreadSafeFunction::New(napi_env env, + const Function& callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context) { + return New(env, + callback, + resource, + resourceName, + maxQueueSize, + initialThreadCount, + context, + [](Env, ContextType*) {} /* empty finalizer */); +} + +// static +template +inline ThreadSafeFunction ThreadSafeFunction::New(napi_env env, + const Function& callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + Finalizer finalizeCallback) { + return New(env, + callback, + resource, + resourceName, + maxQueueSize, + initialThreadCount, + static_cast(nullptr) /* context */, + finalizeCallback, + static_cast(nullptr) /* data */, + details::ThreadSafeFinalize::Wrapper); +} + +// static +template +inline ThreadSafeFunction ThreadSafeFunction::New(napi_env env, + const Function& callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + Finalizer finalizeCallback, + FinalizerDataType* data) { + return New(env, + callback, + resource, + resourceName, + maxQueueSize, + initialThreadCount, + static_cast(nullptr) /* context */, + finalizeCallback, + data, + details::ThreadSafeFinalize:: + FinalizeWrapperWithData); +} + +// static +template +inline ThreadSafeFunction ThreadSafeFunction::New(napi_env env, + const Function& callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback) { + return New( + env, + callback, + resource, + resourceName, + maxQueueSize, + initialThreadCount, + context, + finalizeCallback, + static_cast(nullptr) /* data */, + details::ThreadSafeFinalize::FinalizeWrapperWithContext); +} + +// static +template +inline ThreadSafeFunction ThreadSafeFunction::New(napi_env env, + const Function& callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback, + FinalizerDataType* data) { + return New( + env, + callback, + resource, + resourceName, + maxQueueSize, + initialThreadCount, + context, + finalizeCallback, + data, + details::ThreadSafeFinalize:: + FinalizeFinalizeWrapperWithDataAndContext); +} + +inline ThreadSafeFunction::ThreadSafeFunction() : _tsfn() {} + +inline ThreadSafeFunction::ThreadSafeFunction(napi_threadsafe_function tsfn) + : _tsfn(tsfn) {} + +inline ThreadSafeFunction::operator napi_threadsafe_function() const { + return _tsfn; +} + +inline napi_status ThreadSafeFunction::BlockingCall() const { + return CallInternal(nullptr, napi_tsfn_blocking); +} + +template <> +inline napi_status ThreadSafeFunction::BlockingCall(void* data) const { + return napi_call_threadsafe_function(_tsfn, data, napi_tsfn_blocking); +} + +template +inline napi_status ThreadSafeFunction::BlockingCall(Callback callback) const { + return CallInternal(new CallbackWrapper(callback), napi_tsfn_blocking); +} + +template +inline napi_status ThreadSafeFunction::BlockingCall(DataType* data, + Callback callback) const { + auto wrapper = [data, callback](Env env, Function jsCallback) { + callback(env, jsCallback, data); + }; + return CallInternal(new CallbackWrapper(wrapper), napi_tsfn_blocking); +} + +inline napi_status ThreadSafeFunction::NonBlockingCall() const { + return CallInternal(nullptr, napi_tsfn_nonblocking); +} + +template <> +inline napi_status ThreadSafeFunction::NonBlockingCall(void* data) const { + return napi_call_threadsafe_function(_tsfn, data, napi_tsfn_nonblocking); +} + +template +inline napi_status ThreadSafeFunction::NonBlockingCall( + Callback callback) const { + return CallInternal(new CallbackWrapper(callback), napi_tsfn_nonblocking); +} + +template +inline napi_status ThreadSafeFunction::NonBlockingCall( + DataType* data, Callback callback) const { + auto wrapper = [data, callback](Env env, Function jsCallback) { + callback(env, jsCallback, data); + }; + return CallInternal(new CallbackWrapper(wrapper), napi_tsfn_nonblocking); +} + +inline void ThreadSafeFunction::Ref(napi_env env) const { + if (_tsfn != nullptr) { + napi_status status = napi_ref_threadsafe_function(env, _tsfn); + NAPI_THROW_IF_FAILED_VOID(env, status); + } +} + +inline void ThreadSafeFunction::Unref(napi_env env) const { + if (_tsfn != nullptr) { + napi_status status = napi_unref_threadsafe_function(env, _tsfn); + NAPI_THROW_IF_FAILED_VOID(env, status); + } +} + +inline napi_status ThreadSafeFunction::Acquire() const { + return napi_acquire_threadsafe_function(_tsfn); +} + +inline napi_status ThreadSafeFunction::Release() const { + return napi_release_threadsafe_function(_tsfn, napi_tsfn_release); +} + +inline napi_status ThreadSafeFunction::Abort() const { + return napi_release_threadsafe_function(_tsfn, napi_tsfn_abort); +} + +inline ThreadSafeFunction::ConvertibleContext ThreadSafeFunction::GetContext() + const { + void* context; + napi_status status = napi_get_threadsafe_function_context(_tsfn, &context); + NAPI_FATAL_IF_FAILED(status, + "ThreadSafeFunction::GetContext", + "napi_get_threadsafe_function_context"); + return ConvertibleContext({context}); +} + +// static +template +inline ThreadSafeFunction ThreadSafeFunction::New(napi_env env, + const Function& callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback, + FinalizerDataType* data, + napi_finalize wrapper) { + static_assert(details::can_make_string::value || + std::is_convertible::value, + "Resource name should be convertible to the string type"); + + ThreadSafeFunction tsfn; + auto* finalizeData = new details:: + ThreadSafeFinalize( + {data, finalizeCallback}); + napi_status status = + napi_create_threadsafe_function(env, + callback, + resource, + Value::From(env, resourceName), + maxQueueSize, + initialThreadCount, + finalizeData, + wrapper, + context, + CallJS, + &tsfn._tsfn); + if (status != napi_ok) { + delete finalizeData; + NAPI_THROW_IF_FAILED(env, status, ThreadSafeFunction()); + } + + return tsfn; +} + +inline napi_status ThreadSafeFunction::CallInternal( + CallbackWrapper* callbackWrapper, + napi_threadsafe_function_call_mode mode) const { + napi_status status = + napi_call_threadsafe_function(_tsfn, callbackWrapper, mode); + if (status != napi_ok && callbackWrapper != nullptr) { + delete callbackWrapper; + } + + return status; +} + +// static +inline void ThreadSafeFunction::CallJS(napi_env env, + napi_value jsCallback, + void* /* context */, + void* data) { + if (env == nullptr && jsCallback == nullptr) { + return; + } + + details::WrapVoidCallback(env, [&]() { + if (data != nullptr) { + auto* callbackWrapper = static_cast(data); + (*callbackWrapper)(env, Function(env, jsCallback)); + delete callbackWrapper; + } else if (jsCallback != nullptr) { + Function(env, jsCallback).Call({}); + } + }); +} + +//////////////////////////////////////////////////////////////////////////////// +// Async Progress Worker Base class +//////////////////////////////////////////////////////////////////////////////// +template +inline AsyncProgressWorkerBase::AsyncProgressWorkerBase( + const Object& receiver, + const Function& callback, + const char* resource_name, + const Object& resource, + size_t queue_size) + : AsyncWorker(receiver, callback, resource_name, resource) { + // Fill all possible arguments to work around ambiguous + // ThreadSafeFunction::New signatures. + _tsfn = ThreadSafeFunction::New(callback.Env(), + callback, + resource, + resource_name, + queue_size, + /** initialThreadCount */ 1, + /** context */ this, + OnThreadSafeFunctionFinalize, + /** finalizeData */ this); +} + +#if NAPI_VERSION > 4 +template +inline AsyncProgressWorkerBase::AsyncProgressWorkerBase( + Napi::Env env, + const char* resource_name, + const Object& resource, + size_t queue_size) + : AsyncWorker(env, resource_name, resource) { + // TODO: Once the changes to make the callback optional for threadsafe + // functions are available on all versions we can remove the dummy Function + // here. + Function callback; + // Fill all possible arguments to work around ambiguous + // ThreadSafeFunction::New signatures. + _tsfn = ThreadSafeFunction::New(env, + callback, + resource, + resource_name, + queue_size, + /** initialThreadCount */ 1, + /** context */ this, + OnThreadSafeFunctionFinalize, + /** finalizeData */ this); +} +#endif + +template +inline AsyncProgressWorkerBase::~AsyncProgressWorkerBase() { + // Abort pending tsfn call. + // Don't send progress events after we've already completed. + // It's ok to call ThreadSafeFunction::Abort and ThreadSafeFunction::Release + // duplicated. + _tsfn.Abort(); +} + +template +inline void AsyncProgressWorkerBase::OnAsyncWorkProgress( + Napi::Env /* env */, Napi::Function /* jsCallback */, void* data) { + ThreadSafeData* tsd = static_cast(data); + tsd->asyncprogressworker()->OnWorkProgress(tsd->data()); + delete tsd; +} + +template +inline napi_status AsyncProgressWorkerBase::NonBlockingCall( + DataType* data) { + auto tsd = new AsyncProgressWorkerBase::ThreadSafeData(this, data); + auto ret = _tsfn.NonBlockingCall(tsd, OnAsyncWorkProgress); + if (ret != napi_ok) { + delete tsd; + } + return ret; +} + +template +inline void AsyncProgressWorkerBase::OnWorkComplete( + Napi::Env /* env */, napi_status status) { + _work_completed = true; + _complete_status = status; + _tsfn.Release(); +} + +template +inline void AsyncProgressWorkerBase::OnThreadSafeFunctionFinalize( + Napi::Env env, void* /* data */, AsyncProgressWorkerBase* context) { + if (context->_work_completed) { + context->AsyncWorker::OnWorkComplete(env, context->_complete_status); + } +} + +//////////////////////////////////////////////////////////////////////////////// +// Async Progress Worker class +//////////////////////////////////////////////////////////////////////////////// +template +inline AsyncProgressWorker::AsyncProgressWorker(const Function& callback) + : AsyncProgressWorker(callback, "generic") {} + +template +inline AsyncProgressWorker::AsyncProgressWorker(const Function& callback, + const char* resource_name) + : AsyncProgressWorker( + callback, resource_name, Object::New(callback.Env())) {} + +template +inline AsyncProgressWorker::AsyncProgressWorker(const Function& callback, + const char* resource_name, + const Object& resource) + : AsyncProgressWorker( + Object::New(callback.Env()), callback, resource_name, resource) {} + +template +inline AsyncProgressWorker::AsyncProgressWorker(const Object& receiver, + const Function& callback) + : AsyncProgressWorker(receiver, callback, "generic") {} + +template +inline AsyncProgressWorker::AsyncProgressWorker(const Object& receiver, + const Function& callback, + const char* resource_name) + : AsyncProgressWorker( + receiver, callback, resource_name, Object::New(callback.Env())) {} + +template +inline AsyncProgressWorker::AsyncProgressWorker(const Object& receiver, + const Function& callback, + const char* resource_name, + const Object& resource) + : AsyncProgressWorkerBase(receiver, callback, resource_name, resource), + _asyncdata(nullptr), + _asyncsize(0), + _signaled(false) {} + +#if NAPI_VERSION > 4 +template +inline AsyncProgressWorker::AsyncProgressWorker(Napi::Env env) + : AsyncProgressWorker(env, "generic") {} + +template +inline AsyncProgressWorker::AsyncProgressWorker(Napi::Env env, + const char* resource_name) + : AsyncProgressWorker(env, resource_name, Object::New(env)) {} + +template +inline AsyncProgressWorker::AsyncProgressWorker(Napi::Env env, + const char* resource_name, + const Object& resource) + : AsyncProgressWorkerBase(env, resource_name, resource), + _asyncdata(nullptr), + _asyncsize(0) {} +#endif + +template +inline AsyncProgressWorker::~AsyncProgressWorker() { + { + std::lock_guard lock(this->_mutex); + _asyncdata = nullptr; + _asyncsize = 0; + } +} + +template +inline void AsyncProgressWorker::Execute() { + ExecutionProgress progress(this); + Execute(progress); +} + +template +inline void AsyncProgressWorker::OnWorkProgress(void*) { + T* data; + size_t size; + bool signaled; + { + std::lock_guard lock(this->_mutex); + data = this->_asyncdata; + size = this->_asyncsize; + signaled = this->_signaled; + this->_asyncdata = nullptr; + this->_asyncsize = 0; + this->_signaled = false; + } + + /** + * The callback of ThreadSafeFunction is not been invoked immediately on the + * callback of uv_async_t (uv io poll), rather the callback of TSFN is + * invoked on the right next uv idle callback. There are chances that during + * the deferring the signal of uv_async_t is been sent again, i.e. potential + * not coalesced two calls of the TSFN callback. + */ + if (data == nullptr && !signaled) { + return; + } + + this->OnProgress(data, size); + delete[] data; +} + +template +inline void AsyncProgressWorker::SendProgress_(const T* data, size_t count) { + T* new_data = new T[count]; + std::copy(data, data + count, new_data); + + T* old_data; + { + std::lock_guard lock(this->_mutex); + old_data = _asyncdata; + _asyncdata = new_data; + _asyncsize = count; + _signaled = false; + } + this->NonBlockingCall(nullptr); + + delete[] old_data; +} + +template +inline void AsyncProgressWorker::Signal() { + { + std::lock_guard lock(this->_mutex); + _signaled = true; + } + this->NonBlockingCall(static_cast(nullptr)); +} + +template +inline void AsyncProgressWorker::ExecutionProgress::Signal() const { + this->_worker->Signal(); +} + +template +inline void AsyncProgressWorker::ExecutionProgress::Send( + const T* data, size_t count) const { + _worker->SendProgress_(data, count); +} + +//////////////////////////////////////////////////////////////////////////////// +// Async Progress Queue Worker class +//////////////////////////////////////////////////////////////////////////////// +template +inline AsyncProgressQueueWorker::AsyncProgressQueueWorker( + const Function& callback) + : AsyncProgressQueueWorker(callback, "generic") {} + +template +inline AsyncProgressQueueWorker::AsyncProgressQueueWorker( + const Function& callback, const char* resource_name) + : AsyncProgressQueueWorker( + callback, resource_name, Object::New(callback.Env())) {} + +template +inline AsyncProgressQueueWorker::AsyncProgressQueueWorker( + const Function& callback, const char* resource_name, const Object& resource) + : AsyncProgressQueueWorker( + Object::New(callback.Env()), callback, resource_name, resource) {} + +template +inline AsyncProgressQueueWorker::AsyncProgressQueueWorker( + const Object& receiver, const Function& callback) + : AsyncProgressQueueWorker(receiver, callback, "generic") {} + +template +inline AsyncProgressQueueWorker::AsyncProgressQueueWorker( + const Object& receiver, const Function& callback, const char* resource_name) + : AsyncProgressQueueWorker( + receiver, callback, resource_name, Object::New(callback.Env())) {} + +template +inline AsyncProgressQueueWorker::AsyncProgressQueueWorker( + const Object& receiver, + const Function& callback, + const char* resource_name, + const Object& resource) + : AsyncProgressWorkerBase>( + receiver, + callback, + resource_name, + resource, + /** unlimited queue size */ 0) {} + +#if NAPI_VERSION > 4 +template +inline AsyncProgressQueueWorker::AsyncProgressQueueWorker(Napi::Env env) + : AsyncProgressQueueWorker(env, "generic") {} + +template +inline AsyncProgressQueueWorker::AsyncProgressQueueWorker( + Napi::Env env, const char* resource_name) + : AsyncProgressQueueWorker(env, resource_name, Object::New(env)) {} + +template +inline AsyncProgressQueueWorker::AsyncProgressQueueWorker( + Napi::Env env, const char* resource_name, const Object& resource) + : AsyncProgressWorkerBase>( + env, resource_name, resource, /** unlimited queue size */ 0) {} +#endif + +template +inline void AsyncProgressQueueWorker::Execute() { + ExecutionProgress progress(this); + Execute(progress); +} + +template +inline void AsyncProgressQueueWorker::OnWorkProgress( + std::pair* datapair) { + if (datapair == nullptr) { + return; + } + + T* data = datapair->first; + size_t size = datapair->second; + + this->OnProgress(data, size); + delete datapair; + delete[] data; +} + +template +inline void AsyncProgressQueueWorker::SendProgress_(const T* data, + size_t count) { + T* new_data = new T[count]; + std::copy(data, data + count, new_data); + + auto pair = new std::pair(new_data, count); + this->NonBlockingCall(pair); +} + +template +inline void AsyncProgressQueueWorker::Signal() const { + this->SendProgress_(static_cast(nullptr), 0); +} + +template +inline void AsyncProgressQueueWorker::OnWorkComplete(Napi::Env env, + napi_status status) { + // Draining queued items in TSFN. + AsyncProgressWorkerBase>::OnWorkComplete(env, status); +} + +template +inline void AsyncProgressQueueWorker::ExecutionProgress::Signal() const { + _worker->SendProgress_(static_cast(nullptr), 0); +} + +template +inline void AsyncProgressQueueWorker::ExecutionProgress::Send( + const T* data, size_t count) const { + _worker->SendProgress_(data, count); +} +#endif // NAPI_VERSION > 3 && NAPI_HAS_THREADS + +//////////////////////////////////////////////////////////////////////////////// +// Memory Management class +//////////////////////////////////////////////////////////////////////////////// + +inline int64_t MemoryManagement::AdjustExternalMemory(BasicEnv env, + int64_t change_in_bytes) { + int64_t result; + napi_status status = + napi_adjust_external_memory(env, change_in_bytes, &result); + NAPI_FATAL_IF_FAILED(status, + "MemoryManagement::AdjustExternalMemory", + "napi_adjust_external_memory"); + return result; +} + +//////////////////////////////////////////////////////////////////////////////// +// Version Management class +//////////////////////////////////////////////////////////////////////////////// + +inline uint32_t VersionManagement::GetNapiVersion(BasicEnv env) { + uint32_t result; + napi_status status = napi_get_version(env, &result); + NAPI_FATAL_IF_FAILED( + status, "VersionManagement::GetNapiVersion", "napi_get_version"); + return result; +} + +inline const napi_node_version* VersionManagement::GetNodeVersion( + BasicEnv env) { + const napi_node_version* result; + napi_status status = napi_get_node_version(env, &result); + NAPI_FATAL_IF_FAILED( + status, "VersionManagement::GetNodeVersion", "napi_get_node_version"); + return result; +} + +#if NAPI_VERSION > 5 +//////////////////////////////////////////////////////////////////////////////// +// Addon class +//////////////////////////////////////////////////////////////////////////////// + +template +inline Object Addon::Init(Env env, Object exports) { + T* addon = new T(env, exports); + env.SetInstanceData(addon); + return addon->entry_point_; +} + +template +inline T* Addon::Unwrap(Object wrapper) { + return wrapper.Env().GetInstanceData(); +} + +template +inline void Addon::DefineAddon( + Object exports, const std::initializer_list& props) { + DefineProperties(exports, props); + entry_point_ = exports; +} + +template +inline Napi::Object Addon::DefineProperties( + Object object, const std::initializer_list& props) { + const napi_property_descriptor* properties = + reinterpret_cast(props.begin()); + size_t size = props.size(); + napi_status status = + napi_define_properties(object.Env(), object, size, properties); + NAPI_THROW_IF_FAILED(object.Env(), status, object); + for (size_t idx = 0; idx < size; idx++) + T::AttachPropData(object.Env(), object, &properties[idx]); + return object; +} +#endif // NAPI_VERSION > 5 + +#if NAPI_VERSION > 2 +template +Env::CleanupHook BasicEnv::AddCleanupHook(Hook hook, Arg* arg) { + return CleanupHook(*this, hook, arg); +} + +template +Env::CleanupHook BasicEnv::AddCleanupHook(Hook hook) { + return CleanupHook(*this, hook); +} + +template +Env::CleanupHook::CleanupHook() { + data = nullptr; +} + +template +Env::CleanupHook::CleanupHook(Napi::BasicEnv env, Hook hook) + : wrapper(Env::CleanupHook::Wrapper) { + data = new CleanupData{std::move(hook), nullptr}; + napi_status status = napi_add_env_cleanup_hook(env, wrapper, data); + if (status != napi_ok) { + delete data; + data = nullptr; + } +} + +template +Env::CleanupHook::CleanupHook(Napi::BasicEnv env, + Hook hook, + Arg* arg) + : wrapper(Env::CleanupHook::WrapperWithArg) { + data = new CleanupData{std::move(hook), arg}; + napi_status status = napi_add_env_cleanup_hook(env, wrapper, data); + if (status != napi_ok) { + delete data; + data = nullptr; + } +} + +template +bool Env::CleanupHook::Remove(BasicEnv env) { + napi_status status = napi_remove_env_cleanup_hook(env, wrapper, data); + delete data; + data = nullptr; + return status == napi_ok; +} + +template +bool Env::CleanupHook::IsEmpty() const { + return data == nullptr; +} +#endif // NAPI_VERSION > 2 + +#ifdef NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER +template +inline void BasicEnv::PostFinalizer(FinalizerType finalizeCallback) const { + using T = void*; + details::FinalizeData* finalizeData = + new details::FinalizeData( + {std::move(finalizeCallback), nullptr}); + + napi_status status = node_api_post_finalizer( + _env, + details::FinalizeData::WrapperGCWithoutData, + static_cast(nullptr), + finalizeData); + if (status != napi_ok) { + delete finalizeData; + NAPI_FATAL_IF_FAILED( + status, "BasicEnv::PostFinalizer", "invalid arguments"); + } +} + +template +inline void BasicEnv::PostFinalizer(FinalizerType finalizeCallback, + T* data) const { + details::FinalizeData* finalizeData = + new details::FinalizeData( + {std::move(finalizeCallback), nullptr}); + + napi_status status = node_api_post_finalizer( + _env, + details::FinalizeData::WrapperGC, + data, + finalizeData); + if (status != napi_ok) { + delete finalizeData; + NAPI_FATAL_IF_FAILED( + status, "BasicEnv::PostFinalizer", "invalid arguments"); + } +} + +template +inline void BasicEnv::PostFinalizer(FinalizerType finalizeCallback, + T* data, + Hint* finalizeHint) const { + details::FinalizeData* finalizeData = + new details::FinalizeData( + {std::move(finalizeCallback), finalizeHint}); + napi_status status = node_api_post_finalizer( + _env, + details::FinalizeData::WrapperGCWithHint, + data, + finalizeData); + if (status != napi_ok) { + delete finalizeData; + NAPI_FATAL_IF_FAILED( + status, "BasicEnv::PostFinalizer", "invalid arguments"); + } +} +#endif // NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER + +#ifdef NAPI_CPP_CUSTOM_NAMESPACE +} // namespace NAPI_CPP_CUSTOM_NAMESPACE +#endif + +} // namespace Napi + +#undef NAPI_NO_SANITIZE_VPTR + +#endif // SRC_NAPI_INL_H_ diff --git a/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/napi.h b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/napi.h new file mode 100644 index 0000000..013a911 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/napi.h @@ -0,0 +1,3327 @@ +#ifndef SRC_NAPI_H_ +#define SRC_NAPI_H_ + +#ifndef NAPI_HAS_THREADS +#if !defined(__wasm__) || (defined(__EMSCRIPTEN_PTHREADS__) || \ + (defined(__wasi__) && defined(_REENTRANT))) +#define NAPI_HAS_THREADS 1 +#else +#define NAPI_HAS_THREADS 0 +#endif +#endif + +#include +#include +#include +#include +#if NAPI_HAS_THREADS +#include +#endif // NAPI_HAS_THREADS +#include +#include + +// VS2015 RTM has bugs with constexpr, so require min of VS2015 Update 3 (known +// good version) +#if !defined(_MSC_VER) || _MSC_FULL_VER >= 190024210 +#define NAPI_HAS_CONSTEXPR 1 +#endif + +// VS2013 does not support char16_t literal strings, so we'll work around it +// using wchar_t strings and casting them. This is safe as long as the character +// sizes are the same. +#if defined(_MSC_VER) && _MSC_VER <= 1800 +static_assert(sizeof(char16_t) == sizeof(wchar_t), + "Size mismatch between char16_t and wchar_t"); +#define NAPI_WIDE_TEXT(x) reinterpret_cast(L##x) +#else +#define NAPI_WIDE_TEXT(x) u##x +#endif + +// Backwards-compatibility to handle the rename of this macro definition, in +// case they are used within userland code. +#ifdef NAPI_CPP_EXCEPTIONS +#define NODE_ADDON_API_CPP_EXCEPTIONS +#endif +#if defined(NODE_ADDON_API_CPP_EXCEPTIONS) && !defined(NAPI_CPP_EXCEPTIONS) +#define NAPI_CPP_EXCEPTIONS +#endif +#ifdef NAPI_DISABLE_CPP_EXCEPTIONS +#define NODE_ADDON_API_DISABLE_CPP_EXCEPTIONS +#endif +#if defined(NODE_ADDON_API_DISABLE_CPP_EXCEPTIONS) && \ + !defined(NAPI_DISABLE_CPP_EXCEPTIONS) +#define NAPI_DISABLE_CPP_EXCEPTIONS +#endif + +// If C++ exceptions are not explicitly enabled or disabled, enable them +// if exceptions were enabled in the compiler settings. +#if !defined(NODE_ADDON_API_CPP_EXCEPTIONS) && \ + !defined(NODE_ADDON_API_DISABLE_CPP_EXCEPTIONS) +#if defined(_CPPUNWIND) || defined(__EXCEPTIONS) +#define NODE_ADDON_API_CPP_EXCEPTIONS +#else +#error Exception support not detected. \ + Define either NODE_ADDON_API_CPP_EXCEPTIONS or NODE_ADDON_API_DISABLE_CPP_EXCEPTIONS. +#endif +#endif + +// If C++ NODE_ADDON_API_CPP_EXCEPTIONS are enabled, NODE_ADDON_API_ENABLE_MAYBE +// should not be set +#if defined(NODE_ADDON_API_CPP_EXCEPTIONS) && \ + defined(NODE_ADDON_API_ENABLE_MAYBE) +#error NODE_ADDON_API_ENABLE_MAYBE should not be set when \ + NODE_ADDON_API_CPP_EXCEPTIONS is defined. +#endif + +#ifdef _NOEXCEPT +#define NAPI_NOEXCEPT _NOEXCEPT +#else +#define NAPI_NOEXCEPT noexcept +#endif + +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS + +// When C++ exceptions are enabled, Errors are thrown directly. There is no need +// to return anything after the throw statements. The variadic parameter is an +// optional return value that is ignored. +// We need _VOID versions of the macros to avoid warnings resulting from +// leaving the NAPI_THROW_* `...` argument empty. + +#define NAPI_THROW(e, ...) throw e +#define NAPI_THROW_VOID(e) throw e + +#define NAPI_THROW_IF_FAILED(env, status, ...) \ + if ((status) != napi_ok) throw Napi::Error::New(env); + +#define NAPI_THROW_IF_FAILED_VOID(env, status) \ + if ((status) != napi_ok) throw Napi::Error::New(env); + +#else // NODE_ADDON_API_CPP_EXCEPTIONS + +// When C++ exceptions are disabled, Errors are thrown as JavaScript exceptions, +// which are pending until the callback returns to JS. The variadic parameter +// is an optional return value; usually it is an empty result. +// We need _VOID versions of the macros to avoid warnings resulting from +// leaving the NAPI_THROW_* `...` argument empty. + +#define NAPI_THROW(e, ...) \ + do { \ + (e).ThrowAsJavaScriptException(); \ + return __VA_ARGS__; \ + } while (0) + +#define NAPI_THROW_VOID(e) \ + do { \ + (e).ThrowAsJavaScriptException(); \ + return; \ + } while (0) + +#define NAPI_THROW_IF_FAILED(env, status, ...) \ + if ((status) != napi_ok) { \ + Napi::Error::New(env).ThrowAsJavaScriptException(); \ + return __VA_ARGS__; \ + } + +#define NAPI_THROW_IF_FAILED_VOID(env, status) \ + if ((status) != napi_ok) { \ + Napi::Error::New(env).ThrowAsJavaScriptException(); \ + return; \ + } + +#endif // NODE_ADDON_API_CPP_EXCEPTIONS + +#ifdef NODE_ADDON_API_ENABLE_MAYBE +#define NAPI_MAYBE_THROW_IF_FAILED(env, status, type) \ + NAPI_THROW_IF_FAILED(env, status, Napi::Nothing()) + +#define NAPI_RETURN_OR_THROW_IF_FAILED(env, status, result, type) \ + NAPI_MAYBE_THROW_IF_FAILED(env, status, type); \ + return Napi::Just(result); +#else +#define NAPI_MAYBE_THROW_IF_FAILED(env, status, type) \ + NAPI_THROW_IF_FAILED(env, status, type()) + +#define NAPI_RETURN_OR_THROW_IF_FAILED(env, status, result, type) \ + NAPI_MAYBE_THROW_IF_FAILED(env, status, type); \ + return result; +#endif + +#define NAPI_DISALLOW_ASSIGN(CLASS) void operator=(const CLASS&) = delete; +#define NAPI_DISALLOW_COPY(CLASS) CLASS(const CLASS&) = delete; + +#define NAPI_DISALLOW_ASSIGN_COPY(CLASS) \ + NAPI_DISALLOW_ASSIGN(CLASS) \ + NAPI_DISALLOW_COPY(CLASS) + +#define NAPI_CHECK(condition, location, message) \ + do { \ + if (!(condition)) { \ + Napi::Error::Fatal((location), (message)); \ + } \ + } while (0) + +// Internal check helper. Be careful that the formatted message length should be +// max 255 size and null terminated. +#define NAPI_INTERNAL_CHECK(expr, location, ...) \ + do { \ + if (!(expr)) { \ + std::string msg = Napi::details::StringFormat(__VA_ARGS__); \ + Napi::Error::Fatal(location, msg.c_str()); \ + } \ + } while (0) + +#define NAPI_INTERNAL_CHECK_EQ(actual, expected, value_format, location) \ + do { \ + auto actual_value = (actual); \ + NAPI_INTERNAL_CHECK(actual_value == (expected), \ + location, \ + "Expected " #actual " to be equal to " #expected \ + ", but got " value_format ".", \ + actual_value); \ + } while (0) + +#define NAPI_FATAL_IF_FAILED(status, location, message) \ + NAPI_CHECK((status) == napi_ok, location, message) + +//////////////////////////////////////////////////////////////////////////////// +/// Node-API C++ Wrapper Classes +/// +/// These classes wrap the "Node-API" ABI-stable C APIs for Node.js, providing a +/// C++ object model and C++ exception-handling semantics with low overhead. +/// The wrappers are all header-only so that they do not affect the ABI. +//////////////////////////////////////////////////////////////////////////////// +namespace Napi { + +#ifdef NAPI_CPP_CUSTOM_NAMESPACE +// NAPI_CPP_CUSTOM_NAMESPACE can be #define'd per-addon to avoid symbol +// conflicts between different instances of node-addon-api + +// First dummy definition of the namespace to make sure that Napi::(name) still +// refers to the right things inside this file. +namespace NAPI_CPP_CUSTOM_NAMESPACE {} +using namespace NAPI_CPP_CUSTOM_NAMESPACE; + +namespace NAPI_CPP_CUSTOM_NAMESPACE { +#endif + +// Forward declarations +class Env; +class Value; +class Boolean; +class Number; +#if NAPI_VERSION > 5 +class BigInt; +#endif // NAPI_VERSION > 5 +#if (NAPI_VERSION > 4) +class Date; +#endif +class String; +class Object; +class Array; +class ArrayBuffer; +class Function; +class Error; +class PropertyDescriptor; +class CallbackInfo; +class TypedArray; +template +class TypedArrayOf; + +using Int8Array = + TypedArrayOf; ///< Typed-array of signed 8-bit integers +using Uint8Array = + TypedArrayOf; ///< Typed-array of unsigned 8-bit integers +using Int16Array = + TypedArrayOf; ///< Typed-array of signed 16-bit integers +using Uint16Array = + TypedArrayOf; ///< Typed-array of unsigned 16-bit integers +using Int32Array = + TypedArrayOf; ///< Typed-array of signed 32-bit integers +using Uint32Array = + TypedArrayOf; ///< Typed-array of unsigned 32-bit integers +using Float32Array = + TypedArrayOf; ///< Typed-array of 32-bit floating-point values +using Float64Array = + TypedArrayOf; ///< Typed-array of 64-bit floating-point values +#if NAPI_VERSION > 5 +using BigInt64Array = + TypedArrayOf; ///< Typed array of signed 64-bit integers +using BigUint64Array = + TypedArrayOf; ///< Typed array of unsigned 64-bit integers +#endif // NAPI_VERSION > 5 + +/// Defines the signature of a Node-API C++ module's registration callback +/// (init) function. +using ModuleRegisterCallback = Object (*)(Env env, Object exports); + +class MemoryManagement; + +/// A simple Maybe type, representing an object which may or may not have a +/// value. +/// +/// If an API method returns a Maybe<>, the API method can potentially fail +/// either because an exception is thrown, or because an exception is pending, +/// e.g. because a previous API call threw an exception that hasn't been +/// caught yet. In that case, a "Nothing" value is returned. +template +class Maybe { + public: + bool IsNothing() const; + bool IsJust() const; + + /// Short-hand for Unwrap(), which doesn't return a value. Could be used + /// where the actual value of the Maybe is not needed like Object::Set. + /// If this Maybe is nothing (empty), node-addon-api will crash the + /// process. + void Check() const; + + /// Return the value of type T contained in the Maybe. If this Maybe is + /// nothing (empty), node-addon-api will crash the process. + T Unwrap() const; + + /// Return the value of type T contained in the Maybe, or using a default + /// value if this Maybe is nothing (empty). + T UnwrapOr(const T& default_value) const; + + /// Converts this Maybe to a value of type T in the out. If this Maybe is + /// nothing (empty), `false` is returned and `out` is left untouched. + bool UnwrapTo(T* out) const; + + bool operator==(const Maybe& other) const; + bool operator!=(const Maybe& other) const; + + private: + Maybe(); + explicit Maybe(const T& t); + + bool _has_value; + T _value; + + template + friend Maybe Nothing(); + template + friend Maybe Just(const U& u); +}; + +template +inline Maybe Nothing(); + +template +inline Maybe Just(const T& t); + +#if defined(NODE_ADDON_API_ENABLE_MAYBE) +template +using MaybeOrValue = Maybe; +#else +template +using MaybeOrValue = T; +#endif + +#ifdef NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER +using node_addon_api_basic_env = node_api_nogc_env; +using node_addon_api_basic_finalize = node_api_nogc_finalize; +#else +using node_addon_api_basic_env = napi_env; +using node_addon_api_basic_finalize = napi_finalize; +#endif + +/// Environment for Node-API values and operations. +/// +/// All Node-API values and operations must be associated with an environment. +/// An environment instance is always provided to callback functions; that +/// environment must then be used for any creation of Node-API values or other +/// Node-API operations within the callback. (Many methods infer the +/// environment from the `this` instance that the method is called on.) +/// +/// Multiple environments may co-exist in a single process or a thread. +/// +/// In the V8 JavaScript engine, a Node-API environment approximately +/// corresponds to an Isolate. +class BasicEnv { + private: + node_addon_api_basic_env _env; +#if NAPI_VERSION > 5 + template + static void DefaultFini(Env, T* data); + template + static void DefaultFiniWithHint(Env, DataType* data, HintType* hint); +#endif // NAPI_VERSION > 5 + public: + BasicEnv(node_addon_api_basic_env env); + + operator node_addon_api_basic_env() const; + + // Without these operator overloads, the error: + // + // Use of overloaded operator '==' is ambiguous (with operand types + // 'Napi::Env' and 'Napi::Env') + // + // ... occurs when comparing foo.Env() == bar.Env() or foo.Env() == nullptr + bool operator==(const BasicEnv& other) const { + return _env == other._env; + }; + bool operator==(std::nullptr_t /*other*/) const { + return _env == nullptr; + }; + +#if NAPI_VERSION > 2 + template + class CleanupHook; + + template + CleanupHook AddCleanupHook(Hook hook); + + template + CleanupHook AddCleanupHook(Hook hook, Arg* arg); +#endif // NAPI_VERSION > 2 + +#if NAPI_VERSION > 5 + template + T* GetInstanceData() const; + + template + using Finalizer = void (*)(Env, T*); + template fini = BasicEnv::DefaultFini> + void SetInstanceData(T* data) const; + + template + using FinalizerWithHint = void (*)(Env, DataType*, HintType*); + template fini = + BasicEnv::DefaultFiniWithHint> + void SetInstanceData(DataType* data, HintType* hint) const; +#endif // NAPI_VERSION > 5 + +#if NAPI_VERSION > 2 + template + class CleanupHook { + public: + CleanupHook(); + CleanupHook(BasicEnv env, Hook hook, Arg* arg); + CleanupHook(BasicEnv env, Hook hook); + bool Remove(BasicEnv env); + bool IsEmpty() const; + + private: + static inline void Wrapper(void* data) NAPI_NOEXCEPT; + static inline void WrapperWithArg(void* data) NAPI_NOEXCEPT; + + void (*wrapper)(void* arg); + struct CleanupData { + Hook hook; + Arg* arg; + } * data; + }; +#endif // NAPI_VERSION > 2 + +#if NAPI_VERSION > 8 + const char* GetModuleFileName() const; +#endif // NAPI_VERSION > 8 + +#ifdef NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER + template + inline void PostFinalizer(FinalizerType finalizeCallback) const; + + template + inline void PostFinalizer(FinalizerType finalizeCallback, T* data) const; + + template + inline void PostFinalizer(FinalizerType finalizeCallback, + T* data, + Hint* finalizeHint) const; +#endif // NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER + + friend class Env; +}; + +class Env : public BasicEnv { + public: + Env(napi_env env); + + operator napi_env() const; + + Object Global() const; + Value Undefined() const; + Value Null() const; + + bool IsExceptionPending() const; + Error GetAndClearPendingException() const; + + MaybeOrValue RunScript(const char* utf8script) const; + MaybeOrValue RunScript(const std::string& utf8script) const; + MaybeOrValue RunScript(String script) const; +}; + +/// A JavaScript value of unknown type. +/// +/// For type-specific operations, convert to one of the Value subclasses using a +/// `To*` or `As()` method. The `To*` methods do type coercion; the `As()` +/// method does not. +/// +/// Napi::Value value = ... +/// if (!value.IsString()) throw Napi::TypeError::New(env, "Invalid +/// arg..."); Napi::String str = value.As(); // Cast to a +/// string value +/// +/// Napi::Value anotherValue = ... +/// bool isTruthy = anotherValue.ToBoolean(); // Coerce to a boolean value +class Value { + public: + Value(); ///< Creates a new _empty_ Value instance. + Value(napi_env env, + napi_value value); ///< Wraps a Node-API value primitive. + + /// Creates a JS value from a C++ primitive. + /// + /// `value` may be any of: + /// - bool + /// - Any integer type + /// - Any floating point type + /// - const char* (encoded using UTF-8, null-terminated) + /// - const char16_t* (encoded using UTF-16-LE, null-terminated) + /// - std::string (encoded using UTF-8) + /// - std::u16string + /// - napi::Value + /// - napi_value + template + static Value From(napi_env env, const T& value); + + static void CheckCast(napi_env env, napi_value value); + + /// Converts to a Node-API value primitive. + /// + /// If the instance is _empty_, this returns `nullptr`. + operator napi_value() const; + + /// Tests if this value strictly equals another value. + bool operator==(const Value& other) const; + + /// Tests if this value does not strictly equal another value. + bool operator!=(const Value& other) const; + + /// Tests if this value strictly equals another value. + bool StrictEquals(const Value& other) const; + + /// Gets the environment the value is associated with. + Napi::Env Env() const; + + /// Checks if the value is empty (uninitialized). + /// + /// An empty value is invalid, and most attempts to perform an operation on an + /// empty value will result in an exception. Note an empty value is distinct + /// from JavaScript `null` or `undefined`, which are valid values. + /// + /// When C++ exceptions are disabled at compile time, a method with a `Value` + /// return type may return an empty value to indicate a pending exception. So + /// when not using C++ exceptions, callers should check whether the value is + /// empty before attempting to use it. + bool IsEmpty() const; + + napi_valuetype Type() const; ///< Gets the type of the value. + + bool IsUndefined() + const; ///< Tests if a value is an undefined JavaScript value. + bool IsNull() const; ///< Tests if a value is a null JavaScript value. + bool IsBoolean() const; ///< Tests if a value is a JavaScript boolean. + bool IsNumber() const; ///< Tests if a value is a JavaScript number. +#if NAPI_VERSION > 5 + bool IsBigInt() const; ///< Tests if a value is a JavaScript bigint. +#endif // NAPI_VERSION > 5 +#if (NAPI_VERSION > 4) + bool IsDate() const; ///< Tests if a value is a JavaScript date. +#endif + bool IsString() const; ///< Tests if a value is a JavaScript string. + bool IsSymbol() const; ///< Tests if a value is a JavaScript symbol. + bool IsArray() const; ///< Tests if a value is a JavaScript array. + bool IsArrayBuffer() + const; ///< Tests if a value is a JavaScript array buffer. + bool IsTypedArray() const; ///< Tests if a value is a JavaScript typed array. + bool IsObject() const; ///< Tests if a value is a JavaScript object. + bool IsFunction() const; ///< Tests if a value is a JavaScript function. + bool IsPromise() const; ///< Tests if a value is a JavaScript promise. + bool IsDataView() const; ///< Tests if a value is a JavaScript data view. + bool IsBuffer() const; ///< Tests if a value is a Node buffer. + bool IsExternal() const; ///< Tests if a value is a pointer to external data. +#ifdef NODE_API_EXPERIMENTAL_HAS_SHAREDARRAYBUFFER + bool IsSharedArrayBuffer() const; +#endif + + /// Casts to another type of `Napi::Value`, when the actual type is known or + /// assumed. + /// + /// This conversion does NOT coerce the type. Calling any methods + /// inappropriate for the actual value type will throw `Napi::Error`. + /// + /// If `NODE_ADDON_API_ENABLE_TYPE_CHECK_ON_AS` is defined, this method + /// asserts that the actual type is the expected type. + template + T As() const; + + // Unsafe Value::As(), should be avoided. + template + T UnsafeAs() const; + + MaybeOrValue ToBoolean() + const; ///< Coerces a value to a JavaScript boolean. + MaybeOrValue ToNumber() + const; ///< Coerces a value to a JavaScript number. + MaybeOrValue ToString() + const; ///< Coerces a value to a JavaScript string. + MaybeOrValue ToObject() + const; ///< Coerces a value to a JavaScript object. + + protected: + /// !cond INTERNAL + napi_env _env; + napi_value _value; + /// !endcond +}; + +/// A JavaScript boolean value. +class Boolean : public Value { + public: + static Boolean New(napi_env env, ///< Node-API environment + bool value ///< Boolean value + ); + + static void CheckCast(napi_env env, napi_value value); + + Boolean(); ///< Creates a new _empty_ Boolean instance. + Boolean(napi_env env, + napi_value value); ///< Wraps a Node-API value primitive. + + operator bool() const; ///< Converts a Boolean value to a boolean primitive. + bool Value() const; ///< Converts a Boolean value to a boolean primitive. +}; + +/// A JavaScript number value. +class Number : public Value { + public: + static Number New(napi_env env, ///< Node-API environment + double value ///< Number value + ); + + static void CheckCast(napi_env env, napi_value value); + + Number(); ///< Creates a new _empty_ Number instance. + Number(napi_env env, + napi_value value); ///< Wraps a Node-API value primitive. + + operator int32_t() + const; ///< Converts a Number value to a 32-bit signed integer value. + operator uint32_t() + const; ///< Converts a Number value to a 32-bit unsigned integer value. + operator int64_t() + const; ///< Converts a Number value to a 64-bit signed integer value. + operator float() + const; ///< Converts a Number value to a 32-bit floating-point value. + operator double() + const; ///< Converts a Number value to a 64-bit floating-point value. + + int32_t Int32Value() + const; ///< Converts a Number value to a 32-bit signed integer value. + uint32_t Uint32Value() + const; ///< Converts a Number value to a 32-bit unsigned integer value. + int64_t Int64Value() + const; ///< Converts a Number value to a 64-bit signed integer value. + float FloatValue() + const; ///< Converts a Number value to a 32-bit floating-point value. + double DoubleValue() + const; ///< Converts a Number value to a 64-bit floating-point value. +}; + +#if NAPI_VERSION > 5 +/// A JavaScript bigint value. +class BigInt : public Value { + public: + static BigInt New(napi_env env, ///< Node-API environment + int64_t value ///< Number value + ); + static BigInt New(napi_env env, ///< Node-API environment + uint64_t value ///< Number value + ); + + /// Creates a new BigInt object using a specified sign bit and a + /// specified list of digits/words. + /// The resulting number is calculated as: + /// (-1)^sign_bit * (words[0] * (2^64)^0 + words[1] * (2^64)^1 + ...) + static BigInt New(napi_env env, ///< Node-API environment + int sign_bit, ///< Sign bit. 1 if negative. + size_t word_count, ///< Number of words in array + const uint64_t* words ///< Array of words + ); + + static void CheckCast(napi_env env, napi_value value); + + BigInt(); ///< Creates a new _empty_ BigInt instance. + BigInt(napi_env env, + napi_value value); ///< Wraps a Node-API value primitive. + + int64_t Int64Value(bool* lossless) + const; ///< Converts a BigInt value to a 64-bit signed integer value. + uint64_t Uint64Value(bool* lossless) + const; ///< Converts a BigInt value to a 64-bit unsigned integer value. + + size_t WordCount() const; ///< The number of 64-bit words needed to store + ///< the result of ToWords(). + + /// Writes the contents of this BigInt to a specified memory location. + /// `sign_bit` must be provided and will be set to 1 if this BigInt is + /// negative. + /// `*word_count` has to be initialized to the length of the `words` array. + /// Upon return, it will be set to the actual number of words that would + /// be needed to store this BigInt (i.e. the return value of `WordCount()`). + void ToWords(int* sign_bit, size_t* word_count, uint64_t* words); +}; +#endif // NAPI_VERSION > 5 + +#if (NAPI_VERSION > 4) +/// A JavaScript date value. +class Date : public Value { + public: + /// Creates a new Date value from a double primitive. + static Date New(napi_env env, ///< Node-API environment + double value ///< Number value + ); + + static void CheckCast(napi_env env, napi_value value); + + Date(); ///< Creates a new _empty_ Date instance. + Date(napi_env env, napi_value value); ///< Wraps a Node-API value primitive. + operator double() const; ///< Converts a Date value to double primitive + + double ValueOf() const; ///< Converts a Date value to a double primitive. +}; +#endif + +/// A JavaScript string or symbol value (that can be used as a property name). +class Name : public Value { + public: + static void CheckCast(napi_env env, napi_value value); + + Name(); ///< Creates a new _empty_ Name instance. + Name(napi_env env, + napi_value value); ///< Wraps a Node-API value primitive. +}; + +/// A JavaScript string value. +class String : public Name { + public: + /// Creates a new String value from a UTF-8 encoded C++ string. + static String New(napi_env env, ///< Node-API environment + const std::string& value ///< UTF-8 encoded C++ string + ); + + /// Creates a new String value from a UTF-16 encoded C++ string. + static String New(napi_env env, ///< Node-API environment + const std::u16string& value ///< UTF-16 encoded C++ string + ); + + /// Creates a new String value from a UTF-8 encoded C string. + static String New( + napi_env env, ///< Node-API environment + const char* value ///< UTF-8 encoded null-terminated C string + ); + + /// Creates a new String value from a UTF-16 encoded C string. + static String New( + napi_env env, ///< Node-API environment + const char16_t* value ///< UTF-16 encoded null-terminated C string + ); + + /// Creates a new String value from a UTF-8 encoded C string with specified + /// length. + static String New(napi_env env, ///< Node-API environment + const char* value, ///< UTF-8 encoded C string (not + ///< necessarily null-terminated) + size_t length ///< length of the string in bytes + ); + + /// Creates a new String value from a UTF-16 encoded C string with specified + /// length. + static String New( + napi_env env, ///< Node-API environment + const char16_t* value, ///< UTF-16 encoded C string (not necessarily + ///< null-terminated) + size_t length ///< Length of the string in 2-byte code units + ); + + /// Creates a new String based on the original object's type. + /// + /// `value` may be any of: + /// - const char* (encoded using UTF-8, null-terminated) + /// - const char16_t* (encoded using UTF-16-LE, null-terminated) + /// - std::string (encoded using UTF-8) + /// - std::u16string + template + static String From(napi_env env, const T& value); + + static void CheckCast(napi_env env, napi_value value); + + String(); ///< Creates a new _empty_ String instance. + String(napi_env env, + napi_value value); ///< Wraps a Node-API value primitive. + + operator std::string() + const; ///< Converts a String value to a UTF-8 encoded C++ string. + operator std::u16string() + const; ///< Converts a String value to a UTF-16 encoded C++ string. + std::string Utf8Value() + const; ///< Converts a String value to a UTF-8 encoded C++ string. + std::u16string Utf16Value() + const; ///< Converts a String value to a UTF-16 encoded C++ string. +}; + +/// A JavaScript symbol value. +class Symbol : public Name { + public: + /// Creates a new Symbol value with an optional description. + static Symbol New( + napi_env env, ///< Node-API environment + const char* description = + nullptr ///< Optional UTF-8 encoded null-terminated C string + /// describing the symbol + ); + + /// Creates a new Symbol value with a description. + static Symbol New( + napi_env env, ///< Node-API environment + const std::string& + description ///< UTF-8 encoded C++ string describing the symbol + ); + + /// Creates a new Symbol value with a description. + static Symbol New(napi_env env, ///< Node-API environment + String description ///< String value describing the symbol + ); + + /// Creates a new Symbol value with a description. + static Symbol New( + napi_env env, ///< Node-API environment + napi_value description ///< String value describing the symbol + ); + + /// Get a public Symbol (e.g. Symbol.iterator). + static MaybeOrValue WellKnown(napi_env, const std::string& name); + + // Create a symbol in the global registry, UTF-8 Encoded cpp string + static MaybeOrValue For(napi_env env, const std::string& description); + + // Create a symbol in the global registry, C style string (null terminated) + static MaybeOrValue For(napi_env env, const char* description); + + // Create a symbol in the global registry, String value describing the symbol + static MaybeOrValue For(napi_env env, String description); + + // Create a symbol in the global registry, napi_value describing the symbol + static MaybeOrValue For(napi_env env, napi_value description); + + static void CheckCast(napi_env env, napi_value value); + + Symbol(); ///< Creates a new _empty_ Symbol instance. + Symbol(napi_env env, + napi_value value); ///< Wraps a Node-API value primitive. +}; + +class TypeTaggable : public Value { + public: +#if NAPI_VERSION >= 8 + void TypeTag(const napi_type_tag* type_tag) const; + bool CheckTypeTag(const napi_type_tag* type_tag) const; +#endif // NAPI_VERSION >= 8 + protected: + TypeTaggable(); + TypeTaggable(napi_env env, napi_value value); +}; + +/// A JavaScript object value. +class Object : public TypeTaggable { + public: + /// Enables property and element assignments using indexing syntax. + /// + /// This is a convenient helper to get and set object properties. As + /// getting and setting object properties may throw with JavaScript + /// exceptions, it is notable that these operations may fail. + /// When NODE_ADDON_API_ENABLE_MAYBE is defined, the process will abort + /// on JavaScript exceptions. + /// + /// Example: + /// + /// Napi::Value propertyValue = object1['A']; + /// object2['A'] = propertyValue; + /// Napi::Value elementValue = array[0]; + /// array[1] = elementValue; + template + class PropertyLValue { + public: + /// Converts an L-value to a value. + operator Value() const; + + /// Assigns a value to the property. The type of value can be + /// anything supported by `Object::Set`. + template + PropertyLValue& operator=(ValueType value); + + /// Converts an L-value to a value. For convenience. + Value AsValue() const; + + private: + PropertyLValue() = delete; + PropertyLValue(Object object, Key key); + napi_env _env; + napi_value _object; + Key _key; + + friend class Napi::Object; + }; + + /// Creates a new Object value. + static Object New(napi_env env ///< Node-API environment + ); + + static void CheckCast(napi_env env, napi_value value); + + Object(); ///< Creates a new _empty_ Object instance. + Object(napi_env env, + napi_value value); ///< Wraps a Node-API value primitive. + + /// Gets or sets a named property. + PropertyLValue operator[]( + const char* utf8name ///< UTF-8 encoded null-terminated property name + ); + + /// Gets or sets a named property. + PropertyLValue operator[]( + const std::string& utf8name ///< UTF-8 encoded property name + ); + + /// Gets or sets an indexed property or array element. + PropertyLValue operator[]( + uint32_t index /// Property / element index + ); + + /// Gets or sets an indexed property or array element. + PropertyLValue operator[](Value index /// Property / element index + ) const; + + /// Gets a named property. + MaybeOrValue operator[]( + const char* utf8name ///< UTF-8 encoded null-terminated property name + ) const; + + /// Gets a named property. + MaybeOrValue operator[]( + const std::string& utf8name ///< UTF-8 encoded property name + ) const; + + /// Gets an indexed property or array element. + MaybeOrValue operator[](uint32_t index ///< Property / element index + ) const; + + /// Checks whether a property is present. + MaybeOrValue Has(napi_value key ///< Property key primitive + ) const; + + /// Checks whether a property is present. + MaybeOrValue Has(Value key ///< Property key + ) const; + + /// Checks whether a named property is present. + MaybeOrValue Has( + const char* utf8name ///< UTF-8 encoded null-terminated property name + ) const; + + /// Checks whether a named property is present. + MaybeOrValue Has( + const std::string& utf8name ///< UTF-8 encoded property name + ) const; + + /// Checks whether a own property is present. + MaybeOrValue HasOwnProperty(napi_value key ///< Property key primitive + ) const; + + /// Checks whether a own property is present. + MaybeOrValue HasOwnProperty(Value key ///< Property key + ) const; + + /// Checks whether a own property is present. + MaybeOrValue HasOwnProperty( + const char* utf8name ///< UTF-8 encoded null-terminated property name + ) const; + + /// Checks whether a own property is present. + MaybeOrValue HasOwnProperty( + const std::string& utf8name ///< UTF-8 encoded property name + ) const; + + /// Gets a property. + MaybeOrValue Get(napi_value key ///< Property key primitive + ) const; + + /// Gets a property. + MaybeOrValue Get(Value key ///< Property key + ) const; + + /// Gets a named property. + MaybeOrValue Get( + const char* utf8name ///< UTF-8 encoded null-terminated property name + ) const; + + /// Gets a named property. + MaybeOrValue Get( + const std::string& utf8name ///< UTF-8 encoded property name + ) const; + + /// Sets a property. + template + MaybeOrValue Set(napi_value key, ///< Property key primitive + const ValueType& value ///< Property value primitive + ) const; + + /// Sets a property. + template + MaybeOrValue Set(Value key, ///< Property key + const ValueType& value ///< Property value + ) const; + + /// Sets a named property. + template + MaybeOrValue Set( + const char* utf8name, ///< UTF-8 encoded null-terminated property name + const ValueType& value) const; + + /// Sets a named property. + template + MaybeOrValue Set( + const std::string& utf8name, ///< UTF-8 encoded property name + const ValueType& value ///< Property value primitive + ) const; + + /// Delete property. + MaybeOrValue Delete(napi_value key ///< Property key primitive + ) const; + + /// Delete property. + MaybeOrValue Delete(Value key ///< Property key + ) const; + + /// Delete property. + MaybeOrValue Delete( + const char* utf8name ///< UTF-8 encoded null-terminated property name + ) const; + + /// Delete property. + MaybeOrValue Delete( + const std::string& utf8name ///< UTF-8 encoded property name + ) const; + + /// Checks whether an indexed property is present. + MaybeOrValue Has(uint32_t index ///< Property / element index + ) const; + + /// Gets an indexed property or array element. + MaybeOrValue Get(uint32_t index ///< Property / element index + ) const; + + /// Sets an indexed property or array element. + template + MaybeOrValue Set(uint32_t index, ///< Property / element index + const ValueType& value ///< Property value primitive + ) const; + + /// Deletes an indexed property or array element. + MaybeOrValue Delete(uint32_t index ///< Property / element index + ) const; + + /// This operation can fail in case of Proxy.[[OwnPropertyKeys]] and + /// Proxy.[[GetOwnProperty]] calling into JavaScript. See: + /// - + /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys + /// - + /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-getownproperty-p + MaybeOrValue GetPropertyNames() const; ///< Get all property names + + /// Defines a property on the object. + /// + /// This operation can fail in case of Proxy.[[DefineOwnProperty]] calling + /// into JavaScript. See + /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc + MaybeOrValue DefineProperty( + const PropertyDescriptor& + property ///< Descriptor for the property to be defined + ) const; + + /// Defines properties on the object. + /// + /// This operation can fail in case of Proxy.[[DefineOwnProperty]] calling + /// into JavaScript. See + /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc + MaybeOrValue DefineProperties( + const std::initializer_list& properties + ///< List of descriptors for the properties to be defined + ) const; + + /// Defines properties on the object. + /// + /// This operation can fail in case of Proxy.[[DefineOwnProperty]] calling + /// into JavaScript. See + /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc + MaybeOrValue DefineProperties( + const std::vector& properties + ///< Vector of descriptors for the properties to be defined + ) const; + + /// Checks if an object is an instance created by a constructor function. + /// + /// This is equivalent to the JavaScript `instanceof` operator. + /// + /// This operation can fail in case of Proxy.[[GetPrototypeOf]] calling into + /// JavaScript. + /// See + /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-getprototypeof + MaybeOrValue InstanceOf( + const Function& constructor ///< Constructor function + ) const; + + template + inline void AddFinalizer(Finalizer finalizeCallback, T* data) const; + + template + inline void AddFinalizer(Finalizer finalizeCallback, + T* data, + Hint* finalizeHint) const; + +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS + class const_iterator; + + inline const_iterator begin() const; + + inline const_iterator end() const; + + class iterator; + + inline iterator begin(); + + inline iterator end(); +#endif // NODE_ADDON_API_CPP_EXCEPTIONS + +#if NAPI_VERSION >= 8 + /// This operation can fail in case of Proxy.[[GetPrototypeOf]] calling into + /// JavaScript. + /// See + /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-getprototypeof + MaybeOrValue Freeze() const; + /// This operation can fail in case of Proxy.[[GetPrototypeOf]] calling into + /// JavaScript. + /// See + /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-getprototypeof + MaybeOrValue Seal() const; +#endif // NAPI_VERSION >= 8 +}; + +template +class External : public TypeTaggable { + public: + static External New(napi_env env, T* data); + + // Finalizer must implement `void operator()(Env env, T* data)`. + template + static External New(napi_env env, T* data, Finalizer finalizeCallback); + // Finalizer must implement `void operator()(Env env, T* data, Hint* hint)`. + template + static External New(napi_env env, + T* data, + Finalizer finalizeCallback, + Hint* finalizeHint); + + static void CheckCast(napi_env env, napi_value value); + + External(); + External(napi_env env, napi_value value); + + T* Data() const; +}; + +class Array : public Object { + public: + static Array New(napi_env env); + static Array New(napi_env env, size_t length); + + static void CheckCast(napi_env env, napi_value value); + + Array(); + Array(napi_env env, napi_value value); + + uint32_t Length() const; +}; + +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS +class Object::const_iterator { + private: + enum class Type { BEGIN, END }; + + inline const_iterator(const Object* object, const Type type); + + public: + inline const_iterator& operator++(); + + inline bool operator==(const const_iterator& other) const; + + inline bool operator!=(const const_iterator& other) const; + + inline const std::pair> operator*() + const; + + private: + const Napi::Object* _object; + Array _keys; + uint32_t _index; + + friend class Object; +}; + +class Object::iterator { + private: + enum class Type { BEGIN, END }; + + inline iterator(Object* object, const Type type); + + public: + inline iterator& operator++(); + + inline bool operator==(const iterator& other) const; + + inline bool operator!=(const iterator& other) const; + + inline std::pair> operator*(); + + private: + Napi::Object* _object; + Array _keys; + uint32_t _index; + + friend class Object; +}; +#endif // NODE_ADDON_API_CPP_EXCEPTIONS + +#ifdef NODE_API_EXPERIMENTAL_HAS_SHAREDARRAYBUFFER +class SharedArrayBuffer : public Object { + public: + SharedArrayBuffer(); + SharedArrayBuffer(napi_env env, napi_value value); + + static SharedArrayBuffer New(napi_env env, size_t byteLength); + + static void CheckCast(napi_env env, napi_value value); + + void* Data(); + size_t ByteLength(); +}; +#endif + +/// A JavaScript array buffer value. +class ArrayBuffer : public Object { + public: + /// Creates a new ArrayBuffer instance over a new automatically-allocated + /// buffer. + static ArrayBuffer New( + napi_env env, ///< Node-API environment + size_t byteLength ///< Length of the buffer to be allocated, in bytes + ); + +#ifndef NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED + /// Creates a new ArrayBuffer instance, using an external buffer with + /// specified byte length. + static ArrayBuffer New( + napi_env env, ///< Node-API environment + void* externalData, ///< Pointer to the external buffer to be used by + ///< the array + size_t byteLength ///< Length of the external buffer to be used by the + ///< array, in bytes + ); + + /// Creates a new ArrayBuffer instance, using an external buffer with + /// specified byte length. + template + static ArrayBuffer New( + napi_env env, ///< Node-API environment + void* externalData, ///< Pointer to the external buffer to be used by + ///< the array + size_t byteLength, ///< Length of the external buffer to be used by the + ///< array, + /// in bytes + Finalizer finalizeCallback ///< Function to be called when the array + ///< buffer is destroyed; + /// must implement `void operator()(Env env, + /// void* externalData)` + ); + + /// Creates a new ArrayBuffer instance, using an external buffer with + /// specified byte length. + template + static ArrayBuffer New( + napi_env env, ///< Node-API environment + void* externalData, ///< Pointer to the external buffer to be used by + ///< the array + size_t byteLength, ///< Length of the external buffer to be used by the + ///< array, + /// in bytes + Finalizer finalizeCallback, ///< Function to be called when the array + ///< buffer is destroyed; + /// must implement `void operator()(Env + /// env, void* externalData, Hint* hint)` + Hint* finalizeHint ///< Hint (second parameter) to be passed to the + ///< finalize callback + ); +#endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED + + static void CheckCast(napi_env env, napi_value value); + + ArrayBuffer(); ///< Creates a new _empty_ ArrayBuffer instance. + ArrayBuffer(napi_env env, + napi_value value); ///< Wraps a Node-API value primitive. + + void* Data(); ///< Gets a pointer to the data buffer. + size_t ByteLength(); ///< Gets the length of the array buffer in bytes. + +#if NAPI_VERSION >= 7 + bool IsDetached() const; + void Detach(); +#endif // NAPI_VERSION >= 7 +}; + +/// A JavaScript typed-array value with unknown array type. +/// +/// For type-specific operations, cast to a `TypedArrayOf` instance using the +/// `As()` method: +/// +/// Napi::TypedArray array = ... +/// if (t.TypedArrayType() == napi_int32_array) { +/// Napi::Int32Array int32Array = t.As(); +/// } +class TypedArray : public Object { + public: + static void CheckCast(napi_env env, napi_value value); + + TypedArray(); ///< Creates a new _empty_ TypedArray instance. + TypedArray(napi_env env, + napi_value value); ///< Wraps a Node-API value primitive. + + napi_typedarray_type TypedArrayType() + const; ///< Gets the type of this typed-array. + Napi::ArrayBuffer ArrayBuffer() const; ///< Gets the backing array buffer. + + uint8_t ElementSize() + const; ///< Gets the size in bytes of one element in the array. + size_t ElementLength() const; ///< Gets the number of elements in the array. + size_t ByteOffset() + const; ///< Gets the offset into the buffer where the array starts. + size_t ByteLength() const; ///< Gets the length of the array in bytes. + + protected: + /// !cond INTERNAL + napi_typedarray_type _type; + size_t _length; + + TypedArray(napi_env env, + napi_value value, + napi_typedarray_type type, + size_t length); + + template + static +#if defined(NAPI_HAS_CONSTEXPR) + constexpr +#endif + napi_typedarray_type + TypedArrayTypeForPrimitiveType() { + return std::is_same::value ? napi_int8_array + : std::is_same::value ? napi_uint8_array + : std::is_same::value ? napi_int16_array + : std::is_same::value ? napi_uint16_array + : std::is_same::value ? napi_int32_array + : std::is_same::value ? napi_uint32_array + : std::is_same::value ? napi_float32_array + : std::is_same::value ? napi_float64_array +#if NAPI_VERSION > 5 + : std::is_same::value ? napi_bigint64_array + : std::is_same::value ? napi_biguint64_array +#endif // NAPI_VERSION > 5 + : napi_int8_array; + } + /// !endcond +}; + +/// A JavaScript typed-array value with known array type. +/// +/// Note while it is possible to create and access Uint8 "clamped" arrays using +/// this class, the _clamping_ behavior is only applied in JavaScript. +template +class TypedArrayOf : public TypedArray { + public: + /// Creates a new TypedArray instance over a new automatically-allocated array + /// buffer. + /// + /// The array type parameter can normally be omitted (because it is inferred + /// from the template parameter T), except when creating a "clamped" array: + /// + /// Uint8Array::New(env, length, napi_uint8_clamped_array) + static TypedArrayOf New( + napi_env env, ///< Node-API environment + size_t elementLength, ///< Length of the created array, as a number of + ///< elements +#if defined(NAPI_HAS_CONSTEXPR) + napi_typedarray_type type = + TypedArray::TypedArrayTypeForPrimitiveType() +#else + napi_typedarray_type type +#endif + ///< Type of array, if different from the default array type for the + ///< template parameter T. + ); + + /// Creates a new TypedArray instance over a provided array buffer. + /// + /// The array type parameter can normally be omitted (because it is inferred + /// from the template parameter T), except when creating a "clamped" array: + /// + /// Uint8Array::New(env, length, buffer, 0, napi_uint8_clamped_array) + static TypedArrayOf New( + napi_env env, ///< Node-API environment + size_t elementLength, ///< Length of the created array, as a number of + ///< elements + Napi::ArrayBuffer arrayBuffer, ///< Backing array buffer instance to use + size_t bufferOffset, ///< Offset into the array buffer where the + ///< typed-array starts +#if defined(NAPI_HAS_CONSTEXPR) + napi_typedarray_type type = + TypedArray::TypedArrayTypeForPrimitiveType() +#else + napi_typedarray_type type +#endif + ///< Type of array, if different from the default array type for the + ///< template parameter T. + ); + + static void CheckCast(napi_env env, napi_value value); + + TypedArrayOf(); ///< Creates a new _empty_ TypedArrayOf instance. + TypedArrayOf(napi_env env, + napi_value value); ///< Wraps a Node-API value primitive. + + T& operator[](size_t index); ///< Gets or sets an element in the array. + const T& operator[](size_t index) const; ///< Gets an element in the array. + + /// Gets a pointer to the array's backing buffer. + /// + /// This is not necessarily the same as the `ArrayBuffer::Data()` pointer, + /// because the typed-array may have a non-zero `ByteOffset()` into the + /// `ArrayBuffer`. + T* Data(); + + /// Gets a pointer to the array's backing buffer. + /// + /// This is not necessarily the same as the `ArrayBuffer::Data()` pointer, + /// because the typed-array may have a non-zero `ByteOffset()` into the + /// `ArrayBuffer`. + const T* Data() const; + + private: + T* _data; + + TypedArrayOf(napi_env env, + napi_value value, + napi_typedarray_type type, + size_t length, + T* data); +}; + +/// The DataView provides a low-level interface for reading/writing multiple +/// number types in an ArrayBuffer irrespective of the platform's endianness. +class DataView : public Object { + public: + static DataView New(napi_env env, Napi::ArrayBuffer arrayBuffer); + static DataView New(napi_env env, + Napi::ArrayBuffer arrayBuffer, + size_t byteOffset); + static DataView New(napi_env env, + Napi::ArrayBuffer arrayBuffer, + size_t byteOffset, + size_t byteLength); + + static void CheckCast(napi_env env, napi_value value); + + DataView(); ///< Creates a new _empty_ DataView instance. + DataView(napi_env env, + napi_value value); ///< Wraps a Node-API value primitive. + + Napi::ArrayBuffer ArrayBuffer() const; ///< Gets the backing array buffer. + size_t ByteOffset() + const; ///< Gets the offset into the buffer where the array starts. + size_t ByteLength() const; ///< Gets the length of the array in bytes. + + void* Data() const; + + float GetFloat32(size_t byteOffset) const; + double GetFloat64(size_t byteOffset) const; + int8_t GetInt8(size_t byteOffset) const; + int16_t GetInt16(size_t byteOffset) const; + int32_t GetInt32(size_t byteOffset) const; + uint8_t GetUint8(size_t byteOffset) const; + uint16_t GetUint16(size_t byteOffset) const; + uint32_t GetUint32(size_t byteOffset) const; + + void SetFloat32(size_t byteOffset, float value) const; + void SetFloat64(size_t byteOffset, double value) const; + void SetInt8(size_t byteOffset, int8_t value) const; + void SetInt16(size_t byteOffset, int16_t value) const; + void SetInt32(size_t byteOffset, int32_t value) const; + void SetUint8(size_t byteOffset, uint8_t value) const; + void SetUint16(size_t byteOffset, uint16_t value) const; + void SetUint32(size_t byteOffset, uint32_t value) const; + + private: + template + T ReadData(size_t byteOffset) const; + + template + void WriteData(size_t byteOffset, T value) const; + + void* _data{}; + size_t _length{}; +}; + +class Function : public Object { + public: + using VoidCallback = void (*)(const CallbackInfo& info); + using Callback = Value (*)(const CallbackInfo& info); + + template + static Function New(napi_env env, + const char* utf8name = nullptr, + void* data = nullptr); + + template + static Function New(napi_env env, + const char* utf8name = nullptr, + void* data = nullptr); + + template + static Function New(napi_env env, + const std::string& utf8name, + void* data = nullptr); + + template + static Function New(napi_env env, + const std::string& utf8name, + void* data = nullptr); + + /// Callable must implement operator() accepting a const CallbackInfo& + /// and return either void or Value. + template + static Function New(napi_env env, + Callable cb, + const char* utf8name = nullptr, + void* data = nullptr); + /// Callable must implement operator() accepting a const CallbackInfo& + /// and return either void or Value. + template + static Function New(napi_env env, + Callable cb, + const std::string& utf8name, + void* data = nullptr); + + static void CheckCast(napi_env env, napi_value value); + + Function(); + Function(napi_env env, napi_value value); + + MaybeOrValue operator()( + const std::initializer_list& args) const; + + MaybeOrValue Call(const std::initializer_list& args) const; + MaybeOrValue Call(const std::vector& args) const; + MaybeOrValue Call(const std::vector& args) const; + MaybeOrValue Call(size_t argc, const napi_value* args) const; + MaybeOrValue Call(napi_value recv, + const std::initializer_list& args) const; + MaybeOrValue Call(napi_value recv, + const std::vector& args) const; + MaybeOrValue Call(napi_value recv, + const std::vector& args) const; + MaybeOrValue Call(napi_value recv, + size_t argc, + const napi_value* args) const; + + MaybeOrValue MakeCallback( + napi_value recv, + const std::initializer_list& args, + napi_async_context context = nullptr) const; + MaybeOrValue MakeCallback(napi_value recv, + const std::vector& args, + napi_async_context context = nullptr) const; + MaybeOrValue MakeCallback(napi_value recv, + size_t argc, + const napi_value* args, + napi_async_context context = nullptr) const; + + MaybeOrValue New(const std::initializer_list& args) const; + MaybeOrValue New(const std::vector& args) const; + MaybeOrValue New(size_t argc, const napi_value* args) const; +}; + +class Promise : public Object { + public: + class Deferred { + public: + static Deferred New(napi_env env); + Deferred(napi_env env); + + Napi::Promise Promise() const; + Napi::Env Env() const; + + void Resolve(napi_value value) const; + void Reject(napi_value value) const; + + private: + napi_env _env; + napi_deferred _deferred; + napi_value _promise; + }; + + static void CheckCast(napi_env env, napi_value value); + + Promise(); + Promise(napi_env env, napi_value value); + + MaybeOrValue Then(napi_value onFulfilled) const; + MaybeOrValue Then(napi_value onFulfilled, + napi_value onRejected) const; + MaybeOrValue Catch(napi_value onRejected) const; + + MaybeOrValue Then(const Function& onFulfilled) const; + MaybeOrValue Then(const Function& onFulfilled, + const Function& onRejected) const; + MaybeOrValue Catch(const Function& onRejected) const; +}; + +template +class Buffer : public Uint8Array { + public: + static Buffer New(napi_env env, size_t length); +#ifndef NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED + static Buffer New(napi_env env, T* data, size_t length); + + // Finalizer must implement `void operator()(Env env, T* data)`. + template + static Buffer New(napi_env env, + T* data, + size_t length, + Finalizer finalizeCallback); + // Finalizer must implement `void operator()(Env env, T* data, Hint* hint)`. + template + static Buffer New(napi_env env, + T* data, + size_t length, + Finalizer finalizeCallback, + Hint* finalizeHint); +#endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED + + static Buffer NewOrCopy(napi_env env, T* data, size_t length); + // Finalizer must implement `void operator()(Env env, T* data)`. + template + static Buffer NewOrCopy(napi_env env, + T* data, + size_t length, + Finalizer finalizeCallback); + // Finalizer must implement `void operator()(Env env, T* data, Hint* hint)`. + template + static Buffer NewOrCopy(napi_env env, + T* data, + size_t length, + Finalizer finalizeCallback, + Hint* finalizeHint); + + static Buffer Copy(napi_env env, const T* data, size_t length); + + static void CheckCast(napi_env env, napi_value value); + + Buffer(); + Buffer(napi_env env, napi_value value); + size_t Length() const; + T* Data() const; + + private: +}; + +/// Holds a counted reference to a value; initially a weak reference unless +/// otherwise specified, may be changed to/from a strong reference by adjusting +/// the refcount. +/// +/// The referenced value is not immediately destroyed when the reference count +/// is zero; it is merely then eligible for garbage-collection if there are no +/// other references to the value. +template +class Reference { + public: + static Reference New(const T& value, uint32_t initialRefcount = 0); + + Reference(); + Reference(napi_env env, napi_ref ref); + ~Reference(); + + // A reference can be moved but cannot be copied. + Reference(Reference&& other); + Reference& operator=(Reference&& other); + NAPI_DISALLOW_ASSIGN(Reference) + + operator napi_ref() const; + bool operator==(const Reference& other) const; + bool operator!=(const Reference& other) const; + + Napi::Env Env() const; + bool IsEmpty() const; + + // Note when getting the value of a Reference it is usually correct to do so + // within a HandleScope so that the value handle gets cleaned up efficiently. + T Value() const; + + uint32_t Ref() const; + uint32_t Unref() const; + void Reset(); + void Reset(const T& value, uint32_t refcount = 0); + + // Call this on a reference that is declared as static data, to prevent its + // destructor from running at program shutdown time, which would attempt to + // reset the reference when the environment is no longer valid. Avoid using + // this if at all possible. If you do need to use static data, MAKE SURE to + // warn your users that your addon is NOT threadsafe. + void SuppressDestruct(); + + protected: + Reference(const Reference&); + + /// !cond INTERNAL + napi_env _env; + napi_ref _ref; + /// !endcond + + private: + bool _suppressDestruct; +}; + +class ObjectReference : public Reference { + public: + ObjectReference(); + ObjectReference(napi_env env, napi_ref ref); + + // A reference can be moved but cannot be copied. + ObjectReference(Reference&& other); + ObjectReference& operator=(Reference&& other); + ObjectReference(ObjectReference&& other); + ObjectReference& operator=(ObjectReference&& other); + NAPI_DISALLOW_ASSIGN(ObjectReference) + + MaybeOrValue Get(const char* utf8name) const; + MaybeOrValue Get(const std::string& utf8name) const; + MaybeOrValue Set(const char* utf8name, napi_value value) const; + MaybeOrValue Set(const char* utf8name, Napi::Value value) const; + MaybeOrValue Set(const char* utf8name, const char* utf8value) const; + MaybeOrValue Set(const char* utf8name, bool boolValue) const; + MaybeOrValue Set(const char* utf8name, double numberValue) const; + MaybeOrValue Set(const std::string& utf8name, napi_value value) const; + MaybeOrValue Set(const std::string& utf8name, Napi::Value value) const; + MaybeOrValue Set(const std::string& utf8name, + std::string& utf8value) const; + MaybeOrValue Set(const std::string& utf8name, bool boolValue) const; + MaybeOrValue Set(const std::string& utf8name, double numberValue) const; + + MaybeOrValue Get(uint32_t index) const; + MaybeOrValue Set(uint32_t index, const napi_value value) const; + MaybeOrValue Set(uint32_t index, const Napi::Value value) const; + MaybeOrValue Set(uint32_t index, const char* utf8value) const; + MaybeOrValue Set(uint32_t index, const std::string& utf8value) const; + MaybeOrValue Set(uint32_t index, bool boolValue) const; + MaybeOrValue Set(uint32_t index, double numberValue) const; + + protected: + ObjectReference(const ObjectReference&); +}; + +class FunctionReference : public Reference { + public: + FunctionReference(); + FunctionReference(napi_env env, napi_ref ref); + + // A reference can be moved but cannot be copied. + FunctionReference(Reference&& other); + FunctionReference& operator=(Reference&& other); + FunctionReference(FunctionReference&& other); + FunctionReference& operator=(FunctionReference&& other); + NAPI_DISALLOW_ASSIGN_COPY(FunctionReference) + + MaybeOrValue operator()( + const std::initializer_list& args) const; + + MaybeOrValue Call( + const std::initializer_list& args) const; + MaybeOrValue Call(const std::vector& args) const; + MaybeOrValue Call( + napi_value recv, const std::initializer_list& args) const; + MaybeOrValue Call(napi_value recv, + const std::vector& args) const; + MaybeOrValue Call(napi_value recv, + size_t argc, + const napi_value* args) const; + + MaybeOrValue MakeCallback( + napi_value recv, + const std::initializer_list& args, + napi_async_context context = nullptr) const; + MaybeOrValue MakeCallback( + napi_value recv, + const std::vector& args, + napi_async_context context = nullptr) const; + MaybeOrValue MakeCallback( + napi_value recv, + size_t argc, + const napi_value* args, + napi_async_context context = nullptr) const; + + MaybeOrValue New(const std::initializer_list& args) const; + MaybeOrValue New(const std::vector& args) const; +}; + +// Shortcuts to creating a new reference with inferred type and refcount = 0. +template +Reference Weak(T value); +ObjectReference Weak(Object value); +FunctionReference Weak(Function value); + +// Shortcuts to creating a new reference with inferred type and refcount = 1. +template +Reference Persistent(T value); +ObjectReference Persistent(Object value); +FunctionReference Persistent(Function value); + +/// A persistent reference to a JavaScript error object. Use of this class +/// depends somewhat on whether C++ exceptions are enabled at compile time. +/// +/// ### Handling Errors With C++ Exceptions +/// +/// If C++ exceptions are enabled, then the `Error` class extends +/// `std::exception` and enables integrated error-handling for C++ exceptions +/// and JavaScript exceptions. +/// +/// If a Node-API call fails without executing any JavaScript code (for +/// example due to an invalid argument), then the Node-API wrapper +/// automatically converts and throws the error as a C++ exception of type +/// `Napi::Error`. Or if a JavaScript function called by C++ code via Node-API +/// throws a JavaScript exception, then the Node-API wrapper automatically +/// converts and throws it as a C++ exception of type `Napi::Error`. +/// +/// If a C++ exception of type `Napi::Error` escapes from a Node-API C++ +/// callback, then the Node-API wrapper automatically converts and throws it +/// as a JavaScript exception. Therefore, catching a C++ exception of type +/// `Napi::Error` prevents a JavaScript exception from being thrown. +/// +/// #### Example 1A - Throwing a C++ exception: +/// +/// Napi::Env env = ... +/// throw Napi::Error::New(env, "Example exception"); +/// +/// Following C++ statements will not be executed. The exception will bubble +/// up as a C++ exception of type `Napi::Error`, until it is either caught +/// while still in C++, or else automatically propagated as a JavaScript +/// exception when the callback returns to JavaScript. +/// +/// #### Example 2A - Propagating a Node-API C++ exception: +/// +/// Napi::Function jsFunctionThatThrows = someObj.As(); +/// Napi::Value result = jsFunctionThatThrows({ arg1, arg2 }); +/// +/// Following C++ statements will not be executed. The exception will bubble +/// up as a C++ exception of type `Napi::Error`, until it is either caught +/// while still in C++, or else automatically propagated as a JavaScript +/// exception when the callback returns to JavaScript. +/// +/// #### Example 3A - Handling a Node-API C++ exception: +/// +/// Napi::Function jsFunctionThatThrows = someObj.As(); +/// Napi::Value result; +/// try { +/// result = jsFunctionThatThrows({ arg1, arg2 }); +/// } catch (const Napi::Error& e) { +/// cerr << "Caught JavaScript exception: " + e.what(); +/// } +/// +/// Since the exception was caught here, it will not be propagated as a +/// JavaScript exception. +/// +/// ### Handling Errors Without C++ Exceptions +/// +/// If C++ exceptions are disabled (by defining +/// `NODE_ADDON_API_DISABLE_CPP_EXCEPTIONS`) then this class does not extend +/// `std::exception`, and APIs in the `Napi` namespace do not throw C++ +/// exceptions when they fail. Instead, they raise _pending_ JavaScript +/// exceptions and return _empty_ `Value`s. Calling code should check +/// `Value::IsEmpty()` before attempting to use a returned value, and may use +/// methods on the `Env` class to check for, get, and clear a pending JavaScript +/// exception. If the pending exception is not cleared, it will be thrown when +/// the native callback returns to JavaScript. +/// +/// #### Example 1B - Throwing a JS exception +/// +/// Napi::Env env = ... +/// Napi::Error::New(env, "Example +/// exception").ThrowAsJavaScriptException(); return; +/// +/// After throwing a JS exception, the code should generally return +/// immediately from the native callback, after performing any necessary +/// cleanup. +/// +/// #### Example 2B - Propagating a Node-API JS exception: +/// +/// Napi::Function jsFunctionThatThrows = someObj.As(); +/// Napi::Value result = jsFunctionThatThrows({ arg1, arg2 }); +/// if (result.IsEmpty()) return; +/// +/// An empty value result from a Node-API call indicates an error occurred, +/// and a JavaScript exception is pending. To let the exception propagate, the +/// code should generally return immediately from the native callback, after +/// performing any necessary cleanup. +/// +/// #### Example 3B - Handling a Node-API JS exception: +/// +/// Napi::Function jsFunctionThatThrows = someObj.As(); +/// Napi::Value result = jsFunctionThatThrows({ arg1, arg2 }); +/// if (result.IsEmpty()) { +/// Napi::Error e = env.GetAndClearPendingException(); +/// cerr << "Caught JavaScript exception: " + e.Message(); +/// } +/// +/// Since the exception was cleared here, it will not be propagated as a +/// JavaScript exception after the native callback returns. +class Error : public ObjectReference +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS + , + public std::exception +#endif // NODE_ADDON_API_CPP_EXCEPTIONS +{ + public: + static Error New(napi_env env); + static Error New(napi_env env, const char* message); + static Error New(napi_env env, const std::string& message); + + static NAPI_NO_RETURN void Fatal(const char* location, const char* message); + + Error(); + Error(napi_env env, napi_value value); + + // An error can be moved or copied. + Error(Error&& other); + Error& operator=(Error&& other); + Error(const Error&); + Error& operator=(const Error&); + + const std::string& Message() const NAPI_NOEXCEPT; + void ThrowAsJavaScriptException() const; + + Object Value() const; + +#ifdef NODE_ADDON_API_CPP_EXCEPTIONS + const char* what() const NAPI_NOEXCEPT override; +#endif // NODE_ADDON_API_CPP_EXCEPTIONS + + protected: + /// !cond INTERNAL + using create_error_fn = napi_status (*)(napi_env envb, + napi_value code, + napi_value msg, + napi_value* result); + + template + static TError New(napi_env env, + const char* message, + size_t length, + create_error_fn create_error); + /// !endcond + + private: + static inline const char* ERROR_WRAP_VALUE() NAPI_NOEXCEPT; + mutable std::string _message; +}; + +class TypeError : public Error { + public: + static TypeError New(napi_env env, const char* message); + static TypeError New(napi_env env, const std::string& message); + + TypeError(); + TypeError(napi_env env, napi_value value); +}; + +class RangeError : public Error { + public: + static RangeError New(napi_env env, const char* message); + static RangeError New(napi_env env, const std::string& message); + + RangeError(); + RangeError(napi_env env, napi_value value); +}; + +#if NAPI_VERSION > 8 +class SyntaxError : public Error { + public: + static SyntaxError New(napi_env env, const char* message); + static SyntaxError New(napi_env env, const std::string& message); + + SyntaxError(); + SyntaxError(napi_env env, napi_value value); +}; +#endif // NAPI_VERSION > 8 + +class CallbackInfo { + public: + CallbackInfo(napi_env env, napi_callback_info info); + ~CallbackInfo(); + + // Disallow copying to prevent multiple free of _dynamicArgs + NAPI_DISALLOW_ASSIGN_COPY(CallbackInfo) + + Napi::Env Env() const; + Value NewTarget() const; + bool IsConstructCall() const; + size_t Length() const; + const Value operator[](size_t index) const; + Value This() const; + void* Data() const; + void SetData(void* data); + explicit operator napi_callback_info() const; + + private: + const size_t _staticArgCount = 6; + napi_env _env; + napi_callback_info _info; + napi_value _this; + size_t _argc; + napi_value* _argv; + napi_value _staticArgs[6]{}; + napi_value* _dynamicArgs; + void* _data; +}; + +class PropertyDescriptor { + public: + using GetterCallback = Napi::Value (*)(const Napi::CallbackInfo& info); + using SetterCallback = void (*)(const Napi::CallbackInfo& info); + +#ifndef NODE_ADDON_API_DISABLE_DEPRECATED + template + static PropertyDescriptor Accessor( + const char* utf8name, + Getter getter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Accessor( + const std::string& utf8name, + Getter getter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Accessor( + napi_value name, + Getter getter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Accessor( + Name name, + Getter getter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Accessor( + const char* utf8name, + Getter getter, + Setter setter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Accessor( + const std::string& utf8name, + Getter getter, + Setter setter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Accessor( + napi_value name, + Getter getter, + Setter setter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Accessor( + Name name, + Getter getter, + Setter setter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Function( + const char* utf8name, + Callable cb, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Function( + const std::string& utf8name, + Callable cb, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Function( + napi_value name, + Callable cb, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Function( + Name name, + Callable cb, + napi_property_attributes attributes = napi_default, + void* data = nullptr); +#endif // !NODE_ADDON_API_DISABLE_DEPRECATED + + template + static PropertyDescriptor Accessor( + const char* utf8name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + + template + static PropertyDescriptor Accessor( + const std::string& utf8name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + + template + static PropertyDescriptor Accessor( + Name name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + + template + static PropertyDescriptor Accessor( + const char* utf8name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + + template + static PropertyDescriptor Accessor( + const std::string& utf8name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + + template + static PropertyDescriptor Accessor( + Name name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + + template + static PropertyDescriptor Accessor( + Napi::Env env, + Napi::Object object, + const char* utf8name, + Getter getter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Accessor( + Napi::Env env, + Napi::Object object, + const std::string& utf8name, + Getter getter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Accessor( + Napi::Env env, + Napi::Object object, + Name name, + Getter getter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Accessor( + Napi::Env env, + Napi::Object object, + const char* utf8name, + Getter getter, + Setter setter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Accessor( + Napi::Env env, + Napi::Object object, + const std::string& utf8name, + Getter getter, + Setter setter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Accessor( + Napi::Env env, + Napi::Object object, + Name name, + Getter getter, + Setter setter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Function( + Napi::Env env, + Napi::Object object, + const char* utf8name, + Callable cb, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Function( + Napi::Env env, + Napi::Object object, + const std::string& utf8name, + Callable cb, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor Function( + Napi::Env env, + Napi::Object object, + Name name, + Callable cb, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + static PropertyDescriptor Value( + const char* utf8name, + napi_value value, + napi_property_attributes attributes = napi_default); + static PropertyDescriptor Value( + const std::string& utf8name, + napi_value value, + napi_property_attributes attributes = napi_default); + static PropertyDescriptor Value( + napi_value name, + napi_value value, + napi_property_attributes attributes = napi_default); + static PropertyDescriptor Value( + Name name, + Napi::Value value, + napi_property_attributes attributes = napi_default); + + PropertyDescriptor(napi_property_descriptor desc); + + operator napi_property_descriptor&(); + operator const napi_property_descriptor&() const; + + private: + napi_property_descriptor _desc; +}; + +/// Property descriptor for use with `ObjectWrap::DefineClass()`. +/// +/// This is different from the standalone `PropertyDescriptor` because it is +/// specific to each `ObjectWrap` subclass. This prevents using descriptors +/// from a different class when defining a new class (preventing the callbacks +/// from having incorrect `this` pointers). +template +class ClassPropertyDescriptor { + public: + ClassPropertyDescriptor(napi_property_descriptor desc) : _desc(desc) {} + + operator napi_property_descriptor&() { return _desc; } + operator const napi_property_descriptor&() const { return _desc; } + + private: + napi_property_descriptor _desc; +}; + +template +struct MethodCallbackData { + TCallback callback; + void* data; +}; + +template +struct AccessorCallbackData { + TGetterCallback getterCallback; + TSetterCallback setterCallback; + void* data; +}; + +template +class InstanceWrap { + public: + using InstanceVoidMethodCallback = void (T::*)(const CallbackInfo& info); + using InstanceMethodCallback = Napi::Value (T::*)(const CallbackInfo& info); + using InstanceGetterCallback = Napi::Value (T::*)(const CallbackInfo& info); + using InstanceSetterCallback = void (T::*)(const CallbackInfo& info, + const Napi::Value& value); + + using PropertyDescriptor = ClassPropertyDescriptor; + + static PropertyDescriptor InstanceMethod( + const char* utf8name, + InstanceVoidMethodCallback method, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + static PropertyDescriptor InstanceMethod( + const char* utf8name, + InstanceMethodCallback method, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + static PropertyDescriptor InstanceMethod( + Symbol name, + InstanceVoidMethodCallback method, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + static PropertyDescriptor InstanceMethod( + Symbol name, + InstanceMethodCallback method, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor InstanceMethod( + const char* utf8name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor InstanceMethod( + const char* utf8name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor InstanceMethod( + Symbol name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor InstanceMethod( + Symbol name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + static PropertyDescriptor InstanceAccessor( + const char* utf8name, + InstanceGetterCallback getter, + InstanceSetterCallback setter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + static PropertyDescriptor InstanceAccessor( + Symbol name, + InstanceGetterCallback getter, + InstanceSetterCallback setter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor InstanceAccessor( + const char* utf8name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor InstanceAccessor( + Symbol name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + static PropertyDescriptor InstanceValue( + const char* utf8name, + Napi::Value value, + napi_property_attributes attributes = napi_default); + static PropertyDescriptor InstanceValue( + Symbol name, + Napi::Value value, + napi_property_attributes attributes = napi_default); + + protected: + static void AttachPropData(napi_env env, + napi_value value, + const napi_property_descriptor* prop); + + private: + using This = InstanceWrap; + + using InstanceVoidMethodCallbackData = + MethodCallbackData; + using InstanceMethodCallbackData = + MethodCallbackData; + using InstanceAccessorCallbackData = + AccessorCallbackData; + + static napi_value InstanceVoidMethodCallbackWrapper(napi_env env, + napi_callback_info info); + static napi_value InstanceMethodCallbackWrapper(napi_env env, + napi_callback_info info); + static napi_value InstanceGetterCallbackWrapper(napi_env env, + napi_callback_info info); + static napi_value InstanceSetterCallbackWrapper(napi_env env, + napi_callback_info info); + + template + static napi_value WrappedMethod(napi_env env, + napi_callback_info info) NAPI_NOEXCEPT; + + template + struct SetterTag {}; + + template + static napi_callback WrapSetter(SetterTag) NAPI_NOEXCEPT { + return &This::WrappedMethod; + } + static napi_callback WrapSetter(SetterTag) NAPI_NOEXCEPT { + return nullptr; + } +}; + +/// Base class to be extended by C++ classes exposed to JavaScript; each C++ +/// class instance gets "wrapped" by a JavaScript object that is managed by this +/// class. +/// +/// At initialization time, the `DefineClass()` method must be used to +/// hook up the accessor and method callbacks. It takes a list of +/// property descriptors, which can be constructed via the various +/// static methods on the base class. +/// +/// #### Example: +/// +/// class Example: public Napi::ObjectWrap { +/// public: +/// static void Initialize(Napi::Env& env, Napi::Object& target) { +/// Napi::Function constructor = DefineClass(env, "Example", { +/// InstanceAccessor<&Example::GetSomething, +/// &Example::SetSomething>("value"), +/// InstanceMethod<&Example::DoSomething>("doSomething"), +/// }); +/// target.Set("Example", constructor); +/// } +/// +/// Example(const Napi::CallbackInfo& info); // Constructor +/// Napi::Value GetSomething(const Napi::CallbackInfo& info); +/// void SetSomething(const Napi::CallbackInfo& info, const Napi::Value& +/// value); Napi::Value DoSomething(const Napi::CallbackInfo& info); +/// } +template +class ObjectWrap : public InstanceWrap, public Reference { + public: + ObjectWrap(const CallbackInfo& callbackInfo); + virtual ~ObjectWrap(); + + static T* Unwrap(Object wrapper); + + // Methods exposed to JavaScript must conform to one of these callback + // signatures. + using StaticVoidMethodCallback = void (*)(const CallbackInfo& info); + using StaticMethodCallback = Napi::Value (*)(const CallbackInfo& info); + using StaticGetterCallback = Napi::Value (*)(const CallbackInfo& info); + using StaticSetterCallback = void (*)(const CallbackInfo& info, + const Napi::Value& value); + + using PropertyDescriptor = ClassPropertyDescriptor; + + static Function DefineClass( + Napi::Env env, + const char* utf8name, + const std::initializer_list& properties, + void* data = nullptr); + static Function DefineClass(Napi::Env env, + const char* utf8name, + const std::vector& properties, + void* data = nullptr); + static PropertyDescriptor StaticMethod( + const char* utf8name, + StaticVoidMethodCallback method, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + static PropertyDescriptor StaticMethod( + const char* utf8name, + StaticMethodCallback method, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + static PropertyDescriptor StaticMethod( + Symbol name, + StaticVoidMethodCallback method, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + static PropertyDescriptor StaticMethod( + Symbol name, + StaticMethodCallback method, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor StaticMethod( + const char* utf8name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor StaticMethod( + Symbol name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor StaticMethod( + const char* utf8name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor StaticMethod( + Symbol name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + static PropertyDescriptor StaticAccessor( + const char* utf8name, + StaticGetterCallback getter, + StaticSetterCallback setter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + static PropertyDescriptor StaticAccessor( + Symbol name, + StaticGetterCallback getter, + StaticSetterCallback setter, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor StaticAccessor( + const char* utf8name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + template + static PropertyDescriptor StaticAccessor( + Symbol name, + napi_property_attributes attributes = napi_default, + void* data = nullptr); + static PropertyDescriptor StaticValue( + const char* utf8name, + Napi::Value value, + napi_property_attributes attributes = napi_default); + static PropertyDescriptor StaticValue( + Symbol name, + Napi::Value value, + napi_property_attributes attributes = napi_default); + static Napi::Value OnCalledAsFunction(const Napi::CallbackInfo& callbackInfo); + virtual void Finalize(Napi::Env env); + virtual void Finalize(BasicEnv env); + + private: + using This = ObjectWrap; + + static napi_value ConstructorCallbackWrapper(napi_env env, + napi_callback_info info); + static napi_value StaticVoidMethodCallbackWrapper(napi_env env, + napi_callback_info info); + static napi_value StaticMethodCallbackWrapper(napi_env env, + napi_callback_info info); + static napi_value StaticGetterCallbackWrapper(napi_env env, + napi_callback_info info); + static napi_value StaticSetterCallbackWrapper(napi_env env, + napi_callback_info info); + static void FinalizeCallback(node_addon_api_basic_env env, + void* data, + void* hint); + + static void PostFinalizeCallback(napi_env env, void* data, void* hint); + + static Function DefineClass(Napi::Env env, + const char* utf8name, + const size_t props_count, + const napi_property_descriptor* props, + void* data = nullptr); + + using StaticVoidMethodCallbackData = + MethodCallbackData; + using StaticMethodCallbackData = MethodCallbackData; + + using StaticAccessorCallbackData = + AccessorCallbackData; + + template + static napi_value WrappedMethod(napi_env env, + napi_callback_info info) NAPI_NOEXCEPT; + + template + struct StaticSetterTag {}; + + template + static napi_callback WrapStaticSetter(StaticSetterTag) NAPI_NOEXCEPT { + return &This::WrappedMethod; + } + static napi_callback WrapStaticSetter(StaticSetterTag) + NAPI_NOEXCEPT { + return nullptr; + } + + bool _construction_failed = true; + bool _finalized = false; +}; + +class HandleScope { + public: + HandleScope(napi_env env, napi_handle_scope scope); + explicit HandleScope(Napi::Env env); + ~HandleScope(); + + // Disallow copying to prevent double close of napi_handle_scope + NAPI_DISALLOW_ASSIGN_COPY(HandleScope) + + operator napi_handle_scope() const; + + Napi::Env Env() const; + + private: + napi_env _env; + napi_handle_scope _scope; +}; + +class EscapableHandleScope { + public: + EscapableHandleScope(napi_env env, napi_escapable_handle_scope scope); + explicit EscapableHandleScope(Napi::Env env); + ~EscapableHandleScope(); + + // Disallow copying to prevent double close of napi_escapable_handle_scope + NAPI_DISALLOW_ASSIGN_COPY(EscapableHandleScope) + + operator napi_escapable_handle_scope() const; + + Napi::Env Env() const; + Value Escape(napi_value escapee); + + private: + napi_env _env; + napi_escapable_handle_scope _scope; +}; + +#if (NAPI_VERSION > 2) +class CallbackScope { + public: + CallbackScope(napi_env env, napi_callback_scope scope); + CallbackScope(napi_env env, napi_async_context context); + virtual ~CallbackScope(); + + // Disallow copying to prevent double close of napi_callback_scope + NAPI_DISALLOW_ASSIGN_COPY(CallbackScope) + + operator napi_callback_scope() const; + + Napi::Env Env() const; + + private: + napi_env _env; + napi_callback_scope _scope; +}; +#endif + +class AsyncContext { + public: + explicit AsyncContext(napi_env env, const char* resource_name); + explicit AsyncContext(napi_env env, + const char* resource_name, + const Object& resource); + virtual ~AsyncContext(); + + AsyncContext(AsyncContext&& other); + AsyncContext& operator=(AsyncContext&& other); + NAPI_DISALLOW_ASSIGN_COPY(AsyncContext) + + operator napi_async_context() const; + + Napi::Env Env() const; + + private: + napi_env _env; + napi_async_context _context; +}; + +#if NAPI_HAS_THREADS +class AsyncWorker { + public: + virtual ~AsyncWorker(); + + NAPI_DISALLOW_ASSIGN_COPY(AsyncWorker) + + operator napi_async_work() const; + + Napi::Env Env() const; + + void Queue(); + void Cancel(); + void SuppressDestruct(); + + ObjectReference& Receiver(); + FunctionReference& Callback(); + + virtual void OnExecute(Napi::Env env); + virtual void OnWorkComplete(Napi::Env env, napi_status status); + + protected: + explicit AsyncWorker(const Function& callback); + explicit AsyncWorker(const Function& callback, const char* resource_name); + explicit AsyncWorker(const Function& callback, + const char* resource_name, + const Object& resource); + explicit AsyncWorker(const Object& receiver, const Function& callback); + explicit AsyncWorker(const Object& receiver, + const Function& callback, + const char* resource_name); + explicit AsyncWorker(const Object& receiver, + const Function& callback, + const char* resource_name, + const Object& resource); + + explicit AsyncWorker(Napi::Env env); + explicit AsyncWorker(Napi::Env env, const char* resource_name); + explicit AsyncWorker(Napi::Env env, + const char* resource_name, + const Object& resource); + + virtual void Execute() = 0; + virtual void OnOK(); + virtual void OnError(const Error& e); + virtual void Destroy(); + virtual std::vector GetResult(Napi::Env env); + + void SetError(const std::string& error); + + private: + static inline void OnAsyncWorkExecute(napi_env env, void* asyncworker); + static inline void OnAsyncWorkComplete(napi_env env, + napi_status status, + void* asyncworker); + + napi_env _env; + napi_async_work _work; + ObjectReference _receiver; + FunctionReference _callback; + std::string _error; + bool _suppress_destruct; +}; +#endif // NAPI_HAS_THREADS + +#if (NAPI_VERSION > 3 && NAPI_HAS_THREADS) +class ThreadSafeFunction { + public: + // This API may only be called from the main thread. + template + static ThreadSafeFunction New(napi_env env, + const Function& callback, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount); + + // This API may only be called from the main thread. + template + static ThreadSafeFunction New(napi_env env, + const Function& callback, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context); + + // This API may only be called from the main thread. + template + static ThreadSafeFunction New(napi_env env, + const Function& callback, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + Finalizer finalizeCallback); + + // This API may only be called from the main thread. + template + static ThreadSafeFunction New(napi_env env, + const Function& callback, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + Finalizer finalizeCallback, + FinalizerDataType* data); + + // This API may only be called from the main thread. + template + static ThreadSafeFunction New(napi_env env, + const Function& callback, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback); + + // This API may only be called from the main thread. + template + static ThreadSafeFunction New(napi_env env, + const Function& callback, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback, + FinalizerDataType* data); + + // This API may only be called from the main thread. + template + static ThreadSafeFunction New(napi_env env, + const Function& callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount); + + // This API may only be called from the main thread. + template + static ThreadSafeFunction New(napi_env env, + const Function& callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context); + + // This API may only be called from the main thread. + template + static ThreadSafeFunction New(napi_env env, + const Function& callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + Finalizer finalizeCallback); + + // This API may only be called from the main thread. + template + static ThreadSafeFunction New(napi_env env, + const Function& callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + Finalizer finalizeCallback, + FinalizerDataType* data); + + // This API may only be called from the main thread. + template + static ThreadSafeFunction New(napi_env env, + const Function& callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback); + + // This API may only be called from the main thread. + template + static ThreadSafeFunction New(napi_env env, + const Function& callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback, + FinalizerDataType* data); + + ThreadSafeFunction(); + ThreadSafeFunction(napi_threadsafe_function tsFunctionValue); + + operator napi_threadsafe_function() const; + + // This API may be called from any thread. + napi_status BlockingCall() const; + + // This API may be called from any thread. + template + napi_status BlockingCall(Callback callback) const; + + // This API may be called from any thread. + template + napi_status BlockingCall(DataType* data, Callback callback) const; + + // This API may be called from any thread. + napi_status NonBlockingCall() const; + + // This API may be called from any thread. + template + napi_status NonBlockingCall(Callback callback) const; + + // This API may be called from any thread. + template + napi_status NonBlockingCall(DataType* data, Callback callback) const; + + // This API may only be called from the main thread. + void Ref(napi_env env) const; + + // This API may only be called from the main thread. + void Unref(napi_env env) const; + + // This API may be called from any thread. + napi_status Acquire() const; + + // This API may be called from any thread. + napi_status Release() const; + + // This API may be called from any thread. + napi_status Abort() const; + + struct ConvertibleContext { + template + operator T*() { + return static_cast(context); + } + void* context; + }; + + // This API may be called from any thread. + ConvertibleContext GetContext() const; + + private: + using CallbackWrapper = std::function; + + template + static ThreadSafeFunction New(napi_env env, + const Function& callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback, + FinalizerDataType* data, + napi_finalize wrapper); + + napi_status CallInternal(CallbackWrapper* callbackWrapper, + napi_threadsafe_function_call_mode mode) const; + + static void CallJS(napi_env env, + napi_value jsCallback, + void* context, + void* data); + + napi_threadsafe_function _tsfn; +}; + +// A TypedThreadSafeFunction by default has no context (nullptr) and can +// accept any type (void) to its CallJs. +template +class TypedThreadSafeFunction { + public: + // This API may only be called from the main thread. + // Helper function that returns nullptr if running Node-API 5+, otherwise a + // non-empty, no-op Function. This provides the ability to specify at + // compile-time a callback parameter to `New` that safely does no action + // when targeting _any_ Node-API version. +#if NAPI_VERSION > 4 + static std::nullptr_t EmptyFunctionFactory(Napi::Env env); +#else + static Napi::Function EmptyFunctionFactory(Napi::Env env); +#endif + static Napi::Function FunctionOrEmpty(Napi::Env env, + Napi::Function& callback); + +#if NAPI_VERSION > 4 + // This API may only be called from the main thread. + // Creates a new threadsafe function with: + // Callback [missing] Resource [missing] Finalizer [missing] + template + static TypedThreadSafeFunction New( + napi_env env, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context = nullptr); + + // This API may only be called from the main thread. + // Creates a new threadsafe function with: + // Callback [missing] Resource [passed] Finalizer [missing] + template + static TypedThreadSafeFunction New( + napi_env env, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context = nullptr); + + // This API may only be called from the main thread. + // Creates a new threadsafe function with: + // Callback [missing] Resource [missing] Finalizer [passed] + template + static TypedThreadSafeFunction New( + napi_env env, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback, + FinalizerDataType* data = nullptr); + + // This API may only be called from the main thread. + // Creates a new threadsafe function with: + // Callback [missing] Resource [passed] Finalizer [passed] + template + static TypedThreadSafeFunction New( + napi_env env, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback, + FinalizerDataType* data = nullptr); +#endif + + // This API may only be called from the main thread. + // Creates a new threadsafe function with: + // Callback [passed] Resource [missing] Finalizer [missing] + template + static TypedThreadSafeFunction New( + napi_env env, + const Function& callback, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context = nullptr); + + // This API may only be called from the main thread. + // Creates a new threadsafe function with: + // Callback [passed] Resource [passed] Finalizer [missing] + template + static TypedThreadSafeFunction New( + napi_env env, + const Function& callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context = nullptr); + + // This API may only be called from the main thread. + // Creates a new threadsafe function with: + // Callback [passed] Resource [missing] Finalizer [passed] + template + static TypedThreadSafeFunction New( + napi_env env, + const Function& callback, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback, + FinalizerDataType* data = nullptr); + + // This API may only be called from the main thread. + // Creates a new threadsafe function with: + // Callback [passed] Resource [passed] Finalizer [passed] + template + static TypedThreadSafeFunction New( + napi_env env, + CallbackType callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback, + FinalizerDataType* data = nullptr); + + TypedThreadSafeFunction(); + TypedThreadSafeFunction(napi_threadsafe_function tsFunctionValue); + + operator napi_threadsafe_function() const; + + // This API may be called from any thread. + napi_status BlockingCall(DataType* data = nullptr) const; + + // This API may be called from any thread. + napi_status NonBlockingCall(DataType* data = nullptr) const; + + // This API may only be called from the main thread. + void Ref(napi_env env) const; + + // This API may only be called from the main thread. + void Unref(napi_env env) const; + + // This API may be called from any thread. + napi_status Acquire() const; + + // This API may be called from any thread. + napi_status Release() const; + + // This API may be called from any thread. + napi_status Abort() const; + + // This API may be called from any thread. + ContextType* GetContext() const; + + private: + template + static TypedThreadSafeFunction New( + napi_env env, + const Function& callback, + const Object& resource, + ResourceString resourceName, + size_t maxQueueSize, + size_t initialThreadCount, + ContextType* context, + Finalizer finalizeCallback, + FinalizerDataType* data, + napi_finalize wrapper); + + static void CallJsInternal(napi_env env, + napi_value jsCallback, + void* context, + void* data); + + protected: + napi_threadsafe_function _tsfn; +}; +template +class AsyncProgressWorkerBase : public AsyncWorker { + public: + virtual void OnWorkProgress(DataType* data) = 0; + class ThreadSafeData { + public: + ThreadSafeData(AsyncProgressWorkerBase* asyncprogressworker, DataType* data) + : _asyncprogressworker(asyncprogressworker), _data(data) {} + + AsyncProgressWorkerBase* asyncprogressworker() { + return _asyncprogressworker; + }; + DataType* data() { return _data; }; + + private: + AsyncProgressWorkerBase* _asyncprogressworker; + DataType* _data; + }; + void OnWorkComplete(Napi::Env env, napi_status status) override; + + protected: + explicit AsyncProgressWorkerBase(const Object& receiver, + const Function& callback, + const char* resource_name, + const Object& resource, + size_t queue_size = 1); + virtual ~AsyncProgressWorkerBase(); + +// Optional callback of Napi::ThreadSafeFunction only available after +// NAPI_VERSION 4. Refs: https://github.com/nodejs/node/pull/27791 +#if NAPI_VERSION > 4 + explicit AsyncProgressWorkerBase(Napi::Env env, + const char* resource_name, + const Object& resource, + size_t queue_size = 1); +#endif + + static inline void OnAsyncWorkProgress(Napi::Env env, + Napi::Function jsCallback, + void* data); + + napi_status NonBlockingCall(DataType* data); + + private: + ThreadSafeFunction _tsfn; + bool _work_completed = false; + napi_status _complete_status; + static inline void OnThreadSafeFunctionFinalize( + Napi::Env env, void* data, AsyncProgressWorkerBase* context); +}; + +template +class AsyncProgressWorker : public AsyncProgressWorkerBase { + public: + virtual ~AsyncProgressWorker(); + + class ExecutionProgress { + friend class AsyncProgressWorker; + + public: + void Signal() const; + void Send(const T* data, size_t count) const; + + private: + explicit ExecutionProgress(AsyncProgressWorker* worker) : _worker(worker) {} + AsyncProgressWorker* const _worker; + }; + + void OnWorkProgress(void*) override; + + protected: + explicit AsyncProgressWorker(const Function& callback); + explicit AsyncProgressWorker(const Function& callback, + const char* resource_name); + explicit AsyncProgressWorker(const Function& callback, + const char* resource_name, + const Object& resource); + explicit AsyncProgressWorker(const Object& receiver, + const Function& callback); + explicit AsyncProgressWorker(const Object& receiver, + const Function& callback, + const char* resource_name); + explicit AsyncProgressWorker(const Object& receiver, + const Function& callback, + const char* resource_name, + const Object& resource); + +// Optional callback of Napi::ThreadSafeFunction only available after +// NAPI_VERSION 4. Refs: https://github.com/nodejs/node/pull/27791 +#if NAPI_VERSION > 4 + explicit AsyncProgressWorker(Napi::Env env); + explicit AsyncProgressWorker(Napi::Env env, const char* resource_name); + explicit AsyncProgressWorker(Napi::Env env, + const char* resource_name, + const Object& resource); +#endif + virtual void Execute(const ExecutionProgress& progress) = 0; + virtual void OnProgress(const T* data, size_t count) = 0; + + private: + void Execute() override; + void Signal(); + void SendProgress_(const T* data, size_t count); + + std::mutex _mutex; + T* _asyncdata; + size_t _asyncsize; + bool _signaled; +}; + +template +class AsyncProgressQueueWorker + : public AsyncProgressWorkerBase> { + public: + virtual ~AsyncProgressQueueWorker(){}; + + class ExecutionProgress { + friend class AsyncProgressQueueWorker; + + public: + void Signal() const; + void Send(const T* data, size_t count) const; + + private: + explicit ExecutionProgress(AsyncProgressQueueWorker* worker) + : _worker(worker) {} + AsyncProgressQueueWorker* const _worker; + }; + + void OnWorkComplete(Napi::Env env, napi_status status) override; + void OnWorkProgress(std::pair*) override; + + protected: + explicit AsyncProgressQueueWorker(const Function& callback); + explicit AsyncProgressQueueWorker(const Function& callback, + const char* resource_name); + explicit AsyncProgressQueueWorker(const Function& callback, + const char* resource_name, + const Object& resource); + explicit AsyncProgressQueueWorker(const Object& receiver, + const Function& callback); + explicit AsyncProgressQueueWorker(const Object& receiver, + const Function& callback, + const char* resource_name); + explicit AsyncProgressQueueWorker(const Object& receiver, + const Function& callback, + const char* resource_name, + const Object& resource); + +// Optional callback of Napi::ThreadSafeFunction only available after +// NAPI_VERSION 4. Refs: https://github.com/nodejs/node/pull/27791 +#if NAPI_VERSION > 4 + explicit AsyncProgressQueueWorker(Napi::Env env); + explicit AsyncProgressQueueWorker(Napi::Env env, const char* resource_name); + explicit AsyncProgressQueueWorker(Napi::Env env, + const char* resource_name, + const Object& resource); +#endif + virtual void Execute(const ExecutionProgress& progress) = 0; + virtual void OnProgress(const T* data, size_t count) = 0; + + private: + void Execute() override; + void Signal() const; + void SendProgress_(const T* data, size_t count); +}; +#endif // NAPI_VERSION > 3 && NAPI_HAS_THREADS + +// Memory management. +class MemoryManagement { + public: + static int64_t AdjustExternalMemory(BasicEnv env, int64_t change_in_bytes); +}; + +// Version management +class VersionManagement { + public: + static uint32_t GetNapiVersion(BasicEnv env); + static const napi_node_version* GetNodeVersion(BasicEnv env); +}; + +#if NAPI_VERSION > 5 +template +class Addon : public InstanceWrap { + public: + static inline Object Init(Env env, Object exports); + static T* Unwrap(Object wrapper); + + protected: + using AddonProp = ClassPropertyDescriptor; + void DefineAddon(Object exports, + const std::initializer_list& props); + Napi::Object DefineProperties(Object object, + const std::initializer_list& props); + + private: + Object entry_point_; +}; +#endif // NAPI_VERSION > 5 + +#ifdef NAPI_CPP_CUSTOM_NAMESPACE +} // namespace NAPI_CPP_CUSTOM_NAMESPACE +#endif + +} // namespace Napi + +// Inline implementations of all the above class methods are included here. +#include "napi-inl.h" + +#endif // SRC_NAPI_H_ diff --git a/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/node_addon_api.gyp b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/node_addon_api.gyp new file mode 100644 index 0000000..8c09926 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/node_addon_api.gyp @@ -0,0 +1,42 @@ +{ + 'targets': [ + { + 'target_name': 'node_addon_api', + 'type': 'none', + 'sources': [ 'napi.h', 'napi-inl.h' ], + 'direct_dependent_settings': { + 'include_dirs': [ '.' ], + 'includes': ['noexcept.gypi'], + } + }, + { + 'target_name': 'node_addon_api_except', + 'type': 'none', + 'sources': [ 'napi.h', 'napi-inl.h' ], + 'direct_dependent_settings': { + 'include_dirs': [ '.' ], + 'includes': ['except.gypi'], + } + }, + { + 'target_name': 'node_addon_api_except_all', + 'type': 'none', + 'sources': [ 'napi.h', 'napi-inl.h' ], + 'direct_dependent_settings': { + 'include_dirs': [ '.' ], + 'includes': ['except.gypi'], + 'defines': [ 'NODE_ADDON_API_CPP_EXCEPTIONS_ALL' ] + } + }, + { + 'target_name': 'node_addon_api_maybe', + 'type': 'none', + 'sources': [ 'napi.h', 'napi-inl.h' ], + 'direct_dependent_settings': { + 'include_dirs': [ '.' ], + 'includes': ['noexcept.gypi'], + 'defines': ['NODE_ADDON_API_ENABLE_MAYBE'] + } + }, + ] +} diff --git a/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/node_api.gyp b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/node_api.gyp new file mode 100644 index 0000000..4ff0ae7 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/node_api.gyp @@ -0,0 +1,9 @@ +{ + 'targets': [ + { + 'target_name': 'nothing', + 'type': 'static_library', + 'sources': [ 'nothing.c' ] + } + ] +} diff --git a/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/noexcept.gypi b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/noexcept.gypi new file mode 100644 index 0000000..83df4dd --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/noexcept.gypi @@ -0,0 +1,26 @@ +{ + 'defines': [ 'NODE_ADDON_API_DISABLE_CPP_EXCEPTIONS' ], + 'cflags': [ '-fno-exceptions' ], + 'cflags_cc': [ '-fno-exceptions' ], + 'conditions': [ + ["OS=='win'", { + # _HAS_EXCEPTIONS is already defined and set to 0 in common.gypi + #"defines": [ + # "_HAS_EXCEPTIONS=0" + #], + "msvs_settings": { + "VCCLCompilerTool": { + 'ExceptionHandling': 0, + 'EnablePREfast': 'true', + }, + }, + }], + ["OS=='mac'", { + 'xcode_settings': { + 'CLANG_CXX_LIBRARY': 'libc++', + 'MACOSX_DEPLOYMENT_TARGET': '10.7', + 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', + }, + }], + ], +} diff --git a/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/nothing.c b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/nothing.c new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/package-support.json b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/package-support.json new file mode 100644 index 0000000..10d3607 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/package-support.json @@ -0,0 +1,21 @@ +{ + "versions": [ + { + "version": "*", + "target": { + "node": "active" + }, + "response": { + "type": "time-permitting", + "paid": false, + "contact": { + "name": "node-addon-api team", + "url": "https://github.com/nodejs/node-addon-api/issues" + } + }, + "backing": [ { "project": "https://github.com/nodejs" }, + { "foundation": "https://openjsf.org/" } + ] + } + ] +} diff --git a/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/package.json b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/package.json new file mode 100644 index 0000000..b9393c6 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/package.json @@ -0,0 +1,480 @@ +{ + "bugs": { + "url": "https://github.com/nodejs/node-addon-api/issues" + }, + "contributors": [ + { + "name": "Abhishek Kumar Singh", + "url": "https://github.com/abhi11210646" + }, + { + "name": "Alba Mendez", + "url": "https://github.com/jmendeth" + }, + { + "name": "Alexander Floh", + "url": "https://github.com/alexanderfloh" + }, + { + "name": "Ammar Faizi", + "url": "https://github.com/ammarfaizi2" + }, + { + "name": "András Timár, Dr", + "url": "https://github.com/timarandras" + }, + { + "name": "Andrew Petersen", + "url": "https://github.com/kirbysayshi" + }, + { + "name": "Anisha Rohra", + "url": "https://github.com/anisha-rohra" + }, + { + "name": "Anna Henningsen", + "url": "https://github.com/addaleax" + }, + { + "name": "Arnaud Botella", + "url": "https://github.com/BotellaA" + }, + { + "name": "Arunesh Chandra", + "url": "https://github.com/aruneshchandra" + }, + { + "name": "Azlan Mukhtar", + "url": "https://github.com/azlan" + }, + { + "name": "Ben Berman", + "url": "https://github.com/rivertam" + }, + { + "name": "Benjamin Byholm", + "url": "https://github.com/kkoopa" + }, + { + "name": "Bill Gallafent", + "url": "https://github.com/gallafent" + }, + { + "name": "blagoev", + "url": "https://github.com/blagoev" + }, + { + "name": "Bruce A. MacNaughton", + "url": "https://github.com/bmacnaughton" + }, + { + "name": "Cory Mickelson", + "url": "https://github.com/corymickelson" + }, + { + "name": "Daniel Bevenius", + "url": "https://github.com/danbev" + }, + { + "name": "Dante Calderón", + "url": "https://github.com/dantehemerson" + }, + { + "name": "Darshan Sen", + "url": "https://github.com/RaisinTen" + }, + { + "name": "David Halls", + "url": "https://github.com/davedoesdev" + }, + { + "name": "Deepak Rajamohan", + "url": "https://github.com/deepakrkris" + }, + { + "name": "Dmitry Ashkadov", + "url": "https://github.com/dmitryash" + }, + { + "name": "Dongjin Na", + "url": "https://github.com/nadongguri" + }, + { + "name": "Doni Rubiagatra", + "url": "https://github.com/rubiagatra" + }, + { + "name": "Eric Bickle", + "url": "https://github.com/ebickle" + }, + { + "name": "extremeheat", + "url": "https://github.com/extremeheat" + }, + { + "name": "Feng Yu", + "url": "https://github.com/F3n67u" + }, + { + "name": "Ferdinand Holzer", + "url": "https://github.com/fholzer" + }, + { + "name": "Gabriel Schulhof", + "url": "https://github.com/gabrielschulhof" + }, + { + "name": "Guenter Sandner", + "url": "https://github.com/gms1" + }, + { + "name": "Gus Caplan", + "url": "https://github.com/devsnek" + }, + { + "name": "Helio Frota", + "url": "https://github.com/helio-frota" + }, + { + "name": "Hitesh Kanwathirtha", + "url": "https://github.com/digitalinfinity" + }, + { + "name": "ikokostya", + "url": "https://github.com/ikokostya" + }, + { + "name": "Jack Xia", + "url": "https://github.com/JckXia" + }, + { + "name": "Jake Barnes", + "url": "https://github.com/DuBistKomisch" + }, + { + "name": "Jake Yoon", + "url": "https://github.com/yjaeseok" + }, + { + "name": "Jason Ginchereau", + "url": "https://github.com/jasongin" + }, + { + "name": "Jenny", + "url": "https://github.com/egg-bread" + }, + { + "name": "Jeroen Janssen", + "url": "https://github.com/japj" + }, + { + "name": "Jim Schlight", + "url": "https://github.com/jschlight" + }, + { + "name": "Jinho Bang", + "url": "https://github.com/romandev" + }, + { + "name": "José Expósito", + "url": "https://github.com/JoseExposito" + }, + { + "name": "joshgarde", + "url": "https://github.com/joshgarde" + }, + { + "name": "Julian Mesa", + "url": "https://github.com/julianmesa-gitkraken" + }, + { + "name": "Kasumi Hanazuki", + "url": "https://github.com/hanazuki" + }, + { + "name": "Kelvin", + "url": "https://github.com/kelvinhammond" + }, + { + "name": "Kevin Eady", + "url": "https://github.com/KevinEady" + }, + { + "name": "Kévin VOYER", + "url": "https://github.com/kecsou" + }, + { + "name": "kidneysolo", + "url": "https://github.com/kidneysolo" + }, + { + "name": "Koki Nishihara", + "url": "https://github.com/Nishikoh" + }, + { + "name": "Konstantin Tarkus", + "url": "https://github.com/koistya" + }, + { + "name": "Kyle Farnung", + "url": "https://github.com/kfarnung" + }, + { + "name": "Kyle Kovacs", + "url": "https://github.com/nullromo" + }, + { + "name": "legendecas", + "url": "https://github.com/legendecas" + }, + { + "name": "LongYinan", + "url": "https://github.com/Brooooooklyn" + }, + { + "name": "Lovell Fuller", + "url": "https://github.com/lovell" + }, + { + "name": "Luciano Martorella", + "url": "https://github.com/lmartorella" + }, + { + "name": "mastergberry", + "url": "https://github.com/mastergberry" + }, + { + "name": "Mathias Küsel", + "url": "https://github.com/mathiask88" + }, + { + "name": "Mathias Stearn", + "url": "https://github.com/RedBeard0531" + }, + { + "name": "Matteo Collina", + "url": "https://github.com/mcollina" + }, + { + "name": "Michael Dawson", + "url": "https://github.com/mhdawson" + }, + { + "name": "Michael Price", + "url": "https://github.com/mikepricedev" + }, + { + "name": "Michele Campus", + "url": "https://github.com/kYroL01" + }, + { + "name": "Mikhail Cheshkov", + "url": "https://github.com/mcheshkov" + }, + { + "name": "nempoBu4", + "url": "https://github.com/nempoBu4" + }, + { + "name": "Nicola Del Gobbo", + "url": "https://github.com/NickNaso" + }, + { + "name": "Nick Soggin", + "url": "https://github.com/iSkore" + }, + { + "name": "Nikolai Vavilov", + "url": "https://github.com/seishun" + }, + { + "name": "Nurbol Alpysbayev", + "url": "https://github.com/anurbol" + }, + { + "name": "pacop", + "url": "https://github.com/pacop" + }, + { + "name": "Peter Šándor", + "url": "https://github.com/petersandor" + }, + { + "name": "Philipp Renoth", + "url": "https://github.com/DaAitch" + }, + { + "name": "rgerd", + "url": "https://github.com/rgerd" + }, + { + "name": "Richard Lau", + "url": "https://github.com/richardlau" + }, + { + "name": "Rolf Timmermans", + "url": "https://github.com/rolftimmermans" + }, + { + "name": "Ross Weir", + "url": "https://github.com/ross-weir" + }, + { + "name": "Ryuichi Okumura", + "url": "https://github.com/okuryu" + }, + { + "name": "Saint Gabriel", + "url": "https://github.com/chineduG" + }, + { + "name": "Sampson Gao", + "url": "https://github.com/sampsongao" + }, + { + "name": "Sam Roberts", + "url": "https://github.com/sam-github" + }, + { + "name": "strager", + "url": "https://github.com/strager" + }, + { + "name": "Taylor Woll", + "url": "https://github.com/boingoing" + }, + { + "name": "Thomas Gentilhomme", + "url": "https://github.com/fraxken" + }, + { + "name": "Tim Rach", + "url": "https://github.com/timrach" + }, + { + "name": "Tobias Nießen", + "url": "https://github.com/tniessen" + }, + { + "name": "todoroff", + "url": "https://github.com/todoroff" + }, + { + "name": "Toyo Li", + "url": "https://github.com/toyobayashi" + }, + { + "name": "Tux3", + "url": "https://github.com/tux3" + }, + { + "name": "Vlad Velmisov", + "url": "https://github.com/Velmisov" + }, + { + "name": "Vladimir Morozov", + "url": "https://github.com/vmoroz" + }, + { + "name": "WenheLI", + "url": "https://github.com/WenheLI" + }, + { + "name": "Xuguang Mei", + "url": "https://github.com/meixg" + }, + { + "name": "Yohei Kishimoto", + "url": "https://github.com/morokosi" + }, + { + "name": "Yulong Wang", + "url": "https://github.com/fs-eire" + }, + { + "name": "Ziqiu Zhao", + "url": "https://github.com/ZzqiZQute" + }, + { + "name": "Feng Yu", + "url": "https://github.com/F3n67u" + }, + { + "name": "wanlu wang", + "url": "https://github.com/wanlu" + }, + { + "name": "Caleb Hearon", + "url": "https://github.com/chearon" + }, + { + "name": "Marx", + "url": "https://github.com/MarxJiao" + }, + { + "name": "Ömer AKGÜL", + "url": "https://github.com/tuhalf" + } + ], + "description": "Node.js API (Node-API)", + "devDependencies": { + "benchmark": "^2.1.4", + "bindings": "^1.5.0", + "clang-format": "^1.4.0", + "eslint": "^9.13.0", + "fs-extra": "^11.1.1", + "neostandard": "^0.12.0", + "pre-commit": "^1.2.2", + "semver": "^7.6.0" + }, + "directories": {}, + "gypfile": false, + "homepage": "https://github.com/nodejs/node-addon-api", + "keywords": [ + "n-api", + "napi", + "addon", + "native", + "bindings", + "c", + "c++", + "nan", + "node-addon-api" + ], + "license": "MIT", + "main": "index.js", + "name": "node-addon-api", + "readme": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/nodejs/node-addon-api.git" + }, + "files": [ + "*.{c,h,gyp,gypi}", + "package-support.json", + "tools/" + ], + "scripts": { + "prebenchmark": "node-gyp rebuild -C benchmark", + "benchmark": "node benchmark", + "create-coverage": "npm test --coverage", + "report-coverage-html": "rm -rf coverage-html && mkdir coverage-html && gcovr -e test --merge-mode-functions merge-use-line-max --html-nested ./coverage-html/index.html test", + "report-coverage-xml": "rm -rf coverage-xml && mkdir coverage-xml && gcovr -e test --merge-mode-functions merge-use-line-max --xml -o ./coverage-xml/coverage-cxx.xml test", + "pretest": "node-gyp rebuild -C test", + "test": "node test", + "test:debug": "node-gyp rebuild -C test --debug && NODE_API_BUILD_CONFIG=Debug node ./test/index.js", + "predev": "node-gyp rebuild -C test --debug", + "dev": "node test", + "predev:incremental": "node-gyp configure build -C test --debug", + "dev:incremental": "node test", + "doc": "doxygen doc/Doxyfile", + "lint": "eslint && node tools/clang-format", + "lint:fix": "eslint --fix && node tools/clang-format --fix" + }, + "pre-commit": "lint", + "version": "8.6.0", + "support": true, + "engines": { + "node": "^18 || ^20 || >= 21" + } +} diff --git a/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/tools/README.md b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/tools/README.md new file mode 100644 index 0000000..6b80e94 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/tools/README.md @@ -0,0 +1,73 @@ +# Tools + +## clang-format + +The clang-format checking tools is designed to check changed lines of code compared to given git-refs. + +## Migration Script + +The migration tool is designed to reduce repetitive work in the migration process. However, the script is not aiming to convert every thing for you. There are usually some small fixes and major reconstruction required. + +### How To Use + +To run the conversion script, first make sure you have the latest `node-addon-api` in your `node_modules` directory. +``` +npm install node-addon-api +``` + +Then run the script passing your project directory +``` +node ./node_modules/node-addon-api/tools/conversion.js ./ +``` + +After finish, recompile and debug things that are missed by the script. + + +### Quick Fixes +Here is the list of things that can be fixed easily. + 1. Change your methods' return value to void if it doesn't return value to JavaScript. + 2. Use `.` to access attribute or to invoke member function in Napi::Object instead of `->`. + 3. `Napi::New(env, value);` to `Napi::[Type]::New(env, value); + + +### Major Reconstructions +The implementation of `Napi::ObjectWrap` is significantly different from NAN's. `Napi::ObjectWrap` takes a pointer to the wrapped object and creates a reference to the wrapped object inside ObjectWrap constructor. `Napi::ObjectWrap` also associates wrapped object's instance methods to Javascript module instead of static methods like NAN. + +So if you use Nan::ObjectWrap in your module, you will need to execute the following steps. + + 1. Convert your [ClassName]::New function to a constructor function that takes a `Napi::CallbackInfo`. Declare it as +``` +[ClassName](const Napi::CallbackInfo& info); +``` +and define it as +``` +[ClassName]::[ClassName](const Napi::CallbackInfo& info) : Napi::ObjectWrap<[ClassName]>(info){ + ... +} +``` +This way, the `Napi::ObjectWrap` constructor will be invoked after the object has been instantiated and `Napi::ObjectWrap` can use the `this` pointer to create a reference to the wrapped object. + + 2. Move your original constructor code into the new constructor. Delete your original constructor. + 3. In your class initialization function, associate native methods in the following way. +``` +Napi::FunctionReference constructor; + +void [ClassName]::Init(Napi::Env env, Napi::Object exports, Napi::Object module) { + Napi::HandleScope scope(env); + Napi::Function ctor = DefineClass(env, "Canvas", { + InstanceMethod<&[ClassName]::Func1>("Func1"), + InstanceMethod<&[ClassName]::Func2>("Func2"), + InstanceAccessor<&[ClassName]::ValueGetter>("Value"), + StaticMethod<&[ClassName]::StaticMethod>("MethodName"), + InstanceValue("Value", Napi::[Type]::New(env, value)), + }); + + constructor = Napi::Persistent(ctor); + constructor .SuppressDestruct(); + exports.Set("[ClassName]", ctor); +} +``` + 4. In function where you need to Unwrap the ObjectWrap in NAN like `[ClassName]* native = Nan::ObjectWrap::Unwrap<[ClassName]>(info.This());`, use `this` pointer directly as the unwrapped object as each ObjectWrap instance is associated with a unique object instance. + + +If you still find issues after following this guide, please leave us an issue describing your problem and we will try to resolve it. diff --git a/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/tools/check-napi.js b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/tools/check-napi.js new file mode 100644 index 0000000..9199af3 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/tools/check-napi.js @@ -0,0 +1,99 @@ +'use strict'; +// Descend into a directory structure and, for each file matching *.node, output +// based on the imports found in the file whether it's an N-API module or not. + +const fs = require('fs'); +const path = require('path'); + +// Read the output of the command, break it into lines, and use the reducer to +// decide whether the file is an N-API module or not. +function checkFile (file, command, argv, reducer) { + const child = require('child_process').spawn(command, argv, { + stdio: ['inherit', 'pipe', 'inherit'] + }); + let leftover = ''; + let isNapi; + child.stdout.on('data', (chunk) => { + if (isNapi === undefined) { + chunk = (leftover + chunk.toString()).split(/[\r\n]+/); + leftover = chunk.pop(); + isNapi = chunk.reduce(reducer, isNapi); + if (isNapi !== undefined) { + child.kill(); + } + } + }); + child.on('close', (code, signal) => { + if ((code === null && signal !== null) || (code !== 0)) { + console.log( + command + ' exited with code: ' + code + ' and signal: ' + signal); + } else { + // Green if it's a N-API module, red otherwise. + console.log( + '\x1b[' + (isNapi ? '42' : '41') + 'm' + + (isNapi ? ' N-API' : 'Not N-API') + + '\x1b[0m: ' + file); + } + }); +} + +// Use nm -a to list symbols. +function checkFileUNIX (file) { + checkFile(file, 'nm', ['-a', file], (soFar, line) => { + if (soFar === undefined) { + line = line.match(/([0-9a-f]*)? ([a-zA-Z]) (.*$)/); + if (line[2] === 'U') { + if (/^napi/.test(line[3])) { + soFar = true; + } + } + } + return soFar; + }); +} + +// Use dumpbin /imports to list symbols. +function checkFileWin32 (file) { + checkFile(file, 'dumpbin', ['/imports', file], (soFar, line) => { + if (soFar === undefined) { + line = line.match(/([0-9a-f]*)? +([a-zA-Z0-9]) (.*$)/); + if (line && /^napi/.test(line[line.length - 1])) { + soFar = true; + } + } + return soFar; + }); +} + +// Descend into a directory structure and pass each file ending in '.node' to +// one of the above checks, depending on the OS. +function recurse (top) { + fs.readdir(top, (error, items) => { + if (error) { + throw new Error('error reading directory ' + top + ': ' + error); + } + items.forEach((item) => { + item = path.join(top, item); + fs.stat(item, ((item) => (error, stats) => { + if (error) { + throw new Error('error about ' + item + ': ' + error); + } + if (stats.isDirectory()) { + recurse(item); + } else if (/[.]node$/.test(item) && + // Explicitly ignore files called 'nothing.node' because they are + // artefacts of node-addon-api having identified a version of + // Node.js that ships with a correct implementation of N-API. + path.basename(item) !== 'nothing.node') { + process.platform === 'win32' + ? checkFileWin32(item) + : checkFileUNIX(item); + } + })(item)); + }); + }); +} + +// Start with the directory given on the command line or the current directory +// if nothing was given. +recurse(process.argv.length > 3 ? process.argv[2] : '.'); diff --git a/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/tools/clang-format.js b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/tools/clang-format.js new file mode 100644 index 0000000..e4bb4f5 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/tools/clang-format.js @@ -0,0 +1,71 @@ +#!/usr/bin/env node + +const spawn = require('child_process').spawnSync; +const path = require('path'); + +const filesToCheck = ['*.h', '*.cc']; +const FORMAT_START = process.env.FORMAT_START || 'main'; + +function main (args) { + let fix = false; + while (args.length > 0) { + switch (args[0]) { + case '-f': + case '--fix': + fix = true; + break; + default: + } + args.shift(); + } + + const clangFormatPath = path.dirname(require.resolve('clang-format')); + const binary = process.platform === 'win32' + ? 'node_modules\\.bin\\clang-format.cmd' + : 'node_modules/.bin/clang-format'; + const options = ['--binary=' + binary, '--style=file']; + if (fix) { + options.push(FORMAT_START); + } else { + options.push('--diff', FORMAT_START); + } + + const gitClangFormatPath = path.join(clangFormatPath, 'bin/git-clang-format'); + const result = spawn( + 'python', + [gitClangFormatPath, ...options, '--', ...filesToCheck], + { encoding: 'utf-8' } + ); + + if (result.stderr) { + console.error('Error running git-clang-format:', result.stderr); + return 2; + } + + const clangFormatOutput = result.stdout.trim(); + // Bail fast if in fix mode. + if (fix) { + console.log(clangFormatOutput); + return 0; + } + // Detect if there is any complains from clang-format + if ( + clangFormatOutput !== '' && + clangFormatOutput !== 'no modified files to format' && + clangFormatOutput !== 'clang-format did not modify any files' + ) { + console.error(clangFormatOutput); + const fixCmd = 'npm run lint:fix'; + console.error(` + ERROR: please run "${fixCmd}" to format changes in your commit + Note that when running the command locally, please keep your local + main branch and working branch up to date with nodejs/node-addon-api + to exclude un-related complains. + Or you can run "env FORMAT_START=upstream/main ${fixCmd}".`); + return 1; + } +} + +if (require.main === module) { + process.exitCode = main(process.argv.slice(2)); +} diff --git a/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/tools/conversion.js b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/tools/conversion.js new file mode 100755 index 0000000..e92a03a --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/node_modules/node-addon-api/tools/conversion.js @@ -0,0 +1,301 @@ +#! /usr/bin/env node + +'use strict'; + +const fs = require('fs'); +const path = require('path'); + +const args = process.argv.slice(2); +const dir = args[0]; +if (!dir) { + console.log('Usage: node ' + path.basename(__filename) + ' '); + process.exit(1); +} + +const NodeApiVersion = require('../').version; + +const disable = args[1]; +let ConfigFileOperations; +if (disable !== '--disable' && dir !== '--disable') { + ConfigFileOperations = { + 'package.json': [ + [/([ ]*)"dependencies": {/g, '$1"dependencies": {\n$1 "node-addon-api": "' + NodeApiVersion + '",'], + [/[ ]*"nan": *"[^"]+"(,|)[\n\r]/g, ''] + ], + 'binding.gyp': [ + [/([ ]*)'include_dirs': \[/g, '$1\'include_dirs\': [\n$1 \'\s+(\w+)\s*=\s*Nan::New\([\w\d:]+\);(?:\w+->Reset\(\1\))?\s+\1->SetClassName\(Nan::String::New\("(\w+)"\)\);/g, 'Napi::Function $1 = DefineClass(env, "$2", {'], + [/Local\s+(\w+)\s*=\s*Nan::New\([\w\d:]+\);\s+(\w+)\.Reset\((\1)\);\s+\1->SetClassName\((Nan::String::New|Nan::New<(v8::)*String>)\("(.+?)"\)\);/g, 'Napi::Function $1 = DefineClass(env, "$6", {'], + [/Local\s+(\w+)\s*=\s*Nan::New\([\w\d:]+\);(?:\w+->Reset\(\1\))?\s+\1->SetClassName\(Nan::String::New\("(\w+)"\)\);/g, 'Napi::Function $1 = DefineClass(env, "$2", {'], + [/Nan::New\(([\w\d:]+)\)->GetFunction\(\)/g, 'Napi::Function::New(env, $1)'], + [/Nan::New\(([\w\d:]+)\)->GetFunction()/g, 'Napi::Function::New(env, $1);'], + [/Nan::New\(([\w\d:]+)\)/g, 'Napi::Function::New(env, $1)'], + [/Nan::New\(([\w\d:]+)\)/g, 'Napi::Function::New(env, $1)'], + + // FunctionTemplate to FunctionReference + [/Nan::Persistent<(v8::)*FunctionTemplate>/g, 'Napi::FunctionReference'], + [/Nan::Persistent<(v8::)*Function>/g, 'Napi::FunctionReference'], + [/v8::Local/g, 'Napi::FunctionReference'], + [/Local/g, 'Napi::FunctionReference'], + [/v8::FunctionTemplate/g, 'Napi::FunctionReference'], + [/FunctionTemplate/g, 'Napi::FunctionReference'], + + [/([ ]*)Nan::SetPrototypeMethod\(\w+, "(\w+)", (\w+)\);/g, '$1InstanceMethod("$2", &$3),'], + [/([ ]*)(?:\w+\.Reset\(\w+\);\s+)?\(target\)\.Set\("(\w+)",\s*Nan::GetFunction\((\w+)\)\);/gm, + '});\n\n' + + '$1constructor = Napi::Persistent($3);\n' + + '$1constructor.SuppressDestruct();\n' + + '$1target.Set("$2", $3);'], + + // TODO: Other attribute combinations + [/static_cast\(ReadOnly\s*\|\s*DontDelete\)/gm, + 'static_cast(napi_enumerable | napi_configurable)'], + + [/([\w\d:<>]+?)::Cast\((.+?)\)/g, '$2.As<$1>()'], + + [/\*Nan::Utf8String\(([^)]+)\)/g, '$1->As().Utf8Value().c_str()'], + [/Nan::Utf8String +(\w+)\(([^)]+)\)/g, 'std::string $1 = $2.As()'], + [/Nan::Utf8String/g, 'std::string'], + + [/v8::String::Utf8Value (.+?)\((.+?)\)/g, 'Napi::String $1(env, $2)'], + [/String::Utf8Value (.+?)\((.+?)\)/g, 'Napi::String $1(env, $2)'], + [/\.length\(\)/g, '.Length()'], + + [/Nan::MakeCallback\(([^,]+),[\s\\]+([^,]+),/gm, '$2.MakeCallback($1,'], + + [/class\s+(\w+)\s*:\s*public\s+Nan::ObjectWrap/g, 'class $1 : public Napi::ObjectWrap<$1>'], + [/(\w+)\(([^)]*)\)\s*:\s*Nan::ObjectWrap\(\)\s*(,)?/gm, '$1($2) : Napi::ObjectWrap<$1>()$3'], + + // HandleOKCallback to OnOK + [/HandleOKCallback/g, 'OnOK'], + // HandleErrorCallback to OnError + [/HandleErrorCallback/g, 'OnError'], + + // ex. .As() to .As() + [/\.As\(\)/g, '.As()'], + [/\.As<(Value|Boolean|String|Number|Object|Array|Symbol|External|Function)>\(\)/g, '.As()'], + + // ex. Nan::New(info[0]) to Napi::Number::New(info[0]) + [/Nan::New<(v8::)*Integer>\((.+?)\)/g, 'Napi::Number::New(env, $2)'], + [/Nan::New\(([0-9.]+)\)/g, 'Napi::Number::New(env, $1)'], + [/Nan::New<(v8::)*String>\("(.+?)"\)/g, 'Napi::String::New(env, "$2")'], + [/Nan::New\("(.+?)"\)/g, 'Napi::String::New(env, "$1")'], + [/Nan::New<(v8::)*(.+?)>\(\)/g, 'Napi::$2::New(env)'], + [/Nan::New<(.+?)>\(\)/g, 'Napi::$1::New(env)'], + [/Nan::New<(v8::)*(.+?)>\(/g, 'Napi::$2::New(env, '], + [/Nan::New<(.+?)>\(/g, 'Napi::$1::New(env, '], + [/Nan::NewBuffer\(/g, 'Napi::Buffer::New(env, '], + // TODO: Properly handle this + [/Nan::New\(/g, 'Napi::New(env, '], + + [/\.IsInt32\(\)/g, '.IsNumber()'], + [/->IsInt32\(\)/g, '.IsNumber()'], + + [/(.+?)->BooleanValue\(\)/g, '$1.As().Value()'], + [/(.+?)->Int32Value\(\)/g, '$1.As().Int32Value()'], + [/(.+?)->Uint32Value\(\)/g, '$1.As().Uint32Value()'], + [/(.+?)->IntegerValue\(\)/g, '$1.As().Int64Value()'], + [/(.+?)->NumberValue\(\)/g, '$1.As().DoubleValue()'], + + // ex. Nan::To(info[0]) to info[0].Value() + [/Nan::To\((.+?)\)/g, '$2.To()'], + [/Nan::To<(Boolean|String|Number|Object|Array|Symbol|Function)>\((.+?)\)/g, '$2.To()'], + // ex. Nan::To(info[0]) to info[0].As().Value() + [/Nan::To\((.+?)\)/g, '$1.As().Value()'], + // ex. Nan::To(info[0]) to info[0].As().Int32Value() + [/Nan::To\((.+?)\)/g, '$1.As().Int32Value()'], + // ex. Nan::To(info[0]) to info[0].As().Int32Value() + [/Nan::To\((.+?)\)/g, '$1.As().Int32Value()'], + // ex. Nan::To(info[0]) to info[0].As().Uint32Value() + [/Nan::To\((.+?)\)/g, '$1.As().Uint32Value()'], + // ex. Nan::To(info[0]) to info[0].As().Int64Value() + [/Nan::To\((.+?)\)/g, '$1.As().Int64Value()'], + // ex. Nan::To(info[0]) to info[0].As().FloatValue() + [/Nan::To\((.+?)\)/g, '$1.As().FloatValue()'], + // ex. Nan::To(info[0]) to info[0].As().DoubleValue() + [/Nan::To\((.+?)\)/g, '$1.As().DoubleValue()'], + + [/Nan::New\((\w+)\)->HasInstance\((\w+)\)/g, '$2.InstanceOf($1.Value())'], + + [/Nan::Has\(([^,]+),\s*/gm, '($1).Has('], + [/\.Has\([\s|\\]*Nan::New<(v8::)*String>\(([^)]+)\)\)/gm, '.Has($1)'], + [/\.Has\([\s|\\]*Nan::New\(([^)]+)\)\)/gm, '.Has($1)'], + + [/Nan::Get\(([^,]+),\s*/gm, '($1).Get('], + [/\.Get\([\s|\\]*Nan::New<(v8::)*String>\(([^)]+)\)\)/gm, '.Get($1)'], + [/\.Get\([\s|\\]*Nan::New\(([^)]+)\)\)/gm, '.Get($1)'], + + [/Nan::Set\(([^,]+),\s*/gm, '($1).Set('], + [/\.Set\([\s|\\]*Nan::New<(v8::)*String>\(([^)]+)\)\s*,/gm, '.Set($1,'], + [/\.Set\([\s|\\]*Nan::New\(([^)]+)\)\s*,/gm, '.Set($1,'], + + // ex. node::Buffer::HasInstance(info[0]) to info[0].IsBuffer() + [/node::Buffer::HasInstance\((.+?)\)/g, '$1.IsBuffer()'], + // ex. node::Buffer::Length(info[0]) to info[0].Length() + [/node::Buffer::Length\((.+?)\)/g, '$1.As>().Length()'], + // ex. node::Buffer::Data(info[0]) to info[0].Data() + [/node::Buffer::Data\((.+?)\)/g, '$1.As>().Data()'], + [/Nan::CopyBuffer\(/g, 'Napi::Buffer::Copy(env, '], + + // Nan::AsyncQueueWorker(worker) + [/Nan::AsyncQueueWorker\((.+)\);/g, '$1.Queue();'], + [/Nan::(Undefined|Null|True|False)\(\)/g, 'env.$1()'], + + // Nan::ThrowError(error) to Napi::Error::New(env, error).ThrowAsJavaScriptException() + [/([ ]*)return Nan::Throw(\w*?)Error\((.+?)\);/g, '$1Napi::$2Error::New(env, $3).ThrowAsJavaScriptException();\n$1return env.Null();'], + [/Nan::Throw(\w*?)Error\((.+?)\);\n(\s*)return;/g, 'Napi::$1Error::New(env, $2).ThrowAsJavaScriptException();\n$3return env.Null();'], + [/Nan::Throw(\w*?)Error\((.+?)\);/g, 'Napi::$1Error::New(env, $2).ThrowAsJavaScriptException();\n'], + // Nan::RangeError(error) to Napi::RangeError::New(env, error) + [/Nan::(\w*?)Error\((.+)\)/g, 'Napi::$1Error::New(env, $2)'], + + [/Nan::Set\((.+?),\n* *(.+?),\n* *(.+?),\n* *(.+?)\)/g, '$1.Set($2, $3, $4)'], + + [/Nan::(Escapable)?HandleScope\s+(\w+)\s*;/g, 'Napi::$1HandleScope $2(env);'], + [/Nan::(Escapable)?HandleScope/g, 'Napi::$1HandleScope'], + [/Nan::ForceSet\(([^,]+), ?/g, '$1->DefineProperty('], + [/\.ForceSet\(Napi::String::New\(env, "(\w+)"\),\s*?/g, '.DefineProperty("$1", '], + // [ /Nan::GetPropertyNames\(([^,]+)\)/, '$1->GetPropertyNames()' ], + [/Nan::Equals\(([^,]+),/g, '$1.StrictEquals('], + + [/(.+)->Set\(/g, '$1.Set('], + + [/Nan::Callback/g, 'Napi::FunctionReference'], + + [/Nan::Persistent/g, 'Napi::ObjectReference'], + [/Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target/g, 'Napi::Env& env, Napi::Object& target'], + + [/(\w+)\*\s+(\w+)\s*=\s*Nan::ObjectWrap::Unwrap<\w+>\(info\.This\(\)\);/g, '$1* $2 = this;'], + [/Nan::ObjectWrap::Unwrap<(\w+)>\((.*)\);/g, '$2.Unwrap<$1>();'], + + [/Nan::NAN_METHOD_RETURN_TYPE/g, 'void'], + [/NAN_INLINE/g, 'inline'], + + [/Nan::NAN_METHOD_ARGS_TYPE/g, 'const Napi::CallbackInfo&'], + [/NAN_METHOD\(([\w\d:]+?)\)/g, 'Napi::Value $1(const Napi::CallbackInfo& info)'], + [/static\s*NAN_GETTER\(([\w\d:]+?)\)/g, 'Napi::Value $1(const Napi::CallbackInfo& info)'], + [/NAN_GETTER\(([\w\d:]+?)\)/g, 'Napi::Value $1(const Napi::CallbackInfo& info)'], + [/static\s*NAN_SETTER\(([\w\d:]+?)\)/g, 'void $1(const Napi::CallbackInfo& info, const Napi::Value& value)'], + [/NAN_SETTER\(([\w\d:]+?)\)/g, 'void $1(const Napi::CallbackInfo& info, const Napi::Value& value)'], + [/void Init\((v8::)*Local<(v8::)*Object> exports\)/g, 'Napi::Object Init(Napi::Env env, Napi::Object exports)'], + [/NAN_MODULE_INIT\(([\w\d:]+?)\);/g, 'Napi::Object $1(Napi::Env env, Napi::Object exports);'], + [/NAN_MODULE_INIT\(([\w\d:]+?)\)/g, 'Napi::Object $1(Napi::Env env, Napi::Object exports)'], + + [/::(Init(?:ialize)?)\(target\)/g, '::$1(env, target, module)'], + [/constructor_template/g, 'constructor'], + + [/Nan::FunctionCallbackInfo<(v8::)?Value>[ ]*& [ ]*info\)[ ]*{\n*([ ]*)/gm, 'Napi::CallbackInfo& info) {\n$2Napi::Env env = info.Env();\n$2'], + [/Nan::FunctionCallbackInfo<(v8::)*Value>\s*&\s*info\);/g, 'Napi::CallbackInfo& info);'], + [/Nan::FunctionCallbackInfo<(v8::)*Value>\s*&/g, 'Napi::CallbackInfo&'], + + [/Buffer::HasInstance\(([^)]+)\)/g, '$1.IsBuffer()'], + + [/info\[(\d+)\]->/g, 'info[$1].'], + [/info\[([\w\d]+)\]->/g, 'info[$1].'], + [/info\.This\(\)->/g, 'info.This().'], + [/->Is(Object|String|Int32|Number)\(\)/g, '.Is$1()'], + [/info.GetReturnValue\(\).SetUndefined\(\)/g, 'return env.Undefined()'], + [/info\.GetReturnValue\(\)\.Set\(((\n|.)+?)\);/g, 'return $1;'], + + // ex. Local to Napi::Value + [/v8::Local/g, 'Napi::$1'], + [/Local<(Value|Boolean|String|Number|Object|Array|Symbol|External|Function)>/g, 'Napi::$1'], + + // Declare an env in helper functions that take a Napi::Value + [/(\w+)\(Napi::Value (\w+)(,\s*[^()]+)?\)\s*{\n*([ ]*)/gm, '$1(Napi::Value $2$3) {\n$4Napi::Env env = $2.Env();\n$4'], + + // delete #include and/or + [/#include +(<|")(?:node|nan).h("|>)/g, '#include $1napi.h$2\n#include $1uv.h$2'], + // NODE_MODULE to NODE_API_MODULE + [/NODE_MODULE/g, 'NODE_API_MODULE'], + [/Nan::/g, 'Napi::'], + [/nan.h/g, 'napi.h'], + + // delete .FromJust() + [/\.FromJust\(\)/g, ''], + // delete .ToLocalCheck() + [/\.ToLocalChecked\(\)/g, ''], + [/^.*->SetInternalFieldCount\(.*$/gm, ''], + + // replace using node; and/or using v8; to using Napi; + [/using (node|v8);/g, 'using Napi;'], + [/using namespace (node|Nan|v8);/g, 'using namespace Napi;'], + // delete using v8::Local; + [/using v8::Local;\n/g, ''], + // replace using v8::XXX; with using Napi::XXX + [/using v8::([A-Za-z]+);/g, 'using Napi::$1;'] + +]; + +const paths = listFiles(dir); +paths.forEach(function (dirEntry) { + const filename = dirEntry.split('\\').pop().split('/').pop(); + + // Check whether the file is a source file or a config file + // then execute function accordingly + const sourcePattern = /.+\.h|.+\.cc|.+\.cpp/; + if (sourcePattern.test(filename)) { + convertFile(dirEntry, SourceFileOperations); + } else if (ConfigFileOperations[filename] != null) { + convertFile(dirEntry, ConfigFileOperations[filename]); + } +}); + +function listFiles (dir, filelist) { + const files = fs.readdirSync(dir); + filelist = filelist || []; + files.forEach(function (file) { + if (file === 'node_modules') { + return; + } + + if (fs.statSync(path.join(dir, file)).isDirectory()) { + filelist = listFiles(path.join(dir, file), filelist); + } else { + filelist.push(path.join(dir, file)); + } + }); + return filelist; +} + +function convert (content, operations) { + for (let i = 0; i < operations.length; i++) { + const operation = operations[i]; + content = content.replace(operation[0], operation[1]); + } + return content; +} + +function convertFile (fileName, operations) { + fs.readFile(fileName, 'utf-8', function (err, file) { + if (err) throw err; + + file = convert(file, operations); + + fs.writeFile(fileName, file, function (err) { + if (err) throw err; + }); + }); +} diff --git a/node_modules/@julusian/jpeg-turbo/package.json b/node_modules/@julusian/jpeg-turbo/package.json new file mode 100644 index 0000000..eafac2a --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/package.json @@ -0,0 +1,48 @@ +{ + "name": "@julusian/jpeg-turbo", + "version": "3.0.1", + "description": "Limited libjpeg-turbo bindings for Node.js.", + "keywords": [ + "jpeg", + "jpeg-turbo", + "libjpeg-turbo" + ], + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/Julusian/node-jpeg-turbo.git" + }, + "binary": { + "napi_versions": [ + 10 + ] + }, + "engines": { + "node": ">=22.18" + }, + "main": "./index.js", + "types": "./module.d.ts", + "dependencies": { + "cmake-js": "^8.0.0", + "node-addon-api": "^8.5.0", + "pkg-prebuilds": "^1.0.0" + }, + "scripts": { + "install": "pkg-prebuilds-verify ./binding-options.js || cmake-js compile --target jpeg-turbo", + "build": "cmake-js build --target jpeg-turbo", + "rebuild": "cmake-js rebuild --target jpeg-turbo", + "test": "jest" + }, + "devDependencies": { + "jest": "^30.2.0" + }, + "files": [ + "/prebuilds", + "/src", + "/CMakeLists.txt", + "/index.js", + "/binding-options.js", + "/module.d.ts" + ], + "packageManager": "yarn@4.12.0" +} diff --git a/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-darwin-arm64/node-napi-v10.node b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-darwin-arm64/node-napi-v10.node new file mode 100644 index 0000000..248acbd Binary files /dev/null and b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-darwin-arm64/node-napi-v10.node differ diff --git a/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-darwin-x64/node-napi-v10.node b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-darwin-x64/node-napi-v10.node new file mode 100644 index 0000000..3f25ed5 Binary files /dev/null and b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-darwin-x64/node-napi-v10.node differ diff --git a/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-arm/libturbojpeg.so.0 b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-arm/libturbojpeg.so.0 new file mode 100644 index 0000000..d90653d Binary files /dev/null and b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-arm/libturbojpeg.so.0 differ diff --git a/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-arm/node-napi-v10.node b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-arm/node-napi-v10.node new file mode 100644 index 0000000..f1deedc Binary files /dev/null and b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-arm/node-napi-v10.node differ diff --git a/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-arm64/libturbojpeg.so.0 b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-arm64/libturbojpeg.so.0 new file mode 100644 index 0000000..5d9bdb5 Binary files /dev/null and b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-arm64/libturbojpeg.so.0 differ diff --git a/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-arm64/node-napi-v10.node b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-arm64/node-napi-v10.node new file mode 100644 index 0000000..0343f40 Binary files /dev/null and b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-arm64/node-napi-v10.node differ diff --git a/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-x64-musl/libturbojpeg.so.0 b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-x64-musl/libturbojpeg.so.0 new file mode 100644 index 0000000..ef89e14 Binary files /dev/null and b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-x64-musl/libturbojpeg.so.0 differ diff --git a/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-x64-musl/node-napi-v10.node b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-x64-musl/node-napi-v10.node new file mode 100644 index 0000000..010b5ba Binary files /dev/null and b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-x64-musl/node-napi-v10.node differ diff --git a/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-x64/libturbojpeg.so.0 b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-x64/libturbojpeg.so.0 new file mode 100644 index 0000000..df9c36d Binary files /dev/null and b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-x64/libturbojpeg.so.0 differ diff --git a/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-x64/node-napi-v10.node b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-x64/node-napi-v10.node new file mode 100644 index 0000000..f1517c7 Binary files /dev/null and b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-linux-x64/node-napi-v10.node differ diff --git a/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-win32-arm64/node-napi-v10.node b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-win32-arm64/node-napi-v10.node new file mode 100644 index 0000000..f07d187 Binary files /dev/null and b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-win32-arm64/node-napi-v10.node differ diff --git a/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-win32-ia32/node-napi-v10.node b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-win32-ia32/node-napi-v10.node new file mode 100644 index 0000000..18f20d4 Binary files /dev/null and b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-win32-ia32/node-napi-v10.node differ diff --git a/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-win32-x64/node-napi-v10.node b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-win32-x64/node-napi-v10.node new file mode 100644 index 0000000..342a0f3 Binary files /dev/null and b/node_modules/@julusian/jpeg-turbo/prebuilds/jpeg-turbo-win32-x64/node-napi-v10.node differ diff --git a/node_modules/@julusian/jpeg-turbo/src/buffersize.cc b/node_modules/@julusian/jpeg-turbo/src/buffersize.cc new file mode 100644 index 0000000..9635537 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/src/buffersize.cc @@ -0,0 +1,32 @@ +#include "buffersize.h" + +Napi::Value BufferSize(const Napi::CallbackInfo &info) +{ + Napi::Env env = info.Env(); + + if (info.Length() < 1) + { + Napi::TypeError::New(env, "Not enough arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + + if (!info[0].IsObject()) + { + Napi::TypeError::New(env, "Invalid options").ThrowAsJavaScriptException(); + return env.Null(); + } + Napi::Object options = info[0].As(); + + BufferSizeOptions parsedOptions = ParseBufferSizeOptions(env, options); + if (!parsedOptions.valid) + { + return env.Null(); + } + + // Finally, calculate the buffer size + uint32_t dstLength = tjBufSize(parsedOptions.width, parsedOptions.height, parsedOptions.subsampling); + Napi::Number result = Napi::Number::New(env, dstLength); + + return result; +} diff --git a/node_modules/@julusian/jpeg-turbo/src/buffersize.h b/node_modules/@julusian/jpeg-turbo/src/buffersize.h new file mode 100644 index 0000000..166ccdd --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/src/buffersize.h @@ -0,0 +1,8 @@ +#ifndef NODE_JPEGTURBO_BUFFERSIZE_H +#define NODE_JPEGTURBO_BUFFERSIZE_H + +#include "util.h" + +Napi::Value BufferSize(const Napi::CallbackInfo &info); + +#endif diff --git a/node_modules/@julusian/jpeg-turbo/src/compress.cc b/node_modules/@julusian/jpeg-turbo/src/compress.cc new file mode 100644 index 0000000..6f85fc1 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/src/compress.cc @@ -0,0 +1,283 @@ +#include "compress.h" + +struct CompressProps +{ + unsigned char *srcData; + uint32_t format; + uint32_t width; + uint32_t stride; + uint32_t height; + uint32_t subsampling; + int quality; + int bpp; + int flags; + unsigned long resSize; + unsigned char *resData; +}; + +std::string DoCompress(CompressProps &props) +{ + tjhandle handle = tjInitCompress(); + if (handle == nullptr) + { + return tjGetErrorStr(); + } + + int err = tjCompress2(handle, + props.srcData, + props.width, + props.stride * props.bpp, + props.height, + props.format, + &props.resData, + &props.resSize, + props.subsampling, + props.quality, + props.flags); + if (err != 0) + { + tjDestroy(handle); + return tjGetErrorStr(); + } + + err = tjDestroy(handle); + if (err != 0) + { + return tjGetErrorStr(); + } + + if (props.resData == nullptr) + { + return "No output data"; + } + + return ""; +} + +Napi::Object CompressResult(const Napi::Env &env, const Napi::Buffer dstBuffer, const CompressProps &props) +{ + Napi::Object res = Napi::Object::New(env); + res.Set("data", dstBuffer); + res.Set("size", props.resSize); + + return res; +} + +class CompressWorker : public Napi::AsyncWorker +{ +public: + CompressWorker( + Napi::Env &env, + Napi::Buffer &srcBuffer, + Napi::Buffer &dstBuffer, + CompressProps &props) + : AsyncWorker(env), + deferred(Napi::Promise::Deferred::New(env)), + srcBuffer(Napi::Reference>::New(srcBuffer, 1)), + dstBuffer(Napi::Reference>::New(dstBuffer, 1)), + props(props) + { + } + + ~CompressWorker() + { + this->srcBuffer.Reset(); + this->dstBuffer.Reset(); + } + + void Execute() + { + std::string err = DoCompress(this->props); + if (!err.empty()) + { + SetError(err); + } + } + + void OnOK() + { + deferred.Resolve(CompressResult(Env(), this->dstBuffer.Value(), this->props)); + } + + void OnError(Napi::Error const &error) + { + deferred.Reject(error.Value()); + } + + Napi::Promise GetPromise() const + { + return deferred.Promise(); + } + +private: + Napi::Promise::Deferred deferred; + Napi::Reference> srcBuffer; + Napi::Reference> dstBuffer; + CompressProps props; +}; + +Napi::Value CompressInner(const Napi::CallbackInfo &info, bool async) +{ + Napi::Env env = info.Env(); + + if (info.Length() < 2) + { + Napi::TypeError::New(env, "Not enough arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + + if (!info[0].IsBuffer()) + { + Napi::TypeError::New(env, "Invalid source buffer") + .ThrowAsJavaScriptException(); + return env.Null(); + } + Napi::Buffer srcBuffer = info[0].As>(); + + unsigned int offset = 0; + Napi::Buffer dstBuffer; + if (info[1].IsBuffer()) + { + dstBuffer = info[1].As>(); + offset++; + if (dstBuffer.Length() == 0) + { + Napi::TypeError::New(env, "Invalid destination buffer") + .ThrowAsJavaScriptException(); + return env.Null(); + } + } + + if (info.Length() < offset + 2 || !info[offset + 1].IsObject()) + { + Napi::TypeError::New(env, "Invalid options").ThrowAsJavaScriptException(); + return env.Null(); + } + Napi::Object options = info[offset + 1].As(); + + BufferSizeOptions parsedOptions = ParseBufferSizeOptions(env, options); + if (!parsedOptions.valid) + { + return env.Null(); + } + + CompressProps props = {}; + props.srcData = srcBuffer.Data(); + props.width = parsedOptions.width; + props.height = parsedOptions.height; + props.subsampling = parsedOptions.subsampling; + + Napi::Value tmpFormat = options.Get("format"); + if (!tmpFormat.IsNumber()) + { + Napi::TypeError::New(env, "Invalid format").ThrowAsJavaScriptException(); + return env.Null(); + } + props.format = tmpFormat.As().Uint32Value(); + + // Figure out bpp from format (needed to calculate output buffer size) + props.bpp = 0; + switch (props.format) + { + case TJPF_GRAY: + props.bpp = 1; + break; + case TJPF_RGB: + case TJPF_BGR: + props.bpp = 3; + break; + case TJPF_RGBX: + case TJPF_BGRX: + case TJPF_XRGB: + case TJPF_XBGR: + case TJPF_RGBA: + case TJPF_BGRA: + case TJPF_ABGR: + case TJPF_ARGB: + props.bpp = 4; + break; + default: + Napi::TypeError::New(env, "Invalid input format").ThrowAsJavaScriptException(); + return env.Null(); + } + + props.stride = parsedOptions.width; + Napi::Value tmpStride = options.Get("stride"); + if (!tmpStride.IsUndefined()) + { + if (!tmpStride.IsNumber()) + { + Napi::TypeError::New(env, "Invalid stride").ThrowAsJavaScriptException(); + return env.Null(); + } + props.stride = tmpStride.As().Uint32Value(); + } + + props.quality = NJT_DEFAULT_QUALITY; + Napi::Value tmpQuality = options.Get("quality"); + if (!tmpQuality.IsUndefined()) + { + if (!tmpQuality.IsNumber()) + { + Napi::TypeError::New(env, "Invalid quality").ThrowAsJavaScriptException(); + return env.Null(); + } + props.quality = tmpQuality.As().Uint32Value(); + } + if (props.quality <= 0 || props.quality > 100) + { + Napi::TypeError::New(env, "Invalid quality").ThrowAsJavaScriptException(); + return env.Null(); + } + + if (srcBuffer.Length() < static_cast(props.stride) * props.height * props.bpp) + { + Napi::TypeError::New(env, "Source data is not long enough").ThrowAsJavaScriptException(); + return env.Null(); + } + + uint32_t dstLength = tjBufSize(props.width, props.height, props.subsampling); + if (dstBuffer.IsEmpty()) + { + dstBuffer = Napi::Buffer::New(env, dstLength); + } + + if (dstLength > dstBuffer.Length()) + { + Napi::TypeError::New(env, "Insufficient output buffer").ThrowAsJavaScriptException(); + return env.Null(); + } + + props.flags = TJFLAG_FASTDCT | TJFLAG_NOREALLOC; + props.resSize = dstBuffer.Length(); + props.resData = dstBuffer.Data(); + + if (async) + { + CompressWorker *wk = new CompressWorker(env, srcBuffer, dstBuffer, props); + wk->Queue(); + return wk->GetPromise(); + } + else + { + std::string errStr = DoCompress(props); + if (!errStr.empty()) + { + Napi::TypeError::New(env, errStr).ThrowAsJavaScriptException(); + return env.Null(); + } + + return CompressResult(env, dstBuffer, props); + } +} + +Napi::Value CompressAsync(const Napi::CallbackInfo &info) +{ + return CompressInner(info, true); +} + +Napi::Value CompressSync(const Napi::CallbackInfo &info) +{ + return CompressInner(info, false); +} diff --git a/node_modules/@julusian/jpeg-turbo/src/compress.h b/node_modules/@julusian/jpeg-turbo/src/compress.h new file mode 100644 index 0000000..cc2d1f6 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/src/compress.h @@ -0,0 +1,9 @@ +#ifndef NODE_JPEGTURBO_COMPRESS_H +#define NODE_JPEGTURBO_COMPRESS_H + +#include "util.h" + +Napi::Value CompressAsync(const Napi::CallbackInfo &info); +Napi::Value CompressSync(const Napi::CallbackInfo &info); + +#endif diff --git a/node_modules/@julusian/jpeg-turbo/src/consts.h b/node_modules/@julusian/jpeg-turbo/src/consts.h new file mode 100644 index 0000000..a6838f5 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/src/consts.h @@ -0,0 +1,8 @@ +#ifndef NODE_JPEGTURBO_CONSTS_H +#define NODE_JPEGTURBO_CONSTS_H + +static int NJT_DEFAULT_QUALITY = 80; +static int NJT_DEFAULT_SUBSAMPLING = TJSAMP_420; +static int NJT_DEFAULT_FORMAT = TJPF_RGBA; + +#endif diff --git a/node_modules/@julusian/jpeg-turbo/src/decompress.cc b/node_modules/@julusian/jpeg-turbo/src/decompress.cc new file mode 100644 index 0000000..49c342d --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/src/decompress.cc @@ -0,0 +1,244 @@ +#include "compress.h" + +struct DecompressProps +{ + tjhandle handle; + unsigned char *srcData; + uint32_t srcLength; + uint32_t format; + int bpp; + int resWidth; + int resHeight; + unsigned long resSize; + unsigned char *resData; +}; + +std::string DoDecompress(DecompressProps &props) +{ + + int err = tjDecompress2(props.handle, props.srcData, props.srcLength, props.resData, props.resWidth, 0, props.resHeight, props.format, TJFLAG_FASTDCT); + if (err != 0) + { + tjDestroy(props.handle); + return tjGetErrorStr(); + } + + err = tjDestroy(props.handle); + if (err != 0) + { + return tjGetErrorStr(); + } + + return ""; +} + +Napi::Object DecompressResult(const Napi::Env &env, const Napi::Buffer dstBuffer, const DecompressProps &props) +{ + Napi::Object res = Napi::Object::New(env); + res.Set("data", dstBuffer); + res.Set("size", props.resSize); + res.Set("width", props.resWidth); + res.Set("height", props.resHeight); + res.Set("format", props.format); + + return res; +} + +class DecompressWorker : public Napi::AsyncWorker +{ +public: + DecompressWorker( + Napi::Env &env, + Napi::Buffer &srcBuffer, + Napi::Buffer &dstBuffer, + DecompressProps &props) + : AsyncWorker(env), + deferred(Napi::Promise::Deferred::New(env)), + srcBuffer(Napi::Reference>::New(srcBuffer, 1)), + dstBuffer(Napi::Reference>::New(dstBuffer, 1)), + props(props) + { + } + + ~DecompressWorker() + { + this->srcBuffer.Reset(); + this->dstBuffer.Reset(); + } + + void Execute() + { + std::string err = DoDecompress(this->props); + if (!err.empty()) + { + SetError(err); + } + } + + void OnOK() + { + deferred.Resolve(DecompressResult(Env(), this->dstBuffer.Value(), this->props)); + } + + void OnError(Napi::Error const &error) + { + deferred.Reject(error.Value()); + } + + Napi::Promise GetPromise() const + { + return deferred.Promise(); + } + +private: + Napi::Promise::Deferred deferred; + Napi::Reference> srcBuffer; + Napi::Reference> dstBuffer; + DecompressProps props; +}; + +Napi::Value DecompressInner(const Napi::CallbackInfo &info, bool async) +{ + Napi::Env env = info.Env(); + + if (info.Length() < 1) + { + Napi::TypeError::New(env, "Not enough arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + + if (!info[0].IsBuffer()) + { + Napi::TypeError::New(env, "Invalid source buffer") + .ThrowAsJavaScriptException(); + return env.Null(); + } + Napi::Buffer srcBuffer = info[0].As>(); + + unsigned int offset = 0; + Napi::Buffer dstBuffer; + if (info[1].IsBuffer()) + { + dstBuffer = info[1].As>(); + offset++; + if (dstBuffer.Length() == 0) + { + Napi::TypeError::New(env, "Invalid destination buffer") + .ThrowAsJavaScriptException(); + return env.Null(); + } + } + + DecompressProps props = {}; + props.srcData = srcBuffer.Data(); + props.srcLength = srcBuffer.Length(); + + if (info.Length() >= offset + 2) + { + if (!info[offset + 1].IsObject()) + { + Napi::TypeError::New(env, "Invalid options").ThrowAsJavaScriptException(); + return env.Null(); + } + Napi::Object options = info[offset + 1].As(); + + Napi::Value tmpFormat = options.Get("format"); + if (!tmpFormat.IsNumber()) + { + Napi::TypeError::New(env, "Invalid format").ThrowAsJavaScriptException(); + return env.Null(); + } + props.format = tmpFormat.As().Uint32Value(); + } + + // Figure out bpp from format (needed to calculate output buffer size) + props.bpp = 0; + switch (props.format) + { + case TJPF_GRAY: + props.bpp = 1; + break; + case TJPF_RGB: + case TJPF_BGR: + props.bpp = 3; + break; + case TJPF_RGBX: + case TJPF_BGRX: + case TJPF_XRGB: + case TJPF_XBGR: + case TJPF_RGBA: + case TJPF_BGRA: + case TJPF_ABGR: + case TJPF_ARGB: + props.bpp = 4; + break; + default: + Napi::TypeError::New(env, "Invalid output format").ThrowAsJavaScriptException(); + return env.Null(); + } + + tjhandle handle = tjInitDecompress(); + if (handle == nullptr) + { + Napi::TypeError::New(env, tjGetErrorStr()).ThrowAsJavaScriptException(); + return env.Null(); + } + + props.handle = handle; + + int err = tjDecompressHeader(handle, props.srcData, props.srcLength, &props.resWidth, &props.resHeight); + if (err != 0) + { + tjDestroy(handle); + + Napi::TypeError::New(env, tjGetErrorStr()).ThrowAsJavaScriptException(); + return env.Null(); + } + + auto targetSize = static_cast(props.resWidth) * props.resHeight * props.bpp; + if (dstBuffer.IsEmpty()) + { + dstBuffer = Napi::Buffer::New(env, targetSize); + } + + props.resSize = targetSize; + props.resData = dstBuffer.Data(); + + if (targetSize > dstBuffer.Length()) + { + tjDestroy(handle); + + Napi::TypeError::New(env, "Insufficient output buffer").ThrowAsJavaScriptException(); + return env.Null(); + } + + if (async) + { + DecompressWorker *wk = new DecompressWorker(env, srcBuffer, dstBuffer, props); + wk->Queue(); + return wk->GetPromise(); + } + else + { + std::string errStr = DoDecompress(props); + if (!errStr.empty()) + { + Napi::TypeError::New(env, errStr).ThrowAsJavaScriptException(); + return env.Null(); + } + + return DecompressResult(env, dstBuffer, props); + } + return env.Null(); +} + +Napi::Value DecompressAsync(const Napi::CallbackInfo &info) +{ + return DecompressInner(info, true); +} + +Napi::Value DecompressSync(const Napi::CallbackInfo &info) +{ + return DecompressInner(info, false); +} diff --git a/node_modules/@julusian/jpeg-turbo/src/decompress.h b/node_modules/@julusian/jpeg-turbo/src/decompress.h new file mode 100644 index 0000000..43dba99 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/src/decompress.h @@ -0,0 +1,9 @@ +#ifndef NODE_JPEGTURBO_DECOMPRESS_H +#define NODE_JPEGTURBO_DECOMPRESS_H + +#include "util.h" + +Napi::Value DecompressAsync(const Napi::CallbackInfo &info); +Napi::Value DecompressSync(const Napi::CallbackInfo &info); + +#endif diff --git a/node_modules/@julusian/jpeg-turbo/src/enums.cc b/node_modules/@julusian/jpeg-turbo/src/enums.cc new file mode 100644 index 0000000..4e873da --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/src/enums.cc @@ -0,0 +1,22 @@ +#include "enums.h" + +void InitializeEnums(const Napi::Env &env, Napi::Object &exports) +{ + exports.Set("FORMAT_RGB", static_cast(TJPF_RGB)); + exports.Set("FORMAT_BGR", static_cast(TJPF_BGR)); + exports.Set("FORMAT_RGBX", static_cast(TJPF_RGBX)); + exports.Set("FORMAT_BGRX", static_cast(TJPF_BGRX)); + exports.Set("FORMAT_XRGB", static_cast(TJPF_XRGB)); + exports.Set("FORMAT_XBGR", static_cast(TJPF_XBGR)); + exports.Set("FORMAT_GRAY", static_cast(TJPF_GRAY)); + exports.Set("FORMAT_RGBA", static_cast(TJPF_RGBA)); + exports.Set("FORMAT_BGRA", static_cast(TJPF_BGRA)); + exports.Set("FORMAT_ABGR", static_cast(TJPF_ABGR)); + exports.Set("FORMAT_ARGB", static_cast(TJPF_ARGB)); + + exports.Set("SAMP_444", static_cast(TJSAMP_444)); + exports.Set("SAMP_422", static_cast(TJSAMP_422)); + exports.Set("SAMP_420", static_cast(TJSAMP_420)); + exports.Set("SAMP_GRAY", static_cast(TJSAMP_GRAY)); + exports.Set("SAMP_440", static_cast(TJSAMP_440)); +} diff --git a/node_modules/@julusian/jpeg-turbo/src/enums.h b/node_modules/@julusian/jpeg-turbo/src/enums.h new file mode 100644 index 0000000..bbbf7f1 --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/src/enums.h @@ -0,0 +1,8 @@ +#ifndef NODE_JPEGTURBO_ENUMS_H +#define NODE_JPEGTURBO_ENUMS_H + +#include "util.h" + +void InitializeEnums(const Napi::Env &env, Napi::Object &exports); + +#endif diff --git a/node_modules/@julusian/jpeg-turbo/src/exports.cc b/node_modules/@julusian/jpeg-turbo/src/exports.cc new file mode 100644 index 0000000..40389db --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/src/exports.cc @@ -0,0 +1,25 @@ +#include "util.h" +#include "enums.h" +#include "buffersize.h" +#include "compress.h" +#include "decompress.h" + +Napi::Object Init(Napi::Env env, Napi::Object exports) +{ + // FT_Init_FreeType(&library); + + // sprintf(version, "%i.%i.%i", FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH); + // exports.Set("FreeTypeVersion", version); + + exports.Set("bufferSize", Napi::Function::New(env, BufferSize)); + exports.Set("compress", Napi::Function::New(env, CompressAsync)); + exports.Set("compressSync", Napi::Function::New(env, CompressSync)); + exports.Set("decompress", Napi::Function::New(env, DecompressAsync)); + exports.Set("decompressSync", Napi::Function::New(env, DecompressSync)); + + InitializeEnums(env, exports); + + return exports; +} + +NODE_API_MODULE(jpegturbo, Init) diff --git a/node_modules/@julusian/jpeg-turbo/src/util.cc b/node_modules/@julusian/jpeg-turbo/src/util.cc new file mode 100644 index 0000000..d7f637b --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/src/util.cc @@ -0,0 +1,51 @@ +#include "util.h" + +// Napi::Value getProperty(const Napi::Object &obj, const char *name) +// { +// } + +BufferSizeOptions ParseBufferSizeOptions(const Napi::Env &env, const Napi::Object &options) +{ + Napi::Value tmpWidth = options.Get("width"); + if (!tmpWidth.IsNumber()) + { + Napi::TypeError::New(env, "Invalid width").ThrowAsJavaScriptException(); + return BufferSizeOptions{false}; + } + uint32_t width = tmpWidth.As().Uint32Value(); + + Napi::Value tmpHeight = options.Get("height"); + if (!tmpHeight.IsNumber()) + { + Napi::TypeError::New(env, "Invalid height").ThrowAsJavaScriptException(); + return BufferSizeOptions{false}; + } + uint32_t height = tmpHeight.As().Uint32Value(); + + uint32_t subsampling = NJT_DEFAULT_SUBSAMPLING; + Napi::Value tmpSubsampling = options.Get("subsampling"); + if (!tmpSubsampling.IsUndefined()) + { + if (!tmpSubsampling.IsNumber()) + { + Napi::TypeError::New(env, "Invalid subsampling").ThrowAsJavaScriptException(); + return BufferSizeOptions{false}; + } + subsampling = tmpSubsampling.As().Uint32Value(); + } + + switch (subsampling) + { + case TJSAMP_444: + case TJSAMP_422: + case TJSAMP_420: + case TJSAMP_GRAY: + case TJSAMP_440: + break; + default: + Napi::TypeError::New(env, "Invalid subsampling").ThrowAsJavaScriptException(); + return BufferSizeOptions{false}; + } + + return BufferSizeOptions{true, width, height, subsampling}; +} diff --git a/node_modules/@julusian/jpeg-turbo/src/util.h b/node_modules/@julusian/jpeg-turbo/src/util.h new file mode 100644 index 0000000..0ced4ce --- /dev/null +++ b/node_modules/@julusian/jpeg-turbo/src/util.h @@ -0,0 +1,22 @@ +#ifndef NODE_JPEGTURBO_UTIL_H +#define NODE_JPEGTURBO_UTIL_H + +#include + +#include + +#include "consts.h" + +// Napi::Value getProperty(const Napi::Object &obj, const char *name); + +struct BufferSizeOptions +{ + bool valid; + uint32_t width; + uint32_t height; + uint32_t subsampling; +}; + +BufferSizeOptions ParseBufferSizeOptions(const Napi::Env &env, const Napi::Object &obj); + +#endif diff --git a/node_modules/cmake-js/LICENSE b/node_modules/cmake-js/LICENSE new file mode 100644 index 0000000..534a45e --- /dev/null +++ b/node_modules/cmake-js/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Gábor Mező aka unbornchikken + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/node_modules/cmake-js/README.md b/node_modules/cmake-js/README.md new file mode 100644 index 0000000..85caad1 --- /dev/null +++ b/node_modules/cmake-js/README.md @@ -0,0 +1,403 @@ +# CMake.js (MIT) + +[![Node CI](https://github.com/cmake-js/cmake-js/actions/workflows/node.yaml/badge.svg)](https://github.com/cmake-js/cmake-js/actions/workflows/node.yaml) +[![npm](https://img.shields.io/npm/v/cmake-js)](https://www.npmjs.com/package/cmake-js) + +## About + +CMake.js is a Node.js native addon build tool which works (almost) _exactly_ like [node-gyp](https://github.com/TooTallNate/node-gyp), but instead of [gyp](http://en.wikipedia.org/wiki/GYP_%28software%29), it is based on [CMake](http://cmake.org) build system. It's compatible with the following runtimes: + +- Node.js 14.15+ since CMake.js v7.0.0 (for older runtimes please use an earlier version of CMake.js). Newer versions can produce builds targeting older runtimes +- [NW.js](https://github.com/nwjs/nw.js): all CMake.js based native modules are compatible with NW.js out-of-the-box, there is no [nw-gyp like magic](https://github.com/nwjs/nw.js/wiki/Using-Node-modules#3rd-party-modules-with-cc-addons) required +- [Electron](https://github.com/electron/electron): out-of-the-box build support, [no post build steps required](https://github.com/electron/electron/blob/main/docs/tutorial/using-native-node-modules.md) + +If you use `node-api` for your module instead of `nan` it should be able to run on all the runtimes above without needing to be built separately for each. + +## Installation + +```bash +npm install cmake-js +``` + +**Help:** + +```bash +cmake-js --help +``` + +``` +Usage: cmake-js [] [options] + +Commands: + cmake-js install Install Node.js distribution files if needed + cmake-js configure Configure CMake project + cmake-js print-configure Print the configuration command + cmake-js print-cmakejs-src Print the value of the CMAKE_JS_SRC variable + cmake-js print-cmakejs-include Print the value of the CMAKE_JS_INC variable + cmake-js print-cmakejs-lib Print the value of the CMAKE_JS_LIB variable + cmake-js build Build the project (will configure first if + required) + cmake-js print-build Print the build command + cmake-js clean Clean the project directory + cmake-js print-clean Print the clean command + cmake-js reconfigure Clean the project directory then configure the + project + cmake-js rebuild Clean the project directory then build the + project + cmake-js compile Build the project, and if build fails, try a + full rebuild + +Options: + --version Show version number [boolean] + -h, --help Show help [boolean] + -l, --log-level set log level (silly, verbose, info, http, warn, + error), default is info [string] + -d, --directory specify CMake project's directory (where CMakeLists.txt + located) [string] + -D, --debug build debug configuration [boolean] + -B, --config specify build configuration (Debug, RelWithDebInfo, + Release), will ignore '--debug' if specified [string] + -c, --cmake-path path of CMake executable [string] + -m, --prefer-make use Unix Makefiles even if Ninja is available (Posix) + [boolean] + -x, --prefer-xcode use Xcode instead of Unix Makefiles [boolean] + -g, --prefer-gnu use GNU compiler instead of default CMake compiler, if + available (Posix) [boolean] + -G, --generator use specified generator [string] + -t, --toolset use specified toolset [string] + -A, --platform use specified platform name [string] + -T, --target only build the specified target [string] + -C, --prefer-clang use Clang compiler instead of default CMake compiler, + if available (Posix) [boolean] + --cc use the specified C compiler [string] + --cxx use the specified C++ compiler [string] + -r, --runtime the runtime to use [string] + -v, --runtime-version the runtime version to use [string] + -a, --arch the architecture to build in [string] + -p, --parallel the number of threads cmake can use [number] + --CD Custom argument passed to CMake in format: + -D [string] + -i, --silent Prevents CMake.js to print to the stdio [boolean] + -O, --out Specify the output directory to compile to, default is + projectRoot/build [string] +``` + +**Requirements:** + +- [CMake](http://www.cmake.org/download/) +- A proper C/C++ compiler toolchain of the given platform + - **Windows**: + - [Visual C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/). If you installed nodejs with the installer, you can install these when prompted. + - An alternate way is to install the [Chocolatey package manager](https://chocolatey.org/install), and run `choco install visualstudio2017-workload-vctools` in an Administrator Powershell + - If you have multiple versions installed, you can select a specific version with `npm config set msvs_version 2017` (Note: this will also affect `node-gyp`) + - **Unix/Posix**: + - Clang or GCC + - Ninja or Make (Ninja will be picked if both present) + +## Usage + +### General + +It is advised to use Node-API for new projects instead of NAN. It provides ABI stability making usage simpler and reducing maintainance. + +- Install cmake-js for your module `npm install --save cmake-js` +- Put a CMakeLists.txt file into your module root with this minimal required content: + +```cmake +cmake_minimum_required(VERSION 3.15...3.31) +project(your-addon-name-here) + +add_compile_definitions(NAPI_VERSION=4) + +file(GLOB SOURCE_FILES "your-source-files-location-here") + +add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC}) +set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node") +target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_JS_INC}) +target_link_libraries(${PROJECT_NAME} PRIVATE ${CMAKE_JS_LIB}) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) + +if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET) + # Generate node.lib + execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS}) +endif() +``` + +- Add the following into your package.json scripts section: + +```json +"scripts": { + "install": "cmake-js compile" + } +``` + +- Add the following into your package.json, using the same NAPI_VERSION value you provided to cmake + +```json +"binary": { + "napi_versions": [7] + }, +``` + +#### Commandline + +With cmake-js installed as a depdendency or devDependency of your module, you can access run commands directly with: + +``` +npx cmake-js --help +# OR +yarn cmake-js --help +``` + +Please refer to the `--help` for the lists of available commands (they are like commands in `node-gyp`). + +You can override the project default runtimes via `--runtime` and `--runtime-version`, such as: `--runtime=electron --runtime-version=0.26.0`. See below for more info on runtimes. + +### CMake Specific + +`CMAKE_JS_VERSION` variable will reflect the actual CMake.js version. So CMake.js based builds could be detected, eg.: + +```cmake +if (CMAKE_JS_VERSION) + add_subdirectory(node_addon) +else() + add_subdirectory(other_subproject) +endif() +``` + +### NPM Config Integration + +You can set npm configuration options for CMake.js. + +For all users (global): + +``` +npm config set cmake_ --global +``` + +For current user: + +``` +npm config set cmake_ +``` + +CMake.js will set a variable named `""` to `` (by using `-D=""` option). User settings will **overwrite** globals. + +UPDATE: + +You can set CMake.js command line arguments with npm config using the following pattern: + +``` +npm config set cmake_js_G "Visual Studio 56 Win128" +``` + +Which sets the CMake generator, basically defaults to: + +``` +cmake-js -G "Visual Studio 56 Win128" +``` + +#### Example: + +Enter at command prompt: + +``` +npm config set cmake_Foo="bar" +``` + +Then write to your CMakeLists.txt the following: + +```cmake +message (STATUS ${Foo}) +``` + +This will print during configure: + +``` +--- bar +``` + +### Custom CMake options + +You can add custom CMake options by beginning option name with `CD`. + +#### Example + +In command prompt: + +``` +cmake-js compile --CDFOO="bar" +``` + +Then in your CMakeLists.txt: + +```cmake +message (STATUS ${FOO}) +``` + +This will print during configure: + +``` +--- bar +``` + +### Runtimes + +#### Important + +It is important to understand that this setting is to be configured in the **application's root package.json file**. If you're creating a native module targeting nw.js for example, then **do not specify anything** in your module's package.json. It's the actual application's decision to specify its runtime, your module's just compatible anything that was mentioned in the [About chapter](#about). Actually defining `cmake-js` key in your module's package.json file may lead to an error. Why? If you set it up to use nw.js 0.12.1 for example, then when it gets compiled during development time (to run its unit tests for example) it's gonna be compiled against io.js 1.2 runtime. But if you're having io.js 34.0.1 at the command line then, which is binary incompatible with 1.2, then your unit tests will fail for sure. So it is advised to not use cmake-js target settings in your module's package.json, because that way CMake.js will use that you have, and your tests will pass. + +#### Configuration + +If any of the `runtime`, `runtimeVersion`, or `arch` configuration parameters is not explicitly configured, sensible defaults will be auto-detected based on the JavaScript environment where CMake.js runs within. + +You can configure runtimes for compiling target for all depending CMake.js modules in an application. Define a `cmake-js` key in the application's root `package.json` file, eg.: + +```json +{ + "name": "ta-taram-taram", + "description": "pa-param-pam-pam", + "version": "1.0.0", + "main": "app.js", + "cmake-js": { + "runtime": "node", + "runtimeVersion": "0.12.0", + "arch": "ia32" + } +} +``` + +Available settings: + +- **runtime**: application's target runtime, possible values are: + - `node`: Node.js + - `nw`: nw.js + - `electron`: Electron +- **runtimeVersion**: version of the application's target runtime, for example: `0.12.1` +- **arch**: architecture of application's target runtime (eg: `x64`, `ia32`, `arm64`, `arm`). _Notice: on non-Windows systems the C++ toolset's architecture's gonna be used despite this setting. If you don't specify this on Windows, then architecture of the main node runtime is gonna be used, so you have to choose a matching nw.js runtime._ + +#### Node-API and `node-addon-api` + +[ABI-stable Node.js API +(Node-API)](https://nodejs.org/api/n-api.html#n_api_node_api), +which was previously known as N-API, supplies a set of C +APIs that allow to compilation and loading of native modules by +different versions of Node.js that support Node-API which includes +all versions of Node.js v10.x and later. + +To compile a native module that uses only the +[plain `C` Node-API calls](https://nodejs.org/api/n-api.html#n_api_node_api), +follow the directions for plain `node` native modules. + +You must also add the following lines to your CMakeLists.txt, to allow for building on windows + +``` +if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET) + # Generate node.lib + execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS}) +endif() +``` + +To compile a native module that uses the header-only C++ wrapper +classes provided by +[`node-addon-api`](https://github.com/nodejs/node-addon-api), +you need to make your package depend on it with: + + npm install --save node-addon-api + +cmake-js will then add it to the include search path automatically + +You should add the following to your package.json, with the correct version number, so that cmake-js knows the module is node-api and that it can skip downloading the nodejs headers + +```json +"binary": { + "napi_versions": [7] + }, +``` + +#### Electron + +On Windows, the [`win_delay_load_hook`](https://www.electronjs.org/docs/tutorial/using-native-node-modules#a-note-about-win_delay_load_hook) is required to be embedded in the module or it will fail to load in the render process. +cmake-js will add the hook if the CMakeLists.txt contains the library `${CMAKE_JS_SRC}`. + +Without the hook, the module can only be called from the render process using the Electron [remote](https://github.com/electron/electron/blob/master/docs/api/remote.md) module. + +#### Runtime options in CMakeLists.txt + +The actual node runtime parameters are detectable in CMakeLists.txt files, the following variables are set: + +- **NODE_RUNTIME**: `"node"`, `"nw"`, `"electron"` +- **NODE_RUNTIMEVERSION**: for example: `"0.12.1"` +- **NODE_ARCH**: `"x64"`, `"ia32"`, `"arm64"`, `"arm"` + +#### NW.js + +To make compatible your NW.js application with any NAN CMake.js based modules, write the following to your application's package.json file (this is not neccessary for node-api modules): + +```json +{ + "cmake-js": { + "runtime": "nw", + "runtimeVersion": "nw.js-version-here", + "arch": "whatever-setting-is-appropriate-for-your-application's-windows-build" + } +} +``` + +That's it. There is nothing else to do either on the application's or on the module's side, CMake.js modules are compatible with NW.js out-of-the-box. + +#### Heroku + +[Heroku](https://heroku.com) uses the concept of a [buildpack](https://devcenter.heroku.com/articles/buildpacks) to define +how an application should be prepared to run in a [dyno](https://devcenter.heroku.com/articles/dynos). +The typical buildpack for note-based applications, +[heroku/nodejs](https://github.com/heroku/heroku-buildpack-nodejs), +provides an environment capable of running [node-gyp](https://github.com/TooTallNate/node-gyp), +but not [CMake](http://cmake.org). + +The least "painful" way of addressing this is to use heroku's multipack facility: + +- Set the applications' buildpack to + [https://github.com/heroku/heroku-buildpack-multi.git](https://github.com/heroku/heroku-buildpack-multi.git) + +- In the root directory of the application, + create a file called `.buildpacks` with these two lines: + + https://github.com/brave/heroku-cmake-buildpack.git + https://github.com/heroku/heroku-buildpack-nodejs.git + +- Deploy the application to have the changes take effect + +The `heroku-buildpack-multi` will run each buildpack in order allowing the node application to reference CMake in the Heroku +build environment. + +## Using external C/C++ libraries + +Because you are using CMake, there are many ways to load libraries in your CMakeLists.txt. +Various places on the internet and in the CMake docs will suggest various approaches you can take. Common ones are: +* [conan](https://conan.io/) (This may not work properly currently; we hope to improve support in a future release) +* [vcpkg](https://vcpkg.io/) (This may not work properly currently; we hope to improve support in a future release) +* [hunter](https://github.com/cpp-pm/hunter) +* [CMake ExternalProject](https://cmake.org/cmake/help/latest/module/ExternalProject.html) +* If on linux, using system libraries from the system package-manager +* Importing as a git submodule + +We aim to be agnostic about how to use CMake, so it should be possible to use whatever approach you desire. + +## Real examples + +- [@julusian/jpeg-turbo](https://github.com/julusian/node-jpeg-turbo) - A Node-API wrapping around libjpeg-turbo. cmake-js was a good fit here, as libjpeg-turbo provides cmake files that can be used, and would be hard to replicate correctly in node-gyp +- [node-datachannel](https://github.com/murat-dogan/node-datachannel) - Easy to use WebRTC data channels and media transport +- [aws-iot-device-sdk-v2](https://github.com/aws/aws-iot-device-sdk-js-v2) AWS IoT Device SDK for JavaScript v2 + +Open a PR to add your own project here. + +## Changelog + +View [changelog.md](changelog.md) + +## Credits + +https://github.com/cmake-js/cmake-js/graphs/contributors + +Ty all! diff --git a/node_modules/cmake-js/bin/cmake-js b/node_modules/cmake-js/bin/cmake-js new file mode 100755 index 0000000..839a56f --- /dev/null +++ b/node_modules/cmake-js/bin/cmake-js @@ -0,0 +1,342 @@ +#!/usr/bin/env node +'use strict' + +const log = require('../lib/logger') +const BuildSystem = require('../').BuildSystem +const util = require('util') +const version = require('../package').version +const logLevels = ['silly', 'verbose', 'info', 'http', 'warn', 'error'] + +const npmConfigData = require('rc')('npm') +for (const [key, value] of Object.entries(npmConfigData)) { + if (key.startsWith('cmake_js_')) { + const option = key.substr(9) + if (option.length === 1) { + process.argv.push('-' + option) + } else { + process.argv.push('--' + option) + } + if (value) { + process.argv.push(value) + } + } +} + +const yargs = require('yargs') + .usage('CMake.js ' + version + '\n\nUsage: $0 [] [options]') + .version(version) + .command('install', 'Install Node.js distribution files if needed') + .command('configure', 'Configure CMake project') + .command('print-configure', 'Print the configuration command') + .command('print-cmakejs-src', 'Print the value of the CMAKE_JS_SRC variable') + .command('print-cmakejs-include', 'Print the value of the CMAKE_JS_INC variable') + .command('print-cmakejs-lib', 'Print the value of the CMAKE_JS_LIB variable') + .command('build', 'Build the project (will configure first if required)') + .command('print-build', 'Print the build command') + .command('clean', 'Clean the project directory') + .command('print-clean', 'Print the clean command') + .command('reconfigure', 'Clean the project directory then configure the project') + .command('rebuild', 'Clean the project directory then build the project') + .command('compile', 'Build the project, and if build fails, try a full rebuild') + .options({ + h: { + alias: 'help', + demand: false, + describe: 'show this screen', + type: 'boolean', + }, + l: { + alias: 'log-level', + demand: false, + describe: 'set log level (' + logLevels.join(', ') + '), default is info', + type: 'string', + }, + d: { + alias: 'directory', + demand: false, + describe: "specify CMake project's directory (where CMakeLists.txt located)", + type: 'string', + }, + D: { + alias: 'debug', + demand: false, + describe: 'build debug configuration', + type: 'boolean', + }, + B: { + alias: 'config', + demand: false, + describe: "specify build configuration (Debug, RelWithDebInfo, Release), will ignore '--debug' if specified", + type: 'string', + }, + c: { + alias: 'cmake-path', + demand: false, + describe: 'path of CMake executable', + type: 'string', + }, + m: { + alias: 'prefer-make', + demand: false, + describe: 'use Unix Makefiles even if Ninja is available (Posix)', + type: 'boolean', + }, + x: { + alias: 'prefer-xcode', + demand: false, + describe: 'use Xcode instead of Unix Makefiles', + type: 'boolean', + }, + g: { + alias: 'prefer-gnu', + demand: false, + describe: 'use GNU compiler instead of default CMake compiler, if available (Posix)', + type: 'boolean', + }, + G: { + alias: 'generator', + demand: false, + describe: 'use specified generator', + type: 'string', + }, + t: { + alias: 'toolset', + demand: false, + describe: 'use specified toolset', + type: 'string', + }, + A: { + alias: 'platform', + demand: false, + describe: 'use specified platform name', + type: 'string', + }, + T: { + alias: 'target', + demand: false, + describe: 'only build the specified target', + type: 'string', + }, + C: { + alias: 'prefer-clang', + demand: false, + describe: 'use Clang compiler instead of default CMake compiler, if available (Posix)', + type: 'boolean', + }, + cc: { + demand: false, + describe: 'use the specified C compiler', + type: 'string', + }, + cxx: { + demand: false, + describe: 'use the specified C++ compiler', + type: 'string', + }, + r: { + alias: 'runtime', + demand: false, + describe: 'the runtime to use', + type: 'string', + }, + v: { + alias: 'runtime-version', + demand: false, + describe: 'the runtime version to use', + type: 'string', + }, + a: { + alias: 'arch', + demand: false, + describe: 'the architecture to build in', + type: 'string', + }, + p: { + alias: 'parallel', + demand: false, + describe: 'the number of threads cmake can use', + type: 'number', + }, + CD: { + demand: false, + describe: 'Custom argument passed to CMake in format: -D', + type: 'string', + }, + i: { + alias: 'silent', + describe: 'Prevents CMake.js to print to the stdio', + type: 'boolean', + }, + O: { + alias: 'out', + describe: 'Specify the output directory to compile to, default is projectRoot/build', + type: 'string', + }, + }) +const argv = yargs.argv + +// If help, then print and exit: + +if (argv.h) { + console.info(yargs.help()) + process.exit(0) +} + +// Setup log level: + +if (argv.l && logLevels.includes(argv.l)) { + log.level = argv.l +} + +log.silly('CON', 'argv:') +log.silly('CON', util.inspect(argv)) + +log.verbose('CON', 'Parsing arguments') + +// Extract custom cMake options +const customOptions = {} +for (const arg of process.argv) { + if (arg.startsWith('--CD')) { + const separator = arg.indexOf('=') + if (separator < 5) continue + const key = arg.substring(4, separator) + const value = arg.substring(separator + 1) + if (!value) continue + customOptions[key] = value + } +} + +const options = { + directory: argv.directory || null, + debug: argv.debug, + cmakePath: argv.c || null, + generator: argv.G, + toolset: argv.t, + platform: argv.A, + target: argv.T, + preferMake: argv.m, + preferXcode: argv.x, + preferGnu: argv.g, + preferClang: argv.C, + cCompilerPath: argv.cc, + cppCompilerPath: argv.cxx, + runtime: argv.r, + runtimeVersion: argv.v, + arch: argv.a, + cMakeOptions: customOptions, + silent: argv.i, + out: argv.O, + config: argv.B, + parallel: argv.p, + extraCMakeArgs: argv._.slice(1), +} + +log.verbose('CON', 'options:') +log.verbose('CON', util.inspect(options)) + +const command = argv._[0] || 'build' + +log.verbose('CON', 'Running command: ' + command) + +const buildSystem = new BuildSystem(options) + +function ifCommand(c, f) { + if (c === command) { + f() + return true + } + return false +} + +function exitOnError(promise) { + promise.catch(function () { + process.exit(1) + }) +} + +function install() { + exitOnError(buildSystem.install()) +} +function configure() { + exitOnError(buildSystem.configure()) +} +function printConfigure() { + exitOnError( + buildSystem.getConfigureCommand().then(function (command) { + console.info(command) + }), + ) +} +function printCmakeJsLib() { + exitOnError( + buildSystem.getCmakeJsLibString().then(function (command) { + console.info(command) + }), + ) +} +function printCmakeJsInclude() { + exitOnError( + buildSystem.getCmakeJsIncludeString().then(function (command) { + console.info(command) + }), + ) +} +function printCmakeJsSrc() { + exitOnError( + buildSystem.getCmakeJsSrcString().then(function (command) { + console.info(command) + }), + ) +} +function build() { + exitOnError(buildSystem.build()) +} +function printBuild() { + exitOnError( + buildSystem.getBuildCommand().then(function (command) { + console.info(command) + }), + ) +} +function clean() { + exitOnError(buildSystem.clean()) +} +function printClean() { + exitOnError( + buildSystem.getCleanCommand().then(function (command) { + console.info(command) + }), + ) +} +function reconfigure() { + exitOnError(buildSystem.reconfigure()) +} +function rebuild() { + exitOnError(buildSystem.rebuild()) +} +function compile() { + exitOnError(buildSystem.compile()) +} + +let done = ifCommand('install', install) +done = done || ifCommand('configure', configure) +done = done || ifCommand('print-configure', printConfigure) +done = done || ifCommand('print-cmakejs-src', printCmakeJsSrc) +done = done || ifCommand('print-cmakejs-include', printCmakeJsInclude) +done = done || ifCommand('print-cmakejs-lib', printCmakeJsLib) +done = done || ifCommand('build', build) +done = done || ifCommand('print-build', printBuild) +done = done || ifCommand('clean', clean) +done = done || ifCommand('print-clean', printClean) +done = done || ifCommand('reconfigure', reconfigure) +done = done || ifCommand('rebuild', rebuild) +done = done || ifCommand('compile', compile) + +if (!done) { + if (command) { + log.error('COM', 'Unknown command: ' + command) + process.exit(1) + } else { + build() + } +} diff --git a/node_modules/cmake-js/changelog.md b/node_modules/cmake-js/changelog.md new file mode 100644 index 0000000..ba051a1 --- /dev/null +++ b/node_modules/cmake-js/changelog.md @@ -0,0 +1,239 @@ +# v8.0.0 - 27/01/26 + +- feat: require nodejs 20 or later +- feat: update deprecated dependencies + +# v7.4.0 - 14/11/25 + +- feat(windows): support msvc 2026 (Thanks to @Norgerkaj) + +# v7.3.1 - 17/04/25 + +- fix(windows): support windows arm64 (Thanks to @jaycex) +- fix(windows): support newer visual studio installations + +# v7.3.0 - 15/01/24 + +- feat(windows): replace custom libnode.def generation with version from node-api-headers +- fix: support for vs2015 with nodejs 18 and older (#317) +- fix(windows): always remove Path if PATH is also defined (#319) +- fix: Cmake arguments got converted to numbers (#314) +- fix: update node-api-headers +- chore: update dependencies + +# v7.2.1 - 14/02/23 + +- fix: support Windows11SDK + +# v7.2.0 - 12/02/23 + +- fix: `-DCMAKE_JS_VERSION=undefined` (#298) +- fix: Only add build type to `CMAKE_LIBRARY_OUTPUT_DIRECTORY` if needed (#299) +- feat: Forward extra arguments to CMake commands (#297) + +# v7.1.1 - 15/12/22 + +- fix build errors on windows + +# v7.1.0 - 14/12/22 + +- add commands for retrieving cmake-js include and lib directories +- fix win delay hook issues with electron +- fix missing js_native_api_symbols in windows node.lib + +# v7.0.0 - 08/10/22 + +- update dependencies +- replace some dependencies with modern language features +- follow node-gyp behaviour for visual-studio version detection and selection +- automatically locate node-addon-api and add to include paths +- avoid downloads when building for node-api +- encourage use of MT builds with MSVC, rather than MD + +# v6.3.1 - 05/06/22 + +- add missing bluebird dependency +- fix platform detection for visual studio 2019 and newer +- fix platform detection for macos + +# v6.3.0 - 26/11/21 + +- add offline mode: https://github.com/cmake-js/cmake-js/pull/260 +- handle missing buildSystem.log: https://github.com/cmake-js/cmake-js/pull/259 +- Add config flag: https://github.com/cmake-js/cmake-js/pull/251 +- Remove escaped quotes from windows registry queries: https://github.com/cmake-js/cmake-js/pull/250 + +# v6.2.1 - 20/07/21 + +- EOL hotfix (Thx Windows!) + +# v6.2.0 - 19/07/21 + +- various fixes + +# v6.1.0 - 27/02/20 + +- Add support for "-A/--platform" option to make target platform selectable for Visual Studio 2019 generator: https://github.com/cmake-js/cmake-js/pull/201 + +# v6.0.0 - 30/09/19 + +- Dropped compatibility of old Node.js runtimes (<10.0.0) +- --cc and --cxx flags for overriding compiler detection: https://github.com/cmake-js/cmake-js/pull/191 + +# v5.3.2 - 21/08/19 + +- Visual Studio detection fixes + +# v5.3.1 - 18/07/19 + +- VS 2019 Support fix: https://github.com/cmake-js/cmake-js/pull/187 + +# v5.3.0 - 09/07/19 + +- VS 2019 Support: https://github.com/cmake-js/cmake-js/pull/178/, https://github.com/cmake-js/cmake-js/pull/184/ + +# v5.2.1 - 10/04/19 + +- Win delay load hook: https://github.com/cmake-js/cmake-js/pull/165/ + +# v5.1.1 - 02/04/19 + +- CMake 3.14 support fixed - https://github.com/cmake-js/cmake-js/pull/161 + +# v5.1.0 - 14/02/19 + +- CMake 3.14 support - https://github.com/cmake-js/cmake-js/pull/159 + +# v5.0.1 - 24/01/19 + +- Linux line ending hotfix (I hate Windows!) + +# v5.0.0 - 24/01/19 + +- [semver major] Add case sensitive NPM config integration https://github.com/cmake-js/cmake-js/pull/151 +- better npm config integration, all CMake.js commandline argument could be set by using npm config: https://github.com/cmake-js/cmake-js#npm-config-integration +- support for Electron v4+ https://github.com/cmake-js/cmake-js/pull/152 + +# v4.0.1 - 03/10/18 + +- log argument hotfix https://github.com/cmake-js/cmake-js/pull/145 + +# v4.0.0 - 14/09/18 + +BREAKING CHANGES: + +- -s/--std (along with -o/--prec11 option removed, you have to specify compiler standard in CMakeLists.txt files https://github.com/cmake-js/cmake-js/issues/72 +- Implicit -w compiler flag doesn't get added on OSX https://github.com/cmake-js/cmake-js/pull/133 + +# v3.7.3 - 16/05/18 + +- npm config hotfix https://github.com/cmake-js/cmake-js/pull/123 + +# v3.7.2 - 16/05/18 + +- do not use, breaks ES5 compatibility + +# v3.7.1 - 07/05/18 + +- Linux line ending hotfix (wat) + +# v3.7.0 - 07/05/18 + +- PR: replace unzip with unzipper https://github.com/cmake-js/cmake-js/pull/120 +- PR: replace npmconf with rc https://github.com/cmake-js/cmake-js/pull/119 +- PR: update to modern fs-extras https://github.com/cmake-js/cmake-js/pull/118 +- PR: Adds toolset command line flag https://github.com/cmake-js/cmake-js/pull/115 + +# v3.6.2 - 17/02/18 + +- use https distribution download urls +- custom cmake options made case sensitive + +# v3.6.1 - 11/01/18 + +- Detect 2017 Windows Build Tools + +# v3.6.0 - 11/27/17 + +- "T" option for building specified target: https://github.com/cmake-js/cmake-js/pull/98 + +# v3.5.0 - 06/21/17 + +- Added Visual Studio 2017 compatibility: https://github.com/cmake-js/cmake-js/pull/78 + +# v3.4.1 - 02/4/17 + +- FIX: test output instead of guessing by platform: https://github.com/cmake-js/cmake-js/pull/77 + +# v3.4.0 - 01/12/17 + +- "G" option to set custom generators: https://github.com/cmake-js/cmake-js/pull/64 + +# v3.3.1 - 09/13/16 + +- fix of default parameters: https://github.com/cmake-js/cmake-js/pull/57 + +# v3.3.0 - 09/02/16 + +- silent option (https://github.com/cmake-js/cmake-js/pull/54) +- out option (https://github.com/cmake-js/cmake-js/pull/53) + +# v3.2.3 - 08/17/16 + +- Line endings + +# v3.2.2 - 12/08/16 + +- Multi directory support for Windows/MSVC build + +# v3.2.1 - 25/04/16 + +- Linux line ending hotfix + +# v3.2.0 - 25/04/16 + +- Added NW.js 0.13+ compatibility +- Node v0.10.x support fixed (https://github.com/cmake-js/cmake-js/pull/45, https://github.com/cmake-js/cmake-js/issues/50) +- CMAKE_JS_VERSION defined (https://github.com/cmake-js/cmake-js/issues/48) + +# v3.1.2 - 03/02/16 + +- Fixed cmake-js binary ES5 compatibility. + +# v3.1.1 - 03/02/16 + +- Fixed line endings + +# v3.1.0 - 03/02/16 + +- Custom CMake parameter support (https://github.com/gerhardberger) + +# v3.0.0 - 20/11/15 + +- Visual C++ Build Tools support +- std option introduced +- better unit test coverage + +# v2.1.0 - 29/10/15 + +- explicit options for use GNU or Clang compiler instead of CMake's default (see --help for details) + +# v2.0.2 - 22/10/15 + +- Fix: print-\* commands report "undefined" + +# v2.0.0 - 17/10/15 + +- Fix: distribution files only gets downloaded if needed (4.0.0+) +- option to generate Xcode project (-x, --prefer-xcode) - by https://github.com/javedulu +- compile command for fast module compilation during npm updates (instead of rebuild) +- codebase switched to ECMAScript 2015 + +# v1.1.1 - 06/10/15 + +- Hotfix for build NW.js correctly. + +# v1.1.0 - 05/10/15 + +- Node.js 4.0.0+ support +- Downloads the small, header only tarball for Node.js 4+ diff --git a/node_modules/cmake-js/lib/appCMakeJSConfig.js b/node_modules/cmake-js/lib/appCMakeJSConfig.js new file mode 100644 index 0000000..bee9611 --- /dev/null +++ b/node_modules/cmake-js/lib/appCMakeJSConfig.js @@ -0,0 +1,58 @@ +'use strict' +const path = require('path') + +function getConfig(lookPath, log) { + const pjsonPath = path.join(lookPath, 'package.json') + log.silly('CFG', "Looking for package.json in: '" + pjsonPath + "'.") + try { + const json = require(pjsonPath) + log.silly('CFG', 'Loaded:\n' + JSON.stringify(json)) + if (json && json['cmake-js'] && typeof json['cmake-js'] === 'object') { + log.silly('CFG', 'Config found.') + return json['cmake-js'] + } else { + log.silly('CFG', 'Config not found.') + return null + } + } catch (e) { + log.silly('CFG', "'package.json' not found.") + return null + } +} + +module.exports = function (projectPath, log) { + log.verbose('CFG', "Looking for application level CMake.js config in '" + projectPath + '.') + let currPath = projectPath + let lastConfig = null + let currConfig + for (;;) { + currConfig = getConfig(currPath, log) + if (currConfig) { + lastConfig = currConfig + } + try { + log.silly('CFG', 'Looking for parent path.') + const lastPath = currPath + currPath = path.normalize(path.join(currPath, '..')) + if (lastPath === currPath) { + currPath = null // root + } + if (currPath) { + log.silly('CFG', "Parent path: '" + currPath + "'.") + } + } catch (e) { + log.silly('CFG', 'Exception:\n' + e.stack) + break + } + if (currPath === null) { + log.silly('CFG', "Parent path with package.json file doesn't exists. Done.") + break + } + } + if (lastConfig) { + log.verbose('CFG', 'Application level CMake.js config found:\n' + JSON.stringify(lastConfig)) + } else { + log.verbose('CFG', "Application level CMake.js config doesn't exists.") + } + return lastConfig +} diff --git a/node_modules/cmake-js/lib/buildSystem.js b/node_modules/cmake-js/lib/buildSystem.js new file mode 100644 index 0000000..63c9384 --- /dev/null +++ b/node_modules/cmake-js/lib/buildSystem.js @@ -0,0 +1,123 @@ +'use strict' +const CMake = require('./cMake') +const Dist = require('./dist') +const CMLog = require('./cmLog') +const appCMakeJSConfig = require('./appCMakeJSConfig') +const npmConfig = require('./npmConfig') +const path = require('path') +const Toolset = require('./toolset') + +function isNodeApi(log, projectRoot) { + try { + const projectPkgJson = require(path.join(projectRoot, 'package.json')) + // Make sure the property exists + return !!projectPkgJson?.binary?.napi_versions + } catch (e) { + log.silly('CFG', "'package.json' not found.") + return false + } +} + +class BuildSystem { + constructor(options) { + this.options = options || {} + this.options.directory = path.resolve(this.options.directory || process.cwd()) + this.options.out = path.resolve(this.options.out || path.join(this.options.directory, 'build')) + this.log = new CMLog(this.options) + this.options.isNodeApi = isNodeApi(this.log, this.options.directory) + const appConfig = appCMakeJSConfig(this.options.directory, this.log) + const npmOptions = npmConfig(this.log) + + if (npmOptions && typeof npmOptions === 'object' && Object.keys(npmOptions).length) { + this.options.runtimeDirectory = npmOptions['nodedir'] + this.options.msvsVersion = npmOptions['msvs_version'] + } + if (appConfig && typeof appConfig === 'object' && Object.keys(appConfig).length) { + this.log.verbose('CFG', 'Applying CMake.js config from root package.json:') + this.log.verbose('CFG', JSON.stringify(appConfig)) + // Applying applications's config, if there is no explicit runtime related options specified + this.options.runtime = this.options.runtime || appConfig.runtime + this.options.runtimeVersion = this.options.runtimeVersion || appConfig.runtimeVersion + this.options.arch = this.options.arch || appConfig.arch + } + + this.log.verbose('CFG', 'Build system options:') + this.log.verbose('CFG', JSON.stringify(this.options)) + this.cmake = new CMake(this.options) + this.dist = new Dist(this.options) + this.toolset = new Toolset(this.options) + } + async _ensureInstalled() { + try { + await this.toolset.initialize(true) + if (!this.options.isNodeApi) { + await this.dist.ensureDownloaded() + } + } catch (e) { + this._showError(e) + throw e + } + } + _showError(e) { + if (this.log === undefined) { + // handle internal errors (init failed) + console.error('OMG', e.stack) + return + } + if (this.log.level === 'verbose' || this.log.level === 'silly') { + this.log.error('OMG', e.stack) + } else { + this.log.error('OMG', e.message) + } + } + install() { + return this._ensureInstalled() + } + async _invokeCMake(method) { + try { + await this._ensureInstalled() + return await this.cmake[method]() + } catch (e) { + this._showError(e) + throw e + } + } + getConfigureCommand() { + return this._invokeCMake('getConfigureCommand') + } + getCmakeJsLibString() { + return this._invokeCMake('getCmakeJsLibString') + } + getCmakeJsIncludeString() { + return this._invokeCMake('getCmakeJsIncludeString') + } + getCmakeJsSrcString() { + return this._invokeCMake('getCmakeJsSrcString') + } + configure() { + return this._invokeCMake('configure') + } + getBuildCommand() { + return this._invokeCMake('getBuildCommand') + } + build() { + return this._invokeCMake('build') + } + getCleanCommand() { + return this._invokeCMake('getCleanCommand') + } + clean() { + return this._invokeCMake('clean') + } + reconfigure() { + return this._invokeCMake('reconfigure') + } + rebuild() { + return this._invokeCMake('rebuild') + } + compile() { + return this._invokeCMake('compile') + } +} + +module.exports = BuildSystem diff --git a/node_modules/cmake-js/lib/cMake.js b/node_modules/cmake-js/lib/cMake.js new file mode 100644 index 0000000..6ec0a79 --- /dev/null +++ b/node_modules/cmake-js/lib/cMake.js @@ -0,0 +1,362 @@ +'use strict' +const which = require('which') +const fs = require('fs-extra') +const path = require('path') +const environment = require('./environment') +const Dist = require('./dist') +const CMLog = require('./cmLog') +const TargetOptions = require('./targetOptions') +const processHelpers = require('./processHelpers') +const locateNAN = require('./locateNAN') +const locateNodeApi = require('./locateNodeApi') +const npmConfigData = require('rc')('npm') +const Toolset = require('./toolset') +const headers = require('node-api-headers') + +class CMake { + get path() { + return this.options.cmakePath || 'cmake' + } + get isAvailable() { + if (this._isAvailable === null) { + this._isAvailable = CMake.isAvailable(this.options) + } + return this._isAvailable + } + + constructor(options) { + this.options = options || {} + this.log = new CMLog(this.options) + this.dist = new Dist(this.options) + this.projectRoot = path.resolve(this.options.directory || process.cwd()) + this.workDir = path.resolve(this.options.out || path.join(this.projectRoot, 'build')) + this.config = this.options.config || (this.options.debug ? 'Debug' : 'Release') + this.buildDir = path.join(this.workDir, this.config) + this._isAvailable = null + this.targetOptions = new TargetOptions(this.options) + this.toolset = new Toolset(this.options) + this.cMakeOptions = this.options.cMakeOptions || {} + this.extraCMakeArgs = this.options.extraCMakeArgs || [] + this.silent = !!options.silent + } + static isAvailable(options) { + options = options || {} + try { + if (options.cmakePath) { + const stat = fs.lstatSync(options.cmakePath) + return !stat.isDirectory() + } else { + which.sync('cmake') + return true + } + } catch (e) { + // Ignore + } + return false + } + static async getGenerators(options, log) { + const arch = ' [arch]' + options = options || {} + const gens = [] + if (CMake.isAvailable(options)) { + // try parsing machine-readable capabilities (available since CMake 3.7) + try { + const stdout = await processHelpers.execFile([options.cmakePath || 'cmake', '-E', 'capabilities']) + const capabilities = JSON.parse(stdout) + return capabilities.generators.map((x) => x.name) + } catch (error) { + if (log) { + log.verbose('TOOL', 'Failed to query CMake capabilities (CMake is probably older than 3.7)') + } + } + + // fall back to parsing help text + const stdout = await processHelpers.execFile([options.cmakePath || 'cmake', '--help']) + const hasCr = stdout.includes('\r\n') + const output = hasCr ? stdout.split('\r\n') : stdout.split('\n') + let on = false + output.forEach(function (line, i) { + if (on) { + const parts = line.split('=') + if ( + (parts.length === 2 && parts[0].trim()) || + (parts.length === 1 && i !== output.length - 1 && output[i + 1].trim()[0] === '=') + ) { + let gen = parts[0].trim() + if (gen.endsWith(arch)) { + gen = gen.substr(0, gen.length - arch.length) + } + gens.push(gen) + } + } + if (line.trim() === 'Generators') { + on = true + } + }) + } else { + throw new Error('CMake is not installed. Install CMake.') + } + return gens + } + verifyIfAvailable() { + if (!this.isAvailable) { + throw new Error( + "CMake executable is not found. Please use your system's package manager to install it, or you can get installers from there: http://cmake.org.", + ) + } + } + async getConfigureCommand() { + // Create command: + let command = [this.path, this.projectRoot, '--no-warn-unused-cli'] + + const D = [] + + // CMake.js watermark + D.push({ CMAKE_JS_VERSION: environment.cmakeJsVersion }) + + // Build configuration: + D.push({ CMAKE_BUILD_TYPE: this.config }) + if (environment.isWin) { + D.push({ CMAKE_RUNTIME_OUTPUT_DIRECTORY: this.workDir }) + } else if (this.workDir.endsWith(this.config)) { + D.push({ CMAKE_LIBRARY_OUTPUT_DIRECTORY: this.workDir }) + } else { + D.push({ CMAKE_LIBRARY_OUTPUT_DIRECTORY: this.buildDir }) + } + + // In some configurations MD builds will crash upon attempting to free memory. + // This tries to encourage MT builds which are larger but less likely to have this crash. + D.push({ CMAKE_MSVC_RUNTIME_LIBRARY: 'MultiThreaded$<$:Debug>' }) + + // Includes: + const includesString = await this.getCmakeJsIncludeString() + D.push({ CMAKE_JS_INC: includesString }) + + // Sources: + const srcsString = this.getCmakeJsSrcString() + D.push({ CMAKE_JS_SRC: srcsString }) + + // Runtime: + D.push({ NODE_RUNTIME: this.targetOptions.runtime }) + D.push({ NODE_RUNTIMEVERSION: this.targetOptions.runtimeVersion }) + D.push({ NODE_ARCH: this.targetOptions.arch }) + + if (environment.isOSX) { + if (this.targetOptions.arch) { + let xcodeArch = this.targetOptions.arch + if (xcodeArch === 'x64') xcodeArch = 'x86_64' + D.push({ CMAKE_OSX_ARCHITECTURES: xcodeArch }) + } + } + + // Custom options + for (const [key, value] of Object.entries(this.cMakeOptions)) { + D.push({ [key]: value }) + } + + // Toolset: + await this.toolset.initialize(false) + + const libsString = this.getCmakeJsLibString() + D.push({ CMAKE_JS_LIB: libsString }) + + if (environment.isWin) { + const nodeLibDefPath = this.getNodeLibDefPath() + if (nodeLibDefPath) { + const nodeLibPath = path.join(this.workDir, 'node.lib') + D.push({ CMAKE_JS_NODELIB_DEF: nodeLibDefPath }) + D.push({ CMAKE_JS_NODELIB_TARGET: nodeLibPath }) + } + } + + if (this.toolset.generator) { + command.push('-G', this.toolset.generator) + } + if (this.toolset.platform) { + command.push('-A', this.toolset.platform) + } + if (this.toolset.toolset) { + command.push('-T', this.toolset.toolset) + } + if (this.toolset.cppCompilerPath) { + D.push({ CMAKE_CXX_COMPILER: this.toolset.cppCompilerPath }) + } + if (this.toolset.cCompilerPath) { + D.push({ CMAKE_C_COMPILER: this.toolset.cCompilerPath }) + } + if (this.toolset.compilerFlags.length) { + D.push({ CMAKE_CXX_FLAGS: this.toolset.compilerFlags.join(' ') }) + } + if (this.toolset.linkerFlags.length) { + D.push({ CMAKE_SHARED_LINKER_FLAGS: this.toolset.linkerFlags.join(' ') }) + } + if (this.toolset.makePath) { + D.push({ CMAKE_MAKE_PROGRAM: this.toolset.makePath }) + } + + // Load NPM config + for (const [key, value] of Object.entries(npmConfigData)) { + if (key.startsWith('cmake_')) { + const sk = key.substr(6) + if (sk && value) { + D.push({ [sk]: value }) + } + } + } + + command = command.concat( + D.map(function (p) { + return '-D' + Object.keys(p)[0] + '=' + Object.values(p)[0] + }), + ) + + return command.concat(this.extraCMakeArgs) + } + getCmakeJsLibString() { + const libs = [] + if (environment.isWin) { + const nodeLibDefPath = this.getNodeLibDefPath() + if (nodeLibDefPath) { + libs.push(path.join(this.workDir, 'node.lib')) + } else { + libs.push(...this.dist.winLibs) + } + } + return libs.join(';') + } + async getCmakeJsIncludeString() { + let incPaths = [] + if (!this.options.isNodeApi) { + // Include and lib: + if (this.dist.headerOnly) { + incPaths = [path.join(this.dist.internalPath, '/include/node')] + } else { + const nodeH = path.join(this.dist.internalPath, '/src') + const v8H = path.join(this.dist.internalPath, '/deps/v8/include') + const uvH = path.join(this.dist.internalPath, '/deps/uv/include') + incPaths = [nodeH, v8H, uvH] + } + + // NAN + const nanH = await locateNAN(this.projectRoot) + if (nanH) { + incPaths.push(nanH) + } + } else { + // Base headers + const apiHeaders = require('node-api-headers') + incPaths.push(apiHeaders.include_dir) + + // Node-api + const napiH = await locateNodeApi(this.projectRoot) + if (napiH) { + incPaths.push(napiH) + } + } + + return incPaths.join(';') + } + getCmakeJsSrcString() { + const srcPaths = [] + if (environment.isWin) { + const delayHook = path.normalize(path.join(__dirname, 'cpp', 'win_delay_load_hook.cc')) + + srcPaths.push(delayHook.replace(/\\/gm, '/')) + } + + return srcPaths.join(';') + } + getNodeLibDefPath() { + return environment.isWin && this.options.isNodeApi ? headers.def_paths.node_api_def : undefined + } + async configure() { + this.verifyIfAvailable() + + this.log.info('CMD', 'CONFIGURE') + const listPath = path.join(this.projectRoot, 'CMakeLists.txt') + const command = await this.getConfigureCommand() + + try { + await fs.lstat(listPath) + } catch (e) { + throw new Error("'" + listPath + "' not found.") + } + + try { + await fs.ensureDir(this.workDir) + } catch (e) { + // Ignore + } + + const cwd = process.cwd() + process.chdir(this.workDir) + try { + await this._run(command) + } finally { + process.chdir(cwd) + } + } + async ensureConfigured() { + try { + await fs.lstat(path.join(this.workDir, 'CMakeCache.txt')) + } catch (e) { + await this.configure() + } + } + getBuildCommand() { + const command = [this.path, '--build', this.workDir, '--config', this.config] + if (this.options.target) { + command.push('--target', this.options.target) + } + if (this.options.parallel) { + command.push('--parallel', this.options.parallel) + } + return Promise.resolve(command.concat(this.extraCMakeArgs)) + } + async build() { + this.verifyIfAvailable() + + await this.ensureConfigured() + const buildCommand = await this.getBuildCommand() + this.log.info('CMD', 'BUILD') + await this._run(buildCommand) + } + getCleanCommand() { + return [this.path, '-E', 'remove_directory', this.workDir].concat(this.extraCMakeArgs) + } + clean() { + this.verifyIfAvailable() + + this.log.info('CMD', 'CLEAN') + return this._run(this.getCleanCommand()) + } + async reconfigure() { + this.extraCMakeArgs = [] + await this.clean() + await this.configure() + } + async rebuild() { + this.extraCMakeArgs = [] + await this.clean() + await this.build() + } + async compile() { + this.extraCMakeArgs = [] + try { + await this.build() + } catch (e) { + this.log.info('REP', 'Build has been failed, trying to do a full rebuild.') + await this.rebuild() + } + } + _run(command) { + this.log.info('RUN', command) + return processHelpers.run(command, { silent: this.silent }) + } + + async getGenerators() { + return CMake.getGenerators(this.options, this.log) + } +} + +module.exports = CMake diff --git a/node_modules/cmake-js/lib/cmLog.js b/node_modules/cmake-js/lib/cmLog.js new file mode 100644 index 0000000..b481d4a --- /dev/null +++ b/node_modules/cmake-js/lib/cmLog.js @@ -0,0 +1,61 @@ +'use strict' +const log = require('./logger') + +class CMLog { + get level() { + if (this.options.noLog) { + return 'silly' + } else { + return log.level + } + } + + constructor(options) { + this.options = options || {} + this.debug = require('debug')(this.options.logName || 'cmake-js') + } + silly(cat, msg) { + if (this.options.noLog) { + this.debug(cat + ': ' + msg) + } else { + log.silly(cat, msg) + } + } + verbose(cat, msg) { + if (this.options.noLog) { + this.debug(cat + ': ' + msg) + } else { + log.verbose(cat, msg) + } + } + info(cat, msg) { + if (this.options.noLog) { + this.debug(cat + ': ' + msg) + } else { + log.info(cat, msg) + } + } + warn(cat, msg) { + if (this.options.noLog) { + this.debug(cat + ': ' + msg) + } else { + log.warn(cat, msg) + } + } + http(cat, msg) { + if (this.options.noLog) { + this.debug(cat + ': ' + msg) + } else { + log.http(cat, msg) + } + } + error(cat, msg) { + if (this.options.noLog) { + this.debug(cat + ': ' + msg) + } else { + log.error(cat, msg) + } + } +} + +module.exports = CMLog diff --git a/node_modules/cmake-js/lib/cpp/win_delay_load_hook.cc b/node_modules/cmake-js/lib/cpp/win_delay_load_hook.cc new file mode 100644 index 0000000..8add292 --- /dev/null +++ b/node_modules/cmake-js/lib/cpp/win_delay_load_hook.cc @@ -0,0 +1,52 @@ +/* + * When this file is linked to a DLL, it sets up a delay-load hook that + * intervenes when the DLL is trying to load 'node.exe' or 'iojs.exe' + * dynamically. Instead of trying to locate the .exe file it'll just return + * a handle to the process image. + * + * This allows compiled addons to work when node.exe or iojs.exe is renamed. + */ + +#ifdef _MSC_VER + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#include + +#include +#include + +static HMODULE node_dll = NULL; +static HMODULE nw_dll = NULL; + +static FARPROC WINAPI load_exe_hook(unsigned int event, DelayLoadInfo* info) { + if (event == dliNotePreGetProcAddress) { + FARPROC ret = NULL; + ret = GetProcAddress(node_dll, info->dlp.szProcName); + if (ret) + return ret; + ret = GetProcAddress(nw_dll, info->dlp.szProcName); + return ret; + } + if (event == dliStartProcessing) { + node_dll = GetModuleHandleA("node.dll"); + nw_dll = GetModuleHandleA("nw.dll"); + return NULL; + } + if (event != dliNotePreLoadLibrary) + return NULL; + + if (_stricmp(info->szDll, "node.exe") != 0) + return NULL; + + // Fall back to the current process + if(!node_dll) node_dll = GetModuleHandleA(NULL); + + return (FARPROC) node_dll; +} + +decltype(__pfnDliNotifyHook2) __pfnDliNotifyHook2 = load_exe_hook; + +#endif diff --git a/node_modules/cmake-js/lib/dist.js b/node_modules/cmake-js/lib/dist.js new file mode 100644 index 0000000..6bfbd32 --- /dev/null +++ b/node_modules/cmake-js/lib/dist.js @@ -0,0 +1,176 @@ +'use strict' +const environment = require('./environment') +const path = require('path') +const urljoin = require('url-join') +const fs = require('fs-extra') +const CMLog = require('./cmLog') +const TargetOptions = require('./targetOptions') +const runtimePaths = require('./runtimePaths') +const Downloader = require('./downloader') +const os = require('os') + +function testSum(sums, sum, fPath) { + const serverSum = sums.find(function (s) { + return s.getPath === fPath + }) + if (serverSum && serverSum.sum === sum) { + return + } + throw new Error("SHA sum of file '" + fPath + "' mismatch!") +} + +class Dist { + get internalPath() { + const cacheDirectory = '.cmake-js' + const runtimeArchDirectory = this.targetOptions.runtime + '-' + this.targetOptions.arch + const runtimeVersionDirectory = 'v' + this.targetOptions.runtimeVersion + + return ( + this.options.runtimeDirectory || + path.join(os.homedir(), cacheDirectory, runtimeArchDirectory, runtimeVersionDirectory) + ) + } + get externalPath() { + return runtimePaths.get(this.targetOptions).externalPath + } + get downloaded() { + let headers = false + let libs = true + let stat = getStat(this.internalPath) + if (stat.isDirectory()) { + if (this.headerOnly) { + stat = getStat(path.join(this.internalPath, 'include/node/node.h')) + headers = stat.isFile() + } else { + stat = getStat(path.join(this.internalPath, 'src/node.h')) + if (stat.isFile()) { + stat = getStat(path.join(this.internalPath, 'deps/v8/include/v8.h')) + headers = stat.isFile() + } + } + if (environment.isWin) { + for (const libPath of this.winLibs) { + stat = getStat(libPath) + libs = libs && stat.isFile() + } + } + } + return headers && libs + + function getStat(path) { + try { + return fs.statSync(path) + } catch (e) { + return { + isFile: () => false, + isDirectory: () => false, + } + } + } + } + get winLibs() { + const libs = runtimePaths.get(this.targetOptions).winLibs + const result = [] + for (const lib of libs) { + result.push(path.join(this.internalPath, lib.dir, lib.name)) + } + return result + } + get headerOnly() { + return runtimePaths.get(this.targetOptions).headerOnly + } + + constructor(options) { + this.options = options || {} + this.log = new CMLog(this.options) + this.targetOptions = new TargetOptions(this.options) + this.downloader = new Downloader(this.options) + } + + async ensureDownloaded() { + if (!this.downloaded) { + await this.download() + } + } + async download() { + const log = this.log + log.info('DIST', 'Downloading distribution files to: ' + this.internalPath) + await fs.ensureDir(this.internalPath) + const sums = await this._downloadShaSums() + await Promise.all([this._downloadLibs(sums), this._downloadTar(sums)]) + } + async _downloadShaSums() { + if (this.targetOptions.runtime === 'node') { + const sumUrl = urljoin(this.externalPath, 'SHASUMS256.txt') + const log = this.log + log.http('DIST', '\t- ' + sumUrl) + return (await this.downloader.downloadString(sumUrl)) + .split('\n') + .map(function (line) { + const parts = line.split(/\s+/) + return { + getPath: parts[1], + sum: parts[0], + } + }) + .filter(function (i) { + return i.getPath && i.sum + }) + } else { + return null + } + } + async _downloadTar(sums) { + const log = this.log + const self = this + const tarLocalPath = runtimePaths.get(self.targetOptions).tarPath + const tarUrl = urljoin(self.externalPath, tarLocalPath) + log.http('DIST', '\t- ' + tarUrl) + + const sum = await this.downloader.downloadTgz(tarUrl, { + hash: sums ? 'sha256' : null, + cwd: self.internalPath, + strip: 1, + filter: function (entryPath) { + if (entryPath === self.internalPath) { + return true + } + const ext = path.extname(entryPath) + return ext && ext.toLowerCase() === '.h' + }, + }) + + if (sums) { + testSum(sums, sum, tarLocalPath) + } + } + async _downloadLibs(sums) { + const log = this.log + const self = this + if (!environment.isWin) { + return + } + + const paths = runtimePaths.get(self.targetOptions) + for (const dirs of paths.winLibs) { + const subDir = dirs.dir + const fn = dirs.name + const fPath = subDir ? urljoin(subDir, fn) : fn + const libUrl = urljoin(self.externalPath, fPath) + log.http('DIST', '\t- ' + libUrl) + + await fs.ensureDir(path.join(self.internalPath, subDir)) + + const sum = await this.downloader.downloadFile(libUrl, { + path: path.join(self.internalPath, fPath), + hash: sums ? 'sha256' : null, + }) + + if (sums) { + testSum(sums, sum, fPath) + } + } + } +} + +module.exports = Dist diff --git a/node_modules/cmake-js/lib/downloader.js b/node_modules/cmake-js/lib/downloader.js new file mode 100644 index 0000000..6f14b20 --- /dev/null +++ b/node_modules/cmake-js/lib/downloader.js @@ -0,0 +1,99 @@ +'use strict' +const crypto = require('crypto') +const { Readable } = require('node:stream') +const zlib = require('zlib') +const tar = require('tar') +const fs = require('fs') +const CMLog = require('./cmLog') + +class Downloader { + constructor(options) { + this.options = options || {} + this.log = new CMLog(this.options) + } + downloadToStream(url, stream, hash) { + const self = this + const shasum = hash ? crypto.createHash(hash) : null + return new Promise(function (resolve, reject) { + let length = 0 + let done = 0 + let lastPercent = 0 + fetch(url) + .then(function (response) { + if (!response.ok) { + throw new Error(response.statusText || 'Request failed') + } + length = parseInt(response.headers.get('content-length')) + if (Number.isNaN(length)) { + length = 0 + } + + const readable = Readable.fromWeb(response.body) + readable.on('data', function (chunk) { + if (shasum) { + shasum.update(chunk) + } + if (length) { + done += chunk.length + let percent = (done / length) * 100 + percent = Math.round(percent / 10) * 10 + 10 + if (percent > lastPercent) { + self.log.verbose('DWNL', '\t' + lastPercent + '%') + lastPercent = percent + } + } + }) + + readable.pipe(stream) + readable.on('error', function (err) { + reject(err) + }) + }) + .catch(function (err) { + reject(err) + }) + + stream.once('error', function (err) { + reject(err) + }) + + stream.once('finish', function () { + resolve(shasum ? shasum.digest('hex') : undefined) + }) + }) + } + async downloadString(url) { + const response = await fetch(url) + if (!response.ok) { + throw new Error(response.statusText || 'Request failed') + } + return response.text() + } + async downloadFile(url, options) { + if (typeof options === 'string') { + options.path = options + } + const result = fs.createWriteStream(options.path) + const sum = await this.downloadToStream(url, result, options.hash) + this.testSum(url, sum, options) + return sum + } + async downloadTgz(url, options) { + if (typeof options === 'string') { + options.cwd = options + } + const gunzip = zlib.createGunzip() + const extractor = tar.extract(options) + gunzip.pipe(extractor) + const sum = await this.downloadToStream(url, gunzip, options.hash) + this.testSum(url, sum, options) + return sum + } + testSum(url, sum, options) { + if (options.hash && sum && options.sum && options.sum !== sum) { + throw new Error(options.hash.toUpperCase() + " sum of download '" + url + "' mismatch!") + } + } +} + +module.exports = Downloader diff --git a/node_modules/cmake-js/lib/environment.js b/node_modules/cmake-js/lib/environment.js new file mode 100644 index 0000000..401b0ba --- /dev/null +++ b/node_modules/cmake-js/lib/environment.js @@ -0,0 +1,97 @@ +'use strict' +const os = require('os') +const which = require('which') + +const environment = (module.exports = { + cmakeJsVersion: require('../package.json').version, + platform: os.platform(), + isWin: os.platform() === 'win32', + isLinux: os.platform() === 'linux', + isOSX: os.platform() === 'darwin', + arch: os.arch(), + isX86: os.arch() === 'ia32' || os.arch() === 'x86', + isX64: os.arch() === 'x64', + isArm: os.arch() === 'arm', + isArm64: os.arch() === 'arm64', + runtime: 'node', + runtimeVersion: process.versions.node, +}) + +Object.defineProperties(environment, { + _isNinjaAvailable: { + value: null, + writable: true, + }, + isNinjaAvailable: { + get: function () { + if (this._isNinjaAvailable === null) { + this._isNinjaAvailable = false + try { + if (which.sync('ninja')) { + this._isNinjaAvailable = true + } + } catch (e) { + // Ignore + } + } + return this._isNinjaAvailable + }, + }, + _isMakeAvailable: { + value: null, + writable: true, + }, + isMakeAvailable: { + get: function () { + if (this._isMakeAvailable === null) { + this._isMakeAvailable = false + try { + if (which.sync('make')) { + this._isMakeAvailable = true + } + } catch (e) { + // Ignore + } + } + return this._isMakeAvailable + }, + }, + _isGPPAvailable: { + value: null, + writable: true, + }, + isGPPAvailable: { + get: function () { + if (this._isGPPAvailable === null) { + this._isGPPAvailable = false + try { + if (which.sync('g++')) { + this._isGPPAvailable = true + } + } catch (e) { + // Ignore + } + } + return this._isGPPAvailable + }, + }, + _isClangAvailable: { + value: null, + writable: true, + }, + isClangAvailable: { + get: function () { + if (this._isClangAvailable === null) { + this._isClangAvailable = false + try { + if (which.sync('clang++')) { + this._isClangAvailable = true + } + } catch (e) { + // Ignore + } + } + return this._isClangAvailable + }, + }, +}) diff --git a/node_modules/cmake-js/lib/import/Find-VisualStudio.cs b/node_modules/cmake-js/lib/import/Find-VisualStudio.cs new file mode 100644 index 0000000..a58c807 --- /dev/null +++ b/node_modules/cmake-js/lib/import/Find-VisualStudio.cs @@ -0,0 +1,250 @@ +// Copyright 2017 - Refael Ackermann +// Distributed under MIT style license +// See accompanying file LICENSE at https://github.com/node4good/windows-autoconf + +// Usage: +// powershell -ExecutionPolicy Unrestricted -Command "Add-Type -Path Find-VisualStudio.cs; [VisualStudioConfiguration.Main]::PrintJson()" +// This script needs to be compatible with PowerShell v2 to run on Windows 2008R2 and Windows 7. + +using System; +using System.Text; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace VisualStudioConfiguration +{ + [Flags] + public enum InstanceState : uint + { + None = 0, + Local = 1, + Registered = 2, + NoRebootRequired = 4, + NoErrors = 8, + Complete = 4294967295, + } + + [Guid("6380BCFF-41D3-4B2E-8B2E-BF8A6810C848")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + public interface IEnumSetupInstances + { + + void Next([MarshalAs(UnmanagedType.U4), In] int celt, + [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface), Out] ISetupInstance[] rgelt, + [MarshalAs(UnmanagedType.U4)] out int pceltFetched); + + void Skip([MarshalAs(UnmanagedType.U4), In] int celt); + + void Reset(); + + [return: MarshalAs(UnmanagedType.Interface)] + IEnumSetupInstances Clone(); + } + + [Guid("42843719-DB4C-46C2-8E7C-64F1816EFD5B")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + public interface ISetupConfiguration + { + } + + [Guid("26AAB78C-4A60-49D6-AF3B-3C35BC93365D")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + public interface ISetupConfiguration2 : ISetupConfiguration + { + + [return: MarshalAs(UnmanagedType.Interface)] + IEnumSetupInstances EnumInstances(); + + [return: MarshalAs(UnmanagedType.Interface)] + ISetupInstance GetInstanceForCurrentProcess(); + + [return: MarshalAs(UnmanagedType.Interface)] + ISetupInstance GetInstanceForPath([MarshalAs(UnmanagedType.LPWStr), In] string path); + + [return: MarshalAs(UnmanagedType.Interface)] + IEnumSetupInstances EnumAllInstances(); + } + + [Guid("B41463C3-8866-43B5-BC33-2B0676F7F42E")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + public interface ISetupInstance + { + } + + [Guid("89143C9A-05AF-49B0-B717-72E218A2185C")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + public interface ISetupInstance2 : ISetupInstance + { + [return: MarshalAs(UnmanagedType.BStr)] + string GetInstanceId(); + + [return: MarshalAs(UnmanagedType.Struct)] + System.Runtime.InteropServices.ComTypes.FILETIME GetInstallDate(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetInstallationName(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetInstallationPath(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetInstallationVersion(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetDisplayName([MarshalAs(UnmanagedType.U4), In] int lcid); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetDescription([MarshalAs(UnmanagedType.U4), In] int lcid); + + [return: MarshalAs(UnmanagedType.BStr)] + string ResolvePath([MarshalAs(UnmanagedType.LPWStr), In] string pwszRelativePath); + + [return: MarshalAs(UnmanagedType.U4)] + InstanceState GetState(); + + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + ISetupPackageReference[] GetPackages(); + + ISetupPackageReference GetProduct(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetProductPath(); + + [return: MarshalAs(UnmanagedType.VariantBool)] + bool IsLaunchable(); + + [return: MarshalAs(UnmanagedType.VariantBool)] + bool IsComplete(); + + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + ISetupPropertyStore GetProperties(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetEnginePath(); + } + + [Guid("DA8D8A16-B2B6-4487-A2F1-594CCCCD6BF5")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + public interface ISetupPackageReference + { + + [return: MarshalAs(UnmanagedType.BStr)] + string GetId(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetVersion(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetChip(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetLanguage(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetBranch(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetType(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetUniqueId(); + + [return: MarshalAs(UnmanagedType.VariantBool)] + bool GetIsExtension(); + } + + [Guid("c601c175-a3be-44bc-91f6-4568d230fc83")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + public interface ISetupPropertyStore + { + + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_BSTR)] + string[] GetNames(); + + object GetValue([MarshalAs(UnmanagedType.LPWStr), In] string pwszName); + } + + [Guid("42843719-DB4C-46C2-8E7C-64F1816EFD5B")] + [CoClass(typeof(SetupConfigurationClass))] + [ComImport] + public interface SetupConfiguration : ISetupConfiguration2, ISetupConfiguration + { + } + + [Guid("177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D")] + [ClassInterface(ClassInterfaceType.None)] + [ComImport] + public class SetupConfigurationClass + { + } + + public static class Main + { + public static void PrintJson() + { + ISetupConfiguration query = new SetupConfiguration(); + ISetupConfiguration2 query2 = (ISetupConfiguration2)query; + IEnumSetupInstances e = query2.EnumAllInstances(); + + int pceltFetched; + ISetupInstance2[] rgelt = new ISetupInstance2[1]; + List instances = new List(); + while (true) + { + e.Next(1, rgelt, out pceltFetched); + if (pceltFetched <= 0) + { + Console.WriteLine(String.Format("[{0}]", string.Join(",", instances.ToArray()))); + return; + } + + try + { + instances.Add(InstanceJson(rgelt[0])); + } + catch (COMException) + { + // Ignore instances that can't be queried. + } + } + } + + private static string JsonString(string s) + { + return "\"" + s.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\""; + } + + private static string InstanceJson(ISetupInstance2 setupInstance2) + { + // Visual Studio component directory: + // https://docs.microsoft.com/en-us/visualstudio/install/workload-and-component-ids + + StringBuilder json = new StringBuilder(); + json.Append("{"); + + string path = JsonString(setupInstance2.GetInstallationPath()); + json.Append(String.Format("\"path\":{0},", path)); + + string version = JsonString(setupInstance2.GetInstallationVersion()); + json.Append(String.Format("\"version\":{0},", version)); + + List packages = new List(); + foreach (ISetupPackageReference package in setupInstance2.GetPackages()) + { + string id = JsonString(package.GetId()); + packages.Add(id); + } + json.Append(String.Format("\"packages\":[{0}]", string.Join(",", packages.ToArray()))); + + json.Append("}"); + return json.ToString(); + } + } +} \ No newline at end of file diff --git a/node_modules/cmake-js/lib/import/LICENSE b/node_modules/cmake-js/lib/import/LICENSE new file mode 100644 index 0000000..924e1e3 --- /dev/null +++ b/node_modules/cmake-js/lib/import/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2012 Nathan Rajlich + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/cmake-js/lib/import/README b/node_modules/cmake-js/lib/import/README new file mode 100644 index 0000000..55d9730 --- /dev/null +++ b/node_modules/cmake-js/lib/import/README @@ -0,0 +1,6 @@ +This is a copy of some files from node-gyp, with some minor modifications. + +Currently based on v10.0.1 + +node-gyp has a decent strategy for finding Visual Studio, and has a lot more developer time behind them to make a good and robust solution. +We may as well benefit from their solution than reinvent it diff --git a/node_modules/cmake-js/lib/import/find-visualstudio.js b/node_modules/cmake-js/lib/import/find-visualstudio.js new file mode 100644 index 0000000..3139f6e --- /dev/null +++ b/node_modules/cmake-js/lib/import/find-visualstudio.js @@ -0,0 +1,598 @@ +'use strict' + +const log = require('../logger') +const { existsSync } = require('fs') +const { win32: path } = require('path') +const { regSearchKeys, execFile, logWithPrefix } = require('./util') +const semver = require('semver') + +class VisualStudioFinder { + static findVisualStudio = (...args) => new VisualStudioFinder(...args).findVisualStudio() + + log = logWithPrefix(log, 'find VS') + + regSearchKeys = regSearchKeys + + constructor(nodeSemver, configMsvsVersion) { + this.nodeSemver = nodeSemver + this.configMsvsVersion = configMsvsVersion + this.errorLog = [] + this.validVersions = [] + } + + // Logs a message at verbose level, but also saves it to be displayed later + // at error level if an error occurs. This should help diagnose the problem. + addLog(message) { + this.log.verbose(message) + this.errorLog.push(message) + } + + async findVisualStudio() { + this.configVersionYear = null + this.configPath = null + if (this.configMsvsVersion) { + this.addLog('msvs_version was set from command line or npm config') + if (this.configMsvsVersion.match(/^\d{4}$/)) { + this.configVersionYear = parseInt(this.configMsvsVersion, 10) + this.addLog(`- looking for Visual Studio version ${this.configVersionYear}`) + } else { + this.configPath = path.resolve(this.configMsvsVersion) + this.addLog(`- looking for Visual Studio installed in "${this.configPath}"`) + } + } else { + this.addLog('msvs_version not set from command line or npm config') + } + + if (process.env.VCINSTALLDIR) { + this.envVcInstallDir = path.resolve(process.env.VCINSTALLDIR, '..') + this.addLog( + 'running in VS Command Prompt, installation path is:\n' + + `"${this.envVcInstallDir}"\n- will only use this version`, + ) + } else { + this.addLog('VCINSTALLDIR not set, not running in VS Command Prompt') + } + + const checks = [ + () => this.findVisualStudio2019OrNewerFromSpecifiedLocation(), + () => this.findVisualStudio2019OrNewerUsingSetupModule(), + () => this.findVisualStudio2019OrNewer(), + () => this.findVisualStudio2017FromSpecifiedLocation(), + () => this.findVisualStudio2017UsingSetupModule(), + () => this.findVisualStudio2017(), + () => this.findVisualStudio2015(), + () => this.findVisualStudio2013(), + ] + + for (const check of checks) { + const info = await check() + if (info) { + return this.succeed(info) + } + } + + return this.fail() + } + + succeed(info) { + this.log.info( + `using VS${info.versionYear} (${info.version}) found at:` + + `\n"${info.path}"` + + '\nrun with --verbose for detailed information', + ) + return info + } + + fail() { + if (this.configMsvsVersion && this.envVcInstallDir) { + this.errorLog.push('msvs_version does not match this VS Command Prompt or the', 'installation cannot be used.') + } else if (this.configMsvsVersion) { + // If msvs_version was specified but finding VS failed, print what would + // have been accepted + this.errorLog.push('') + if (this.validVersions) { + this.errorLog.push('valid versions for msvs_version:') + this.validVersions.forEach((version) => { + this.errorLog.push(`- "${version}"`) + }) + } else { + this.errorLog.push('no valid versions for msvs_version were found') + } + } + + const errorLog = this.errorLog.join('\n') + + // For Windows 80 col console, use up to the column before the one marked + // with X (total 79 chars including logger prefix, 62 chars usable here): + // X + const infoLog = [ + '**************************************************************', + 'You need to install the latest version of Visual Studio', + 'including the "Desktop development with C++" workload.', + 'For more information consult the documentation at:', + 'https://github.com/nodejs/node-gyp#on-windows', + '**************************************************************', + ].join('\n') + + this.log.error(`\n${errorLog}\n\n${infoLog}\n`) + throw new Error('Could not find any Visual Studio installation to use') + } + + async findVisualStudio2019OrNewerFromSpecifiedLocation() { + return this.findVSFromSpecifiedLocation([2019, 2022, 2026]) + } + + async findVisualStudio2017FromSpecifiedLocation() { + if (semver.gte(this.nodeSemver, '22.0.0')) { + this.addLog('not looking for VS2017 as it is only supported up to Node.js 21') + return null + } + return this.findVSFromSpecifiedLocation([2017]) + } + + async findVSFromSpecifiedLocation(supportedYears) { + if (!this.envVcInstallDir) { + return null + } + const info = { + path: path.resolve(this.envVcInstallDir), + // Assume the version specified by the user is correct. + // Since Visual Studio 2015, the Developer Command Prompt sets the + // VSCMD_VER environment variable which contains the version information + // for Visual Studio. + // https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2022 + version: process.env.VSCMD_VER, + packages: [ + 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64', + 'Microsoft.VisualStudio.Component.VC.Tools.ARM64', + // Assume MSBuild exists. It will be checked in processing. + 'Microsoft.VisualStudio.VC.MSBuild.Base', + ], + } + + // Is there a better way to get SDK information? + const envWindowsSDKVersion = process.env.WindowsSDKVersion + const sdkVersionMatched = envWindowsSDKVersion?.match(/^(\d+)\.(\d+)\.(\d+)\..*/) + if (sdkVersionMatched) { + info.packages.push(`Microsoft.VisualStudio.Component.Windows10SDK.${sdkVersionMatched[3]}.Desktop`) + } + // pass for further processing + return this.processData([info], supportedYears) + } + + async findVisualStudio2019OrNewerUsingSetupModule() { + return this.findNewVSUsingSetupModule([2019, 2022, 2026]) + } + + async findVisualStudio2017UsingSetupModule() { + if (semver.gte(this.nodeSemver, '22.0.0')) { + this.addLog('not looking for VS2017 as it is only supported up to Node.js 21') + return null + } + return this.findNewVSUsingSetupModule([2017]) + } + + async findNewVSUsingSetupModule(supportedYears) { + const ps = path.join(process.env.SystemRoot, 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe') + const vcInstallDir = this.envVcInstallDir + + const checkModuleArgs = [ + '-NoProfile', + '-Command', + '&{@(Get-Module -ListAvailable -Name VSSetup).Version.ToString()}', + ] + this.log.silly('Running', ps, checkModuleArgs) + const [cErr] = await this.execFile(ps, checkModuleArgs) + if (cErr) { + this.addLog( + 'VSSetup module doesn\'t seem to exist. You can install it via: "Install-Module VSSetup -Scope CurrentUser"', + ) + this.log.silly('VSSetup error = %j', cErr && (cErr.stack || cErr)) + return null + } + const filterArg = vcInstallDir !== undefined ? `| where {$_.InstallationPath -eq '${vcInstallDir}' }` : '' + const psArgs = ['-NoProfile', '-Command', `&{Get-VSSetupInstance ${filterArg} | ConvertTo-Json -Depth 3}`] + + this.log.silly('Running', ps, psArgs) + const [err, stdout, stderr] = await this.execFile(ps, psArgs) + let parsedData = this.parseData(err, stdout, stderr) + if (parsedData === null) { + return null + } + this.log.silly('Parsed data', parsedData) + if (!Array.isArray(parsedData)) { + // if there are only 1 result, then Powershell will output non-array + parsedData = [parsedData] + } + // normalize output + parsedData = parsedData.map((info) => { + info.path = info.InstallationPath + info.version = `${info.InstallationVersion.Major}.${info.InstallationVersion.Minor}.${info.InstallationVersion.Build}.${info.InstallationVersion.Revision}` + info.packages = info.Packages.map((p) => p.Id) + return info + }) + // pass for further processing + return this.processData(parsedData, supportedYears) + } + + // Invoke the PowerShell script to get information about Visual Studio 2019 + // or newer installations + async findVisualStudio2019OrNewer() { + return this.findNewVS([2019, 2022, 2026]) + } + + // Invoke the PowerShell script to get information about Visual Studio 2017 + async findVisualStudio2017() { + if (semver.gte(this.nodeSemver, '22.0.0')) { + this.addLog('not looking for VS2017 as it is only supported up to Node.js 21') + return null + } + return this.findNewVS([2017]) + } + + // Invoke the PowerShell script to get information about Visual Studio 2017 + // or newer installations + async findNewVS(supportedYears) { + const ps = path.join(process.env.SystemRoot, 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe') + const csFile = path.join(__dirname, 'Find-VisualStudio.cs') + const psArgs = [ + '-ExecutionPolicy', + 'Unrestricted', + '-NoProfile', + '-Command', + "&{Add-Type -Path '" + csFile + "';" + '[VisualStudioConfiguration.Main]::PrintJson()}', + ] + + this.log.silly('Running', ps, psArgs) + const [err, stdout, stderr] = await this.execFile(ps, psArgs) + const parsedData = this.parseData(err, stdout, stderr, { checkIsArray: true }) + if (parsedData === null) { + return null + } + return this.processData(parsedData, supportedYears) + } + + // Parse the output of the PowerShell script, make sanity checks + parseData(err, stdout, stderr, sanityCheckOptions) { + const defaultOptions = { + checkIsArray: false, + } + + // Merging provided options with the default options + const sanityOptions = { ...defaultOptions, ...sanityCheckOptions } + + this.log.silly('PS stderr = %j', stderr) + + const failPowershell = (failureDetails) => { + this.addLog( + `could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details. \n + Failure details: ${failureDetails}`, + ) + return null + } + + if (err) { + this.log.silly('PS err = %j', err && (err.stack || err)) + return failPowershell(`${err}`.substring(0, 40)) + } + + let vsInfo + try { + vsInfo = JSON.parse(stdout) + } catch (e) { + this.log.silly('PS stdout = %j', stdout) + this.log.silly(e) + return failPowershell() + } + + if (sanityOptions.checkIsArray && !Array.isArray(vsInfo)) { + this.log.silly('PS stdout = %j', stdout) + return failPowershell('Expected array as output of the PS script') + } + return vsInfo + } + + // Process parsed data containing information about VS installations + // Look for the required parts, extract and output them back + processData(vsInfo, supportedYears) { + vsInfo = vsInfo.map((info) => { + this.log.silly(`processing installation: "${info.path}"`) + info.path = path.resolve(info.path) + const ret = this.getVersionInfo(info) + ret.path = info.path + ret.msBuild = this.getMSBuild(info, ret.versionYear) + ret.toolset = this.getToolset(info, ret.versionYear) + ret.sdk = this.getSDK(info) + return ret + }) + this.log.silly('vsInfo:', vsInfo) + + // Remove future versions or errors parsing version number + // Also remove any unsupported versions + vsInfo = vsInfo.filter((info) => { + if (info.versionYear && supportedYears.indexOf(info.versionYear) !== -1) { + return true + } + this.addLog(`${info.versionYear ? 'unsupported' : 'unknown'} version "${info.version}" found at "${info.path}"`) + return false + }) + + // Sort to place newer versions first + vsInfo.sort((a, b) => b.versionYear - a.versionYear) + + for (let i = 0; i < vsInfo.length; ++i) { + const info = vsInfo[i] + this.addLog(`checking VS${info.versionYear} (${info.version}) found ` + `at:\n"${info.path}"`) + + if (info.msBuild) { + this.addLog('- found "Visual Studio C++ core features"') + } else { + this.addLog('- "Visual Studio C++ core features" missing') + continue + } + + if (info.toolset) { + this.addLog(`- found VC++ toolset: ${info.toolset}`) + } else { + this.addLog('- missing any VC++ toolset') + continue + } + + if (info.sdk) { + this.addLog(`- found Windows SDK: ${info.sdk}`) + } else { + this.addLog('- missing any Windows SDK') + continue + } + + if (!this.checkConfigVersion(info.versionYear, info.path)) { + continue + } + + return info + } + + this.addLog('could not find a version of Visual Studio 2017 or newer to use') + return null + } + + // Helper - process version information + getVersionInfo(info) { + const match = /^(\d+)\.(\d+)(?:\..*)?/.exec(info.version) + if (!match) { + this.log.silly('- failed to parse version:', info.version) + return {} + } + this.log.silly('- version match = %j', match) + const ret = { + version: info.version, + versionMajor: parseInt(match[1], 10), + versionMinor: parseInt(match[2], 10), + } + if (ret.versionMajor === 15) { + ret.versionYear = 2017 + return ret + } + if (ret.versionMajor === 16) { + ret.versionYear = 2019 + return ret + } + if (ret.versionMajor === 17) { + ret.versionYear = 2022 + return ret + } + if (ret.versionMajor === 18) { + ret.versionYear = 2026 + return ret + } + this.log.silly('- unsupported version:', ret.versionMajor) + return {} + } + + msBuildPathExists(path) { + return existsSync(path) + } + + // Helper - process MSBuild information + getMSBuild(info, versionYear) { + const pkg = 'Microsoft.VisualStudio.VC.MSBuild.Base' + const msbuildPath = path.join(info.path, 'MSBuild', 'Current', 'Bin', 'MSBuild.exe') + const msbuildPathArm64 = path.join(info.path, 'MSBuild', 'Current', 'Bin', 'arm64', 'MSBuild.exe') + if (info.packages.indexOf(pkg) !== -1) { + this.log.silly('- found VC.MSBuild.Base') + if (versionYear === 2017) { + return path.join(info.path, 'MSBuild', '15.0', 'Bin', 'MSBuild.exe') + } + if (versionYear === 2019) { + if (process.arch === 'arm64' && this.msBuildPathExists(msbuildPathArm64)) { + return msbuildPathArm64 + } else { + return msbuildPath + } + } + } + /** + * Visual Studio 2022 doesn't have the MSBuild package. + * Support for compiling _on_ ARM64 was added in MSVC 14.32.31326, + * so let's leverage it if the user has an ARM64 device. + */ + if (process.arch === 'arm64' && this.msBuildPathExists(msbuildPathArm64)) { + return msbuildPathArm64 + } else if (this.msBuildPathExists(msbuildPath)) { + return msbuildPath + } + return null + } + + // Helper - process toolset information + getToolset(info, versionYear) { + const vcToolsArm64 = 'VC.Tools.ARM64' + const pkgArm64 = `Microsoft.VisualStudio.Component.${vcToolsArm64}` + const vcToolsX64 = 'VC.Tools.x86.x64' + const pkgX64 = `Microsoft.VisualStudio.Component.${vcToolsX64}` + const express = 'Microsoft.VisualStudio.WDExpress' + + if (process.arch === 'arm64' && info.packages.includes(pkgArm64)) { + this.log.silly(`- found ${vcToolsArm64}`) + } else if (info.packages.includes(pkgX64)) { + if (process.arch === 'arm64') { + this.addLog( + `- found ${vcToolsX64} on ARM64 platform. Expect less performance and/or link failure with ARM64 binary.`, + ) + } else { + this.log.silly(`- found ${vcToolsX64}`) + } + } else if (info.packages.includes(express)) { + this.log.silly('- found Visual Studio Express (looking for toolset)') + } else { + return null + } + + if (versionYear === 2017) { + return 'v141' + } else if (versionYear === 2019) { + return 'v142' + } else if (versionYear === 2022) { + return 'v143' + } else if (versionYear === 2026) { + return 'v145' + } + this.log.silly('- invalid versionYear:', versionYear) + return null + } + + // Helper - process Windows SDK information + getSDK(info) { + const win8SDK = 'Microsoft.VisualStudio.Component.Windows81SDK' + const win10SDKPrefix = 'Microsoft.VisualStudio.Component.Windows10SDK.' + const win11SDKPrefix = 'Microsoft.VisualStudio.Component.Windows11SDK.' + + let Win10or11SDKVer = 0 + info.packages.forEach((pkg) => { + if (!pkg.startsWith(win10SDKPrefix) && !pkg.startsWith(win11SDKPrefix)) { + return + } + const parts = pkg.split('.') + if (parts.length > 5 && parts[5] !== 'Desktop') { + this.log.silly('- ignoring non-Desktop Win10/11SDK:', pkg) + return + } + const foundSdkVer = parseInt(parts[4], 10) + if (isNaN(foundSdkVer)) { + // Microsoft.VisualStudio.Component.Windows10SDK.IpOverUsb + this.log.silly('- failed to parse Win10/11SDK number:', pkg) + return + } + this.log.silly('- found Win10/11SDK:', foundSdkVer) + Win10or11SDKVer = Math.max(Win10or11SDKVer, foundSdkVer) + }) + + if (Win10or11SDKVer !== 0) { + return `10.0.${Win10or11SDKVer}.0` + } else if (info.packages.indexOf(win8SDK) !== -1) { + this.log.silly('- found Win8SDK') + return '8.1' + } + return null + } + + // Find an installation of Visual Studio 2015 to use + async findVisualStudio2015() { + if (semver.gte(this.nodeSemver, '19.0.0')) { + this.addLog('not looking for VS2015 as it is only supported up to Node.js 18') + return null + } + return this.findOldVS({ + version: '14.0', + versionMajor: 14, + versionMinor: 0, + versionYear: 2015, + toolset: 'v140', + }) + } + + // Find an installation of Visual Studio 2013 to use + async findVisualStudio2013() { + if (semver.gte(this.nodeSemver, '9.0.0')) { + this.addLog('not looking for VS2013 as it is only supported up to Node.js 8') + return null + } + return this.findOldVS({ + version: '12.0', + versionMajor: 12, + versionMinor: 0, + versionYear: 2013, + toolset: 'v120', + }) + } + + // Helper - common code for VS2013 and VS2015 + async findOldVS(info) { + const regVC7 = [ + 'HKLM\\Software\\Microsoft\\VisualStudio\\SxS\\VC7', + 'HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7', + ] + const regMSBuild = 'HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions' + + this.addLog(`looking for Visual Studio ${info.versionYear}`) + try { + let res = await this.regSearchKeys(regVC7, info.version, []) + const vsPath = path.resolve(res, '..') + this.addLog(`- found in "${vsPath}"`) + const msBuildRegOpts = process.arch === 'ia32' ? [] : ['/reg:32'] + + try { + res = await this.regSearchKeys([`${regMSBuild}\\${info.version}`], 'MSBuildToolsPath', msBuildRegOpts) + } catch (err) { + this.addLog('- could not find MSBuild in registry for this version') + return null + } + + const msBuild = path.join(res, 'MSBuild.exe') + this.addLog(`- MSBuild in "${msBuild}"`) + + if (!this.checkConfigVersion(info.versionYear, vsPath)) { + return null + } + + info.path = vsPath + info.msBuild = msBuild + info.sdk = null + return info + } catch (err) { + this.addLog('- not found') + return null + } + } + + // After finding a usable version of Visual Studio: + // - add it to validVersions to be displayed at the end if a specific + // version was requested and not found; + // - check if this is the version that was requested. + // - check if this matches the Visual Studio Command Prompt + checkConfigVersion(versionYear, vsPath) { + this.validVersions.push(versionYear) + this.validVersions.push(vsPath) + + if (this.configVersionYear && this.configVersionYear !== versionYear) { + this.addLog('- msvs_version does not match this version') + return false + } + if (this.configPath && path.relative(this.configPath, vsPath) !== '') { + this.addLog('- msvs_version does not point to this installation') + return false + } + if (this.envVcInstallDir && path.relative(this.envVcInstallDir, vsPath) !== '') { + this.addLog('- does not match this Visual Studio Command Prompt') + return false + } + + return true + } + + async execFile(exec, args) { + return await execFile(exec, args, { encoding: 'utf8' }) + } +} + +module.exports = VisualStudioFinder diff --git a/node_modules/cmake-js/lib/import/util.js b/node_modules/cmake-js/lib/import/util.js new file mode 100644 index 0000000..b6dc9c7 --- /dev/null +++ b/node_modules/cmake-js/lib/import/util.js @@ -0,0 +1,70 @@ +'use strict' + +const log = require('../logger') +const cp = require('child_process') +const path = require('path') + +const execFile = async (...args) => + new Promise((resolve) => { + const child = cp.execFile(...args, (...a) => resolve(a)) + child.stdin.end() + }) + +function logWithPrefix(log, prefix) { + function setPrefix(logFunction) { + return (...args) => logFunction.apply(null, [prefix, ...args]) // eslint-disable-line + } + return { + silly: setPrefix(log.silly), + verbose: setPrefix(log.verbose), + info: setPrefix(log.info), + warn: setPrefix(log.warn), + error: setPrefix(log.error), + } +} + +async function regGetValue(key, value, addOpts) { + const outReValue = value.replace(/\W/g, '.') + const outRe = new RegExp(`^\\s+${outReValue}\\s+REG_\\w+\\s+(\\S.*)$`, 'im') + const reg = path.join(process.env.SystemRoot, 'System32', 'reg.exe') + const regArgs = ['query', key, '/v', value].concat(addOpts) + + log.silly('reg', 'running', reg, regArgs) + const [err, stdout, stderr] = await execFile(reg, regArgs, { encoding: 'utf8' }) + + log.silly('reg', 'reg.exe stdout = %j', stdout) + if (err || stderr.trim() !== '') { + log.silly('reg', 'reg.exe err = %j', err && (err.stack || err)) + log.silly('reg', 'reg.exe stderr = %j', stderr) + if (err) { + throw err + } + throw new Error(stderr) + } + + const result = outRe.exec(stdout) + if (!result) { + log.silly('reg', 'error parsing stdout') + throw new Error('Could not parse output of reg.exe') + } + + log.silly('reg', 'found: %j', result[1]) + return result[1] +} + +async function regSearchKeys(keys, value, addOpts) { + for (const key of keys) { + try { + return await regGetValue(key, value, addOpts) + } catch { + continue + } + } +} + +module.exports = { + logWithPrefix: logWithPrefix, + regGetValue: regGetValue, + regSearchKeys: regSearchKeys, + execFile: execFile, +} diff --git a/node_modules/cmake-js/lib/index.js b/node_modules/cmake-js/lib/index.js new file mode 100644 index 0000000..3773db0 --- /dev/null +++ b/node_modules/cmake-js/lib/index.js @@ -0,0 +1,12 @@ +'use strict' + +module.exports = { + BuildSystem: require('./buildSystem'), + CMLog: require('./cmLog'), + environment: require('./environment'), + TargetOptions: require('./targetOptions'), + Dist: require('./dist'), + CMake: require('./cMake'), + downloader: require('./downloader'), + Toolset: require('./toolset'), +} diff --git a/node_modules/cmake-js/lib/locateNAN.js b/node_modules/cmake-js/lib/locateNAN.js new file mode 100644 index 0000000..c8d0b0b --- /dev/null +++ b/node_modules/cmake-js/lib/locateNAN.js @@ -0,0 +1,63 @@ +'use strict' +const fs = require('fs-extra') +const path = require('path') + +const isNANModule = async function (dir) { + const h = path.join(dir, 'nan.h') + try { + const stat = await fs.stat(h) + return stat.isFile() + } catch (e) { + return false + } +} + +async function isNodeJSProject(dir) { + const pjson = path.join(dir, 'package.json') + const node_modules = path.join(dir, 'node_modules') + try { + let stat = await fs.stat(pjson) + if (stat.isFile()) { + return true + } + stat = await fs.stat(node_modules) + if (stat.isDirectory()) { + return true + } + } catch (e) { + // Ignore + } + return false +} + +const locateNAN = (module.exports = async function (projectRoot) { + if (locateNAN.__projectRoot) { + // Override for unit tests + projectRoot = locateNAN.__projectRoot + } + + let result = await isNodeJSProject(projectRoot) + if (!result) { + return null + } + + const nanModulePath = path.join(projectRoot, 'node_modules', 'nan') + result = await isNANModule(nanModulePath) + if (result) { + return nanModulePath + } + + // Goto upper level: + return await locateNAN(goUp(projectRoot)) +}) + +function goUp(dir) { + const items = dir.split(path.sep) + const scopeItem = items[items.length - 2] + if (scopeItem && scopeItem[0] === '@') { + // skip scope + dir = path.join(dir, '..') + } + dir = path.join(dir, '..', '..') + return path.normalize(dir) +} diff --git a/node_modules/cmake-js/lib/locateNodeApi.js b/node_modules/cmake-js/lib/locateNodeApi.js new file mode 100644 index 0000000..04c6f08 --- /dev/null +++ b/node_modules/cmake-js/lib/locateNodeApi.js @@ -0,0 +1,18 @@ +'use strict' +const path = require('path') + +const locateNodeApi = (module.exports = async function (projectRoot) { + if (locateNodeApi.__projectRoot) { + // Override for unit tests + projectRoot = locateNodeApi.__projectRoot + } + + try { + const tmpRequire = require('module').createRequire(path.join(projectRoot, 'package.json')) + const inc = tmpRequire('node-addon-api') + return inc.include.replace(/"/g, '') + } catch (e) { + // It most likely wasn't found + return null + } +}) diff --git a/node_modules/cmake-js/lib/logger.js b/node_modules/cmake-js/lib/logger.js new file mode 100644 index 0000000..7944537 --- /dev/null +++ b/node_modules/cmake-js/lib/logger.js @@ -0,0 +1,59 @@ +const util = require('util') + +const levels = { + silly: -Infinity, + verbose: 1000, + info: 2000, + http: 3000, + warn: 4000, + error: 5000, + silent: Infinity, +} + +const colors = { + silly: 'inverse', + verbose: 'blue', + info: 'green', + http: 'green', + warn: 'yellow', + error: 'red', +} + +let currentLevel = levels.info + +function log(level, prefix, message, ...args) { + if (currentLevel <= levels[level]) { + const stream = level === 'error' ? process.stderr : process.stdout + const color = colors[level] + let levelStr = level.toUpperCase() + if (process.stdout.isTTY && util.styleText) { + // util.styleText is available in Node.js >= 20.12.0 + levelStr = util.styleText(color, levelStr) + if (prefix) prefix = util.styleText('magenta', prefix) + } + + const formattedMessage = util.format(message, ...args) + const line = prefix + ? util.format('%s %s %s', levelStr, prefix, formattedMessage) + : util.format('%s %s', levelStr, formattedMessage) + + stream.write(line + '\n') + } +} + +const logger = { + get level() { + return Object.keys(levels).find((key) => levels[key] === currentLevel) + }, + set level(newLevel) { + if (levels[newLevel] !== undefined) { + currentLevel = levels[newLevel] + } + }, +} + +for (const level of Object.keys(colors)) { + logger[level] = (prefix, message, ...args) => log(level, prefix, message, ...args) +} + +module.exports = logger diff --git a/node_modules/cmake-js/lib/npmConfig.js b/node_modules/cmake-js/lib/npmConfig.js new file mode 100644 index 0000000..0fb6cf2 --- /dev/null +++ b/node_modules/cmake-js/lib/npmConfig.js @@ -0,0 +1,31 @@ +'use strict' + +function getNpmConfig() { + const npmOptions = {} + const npmConfigPrefix = 'npm_config_' + Object.keys(process.env).forEach(function (name) { + if (name.indexOf(npmConfigPrefix) !== 0) { + return + } + const value = process.env[name] + name = name.substring(npmConfigPrefix.length) + if (name) { + npmOptions[name] = value + } + }, this) + + return npmOptions +} + +module.exports = function (log) { + log.verbose('CFG', 'Looking for NPM config.') + const options = getNpmConfig() + + if (options) { + log.silly('CFG', 'NPM options:', options) + } else { + log.verbose('CFG', 'There are no NPM options available.') + } + + return options +} diff --git a/node_modules/cmake-js/lib/processHelpers.js b/node_modules/cmake-js/lib/processHelpers.js new file mode 100644 index 0000000..1f237ad --- /dev/null +++ b/node_modules/cmake-js/lib/processHelpers.js @@ -0,0 +1,53 @@ +'use strict' +const spawn = require('child_process').spawn +const execFile = require('child_process').execFile + +const processHelpers = { + run: function (command, options) { + if (!options) options = {} + + return new Promise(function (resolve, reject) { + const env = Object.assign({}, process.env) + if (env.Path && env.PATH) { + if (env.Path !== env.PATH) { + env.PATH = env.Path + ';' + env.PATH + } + delete env.Path + } + const child = spawn(command[0], command.slice(1), { + stdio: options.silent ? 'ignore' : 'inherit', + env, + }) + let ended = false + child.on('error', function (e) { + if (!ended) { + reject(e) + ended = true + } + }) + child.on('exit', function (code, signal) { + if (!ended) { + if (code === 0) { + resolve() + } else { + reject(new Error('Process terminated: ' + code || signal)) + } + ended = true + } + }) + }) + }, + execFile: function (command) { + return new Promise(function (resolve, reject) { + execFile(command[0], command.slice(1), function (err, stdout, stderr) { + if (err) { + reject(new Error(err.message + '\n' + (stdout || stderr))) + } else { + resolve(stdout) + } + }) + }) + }, +} + +module.exports = processHelpers diff --git a/node_modules/cmake-js/lib/runtimePaths.js b/node_modules/cmake-js/lib/runtimePaths.js new file mode 100644 index 0000000..4fc9f17 --- /dev/null +++ b/node_modules/cmake-js/lib/runtimePaths.js @@ -0,0 +1,95 @@ +'use strict' +const assert = require('assert') +const semver = require('semver') + +const NODE_MIRROR = process.env.NVM_NODEJS_ORG_MIRROR || 'https://nodejs.org/dist' +const ELECTRON_MIRROR = process.env.ELECTRON_MIRROR || 'https://artifacts.electronjs.org/headers/dist' + +const runtimePaths = { + node: function (targetOptions) { + if (semver.lt(targetOptions.runtimeVersion, '4.0.0')) { + return { + externalPath: NODE_MIRROR + '/v' + targetOptions.runtimeVersion + '/', + winLibs: [ + { + dir: targetOptions.isX64 ? 'x64' : '', + name: targetOptions.runtime + '.lib', + }, + ], + tarPath: targetOptions.runtime + '-v' + targetOptions.runtimeVersion + '.tar.gz', + headerOnly: false, + } + } else { + return { + externalPath: NODE_MIRROR + '/v' + targetOptions.runtimeVersion + '/', + winLibs: [ + { + dir: targetOptions.isArm64 ? 'win-arm64' : targetOptions.isX64 ? 'win-x64' : 'win-x86', + name: targetOptions.runtime + '.lib', + }, + ], + tarPath: targetOptions.runtime + '-v' + targetOptions.runtimeVersion + '-headers.tar.gz', + headerOnly: true, + } + } + }, + nw: function (targetOptions) { + if (semver.gte(targetOptions.runtimeVersion, '0.13.0')) { + return { + externalPath: 'https://node-webkit.s3.amazonaws.com/v' + targetOptions.runtimeVersion + '/', + winLibs: [ + { + dir: targetOptions.isX64 ? 'x64' : '', + name: targetOptions.runtime + '.lib', + }, + { + dir: targetOptions.isX64 ? 'x64' : '', + name: 'node.lib', + }, + ], + tarPath: 'nw-headers-v' + targetOptions.runtimeVersion + '.tar.gz', + headerOnly: false, + } + } + return { + externalPath: 'https://node-webkit.s3.amazonaws.com/v' + targetOptions.runtimeVersion + '/', + winLibs: [ + { + dir: targetOptions.isX64 ? 'x64' : '', + name: targetOptions.runtime + '.lib', + }, + ], + tarPath: 'nw-headers-v' + targetOptions.runtimeVersion + '.tar.gz', + headerOnly: false, + } + }, + electron: function (targetOptions) { + return { + externalPath: ELECTRON_MIRROR + '/v' + targetOptions.runtimeVersion + '/', + winLibs: [ + { + dir: targetOptions.isArm64 ? 'arm64' : targetOptions.isX64 ? 'x64' : '', + name: 'node.lib', + }, + ], + tarPath: 'node' + '-v' + targetOptions.runtimeVersion + '.tar.gz', + headerOnly: semver.gte(targetOptions.runtimeVersion, '4.0.0-alpha'), + } + }, + get: function (targetOptions) { + assert(targetOptions && typeof targetOptions === 'object') + + const runtime = targetOptions.runtime + const func = runtimePaths[runtime] + let paths + if (typeof func === 'function') { + paths = func(targetOptions) + if (paths && typeof paths === 'object') { + return paths + } + } + throw new Error('Unknown runtime: ' + runtime) + }, +} + +module.exports = runtimePaths diff --git a/node_modules/cmake-js/lib/targetOptions.js b/node_modules/cmake-js/lib/targetOptions.js new file mode 100644 index 0000000..70c3d13 --- /dev/null +++ b/node_modules/cmake-js/lib/targetOptions.js @@ -0,0 +1,33 @@ +'use strict' + +const environment = require('./environment') + +class TargetOptions { + get arch() { + return this.options.arch || environment.arch + } + get isX86() { + return this.arch === 'ia32' || this.arch === 'x86' + } + get isX64() { + return this.arch === 'x64' + } + get isArm() { + return this.arch === 'arm' + } + get isArm64() { + return this.arch === 'arm64' + } + get runtime() { + return this.options.runtime || environment.runtime + } + get runtimeVersion() { + return this.options.runtimeVersion || environment.runtimeVersion + } + + constructor(options) { + this.options = options || {} + } +} + +module.exports = TargetOptions diff --git a/node_modules/cmake-js/lib/toolset.js b/node_modules/cmake-js/lib/toolset.js new file mode 100644 index 0000000..3d9c034 --- /dev/null +++ b/node_modules/cmake-js/lib/toolset.js @@ -0,0 +1,224 @@ +'use strict' +const TargetOptions = require('./targetOptions') +const environment = require('./environment') +const assert = require('assert') +const CMLog = require('./cmLog') +const { findVisualStudio } = environment.isWin ? require('./import/find-visualstudio') : {} + +class Toolset { + constructor(options) { + this.options = options || {} + this.targetOptions = new TargetOptions(this.options) + this.generator = options.generator + this.toolset = options.toolset + this.platform = options.platform + this.target = options.target + this.cCompilerPath = options.cCompilerPath + this.cppCompilerPath = options.cppCompilerPath + this.compilerFlags = [] + this.linkerFlags = [] + this.makePath = null + this.log = new CMLog(this.options) + this._initialized = false + } + async initialize(install) { + if (!this._initialized) { + if (environment.isWin) { + await this.initializeWin(install) + } else { + this.initializePosix(install) + } + this._initialized = true + } + } + initializePosix(install) { + if (!this.cCompilerPath || !this.cppCompilerPath) { + // 1: Compiler + if (!environment.isGPPAvailable && !environment.isClangAvailable) { + if (environment.isOSX) { + throw new Error( + "C++ Compiler toolset is not available. Install Xcode Commandline Tools from Apple Dev Center, or install Clang with homebrew by invoking: 'brew install llvm --with-clang --with-asan'.", + ) + } else { + throw new Error( + "C++ Compiler toolset is not available. Install proper compiler toolset with your package manager, eg. 'sudo apt-get install g++'.", + ) + } + } + + if (this.options.preferClang && environment.isClangAvailable) { + if (install) { + this.log.info('TOOL', 'Using clang++ compiler, because preferClang option is set, and clang++ is available.') + } + this.cppCompilerPath = this.cppCompilerPath || 'clang++' + this.cCompilerPath = this.cCompilerPath || 'clang' + } else if (this.options.preferGnu && environment.isGPPAvailable) { + if (install) { + this.log.info('TOOL', 'Using g++ compiler, because preferGnu option is set, and g++ is available.') + } + this.cppCompilerPath = this.cppCompilerPath || 'g++' + this.cCompilerPath = this.cCompilerPath || 'gcc' + } + } + // if it's already set because of options... + if (this.generator) { + if (install) { + this.log.info('TOOL', 'Using ' + this.generator + ' generator, as specified from commandline.') + } + } + + // 2: Generator + else if (environment.isOSX) { + if (this.options.preferXcode) { + if (install) { + this.log.info('TOOL', 'Using Xcode generator, because preferXcode option is set.') + } + this.generator = 'Xcode' + } else if (this.options.preferMake && environment.isMakeAvailable) { + if (install) { + this.log.info( + 'TOOL', + 'Using Unix Makefiles generator, because preferMake option is set, and make is available.', + ) + } + this.generator = 'Unix Makefiles' + } else if (environment.isNinjaAvailable) { + if (install) { + this.log.info('TOOL', 'Using Ninja generator, because ninja is available.') + } + this.generator = 'Ninja' + } else { + if (install) { + this.log.info('TOOL', 'Using Unix Makefiles generator.') + } + this.generator = 'Unix Makefiles' + } + } else { + if (this.options.preferMake && environment.isMakeAvailable) { + if (install) { + this.log.info( + 'TOOL', + 'Using Unix Makefiles generator, because preferMake option is set, and make is available.', + ) + } + this.generator = 'Unix Makefiles' + } else if (environment.isNinjaAvailable) { + if (install) { + this.log.info('TOOL', 'Using Ninja generator, because ninja is available.') + } + this.generator = 'Ninja' + } else { + if (install) { + this.log.info('TOOL', 'Using Unix Makefiles generator.') + } + this.generator = 'Unix Makefiles' + } + } + + // 3: Flags + if (environment.isOSX) { + if (install) { + this.log.verbose('TOOL', 'Setting default OSX compiler flags.') + } + + this.compilerFlags.push('-D_DARWIN_USE_64_BIT_INODE=1') + this.compilerFlags.push('-D_LARGEFILE_SOURCE') + this.compilerFlags.push('-D_FILE_OFFSET_BITS=64') + this.linkerFlags.push('-undefined dynamic_lookup') + } + + this.compilerFlags.push('-DBUILDING_NODE_EXTENSION') + + // 4: Build target + if (this.options.target) { + this.log.info('TOOL', 'Building only the ' + this.options.target + ' target, as specified from the command line.') + } + } + async initializeWin(install) { + if (!this.generator) { + const foundVsInfo = await this._getTopSupportedVisualStudioGenerator() + if (foundVsInfo) { + if (install) { + this.log.info('TOOL', `Using ${foundVsInfo.generator} generator.`) + } + this.generator = foundVsInfo.generator + + const isAboveVS16 = foundVsInfo.versionMajor >= 16 + + // The CMake Visual Studio Generator does not support the Win64 or ARM suffix on + // the generator name. Instead the generator platform must be set explicitly via + // the platform parameter + if (!this.platform && isAboveVS16) { + switch (this.targetOptions.arch) { + case 'ia32': + case 'x86': + this.platform = 'Win32' + break + case 'x64': + this.platform = 'x64' + break + case 'arm': + this.platform = 'ARM' + break + case 'arm64': + this.platform = 'ARM64' + break + default: + this.log.warn('TOOL', 'Unknown NodeJS architecture: ' + this.targetOptions.arch) + break + } + } + } else { + throw new Error('There is no Visual C++ compiler installed. Install Visual C++ Build Toolset or Visual Studio.') + } + } else { + // if it's already set because of options... + if (install) { + this.log.info('TOOL', 'Using ' + this.options.generator + ' generator, as specified from commandline.') + } + } + + this.linkerFlags.push('/DELAYLOAD:NODE.EXE') + + if (this.targetOptions.isX86) { + if (install) { + this.log.verbose('TOOL', 'Setting SAFESEH:NO linker flag.') + } + this.linkerFlags.push('/SAFESEH:NO') + } + } + async _getTopSupportedVisualStudioGenerator() { + const CMake = require('./cMake') + assert(environment.isWin) + + const selectedVs = await findVisualStudio(environment.runtimeVersion, this.options.msvsVersion) + if (!selectedVs) return null + + const list = await CMake.getGenerators(this.options, this.log) + for (const gen of list) { + const found = gen.startsWith(`Visual Studio ${selectedVs.versionMajor}`) + if (!found) { + continue + } + + // unlike previous versions "Visual Studio 16 2019" and onwards don't end with arch name + const isAboveVS16 = selectedVs.versionMajor >= 16 + if (!isAboveVS16) { + const is64Bit = gen.endsWith('Win64') + if ((this.targetOptions.isX86 && is64Bit) || (this.targetOptions.isX64 && !is64Bit)) { + continue + } + } + + return { + ...selectedVs, + generator: gen, + } + } + + // Nothing matched + return null + } +} + +module.exports = Toolset diff --git a/node_modules/cmake-js/node_modules/.bin/node-which b/node_modules/cmake-js/node_modules/.bin/node-which new file mode 120000 index 0000000..c4a428a --- /dev/null +++ b/node_modules/cmake-js/node_modules/.bin/node-which @@ -0,0 +1 @@ +../which/bin/which.js \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/chownr/LICENSE.md b/node_modules/cmake-js/node_modules/chownr/LICENSE.md new file mode 100644 index 0000000..881248b --- /dev/null +++ b/node_modules/cmake-js/node_modules/chownr/LICENSE.md @@ -0,0 +1,63 @@ +All packages under `src/` are licensed according to the terms in +their respective `LICENSE` or `LICENSE.md` files. + +The remainder of this project is licensed under the Blue Oak +Model License, as follows: + +----- + +# Blue Oak Model License + +Version 1.0.0 + +## Purpose + +This license gives everyone as much permission to work with +this software as possible, while protecting contributors +from liability. + +## Acceptance + +In order to receive this license, you must agree to its +rules. The rules of this license are both obligations +under that agreement and conditions to your license. +You must not do anything with this software that triggers +a rule that you cannot or will not follow. + +## Copyright + +Each contributor licenses you to do everything with this +software that would otherwise infringe that contributor's +copyright in it. + +## Notices + +You must ensure that everyone who gets a copy of +any part of this software from you, with or without +changes, also gets the text of this license or a link to +. + +## Excuse + +If anyone notifies you in writing that you have not +complied with [Notices](#notices), you can keep your +license by taking all practical steps to comply within 30 +days after the notice. If you do not do so, your license +ends immediately. + +## Patent + +Each contributor licenses you to do everything with this +software that would otherwise infringe any patent claims +they can license or become able to license. + +## Reliability + +No contributor can revoke this license. + +## No Liability + +***As far as the law allows, this software comes as is, +without any warranty or condition, and no contributor +will be liable to anyone for any damages related to this +software or this license, under any kind of legal claim.*** diff --git a/node_modules/cmake-js/node_modules/chownr/README.md b/node_modules/cmake-js/node_modules/chownr/README.md new file mode 100644 index 0000000..70e9a54 --- /dev/null +++ b/node_modules/cmake-js/node_modules/chownr/README.md @@ -0,0 +1,3 @@ +Like `chown -R`. + +Takes the same arguments as `fs.chown()` diff --git a/node_modules/cmake-js/node_modules/chownr/dist/commonjs/index.d.ts b/node_modules/cmake-js/node_modules/chownr/dist/commonjs/index.d.ts new file mode 100644 index 0000000..5ab081f --- /dev/null +++ b/node_modules/cmake-js/node_modules/chownr/dist/commonjs/index.d.ts @@ -0,0 +1,3 @@ +export declare const chownr: (p: string, uid: number, gid: number, cb: (er?: unknown) => any) => void; +export declare const chownrSync: (p: string, uid: number, gid: number) => void; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/chownr/dist/commonjs/index.d.ts.map b/node_modules/cmake-js/node_modules/chownr/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000..bda37a0 --- /dev/null +++ b/node_modules/cmake-js/node_modules/chownr/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,MAAM,MACd,MAAM,OACJ,MAAM,OACN,MAAM,YACD,OAAO,KAAK,GAAG,SA0B1B,CAAA;AAcD,eAAO,MAAM,UAAU,MAAO,MAAM,OAAO,MAAM,OAAO,MAAM,SAiB7D,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/chownr/dist/commonjs/index.js b/node_modules/cmake-js/node_modules/chownr/dist/commonjs/index.js new file mode 100644 index 0000000..6a7b68d --- /dev/null +++ b/node_modules/cmake-js/node_modules/chownr/dist/commonjs/index.js @@ -0,0 +1,93 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.chownrSync = exports.chownr = void 0; +const node_fs_1 = __importDefault(require("node:fs")); +const node_path_1 = __importDefault(require("node:path")); +const lchownSync = (path, uid, gid) => { + try { + return node_fs_1.default.lchownSync(path, uid, gid); + } + catch (er) { + if (er?.code !== 'ENOENT') + throw er; + } +}; +const chown = (cpath, uid, gid, cb) => { + node_fs_1.default.lchown(cpath, uid, gid, er => { + // Skip ENOENT error + cb(er && er?.code !== 'ENOENT' ? er : null); + }); +}; +const chownrKid = (p, child, uid, gid, cb) => { + if (child.isDirectory()) { + (0, exports.chownr)(node_path_1.default.resolve(p, child.name), uid, gid, (er) => { + if (er) + return cb(er); + const cpath = node_path_1.default.resolve(p, child.name); + chown(cpath, uid, gid, cb); + }); + } + else { + const cpath = node_path_1.default.resolve(p, child.name); + chown(cpath, uid, gid, cb); + } +}; +const chownr = (p, uid, gid, cb) => { + node_fs_1.default.readdir(p, { withFileTypes: true }, (er, children) => { + // any error other than ENOTDIR or ENOTSUP means it's not readable, + // or doesn't exist. give up. + if (er) { + if (er.code === 'ENOENT') + return cb(); + else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP') + return cb(er); + } + if (er || !children.length) + return chown(p, uid, gid, cb); + let len = children.length; + let errState = null; + const then = (er) => { + /* c8 ignore start */ + if (errState) + return; + /* c8 ignore stop */ + if (er) + return cb((errState = er)); + if (--len === 0) + return chown(p, uid, gid, cb); + }; + for (const child of children) { + chownrKid(p, child, uid, gid, then); + } + }); +}; +exports.chownr = chownr; +const chownrKidSync = (p, child, uid, gid) => { + if (child.isDirectory()) + (0, exports.chownrSync)(node_path_1.default.resolve(p, child.name), uid, gid); + lchownSync(node_path_1.default.resolve(p, child.name), uid, gid); +}; +const chownrSync = (p, uid, gid) => { + let children; + try { + children = node_fs_1.default.readdirSync(p, { withFileTypes: true }); + } + catch (er) { + const e = er; + if (e?.code === 'ENOENT') + return; + else if (e?.code === 'ENOTDIR' || e?.code === 'ENOTSUP') + return lchownSync(p, uid, gid); + else + throw e; + } + for (const child of children) { + chownrKidSync(p, child, uid, gid); + } + return lchownSync(p, uid, gid); +}; +exports.chownrSync = chownrSync; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/chownr/dist/commonjs/index.js.map b/node_modules/cmake-js/node_modules/chownr/dist/commonjs/index.js.map new file mode 100644 index 0000000..954921f --- /dev/null +++ b/node_modules/cmake-js/node_modules/chownr/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyC;AACzC,0DAA4B;AAE5B,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE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AC,CAAA;AAjBY,QAAA,UAAU,cAiBtB","sourcesContent":["import fs, { type Dirent } from 'node:fs'\nimport path from 'node:path'\n\nconst lchownSync = (path: string, uid: number, gid: number) => {\n try {\n return fs.lchownSync(path, uid, gid)\n } catch (er) {\n if ((er as NodeJS.ErrnoException)?.code !== 'ENOENT') throw er\n }\n}\n\nconst chown = (\n cpath: string,\n uid: number,\n gid: number,\n cb: (er?: unknown) => any,\n) => {\n fs.lchown(cpath, uid, gid, er => {\n // Skip ENOENT error\n cb(er && (er as NodeJS.ErrnoException)?.code !== 'ENOENT' ? er : null)\n })\n}\n\nconst chownrKid = (\n p: string,\n child: Dirent,\n uid: number,\n gid: number,\n cb: (er?: unknown) => any,\n) => {\n if (child.isDirectory()) {\n chownr(path.resolve(p, child.name), uid, gid, (er: unknown) => {\n if (er) return cb(er)\n const cpath = path.resolve(p, child.name)\n chown(cpath, uid, gid, cb)\n })\n } else {\n const cpath = path.resolve(p, child.name)\n chown(cpath, uid, gid, cb)\n }\n}\n\nexport const chownr = (\n p: string,\n uid: number,\n gid: number,\n cb: (er?: unknown) => any,\n) => {\n fs.readdir(p, { withFileTypes: true }, (er, children) => {\n // any error other than ENOTDIR or ENOTSUP means it's not readable,\n // or doesn't exist. give up.\n if (er) {\n if (er.code === 'ENOENT') return cb()\n else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP')\n return cb(er)\n }\n if (er || !children.length) return chown(p, uid, gid, cb)\n\n let len = children.length\n let errState: null | NodeJS.ErrnoException = null\n const then = (er?: unknown) => {\n /* c8 ignore start */\n if (errState) return\n /* c8 ignore stop */\n if (er) return cb((errState = er as NodeJS.ErrnoException))\n if (--len === 0) return chown(p, uid, gid, cb)\n }\n\n for (const child of children) {\n chownrKid(p, child, uid, gid, then)\n }\n })\n}\n\nconst chownrKidSync = (\n p: string,\n child: Dirent,\n uid: number,\n gid: number,\n) => {\n if (child.isDirectory())\n chownrSync(path.resolve(p, child.name), uid, gid)\n\n lchownSync(path.resolve(p, child.name), uid, gid)\n}\n\nexport const chownrSync = (p: string, uid: number, gid: number) => {\n let children: Dirent[]\n try {\n children = fs.readdirSync(p, { withFileTypes: true })\n } catch (er) {\n const e = er as NodeJS.ErrnoException\n if (e?.code === 'ENOENT') return\n else if (e?.code === 'ENOTDIR' || e?.code === 'ENOTSUP')\n return lchownSync(p, uid, gid)\n else throw e\n }\n\n for (const child of children) {\n chownrKidSync(p, child, uid, gid)\n }\n\n return lchownSync(p, uid, gid)\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/chownr/dist/commonjs/package.json b/node_modules/cmake-js/node_modules/chownr/dist/commonjs/package.json new file mode 100644 index 0000000..5bbefff --- /dev/null +++ b/node_modules/cmake-js/node_modules/chownr/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/cmake-js/node_modules/chownr/dist/esm/index.d.ts b/node_modules/cmake-js/node_modules/chownr/dist/esm/index.d.ts new file mode 100644 index 0000000..5ab081f --- /dev/null +++ b/node_modules/cmake-js/node_modules/chownr/dist/esm/index.d.ts @@ -0,0 +1,3 @@ +export declare const chownr: (p: string, uid: number, gid: number, cb: (er?: unknown) => any) => void; +export declare const chownrSync: (p: string, uid: number, gid: number) => void; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/chownr/dist/esm/index.d.ts.map b/node_modules/cmake-js/node_modules/chownr/dist/esm/index.d.ts.map new file mode 100644 index 0000000..bda37a0 --- /dev/null +++ b/node_modules/cmake-js/node_modules/chownr/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,MAAM,MACd,MAAM,OACJ,MAAM,OACN,MAAM,YACD,OAAO,KAAK,GAAG,SA0B1B,CAAA;AAcD,eAAO,MAAM,UAAU,MAAO,MAAM,OAAO,MAAM,OAAO,MAAM,SAiB7D,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/chownr/dist/esm/index.js b/node_modules/cmake-js/node_modules/chownr/dist/esm/index.js new file mode 100644 index 0000000..5c28152 --- /dev/null +++ b/node_modules/cmake-js/node_modules/chownr/dist/esm/index.js @@ -0,0 +1,85 @@ +import fs from 'node:fs'; +import path from 'node:path'; +const lchownSync = (path, uid, gid) => { + try { + return fs.lchownSync(path, uid, gid); + } + catch (er) { + if (er?.code !== 'ENOENT') + throw er; + } +}; +const chown = (cpath, uid, gid, cb) => { + fs.lchown(cpath, uid, gid, er => { + // Skip ENOENT error + cb(er && er?.code !== 'ENOENT' ? er : null); + }); +}; +const chownrKid = (p, child, uid, gid, cb) => { + if (child.isDirectory()) { + chownr(path.resolve(p, child.name), uid, gid, (er) => { + if (er) + return cb(er); + const cpath = path.resolve(p, child.name); + chown(cpath, uid, gid, cb); + }); + } + else { + const cpath = path.resolve(p, child.name); + chown(cpath, uid, gid, cb); + } +}; +export const chownr = (p, uid, gid, cb) => { + fs.readdir(p, { withFileTypes: true }, (er, children) => { + // any error other than ENOTDIR or ENOTSUP means it's not readable, + // or doesn't exist. give up. + if (er) { + if (er.code === 'ENOENT') + return cb(); + else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP') + return cb(er); + } + if (er || !children.length) + return chown(p, uid, gid, cb); + let len = children.length; + let errState = null; + const then = (er) => { + /* c8 ignore start */ + if (errState) + return; + /* c8 ignore stop */ + if (er) + return cb((errState = er)); + if (--len === 0) + return chown(p, uid, gid, cb); + }; + for (const child of children) { + chownrKid(p, child, uid, gid, then); + } + }); +}; +const chownrKidSync = (p, child, uid, gid) => { + if (child.isDirectory()) + chownrSync(path.resolve(p, child.name), uid, gid); + lchownSync(path.resolve(p, child.name), uid, gid); +}; +export const chownrSync = (p, uid, gid) => { + let children; + try { + children = fs.readdirSync(p, { withFileTypes: true }); + } + catch (er) { + const e = er; + if (e?.code === 'ENOENT') + return; + else if (e?.code === 'ENOTDIR' || e?.code === 'ENOTSUP') + return lchownSync(p, uid, gid); + else + throw e; + } + for (const child of children) { + chownrKidSync(p, child, uid, gid); + } + return lchownSync(p, uid, gid); +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/chownr/dist/esm/index.js.map b/node_modules/cmake-js/node_modules/chownr/dist/esm/index.js.map new file mode 100644 index 0000000..0e35028 --- /dev/null +++ b/node_modules/cmake-js/node_modules/chownr/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,MAAM,SAAS,CAAA;AACzC,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,GAAW,EAAE,GAAW,EAAE,EAAE;IAC5D,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;IACtC,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;QACZ,IAAK,EAA4B,EAAE,IAAI,KAAK,QAAQ;YAAE,MAAM,EAAE,CAAA;IAChE,CAAC;AACH,CAAC,CAAA;AAED,MAAM,KAAK,GAAG,CACZ,KAAa,EACb,GAAW,EACX,GAAW,EACX,EAAyB,EACzB,EAAE;IACF,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE;QAC9B,oBAAoB;QACpB,EAAE,CAAC,EAAE,IAAK,EAA4B,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACxE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,CAChB,CAAS,EACT,KAAa,EACb,GAAW,EACX,GAAW,EACX,EAAyB,EACzB,EAAE;IACF,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC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B,CAAA;QACrC,IAAI,CAAC,EAAE,IAAI,KAAK,QAAQ;YAAE,OAAM;aAC3B,IAAI,CAAC,EAAE,IAAI,KAAK,SAAS,IAAI,CAAC,EAAE,IAAI,KAAK,SAAS;YACrD,OAAO,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;;YAC3B,MAAM,CAAC,CAAA;IACd,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;QAC7B,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;IACnC,CAAC;IAED,OAAO,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAChC,CAAC,CAAA","sourcesContent":["import fs, { type Dirent } from 'node:fs'\nimport path from 'node:path'\n\nconst lchownSync = (path: string, uid: number, gid: number) => {\n try {\n return fs.lchownSync(path, uid, gid)\n } catch (er) {\n if ((er as NodeJS.ErrnoException)?.code !== 'ENOENT') throw er\n }\n}\n\nconst chown = (\n cpath: string,\n uid: number,\n gid: number,\n cb: (er?: unknown) => any,\n) => {\n fs.lchown(cpath, uid, gid, er => {\n // Skip ENOENT error\n cb(er && (er as NodeJS.ErrnoException)?.code !== 'ENOENT' ? er : null)\n })\n}\n\nconst chownrKid = (\n p: string,\n child: Dirent,\n uid: number,\n gid: number,\n cb: (er?: unknown) => any,\n) => {\n if (child.isDirectory()) {\n chownr(path.resolve(p, child.name), uid, gid, (er: unknown) => {\n if (er) return cb(er)\n const cpath = path.resolve(p, child.name)\n chown(cpath, uid, gid, cb)\n })\n } else {\n const cpath = path.resolve(p, child.name)\n chown(cpath, uid, gid, cb)\n }\n}\n\nexport const chownr = (\n p: string,\n uid: number,\n gid: number,\n cb: (er?: unknown) => any,\n) => {\n fs.readdir(p, { withFileTypes: true }, (er, children) => {\n // any error other than ENOTDIR or ENOTSUP means it's not readable,\n // or doesn't exist. give up.\n if (er) {\n if (er.code === 'ENOENT') return cb()\n else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP')\n return cb(er)\n }\n if (er || !children.length) return chown(p, uid, gid, cb)\n\n let len = children.length\n let errState: null | NodeJS.ErrnoException = null\n const then = (er?: unknown) => {\n /* c8 ignore start */\n if (errState) return\n /* c8 ignore stop */\n if (er) return cb((errState = er as NodeJS.ErrnoException))\n if (--len === 0) return chown(p, uid, gid, cb)\n }\n\n for (const child of children) {\n chownrKid(p, child, uid, gid, then)\n }\n })\n}\n\nconst chownrKidSync = (\n p: string,\n child: Dirent,\n uid: number,\n gid: number,\n) => {\n if (child.isDirectory())\n chownrSync(path.resolve(p, child.name), uid, gid)\n\n lchownSync(path.resolve(p, child.name), uid, gid)\n}\n\nexport const chownrSync = (p: string, uid: number, gid: number) => {\n let children: Dirent[]\n try {\n children = fs.readdirSync(p, { withFileTypes: true })\n } catch (er) {\n const e = er as NodeJS.ErrnoException\n if (e?.code === 'ENOENT') return\n else if (e?.code === 'ENOTDIR' || e?.code === 'ENOTSUP')\n return lchownSync(p, uid, gid)\n else throw e\n }\n\n for (const child of children) {\n chownrKidSync(p, child, uid, gid)\n }\n\n return lchownSync(p, uid, gid)\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/chownr/dist/esm/package.json b/node_modules/cmake-js/node_modules/chownr/dist/esm/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/node_modules/cmake-js/node_modules/chownr/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/cmake-js/node_modules/chownr/package.json b/node_modules/cmake-js/node_modules/chownr/package.json new file mode 100644 index 0000000..09aa6b2 --- /dev/null +++ b/node_modules/cmake-js/node_modules/chownr/package.json @@ -0,0 +1,69 @@ +{ + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "name": "chownr", + "description": "like `chown -R`", + "version": "3.0.0", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/chownr.git" + }, + "files": [ + "dist" + ], + "devDependencies": { + "@types/node": "^20.12.5", + "mkdirp": "^3.0.1", + "prettier": "^3.2.5", + "rimraf": "^5.0.5", + "tap": "^18.7.2", + "tshy": "^1.13.1", + "typedoc": "^0.25.12" + }, + "scripts": { + "prepare": "tshy", + "pretest": "npm run prepare", + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "format": "prettier --write . --loglevel warn", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" + }, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + }, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "type": "module", + "prettier": { + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + } +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/LICENSE b/node_modules/cmake-js/node_modules/fs-extra/LICENSE new file mode 100644 index 0000000..050c1aa --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/LICENSE @@ -0,0 +1,15 @@ +(The MIT License) + +Copyright (c) 2011-2024 JP Richardson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files +(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/cmake-js/node_modules/fs-extra/README.md b/node_modules/cmake-js/node_modules/fs-extra/README.md new file mode 100644 index 0000000..9a104e6 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/README.md @@ -0,0 +1,294 @@ +Node.js: fs-extra +================= + +`fs-extra` adds file system methods that aren't included in the native `fs` module and adds promise support to the `fs` methods. It also uses [`graceful-fs`](https://github.com/isaacs/node-graceful-fs) to prevent `EMFILE` errors. It should be a drop in replacement for `fs`. + +[![npm Package](https://img.shields.io/npm/v/fs-extra.svg)](https://www.npmjs.org/package/fs-extra) +[![License](https://img.shields.io/npm/l/fs-extra.svg)](https://github.com/jprichardson/node-fs-extra/blob/master/LICENSE) +[![build status](https://img.shields.io/github/actions/workflow/status/jprichardson/node-fs-extra/ci.yml?branch=master)](https://github.com/jprichardson/node-fs-extra/actions/workflows/ci.yml?query=branch%3Amaster) +[![downloads per month](http://img.shields.io/npm/dm/fs-extra.svg)](https://www.npmjs.org/package/fs-extra) +[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) + +Why? +---- + +I got tired of including `mkdirp`, `rimraf`, and `ncp` in most of my projects. + + + + +Installation +------------ + + npm install fs-extra + + + +Usage +----- + +### CommonJS + +`fs-extra` is a drop in replacement for native `fs`. All methods in `fs` are attached to `fs-extra`. All `fs` methods return promises if the callback isn't passed. + +You don't ever need to include the original `fs` module again: + +```js +const fs = require('fs') // this is no longer necessary +``` + +you can now do this: + +```js +const fs = require('fs-extra') +``` + +or if you prefer to make it clear that you're using `fs-extra` and not `fs`, you may want +to name your `fs` variable `fse` like so: + +```js +const fse = require('fs-extra') +``` + +you can also keep both, but it's redundant: + +```js +const fs = require('fs') +const fse = require('fs-extra') +``` + +**NOTE:** The deprecated constants `fs.F_OK`, `fs.R_OK`, `fs.W_OK`, & `fs.X_OK` are not exported on Node.js v24.0.0+; please use their `fs.constants` equivalents. + +### ESM + +There is also an `fs-extra/esm` import, that supports both default and named exports. However, note that `fs` methods are not included in `fs-extra/esm`; you still need to import `fs` and/or `fs/promises` seperately: + +```js +import { readFileSync } from 'fs' +import { readFile } from 'fs/promises' +import { outputFile, outputFileSync } from 'fs-extra/esm' +``` + +Default exports are supported: + +```js +import fs from 'fs' +import fse from 'fs-extra/esm' +// fse.readFileSync is not a function; must use fs.readFileSync +``` + +but you probably want to just use regular `fs-extra` instead of `fs-extra/esm` for default exports: + +```js +import fs from 'fs-extra' +// both fs and fs-extra methods are defined +``` + +Sync vs Async vs Async/Await +------------- +Most methods are async by default. All async methods will return a promise if the callback isn't passed. + +Sync methods on the other hand will throw if an error occurs. + +Also Async/Await will throw an error if one occurs. + +Example: + +```js +const fs = require('fs-extra') + +// Async with promises: +fs.copy('/tmp/myfile', '/tmp/mynewfile') + .then(() => console.log('success!')) + .catch(err => console.error(err)) + +// Async with callbacks: +fs.copy('/tmp/myfile', '/tmp/mynewfile', err => { + if (err) return console.error(err) + console.log('success!') +}) + +// Sync: +try { + fs.copySync('/tmp/myfile', '/tmp/mynewfile') + console.log('success!') +} catch (err) { + console.error(err) +} + +// Async/Await: +async function copyFiles () { + try { + await fs.copy('/tmp/myfile', '/tmp/mynewfile') + console.log('success!') + } catch (err) { + console.error(err) + } +} + +copyFiles() +``` + + +Methods +------- + +### Async + +- [copy](docs/copy.md) +- [emptyDir](docs/emptyDir.md) +- [ensureFile](docs/ensureFile.md) +- [ensureDir](docs/ensureDir.md) +- [ensureLink](docs/ensureLink.md) +- [ensureSymlink](docs/ensureSymlink.md) +- [mkdirp](docs/ensureDir.md) +- [mkdirs](docs/ensureDir.md) +- [move](docs/move.md) +- [outputFile](docs/outputFile.md) +- [outputJson](docs/outputJson.md) +- [pathExists](docs/pathExists.md) +- [readJson](docs/readJson.md) +- [remove](docs/remove.md) +- [writeJson](docs/writeJson.md) + +### Sync + +- [copySync](docs/copy-sync.md) +- [emptyDirSync](docs/emptyDir-sync.md) +- [ensureFileSync](docs/ensureFile-sync.md) +- [ensureDirSync](docs/ensureDir-sync.md) +- [ensureLinkSync](docs/ensureLink-sync.md) +- [ensureSymlinkSync](docs/ensureSymlink-sync.md) +- [mkdirpSync](docs/ensureDir-sync.md) +- [mkdirsSync](docs/ensureDir-sync.md) +- [moveSync](docs/move-sync.md) +- [outputFileSync](docs/outputFile-sync.md) +- [outputJsonSync](docs/outputJson-sync.md) +- [pathExistsSync](docs/pathExists-sync.md) +- [readJsonSync](docs/readJson-sync.md) +- [removeSync](docs/remove-sync.md) +- [writeJsonSync](docs/writeJson-sync.md) + + +**NOTE:** You can still use the native Node.js methods. They are promisified and copied over to `fs-extra`. See [notes on `fs.read()`, `fs.write()`, & `fs.writev()`](docs/fs-read-write-writev.md) + +### What happened to `walk()` and `walkSync()`? + +They were removed from `fs-extra` in v2.0.0. If you need the functionality, `walk` and `walkSync` are available as separate packages, [`klaw`](https://github.com/jprichardson/node-klaw) and [`klaw-sync`](https://github.com/manidlou/node-klaw-sync). + + +Third Party +----------- + +### CLI + +[fse-cli](https://www.npmjs.com/package/@atao60/fse-cli) allows you to run `fs-extra` from a console or from [npm](https://www.npmjs.com) scripts. + +### TypeScript + +If you like TypeScript, you can use `fs-extra` with it: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fs-extra + + +### File / Directory Watching + +If you want to watch for changes to files or directories, then you should use [chokidar](https://github.com/paulmillr/chokidar). + +### Obtain Filesystem (Devices, Partitions) Information + +[fs-filesystem](https://github.com/arthurintelligence/node-fs-filesystem) allows you to read the state of the filesystem of the host on which it is run. It returns information about both the devices and the partitions (volumes) of the system. + +### Misc. + +- [fs-extra-debug](https://github.com/jdxcode/fs-extra-debug) - Send your fs-extra calls to [debug](https://npmjs.org/package/debug). +- [mfs](https://github.com/cadorn/mfs) - Monitor your fs-extra calls. + + + +Hacking on fs-extra +------------------- + +Wanna hack on `fs-extra`? Great! Your help is needed! [fs-extra is one of the most depended upon Node.js packages](http://nodei.co/npm/fs-extra.png?downloads=true&downloadRank=true&stars=true). This project +uses [JavaScript Standard Style](https://github.com/feross/standard) - if the name or style choices bother you, +you're gonna have to get over it :) If `standard` is good enough for `npm`, it's good enough for `fs-extra`. + +[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) + +What's needed? +- First, take a look at existing issues. Those are probably going to be where the priority lies. +- More tests for edge cases. Specifically on different platforms. There can never be enough tests. +- Improve test coverage. + +Note: If you make any big changes, **you should definitely file an issue for discussion first.** + +### Running the Test Suite + +fs-extra contains hundreds of tests. + +- `npm run lint`: runs the linter ([standard](http://standardjs.com/)) +- `npm run unit`: runs the unit tests +- `npm run unit-esm`: runs tests for `fs-extra/esm` exports +- `npm test`: runs the linter and all tests + +When running unit tests, set the environment variable `CROSS_DEVICE_PATH` to the absolute path of an empty directory on another device (like a thumb drive) to enable cross-device move tests. + + +### Windows + +If you run the tests on the Windows and receive a lot of symbolic link `EPERM` permission errors, it's +because on Windows you need elevated privilege to create symbolic links. You can add this to your Windows's +account by following the instructions here: http://superuser.com/questions/104845/permission-to-make-symbolic-links-in-windows-7 +However, I didn't have much luck doing this. + +Since I develop on Mac OS X, I use VMWare Fusion for Windows testing. I create a shared folder that I map to a drive on Windows. +I open the `Node.js command prompt` and run as `Administrator`. I then map the network drive running the following command: + + net use z: "\\vmware-host\Shared Folders" + +I can then navigate to my `fs-extra` directory and run the tests. + + +Naming +------ + +I put a lot of thought into the naming of these functions. Inspired by @coolaj86's request. So he deserves much of the credit for raising the issue. See discussion(s) here: + +* https://github.com/jprichardson/node-fs-extra/issues/2 +* https://github.com/flatiron/utile/issues/11 +* https://github.com/ryanmcgrath/wrench-js/issues/29 +* https://github.com/substack/node-mkdirp/issues/17 + +First, I believe that in as many cases as possible, the [Node.js naming schemes](http://nodejs.org/api/fs.html) should be chosen. However, there are problems with the Node.js own naming schemes. + +For example, `fs.readFile()` and `fs.readdir()`: the **F** is capitalized in *File* and the **d** is not capitalized in *dir*. Perhaps a bit pedantic, but they should still be consistent. Also, Node.js has chosen a lot of POSIX naming schemes, which I believe is great. See: `fs.mkdir()`, `fs.rmdir()`, `fs.chown()`, etc. + +We have a dilemma though. How do you consistently name methods that perform the following POSIX commands: `cp`, `cp -r`, `mkdir -p`, and `rm -rf`? + +My perspective: when in doubt, err on the side of simplicity. A directory is just a hierarchical grouping of directories and files. Consider that for a moment. So when you want to copy it or remove it, in most cases you'll want to copy or remove all of its contents. When you want to create a directory, if the directory that it's suppose to be contained in does not exist, then in most cases you'll want to create that too. + +So, if you want to remove a file or a directory regardless of whether it has contents, just call `fs.remove(path)`. If you want to copy a file or a directory whether it has contents, just call `fs.copy(source, destination)`. If you want to create a directory regardless of whether its parent directories exist, just call `fs.mkdirs(path)` or `fs.mkdirp(path)`. + + +Credit +------ + +`fs-extra` wouldn't be possible without using the modules from the following authors: + +- [Isaac Shlueter](https://github.com/isaacs) +- [Charlie McConnel](https://github.com/avianflu) +- [James Halliday](https://github.com/substack) +- [Andrew Kelley](https://github.com/andrewrk) + + + + +License +------- + +Licensed under MIT + +Copyright (c) 2011-2024 [JP Richardson](https://github.com/jprichardson) + +[1]: http://nodejs.org/docs/latest/api/fs.html + + +[jsonfile]: https://github.com/jprichardson/node-jsonfile diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/copy/copy-sync.js b/node_modules/cmake-js/node_modules/fs-extra/lib/copy/copy-sync.js new file mode 100644 index 0000000..8bb1ec5 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/copy/copy-sync.js @@ -0,0 +1,176 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const mkdirsSync = require('../mkdirs').mkdirsSync +const utimesMillisSync = require('../util/utimes').utimesMillisSync +const stat = require('../util/stat') + +function copySync (src, dest, opts) { + if (typeof opts === 'function') { + opts = { filter: opts } + } + + opts = opts || {} + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + process.emitWarning( + 'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' + + '\tsee https://github.com/jprichardson/node-fs-extra/issues/269', + 'Warning', 'fs-extra-WARN0002' + ) + } + + const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy', opts) + stat.checkParentPathsSync(src, srcStat, dest, 'copy') + if (opts.filter && !opts.filter(src, dest)) return + const destParent = path.dirname(dest) + if (!fs.existsSync(destParent)) mkdirsSync(destParent) + return getStats(destStat, src, dest, opts) +} + +function getStats (destStat, src, dest, opts) { + const statSync = opts.dereference ? fs.statSync : fs.lstatSync + const srcStat = statSync(src) + + if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts) + else if (srcStat.isFile() || + srcStat.isCharacterDevice() || + srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts) + else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts) + else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`) + else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`) + throw new Error(`Unknown file: ${src}`) +} + +function onFile (srcStat, destStat, src, dest, opts) { + if (!destStat) return copyFile(srcStat, src, dest, opts) + return mayCopyFile(srcStat, src, dest, opts) +} + +function mayCopyFile (srcStat, src, dest, opts) { + if (opts.overwrite) { + fs.unlinkSync(dest) + return copyFile(srcStat, src, dest, opts) + } else if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`) + } +} + +function copyFile (srcStat, src, dest, opts) { + fs.copyFileSync(src, dest) + if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest) + return setDestMode(dest, srcStat.mode) +} + +function handleTimestamps (srcMode, src, dest) { + // Make sure the file is writable before setting the timestamp + // otherwise open fails with EPERM when invoked with 'r+' + // (through utimes call) + if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode) + return setDestTimestamps(src, dest) +} + +function fileIsNotWritable (srcMode) { + return (srcMode & 0o200) === 0 +} + +function makeFileWritable (dest, srcMode) { + return setDestMode(dest, srcMode | 0o200) +} + +function setDestMode (dest, srcMode) { + return fs.chmodSync(dest, srcMode) +} + +function setDestTimestamps (src, dest) { + // The initial srcStat.atime cannot be trusted + // because it is modified by the read(2) system call + // (See https://nodejs.org/api/fs.html#fs_stat_time_values) + const updatedSrcStat = fs.statSync(src) + return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime) +} + +function onDir (srcStat, destStat, src, dest, opts) { + if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts) + return copyDir(src, dest, opts) +} + +function mkDirAndCopy (srcMode, src, dest, opts) { + fs.mkdirSync(dest) + copyDir(src, dest, opts) + return setDestMode(dest, srcMode) +} + +function copyDir (src, dest, opts) { + const dir = fs.opendirSync(src) + + try { + let dirent + + while ((dirent = dir.readSync()) !== null) { + copyDirItem(dirent.name, src, dest, opts) + } + } finally { + dir.closeSync() + } +} + +function copyDirItem (item, src, dest, opts) { + const srcItem = path.join(src, item) + const destItem = path.join(dest, item) + if (opts.filter && !opts.filter(srcItem, destItem)) return + const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy', opts) + return getStats(destStat, srcItem, destItem, opts) +} + +function onLink (destStat, src, dest, opts) { + let resolvedSrc = fs.readlinkSync(src) + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc) + } + + if (!destStat) { + return fs.symlinkSync(resolvedSrc, dest) + } else { + let resolvedDest + try { + resolvedDest = fs.readlinkSync(dest) + } catch (err) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest) + throw err + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest) + } + // If both symlinks resolve to the same target, they are still distinct symlinks + // that can be copied/overwritten. Only check subdirectory constraints when + // the resolved paths are different. + if (resolvedSrc !== resolvedDest) { + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`) + } + + // prevent copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`) + } + } + return copyLink(resolvedSrc, dest) + } +} + +function copyLink (resolvedSrc, dest) { + fs.unlinkSync(dest) + return fs.symlinkSync(resolvedSrc, dest) +} + +module.exports = copySync diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/copy/copy.js b/node_modules/cmake-js/node_modules/fs-extra/lib/copy/copy.js new file mode 100644 index 0000000..ab01a5f --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/copy/copy.js @@ -0,0 +1,180 @@ +'use strict' + +const fs = require('../fs') +const path = require('path') +const { mkdirs } = require('../mkdirs') +const { pathExists } = require('../path-exists') +const { utimesMillis } = require('../util/utimes') +const stat = require('../util/stat') +const { asyncIteratorConcurrentProcess } = require('../util/async') + +async function copy (src, dest, opts = {}) { + if (typeof opts === 'function') { + opts = { filter: opts } + } + + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + process.emitWarning( + 'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' + + '\tsee https://github.com/jprichardson/node-fs-extra/issues/269', + 'Warning', 'fs-extra-WARN0001' + ) + } + + const { srcStat, destStat } = await stat.checkPaths(src, dest, 'copy', opts) + + await stat.checkParentPaths(src, srcStat, dest, 'copy') + + const include = await runFilter(src, dest, opts) + + if (!include) return + + // check if the parent of dest exists, and create it if it doesn't exist + const destParent = path.dirname(dest) + const dirExists = await pathExists(destParent) + if (!dirExists) { + await mkdirs(destParent) + } + + await getStatsAndPerformCopy(destStat, src, dest, opts) +} + +async function runFilter (src, dest, opts) { + if (!opts.filter) return true + return opts.filter(src, dest) +} + +async function getStatsAndPerformCopy (destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat + const srcStat = await statFn(src) + + if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts) + + if ( + srcStat.isFile() || + srcStat.isCharacterDevice() || + srcStat.isBlockDevice() + ) return onFile(srcStat, destStat, src, dest, opts) + + if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts) + if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`) + if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`) + throw new Error(`Unknown file: ${src}`) +} + +async function onFile (srcStat, destStat, src, dest, opts) { + if (!destStat) return copyFile(srcStat, src, dest, opts) + + if (opts.overwrite) { + await fs.unlink(dest) + return copyFile(srcStat, src, dest, opts) + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`) + } +} + +async function copyFile (srcStat, src, dest, opts) { + await fs.copyFile(src, dest) + if (opts.preserveTimestamps) { + // Make sure the file is writable before setting the timestamp + // otherwise open fails with EPERM when invoked with 'r+' + // (through utimes call) + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode) + } + + // Set timestamps and mode correspondingly + + // Note that The initial srcStat.atime cannot be trusted + // because it is modified by the read(2) system call + // (See https://nodejs.org/api/fs.html#fs_stat_time_values) + const updatedSrcStat = await fs.stat(src) + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime) + } + + return fs.chmod(dest, srcStat.mode) +} + +function fileIsNotWritable (srcMode) { + return (srcMode & 0o200) === 0 +} + +function makeFileWritable (dest, srcMode) { + return fs.chmod(dest, srcMode | 0o200) +} + +async function onDir (srcStat, destStat, src, dest, opts) { + // the dest directory might not exist, create it + if (!destStat) { + await fs.mkdir(dest) + } + + // iterate through the files in the current directory to copy everything + await asyncIteratorConcurrentProcess(await fs.opendir(src), async (item) => { + const srcItem = path.join(src, item.name) + const destItem = path.join(dest, item.name) + + const include = await runFilter(srcItem, destItem, opts) + // only copy the item if it matches the filter function + if (include) { + const { destStat } = await stat.checkPaths(srcItem, destItem, 'copy', opts) + // If the item is a copyable file, `getStatsAndPerformCopy` will copy it + // If the item is a directory, `getStatsAndPerformCopy` will call `onDir` recursively + await getStatsAndPerformCopy(destStat, srcItem, destItem, opts) + } + }) + + if (!destStat) { + await fs.chmod(dest, srcStat.mode) + } +} + +async function onLink (destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src) + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc) + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest) + } + + let resolvedDest = null + try { + resolvedDest = await fs.readlink(dest) + } catch (e) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (e.code === 'EINVAL' || e.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest) + throw e + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest) + } + // If both symlinks resolve to the same target, they are still distinct symlinks + // that can be copied/overwritten. Only check subdirectory constraints when + // the resolved paths are different. + if (resolvedSrc !== resolvedDest) { + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`) + } + + // do not copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`) + } + } + + // copy the link + await fs.unlink(dest) + return fs.symlink(resolvedSrc, dest) +} + +module.exports = copy diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/copy/index.js b/node_modules/cmake-js/node_modules/fs-extra/lib/copy/index.js new file mode 100644 index 0000000..2e31d27 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/copy/index.js @@ -0,0 +1,7 @@ +'use strict' + +const u = require('universalify').fromPromise +module.exports = { + copy: u(require('./copy')), + copySync: require('./copy-sync') +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/empty/index.js b/node_modules/cmake-js/node_modules/fs-extra/lib/empty/index.js new file mode 100644 index 0000000..b4a2e82 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/empty/index.js @@ -0,0 +1,39 @@ +'use strict' + +const u = require('universalify').fromPromise +const fs = require('../fs') +const path = require('path') +const mkdir = require('../mkdirs') +const remove = require('../remove') + +const emptyDir = u(async function emptyDir (dir) { + let items + try { + items = await fs.readdir(dir) + } catch { + return mkdir.mkdirs(dir) + } + + return Promise.all(items.map(item => remove.remove(path.join(dir, item)))) +}) + +function emptyDirSync (dir) { + let items + try { + items = fs.readdirSync(dir) + } catch { + return mkdir.mkdirsSync(dir) + } + + items.forEach(item => { + item = path.join(dir, item) + remove.removeSync(item) + }) +} + +module.exports = { + emptyDirSync, + emptydirSync: emptyDirSync, + emptyDir, + emptydir: emptyDir +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/file.js b/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/file.js new file mode 100644 index 0000000..a55c2d9 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/file.js @@ -0,0 +1,66 @@ +'use strict' + +const u = require('universalify').fromPromise +const path = require('path') +const fs = require('../fs') +const mkdir = require('../mkdirs') + +async function createFile (file) { + let stats + try { + stats = await fs.stat(file) + } catch { } + if (stats && stats.isFile()) return + + const dir = path.dirname(file) + + let dirStats = null + try { + dirStats = await fs.stat(dir) + } catch (err) { + // if the directory doesn't exist, make it + if (err.code === 'ENOENT') { + await mkdir.mkdirs(dir) + await fs.writeFile(file, '') + return + } else { + throw err + } + } + + if (dirStats.isDirectory()) { + await fs.writeFile(file, '') + } else { + // parent is not a directory + // This is just to cause an internal ENOTDIR error to be thrown + await fs.readdir(dir) + } +} + +function createFileSync (file) { + let stats + try { + stats = fs.statSync(file) + } catch { } + if (stats && stats.isFile()) return + + const dir = path.dirname(file) + try { + if (!fs.statSync(dir).isDirectory()) { + // parent is not a directory + // This is just to cause an internal ENOTDIR error to be thrown + fs.readdirSync(dir) + } + } catch (err) { + // If the stat call above failed because the directory doesn't exist, create it + if (err && err.code === 'ENOENT') mkdir.mkdirsSync(dir) + else throw err + } + + fs.writeFileSync(file, '') +} + +module.exports = { + createFile: u(createFile), + createFileSync +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/index.js b/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/index.js new file mode 100644 index 0000000..ecbcdd0 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/index.js @@ -0,0 +1,23 @@ +'use strict' + +const { createFile, createFileSync } = require('./file') +const { createLink, createLinkSync } = require('./link') +const { createSymlink, createSymlinkSync } = require('./symlink') + +module.exports = { + // file + createFile, + createFileSync, + ensureFile: createFile, + ensureFileSync: createFileSync, + // link + createLink, + createLinkSync, + ensureLink: createLink, + ensureLinkSync: createLinkSync, + // symlink + createSymlink, + createSymlinkSync, + ensureSymlink: createSymlink, + ensureSymlinkSync: createSymlinkSync +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/link.js b/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/link.js new file mode 100644 index 0000000..c3d1c69 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/link.js @@ -0,0 +1,64 @@ +'use strict' + +const u = require('universalify').fromPromise +const path = require('path') +const fs = require('../fs') +const mkdir = require('../mkdirs') +const { pathExists } = require('../path-exists') +const { areIdentical } = require('../util/stat') + +async function createLink (srcpath, dstpath) { + let dstStat + try { + dstStat = await fs.lstat(dstpath) + } catch { + // ignore error + } + + let srcStat + try { + srcStat = await fs.lstat(srcpath) + } catch (err) { + err.message = err.message.replace('lstat', 'ensureLink') + throw err + } + + if (dstStat && areIdentical(srcStat, dstStat)) return + + const dir = path.dirname(dstpath) + + const dirExists = await pathExists(dir) + + if (!dirExists) { + await mkdir.mkdirs(dir) + } + + await fs.link(srcpath, dstpath) +} + +function createLinkSync (srcpath, dstpath) { + let dstStat + try { + dstStat = fs.lstatSync(dstpath) + } catch {} + + try { + const srcStat = fs.lstatSync(srcpath) + if (dstStat && areIdentical(srcStat, dstStat)) return + } catch (err) { + err.message = err.message.replace('lstat', 'ensureLink') + throw err + } + + const dir = path.dirname(dstpath) + const dirExists = fs.existsSync(dir) + if (dirExists) return fs.linkSync(srcpath, dstpath) + mkdir.mkdirsSync(dir) + + return fs.linkSync(srcpath, dstpath) +} + +module.exports = { + createLink: u(createLink), + createLinkSync +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/symlink-paths.js b/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/symlink-paths.js new file mode 100644 index 0000000..85dda47 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/symlink-paths.js @@ -0,0 +1,101 @@ +'use strict' + +const path = require('path') +const fs = require('../fs') +const { pathExists } = require('../path-exists') + +const u = require('universalify').fromPromise + +/** + * Function that returns two types of paths, one relative to symlink, and one + * relative to the current working directory. Checks if path is absolute or + * relative. If the path is relative, this function checks if the path is + * relative to symlink or relative to current working directory. This is an + * initiative to find a smarter `srcpath` to supply when building symlinks. + * This allows you to determine which path to use out of one of three possible + * types of source paths. The first is an absolute path. This is detected by + * `path.isAbsolute()`. When an absolute path is provided, it is checked to + * see if it exists. If it does it's used, if not an error is returned + * (callback)/ thrown (sync). The other two options for `srcpath` are a + * relative url. By default Node's `fs.symlink` works by creating a symlink + * using `dstpath` and expects the `srcpath` to be relative to the newly + * created symlink. If you provide a `srcpath` that does not exist on the file + * system it results in a broken symlink. To minimize this, the function + * checks to see if the 'relative to symlink' source file exists, and if it + * does it will use it. If it does not, it checks if there's a file that + * exists that is relative to the current working directory, if does its used. + * This preserves the expectations of the original fs.symlink spec and adds + * the ability to pass in `relative to current working direcotry` paths. + */ + +async function symlinkPaths (srcpath, dstpath) { + if (path.isAbsolute(srcpath)) { + try { + await fs.lstat(srcpath) + } catch (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + throw err + } + + return { + toCwd: srcpath, + toDst: srcpath + } + } + + const dstdir = path.dirname(dstpath) + const relativeToDst = path.join(dstdir, srcpath) + + const exists = await pathExists(relativeToDst) + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + } + } + + try { + await fs.lstat(srcpath) + } catch (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + throw err + } + + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + } +} + +function symlinkPathsSync (srcpath, dstpath) { + if (path.isAbsolute(srcpath)) { + const exists = fs.existsSync(srcpath) + if (!exists) throw new Error('absolute srcpath does not exist') + return { + toCwd: srcpath, + toDst: srcpath + } + } + + const dstdir = path.dirname(dstpath) + const relativeToDst = path.join(dstdir, srcpath) + const exists = fs.existsSync(relativeToDst) + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + } + } + + const srcExists = fs.existsSync(srcpath) + if (!srcExists) throw new Error('relative srcpath does not exist') + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + } +} + +module.exports = { + symlinkPaths: u(symlinkPaths), + symlinkPathsSync +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/symlink-type.js b/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/symlink-type.js new file mode 100644 index 0000000..518558e --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/symlink-type.js @@ -0,0 +1,34 @@ +'use strict' + +const fs = require('../fs') +const u = require('universalify').fromPromise + +async function symlinkType (srcpath, type) { + if (type) return type + + let stats + try { + stats = await fs.lstat(srcpath) + } catch { + return 'file' + } + + return (stats && stats.isDirectory()) ? 'dir' : 'file' +} + +function symlinkTypeSync (srcpath, type) { + if (type) return type + + let stats + try { + stats = fs.lstatSync(srcpath) + } catch { + return 'file' + } + return (stats && stats.isDirectory()) ? 'dir' : 'file' +} + +module.exports = { + symlinkType: u(symlinkType), + symlinkTypeSync +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/symlink.js b/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/symlink.js new file mode 100644 index 0000000..a3d5f57 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/ensure/symlink.js @@ -0,0 +1,67 @@ +'use strict' + +const u = require('universalify').fromPromise +const path = require('path') +const fs = require('../fs') + +const { mkdirs, mkdirsSync } = require('../mkdirs') + +const { symlinkPaths, symlinkPathsSync } = require('./symlink-paths') +const { symlinkType, symlinkTypeSync } = require('./symlink-type') + +const { pathExists } = require('../path-exists') + +const { areIdentical } = require('../util/stat') + +async function createSymlink (srcpath, dstpath, type) { + let stats + try { + stats = await fs.lstat(dstpath) + } catch { } + + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]) + + if (areIdentical(srcStat, dstStat)) return + } + + const relative = await symlinkPaths(srcpath, dstpath) + srcpath = relative.toDst + const toType = await symlinkType(relative.toCwd, type) + const dir = path.dirname(dstpath) + + if (!(await pathExists(dir))) { + await mkdirs(dir) + } + + return fs.symlink(srcpath, dstpath, toType) +} + +function createSymlinkSync (srcpath, dstpath, type) { + let stats + try { + stats = fs.lstatSync(dstpath) + } catch { } + if (stats && stats.isSymbolicLink()) { + const srcStat = fs.statSync(srcpath) + const dstStat = fs.statSync(dstpath) + if (areIdentical(srcStat, dstStat)) return + } + + const relative = symlinkPathsSync(srcpath, dstpath) + srcpath = relative.toDst + type = symlinkTypeSync(relative.toCwd, type) + const dir = path.dirname(dstpath) + const exists = fs.existsSync(dir) + if (exists) return fs.symlinkSync(srcpath, dstpath, type) + mkdirsSync(dir) + return fs.symlinkSync(srcpath, dstpath, type) +} + +module.exports = { + createSymlink: u(createSymlink), + createSymlinkSync +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/esm.mjs b/node_modules/cmake-js/node_modules/fs-extra/lib/esm.mjs new file mode 100644 index 0000000..27b7a1f --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/esm.mjs @@ -0,0 +1,68 @@ +import _copy from './copy/index.js' +import _empty from './empty/index.js' +import _ensure from './ensure/index.js' +import _json from './json/index.js' +import _mkdirs from './mkdirs/index.js' +import _move from './move/index.js' +import _outputFile from './output-file/index.js' +import _pathExists from './path-exists/index.js' +import _remove from './remove/index.js' + +// NOTE: Only exports fs-extra's functions; fs functions must be imported from "node:fs" or "node:fs/promises" + +export const copy = _copy.copy +export const copySync = _copy.copySync +export const emptyDirSync = _empty.emptyDirSync +export const emptydirSync = _empty.emptydirSync +export const emptyDir = _empty.emptyDir +export const emptydir = _empty.emptydir +export const createFile = _ensure.createFile +export const createFileSync = _ensure.createFileSync +export const ensureFile = _ensure.ensureFile +export const ensureFileSync = _ensure.ensureFileSync +export const createLink = _ensure.createLink +export const createLinkSync = _ensure.createLinkSync +export const ensureLink = _ensure.ensureLink +export const ensureLinkSync = _ensure.ensureLinkSync +export const createSymlink = _ensure.createSymlink +export const createSymlinkSync = _ensure.createSymlinkSync +export const ensureSymlink = _ensure.ensureSymlink +export const ensureSymlinkSync = _ensure.ensureSymlinkSync +export const readJson = _json.readJson +export const readJSON = _json.readJSON +export const readJsonSync = _json.readJsonSync +export const readJSONSync = _json.readJSONSync +export const writeJson = _json.writeJson +export const writeJSON = _json.writeJSON +export const writeJsonSync = _json.writeJsonSync +export const writeJSONSync = _json.writeJSONSync +export const outputJson = _json.outputJson +export const outputJSON = _json.outputJSON +export const outputJsonSync = _json.outputJsonSync +export const outputJSONSync = _json.outputJSONSync +export const mkdirs = _mkdirs.mkdirs +export const mkdirsSync = _mkdirs.mkdirsSync +export const mkdirp = _mkdirs.mkdirp +export const mkdirpSync = _mkdirs.mkdirpSync +export const ensureDir = _mkdirs.ensureDir +export const ensureDirSync = _mkdirs.ensureDirSync +export const move = _move.move +export const moveSync = _move.moveSync +export const outputFile = _outputFile.outputFile +export const outputFileSync = _outputFile.outputFileSync +export const pathExists = _pathExists.pathExists +export const pathExistsSync = _pathExists.pathExistsSync +export const remove = _remove.remove +export const removeSync = _remove.removeSync + +export default { + ..._copy, + ..._empty, + ..._ensure, + ..._json, + ..._mkdirs, + ..._move, + ..._outputFile, + ..._pathExists, + ..._remove +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/fs/index.js b/node_modules/cmake-js/node_modules/fs-extra/lib/fs/index.js new file mode 100644 index 0000000..2dae818 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/fs/index.js @@ -0,0 +1,146 @@ +'use strict' +// This is adapted from https://github.com/normalize/mz +// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors +const u = require('universalify').fromCallback +const fs = require('graceful-fs') + +const api = [ + 'access', + 'appendFile', + 'chmod', + 'chown', + 'close', + 'copyFile', + 'cp', + 'fchmod', + 'fchown', + 'fdatasync', + 'fstat', + 'fsync', + 'ftruncate', + 'futimes', + 'glob', + 'lchmod', + 'lchown', + 'lutimes', + 'link', + 'lstat', + 'mkdir', + 'mkdtemp', + 'open', + 'opendir', + 'readdir', + 'readFile', + 'readlink', + 'realpath', + 'rename', + 'rm', + 'rmdir', + 'stat', + 'statfs', + 'symlink', + 'truncate', + 'unlink', + 'utimes', + 'writeFile' +].filter(key => { + // Some commands are not available on some systems. Ex: + // fs.cp was added in Node.js v16.7.0 + // fs.statfs was added in Node v19.6.0, v18.15.0 + // fs.glob was added in Node.js v22.0.0 + // fs.lchown is not available on at least some Linux + return typeof fs[key] === 'function' +}) + +// Export cloned fs: +Object.assign(exports, fs) + +// Universalify async methods: +api.forEach(method => { + exports[method] = u(fs[method]) +}) + +// We differ from mz/fs in that we still ship the old, broken, fs.exists() +// since we are a drop-in replacement for the native module +exports.exists = function (filename, callback) { + if (typeof callback === 'function') { + return fs.exists(filename, callback) + } + return new Promise(resolve => { + return fs.exists(filename, resolve) + }) +} + +// fs.read(), fs.write(), fs.readv(), & fs.writev() need special treatment due to multiple callback args + +exports.read = function (fd, buffer, offset, length, position, callback) { + if (typeof callback === 'function') { + return fs.read(fd, buffer, offset, length, position, callback) + } + return new Promise((resolve, reject) => { + fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => { + if (err) return reject(err) + resolve({ bytesRead, buffer }) + }) + }) +} + +// Function signature can be +// fs.write(fd, buffer[, offset[, length[, position]]], callback) +// OR +// fs.write(fd, string[, position[, encoding]], callback) +// We need to handle both cases, so we use ...args +exports.write = function (fd, buffer, ...args) { + if (typeof args[args.length - 1] === 'function') { + return fs.write(fd, buffer, ...args) + } + + return new Promise((resolve, reject) => { + fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => { + if (err) return reject(err) + resolve({ bytesWritten, buffer }) + }) + }) +} + +// Function signature is +// s.readv(fd, buffers[, position], callback) +// We need to handle the optional arg, so we use ...args +exports.readv = function (fd, buffers, ...args) { + if (typeof args[args.length - 1] === 'function') { + return fs.readv(fd, buffers, ...args) + } + + return new Promise((resolve, reject) => { + fs.readv(fd, buffers, ...args, (err, bytesRead, buffers) => { + if (err) return reject(err) + resolve({ bytesRead, buffers }) + }) + }) +} + +// Function signature is +// s.writev(fd, buffers[, position], callback) +// We need to handle the optional arg, so we use ...args +exports.writev = function (fd, buffers, ...args) { + if (typeof args[args.length - 1] === 'function') { + return fs.writev(fd, buffers, ...args) + } + + return new Promise((resolve, reject) => { + fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => { + if (err) return reject(err) + resolve({ bytesWritten, buffers }) + }) + }) +} + +// fs.realpath.native sometimes not available if fs is monkey-patched +if (typeof fs.realpath.native === 'function') { + exports.realpath.native = u(fs.realpath.native) +} else { + process.emitWarning( + 'fs.realpath.native is not a function. Is fs being monkey-patched?', + 'Warning', 'fs-extra-WARN0003' + ) +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/index.js b/node_modules/cmake-js/node_modules/fs-extra/lib/index.js new file mode 100644 index 0000000..da6711a --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/index.js @@ -0,0 +1,16 @@ +'use strict' + +module.exports = { + // Export promiseified graceful-fs: + ...require('./fs'), + // Export extra methods: + ...require('./copy'), + ...require('./empty'), + ...require('./ensure'), + ...require('./json'), + ...require('./mkdirs'), + ...require('./move'), + ...require('./output-file'), + ...require('./path-exists'), + ...require('./remove') +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/json/index.js b/node_modules/cmake-js/node_modules/fs-extra/lib/json/index.js new file mode 100644 index 0000000..900126a --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/json/index.js @@ -0,0 +1,16 @@ +'use strict' + +const u = require('universalify').fromPromise +const jsonFile = require('./jsonfile') + +jsonFile.outputJson = u(require('./output-json')) +jsonFile.outputJsonSync = require('./output-json-sync') +// aliases +jsonFile.outputJSON = jsonFile.outputJson +jsonFile.outputJSONSync = jsonFile.outputJsonSync +jsonFile.writeJSON = jsonFile.writeJson +jsonFile.writeJSONSync = jsonFile.writeJsonSync +jsonFile.readJSON = jsonFile.readJson +jsonFile.readJSONSync = jsonFile.readJsonSync + +module.exports = jsonFile diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/json/jsonfile.js b/node_modules/cmake-js/node_modules/fs-extra/lib/json/jsonfile.js new file mode 100644 index 0000000..f11d34d --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/json/jsonfile.js @@ -0,0 +1,11 @@ +'use strict' + +const jsonFile = require('jsonfile') + +module.exports = { + // jsonfile exports + readJson: jsonFile.readFile, + readJsonSync: jsonFile.readFileSync, + writeJson: jsonFile.writeFile, + writeJsonSync: jsonFile.writeFileSync +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/json/output-json-sync.js b/node_modules/cmake-js/node_modules/fs-extra/lib/json/output-json-sync.js new file mode 100644 index 0000000..d4e564f --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/json/output-json-sync.js @@ -0,0 +1,12 @@ +'use strict' + +const { stringify } = require('jsonfile/utils') +const { outputFileSync } = require('../output-file') + +function outputJsonSync (file, data, options) { + const str = stringify(data, options) + + outputFileSync(file, str, options) +} + +module.exports = outputJsonSync diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/json/output-json.js b/node_modules/cmake-js/node_modules/fs-extra/lib/json/output-json.js new file mode 100644 index 0000000..0afdeb6 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/json/output-json.js @@ -0,0 +1,12 @@ +'use strict' + +const { stringify } = require('jsonfile/utils') +const { outputFile } = require('../output-file') + +async function outputJson (file, data, options = {}) { + const str = stringify(data, options) + + await outputFile(file, str, options) +} + +module.exports = outputJson diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/mkdirs/index.js b/node_modules/cmake-js/node_modules/fs-extra/lib/mkdirs/index.js new file mode 100644 index 0000000..9edecee --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/mkdirs/index.js @@ -0,0 +1,14 @@ +'use strict' +const u = require('universalify').fromPromise +const { makeDir: _makeDir, makeDirSync } = require('./make-dir') +const makeDir = u(_makeDir) + +module.exports = { + mkdirs: makeDir, + mkdirsSync: makeDirSync, + // alias + mkdirp: makeDir, + mkdirpSync: makeDirSync, + ensureDir: makeDir, + ensureDirSync: makeDirSync +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/mkdirs/make-dir.js b/node_modules/cmake-js/node_modules/fs-extra/lib/mkdirs/make-dir.js new file mode 100644 index 0000000..45ece64 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/mkdirs/make-dir.js @@ -0,0 +1,27 @@ +'use strict' +const fs = require('../fs') +const { checkPath } = require('./utils') + +const getMode = options => { + const defaults = { mode: 0o777 } + if (typeof options === 'number') return options + return ({ ...defaults, ...options }).mode +} + +module.exports.makeDir = async (dir, options) => { + checkPath(dir) + + return fs.mkdir(dir, { + mode: getMode(options), + recursive: true + }) +} + +module.exports.makeDirSync = (dir, options) => { + checkPath(dir) + + return fs.mkdirSync(dir, { + mode: getMode(options), + recursive: true + }) +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/mkdirs/utils.js b/node_modules/cmake-js/node_modules/fs-extra/lib/mkdirs/utils.js new file mode 100644 index 0000000..a4059ad --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/mkdirs/utils.js @@ -0,0 +1,21 @@ +// Adapted from https://github.com/sindresorhus/make-dir +// Copyright (c) Sindre Sorhus (sindresorhus.com) +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +'use strict' +const path = require('path') + +// https://github.com/nodejs/node/issues/8987 +// https://github.com/libuv/libuv/pull/1088 +module.exports.checkPath = function checkPath (pth) { + if (process.platform === 'win32') { + const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, '')) + + if (pathHasInvalidWinCharacters) { + const error = new Error(`Path contains invalid characters: ${pth}`) + error.code = 'EINVAL' + throw error + } + } +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/move/index.js b/node_modules/cmake-js/node_modules/fs-extra/lib/move/index.js new file mode 100644 index 0000000..5a2f1cc --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/move/index.js @@ -0,0 +1,7 @@ +'use strict' + +const u = require('universalify').fromPromise +module.exports = { + move: u(require('./move')), + moveSync: require('./move-sync') +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/move/move-sync.js b/node_modules/cmake-js/node_modules/fs-extra/lib/move/move-sync.js new file mode 100644 index 0000000..c456ab3 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/move/move-sync.js @@ -0,0 +1,55 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const copySync = require('../copy').copySync +const removeSync = require('../remove').removeSync +const mkdirpSync = require('../mkdirs').mkdirpSync +const stat = require('../util/stat') + +function moveSync (src, dest, opts) { + opts = opts || {} + const overwrite = opts.overwrite || opts.clobber || false + + const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, 'move', opts) + stat.checkParentPathsSync(src, srcStat, dest, 'move') + if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest)) + return doRename(src, dest, overwrite, isChangingCase) +} + +function isParentRoot (dest) { + const parent = path.dirname(dest) + const parsedPath = path.parse(parent) + return parsedPath.root === parent +} + +function doRename (src, dest, overwrite, isChangingCase) { + if (isChangingCase) return rename(src, dest, overwrite) + if (overwrite) { + removeSync(dest) + return rename(src, dest, overwrite) + } + if (fs.existsSync(dest)) throw new Error('dest already exists.') + return rename(src, dest, overwrite) +} + +function rename (src, dest, overwrite) { + try { + fs.renameSync(src, dest) + } catch (err) { + if (err.code !== 'EXDEV') throw err + return moveAcrossDevice(src, dest, overwrite) + } +} + +function moveAcrossDevice (src, dest, overwrite) { + const opts = { + overwrite, + errorOnExist: true, + preserveTimestamps: true + } + copySync(src, dest, opts) + return removeSync(src) +} + +module.exports = moveSync diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/move/move.js b/node_modules/cmake-js/node_modules/fs-extra/lib/move/move.js new file mode 100644 index 0000000..992bd0f --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/move/move.js @@ -0,0 +1,59 @@ +'use strict' + +const fs = require('../fs') +const path = require('path') +const { copy } = require('../copy') +const { remove } = require('../remove') +const { mkdirp } = require('../mkdirs') +const { pathExists } = require('../path-exists') +const stat = require('../util/stat') + +async function move (src, dest, opts = {}) { + const overwrite = opts.overwrite || opts.clobber || false + + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, 'move', opts) + + await stat.checkParentPaths(src, srcStat, dest, 'move') + + // If the parent of dest is not root, make sure it exists before proceeding + const destParent = path.dirname(dest) + const parsedParentPath = path.parse(destParent) + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent) + } + + return doRename(src, dest, overwrite, isChangingCase) +} + +async function doRename (src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest) + } else if (await pathExists(dest)) { + throw new Error('dest already exists.') + } + } + + try { + // Try w/ rename first, and try copy + remove if EXDEV + await fs.rename(src, dest) + } catch (err) { + if (err.code !== 'EXDEV') { + throw err + } + await moveAcrossDevice(src, dest, overwrite) + } +} + +async function moveAcrossDevice (src, dest, overwrite) { + const opts = { + overwrite, + errorOnExist: true, + preserveTimestamps: true + } + + await copy(src, dest, opts) + return remove(src) +} + +module.exports = move diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/output-file/index.js b/node_modules/cmake-js/node_modules/fs-extra/lib/output-file/index.js new file mode 100644 index 0000000..a42d943 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/output-file/index.js @@ -0,0 +1,31 @@ +'use strict' + +const u = require('universalify').fromPromise +const fs = require('../fs') +const path = require('path') +const mkdir = require('../mkdirs') +const pathExists = require('../path-exists').pathExists + +async function outputFile (file, data, encoding = 'utf-8') { + const dir = path.dirname(file) + + if (!(await pathExists(dir))) { + await mkdir.mkdirs(dir) + } + + return fs.writeFile(file, data, encoding) +} + +function outputFileSync (file, ...args) { + const dir = path.dirname(file) + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir) + } + + fs.writeFileSync(file, ...args) +} + +module.exports = { + outputFile: u(outputFile), + outputFileSync +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/path-exists/index.js b/node_modules/cmake-js/node_modules/fs-extra/lib/path-exists/index.js new file mode 100644 index 0000000..ddd9bc7 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/path-exists/index.js @@ -0,0 +1,12 @@ +'use strict' +const u = require('universalify').fromPromise +const fs = require('../fs') + +function pathExists (path) { + return fs.access(path).then(() => true).catch(() => false) +} + +module.exports = { + pathExists: u(pathExists), + pathExistsSync: fs.existsSync +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/remove/index.js b/node_modules/cmake-js/node_modules/fs-extra/lib/remove/index.js new file mode 100644 index 0000000..da746c7 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/remove/index.js @@ -0,0 +1,17 @@ +'use strict' + +const fs = require('graceful-fs') +const u = require('universalify').fromCallback + +function remove (path, callback) { + fs.rm(path, { recursive: true, force: true }, callback) +} + +function removeSync (path) { + fs.rmSync(path, { recursive: true, force: true }) +} + +module.exports = { + remove: u(remove), + removeSync +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/util/async.js b/node_modules/cmake-js/node_modules/fs-extra/lib/util/async.js new file mode 100644 index 0000000..3f6288d --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/util/async.js @@ -0,0 +1,29 @@ +'use strict' + +// https://github.com/jprichardson/node-fs-extra/issues/1056 +// Performing parallel operations on each item of an async iterator is +// surprisingly hard; you need to have handlers in place to avoid getting an +// UnhandledPromiseRejectionWarning. +// NOTE: This function does not presently handle return values, only errors +async function asyncIteratorConcurrentProcess (iterator, fn) { + const promises = [] + for await (const item of iterator) { + promises.push( + fn(item).then( + () => null, + (err) => err ?? new Error('unknown error') + ) + ) + } + await Promise.all( + promises.map((promise) => + promise.then((possibleErr) => { + if (possibleErr !== null) throw possibleErr + }) + ) + ) +} + +module.exports = { + asyncIteratorConcurrentProcess +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/util/stat.js b/node_modules/cmake-js/node_modules/fs-extra/lib/util/stat.js new file mode 100644 index 0000000..5594942 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/util/stat.js @@ -0,0 +1,159 @@ +'use strict' + +const fs = require('../fs') +const path = require('path') +const u = require('universalify').fromPromise + +function getStats (src, dest, opts) { + const statFunc = opts.dereference + ? (file) => fs.stat(file, { bigint: true }) + : (file) => fs.lstat(file, { bigint: true }) + return Promise.all([ + statFunc(src), + statFunc(dest).catch(err => { + if (err.code === 'ENOENT') return null + throw err + }) + ]).then(([srcStat, destStat]) => ({ srcStat, destStat })) +} + +function getStatsSync (src, dest, opts) { + let destStat + const statFunc = opts.dereference + ? (file) => fs.statSync(file, { bigint: true }) + : (file) => fs.lstatSync(file, { bigint: true }) + const srcStat = statFunc(src) + try { + destStat = statFunc(dest) + } catch (err) { + if (err.code === 'ENOENT') return { srcStat, destStat: null } + throw err + } + return { srcStat, destStat } +} + +async function checkPaths (src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts) + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src) + const destBaseName = path.basename(dest) + if (funcName === 'move' && + srcBaseName !== destBaseName && + srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true } + } + throw new Error('Source and destination must not be the same.') + } + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`) + } + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`) + } + } + + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)) + } + + return { srcStat, destStat } +} + +function checkPathsSync (src, dest, funcName, opts) { + const { srcStat, destStat } = getStatsSync(src, dest, opts) + + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src) + const destBaseName = path.basename(dest) + if (funcName === 'move' && + srcBaseName !== destBaseName && + srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true } + } + throw new Error('Source and destination must not be the same.') + } + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`) + } + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`) + } + } + + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)) + } + return { srcStat, destStat } +} + +// recursively check if dest parent is a subdirectory of src. +// It works for all file types including symlinks since it +// checks the src and dest inodes. It starts from the deepest +// parent and stops once it reaches the src parent or the root path. +async function checkParentPaths (src, srcStat, dest, funcName) { + const srcParent = path.resolve(path.dirname(src)) + const destParent = path.resolve(path.dirname(dest)) + if (destParent === srcParent || destParent === path.parse(destParent).root) return + + let destStat + try { + destStat = await fs.stat(destParent, { bigint: true }) + } catch (err) { + if (err.code === 'ENOENT') return + throw err + } + + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)) + } + + return checkParentPaths(src, srcStat, destParent, funcName) +} + +function checkParentPathsSync (src, srcStat, dest, funcName) { + const srcParent = path.resolve(path.dirname(src)) + const destParent = path.resolve(path.dirname(dest)) + if (destParent === srcParent || destParent === path.parse(destParent).root) return + let destStat + try { + destStat = fs.statSync(destParent, { bigint: true }) + } catch (err) { + if (err.code === 'ENOENT') return + throw err + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)) + } + return checkParentPathsSync(src, srcStat, destParent, funcName) +} + +function areIdentical (srcStat, destStat) { + // stat.dev can be 0n on windows when node version >= 22.x.x + return destStat.ino !== undefined && destStat.dev !== undefined && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev +} + +// return true if dest is a subdir of src, otherwise false. +// It only checks the path strings. +function isSrcSubdir (src, dest) { + const srcArr = path.resolve(src).split(path.sep).filter(i => i) + const destArr = path.resolve(dest).split(path.sep).filter(i => i) + return srcArr.every((cur, i) => destArr[i] === cur) +} + +function errMsg (src, dest, funcName) { + return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.` +} + +module.exports = { + // checkPaths + checkPaths: u(checkPaths), + checkPathsSync, + // checkParent + checkParentPaths: u(checkParentPaths), + checkParentPathsSync, + // Misc + isSrcSubdir, + areIdentical +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/lib/util/utimes.js b/node_modules/cmake-js/node_modules/fs-extra/lib/util/utimes.js new file mode 100644 index 0000000..87f4588 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/lib/util/utimes.js @@ -0,0 +1,36 @@ +'use strict' + +const fs = require('../fs') +const u = require('universalify').fromPromise + +async function utimesMillis (path, atime, mtime) { + // if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback) + const fd = await fs.open(path, 'r+') + + let closeErr = null + + try { + await fs.futimes(fd, atime, mtime) + } finally { + try { + await fs.close(fd) + } catch (e) { + closeErr = e + } + } + + if (closeErr) { + throw closeErr + } +} + +function utimesMillisSync (path, atime, mtime) { + const fd = fs.openSync(path, 'r+') + fs.futimesSync(fd, atime, mtime) + return fs.closeSync(fd) +} + +module.exports = { + utimesMillis: u(utimesMillis), + utimesMillisSync +} diff --git a/node_modules/cmake-js/node_modules/fs-extra/package.json b/node_modules/cmake-js/node_modules/fs-extra/package.json new file mode 100644 index 0000000..582a796 --- /dev/null +++ b/node_modules/cmake-js/node_modules/fs-extra/package.json @@ -0,0 +1,71 @@ +{ + "name": "fs-extra", + "version": "11.3.3", + "description": "fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.", + "engines": { + "node": ">=14.14" + }, + "homepage": "https://github.com/jprichardson/node-fs-extra", + "repository": { + "type": "git", + "url": "https://github.com/jprichardson/node-fs-extra" + }, + "keywords": [ + "fs", + "file", + "file system", + "copy", + "directory", + "extra", + "mkdirp", + "mkdir", + "mkdirs", + "recursive", + "json", + "read", + "write", + "extra", + "delete", + "remove", + "touch", + "create", + "text", + "output", + "move", + "promise" + ], + "author": "JP Richardson ", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "devDependencies": { + "klaw": "^2.1.1", + "klaw-sync": "^3.0.2", + "minimist": "^1.1.1", + "mocha": "^10.1.0", + "nyc": "^15.0.0", + "proxyquire": "^2.0.1", + "read-dir-files": "^0.1.1", + "standard": "^17.0.0" + }, + "main": "./lib/index.js", + "exports": { + ".": "./lib/index.js", + "./esm": "./lib/esm.mjs" + }, + "files": [ + "lib/", + "!lib/**/__tests__/" + ], + "scripts": { + "lint": "standard", + "test-find": "find ./lib/**/__tests__ -name *.test.js | xargs mocha", + "test": "npm run lint && npm run unit && npm run unit-esm", + "unit": "nyc node test.js", + "unit-esm": "node test.mjs" + }, + "sideEffects": false +} diff --git a/node_modules/cmake-js/node_modules/isexe/LICENSE.md b/node_modules/cmake-js/node_modules/isexe/LICENSE.md new file mode 100644 index 0000000..c5402b9 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/LICENSE.md @@ -0,0 +1,55 @@ +# Blue Oak Model License + +Version 1.0.0 + +## Purpose + +This license gives everyone as much permission to work with +this software as possible, while protecting contributors +from liability. + +## Acceptance + +In order to receive this license, you must agree to its +rules. The rules of this license are both obligations +under that agreement and conditions to your license. +You must not do anything with this software that triggers +a rule that you cannot or will not follow. + +## Copyright + +Each contributor licenses you to do everything with this +software that would otherwise infringe that contributor's +copyright in it. + +## Notices + +You must ensure that everyone who gets a copy of +any part of this software from you, with or without +changes, also gets the text of this license or a link to +. + +## Excuse + +If anyone notifies you in writing that you have not +complied with [Notices](#notices), you can keep your +license by taking all practical steps to comply within 30 +days after the notice. If you do not do so, your license +ends immediately. + +## Patent + +Each contributor licenses you to do everything with this +software that would otherwise infringe any patent claims +they can license or become able to license. + +## Reliability + +No contributor can revoke this license. + +## No Liability + +***As far as the law allows, this software comes as is, +without any warranty or condition, and no contributor +will be liable to anyone for any damages related to this +software or this license, under any kind of legal claim.*** diff --git a/node_modules/cmake-js/node_modules/isexe/README.md b/node_modules/cmake-js/node_modules/isexe/README.md new file mode 100644 index 0000000..e050d21 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/README.md @@ -0,0 +1,80 @@ +# isexe + +Minimal module to check if a file is executable, and a normal file. + +Uses `fs.stat` and tests against the `PATHEXT` environment variable on +Windows. + +## USAGE + +```js +// default export is a minified version that doesn't need to +// load more than one file. Load the 'isexe/raw' export if +// you want the non-minified version for some reason. +import { isexe, sync } from 'isexe' +// or require() works too +// const { isexe } = require('isexe') +isexe('some-file-name').then( + isExe => { + if (isExe) { + console.error('this thing can be run') + } else { + console.error('cannot be run') + } + }, + err => { + console.error('probably file doesnt exist or something') + }, +) + +// same thing but synchronous, throws errors +isExe = sync('some-file-name') + +// treat errors as just "not executable" +const isExe = await isexe('maybe-missing-file', { ignoreErrors: true }) +const isExe = sync('maybe-missing-file', { ignoreErrors: true }) +``` + +## API + +### `isexe(path, [options]) => Promise` + +Check if the path is executable. + +Will raise whatever errors may be raised by `fs.stat`, unless +`options.ignoreErrors` is set to true. + +### `sync(path, [options]) => boolean` + +Same as `isexe` but returns the value and throws any errors raised. + +## Platform Specific Implementations + +If for some reason you want to use the implementation for a +specific platform, you can do that. + +```js +import { win32, posix } from 'isexe' +win32.isexe(...) +win32.sync(...) +// etc + +// or: +import { isexe, sync } from 'isexe/posix' +``` + +The default exported implementation will be chosen based on +`process.platform`. + +### Options + +```ts +import type IsexeOptions from 'isexe' +``` + +- `ignoreErrors` Treat all errors as "no, this is not + executable", but don't raise them. +- `uid` Number to use as the user id on posix +- `gid` Number to use as the group id on posix +- `pathExt` List of path extensions to use instead of `PATHEXT` + environment variable on Windows. diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/index.d.ts b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/index.d.ts new file mode 100644 index 0000000..223bf78 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/index.d.ts @@ -0,0 +1,14 @@ +import * as posix from './posix.js'; +import * as win32 from './win32.js'; +export * from './options.js'; +export { win32, posix }; +/** + * Determine whether a path is executable on the current platform. + */ +export declare const isexe: (path: string, options?: import("./options.js").IsexeOptions) => Promise; +/** + * Synchronously determine whether a path is executable on the + * current platform. + */ +export declare const sync: (path: string, options?: import("./options.js").IsexeOptions) => boolean; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/index.d.ts.map b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000..c90348e --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;AAKvB;;GAEG;AACH,eAAO,MAAM,KAAK,mFAAa,CAAA;AAC/B;;;GAGG;AACH,eAAO,MAAM,IAAI,0EAAY,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/index.js b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/index.js new file mode 100644 index 0000000..71882e7 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/index.js @@ -0,0 +1,56 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sync = exports.isexe = exports.posix = exports.win32 = void 0; +const posix = __importStar(require("./posix.js")); +exports.posix = posix; +const win32 = __importStar(require("./win32.js")); +exports.win32 = win32; +__exportStar(require("./options.js"), exports); +const platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform; +const impl = platform === 'win32' ? win32 : posix; +/** + * Determine whether a path is executable on the current platform. + */ +exports.isexe = impl.isexe; +/** + * Synchronously determine whether a path is executable on the + * current platform. + */ +exports.sync = impl.sync; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/index.js.map b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/index.js.map new file mode 100644 index 0000000..c581421 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAmC;AAGnB,sBAAK;AAFrB,kDAAmC;AAE1B,sBAAK;AADd,+CAA4B;AAG5B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,OAAO,CAAC,QAAQ,CAAA;AACtE,MAAM,IAAI,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;AAEjD;;GAEG;AACU,QAAA,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;AAC/B;;;GAGG;AACU,QAAA,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA","sourcesContent":["import * as posix from './posix.js'\nimport * as win32 from './win32.js'\nexport * from './options.js'\nexport { win32, posix }\n\nconst platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform\nconst impl = platform === 'win32' ? win32 : posix\n\n/**\n * Determine whether a path is executable on the current platform.\n */\nexport const isexe = impl.isexe\n/**\n * Synchronously determine whether a path is executable on the\n * current platform.\n */\nexport const sync = impl.sync\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/index.min.js b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/index.min.js new file mode 100644 index 0000000..7cb0271 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/index.min.js @@ -0,0 +1,2 @@ +"use strict";var a=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var _=a(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.sync=i.isexe=void 0;var M=require("node:fs"),x=require("node:fs/promises"),q=async(t,e={})=>{let{ignoreErrors:r=!1}=e;try{return d(await(0,x.stat)(t),e)}catch(s){let n=s;if(r||n.code==="EACCES")return!1;throw n}};i.isexe=q;var m=(t,e={})=>{let{ignoreErrors:r=!1}=e;try{return d((0,M.statSync)(t),e)}catch(s){let n=s;if(r||n.code==="EACCES")return!1;throw n}};i.sync=m;var d=(t,e)=>t.isFile()&&A(t,e),A=(t,e)=>{let r=e.uid??process.getuid?.(),s=e.groups??process.getgroups?.()??[],n=e.gid??process.getgid?.()??s[0];if(r===void 0||n===void 0)throw new Error("cannot get uid or gid");let u=new Set([n,...s]),c=t.mode,S=t.uid,P=t.gid,f=parseInt("100",8),l=parseInt("010",8),j=parseInt("001",8),C=f|l;return!!(c&j||c&l&&u.has(P)||c&f&&S===r||c&C&&r===0)}});var g=a(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0});o.sync=o.isexe=void 0;var T=require("node:fs"),I=require("node:fs/promises"),D=require("node:path"),F=async(t,e={})=>{let{ignoreErrors:r=!1}=e;try{return y(await(0,I.stat)(t),t,e)}catch(s){let n=s;if(r||n.code==="EACCES")return!1;throw n}};o.isexe=F;var L=(t,e={})=>{let{ignoreErrors:r=!1}=e;try{return y((0,T.statSync)(t),t,e)}catch(s){let n=s;if(r||n.code==="EACCES")return!1;throw n}};o.sync=L;var B=(t,e)=>{let{pathExt:r=process.env.PATHEXT||""}=e,s=r.split(D.delimiter);if(s.indexOf("")!==-1)return!0;for(let n of s){let u=n.toLowerCase(),c=t.substring(t.length-u.length).toLowerCase();if(u&&c===u)return!0}return!1},y=(t,e,r)=>t.isFile()&&B(e,r)});var p=a(h=>{"use strict";Object.defineProperty(h,"__esModule",{value:!0})});var v=exports&&exports.__createBinding||(Object.create?(function(t,e,r,s){s===void 0&&(s=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,n)}):(function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]})),G=exports&&exports.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),w=exports&&exports.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var s=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[s.length]=n);return s},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var s=t(e),n=0;n => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(await stat(path), options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\n/**\n * Synchronously determine whether a path is executable according to\n * the mode and current (or specified) user and group IDs.\n */\nexport const sync = (\n path: string,\n options: IsexeOptions = {},\n): boolean => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(statSync(path), options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\nconst checkStat = (stat: Stats, options: IsexeOptions) =>\n stat.isFile() && checkMode(stat, options)\n\nconst checkMode = (stat: Stats, options: IsexeOptions) => {\n const myUid = options.uid ?? process.getuid?.()\n const myGroups = options.groups ?? process.getgroups?.() ?? []\n const myGid = options.gid ?? process.getgid?.() ?? myGroups[0]\n if (myUid === undefined || myGid === undefined) {\n throw new Error('cannot get uid or gid')\n }\n\n const groups = new Set([myGid, ...myGroups])\n\n const mod = stat.mode\n const uid = stat.uid\n const gid = stat.gid\n\n const u = parseInt('100', 8)\n const g = parseInt('010', 8)\n const o = parseInt('001', 8)\n const ug = u | g\n\n return !!(\n mod & o ||\n (mod & g && groups.has(gid)) ||\n (mod & u && uid === myUid) ||\n (mod & ug && myUid === 0)\n )\n}\n", "/**\n * This is the Windows implementation of isexe, which uses the file\n * extension and PATHEXT setting.\n *\n * @module\n */\n\nimport { Stats, statSync } from 'node:fs'\nimport { stat } from 'node:fs/promises'\nimport { IsexeOptions } from './options.js'\nimport { delimiter } from 'node:path'\n\n/**\n * Determine whether a path is executable based on the file extension\n * and PATHEXT environment variable (or specified pathExt option)\n */\nexport const isexe = async (\n path: string,\n options: IsexeOptions = {},\n): Promise => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(await stat(path), path, options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\n/**\n * Synchronously determine whether a path is executable based on the file\n * extension and PATHEXT environment variable (or specified pathExt option)\n */\nexport const sync = (\n path: string,\n options: IsexeOptions = {},\n): boolean => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(statSync(path), path, options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\nconst checkPathExt = (path: string, options: IsexeOptions) => {\n const { pathExt = process.env.PATHEXT || '' } = options\n const peSplit = pathExt.split(delimiter)\n if (peSplit.indexOf('') !== -1) {\n return true\n }\n\n for (const pes of peSplit) {\n const p = pes.toLowerCase()\n const ext = path.substring(path.length - p.length).toLowerCase()\n\n if (p && ext === p) {\n return true\n }\n }\n return false\n}\n\nconst checkStat = (stat: Stats, path: string, options: IsexeOptions) =>\n stat.isFile() && checkPathExt(path, options)\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=options.js.map", "import * as posix from './posix.js'\nimport * as win32 from './win32.js'\nexport * from './options.js'\nexport { win32, posix }\n\nconst platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform\nconst impl = platform === 'win32' ? win32 : posix\n\n/**\n * Determine whether a path is executable on the current platform.\n */\nexport const isexe = impl.isexe\n/**\n * Synchronously determine whether a path is executable on the\n * current platform.\n */\nexport const sync = impl.sync\n"], + "mappings": "2KAOA,IAAAA,EAAA,QAAA,SAAA,EACAC,EAAA,QAAA,kBAAA,EAOaC,EAAQ,MACnBC,EACAC,EAAwB,CAAA,IACJ,CACpB,GAAM,CAAE,aAAAC,EAAe,EAAK,EAAKD,EACjC,GAAI,CACF,OAAOE,EAAU,QAAML,EAAA,MAAKE,CAAI,EAAGC,CAAO,CAC5C,OAASG,EAAG,CACV,IAAMC,EAAKD,EACX,GAAIF,GAAgBG,EAAG,OAAS,SAAU,MAAO,GACjD,MAAMA,CACR,CACF,EAZaC,EAAA,MAAKP,EAkBX,IAAMQ,EAAO,CAClBP,EACAC,EAAwB,CAAA,IACb,CACX,GAAM,CAAE,aAAAC,EAAe,EAAK,EAAKD,EACjC,GAAI,CACF,OAAOE,KAAUN,EAAA,UAASG,CAAI,EAAGC,CAAO,CAC1C,OAASG,EAAG,CACV,IAAMC,EAAKD,EACX,GAAIF,GAAgBG,EAAG,OAAS,SAAU,MAAO,GACjD,MAAMA,CACR,CACF,EAZaC,EAAA,KAAIC,EAcjB,IAAMJ,EAAY,CAACK,EAAaP,IAC9BO,EAAK,OAAM,GAAMC,EAAUD,EAAMP,CAAO,EAEpCQ,EAAY,CAACD,EAAaP,IAAyB,CACvD,IAAMS,EAAQT,EAAQ,KAAO,QAAQ,SAAQ,EACvCU,EAAWV,EAAQ,QAAU,QAAQ,YAAW,GAAM,CAAA,EACtDW,EAAQX,EAAQ,KAAO,QAAQ,SAAQ,GAAMU,EAAS,CAAC,EAC7D,GAAID,IAAU,QAAaE,IAAU,OACnC,MAAM,IAAI,MAAM,uBAAuB,EAGzC,IAAMC,EAAS,IAAI,IAAI,CAACD,EAAO,GAAGD,CAAQ,CAAC,EAErCG,EAAMN,EAAK,KACXO,EAAMP,EAAK,IACXQ,EAAMR,EAAK,IAEXS,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AW,EAE9D,GAAIA,GAAKC,IAAQD,EACf,MAAO,EAEX,CACA,MAAO,EACT,EAEMT,EAAY,CAACW,EAAad,EAAcC,IAC5Ca,EAAK,OAAM,GAAMN,EAAaR,EAAMC,CAAO,ICnE7C,IAAAc,EAAAC,EAAAC,GAAA,cACA,OAAO,eAAeA,EAAS,aAAc,CAAE,MAAO,EAAK,CAAC,ykCCD5D,IAAAC,EAAAC,EAAA,GAAA,EAGgB,QAAA,MAAAD,EAFhB,IAAAE,EAAAD,EAAA,GAAA,EAES,QAAA,MAAAC,EADTC,EAAA,IAAA,OAAA,EAGA,IAAMC,EAAW,QAAQ,IAAI,uBAAyB,QAAQ,SACxDC,EAAOD,IAAa,QAAUF,EAAQF,EAK/B,QAAA,MAAQK,EAAK,MAKb,QAAA,KAAOA,EAAK", + "names": ["node_fs_1", "promises_1", "isexe", "path", "options", "ignoreErrors", "checkStat", "e", "er", "exports", "sync", "stat", "checkMode", "myUid", "myGroups", "myGid", "groups", "mod", "uid", "gid", "u", "g", "o", "ug", "node_fs_1", "promises_1", "node_path_1", "isexe", "path", "options", "ignoreErrors", "checkStat", "e", "er", "exports", "sync", "checkPathExt", "pathExt", "peSplit", "pes", "p", "ext", "stat", "require_options", "__commonJSMin", "exports", "posix", "__importStar", "win32", "__exportStar", "platform", "impl"] +} diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/options.d.ts b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/options.d.ts new file mode 100644 index 0000000..c30a29b --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/options.d.ts @@ -0,0 +1,32 @@ +export interface IsexeOptions { + /** + * Ignore errors arising from attempting to get file access status + * Note that EACCES is always ignored, because that just means + * it's not executable. If this is not set, then attempting to check + * the executable-ness of a nonexistent file will raise ENOENT, for + * example. + */ + ignoreErrors?: boolean; + /** + * effective uid when checking executable mode flags on posix + * Defaults to process.getuid() + */ + uid?: number; + /** + * effective gid when checking executable mode flags on posix + * Defaults to process.getgid() + */ + gid?: number; + /** + * effective group ID list to use when checking executable mode flags + * on posix + * Defaults to process.getgroups() + */ + groups?: number[]; + /** + * The ;-delimited path extension list for win32 implementation. + * Defaults to process.env.PATHEXT + */ + pathExt?: string; +} +//# sourceMappingURL=options.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/options.d.ts.map b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/options.d.ts.map new file mode 100644 index 0000000..952afdb --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/options.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/options.js b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/options.js new file mode 100644 index 0000000..0dfad07 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/options.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/options.js.map b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/options.js.map new file mode 100644 index 0000000..27bbeac --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/options.js.map @@ -0,0 +1 @@ +{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"","sourcesContent":["export interface IsexeOptions {\n /**\n * Ignore errors arising from attempting to get file access status\n * Note that EACCES is always ignored, because that just means\n * it's not executable. If this is not set, then attempting to check\n * the executable-ness of a nonexistent file will raise ENOENT, for\n * example.\n */\n ignoreErrors?: boolean\n\n /**\n * effective uid when checking executable mode flags on posix\n * Defaults to process.getuid()\n */\n uid?: number\n\n /**\n * effective gid when checking executable mode flags on posix\n * Defaults to process.getgid()\n */\n gid?: number\n\n /**\n * effective group ID list to use when checking executable mode flags\n * on posix\n * Defaults to process.getgroups()\n */\n groups?: number[]\n\n /**\n * The ;-delimited path extension list for win32 implementation.\n * Defaults to process.env.PATHEXT\n */\n pathExt?: string\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/package.json b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/package.json new file mode 100644 index 0000000..5bbefff --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/posix.d.ts b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/posix.d.ts new file mode 100644 index 0000000..04874a1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/posix.d.ts @@ -0,0 +1,18 @@ +/** + * This is the Posix implementation of isexe, which uses the file + * mode and uid/gid values. + * + * @module + */ +import { IsexeOptions } from './options.js'; +/** + * Determine whether a path is executable according to the mode and + * current (or specified) user and group IDs. + */ +export declare const isexe: (path: string, options?: IsexeOptions) => Promise; +/** + * Synchronously determine whether a path is executable according to + * the mode and current (or specified) user and group IDs. + */ +export declare const sync: (path: string, options?: IsexeOptions) => boolean; +//# sourceMappingURL=posix.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/posix.d.ts.map b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/posix.d.ts.map new file mode 100644 index 0000000..05bee58 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/posix.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"posix.d.ts","sourceRoot":"","sources":["../../src/posix.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C;;;GAGG;AACH,eAAO,MAAM,KAAK,GAChB,MAAM,MAAM,EACZ,UAAS,YAAiB,KACzB,OAAO,CAAC,OAAO,CASjB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,IAAI,GACf,MAAM,MAAM,EACZ,UAAS,YAAiB,KACzB,OASF,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/posix.js b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/posix.js new file mode 100644 index 0000000..c6b9f63 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/posix.js @@ -0,0 +1,67 @@ +"use strict"; +/** + * This is the Posix implementation of isexe, which uses the file + * mode and uid/gid values. + * + * @module + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sync = exports.isexe = void 0; +const node_fs_1 = require("node:fs"); +const promises_1 = require("node:fs/promises"); +/** + * Determine whether a path is executable according to the mode and + * current (or specified) user and group IDs. + */ +const isexe = async (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(await (0, promises_1.stat)(path), options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +exports.isexe = isexe; +/** + * Synchronously determine whether a path is executable according to + * the mode and current (or specified) user and group IDs. + */ +const sync = (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat((0, node_fs_1.statSync)(path), options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +exports.sync = sync; +const checkStat = (stat, options) => stat.isFile() && checkMode(stat, options); +const checkMode = (stat, options) => { + const myUid = options.uid ?? process.getuid?.(); + const myGroups = options.groups ?? process.getgroups?.() ?? []; + const myGid = options.gid ?? process.getgid?.() ?? myGroups[0]; + if (myUid === undefined || myGid === undefined) { + throw new Error('cannot get uid or gid'); + } + const groups = new Set([myGid, ...myGroups]); + const mod = stat.mode; + const uid = stat.uid; + const gid = stat.gid; + const u = parseInt('100', 8); + const g = parseInt('010', 8); + const o = parseInt('001', 8); + const ug = u | g; + return !!(mod & o || + (mod & g && groups.has(gid)) || + (mod & u && uid === myUid) || + (mod & ug && myUid === 0)); +}; +//# sourceMappingURL=posix.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/posix.js.map b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/posix.js.map new file mode 100644 index 0000000..d49db48 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/posix.js.map @@ -0,0 +1 @@ +{"version":3,"file":"posix.js","sourceRoot":"","sources":["../../src/posix.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,qCAAyC;AACzC,+CAAuC;AAGvC;;;GAGG;AACI,MAAM,KAAK,GAAG,KAAK,EACxB,IAAY,EACZ,UAAwB,EAAE,EACR,EAAE;IACpB,MAAM,EAAE,YAAY,GAAG,KAAK,EAAE,GAAG,OAAO,CAAA;IACxC,IAAI,CAAC;QACH,OAAO,SAAS,CAAC,MAAM,IAAA,eAAI,EAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAA;IAC7C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,EAAE,GAAG,CAA0B,CAAA;QACrC,IAAI,YAAY,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAA;QACtD,MAAM,EAAE,CAAA;IACV,CAAC;AACH,CAAC,CAAA;AAZY,QAAA,KAAK,SAYjB;AAED;;;GAGG;AACI,MAAM,IAAI,GAAG,CAClB,IAAY,EACZ,UAAwB,EAAE,EACjB,EAAE;IACX,MAA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I,CAAC,GAAG,CAAA;IAEpB,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IAC5B,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IAC5B,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IAC5B,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAA;IAEhB,OAAO,CAAC,CAAC,CACP,GAAG,GAAG,CAAC;QACP,CAAC,GAAG,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC,GAAG,GAAG,CAAC,IAAI,GAAG,KAAK,KAAK,CAAC;QAC1B,CAAC,GAAG,GAAG,EAAE,IAAI,KAAK,KAAK,CAAC,CAAC,CAC1B,CAAA;AACH,CAAC,CAAA","sourcesContent":["/**\n * This is the Posix implementation of isexe, which uses the file\n * mode and uid/gid values.\n *\n * @module\n */\n\nimport { Stats, statSync } from 'node:fs'\nimport { stat } from 'node:fs/promises'\nimport { IsexeOptions } from './options.js'\n\n/**\n * Determine whether a path is executable according to the mode and\n * current (or specified) user and group IDs.\n */\nexport const isexe = async (\n path: string,\n options: IsexeOptions = {},\n): Promise => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(await stat(path), options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\n/**\n * Synchronously determine whether a path is executable according to\n * the mode and current (or specified) user and group IDs.\n */\nexport const sync = (\n path: string,\n options: IsexeOptions = {},\n): boolean => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(statSync(path), options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\nconst checkStat = (stat: Stats, options: IsexeOptions) =>\n stat.isFile() && checkMode(stat, options)\n\nconst checkMode = (stat: Stats, options: IsexeOptions) => {\n const myUid = options.uid ?? process.getuid?.()\n const myGroups = options.groups ?? process.getgroups?.() ?? []\n const myGid = options.gid ?? process.getgid?.() ?? myGroups[0]\n if (myUid === undefined || myGid === undefined) {\n throw new Error('cannot get uid or gid')\n }\n\n const groups = new Set([myGid, ...myGroups])\n\n const mod = stat.mode\n const uid = stat.uid\n const gid = stat.gid\n\n const u = parseInt('100', 8)\n const g = parseInt('010', 8)\n const o = parseInt('001', 8)\n const ug = u | g\n\n return !!(\n mod & o ||\n (mod & g && groups.has(gid)) ||\n (mod & u && uid === myUid) ||\n (mod & ug && myUid === 0)\n )\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/win32.d.ts b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/win32.d.ts new file mode 100644 index 0000000..e3f68d1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/win32.d.ts @@ -0,0 +1,18 @@ +/** + * This is the Windows implementation of isexe, which uses the file + * extension and PATHEXT setting. + * + * @module + */ +import { IsexeOptions } from './options.js'; +/** + * Determine whether a path is executable based on the file extension + * and PATHEXT environment variable (or specified pathExt option) + */ +export declare const isexe: (path: string, options?: IsexeOptions) => Promise; +/** + * Synchronously determine whether a path is executable based on the file + * extension and PATHEXT environment variable (or specified pathExt option) + */ +export declare const sync: (path: string, options?: IsexeOptions) => boolean; +//# sourceMappingURL=win32.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/win32.d.ts.map b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/win32.d.ts.map new file mode 100644 index 0000000..33b22e2 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/win32.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"win32.d.ts","sourceRoot":"","sources":["../../src/win32.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAG3C;;;GAGG;AACH,eAAO,MAAM,KAAK,GAChB,MAAM,MAAM,EACZ,UAAS,YAAiB,KACzB,OAAO,CAAC,OAAO,CASjB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,IAAI,GACf,MAAM,MAAM,EACZ,UAAS,YAAiB,KACzB,OASF,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/win32.js b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/win32.js new file mode 100644 index 0000000..c1524a1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/win32.js @@ -0,0 +1,63 @@ +"use strict"; +/** + * This is the Windows implementation of isexe, which uses the file + * extension and PATHEXT setting. + * + * @module + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sync = exports.isexe = void 0; +const node_fs_1 = require("node:fs"); +const promises_1 = require("node:fs/promises"); +const node_path_1 = require("node:path"); +/** + * Determine whether a path is executable based on the file extension + * and PATHEXT environment variable (or specified pathExt option) + */ +const isexe = async (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(await (0, promises_1.stat)(path), path, options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +exports.isexe = isexe; +/** + * Synchronously determine whether a path is executable based on the file + * extension and PATHEXT environment variable (or specified pathExt option) + */ +const sync = (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat((0, node_fs_1.statSync)(path), path, options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +exports.sync = sync; +const checkPathExt = (path, options) => { + const { pathExt = process.env.PATHEXT || '' } = options; + const peSplit = pathExt.split(node_path_1.delimiter); + if (peSplit.indexOf('') !== -1) { + return true; + } + for (const pes of peSplit) { + const p = pes.toLowerCase(); + const ext = path.substring(path.length - p.length).toLowerCase(); + if (p && ext === p) { + return true; + } + } + return false; +}; +const checkStat = (stat, path, options) => stat.isFile() && checkPathExt(path, options); +//# sourceMappingURL=win32.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/commonjs/win32.js.map b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/win32.js.map new file mode 100644 index 0000000..98e59e1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/commonjs/win32.js.map @@ -0,0 +1 @@ +{"version":3,"file":"win32.js","sourceRoot":"","sources":["../../src/win32.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,qCAAyC;AACzC,+CAAuC;AAEvC,yCAAqC;AAErC;;;GAGG;AACI,MAAM,KAAK,GAAG,KAAK,EACxB,IAAY,EACZ,UAAwB,EAAE,EACR,EAAE;IACpB,MAAM,EAAE,YAAY,GAAG,KAAK,EAAE,GAAG,OAAO,CAAA;IACxC,IAAI,CAAC;QACH,OAAO,SAAS,CAAC,MAAM,IAAA,eAAI,EAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IACnD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,EAAE,GAAG,CAA0B,CAAA;QACrC,IAAI,YAAY,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAA;QACtD,MAAM,EAAE,CAAA;IACV,CAAC;AACH,CAAC,CAAA;AAZY,QAAA,KAAK,SAYjB;AAED;;;GAGG;AACI,MAAM,IAAI,GAAG,CAClB,IAAY,EACZ,UAAwB,EAAE,EACjB,EAAE;IACX,MAAM,EAAE,YAAY,GAAG,KAAK,EAAE,GAAG,OAAO,CAAA;IACxC,IAAI,CAAC;QACH,OAAO,SAAS,CAAC,IAAA,kBAAQ,EAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,EAAE,GAAG,CAA0B,CAAA;QACrC,IAAI,YAAY,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAA;QACtD,MAAM,EAAE,CAAA;IACV,CAAC;AACH,CAAC,CAAA;AAZY,QAAA,IAAI,QAYhB;AAED,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,OAAqB,EAAE,EAAE;IAC3D,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,EAAE,GAAG,OAAO,CAAA;IACvD,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,qBAAS,CAAC,CAAA;IACxC,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,EAAE,CAAA;QAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAA;QAEhE,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;YACnB,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,IAAW,EAAE,IAAY,EAAE,OAAqB,EAAE,EAAE,CACrE,IAAI,CAAC,MAAM,EAAE,IAAI,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA","sourcesContent":["/**\n * This is the Windows implementation of isexe, which uses the file\n * extension and PATHEXT setting.\n *\n * @module\n */\n\nimport { Stats, statSync } from 'node:fs'\nimport { stat } from 'node:fs/promises'\nimport { IsexeOptions } from './options.js'\nimport { delimiter } from 'node:path'\n\n/**\n * Determine whether a path is executable based on the file extension\n * and PATHEXT environment variable (or specified pathExt option)\n */\nexport const isexe = async (\n path: string,\n options: IsexeOptions = {},\n): Promise => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(await stat(path), path, options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\n/**\n * Synchronously determine whether a path is executable based on the file\n * extension and PATHEXT environment variable (or specified pathExt option)\n */\nexport const sync = (\n path: string,\n options: IsexeOptions = {},\n): boolean => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(statSync(path), path, options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\nconst checkPathExt = (path: string, options: IsexeOptions) => {\n const { pathExt = process.env.PATHEXT || '' } = options\n const peSplit = pathExt.split(delimiter)\n if (peSplit.indexOf('') !== -1) {\n return true\n }\n\n for (const pes of peSplit) {\n const p = pes.toLowerCase()\n const ext = path.substring(path.length - p.length).toLowerCase()\n\n if (p && ext === p) {\n return true\n }\n }\n return false\n}\n\nconst checkStat = (stat: Stats, path: string, options: IsexeOptions) =>\n stat.isFile() && checkPathExt(path, options)\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/index.d.ts b/node_modules/cmake-js/node_modules/isexe/dist/esm/index.d.ts new file mode 100644 index 0000000..223bf78 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/index.d.ts @@ -0,0 +1,14 @@ +import * as posix from './posix.js'; +import * as win32 from './win32.js'; +export * from './options.js'; +export { win32, posix }; +/** + * Determine whether a path is executable on the current platform. + */ +export declare const isexe: (path: string, options?: import("./options.js").IsexeOptions) => Promise; +/** + * Synchronously determine whether a path is executable on the + * current platform. + */ +export declare const sync: (path: string, options?: import("./options.js").IsexeOptions) => boolean; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/index.d.ts.map b/node_modules/cmake-js/node_modules/isexe/dist/esm/index.d.ts.map new file mode 100644 index 0000000..c90348e --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;AAKvB;;GAEG;AACH,eAAO,MAAM,KAAK,mFAAa,CAAA;AAC/B;;;GAGG;AACH,eAAO,MAAM,IAAI,0EAAY,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/index.js b/node_modules/cmake-js/node_modules/isexe/dist/esm/index.js new file mode 100644 index 0000000..1e309ac --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/index.js @@ -0,0 +1,16 @@ +import * as posix from './posix.js'; +import * as win32 from './win32.js'; +export * from './options.js'; +export { win32, posix }; +const platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform; +const impl = platform === 'win32' ? win32 : posix; +/** + * Determine whether a path is executable on the current platform. + */ +export const isexe = impl.isexe; +/** + * Synchronously determine whether a path is executable on the + * current platform. + */ +export const sync = impl.sync; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/index.js.map b/node_modules/cmake-js/node_modules/isexe/dist/esm/index.js.map new file mode 100644 index 0000000..9b9dfe7 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;AAEvB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,OAAO,CAAC,QAAQ,CAAA;AACtE,MAAM,IAAI,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;AAC/B;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA","sourcesContent":["import * as posix from './posix.js'\nimport * as win32 from './win32.js'\nexport * from './options.js'\nexport { win32, posix }\n\nconst platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform\nconst impl = platform === 'win32' ? win32 : posix\n\n/**\n * Determine whether a path is executable on the current platform.\n */\nexport const isexe = impl.isexe\n/**\n * Synchronously determine whether a path is executable on the\n * current platform.\n */\nexport const sync = impl.sync\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/index.min.js b/node_modules/cmake-js/node_modules/isexe/dist/esm/index.min.js new file mode 100644 index 0000000..f3a6fc3 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/index.min.js @@ -0,0 +1,2 @@ +var y=Object.defineProperty;var u=(t,r)=>{for(var e in r)y(t,e,{get:r[e],enumerable:!0})};var i={};u(i,{isexe:()=>C,sync:()=>A});import{statSync as w}from"node:fs";import{stat as S}from"node:fs/promises";var C=async(t,r={})=>{let{ignoreErrors:e=!1}=r;try{return d(await S(t),r)}catch(s){let o=s;if(e||o.code==="EACCES")return!1;throw o}},A=(t,r={})=>{let{ignoreErrors:e=!1}=r;try{return d(w(t),r)}catch(s){let o=s;if(e||o.code==="EACCES")return!1;throw o}},d=(t,r)=>t.isFile()&&T(t,r),T=(t,r)=>{let e=r.uid??process.getuid?.(),s=r.groups??process.getgroups?.()??[],o=r.gid??process.getgid?.()??s[0];if(e===void 0||o===void 0)throw new Error("cannot get uid or gid");let c=new Set([o,...s]),n=t.mode,l=t.uid,E=t.gid,f=parseInt("100",8),p=parseInt("010",8),x=parseInt("001",8),h=f|p;return!!(n&x||n&p&&c.has(E)||n&f&&l===e||n&h&&e===0)};var a={};u(a,{isexe:()=>F,sync:()=>L});import{statSync as k}from"node:fs";import{stat as I}from"node:fs/promises";import{delimiter as _}from"node:path";var F=async(t,r={})=>{let{ignoreErrors:e=!1}=r;try{return m(await I(t),t,r)}catch(s){let o=s;if(e||o.code==="EACCES")return!1;throw o}},L=(t,r={})=>{let{ignoreErrors:e=!1}=r;try{return m(k(t),t,r)}catch(s){let o=s;if(e||o.code==="EACCES")return!1;throw o}},P=(t,r)=>{let{pathExt:e=process.env.PATHEXT||""}=r,s=e.split(_);if(s.indexOf("")!==-1)return!0;for(let o of s){let c=o.toLowerCase(),n=t.substring(t.length-c.length).toLowerCase();if(c&&n===c)return!0}return!1},m=(t,r,e)=>t.isFile()&&P(r,e);var v=process.env._ISEXE_TEST_PLATFORM_||process.platform,g=v==="win32"?a:i,R=g.isexe,U=g.sync;export{R as isexe,i as posix,U as sync,a as win32}; +//# sourceMappingURL=index.min.js.map diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/index.min.js.map b/node_modules/cmake-js/node_modules/isexe/dist/esm/index.min.js.map new file mode 100644 index 0000000..0557840 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/index.min.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../src/posix.ts", "../../src/win32.ts", "../../src/index.ts"], + "sourcesContent": ["/**\n * This is the Posix implementation of isexe, which uses the file\n * mode and uid/gid values.\n *\n * @module\n */\n\nimport { Stats, statSync } from 'node:fs'\nimport { stat } from 'node:fs/promises'\nimport { IsexeOptions } from './options.js'\n\n/**\n * Determine whether a path is executable according to the mode and\n * current (or specified) user and group IDs.\n */\nexport const isexe = async (\n path: string,\n options: IsexeOptions = {},\n): Promise => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(await stat(path), options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\n/**\n * Synchronously determine whether a path is executable according to\n * the mode and current (or specified) user and group IDs.\n */\nexport const sync = (\n path: string,\n options: IsexeOptions = {},\n): boolean => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(statSync(path), options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\nconst checkStat = (stat: Stats, options: IsexeOptions) =>\n stat.isFile() && checkMode(stat, options)\n\nconst checkMode = (stat: Stats, options: IsexeOptions) => {\n const myUid = options.uid ?? process.getuid?.()\n const myGroups = options.groups ?? process.getgroups?.() ?? []\n const myGid = options.gid ?? process.getgid?.() ?? myGroups[0]\n if (myUid === undefined || myGid === undefined) {\n throw new Error('cannot get uid or gid')\n }\n\n const groups = new Set([myGid, ...myGroups])\n\n const mod = stat.mode\n const uid = stat.uid\n const gid = stat.gid\n\n const u = parseInt('100', 8)\n const g = parseInt('010', 8)\n const o = parseInt('001', 8)\n const ug = u | g\n\n return !!(\n mod & o ||\n (mod & g && groups.has(gid)) ||\n (mod & u && uid === myUid) ||\n (mod & ug && myUid === 0)\n )\n}\n", "/**\n * This is the Windows implementation of isexe, which uses the file\n * extension and PATHEXT setting.\n *\n * @module\n */\n\nimport { Stats, statSync } from 'node:fs'\nimport { stat } from 'node:fs/promises'\nimport { IsexeOptions } from './options.js'\nimport { delimiter } from 'node:path'\n\n/**\n * Determine whether a path is executable based on the file extension\n * and PATHEXT environment variable (or specified pathExt option)\n */\nexport const isexe = async (\n path: string,\n options: IsexeOptions = {},\n): Promise => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(await stat(path), path, options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\n/**\n * Synchronously determine whether a path is executable based on the file\n * extension and PATHEXT environment variable (or specified pathExt option)\n */\nexport const sync = (\n path: string,\n options: IsexeOptions = {},\n): boolean => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(statSync(path), path, options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\nconst checkPathExt = (path: string, options: IsexeOptions) => {\n const { pathExt = process.env.PATHEXT || '' } = options\n const peSplit = pathExt.split(delimiter)\n if (peSplit.indexOf('') !== -1) {\n return true\n }\n\n for (const pes of peSplit) {\n const p = pes.toLowerCase()\n const ext = path.substring(path.length - p.length).toLowerCase()\n\n if (p && ext === p) {\n return true\n }\n }\n return false\n}\n\nconst checkStat = (stat: Stats, path: string, options: IsexeOptions) =>\n stat.isFile() && checkPathExt(path, options)\n", "import * as posix from './posix.js'\nimport * as win32 from './win32.js'\nexport * from './options.js'\nexport { win32, posix }\n\nconst platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform\nconst impl = platform === 'win32' ? win32 : posix\n\n/**\n * Determine whether a path is executable on the current platform.\n */\nexport const isexe = impl.isexe\n/**\n * Synchronously determine whether a path is executable on the\n * current platform.\n */\nexport const sync = impl.sync\n"], + "mappings": "0FAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,SAAAC,IAOA,OAAgB,YAAAC,MAAgB,UAChC,OAAS,QAAAC,MAAY,mBAOd,IAAMH,EAAQ,MACnBI,EACAC,EAAwB,CAAA,IACJ,CACpB,GAAM,CAAE,aAAAC,EAAe,EAAK,EAAKD,EACjC,GAAI,CACF,OAAOE,EAAU,MAAMJ,EAAKC,CAAI,EAAGC,CAAO,CAC5C,OAASG,EAAG,CACV,IAAMC,EAAKD,EACX,GAAIF,GAAgBG,EAAG,OAAS,SAAU,MAAO,GACjD,MAAMA,CACR,CACF,EAMaR,EAAO,CAClBG,EACAC,EAAwB,CAAA,IACb,CACX,GAAM,CAAE,aAAAC,EAAe,EAAK,EAAKD,EACjC,GAAI,CACF,OAAOE,EAAUL,EAASE,CAAI,EAAGC,CAAO,CAC1C,OAASG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EAAO,CAClBI,EACAC,EAAwB,CAAA,IACb,CACX,GAAM,CAAE,aAAAC,EAAe,EAAK,EAAKD,EACjC,GAAI,CACF,OAAOE,EAAUN,EAASG,CAAI,EAAGA,EAAMC,CAAO,CAChD,OAASG,EAAG,CACV,IAAMC,EAAKD,EACX,GAAIF,GAAgBG,EAAG,OAAS,SAAU,MAAO,GACjD,MAAMA,CACR,CACF,EAEMC,EAAe,CAACN,EAAcC,IAAyB,CAC3D,GAAM,CAAE,QAAAM,EAAU,QAAQ,IAAI,SAAW,EAAE,EAAKN,EAC1CO,EAAUD,EAAQ,MAAMR,CAAS,EACvC,GAAIS,EAAQ,QAAQ,EAAE,IAAM,GAC1B,MAAO,GAGT,QAAWC,KAAOD,EAAS,CACzB,IAAME,EAAID,EAAI,YAAW,EACnBE,EAAMX,EAAK,UAAUA,EAAK,OAASU,EAAE,MAAM,EAAE,YAAW,EAE9D,GAAIA,GAAKC,IAAQD,EACf,MAAO,EAEX,CACA,MAAO,EACT,EAEMP,EAAY,CAACL,EAAaE,EAAcC,IAC5CH,EAAK,OAAM,GAAMQ,EAAaN,EAAMC,CAAO,EC9D7C,IAAMW,EAAW,QAAQ,IAAI,uBAAyB,QAAQ,SACxDC,EAAOD,IAAa,QAAUE,EAAQC,EAK/BC,EAAQH,EAAK,MAKbI,EAAOJ,EAAK", + "names": ["posix_exports", "__export", "isexe", "sync", "statSync", "stat", "path", "options", "ignoreErrors", "checkStat", "e", "er", "checkMode", "myUid", "myGroups", "myGid", "groups", "mod", "uid", "gid", "u", "g", "o", "ug", "win32_exports", "__export", "isexe", "sync", "statSync", "stat", "delimiter", "path", "options", "ignoreErrors", "checkStat", "e", "er", "checkPathExt", "pathExt", "peSplit", "pes", "p", "ext", "platform", "impl", "win32_exports", "posix_exports", "isexe", "sync"] +} diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/options.d.ts b/node_modules/cmake-js/node_modules/isexe/dist/esm/options.d.ts new file mode 100644 index 0000000..c30a29b --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/options.d.ts @@ -0,0 +1,32 @@ +export interface IsexeOptions { + /** + * Ignore errors arising from attempting to get file access status + * Note that EACCES is always ignored, because that just means + * it's not executable. If this is not set, then attempting to check + * the executable-ness of a nonexistent file will raise ENOENT, for + * example. + */ + ignoreErrors?: boolean; + /** + * effective uid when checking executable mode flags on posix + * Defaults to process.getuid() + */ + uid?: number; + /** + * effective gid when checking executable mode flags on posix + * Defaults to process.getgid() + */ + gid?: number; + /** + * effective group ID list to use when checking executable mode flags + * on posix + * Defaults to process.getgroups() + */ + groups?: number[]; + /** + * The ;-delimited path extension list for win32 implementation. + * Defaults to process.env.PATHEXT + */ + pathExt?: string; +} +//# sourceMappingURL=options.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/options.d.ts.map b/node_modules/cmake-js/node_modules/isexe/dist/esm/options.d.ts.map new file mode 100644 index 0000000..952afdb --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/options.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/options.js b/node_modules/cmake-js/node_modules/isexe/dist/esm/options.js new file mode 100644 index 0000000..e9ded40 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/options.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/options.js.map b/node_modules/cmake-js/node_modules/isexe/dist/esm/options.js.map new file mode 100644 index 0000000..27bbeac --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/options.js.map @@ -0,0 +1 @@ +{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"","sourcesContent":["export interface IsexeOptions {\n /**\n * Ignore errors arising from attempting to get file access status\n * Note that EACCES is always ignored, because that just means\n * it's not executable. If this is not set, then attempting to check\n * the executable-ness of a nonexistent file will raise ENOENT, for\n * example.\n */\n ignoreErrors?: boolean\n\n /**\n * effective uid when checking executable mode flags on posix\n * Defaults to process.getuid()\n */\n uid?: number\n\n /**\n * effective gid when checking executable mode flags on posix\n * Defaults to process.getgid()\n */\n gid?: number\n\n /**\n * effective group ID list to use when checking executable mode flags\n * on posix\n * Defaults to process.getgroups()\n */\n groups?: number[]\n\n /**\n * The ;-delimited path extension list for win32 implementation.\n * Defaults to process.env.PATHEXT\n */\n pathExt?: string\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/package.json b/node_modules/cmake-js/node_modules/isexe/dist/esm/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/posix.d.ts b/node_modules/cmake-js/node_modules/isexe/dist/esm/posix.d.ts new file mode 100644 index 0000000..04874a1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/posix.d.ts @@ -0,0 +1,18 @@ +/** + * This is the Posix implementation of isexe, which uses the file + * mode and uid/gid values. + * + * @module + */ +import { IsexeOptions } from './options.js'; +/** + * Determine whether a path is executable according to the mode and + * current (or specified) user and group IDs. + */ +export declare const isexe: (path: string, options?: IsexeOptions) => Promise; +/** + * Synchronously determine whether a path is executable according to + * the mode and current (or specified) user and group IDs. + */ +export declare const sync: (path: string, options?: IsexeOptions) => boolean; +//# sourceMappingURL=posix.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/posix.d.ts.map b/node_modules/cmake-js/node_modules/isexe/dist/esm/posix.d.ts.map new file mode 100644 index 0000000..05bee58 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/posix.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"posix.d.ts","sourceRoot":"","sources":["../../src/posix.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C;;;GAGG;AACH,eAAO,MAAM,KAAK,GAChB,MAAM,MAAM,EACZ,UAAS,YAAiB,KACzB,OAAO,CAAC,OAAO,CASjB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,IAAI,GACf,MAAM,MAAM,EACZ,UAAS,YAAiB,KACzB,OASF,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/posix.js b/node_modules/cmake-js/node_modules/isexe/dist/esm/posix.js new file mode 100644 index 0000000..f1af6d5 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/posix.js @@ -0,0 +1,62 @@ +/** + * This is the Posix implementation of isexe, which uses the file + * mode and uid/gid values. + * + * @module + */ +import { statSync } from 'node:fs'; +import { stat } from 'node:fs/promises'; +/** + * Determine whether a path is executable according to the mode and + * current (or specified) user and group IDs. + */ +export const isexe = async (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(await stat(path), options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +/** + * Synchronously determine whether a path is executable according to + * the mode and current (or specified) user and group IDs. + */ +export const sync = (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(statSync(path), options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +const checkStat = (stat, options) => stat.isFile() && checkMode(stat, options); +const checkMode = (stat, options) => { + const myUid = options.uid ?? process.getuid?.(); + const myGroups = options.groups ?? process.getgroups?.() ?? []; + const myGid = options.gid ?? process.getgid?.() ?? myGroups[0]; + if (myUid === undefined || myGid === undefined) { + throw new Error('cannot get uid or gid'); + } + const groups = new Set([myGid, ...myGroups]); + const mod = stat.mode; + const uid = stat.uid; + const gid = stat.gid; + const u = parseInt('100', 8); + const g = parseInt('010', 8); + const o = parseInt('001', 8); + const ug = u | g; + return !!(mod & o || + (mod & g && groups.has(gid)) || + (mod & u && uid === myUid) || + (mod & ug && myUid === 0)); +}; +//# sourceMappingURL=posix.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/posix.js.map b/node_modules/cmake-js/node_modules/isexe/dist/esm/posix.js.map new file mode 100644 index 0000000..5fc3646 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/posix.js.map @@ -0,0 +1 @@ +{"version":3,"file":"posix.js","sourceRoot":"","sources":["../../src/posix.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAS,QAAQ,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAGvC;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EACxB,IAAY,EACZ,UAAwB,EAAE,EACR,EAAE;IACpB,MAAM,EAAE,YAAY,GAAG,KAAK,EAAE,GAAG,OAAO,CAAA;IACxC,IAAI,CAAC;QACH,OAAO,SAAS,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAA;IAC7C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,EAAE,GAAG,CAA0B,CAAA;QACrC,IAAI,YAAY,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAA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5C,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAA;IACrB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAA;IACpB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAA;IAEpB,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IAC5B,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IAC5B,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IAC5B,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAA;IAEhB,OAAO,CAAC,CAAC,CACP,GAAG,GAAG,CAAC;QACP,CAAC,GAAG,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC,GAAG,GAAG,CAAC,IAAI,GAAG,KAAK,KAAK,CAAC;QAC1B,CAAC,GAAG,GAAG,EAAE,IAAI,KAAK,KAAK,CAAC,CAAC,CAC1B,CAAA;AACH,CAAC,CAAA","sourcesContent":["/**\n * This is the Posix implementation of isexe, which uses the file\n * mode and uid/gid values.\n *\n * @module\n */\n\nimport { Stats, statSync } from 'node:fs'\nimport { stat } from 'node:fs/promises'\nimport { IsexeOptions } from './options.js'\n\n/**\n * Determine whether a path is executable according to the mode and\n * current (or specified) user and group IDs.\n */\nexport const isexe = async (\n path: string,\n options: IsexeOptions = {},\n): Promise => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(await stat(path), options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\n/**\n * Synchronously determine whether a path is executable according to\n * the mode and current (or specified) user and group IDs.\n */\nexport const sync = (\n path: string,\n options: IsexeOptions = {},\n): boolean => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(statSync(path), options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\nconst checkStat = (stat: Stats, options: IsexeOptions) =>\n stat.isFile() && checkMode(stat, options)\n\nconst checkMode = (stat: Stats, options: IsexeOptions) => {\n const myUid = options.uid ?? process.getuid?.()\n const myGroups = options.groups ?? process.getgroups?.() ?? []\n const myGid = options.gid ?? process.getgid?.() ?? myGroups[0]\n if (myUid === undefined || myGid === undefined) {\n throw new Error('cannot get uid or gid')\n }\n\n const groups = new Set([myGid, ...myGroups])\n\n const mod = stat.mode\n const uid = stat.uid\n const gid = stat.gid\n\n const u = parseInt('100', 8)\n const g = parseInt('010', 8)\n const o = parseInt('001', 8)\n const ug = u | g\n\n return !!(\n mod & o ||\n (mod & g && groups.has(gid)) ||\n (mod & u && uid === myUid) ||\n (mod & ug && myUid === 0)\n )\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/win32.d.ts b/node_modules/cmake-js/node_modules/isexe/dist/esm/win32.d.ts new file mode 100644 index 0000000..e3f68d1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/win32.d.ts @@ -0,0 +1,18 @@ +/** + * This is the Windows implementation of isexe, which uses the file + * extension and PATHEXT setting. + * + * @module + */ +import { IsexeOptions } from './options.js'; +/** + * Determine whether a path is executable based on the file extension + * and PATHEXT environment variable (or specified pathExt option) + */ +export declare const isexe: (path: string, options?: IsexeOptions) => Promise; +/** + * Synchronously determine whether a path is executable based on the file + * extension and PATHEXT environment variable (or specified pathExt option) + */ +export declare const sync: (path: string, options?: IsexeOptions) => boolean; +//# sourceMappingURL=win32.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/win32.d.ts.map b/node_modules/cmake-js/node_modules/isexe/dist/esm/win32.d.ts.map new file mode 100644 index 0000000..33b22e2 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/win32.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"win32.d.ts","sourceRoot":"","sources":["../../src/win32.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAG3C;;;GAGG;AACH,eAAO,MAAM,KAAK,GAChB,MAAM,MAAM,EACZ,UAAS,YAAiB,KACzB,OAAO,CAAC,OAAO,CASjB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,IAAI,GACf,MAAM,MAAM,EACZ,UAAS,YAAiB,KACzB,OASF,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/win32.js b/node_modules/cmake-js/node_modules/isexe/dist/esm/win32.js new file mode 100644 index 0000000..2c75e67 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/win32.js @@ -0,0 +1,58 @@ +/** + * This is the Windows implementation of isexe, which uses the file + * extension and PATHEXT setting. + * + * @module + */ +import { statSync } from 'node:fs'; +import { stat } from 'node:fs/promises'; +import { delimiter } from 'node:path'; +/** + * Determine whether a path is executable based on the file extension + * and PATHEXT environment variable (or specified pathExt option) + */ +export const isexe = async (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(await stat(path), path, options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +/** + * Synchronously determine whether a path is executable based on the file + * extension and PATHEXT environment variable (or specified pathExt option) + */ +export const sync = (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(statSync(path), path, options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +const checkPathExt = (path, options) => { + const { pathExt = process.env.PATHEXT || '' } = options; + const peSplit = pathExt.split(delimiter); + if (peSplit.indexOf('') !== -1) { + return true; + } + for (const pes of peSplit) { + const p = pes.toLowerCase(); + const ext = path.substring(path.length - p.length).toLowerCase(); + if (p && ext === p) { + return true; + } + } + return false; +}; +const checkStat = (stat, path, options) => stat.isFile() && checkPathExt(path, options); +//# sourceMappingURL=win32.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/dist/esm/win32.js.map b/node_modules/cmake-js/node_modules/isexe/dist/esm/win32.js.map new file mode 100644 index 0000000..5499c92 --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/dist/esm/win32.js.map @@ -0,0 +1 @@ +{"version":3,"file":"win32.js","sourceRoot":"","sources":["../../src/win32.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAS,QAAQ,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EACxB,IAAY,EACZ,UAAwB,EAAE,EACR,EAAE;IACpB,MAAM,EAAE,YAAY,GAAG,KAAK,EAAE,GAAG,OAAO,CAAA;IACxC,IAAI,CAAC;QACH,OAAO,SAAS,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IACnD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,EAAE,GAAG,CAA0B,CAAA;QACrC,IAAI,YAAY,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAA;QACtD,MAAM,EAAE,CAAA;IACV,CAAC;AACH,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,IAAY,EACZ,UAAwB,EAAE,EACjB,EAAE;IACX,MAAM,EAAE,YAAY,GAAG,KAAK,EAAE,GAAG,OAAO,CAAA;IACxC,IAAI,CAAC;QACH,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,EAAE,GAAG,CAA0B,CAAA;QACrC,IAAI,YAAY,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAA;QACtD,MAAM,EAAE,CAAA;IACV,CAAC;AACH,CAAC,CAAA;AAED,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,OAAqB,EAAE,EAAE;IAC3D,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,EAAE,GAAG,OAAO,CAAA;IACvD,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACxC,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,EAAE,CAAA;QAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAA;QAEhE,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;YACnB,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,IAAW,EAAE,IAAY,EAAE,OAAqB,EAAE,EAAE,CACrE,IAAI,CAAC,MAAM,EAAE,IAAI,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA","sourcesContent":["/**\n * This is the Windows implementation of isexe, which uses the file\n * extension and PATHEXT setting.\n *\n * @module\n */\n\nimport { Stats, statSync } from 'node:fs'\nimport { stat } from 'node:fs/promises'\nimport { IsexeOptions } from './options.js'\nimport { delimiter } from 'node:path'\n\n/**\n * Determine whether a path is executable based on the file extension\n * and PATHEXT environment variable (or specified pathExt option)\n */\nexport const isexe = async (\n path: string,\n options: IsexeOptions = {},\n): Promise => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(await stat(path), path, options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\n/**\n * Synchronously determine whether a path is executable based on the file\n * extension and PATHEXT environment variable (or specified pathExt option)\n */\nexport const sync = (\n path: string,\n options: IsexeOptions = {},\n): boolean => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(statSync(path), path, options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\nconst checkPathExt = (path: string, options: IsexeOptions) => {\n const { pathExt = process.env.PATHEXT || '' } = options\n const peSplit = pathExt.split(delimiter)\n if (peSplit.indexOf('') !== -1) {\n return true\n }\n\n for (const pes of peSplit) {\n const p = pes.toLowerCase()\n const ext = path.substring(path.length - p.length).toLowerCase()\n\n if (p && ext === p) {\n return true\n }\n }\n return false\n}\n\nconst checkStat = (stat: Stats, path: string, options: IsexeOptions) =>\n stat.isFile() && checkPathExt(path, options)\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/isexe/package.json b/node_modules/cmake-js/node_modules/isexe/package.json new file mode 100644 index 0000000..31c05fa --- /dev/null +++ b/node_modules/cmake-js/node_modules/isexe/package.json @@ -0,0 +1,78 @@ +{ + "name": "isexe", + "version": "4.0.0", + "description": "Minimal module to check if a file is executable.", + "main": "./dist/commonjs/index.min.js", + "module": "./dist/esm/index.min.js", + "types": "./dist/commonjs/index.d.ts", + "files": [ + "dist" + ], + "tshy": { + "selfLink": false, + "exports": { + "./raw": "./src/index.ts", + "./package.json": "./package.json", + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.min.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.min.js" + } + } + } + }, + "exports": { + "./raw": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + }, + "./package.json": "./package.json", + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.min.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.min.js" + } + } + }, + "devDependencies": { + "@types/node": "^25.2.1", + "esbuild": "^0.27.3", + "prettier": "^3.8.1", + "tap": "^21.5.1", + "tshy": "^3.1.3", + "typedoc": "^0.28.16" + }, + "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "prepare": "tshy && bash build.sh", + "pretest": "npm run prepare", + "presnap": "npm run prepare", + "test": "tap", + "snap": "tap", + "format": "prettier --write .", + "typedoc": "typedoc" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "BlueOak-1.0.0", + "repository": "https://github.com/isaacs/isexe", + "engines": { + "node": ">=20" + }, + "type": "module" +} diff --git a/node_modules/cmake-js/node_modules/jsonfile/LICENSE b/node_modules/cmake-js/node_modules/jsonfile/LICENSE new file mode 100644 index 0000000..cb7e807 --- /dev/null +++ b/node_modules/cmake-js/node_modules/jsonfile/LICENSE @@ -0,0 +1,15 @@ +(The MIT License) + +Copyright (c) 2012-2015, JP Richardson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files +(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/cmake-js/node_modules/jsonfile/README.md b/node_modules/cmake-js/node_modules/jsonfile/README.md new file mode 100644 index 0000000..215dc09 --- /dev/null +++ b/node_modules/cmake-js/node_modules/jsonfile/README.md @@ -0,0 +1,230 @@ +Node.js - jsonfile +================ + +Easily read/write JSON files in Node.js. _Note: this module cannot be used in the browser._ + +[![npm Package](https://img.shields.io/npm/v/jsonfile.svg?style=flat-square)](https://www.npmjs.org/package/jsonfile) +[![linux build status](https://img.shields.io/github/actions/workflow/status/jprichardson/node-jsonfile/ci.yml?branch=master)](https://github.com/jprichardson/node-jsonfile/actions?query=branch%3Amaster) +[![windows Build status](https://img.shields.io/appveyor/ci/jprichardson/node-jsonfile/master.svg?label=windows%20build)](https://ci.appveyor.com/project/jprichardson/node-jsonfile/branch/master) + +Standard JavaScript + +Why? +---- + +Writing `JSON.stringify()` and then `fs.writeFile()` and `JSON.parse()` with `fs.readFile()` enclosed in `try/catch` blocks became annoying. + + + +Installation +------------ + + npm install --save jsonfile + + + +API +--- + +* [`readFile(filename, [options], callback)`](#readfilefilename-options-callback) +* [`readFileSync(filename, [options])`](#readfilesyncfilename-options) +* [`writeFile(filename, obj, [options], callback)`](#writefilefilename-obj-options-callback) +* [`writeFileSync(filename, obj, [options])`](#writefilesyncfilename-obj-options) + +---- + +### readFile(filename, [options], callback) + +`options` (`object`, default `undefined`): Pass in any [`fs.readFile`](https://nodejs.org/api/fs.html#fs_fs_readfile_path_options_callback) options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse). + - `throws` (`boolean`, default: `true`). If `JSON.parse` throws an error, pass this error to the callback. + If `false`, returns `null` for the object. + + +```js +const jsonfile = require('jsonfile') +const file = '/tmp/data.json' +jsonfile.readFile(file, function (err, obj) { + if (err) console.error(err) + console.dir(obj) +}) +``` + +You can also use this method with promises. The `readFile` method will return a promise if you do not pass a callback function. + +```js +const jsonfile = require('jsonfile') +const file = '/tmp/data.json' +jsonfile.readFile(file) + .then(obj => console.dir(obj)) + .catch(error => console.error(error)) +``` + +---- + +### readFileSync(filename, [options]) + +`options` (`object`, default `undefined`): Pass in any [`fs.readFileSync`](https://nodejs.org/api/fs.html#fs_fs_readfilesync_path_options) options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse). +- `throws` (`boolean`, default: `true`). If an error is encountered reading or parsing the file, throw the error. If `false`, returns `null` for the object. + +```js +const jsonfile = require('jsonfile') +const file = '/tmp/data.json' + +console.dir(jsonfile.readFileSync(file)) +``` + +---- + +### writeFile(filename, obj, [options], callback) + +`options`: Pass in any [`fs.writeFile`](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback) options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces`, or override `EOL` string or set `finalEOL` flag as `false` to not save the file with `EOL` at the end. + + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj, function (err) { + if (err) console.error(err) +}) +``` +Or use with promises as follows: + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj) + .then(res => { + console.log('Write complete') + }) + .catch(error => console.error(error)) +``` + + +**formatting with spaces:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj, { spaces: 2 }, function (err) { + if (err) console.error(err) +}) +``` + +**overriding EOL:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj, { spaces: 2, EOL: '\r\n' }, function (err) { + if (err) console.error(err) +}) +``` + + +**disabling the EOL at the end of file:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj, { spaces: 2, finalEOL: false }, function (err) { + if (err) console.log(err) +}) +``` + +**appending to an existing JSON file:** + +You can use `fs.writeFile` option `{ flag: 'a' }` to achieve this. + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/mayAlreadyExistedData.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj, { flag: 'a' }, function (err) { + if (err) console.error(err) +}) +``` + +---- + +### writeFileSync(filename, obj, [options]) + +`options`: Pass in any [`fs.writeFileSync`](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options) options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces`, or override `EOL` string or set `finalEOL` flag as `false` to not save the file with `EOL` at the end. + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFileSync(file, obj) +``` + +**formatting with spaces:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFileSync(file, obj, { spaces: 2 }) +``` + +**overriding EOL:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFileSync(file, obj, { spaces: 2, EOL: '\r\n' }) +``` + +**disabling the EOL at the end of file:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFileSync(file, obj, { spaces: 2, finalEOL: false }) +``` + +**appending to an existing JSON file:** + +You can use `fs.writeFileSync` option `{ flag: 'a' }` to achieve this. + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/mayAlreadyExistedData.json' +const obj = { name: 'JP' } + +jsonfile.writeFileSync(file, obj, { flag: 'a' }) +``` + +License +------- + +(MIT License) + +Copyright 2012-2016, JP Richardson diff --git a/node_modules/cmake-js/node_modules/jsonfile/index.js b/node_modules/cmake-js/node_modules/jsonfile/index.js new file mode 100644 index 0000000..acd0af2 --- /dev/null +++ b/node_modules/cmake-js/node_modules/jsonfile/index.js @@ -0,0 +1,88 @@ +let _fs +try { + _fs = require('graceful-fs') +} catch (_) { + _fs = require('fs') +} +const universalify = require('universalify') +const { stringify, stripBom } = require('./utils') + +async function _readFile (file, options = {}) { + if (typeof options === 'string') { + options = { encoding: options } + } + + const fs = options.fs || _fs + + const shouldThrow = 'throws' in options ? options.throws : true + + let data = await universalify.fromCallback(fs.readFile)(file, options) + + data = stripBom(data) + + let obj + try { + obj = JSON.parse(data, options ? options.reviver : null) + } catch (err) { + if (shouldThrow) { + err.message = `${file}: ${err.message}` + throw err + } else { + return null + } + } + + return obj +} + +const readFile = universalify.fromPromise(_readFile) + +function readFileSync (file, options = {}) { + if (typeof options === 'string') { + options = { encoding: options } + } + + const fs = options.fs || _fs + + const shouldThrow = 'throws' in options ? options.throws : true + + try { + let content = fs.readFileSync(file, options) + content = stripBom(content) + return JSON.parse(content, options.reviver) + } catch (err) { + if (shouldThrow) { + err.message = `${file}: ${err.message}` + throw err + } else { + return null + } + } +} + +async function _writeFile (file, obj, options = {}) { + const fs = options.fs || _fs + + const str = stringify(obj, options) + + await universalify.fromCallback(fs.writeFile)(file, str, options) +} + +const writeFile = universalify.fromPromise(_writeFile) + +function writeFileSync (file, obj, options = {}) { + const fs = options.fs || _fs + + const str = stringify(obj, options) + // not sure if fs.writeFileSync returns anything, but just in case + return fs.writeFileSync(file, str, options) +} + +// NOTE: do not change this export format; required for ESM compat +// see https://github.com/jprichardson/node-jsonfile/pull/162 for details +module.exports = { + readFile, + readFileSync, + writeFile, + writeFileSync +} diff --git a/node_modules/cmake-js/node_modules/jsonfile/package.json b/node_modules/cmake-js/node_modules/jsonfile/package.json new file mode 100644 index 0000000..0ff96cc --- /dev/null +++ b/node_modules/cmake-js/node_modules/jsonfile/package.json @@ -0,0 +1,40 @@ +{ + "name": "jsonfile", + "version": "6.2.0", + "description": "Easily read/write JSON files.", + "repository": { + "type": "git", + "url": "git@github.com:jprichardson/node-jsonfile.git" + }, + "keywords": [ + "read", + "write", + "file", + "json", + "fs", + "fs-extra" + ], + "author": "JP Richardson ", + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + }, + "devDependencies": { + "mocha": "^8.2.0", + "rimraf": "^2.4.0", + "standard": "^16.0.1" + }, + "main": "index.js", + "files": [ + "index.js", + "utils.js" + ], + "scripts": { + "lint": "standard", + "test": "npm run lint && npm run unit", + "unit": "mocha" + } +} diff --git a/node_modules/cmake-js/node_modules/jsonfile/utils.js b/node_modules/cmake-js/node_modules/jsonfile/utils.js new file mode 100644 index 0000000..b5ff48e --- /dev/null +++ b/node_modules/cmake-js/node_modules/jsonfile/utils.js @@ -0,0 +1,14 @@ +function stringify (obj, { EOL = '\n', finalEOL = true, replacer = null, spaces } = {}) { + const EOF = finalEOL ? EOL : '' + const str = JSON.stringify(obj, replacer, spaces) + + return str.replace(/\n/g, EOL) + EOF +} + +function stripBom (content) { + // we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified + if (Buffer.isBuffer(content)) content = content.toString('utf8') + return content.replace(/^\uFEFF/, '') +} + +module.exports = { stringify, stripBom } diff --git a/node_modules/cmake-js/node_modules/minipass/LICENSE.md b/node_modules/cmake-js/node_modules/minipass/LICENSE.md new file mode 100644 index 0000000..c5402b9 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minipass/LICENSE.md @@ -0,0 +1,55 @@ +# Blue Oak Model License + +Version 1.0.0 + +## Purpose + +This license gives everyone as much permission to work with +this software as possible, while protecting contributors +from liability. + +## Acceptance + +In order to receive this license, you must agree to its +rules. The rules of this license are both obligations +under that agreement and conditions to your license. +You must not do anything with this software that triggers +a rule that you cannot or will not follow. + +## Copyright + +Each contributor licenses you to do everything with this +software that would otherwise infringe that contributor's +copyright in it. + +## Notices + +You must ensure that everyone who gets a copy of +any part of this software from you, with or without +changes, also gets the text of this license or a link to +. + +## Excuse + +If anyone notifies you in writing that you have not +complied with [Notices](#notices), you can keep your +license by taking all practical steps to comply within 30 +days after the notice. If you do not do so, your license +ends immediately. + +## Patent + +Each contributor licenses you to do everything with this +software that would otherwise infringe any patent claims +they can license or become able to license. + +## Reliability + +No contributor can revoke this license. + +## No Liability + +***As far as the law allows, this software comes as is, +without any warranty or condition, and no contributor +will be liable to anyone for any damages related to this +software or this license, under any kind of legal claim.*** diff --git a/node_modules/cmake-js/node_modules/minipass/README.md b/node_modules/cmake-js/node_modules/minipass/README.md new file mode 100644 index 0000000..1126330 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minipass/README.md @@ -0,0 +1,825 @@ +# minipass + +A _very_ minimal implementation of a [PassThrough +stream](https://nodejs.org/api/stream.html#stream_class_stream_passthrough) + +[It's very +fast](https://docs.google.com/spreadsheets/d/1K_HR5oh3r80b8WVMWCPPjfuWXUgfkmhlX7FGI6JJ8tY/edit?usp=sharing) +for objects, strings, and buffers. + +Supports `pipe()`ing (including multi-`pipe()` and backpressure +transmission), buffering data until either a `data` event handler +or `pipe()` is added (so you don't lose the first chunk), and +most other cases where PassThrough is a good idea. + +There is a `read()` method, but it's much more efficient to +consume data from this stream via `'data'` events or by calling +`pipe()` into some other stream. Calling `read()` requires the +buffer to be flattened in some cases, which requires copying +memory. + +If you set `objectMode: true` in the options, then whatever is +written will be emitted. Otherwise, it'll do a minimal amount of +Buffer copying to ensure proper Streams semantics when `read(n)` +is called. + +`objectMode` can only be set at instantiation. Attempting to +write something other than a String or Buffer without having set +`objectMode` in the options will throw an error. + +This is not a `through` or `through2` stream. It doesn't +transform the data, it just passes it right through. If you want +to transform the data, extend the class, and override the +`write()` method. Once you're done transforming the data however +you want, call `super.write()` with the transform output. + +For some examples of streams that extend Minipass in various +ways, check out: + +- [minizlib](http://npm.im/minizlib) +- [fs-minipass](http://npm.im/fs-minipass) +- [tar](http://npm.im/tar) +- [minipass-collect](http://npm.im/minipass-collect) +- [minipass-flush](http://npm.im/minipass-flush) +- [minipass-pipeline](http://npm.im/minipass-pipeline) +- [tap](http://npm.im/tap) +- [tap-parser](http://npm.im/tap-parser) +- [treport](http://npm.im/treport) +- [minipass-fetch](http://npm.im/minipass-fetch) +- [pacote](http://npm.im/pacote) +- [make-fetch-happen](http://npm.im/make-fetch-happen) +- [cacache](http://npm.im/cacache) +- [ssri](http://npm.im/ssri) +- [npm-registry-fetch](http://npm.im/npm-registry-fetch) +- [minipass-json-stream](http://npm.im/minipass-json-stream) +- [minipass-sized](http://npm.im/minipass-sized) + +## Usage in TypeScript + +The `Minipass` class takes three type template definitions: + +- `RType` the type being read, which defaults to `Buffer`. If + `RType` is `string`, then the constructor _must_ get an options + object specifying either an `encoding` or `objectMode: true`. + If it's anything other than `string` or `Buffer`, then it + _must_ get an options object specifying `objectMode: true`. +- `WType` the type being written. If `RType` is `Buffer` or + `string`, then this defaults to `ContiguousData` (Buffer, + string, ArrayBuffer, or ArrayBufferView). Otherwise, it + defaults to `RType`. +- `Events` type mapping event names to the arguments emitted + with that event, which extends `Minipass.Events`. + +To declare types for custom events in subclasses, extend the +third parameter with your own event signatures. For example: + +```js +import { Minipass } from 'minipass' + +// a NDJSON stream that emits 'jsonError' when it can't stringify +export interface Events extends Minipass.Events { + jsonError: [e: Error] +} + +export class NDJSONStream extends Minipass { + constructor() { + super({ objectMode: true }) + } + + // data is type `any` because that's WType + write(data, encoding, cb) { + try { + const json = JSON.stringify(data) + return super.write(json + '\n', encoding, cb) + } catch (er) { + if (!er instanceof Error) { + er = Object.assign(new Error('json stringify failed'), { + cause: er, + }) + } + // trying to emit with something OTHER than an error will + // fail, because we declared the event arguments type. + this.emit('jsonError', er) + } + } +} + +const s = new NDJSONStream() +s.on('jsonError', e => { + // here, TS knows that e is an Error +}) +``` + +Emitting/handling events that aren't declared in this way is +fine, but the arguments will be typed as `unknown`. + +## Differences from Node.js Streams + +There are several things that make Minipass streams different +from (and in some ways superior to) Node.js core streams. + +Please read these caveats if you are familiar with node-core +streams and intend to use Minipass streams in your programs. + +You can avoid most of these differences entirely (for a very +small performance penalty) by setting `{async: true}` in the +constructor options. + +### Timing + +Minipass streams are designed to support synchronous use-cases. +Thus, data is emitted as soon as it is available, always. It is +buffered until read, but no longer. Another way to look at it is +that Minipass streams are exactly as synchronous as the logic +that writes into them. + +This can be surprising if your code relies on +`PassThrough.write()` always providing data on the next tick +rather than the current one, or being able to call `resume()` and +not have the entire buffer disappear immediately. + +However, without this synchronicity guarantee, there would be no +way for Minipass to achieve the speeds it does, or support the +synchronous use cases that it does. Simply put, waiting takes +time. + +This non-deferring approach makes Minipass streams much easier to +reason about, especially in the context of Promises and other +flow-control mechanisms. + +Example: + +```js +// hybrid module, either works +import { Minipass } from 'minipass' +// or: +const { Minipass } = require('minipass') + +const stream = new Minipass() +stream.on('data', () => console.log('data event')) +console.log('before write') +stream.write('hello') +console.log('after write') +// output: +// before write +// data event +// after write +``` + +### Exception: Async Opt-In + +If you wish to have a Minipass stream with behavior that more +closely mimics Node.js core streams, you can set the stream in +async mode either by setting `async: true` in the constructor +options, or by setting `stream.async = true` later on. + +```js +// hybrid module, either works +import { Minipass } from 'minipass' +// or: +const { Minipass } = require('minipass') + +const asyncStream = new Minipass({ async: true }) +asyncStream.on('data', () => console.log('data event')) +console.log('before write') +asyncStream.write('hello') +console.log('after write') +// output: +// before write +// after write +// data event <-- this is deferred until the next tick +``` + +Switching _out_ of async mode is unsafe, as it could cause data +corruption, and so is not enabled. Example: + +```js +import { Minipass } from 'minipass' +const stream = new Minipass({ encoding: 'utf8' }) +stream.on('data', chunk => console.log(chunk)) +stream.async = true +console.log('before writes') +stream.write('hello') +setStreamSyncAgainSomehow(stream) // <-- this doesn't actually exist! +stream.write('world') +console.log('after writes') +// hypothetical output would be: +// before writes +// world +// after writes +// hello +// NOT GOOD! +``` + +To avoid this problem, once set into async mode, any attempt to +make the stream sync again will be ignored. + +```js +const { Minipass } = require('minipass') +const stream = new Minipass({ encoding: 'utf8' }) +stream.on('data', chunk => console.log(chunk)) +stream.async = true +console.log('before writes') +stream.write('hello') +stream.async = false // <-- no-op, stream already async +stream.write('world') +console.log('after writes') +// actual output: +// before writes +// after writes +// hello +// world +``` + +### No High/Low Water Marks + +Node.js core streams will optimistically fill up a buffer, +returning `true` on all writes until the limit is hit, even if +the data has nowhere to go. Then, they will not attempt to draw +more data in until the buffer size dips below a minimum value. + +Minipass streams are much simpler. The `write()` method will +return `true` if the data has somewhere to go (which is to say, +given the timing guarantees, that the data is already there by +the time `write()` returns). + +If the data has nowhere to go, then `write()` returns false, and +the data sits in a buffer, to be drained out immediately as soon +as anyone consumes it. + +Since nothing is ever buffered unnecessarily, there is much less +copying data, and less bookkeeping about buffer capacity levels. + +### Hazards of Buffering (or: Why Minipass Is So Fast) + +Since data written to a Minipass stream is immediately written +all the way through the pipeline, and `write()` always returns +true/false based on whether the data was fully flushed, +backpressure is communicated immediately to the upstream caller. +This minimizes buffering. + +Consider this case: + +```js +const { PassThrough } = require('stream') +const p1 = new PassThrough({ highWaterMark: 1024 }) +const p2 = new PassThrough({ highWaterMark: 1024 }) +const p3 = new PassThrough({ highWaterMark: 1024 }) +const p4 = new PassThrough({ highWaterMark: 1024 }) + +p1.pipe(p2).pipe(p3).pipe(p4) +p4.on('data', () => console.log('made it through')) + +// this returns false and buffers, then writes to p2 on next tick (1) +// p2 returns false and buffers, pausing p1, then writes to p3 on next tick (2) +// p3 returns false and buffers, pausing p2, then writes to p4 on next tick (3) +// p4 returns false and buffers, pausing p3, then emits 'data' and 'drain' +// on next tick (4) +// p3 sees p4's 'drain' event, and calls resume(), emitting 'resume' and +// 'drain' on next tick (5) +// p2 sees p3's 'drain', calls resume(), emits 'resume' and 'drain' on next tick (6) +// p1 sees p2's 'drain', calls resume(), emits 'resume' and 'drain' on next +// tick (7) + +p1.write(Buffer.alloc(2048)) // returns false +``` + +Along the way, the data was buffered and deferred at each stage, +and multiple event deferrals happened, for an unblocked pipeline +where it was perfectly safe to write all the way through! + +Furthermore, setting a `highWaterMark` of `1024` might lead +someone reading the code to think an advisory maximum of 1KiB is +being set for the pipeline. However, the actual advisory +buffering level is the _sum_ of `highWaterMark` values, since +each one has its own bucket. + +Consider the Minipass case: + +```js +const m1 = new Minipass() +const m2 = new Minipass() +const m3 = new Minipass() +const m4 = new Minipass() + +m1.pipe(m2).pipe(m3).pipe(m4) +m4.on('data', () => console.log('made it through')) + +// m1 is flowing, so it writes the data to m2 immediately +// m2 is flowing, so it writes the data to m3 immediately +// m3 is flowing, so it writes the data to m4 immediately +// m4 is flowing, so it fires the 'data' event immediately, returns true +// m4's write returned true, so m3 is still flowing, returns true +// m3's write returned true, so m2 is still flowing, returns true +// m2's write returned true, so m1 is still flowing, returns true +// No event deferrals or buffering along the way! + +m1.write(Buffer.alloc(2048)) // returns true +``` + +It is extremely unlikely that you _don't_ want to buffer any data +written, or _ever_ buffer data that can be flushed all the way +through. Neither node-core streams nor Minipass ever fail to +buffer written data, but node-core streams do a lot of +unnecessary buffering and pausing. + +As always, the faster implementation is the one that does less +stuff and waits less time to do it. + +### Immediately emit `end` for empty streams (when not paused) + +If a stream is not paused, and `end()` is called before writing +any data into it, then it will emit `end` immediately. + +If you have logic that occurs on the `end` event which you don't +want to potentially happen immediately (for example, closing file +descriptors, moving on to the next entry in an archive parse +stream, etc.) then be sure to call `stream.pause()` on creation, +and then `stream.resume()` once you are ready to respond to the +`end` event. + +However, this is _usually_ not a problem because: + +### Emit `end` When Asked + +One hazard of immediately emitting `'end'` is that you may not +yet have had a chance to add a listener. In order to avoid this +hazard, Minipass streams safely re-emit the `'end'` event if a +new listener is added after `'end'` has been emitted. + +Ie, if you do `stream.on('end', someFunction)`, and the stream +has already emitted `end`, then it will call the handler right +away. (You can think of this somewhat like attaching a new +`.then(fn)` to a previously-resolved Promise.) + +To prevent calling handlers multiple times who would not expect +multiple ends to occur, all listeners are removed from the +`'end'` event whenever it is emitted. + +### Emit `error` When Asked + +The most recent error object passed to the `'error'` event is +stored on the stream. If a new `'error'` event handler is added, +and an error was previously emitted, then the event handler will +be called immediately (or on `process.nextTick` in the case of +async streams). + +This makes it much more difficult to end up trying to interact +with a broken stream, if the error handler is added after an +error was previously emitted. + +### Impact of "immediate flow" on Tee-streams + +A "tee stream" is a stream piping to multiple destinations: + +```js +const tee = new Minipass() +t.pipe(dest1) +t.pipe(dest2) +t.write('foo') // goes to both destinations +``` + +Since Minipass streams _immediately_ process any pending data +through the pipeline when a new pipe destination is added, this +can have surprising effects, especially when a stream comes in +from some other function and may or may not have data in its +buffer. + +```js +// WARNING! WILL LOSE DATA! +const src = new Minipass() +src.write('foo') +src.pipe(dest1) // 'foo' chunk flows to dest1 immediately, and is gone +src.pipe(dest2) // gets nothing! +``` + +One solution is to create a dedicated tee-stream junction that +pipes to both locations, and then pipe to _that_ instead. + +```js +// Safe example: tee to both places +const src = new Minipass() +src.write('foo') +const tee = new Minipass() +tee.pipe(dest1) +tee.pipe(dest2) +src.pipe(tee) // tee gets 'foo', pipes to both locations +``` + +The same caveat applies to `on('data')` event listeners. The +first one added will _immediately_ receive all of the data, +leaving nothing for the second: + +```js +// WARNING! WILL LOSE DATA! +const src = new Minipass() +src.write('foo') +src.on('data', handler1) // receives 'foo' right away +src.on('data', handler2) // nothing to see here! +``` + +Using a dedicated tee-stream can be used in this case as well: + +```js +// Safe example: tee to both data handlers +const src = new Minipass() +src.write('foo') +const tee = new Minipass() +tee.on('data', handler1) +tee.on('data', handler2) +src.pipe(tee) +``` + +All of the hazards in this section are avoided by setting `{ +async: true }` in the Minipass constructor, or by setting +`stream.async = true` afterwards. Note that this does add some +overhead, so should only be done in cases where you are willing +to lose a bit of performance in order to avoid having to refactor +program logic. + +## USAGE + +It's a stream! Use it like a stream and it'll most likely do what +you want. + +```js +import { Minipass } from 'minipass' +const mp = new Minipass(options) // options is optional +mp.write('foo') +mp.pipe(someOtherStream) +mp.end('bar') +``` + +### OPTIONS + +- `encoding` How would you like the data coming _out_ of the + stream to be encoded? Accepts any values that can be passed to + `Buffer.toString()`. +- `objectMode` Emit data exactly as it comes in. This will be + flipped on by default if you write() something other than a + string or Buffer at any point. Setting `objectMode: true` will + prevent setting any encoding value. +- `async` Defaults to `false`. Set to `true` to defer data + emission until next tick. This reduces performance slightly, + but makes Minipass streams use timing behavior closer to Node + core streams. See [Timing](#timing) for more details. +- `signal` An `AbortSignal` that will cause the stream to unhook + itself from everything and become as inert as possible. Note + that providing a `signal` parameter will make `'error'` events + no longer throw if they are unhandled, but they will still be + emitted to handlers if any are attached. + +### API + +Implements the user-facing portions of Node.js's `Readable` and +`Writable` streams. + +### Methods + +- `write(chunk, [encoding], [callback])` - Put data in. (Note + that, in the base Minipass class, the same data will come out.) + Returns `false` if the stream will buffer the next write, or + true if it's still in "flowing" mode. +- `end([chunk, [encoding]], [callback])` - Signal that you have + no more data to write. This will queue an `end` event to be + fired when all the data has been consumed. +- `pause()` - No more data for a while, please. This also + prevents `end` from being emitted for empty streams until the + stream is resumed. +- `resume()` - Resume the stream. If there's data in the buffer, + it is all discarded. Any buffered events are immediately + emitted. +- `pipe(dest)` - Send all output to the stream provided. When + data is emitted, it is immediately written to any and all pipe + destinations. (Or written on next tick in `async` mode.) +- `unpipe(dest)` - Stop piping to the destination stream. This is + immediate, meaning that any asynchronously queued data will + _not_ make it to the destination when running in `async` mode. + - `options.end` - Boolean, end the destination stream when the + source stream ends. Default `true`. + - `options.proxyErrors` - Boolean, proxy `error` events from + the source stream to the destination stream. Note that errors + are _not_ proxied after the pipeline terminates, either due + to the source emitting `'end'` or manually unpiping with + `src.unpipe(dest)`. Default `false`. +- `on(ev, fn)`, `emit(ev, fn)` - Minipass streams are + EventEmitters. Some events are given special treatment, + however. (See below under "events".) +- `promise()` - Returns a Promise that resolves when the stream + emits `end`, or rejects if the stream emits `error`. +- `collect()` - Return a Promise that resolves on `end` with an + array containing each chunk of data that was emitted, or + rejects if the stream emits `error`. Note that this consumes + the stream data. +- `concat()` - Same as `collect()`, but concatenates the data + into a single Buffer object. Will reject the returned promise + if the stream is in objectMode, or if it goes into objectMode + by the end of the data. +- `read(n)` - Consume `n` bytes of data out of the buffer. If `n` + is not provided, then consume all of it. If `n` bytes are not + available, then it returns null. **Note** consuming streams in + this way is less efficient, and can lead to unnecessary Buffer + copying. +- `destroy([er])` - Destroy the stream. If an error is provided, + then an `'error'` event is emitted. If the stream has a + `close()` method, and has not emitted a `'close'` event yet, + then `stream.close()` will be called. Any Promises returned by + `.promise()`, `.collect()` or `.concat()` will be rejected. + After being destroyed, writing to the stream will emit an + error. No more data will be emitted if the stream is destroyed, + even if it was previously buffered. + +### Properties + +- `bufferLength` Read-only. Total number of bytes buffered, or in + the case of objectMode, the total number of objects. +- `encoding` Read-only. The encoding that has been set. +- `flowing` Read-only. Boolean indicating whether a chunk written + to the stream will be immediately emitted. +- `emittedEnd` Read-only. Boolean indicating whether the end-ish + events (ie, `end`, `prefinish`, `finish`) have been emitted. + Note that listening on any end-ish event will immediateyl + re-emit it if it has already been emitted. +- `writable` Whether the stream is writable. Default `true`. Set + to `false` when `end()` +- `readable` Whether the stream is readable. Default `true`. +- `pipes` An array of Pipe objects referencing streams that this + stream is piping into. +- `destroyed` A getter that indicates whether the stream was + destroyed. +- `paused` True if the stream has been explicitly paused, + otherwise false. +- `objectMode` Indicates whether the stream is in `objectMode`. +- `aborted` Readonly property set when the `AbortSignal` + dispatches an `abort` event. + +### Events + +- `data` Emitted when there's data to read. Argument is the data + to read. This is never emitted while not flowing. If a listener + is attached, that will resume the stream. +- `end` Emitted when there's no more data to read. This will be + emitted immediately for empty streams when `end()` is called. + If a listener is attached, and `end` was already emitted, then + it will be emitted again. All listeners are removed when `end` + is emitted. +- `prefinish` An end-ish event that follows the same logic as + `end` and is emitted in the same conditions where `end` is + emitted. Emitted after `'end'`. +- `finish` An end-ish event that follows the same logic as `end` + and is emitted in the same conditions where `end` is emitted. + Emitted after `'prefinish'`. +- `close` An indication that an underlying resource has been + released. Minipass does not emit this event, but will defer it + until after `end` has been emitted, since it throws off some + stream libraries otherwise. +- `drain` Emitted when the internal buffer empties, and it is + again suitable to `write()` into the stream. +- `readable` Emitted when data is buffered and ready to be read + by a consumer. +- `resume` Emitted when stream changes state from buffering to + flowing mode. (Ie, when `resume` is called, `pipe` is called, + or a `data` event listener is added.) + +### Static Methods + +- `Minipass.isStream(stream)` Returns `true` if the argument is a + stream, and false otherwise. To be considered a stream, the + object must be either an instance of Minipass, or an + EventEmitter that has either a `pipe()` method, or both + `write()` and `end()` methods. (Pretty much any stream in + node-land will return `true` for this.) + +## EXAMPLES + +Here are some examples of things you can do with Minipass +streams. + +### simple "are you done yet" promise + +```js +mp.promise().then( + () => { + // stream is finished + }, + er => { + // stream emitted an error + } +) +``` + +### collecting + +```js +mp.collect().then(all => { + // all is an array of all the data emitted + // encoding is supported in this case, so + // so the result will be a collection of strings if + // an encoding is specified, or buffers/objects if not. + // + // In an async function, you may do + // const data = await stream.collect() +}) +``` + +### collecting into a single blob + +This is a bit slower because it concatenates the data into one +chunk for you, but if you're going to do it yourself anyway, it's +convenient this way: + +```js +mp.concat().then(onebigchunk => { + // onebigchunk is a string if the stream + // had an encoding set, or a buffer otherwise. +}) +``` + +### iteration + +You can iterate over streams synchronously or asynchronously in +platforms that support it. + +Synchronous iteration will end when the currently available data +is consumed, even if the `end` event has not been reached. In +string and buffer mode, the data is concatenated, so unless +multiple writes are occurring in the same tick as the `read()`, +sync iteration loops will generally only have a single iteration. + +To consume chunks in this way exactly as they have been written, +with no flattening, create the stream with the `{ objectMode: +true }` option. + +```js +const mp = new Minipass({ objectMode: true }) +mp.write('a') +mp.write('b') +for (let letter of mp) { + console.log(letter) // a, b +} +mp.write('c') +mp.write('d') +for (let letter of mp) { + console.log(letter) // c, d +} +mp.write('e') +mp.end() +for (let letter of mp) { + console.log(letter) // e +} +for (let letter of mp) { + console.log(letter) // nothing +} +``` + +Asynchronous iteration will continue until the end event is reached, +consuming all of the data. + +```js +const mp = new Minipass({ encoding: 'utf8' }) + +// some source of some data +let i = 5 +const inter = setInterval(() => { + if (i-- > 0) mp.write(Buffer.from('foo\n', 'utf8')) + else { + mp.end() + clearInterval(inter) + } +}, 100) + +// consume the data with asynchronous iteration +async function consume() { + for await (let chunk of mp) { + console.log(chunk) + } + return 'ok' +} + +consume().then(res => console.log(res)) +// logs `foo\n` 5 times, and then `ok` +``` + +### subclass that `console.log()`s everything written into it + +```js +class Logger extends Minipass { + write(chunk, encoding, callback) { + console.log('WRITE', chunk, encoding) + return super.write(chunk, encoding, callback) + } + end(chunk, encoding, callback) { + console.log('END', chunk, encoding) + return super.end(chunk, encoding, callback) + } +} + +someSource.pipe(new Logger()).pipe(someDest) +``` + +### same thing, but using an inline anonymous class + +```js +// js classes are fun +someSource + .pipe( + new (class extends Minipass { + emit(ev, ...data) { + // let's also log events, because debugging some weird thing + console.log('EMIT', ev) + return super.emit(ev, ...data) + } + write(chunk, encoding, callback) { + console.log('WRITE', chunk, encoding) + return super.write(chunk, encoding, callback) + } + end(chunk, encoding, callback) { + console.log('END', chunk, encoding) + return super.end(chunk, encoding, callback) + } + })() + ) + .pipe(someDest) +``` + +### subclass that defers 'end' for some reason + +```js +class SlowEnd extends Minipass { + emit(ev, ...args) { + if (ev === 'end') { + console.log('going to end, hold on a sec') + setTimeout(() => { + console.log('ok, ready to end now') + super.emit('end', ...args) + }, 100) + return true + } else { + return super.emit(ev, ...args) + } + } +} +``` + +### transform that creates newline-delimited JSON + +```js +class NDJSONEncode extends Minipass { + write(obj, cb) { + try { + // JSON.stringify can throw, emit an error on that + return super.write(JSON.stringify(obj) + '\n', 'utf8', cb) + } catch (er) { + this.emit('error', er) + } + } + end(obj, cb) { + if (typeof obj === 'function') { + cb = obj + obj = undefined + } + if (obj !== undefined) { + this.write(obj) + } + return super.end(cb) + } +} +``` + +### transform that parses newline-delimited JSON + +```js +class NDJSONDecode extends Minipass { + constructor(options) { + // always be in object mode, as far as Minipass is concerned + super({ objectMode: true }) + this._jsonBuffer = '' + } + write(chunk, encoding, cb) { + if ( + typeof chunk === 'string' && + typeof encoding === 'string' && + encoding !== 'utf8' + ) { + chunk = Buffer.from(chunk, encoding).toString() + } else if (Buffer.isBuffer(chunk)) { + chunk = chunk.toString() + } + if (typeof encoding === 'function') { + cb = encoding + } + const jsonData = (this._jsonBuffer + chunk).split('\n') + this._jsonBuffer = jsonData.pop() + for (let i = 0; i < jsonData.length; i++) { + try { + // JSON.parse can throw, emit an error on that + super.write(JSON.parse(jsonData[i])) + } catch (er) { + this.emit('error', er) + continue + } + } + if (cb) cb() + } +} +``` diff --git a/node_modules/cmake-js/node_modules/minipass/dist/commonjs/index.d.ts b/node_modules/cmake-js/node_modules/minipass/dist/commonjs/index.d.ts new file mode 100644 index 0000000..3e75b57 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minipass/dist/commonjs/index.d.ts @@ -0,0 +1,545 @@ +import { EventEmitter } from 'node:events'; +import { StringDecoder } from 'node:string_decoder'; +/** + * Same as StringDecoder, but exposing the `lastNeed` flag on the type + */ +type SD = StringDecoder & { + lastNeed: boolean; +}; +export type { SD, Pipe, PipeProxyErrors }; +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +export declare const isStream: (s: any) => s is Minipass | NodeJS.ReadStream | NodeJS.WriteStream | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; +}) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; +}) | (NodeJS.ReadStream & { + fd: number; +}) | (NodeJS.WriteStream & { + fd: number; +}); +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +export declare const isReadable: (s: any) => s is Minipass.Readable; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +export declare const isWritable: (s: any) => s is Minipass.Readable; +declare const EOF: unique symbol; +declare const MAYBE_EMIT_END: unique symbol; +declare const EMITTED_END: unique symbol; +declare const EMITTING_END: unique symbol; +declare const EMITTED_ERROR: unique symbol; +declare const CLOSED: unique symbol; +declare const READ: unique symbol; +declare const FLUSH: unique symbol; +declare const FLUSHCHUNK: unique symbol; +declare const ENCODING: unique symbol; +declare const DECODER: unique symbol; +declare const FLOWING: unique symbol; +declare const PAUSED: unique symbol; +declare const RESUME: unique symbol; +declare const BUFFER: unique symbol; +declare const PIPES: unique symbol; +declare const BUFFERLENGTH: unique symbol; +declare const BUFFERPUSH: unique symbol; +declare const BUFFERSHIFT: unique symbol; +declare const OBJECTMODE: unique symbol; +declare const DESTROYED: unique symbol; +declare const ERROR: unique symbol; +declare const EMITDATA: unique symbol; +declare const EMITEND: unique symbol; +declare const EMITEND2: unique symbol; +declare const ASYNC: unique symbol; +declare const ABORT: unique symbol; +declare const ABORTED: unique symbol; +declare const SIGNAL: unique symbol; +declare const DATALISTENERS: unique symbol; +declare const DISCARDED: unique symbol; +/** + * Options that may be passed to stream.pipe() + */ +export interface PipeOptions { + /** + * end the destination stream when the source stream ends + */ + end?: boolean; + /** + * proxy errors from the source stream to the destination stream + */ + proxyErrors?: boolean; +} +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +declare class Pipe { + src: Minipass; + dest: Minipass; + opts: PipeOptions; + ondrain: () => any; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); + unpipe(): void; + proxyErrors(_er: any): void; + end(): void; +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +declare class PipeProxyErrors extends Pipe { + unpipe(): void; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); +} +export declare namespace Minipass { + /** + * Encoding used to create a stream that outputs strings rather than + * Buffer objects. + */ + export type Encoding = BufferEncoding | 'buffer' | null; + /** + * Any stream that Minipass can pipe into + */ + export type Writable = Minipass | NodeJS.WriteStream | (NodeJS.WriteStream & { + fd: number; + }) | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }); + /** + * Any stream that can be read from + */ + export type Readable = Minipass | NodeJS.ReadStream | (NodeJS.ReadStream & { + fd: number; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }); + /** + * Utility type that can be iterated sync or async + */ + export type DualIterable = Iterable & AsyncIterable; + type EventArguments = Record; + /** + * The listing of events that a Minipass class can emit. + * Extend this when extending the Minipass class, and pass as + * the third template argument. The key is the name of the event, + * and the value is the argument list. + * + * Any undeclared events will still be allowed, but the handler will get + * arguments as `unknown[]`. + */ + export interface Events extends EventArguments { + readable: []; + data: [chunk: RType]; + error: [er: unknown]; + abort: [reason: unknown]; + drain: []; + resume: []; + end: []; + finish: []; + prefinish: []; + close: []; + [DESTROYED]: [er?: unknown]; + [ERROR]: [er: unknown]; + } + /** + * String or buffer-like data that can be joined and sliced + */ + export type ContiguousData = Buffer | ArrayBufferLike | ArrayBufferView | string; + export type BufferOrString = Buffer | string; + /** + * Options passed to the Minipass constructor. + */ + export type SharedOptions = { + /** + * Defer all data emission and other events until the end of the + * current tick, similar to Node core streams + */ + async?: boolean; + /** + * A signal which will abort the stream + */ + signal?: AbortSignal; + /** + * Output string encoding. Set to `null` or `'buffer'` (or omit) to + * emit Buffer objects rather than strings. + * + * Conflicts with `objectMode` + */ + encoding?: BufferEncoding | null | 'buffer'; + /** + * Output data exactly as it was written, supporting non-buffer/string + * data (such as arbitrary objects, falsey values, etc.) + * + * Conflicts with `encoding` + */ + objectMode?: boolean; + }; + /** + * Options for a string encoded output + */ + export type EncodingOptions = SharedOptions & { + encoding: BufferEncoding; + objectMode?: false; + }; + /** + * Options for contiguous data buffer output + */ + export type BufferOptions = SharedOptions & { + encoding?: null | 'buffer'; + objectMode?: false; + }; + /** + * Options for objectMode arbitrary output + */ + export type ObjectModeOptions = SharedOptions & { + objectMode: true; + encoding?: null; + }; + /** + * Utility type to determine allowed options based on read type + */ + export type Options = ObjectModeOptions | (T extends string ? EncodingOptions : T extends Buffer ? BufferOptions : SharedOptions); + export {}; +} +/** + * Main export, the Minipass class + * + * `RType` is the type of data emitted, defaults to Buffer + * + * `WType` is the type of data to be written, if RType is buffer or string, + * then any {@link Minipass.ContiguousData} is allowed. + * + * `Events` is the set of event handler signatures that this object + * will emit, see {@link Minipass.Events} + */ +export declare class Minipass = Minipass.Events> extends EventEmitter implements Minipass.DualIterable { + [FLOWING]: boolean; + [PAUSED]: boolean; + [PIPES]: Pipe[]; + [BUFFER]: RType[]; + [OBJECTMODE]: boolean; + [ENCODING]: BufferEncoding | null; + [ASYNC]: boolean; + [DECODER]: SD | null; + [EOF]: boolean; + [EMITTED_END]: boolean; + [EMITTING_END]: boolean; + [CLOSED]: boolean; + [EMITTED_ERROR]: unknown; + [BUFFERLENGTH]: number; + [DESTROYED]: boolean; + [SIGNAL]?: AbortSignal; + [ABORTED]: boolean; + [DATALISTENERS]: number; + [DISCARDED]: boolean; + /** + * true if the stream can be written + */ + writable: boolean; + /** + * true if the stream can be read + */ + readable: boolean; + /** + * If `RType` is Buffer, then options do not need to be provided. + * Otherwise, an options object must be provided to specify either + * {@link Minipass.SharedOptions.objectMode} or + * {@link Minipass.SharedOptions.encoding}, as appropriate. + */ + constructor(...args: [Minipass.ObjectModeOptions] | (RType extends Buffer ? [] | [Minipass.Options] : [Minipass.Options])); + /** + * The amount of data stored in the buffer waiting to be read. + * + * For Buffer strings, this will be the total byte length. + * For string encoding streams, this will be the string character length, + * according to JavaScript's `string.length` logic. + * For objectMode streams, this is a count of the items waiting to be + * emitted. + */ + get bufferLength(): number; + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding(): BufferEncoding | null; + /** + * @deprecated - This is a read only property + */ + set encoding(_enc: BufferEncoding | null); + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc: Minipass.Encoding): void; + /** + * True if this is an objectMode stream + */ + get objectMode(): boolean; + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om: boolean); + /** + * true if this is an async stream + */ + get ['async'](): boolean; + /** + * Set to true to make this stream async. + * + * Once set, it cannot be unset, as this would potentially cause incorrect + * behavior. Ie, a sync stream can be made async, but an async stream + * cannot be safely made sync. + */ + set ['async'](a: boolean); + [ABORT](): void; + /** + * True if the stream has been aborted. + */ + get aborted(): boolean; + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_: boolean); + /** + * Write data into the stream + * + * If the chunk written is a string, and encoding is not specified, then + * `utf8` will be assumed. If the stream encoding matches the encoding of + * a written string, and the state of the string decoder allows it, then + * the string will be passed through to either the output or the internal + * buffer without any processing. Otherwise, it will be turned into a + * Buffer object for processing into the desired encoding. + * + * If provided, `cb` function is called immediately before return for + * sync streams, or on next tick for async streams, because for this + * base class, a chunk is considered "processed" once it is accepted + * and either emitted or buffered. That is, the callback does not indicate + * that the chunk has been eventually emitted, though of course child + * classes can override this function to do whatever processing is required + * and call `super.write(...)` only once processing is completed. + */ + write(chunk: WType, cb?: () => void): boolean; + write(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): boolean; + /** + * Low-level explicit read method. + * + * In objectMode, the argument is ignored, and one item is returned if + * available. + * + * `n` is the number of bytes (or in the case of encoding streams, + * characters) to consume. If `n` is not provided, then the entire buffer + * is returned, or `null` is returned if no data is available. + * + * If `n` is greater that the amount of data in the internal buffer, + * then `null` is returned. + */ + read(n?: number | null): RType | null; + [READ](n: number | null, chunk: RType): RType; + /** + * End the stream, optionally providing a final write. + * + * See {@link Minipass#write} for argument descriptions + */ + end(cb?: () => void): this; + end(chunk: WType, cb?: () => void): this; + end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this; + [RESUME](): void; + /** + * Resume the stream if it is currently in a paused state + * + * If called when there are no pipe destinations or `data` event listeners, + * this will place the stream in a "discarded" state, where all data will + * be thrown away. The discarded state is removed if a pipe destination or + * data handler is added, if pause() is called, or if any synchronous or + * asynchronous iteration is started. + */ + resume(): void; + /** + * Pause the stream + */ + pause(): void; + /** + * true if the stream has been forcibly destroyed + */ + get destroyed(): boolean; + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing(): boolean; + /** + * true if the stream is currently in a paused state + */ + get paused(): boolean; + [BUFFERPUSH](chunk: RType): void; + [BUFFERSHIFT](): RType; + [FLUSH](noDrain?: boolean): void; + [FLUSHCHUNK](chunk: RType): boolean; + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest: W, opts?: PipeOptions): W; + /** + * Fully unhook a piped destination stream. + * + * If the destination stream was the only consumer of this stream (ie, + * there are no other piped destinations or `'data'` event listeners) + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + unpipe(dest: W): void; + /** + * Alias for {@link Minipass#on} + */ + addListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.on`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * - Adding a 'data' event handler will trigger the flow of data + * + * - Adding a 'readable' event handler when there is data waiting to be read + * will cause 'readable' to be emitted immediately. + * + * - Adding an 'endish' event handler ('end', 'finish', etc.) which has + * already passed will cause the event to be emitted immediately and all + * handlers removed. + * + * - Adding an 'error' event handler after an error has been emitted will + * cause the event to be re-emitted immediately with the error previously + * raised. + */ + on(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.off` + * + * If a 'data' event handler is removed, and it was the last consumer + * (ie, there are no pipe destinations or other 'data' event listeners), + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + off(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.removeAllListeners` + * + * If all 'data' event handlers are removed, and they were the last consumer + * (ie, there are no pipe destinations), then the flow of data will stop + * until there is another consumer or {@link Minipass#resume} is explicitly + * called. + */ + removeAllListeners(ev?: Event): this; + /** + * true if the 'end' event has been emitted + */ + get emittedEnd(): boolean; + [MAYBE_EMIT_END](): void; + /** + * Mostly identical to `EventEmitter.emit`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * If the stream has been destroyed, and the event is something other + * than 'close' or 'error', then `false` is returned and no handlers + * are called. + * + * If the event is 'end', and has already been emitted, then the event + * is ignored. If the stream is in a paused or non-flowing state, then + * the event will be deferred until data flow resumes. If the stream is + * async, then handlers will be called on the next tick rather than + * immediately. + * + * If the event is 'close', and 'end' has not yet been emitted, then + * the event will be deferred until after 'end' is emitted. + * + * If the event is 'error', and an AbortSignal was provided for the stream, + * and there are no listeners, then the event is ignored, matching the + * behavior of node core streams in the presense of an AbortSignal. + * + * If the event is 'finish' or 'prefinish', then all listeners will be + * removed after emitting the event, to prevent double-firing. + */ + emit(ev: Event, ...args: Events[Event]): boolean; + [EMITDATA](data: RType): boolean; + [EMITEND](): boolean; + [EMITEND2](): boolean; + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + collect(): Promise; + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + concat(): Promise; + /** + * Return a void Promise that resolves once the stream ends. + */ + promise(): Promise; + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator](): AsyncGenerator; + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator](): Generator; + /** + * Destroy a stream, preventing it from being used for any further purpose. + * + * If the stream has a `close()` method, then it will be called on + * destruction. + * + * After destruction, any attempt to write data, read data, or emit most + * events will be ignored. + * + * If an error argument is provided, then it will be emitted in an + * 'error' event. + */ + destroy(er?: unknown): this; + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream(): (s: any) => s is Minipass | NodeJS.ReadStream | NodeJS.WriteStream | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }) | (NodeJS.ReadStream & { + fd: number; + }) | (NodeJS.WriteStream & { + fd: number; + }); +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minipass/dist/commonjs/index.d.ts.map b/node_modules/cmake-js/node_modules/minipass/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000..7bce611 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minipass/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD;;GAEG;AACH,KAAK,EAAE,GAAG,aAAa,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAA;AAE/C,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAA;AAEzC;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;EAQH,CAAA;AAElB;;GAEG;AACH,eAAO,MAAM,UAAU,oCAM2C,CAAA;AAElE;;GAEG;AACH,eAAO,MAAM,UAAU,oCAK6B,CAAA;AAEpD,QAAA,MAAM,GAAG,eAAgB,CAAA;AACzB,QAAA,MAAM,cAAc,eAAyB,CAAA;AAC7C,QAAA,MAAM,WAAW,eAAuB,CAAA;AACxC,QAAA,MAAM,YAAY,eAAwB,CAAA;AAC1C,QAAA,MAAM,aAAa,eAAyB,CAAA;AAC5C,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,IAAI,eAAiB,CAAA;AAC3B,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,OAAO,eAAoB,CAAA;AACj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AAI,CAAC,KAAK,SAAS,MAAM,MAAM,EAC7B,EAAE,EAAE,KAAK,EACT,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GACrB,OAAO,CAgDT;IAED,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,KAAK,WAOrB;IAED,CAAC,OAAO,CAAC,YAQR;IAED,CAAC,QAAQ,CAAC,YAiBT;IAED;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAezD;IAED;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,CAU7B;IAED;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAM7B;IAED;;;;OAIG;IACH,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CA4D1D;IAED;;;;;OAKG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAiChD;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO,QAwBnB;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ;;;;;;;;;;;OAElB;CACF","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe {\n src: Minipass\n dest: Minipass\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = (er: Error) => this.dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable = Iterable & AsyncIterable\n\n type EventArguments = Record\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events = Minipass.Events\n >\n extends EventEmitter\n implements Minipass.DualIterable\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options]\n : [Minipass.Options])\n ) {\n const options: Minipass.Options = (args[0] ||\n {}) as Minipass.Options\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this as Minipass, dest, opts)\n : new PipeProxyErrors(this as Minipass, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n [Symbol.asyncDispose]: async () => {},\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n [Symbol.dispose]: () => {},\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minipass/dist/commonjs/index.js b/node_modules/cmake-js/node_modules/minipass/dist/commonjs/index.js new file mode 100644 index 0000000..91f3a5c --- /dev/null +++ b/node_modules/cmake-js/node_modules/minipass/dist/commonjs/index.js @@ -0,0 +1,1038 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Minipass = exports.isWritable = exports.isReadable = exports.isStream = void 0; +const proc = typeof process === 'object' && process + ? process + : { + stdout: null, + stderr: null, + }; +const node_events_1 = require("node:events"); +const node_stream_1 = __importDefault(require("node:stream")); +const node_string_decoder_1 = require("node:string_decoder"); +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +const isStream = (s) => !!s && + typeof s === 'object' && + (s instanceof Minipass || + s instanceof node_stream_1.default || + (0, exports.isReadable)(s) || + (0, exports.isWritable)(s)) +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +; +exports.isStream = isStream; +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +const isReadable = (s) => !!s && + typeof s === 'object' && + s instanceof node_events_1.EventEmitter && + typeof s.pipe === 'function' && + // node core Writable streams have a pipe() method, but it throws + s.pipe !== node_stream_1.default.Writable.prototype.pipe +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +; +exports.isReadable = isReadable; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +const isWritable = (s) => !!s && + typeof s === 'object' && + s instanceof node_events_1.EventEmitter && + typeof s.write === 'function' && + typeof s.end === 'function'; +exports.isWritable = isWritable; +const EOF = Symbol('EOF'); +const MAYBE_EMIT_END = Symbol('maybeEmitEnd'); +const EMITTED_END = Symbol('emittedEnd'); +const EMITTING_END = Symbol('emittingEnd'); +const EMITTED_ERROR = Symbol('emittedError'); +const CLOSED = Symbol('closed'); +const READ = Symbol('read'); +const FLUSH = Symbol('flush'); +const FLUSHCHUNK = Symbol('flushChunk'); +const ENCODING = Symbol('encoding'); +const DECODER = Symbol('decoder'); +const FLOWING = Symbol('flowing'); +const PAUSED = Symbol('paused'); +const RESUME = Symbol('resume'); +const BUFFER = Symbol('buffer'); +const PIPES = Symbol('pipes'); +const BUFFERLENGTH = Symbol('bufferLength'); +const BUFFERPUSH = Symbol('bufferPush'); +const BUFFERSHIFT = Symbol('bufferShift'); +const OBJECTMODE = Symbol('objectMode'); +// internal event when stream is destroyed +const DESTROYED = Symbol('destroyed'); +// internal event when stream has an error +const ERROR = Symbol('error'); +const EMITDATA = Symbol('emitData'); +const EMITEND = Symbol('emitEnd'); +const EMITEND2 = Symbol('emitEnd2'); +const ASYNC = Symbol('async'); +const ABORT = Symbol('abort'); +const ABORTED = Symbol('aborted'); +const SIGNAL = Symbol('signal'); +const DATALISTENERS = Symbol('dataListeners'); +const DISCARDED = Symbol('discarded'); +const defer = (fn) => Promise.resolve().then(fn); +const nodefer = (fn) => fn(); +const isEndish = (ev) => ev === 'end' || ev === 'finish' || ev === 'prefinish'; +const isArrayBufferLike = (b) => b instanceof ArrayBuffer || + (!!b && + typeof b === 'object' && + b.constructor && + b.constructor.name === 'ArrayBuffer' && + b.byteLength >= 0); +const isArrayBufferView = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b); +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +class Pipe { + src; + dest; + opts; + ondrain; + constructor(src, dest, opts) { + this.src = src; + this.dest = dest; + this.opts = opts; + this.ondrain = () => src[RESUME](); + this.dest.on('drain', this.ondrain); + } + unpipe() { + this.dest.removeListener('drain', this.ondrain); + } + // only here for the prototype + /* c8 ignore start */ + proxyErrors(_er) { } + /* c8 ignore stop */ + end() { + this.unpipe(); + if (this.opts.end) + this.dest.end(); + } +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +class PipeProxyErrors extends Pipe { + unpipe() { + this.src.removeListener('error', this.proxyErrors); + super.unpipe(); + } + constructor(src, dest, opts) { + super(src, dest, opts); + this.proxyErrors = (er) => this.dest.emit('error', er); + src.on('error', this.proxyErrors); + } +} +const isObjectModeOptions = (o) => !!o.objectMode; +const isEncodingOptions = (o) => !o.objectMode && !!o.encoding && o.encoding !== 'buffer'; +/** + * Main export, the Minipass class + * + * `RType` is the type of data emitted, defaults to Buffer + * + * `WType` is the type of data to be written, if RType is buffer or string, + * then any {@link Minipass.ContiguousData} is allowed. + * + * `Events` is the set of event handler signatures that this object + * will emit, see {@link Minipass.Events} + */ +class Minipass extends node_events_1.EventEmitter { + [FLOWING] = false; + [PAUSED] = false; + [PIPES] = []; + [BUFFER] = []; + [OBJECTMODE]; + [ENCODING]; + [ASYNC]; + [DECODER]; + [EOF] = false; + [EMITTED_END] = false; + [EMITTING_END] = false; + [CLOSED] = false; + [EMITTED_ERROR] = null; + [BUFFERLENGTH] = 0; + [DESTROYED] = false; + [SIGNAL]; + [ABORTED] = false; + [DATALISTENERS] = 0; + [DISCARDED] = false; + /** + * true if the stream can be written + */ + writable = true; + /** + * true if the stream can be read + */ + readable = true; + /** + * If `RType` is Buffer, then options do not need to be provided. + * Otherwise, an options object must be provided to specify either + * {@link Minipass.SharedOptions.objectMode} or + * {@link Minipass.SharedOptions.encoding}, as appropriate. + */ + constructor(...args) { + const options = (args[0] || + {}); + super(); + if (options.objectMode && typeof options.encoding === 'string') { + throw new TypeError('Encoding and objectMode may not be used together'); + } + if (isObjectModeOptions(options)) { + this[OBJECTMODE] = true; + this[ENCODING] = null; + } + else if (isEncodingOptions(options)) { + this[ENCODING] = options.encoding; + this[OBJECTMODE] = false; + } + else { + this[OBJECTMODE] = false; + this[ENCODING] = null; + } + this[ASYNC] = !!options.async; + this[DECODER] = this[ENCODING] + ? new node_string_decoder_1.StringDecoder(this[ENCODING]) + : null; + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposeBuffer === true) { + Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] }); + } + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposePipes === true) { + Object.defineProperty(this, 'pipes', { get: () => this[PIPES] }); + } + const { signal } = options; + if (signal) { + this[SIGNAL] = signal; + if (signal.aborted) { + this[ABORT](); + } + else { + signal.addEventListener('abort', () => this[ABORT]()); + } + } + } + /** + * The amount of data stored in the buffer waiting to be read. + * + * For Buffer strings, this will be the total byte length. + * For string encoding streams, this will be the string character length, + * according to JavaScript's `string.length` logic. + * For objectMode streams, this is a count of the items waiting to be + * emitted. + */ + get bufferLength() { + return this[BUFFERLENGTH]; + } + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding() { + return this[ENCODING]; + } + /** + * @deprecated - This is a read only property + */ + set encoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * True if this is an objectMode stream + */ + get objectMode() { + return this[OBJECTMODE]; + } + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om) { + throw new Error('objectMode must be set at instantiation time'); + } + /** + * true if this is an async stream + */ + get ['async']() { + return this[ASYNC]; + } + /** + * Set to true to make this stream async. + * + * Once set, it cannot be unset, as this would potentially cause incorrect + * behavior. Ie, a sync stream can be made async, but an async stream + * cannot be safely made sync. + */ + set ['async'](a) { + this[ASYNC] = this[ASYNC] || !!a; + } + // drop everything and get out of the flow completely + [ABORT]() { + this[ABORTED] = true; + this.emit('abort', this[SIGNAL]?.reason); + this.destroy(this[SIGNAL]?.reason); + } + /** + * True if the stream has been aborted. + */ + get aborted() { + return this[ABORTED]; + } + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_) { } + write(chunk, encoding, cb) { + if (this[ABORTED]) + return false; + if (this[EOF]) + throw new Error('write after end'); + if (this[DESTROYED]) { + this.emit('error', Object.assign(new Error('Cannot call write after a stream was destroyed'), { code: 'ERR_STREAM_DESTROYED' })); + return true; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (!encoding) + encoding = 'utf8'; + const fn = this[ASYNC] ? defer : nodefer; + // convert array buffers and typed array views into buffers + // at some point in the future, we may want to do the opposite! + // leave strings and buffers as-is + // anything is only allowed if in object mode, so throw + if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) { + if (isArrayBufferView(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength); + } + else if (isArrayBufferLike(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk); + } + else if (typeof chunk !== 'string') { + throw new Error('Non-contiguous data written to non-objectMode stream'); + } + } + // handle object mode up front, since it's simpler + // this yields better performance, fewer checks later. + if (this[OBJECTMODE]) { + // maybe impossible? + /* c8 ignore start */ + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + /* c8 ignore stop */ + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // at this point the chunk is a buffer or string + // don't buffer it up or send it to the decoder + if (!chunk.length) { + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // fast-path writing strings of same encoding to a stream with + // an empty buffer, skipping the buffer/decoder dance + if (typeof chunk === 'string' && + // unless it is a string already ready for us to use + !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)) { + //@ts-ignore - sinful unsafe type change + chunk = Buffer.from(chunk, encoding); + } + if (Buffer.isBuffer(chunk) && this[ENCODING]) { + //@ts-ignore - sinful unsafe type change + chunk = this[DECODER].write(chunk); + } + // Note: flushing CAN potentially switch us into not-flowing mode + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + /** + * Low-level explicit read method. + * + * In objectMode, the argument is ignored, and one item is returned if + * available. + * + * `n` is the number of bytes (or in the case of encoding streams, + * characters) to consume. If `n` is not provided, then the entire buffer + * is returned, or `null` is returned if no data is available. + * + * If `n` is greater that the amount of data in the internal buffer, + * then `null` is returned. + */ + read(n) { + if (this[DESTROYED]) + return null; + this[DISCARDED] = false; + if (this[BUFFERLENGTH] === 0 || + n === 0 || + (n && n > this[BUFFERLENGTH])) { + this[MAYBE_EMIT_END](); + return null; + } + if (this[OBJECTMODE]) + n = null; + if (this[BUFFER].length > 1 && !this[OBJECTMODE]) { + // not object mode, so if we have an encoding, then RType is string + // otherwise, must be Buffer + this[BUFFER] = [ + (this[ENCODING] + ? this[BUFFER].join('') + : Buffer.concat(this[BUFFER], this[BUFFERLENGTH])), + ]; + } + const ret = this[READ](n || null, this[BUFFER][0]); + this[MAYBE_EMIT_END](); + return ret; + } + [READ](n, chunk) { + if (this[OBJECTMODE]) + this[BUFFERSHIFT](); + else { + const c = chunk; + if (n === c.length || n === null) + this[BUFFERSHIFT](); + else if (typeof c === 'string') { + this[BUFFER][0] = c.slice(n); + chunk = c.slice(0, n); + this[BUFFERLENGTH] -= n; + } + else { + this[BUFFER][0] = c.subarray(n); + chunk = c.subarray(0, n); + this[BUFFERLENGTH] -= n; + } + } + this.emit('data', chunk); + if (!this[BUFFER].length && !this[EOF]) + this.emit('drain'); + return chunk; + } + end(chunk, encoding, cb) { + if (typeof chunk === 'function') { + cb = chunk; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (chunk !== undefined) + this.write(chunk, encoding); + if (cb) + this.once('end', cb); + this[EOF] = true; + this.writable = false; + // if we haven't written anything, then go ahead and emit, + // even if we're not reading. + // we'll re-emit if a new 'end' listener is added anyway. + // This makes MP more suitable to write-only use cases. + if (this[FLOWING] || !this[PAUSED]) + this[MAYBE_EMIT_END](); + return this; + } + // don't let the internal resume be overwritten + [RESUME]() { + if (this[DESTROYED]) + return; + if (!this[DATALISTENERS] && !this[PIPES].length) { + this[DISCARDED] = true; + } + this[PAUSED] = false; + this[FLOWING] = true; + this.emit('resume'); + if (this[BUFFER].length) + this[FLUSH](); + else if (this[EOF]) + this[MAYBE_EMIT_END](); + else + this.emit('drain'); + } + /** + * Resume the stream if it is currently in a paused state + * + * If called when there are no pipe destinations or `data` event listeners, + * this will place the stream in a "discarded" state, where all data will + * be thrown away. The discarded state is removed if a pipe destination or + * data handler is added, if pause() is called, or if any synchronous or + * asynchronous iteration is started. + */ + resume() { + return this[RESUME](); + } + /** + * Pause the stream + */ + pause() { + this[FLOWING] = false; + this[PAUSED] = true; + this[DISCARDED] = false; + } + /** + * true if the stream has been forcibly destroyed + */ + get destroyed() { + return this[DESTROYED]; + } + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing() { + return this[FLOWING]; + } + /** + * true if the stream is currently in a paused state + */ + get paused() { + return this[PAUSED]; + } + [BUFFERPUSH](chunk) { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] += 1; + else + this[BUFFERLENGTH] += chunk.length; + this[BUFFER].push(chunk); + } + [BUFFERSHIFT]() { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] -= 1; + else + this[BUFFERLENGTH] -= this[BUFFER][0].length; + return this[BUFFER].shift(); + } + [FLUSH](noDrain = false) { + do { } while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && + this[BUFFER].length); + if (!noDrain && !this[BUFFER].length && !this[EOF]) + this.emit('drain'); + } + [FLUSHCHUNK](chunk) { + this.emit('data', chunk); + return this[FLOWING]; + } + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest, opts) { + if (this[DESTROYED]) + return dest; + this[DISCARDED] = false; + const ended = this[EMITTED_END]; + opts = opts || {}; + if (dest === proc.stdout || dest === proc.stderr) + opts.end = false; + else + opts.end = opts.end !== false; + opts.proxyErrors = !!opts.proxyErrors; + // piping an ended stream ends immediately + if (ended) { + if (opts.end) + dest.end(); + } + else { + // "as" here just ignores the WType, which pipes don't care about, + // since they're only consuming from us, and writing to the dest + this[PIPES].push(!opts.proxyErrors + ? new Pipe(this, dest, opts) + : new PipeProxyErrors(this, dest, opts)); + if (this[ASYNC]) + defer(() => this[RESUME]()); + else + this[RESUME](); + } + return dest; + } + /** + * Fully unhook a piped destination stream. + * + * If the destination stream was the only consumer of this stream (ie, + * there are no other piped destinations or `'data'` event listeners) + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + unpipe(dest) { + const p = this[PIPES].find(p => p.dest === dest); + if (p) { + if (this[PIPES].length === 1) { + if (this[FLOWING] && this[DATALISTENERS] === 0) { + this[FLOWING] = false; + } + this[PIPES] = []; + } + else + this[PIPES].splice(this[PIPES].indexOf(p), 1); + p.unpipe(); + } + } + /** + * Alias for {@link Minipass#on} + */ + addListener(ev, handler) { + return this.on(ev, handler); + } + /** + * Mostly identical to `EventEmitter.on`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * - Adding a 'data' event handler will trigger the flow of data + * + * - Adding a 'readable' event handler when there is data waiting to be read + * will cause 'readable' to be emitted immediately. + * + * - Adding an 'endish' event handler ('end', 'finish', etc.) which has + * already passed will cause the event to be emitted immediately and all + * handlers removed. + * + * - Adding an 'error' event handler after an error has been emitted will + * cause the event to be re-emitted immediately with the error previously + * raised. + */ + on(ev, handler) { + const ret = super.on(ev, handler); + if (ev === 'data') { + this[DISCARDED] = false; + this[DATALISTENERS]++; + if (!this[PIPES].length && !this[FLOWING]) { + this[RESUME](); + } + } + else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) { + super.emit('readable'); + } + else if (isEndish(ev) && this[EMITTED_END]) { + super.emit(ev); + this.removeAllListeners(ev); + } + else if (ev === 'error' && this[EMITTED_ERROR]) { + const h = handler; + if (this[ASYNC]) + defer(() => h.call(this, this[EMITTED_ERROR])); + else + h.call(this, this[EMITTED_ERROR]); + } + return ret; + } + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev, handler) { + return this.off(ev, handler); + } + /** + * Mostly identical to `EventEmitter.off` + * + * If a 'data' event handler is removed, and it was the last consumer + * (ie, there are no pipe destinations or other 'data' event listeners), + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + off(ev, handler) { + const ret = super.off(ev, handler); + // if we previously had listeners, and now we don't, and we don't + // have any pipes, then stop the flow, unless it's been explicitly + // put in a discarded flowing state via stream.resume(). + if (ev === 'data') { + this[DATALISTENERS] = this.listeners('data').length; + if (this[DATALISTENERS] === 0 && + !this[DISCARDED] && + !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * Mostly identical to `EventEmitter.removeAllListeners` + * + * If all 'data' event handlers are removed, and they were the last consumer + * (ie, there are no pipe destinations), then the flow of data will stop + * until there is another consumer or {@link Minipass#resume} is explicitly + * called. + */ + removeAllListeners(ev) { + const ret = super.removeAllListeners(ev); + if (ev === 'data' || ev === undefined) { + this[DATALISTENERS] = 0; + if (!this[DISCARDED] && !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * true if the 'end' event has been emitted + */ + get emittedEnd() { + return this[EMITTED_END]; + } + [MAYBE_EMIT_END]() { + if (!this[EMITTING_END] && + !this[EMITTED_END] && + !this[DESTROYED] && + this[BUFFER].length === 0 && + this[EOF]) { + this[EMITTING_END] = true; + this.emit('end'); + this.emit('prefinish'); + this.emit('finish'); + if (this[CLOSED]) + this.emit('close'); + this[EMITTING_END] = false; + } + } + /** + * Mostly identical to `EventEmitter.emit`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * If the stream has been destroyed, and the event is something other + * than 'close' or 'error', then `false` is returned and no handlers + * are called. + * + * If the event is 'end', and has already been emitted, then the event + * is ignored. If the stream is in a paused or non-flowing state, then + * the event will be deferred until data flow resumes. If the stream is + * async, then handlers will be called on the next tick rather than + * immediately. + * + * If the event is 'close', and 'end' has not yet been emitted, then + * the event will be deferred until after 'end' is emitted. + * + * If the event is 'error', and an AbortSignal was provided for the stream, + * and there are no listeners, then the event is ignored, matching the + * behavior of node core streams in the presense of an AbortSignal. + * + * If the event is 'finish' or 'prefinish', then all listeners will be + * removed after emitting the event, to prevent double-firing. + */ + emit(ev, ...args) { + const data = args[0]; + // error and close are only events allowed after calling destroy() + if (ev !== 'error' && + ev !== 'close' && + ev !== DESTROYED && + this[DESTROYED]) { + return false; + } + else if (ev === 'data') { + return !this[OBJECTMODE] && !data + ? false + : this[ASYNC] + ? (defer(() => this[EMITDATA](data)), true) + : this[EMITDATA](data); + } + else if (ev === 'end') { + return this[EMITEND](); + } + else if (ev === 'close') { + this[CLOSED] = true; + // don't emit close before 'end' and 'finish' + if (!this[EMITTED_END] && !this[DESTROYED]) + return false; + const ret = super.emit('close'); + this.removeAllListeners('close'); + return ret; + } + else if (ev === 'error') { + this[EMITTED_ERROR] = data; + super.emit(ERROR, data); + const ret = !this[SIGNAL] || this.listeners('error').length + ? super.emit('error', data) + : false; + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'resume') { + const ret = super.emit('resume'); + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'finish' || ev === 'prefinish') { + const ret = super.emit(ev); + this.removeAllListeners(ev); + return ret; + } + // Some other unknown event + const ret = super.emit(ev, ...args); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITDATA](data) { + for (const p of this[PIPES]) { + if (p.dest.write(data) === false) + this.pause(); + } + const ret = this[DISCARDED] ? false : super.emit('data', data); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITEND]() { + if (this[EMITTED_END]) + return false; + this[EMITTED_END] = true; + this.readable = false; + return this[ASYNC] + ? (defer(() => this[EMITEND2]()), true) + : this[EMITEND2](); + } + [EMITEND2]() { + if (this[DECODER]) { + const data = this[DECODER].end(); + if (data) { + for (const p of this[PIPES]) { + p.dest.write(data); + } + if (!this[DISCARDED]) + super.emit('data', data); + } + } + for (const p of this[PIPES]) { + p.end(); + } + const ret = super.emit('end'); + this.removeAllListeners('end'); + return ret; + } + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + async collect() { + const buf = Object.assign([], { + dataLength: 0, + }); + if (!this[OBJECTMODE]) + buf.dataLength = 0; + // set the promise first, in case an error is raised + // by triggering the flow here. + const p = this.promise(); + this.on('data', c => { + buf.push(c); + if (!this[OBJECTMODE]) + buf.dataLength += c.length; + }); + await p; + return buf; + } + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + async concat() { + if (this[OBJECTMODE]) { + throw new Error('cannot concat in objectMode'); + } + const buf = await this.collect(); + return (this[ENCODING] + ? buf.join('') + : Buffer.concat(buf, buf.dataLength)); + } + /** + * Return a void Promise that resolves once the stream ends. + */ + async promise() { + return new Promise((resolve, reject) => { + this.on(DESTROYED, () => reject(new Error('stream destroyed'))); + this.on('error', er => reject(er)); + this.on('end', () => resolve()); + }); + } + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = async () => { + this.pause(); + stopped = true; + return { value: undefined, done: true }; + }; + const next = () => { + if (stopped) + return stop(); + const res = this.read(); + if (res !== null) + return Promise.resolve({ done: false, value: res }); + if (this[EOF]) + return stop(); + let resolve; + let reject; + const onerr = (er) => { + this.off('data', ondata); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + stop(); + reject(er); + }; + const ondata = (value) => { + this.off('error', onerr); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + this.pause(); + resolve({ value, done: !!this[EOF] }); + }; + const onend = () => { + this.off('error', onerr); + this.off('data', ondata); + this.off(DESTROYED, ondestroy); + stop(); + resolve({ done: true, value: undefined }); + }; + const ondestroy = () => onerr(new Error('stream destroyed')); + return new Promise((res, rej) => { + reject = rej; + resolve = res; + this.once(DESTROYED, ondestroy); + this.once('error', onerr); + this.once('end', onend); + this.once('data', ondata); + }); + }; + return { + next, + throw: stop, + return: stop, + [Symbol.asyncIterator]() { + return this; + }, + [Symbol.asyncDispose]: async () => { }, + }; + } + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = () => { + this.pause(); + this.off(ERROR, stop); + this.off(DESTROYED, stop); + this.off('end', stop); + stopped = true; + return { done: true, value: undefined }; + }; + const next = () => { + if (stopped) + return stop(); + const value = this.read(); + return value === null ? stop() : { done: false, value }; + }; + this.once('end', stop); + this.once(ERROR, stop); + this.once(DESTROYED, stop); + return { + next, + throw: stop, + return: stop, + [Symbol.iterator]() { + return this; + }, + [Symbol.dispose]: () => { }, + }; + } + /** + * Destroy a stream, preventing it from being used for any further purpose. + * + * If the stream has a `close()` method, then it will be called on + * destruction. + * + * After destruction, any attempt to write data, read data, or emit most + * events will be ignored. + * + * If an error argument is provided, then it will be emitted in an + * 'error' event. + */ + destroy(er) { + if (this[DESTROYED]) { + if (er) + this.emit('error', er); + else + this.emit(DESTROYED); + return this; + } + this[DESTROYED] = true; + this[DISCARDED] = true; + // throw away all buffered data, it's never coming out + this[BUFFER].length = 0; + this[BUFFERLENGTH] = 0; + const wc = this; + if (typeof wc.close === 'function' && !this[CLOSED]) + wc.close(); + if (er) + this.emit('error', er); + // if no error to emit, still reject pending promises + else + this.emit(DESTROYED); + return this; + } + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream() { + return exports.isStream; + } +} +exports.Minipass = Minipass; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minipass/dist/commonjs/index.js.map b/node_modules/cmake-js/node_modules/minipass/dist/commonjs/index.js.map new file mode 100644 index 0000000..1687b4c --- /dev/null +++ b/node_modules/cmake-js/node_modules/minipass/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,MAAM,IAAI,GACR,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO;IACpC,CAAC,CAAC,OAAO;IACT,CAAC,CAAC;QACE,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;KACb,CAAA;AACP,6CAA0C;AAC1C,8DAAgC;AAChC,6DAAmD;AASnD;;;GAGG;AACI,MAAM,QAAQ,GAAG,CACtB,CAAM,EACsC,EAAE,CAC9C,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,CAAC,YAAY,QAAQ;QACpB,CAAC,YAAY,qBAAM;QACnB,IAAA,QAAA,UAAU,EAAC,CAAC,CAAC;QACb,IAAA,QAAA,UAAU,EAAC,CAAC,CAAC,CAAC;AAElB;;GAEG;AAJe,CAAA;AARL,QAAA,QAAQ,GAAR,QAAQ,CAQH;AAElB;;GAEG;AACI,MAAM,UAAU,GAAG,CAAC,CAAM,EAA0B,EAAE,CAC3D,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,YAAY,0BAAY;IACzB,OAAQ,CAAuB,CAAC,IAAI,KAAK,UAAU;IACnD,iEAAiE;IAChE,CAAuB,CAAC,IAAI,KAAK,qBAAM,CAAC,QAAQ,CAAC,SAA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AAO,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC,CAAC;SAC3B,CAAA;IAAA,CACF;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAY,EAAE;QACpB,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YACpB,IAAI,EAAE;gBAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;;gBACzB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YACzB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;QACtB,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;QAEtB,sDAAsD;QACtD,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;QACvB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;QAEtB,MAAM,EAAE,GAAG,IAEV,CAAA;QACD,IAAI,OAAO,EAAE,CAAC,KAAK,KAAK,UAAU,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,EAAE,CAAC,KAAK,EAAE,CAAA;QAE/D,IAAI,EAAE;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;QAC9B,qDAAqD;;YAChD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAEzB,OAAO,IAAI,CAAA;IAAA,CACZ;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ,GAAG;QACpB,OAAO,QAAA,QAAQ,CAAA;IAAA,CAChB;CACF","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe {\n src: Minipass\n dest: Minipass\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = (er: Error) => this.dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable = Iterable & AsyncIterable\n\n type EventArguments = Record\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events = Minipass.Events\n >\n extends EventEmitter\n implements Minipass.DualIterable\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options]\n : [Minipass.Options])\n ) {\n const options: Minipass.Options = (args[0] ||\n {}) as Minipass.Options\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this as Minipass, dest, opts)\n : new PipeProxyErrors(this as Minipass, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n [Symbol.asyncDispose]: async () => {},\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n [Symbol.dispose]: () => {},\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minipass/dist/commonjs/package.json b/node_modules/cmake-js/node_modules/minipass/dist/commonjs/package.json new file mode 100644 index 0000000..5bbefff --- /dev/null +++ b/node_modules/cmake-js/node_modules/minipass/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/cmake-js/node_modules/minipass/dist/esm/index.d.ts b/node_modules/cmake-js/node_modules/minipass/dist/esm/index.d.ts new file mode 100644 index 0000000..3e75b57 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minipass/dist/esm/index.d.ts @@ -0,0 +1,545 @@ +import { EventEmitter } from 'node:events'; +import { StringDecoder } from 'node:string_decoder'; +/** + * Same as StringDecoder, but exposing the `lastNeed` flag on the type + */ +type SD = StringDecoder & { + lastNeed: boolean; +}; +export type { SD, Pipe, PipeProxyErrors }; +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +export declare const isStream: (s: any) => s is Minipass | NodeJS.ReadStream | NodeJS.WriteStream | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; +}) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; +}) | (NodeJS.ReadStream & { + fd: number; +}) | (NodeJS.WriteStream & { + fd: number; +}); +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +export declare const isReadable: (s: any) => s is Minipass.Readable; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +export declare const isWritable: (s: any) => s is Minipass.Readable; +declare const EOF: unique symbol; +declare const MAYBE_EMIT_END: unique symbol; +declare const EMITTED_END: unique symbol; +declare const EMITTING_END: unique symbol; +declare const EMITTED_ERROR: unique symbol; +declare const CLOSED: unique symbol; +declare const READ: unique symbol; +declare const FLUSH: unique symbol; +declare const FLUSHCHUNK: unique symbol; +declare const ENCODING: unique symbol; +declare const DECODER: unique symbol; +declare const FLOWING: unique symbol; +declare const PAUSED: unique symbol; +declare const RESUME: unique symbol; +declare const BUFFER: unique symbol; +declare const PIPES: unique symbol; +declare const BUFFERLENGTH: unique symbol; +declare const BUFFERPUSH: unique symbol; +declare const BUFFERSHIFT: unique symbol; +declare const OBJECTMODE: unique symbol; +declare const DESTROYED: unique symbol; +declare const ERROR: unique symbol; +declare const EMITDATA: unique symbol; +declare const EMITEND: unique symbol; +declare const EMITEND2: unique symbol; +declare const ASYNC: unique symbol; +declare const ABORT: unique symbol; +declare const ABORTED: unique symbol; +declare const SIGNAL: unique symbol; +declare const DATALISTENERS: unique symbol; +declare const DISCARDED: unique symbol; +/** + * Options that may be passed to stream.pipe() + */ +export interface PipeOptions { + /** + * end the destination stream when the source stream ends + */ + end?: boolean; + /** + * proxy errors from the source stream to the destination stream + */ + proxyErrors?: boolean; +} +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +declare class Pipe { + src: Minipass; + dest: Minipass; + opts: PipeOptions; + ondrain: () => any; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); + unpipe(): void; + proxyErrors(_er: any): void; + end(): void; +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +declare class PipeProxyErrors extends Pipe { + unpipe(): void; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); +} +export declare namespace Minipass { + /** + * Encoding used to create a stream that outputs strings rather than + * Buffer objects. + */ + export type Encoding = BufferEncoding | 'buffer' | null; + /** + * Any stream that Minipass can pipe into + */ + export type Writable = Minipass | NodeJS.WriteStream | (NodeJS.WriteStream & { + fd: number; + }) | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }); + /** + * Any stream that can be read from + */ + export type Readable = Minipass | NodeJS.ReadStream | (NodeJS.ReadStream & { + fd: number; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }); + /** + * Utility type that can be iterated sync or async + */ + export type DualIterable = Iterable & AsyncIterable; + type EventArguments = Record; + /** + * The listing of events that a Minipass class can emit. + * Extend this when extending the Minipass class, and pass as + * the third template argument. The key is the name of the event, + * and the value is the argument list. + * + * Any undeclared events will still be allowed, but the handler will get + * arguments as `unknown[]`. + */ + export interface Events extends EventArguments { + readable: []; + data: [chunk: RType]; + error: [er: unknown]; + abort: [reason: unknown]; + drain: []; + resume: []; + end: []; + finish: []; + prefinish: []; + close: []; + [DESTROYED]: [er?: unknown]; + [ERROR]: [er: unknown]; + } + /** + * String or buffer-like data that can be joined and sliced + */ + export type ContiguousData = Buffer | ArrayBufferLike | ArrayBufferView | string; + export type BufferOrString = Buffer | string; + /** + * Options passed to the Minipass constructor. + */ + export type SharedOptions = { + /** + * Defer all data emission and other events until the end of the + * current tick, similar to Node core streams + */ + async?: boolean; + /** + * A signal which will abort the stream + */ + signal?: AbortSignal; + /** + * Output string encoding. Set to `null` or `'buffer'` (or omit) to + * emit Buffer objects rather than strings. + * + * Conflicts with `objectMode` + */ + encoding?: BufferEncoding | null | 'buffer'; + /** + * Output data exactly as it was written, supporting non-buffer/string + * data (such as arbitrary objects, falsey values, etc.) + * + * Conflicts with `encoding` + */ + objectMode?: boolean; + }; + /** + * Options for a string encoded output + */ + export type EncodingOptions = SharedOptions & { + encoding: BufferEncoding; + objectMode?: false; + }; + /** + * Options for contiguous data buffer output + */ + export type BufferOptions = SharedOptions & { + encoding?: null | 'buffer'; + objectMode?: false; + }; + /** + * Options for objectMode arbitrary output + */ + export type ObjectModeOptions = SharedOptions & { + objectMode: true; + encoding?: null; + }; + /** + * Utility type to determine allowed options based on read type + */ + export type Options = ObjectModeOptions | (T extends string ? EncodingOptions : T extends Buffer ? BufferOptions : SharedOptions); + export {}; +} +/** + * Main export, the Minipass class + * + * `RType` is the type of data emitted, defaults to Buffer + * + * `WType` is the type of data to be written, if RType is buffer or string, + * then any {@link Minipass.ContiguousData} is allowed. + * + * `Events` is the set of event handler signatures that this object + * will emit, see {@link Minipass.Events} + */ +export declare class Minipass = Minipass.Events> extends EventEmitter implements Minipass.DualIterable { + [FLOWING]: boolean; + [PAUSED]: boolean; + [PIPES]: Pipe[]; + [BUFFER]: RType[]; + [OBJECTMODE]: boolean; + [ENCODING]: BufferEncoding | null; + [ASYNC]: boolean; + [DECODER]: SD | null; + [EOF]: boolean; + [EMITTED_END]: boolean; + [EMITTING_END]: boolean; + [CLOSED]: boolean; + [EMITTED_ERROR]: unknown; + [BUFFERLENGTH]: number; + [DESTROYED]: boolean; + [SIGNAL]?: AbortSignal; + [ABORTED]: boolean; + [DATALISTENERS]: number; + [DISCARDED]: boolean; + /** + * true if the stream can be written + */ + writable: boolean; + /** + * true if the stream can be read + */ + readable: boolean; + /** + * If `RType` is Buffer, then options do not need to be provided. + * Otherwise, an options object must be provided to specify either + * {@link Minipass.SharedOptions.objectMode} or + * {@link Minipass.SharedOptions.encoding}, as appropriate. + */ + constructor(...args: [Minipass.ObjectModeOptions] | (RType extends Buffer ? [] | [Minipass.Options] : [Minipass.Options])); + /** + * The amount of data stored in the buffer waiting to be read. + * + * For Buffer strings, this will be the total byte length. + * For string encoding streams, this will be the string character length, + * according to JavaScript's `string.length` logic. + * For objectMode streams, this is a count of the items waiting to be + * emitted. + */ + get bufferLength(): number; + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding(): BufferEncoding | null; + /** + * @deprecated - This is a read only property + */ + set encoding(_enc: BufferEncoding | null); + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc: Minipass.Encoding): void; + /** + * True if this is an objectMode stream + */ + get objectMode(): boolean; + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om: boolean); + /** + * true if this is an async stream + */ + get ['async'](): boolean; + /** + * Set to true to make this stream async. + * + * Once set, it cannot be unset, as this would potentially cause incorrect + * behavior. Ie, a sync stream can be made async, but an async stream + * cannot be safely made sync. + */ + set ['async'](a: boolean); + [ABORT](): void; + /** + * True if the stream has been aborted. + */ + get aborted(): boolean; + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_: boolean); + /** + * Write data into the stream + * + * If the chunk written is a string, and encoding is not specified, then + * `utf8` will be assumed. If the stream encoding matches the encoding of + * a written string, and the state of the string decoder allows it, then + * the string will be passed through to either the output or the internal + * buffer without any processing. Otherwise, it will be turned into a + * Buffer object for processing into the desired encoding. + * + * If provided, `cb` function is called immediately before return for + * sync streams, or on next tick for async streams, because for this + * base class, a chunk is considered "processed" once it is accepted + * and either emitted or buffered. That is, the callback does not indicate + * that the chunk has been eventually emitted, though of course child + * classes can override this function to do whatever processing is required + * and call `super.write(...)` only once processing is completed. + */ + write(chunk: WType, cb?: () => void): boolean; + write(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): boolean; + /** + * Low-level explicit read method. + * + * In objectMode, the argument is ignored, and one item is returned if + * available. + * + * `n` is the number of bytes (or in the case of encoding streams, + * characters) to consume. If `n` is not provided, then the entire buffer + * is returned, or `null` is returned if no data is available. + * + * If `n` is greater that the amount of data in the internal buffer, + * then `null` is returned. + */ + read(n?: number | null): RType | null; + [READ](n: number | null, chunk: RType): RType; + /** + * End the stream, optionally providing a final write. + * + * See {@link Minipass#write} for argument descriptions + */ + end(cb?: () => void): this; + end(chunk: WType, cb?: () => void): this; + end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this; + [RESUME](): void; + /** + * Resume the stream if it is currently in a paused state + * + * If called when there are no pipe destinations or `data` event listeners, + * this will place the stream in a "discarded" state, where all data will + * be thrown away. The discarded state is removed if a pipe destination or + * data handler is added, if pause() is called, or if any synchronous or + * asynchronous iteration is started. + */ + resume(): void; + /** + * Pause the stream + */ + pause(): void; + /** + * true if the stream has been forcibly destroyed + */ + get destroyed(): boolean; + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing(): boolean; + /** + * true if the stream is currently in a paused state + */ + get paused(): boolean; + [BUFFERPUSH](chunk: RType): void; + [BUFFERSHIFT](): RType; + [FLUSH](noDrain?: boolean): void; + [FLUSHCHUNK](chunk: RType): boolean; + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest: W, opts?: PipeOptions): W; + /** + * Fully unhook a piped destination stream. + * + * If the destination stream was the only consumer of this stream (ie, + * there are no other piped destinations or `'data'` event listeners) + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + unpipe(dest: W): void; + /** + * Alias for {@link Minipass#on} + */ + addListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.on`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * - Adding a 'data' event handler will trigger the flow of data + * + * - Adding a 'readable' event handler when there is data waiting to be read + * will cause 'readable' to be emitted immediately. + * + * - Adding an 'endish' event handler ('end', 'finish', etc.) which has + * already passed will cause the event to be emitted immediately and all + * handlers removed. + * + * - Adding an 'error' event handler after an error has been emitted will + * cause the event to be re-emitted immediately with the error previously + * raised. + */ + on(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.off` + * + * If a 'data' event handler is removed, and it was the last consumer + * (ie, there are no pipe destinations or other 'data' event listeners), + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + off(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.removeAllListeners` + * + * If all 'data' event handlers are removed, and they were the last consumer + * (ie, there are no pipe destinations), then the flow of data will stop + * until there is another consumer or {@link Minipass#resume} is explicitly + * called. + */ + removeAllListeners(ev?: Event): this; + /** + * true if the 'end' event has been emitted + */ + get emittedEnd(): boolean; + [MAYBE_EMIT_END](): void; + /** + * Mostly identical to `EventEmitter.emit`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * If the stream has been destroyed, and the event is something other + * than 'close' or 'error', then `false` is returned and no handlers + * are called. + * + * If the event is 'end', and has already been emitted, then the event + * is ignored. If the stream is in a paused or non-flowing state, then + * the event will be deferred until data flow resumes. If the stream is + * async, then handlers will be called on the next tick rather than + * immediately. + * + * If the event is 'close', and 'end' has not yet been emitted, then + * the event will be deferred until after 'end' is emitted. + * + * If the event is 'error', and an AbortSignal was provided for the stream, + * and there are no listeners, then the event is ignored, matching the + * behavior of node core streams in the presense of an AbortSignal. + * + * If the event is 'finish' or 'prefinish', then all listeners will be + * removed after emitting the event, to prevent double-firing. + */ + emit(ev: Event, ...args: Events[Event]): boolean; + [EMITDATA](data: RType): boolean; + [EMITEND](): boolean; + [EMITEND2](): boolean; + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + collect(): Promise; + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + concat(): Promise; + /** + * Return a void Promise that resolves once the stream ends. + */ + promise(): Promise; + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator](): AsyncGenerator; + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator](): Generator; + /** + * Destroy a stream, preventing it from being used for any further purpose. + * + * If the stream has a `close()` method, then it will be called on + * destruction. + * + * After destruction, any attempt to write data, read data, or emit most + * events will be ignored. + * + * If an error argument is provided, then it will be emitted in an + * 'error' event. + */ + destroy(er?: unknown): this; + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream(): (s: any) => s is Minipass | NodeJS.ReadStream | NodeJS.WriteStream | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }) | (NodeJS.ReadStream & { + fd: number; + }) | (NodeJS.WriteStream & { + fd: number; + }); +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minipass/dist/esm/index.d.ts.map b/node_modules/cmake-js/node_modules/minipass/dist/esm/index.d.ts.map new file mode 100644 index 0000000..7bce611 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minipass/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD;;GAEG;AACH,KAAK,EAAE,GAAG,aAAa,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAA;AAE/C,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAA;AAEzC;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;EAQH,CAAA;AAElB;;GAEG;AACH,eAAO,MAAM,UAAU,oCAM2C,CAAA;AAElE;;GAEG;AACH,eAAO,MAAM,UAAU,oCAK6B,CAAA;AAEpD,QAAA,MAAM,GAAG,eAAgB,CAAA;AACzB,QAAA,MAAM,cAAc,eAAyB,CAAA;AAC7C,QAAA,MAAM,WAAW,eAAuB,CAAA;AACxC,QAAA,MAAM,YAAY,eAAwB,CAAA;AAC1C,QAAA,MAAM,aAAa,eAAyB,CAA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AAK,CAAC,KAAK,GAAG,QAoBzC;IAED;;;;;;;OAOG;IACH,kBAAkB,CAAC,KAAK,SAAS,MAAM,MAAM,EAAE,EAAE,CAAC,EAAE,KAAK,QASxD;IAED;;OAEG;IACH,IAAI,UAAU,YAEb;IAED,CAAC,cAAc,CAAC,SAef;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,IAAI,CAAC,KAAK,SAAS,MAAM,MAAM,EAC7B,EAAE,EAAE,KAAK,EACT,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GACrB,OAAO,CAgDT;IAED,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,KAAK,WAOrB;IAED,CAAC,OAAO,CAAC,YAQR;IAED,CAAC,QAAQ,CAAC,YAiBT;IAED;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAezD;IAED;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,CAU7B;IAED;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAM7B;IAED;;;;OAIG;IACH,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CA4D1D;IAED;;;;;OAKG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAiChD;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO,QAwBnB;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ;;;;;;;;;;;OAElB;CACF","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe {\n src: Minipass\n dest: Minipass\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = (er: Error) => this.dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable = Iterable & AsyncIterable\n\n type EventArguments = Record\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events = Minipass.Events\n >\n extends EventEmitter\n implements Minipass.DualIterable\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options]\n : [Minipass.Options])\n ) {\n const options: Minipass.Options = (args[0] ||\n {}) as Minipass.Options\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this as Minipass, dest, opts)\n : new PipeProxyErrors(this as Minipass, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n [Symbol.asyncDispose]: async () => {},\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n [Symbol.dispose]: () => {},\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minipass/dist/esm/index.js b/node_modules/cmake-js/node_modules/minipass/dist/esm/index.js new file mode 100644 index 0000000..5df5546 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minipass/dist/esm/index.js @@ -0,0 +1,1020 @@ +const proc = typeof process === 'object' && process + ? process + : { + stdout: null, + stderr: null, + }; +import { EventEmitter } from 'node:events'; +import Stream from 'node:stream'; +import { StringDecoder } from 'node:string_decoder'; +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +export const isStream = (s) => !!s && + typeof s === 'object' && + (s instanceof Minipass || + s instanceof Stream || + isReadable(s) || + isWritable(s)); +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +export const isReadable = (s) => !!s && + typeof s === 'object' && + s instanceof EventEmitter && + typeof s.pipe === 'function' && + // node core Writable streams have a pipe() method, but it throws + s.pipe !== Stream.Writable.prototype.pipe; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +export const isWritable = (s) => !!s && + typeof s === 'object' && + s instanceof EventEmitter && + typeof s.write === 'function' && + typeof s.end === 'function'; +const EOF = Symbol('EOF'); +const MAYBE_EMIT_END = Symbol('maybeEmitEnd'); +const EMITTED_END = Symbol('emittedEnd'); +const EMITTING_END = Symbol('emittingEnd'); +const EMITTED_ERROR = Symbol('emittedError'); +const CLOSED = Symbol('closed'); +const READ = Symbol('read'); +const FLUSH = Symbol('flush'); +const FLUSHCHUNK = Symbol('flushChunk'); +const ENCODING = Symbol('encoding'); +const DECODER = Symbol('decoder'); +const FLOWING = Symbol('flowing'); +const PAUSED = Symbol('paused'); +const RESUME = Symbol('resume'); +const BUFFER = Symbol('buffer'); +const PIPES = Symbol('pipes'); +const BUFFERLENGTH = Symbol('bufferLength'); +const BUFFERPUSH = Symbol('bufferPush'); +const BUFFERSHIFT = Symbol('bufferShift'); +const OBJECTMODE = Symbol('objectMode'); +// internal event when stream is destroyed +const DESTROYED = Symbol('destroyed'); +// internal event when stream has an error +const ERROR = Symbol('error'); +const EMITDATA = Symbol('emitData'); +const EMITEND = Symbol('emitEnd'); +const EMITEND2 = Symbol('emitEnd2'); +const ASYNC = Symbol('async'); +const ABORT = Symbol('abort'); +const ABORTED = Symbol('aborted'); +const SIGNAL = Symbol('signal'); +const DATALISTENERS = Symbol('dataListeners'); +const DISCARDED = Symbol('discarded'); +const defer = (fn) => Promise.resolve().then(fn); +const nodefer = (fn) => fn(); +const isEndish = (ev) => ev === 'end' || ev === 'finish' || ev === 'prefinish'; +const isArrayBufferLike = (b) => b instanceof ArrayBuffer || + (!!b && + typeof b === 'object' && + b.constructor && + b.constructor.name === 'ArrayBuffer' && + b.byteLength >= 0); +const isArrayBufferView = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b); +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +class Pipe { + src; + dest; + opts; + ondrain; + constructor(src, dest, opts) { + this.src = src; + this.dest = dest; + this.opts = opts; + this.ondrain = () => src[RESUME](); + this.dest.on('drain', this.ondrain); + } + unpipe() { + this.dest.removeListener('drain', this.ondrain); + } + // only here for the prototype + /* c8 ignore start */ + proxyErrors(_er) { } + /* c8 ignore stop */ + end() { + this.unpipe(); + if (this.opts.end) + this.dest.end(); + } +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +class PipeProxyErrors extends Pipe { + unpipe() { + this.src.removeListener('error', this.proxyErrors); + super.unpipe(); + } + constructor(src, dest, opts) { + super(src, dest, opts); + this.proxyErrors = (er) => this.dest.emit('error', er); + src.on('error', this.proxyErrors); + } +} +const isObjectModeOptions = (o) => !!o.objectMode; +const isEncodingOptions = (o) => !o.objectMode && !!o.encoding && o.encoding !== 'buffer'; +/** + * Main export, the Minipass class + * + * `RType` is the type of data emitted, defaults to Buffer + * + * `WType` is the type of data to be written, if RType is buffer or string, + * then any {@link Minipass.ContiguousData} is allowed. + * + * `Events` is the set of event handler signatures that this object + * will emit, see {@link Minipass.Events} + */ +export class Minipass extends EventEmitter { + [FLOWING] = false; + [PAUSED] = false; + [PIPES] = []; + [BUFFER] = []; + [OBJECTMODE]; + [ENCODING]; + [ASYNC]; + [DECODER]; + [EOF] = false; + [EMITTED_END] = false; + [EMITTING_END] = false; + [CLOSED] = false; + [EMITTED_ERROR] = null; + [BUFFERLENGTH] = 0; + [DESTROYED] = false; + [SIGNAL]; + [ABORTED] = false; + [DATALISTENERS] = 0; + [DISCARDED] = false; + /** + * true if the stream can be written + */ + writable = true; + /** + * true if the stream can be read + */ + readable = true; + /** + * If `RType` is Buffer, then options do not need to be provided. + * Otherwise, an options object must be provided to specify either + * {@link Minipass.SharedOptions.objectMode} or + * {@link Minipass.SharedOptions.encoding}, as appropriate. + */ + constructor(...args) { + const options = (args[0] || + {}); + super(); + if (options.objectMode && typeof options.encoding === 'string') { + throw new TypeError('Encoding and objectMode may not be used together'); + } + if (isObjectModeOptions(options)) { + this[OBJECTMODE] = true; + this[ENCODING] = null; + } + else if (isEncodingOptions(options)) { + this[ENCODING] = options.encoding; + this[OBJECTMODE] = false; + } + else { + this[OBJECTMODE] = false; + this[ENCODING] = null; + } + this[ASYNC] = !!options.async; + this[DECODER] = this[ENCODING] + ? new StringDecoder(this[ENCODING]) + : null; + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposeBuffer === true) { + Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] }); + } + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposePipes === true) { + Object.defineProperty(this, 'pipes', { get: () => this[PIPES] }); + } + const { signal } = options; + if (signal) { + this[SIGNAL] = signal; + if (signal.aborted) { + this[ABORT](); + } + else { + signal.addEventListener('abort', () => this[ABORT]()); + } + } + } + /** + * The amount of data stored in the buffer waiting to be read. + * + * For Buffer strings, this will be the total byte length. + * For string encoding streams, this will be the string character length, + * according to JavaScript's `string.length` logic. + * For objectMode streams, this is a count of the items waiting to be + * emitted. + */ + get bufferLength() { + return this[BUFFERLENGTH]; + } + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding() { + return this[ENCODING]; + } + /** + * @deprecated - This is a read only property + */ + set encoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * True if this is an objectMode stream + */ + get objectMode() { + return this[OBJECTMODE]; + } + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om) { + throw new Error('objectMode must be set at instantiation time'); + } + /** + * true if this is an async stream + */ + get ['async']() { + return this[ASYNC]; + } + /** + * Set to true to make this stream async. + * + * Once set, it cannot be unset, as this would potentially cause incorrect + * behavior. Ie, a sync stream can be made async, but an async stream + * cannot be safely made sync. + */ + set ['async'](a) { + this[ASYNC] = this[ASYNC] || !!a; + } + // drop everything and get out of the flow completely + [ABORT]() { + this[ABORTED] = true; + this.emit('abort', this[SIGNAL]?.reason); + this.destroy(this[SIGNAL]?.reason); + } + /** + * True if the stream has been aborted. + */ + get aborted() { + return this[ABORTED]; + } + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_) { } + write(chunk, encoding, cb) { + if (this[ABORTED]) + return false; + if (this[EOF]) + throw new Error('write after end'); + if (this[DESTROYED]) { + this.emit('error', Object.assign(new Error('Cannot call write after a stream was destroyed'), { code: 'ERR_STREAM_DESTROYED' })); + return true; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (!encoding) + encoding = 'utf8'; + const fn = this[ASYNC] ? defer : nodefer; + // convert array buffers and typed array views into buffers + // at some point in the future, we may want to do the opposite! + // leave strings and buffers as-is + // anything is only allowed if in object mode, so throw + if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) { + if (isArrayBufferView(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength); + } + else if (isArrayBufferLike(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk); + } + else if (typeof chunk !== 'string') { + throw new Error('Non-contiguous data written to non-objectMode stream'); + } + } + // handle object mode up front, since it's simpler + // this yields better performance, fewer checks later. + if (this[OBJECTMODE]) { + // maybe impossible? + /* c8 ignore start */ + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + /* c8 ignore stop */ + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // at this point the chunk is a buffer or string + // don't buffer it up or send it to the decoder + if (!chunk.length) { + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // fast-path writing strings of same encoding to a stream with + // an empty buffer, skipping the buffer/decoder dance + if (typeof chunk === 'string' && + // unless it is a string already ready for us to use + !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)) { + //@ts-ignore - sinful unsafe type change + chunk = Buffer.from(chunk, encoding); + } + if (Buffer.isBuffer(chunk) && this[ENCODING]) { + //@ts-ignore - sinful unsafe type change + chunk = this[DECODER].write(chunk); + } + // Note: flushing CAN potentially switch us into not-flowing mode + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + /** + * Low-level explicit read method. + * + * In objectMode, the argument is ignored, and one item is returned if + * available. + * + * `n` is the number of bytes (or in the case of encoding streams, + * characters) to consume. If `n` is not provided, then the entire buffer + * is returned, or `null` is returned if no data is available. + * + * If `n` is greater that the amount of data in the internal buffer, + * then `null` is returned. + */ + read(n) { + if (this[DESTROYED]) + return null; + this[DISCARDED] = false; + if (this[BUFFERLENGTH] === 0 || + n === 0 || + (n && n > this[BUFFERLENGTH])) { + this[MAYBE_EMIT_END](); + return null; + } + if (this[OBJECTMODE]) + n = null; + if (this[BUFFER].length > 1 && !this[OBJECTMODE]) { + // not object mode, so if we have an encoding, then RType is string + // otherwise, must be Buffer + this[BUFFER] = [ + (this[ENCODING] + ? this[BUFFER].join('') + : Buffer.concat(this[BUFFER], this[BUFFERLENGTH])), + ]; + } + const ret = this[READ](n || null, this[BUFFER][0]); + this[MAYBE_EMIT_END](); + return ret; + } + [READ](n, chunk) { + if (this[OBJECTMODE]) + this[BUFFERSHIFT](); + else { + const c = chunk; + if (n === c.length || n === null) + this[BUFFERSHIFT](); + else if (typeof c === 'string') { + this[BUFFER][0] = c.slice(n); + chunk = c.slice(0, n); + this[BUFFERLENGTH] -= n; + } + else { + this[BUFFER][0] = c.subarray(n); + chunk = c.subarray(0, n); + this[BUFFERLENGTH] -= n; + } + } + this.emit('data', chunk); + if (!this[BUFFER].length && !this[EOF]) + this.emit('drain'); + return chunk; + } + end(chunk, encoding, cb) { + if (typeof chunk === 'function') { + cb = chunk; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (chunk !== undefined) + this.write(chunk, encoding); + if (cb) + this.once('end', cb); + this[EOF] = true; + this.writable = false; + // if we haven't written anything, then go ahead and emit, + // even if we're not reading. + // we'll re-emit if a new 'end' listener is added anyway. + // This makes MP more suitable to write-only use cases. + if (this[FLOWING] || !this[PAUSED]) + this[MAYBE_EMIT_END](); + return this; + } + // don't let the internal resume be overwritten + [RESUME]() { + if (this[DESTROYED]) + return; + if (!this[DATALISTENERS] && !this[PIPES].length) { + this[DISCARDED] = true; + } + this[PAUSED] = false; + this[FLOWING] = true; + this.emit('resume'); + if (this[BUFFER].length) + this[FLUSH](); + else if (this[EOF]) + this[MAYBE_EMIT_END](); + else + this.emit('drain'); + } + /** + * Resume the stream if it is currently in a paused state + * + * If called when there are no pipe destinations or `data` event listeners, + * this will place the stream in a "discarded" state, where all data will + * be thrown away. The discarded state is removed if a pipe destination or + * data handler is added, if pause() is called, or if any synchronous or + * asynchronous iteration is started. + */ + resume() { + return this[RESUME](); + } + /** + * Pause the stream + */ + pause() { + this[FLOWING] = false; + this[PAUSED] = true; + this[DISCARDED] = false; + } + /** + * true if the stream has been forcibly destroyed + */ + get destroyed() { + return this[DESTROYED]; + } + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing() { + return this[FLOWING]; + } + /** + * true if the stream is currently in a paused state + */ + get paused() { + return this[PAUSED]; + } + [BUFFERPUSH](chunk) { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] += 1; + else + this[BUFFERLENGTH] += chunk.length; + this[BUFFER].push(chunk); + } + [BUFFERSHIFT]() { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] -= 1; + else + this[BUFFERLENGTH] -= this[BUFFER][0].length; + return this[BUFFER].shift(); + } + [FLUSH](noDrain = false) { + do { } while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && + this[BUFFER].length); + if (!noDrain && !this[BUFFER].length && !this[EOF]) + this.emit('drain'); + } + [FLUSHCHUNK](chunk) { + this.emit('data', chunk); + return this[FLOWING]; + } + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest, opts) { + if (this[DESTROYED]) + return dest; + this[DISCARDED] = false; + const ended = this[EMITTED_END]; + opts = opts || {}; + if (dest === proc.stdout || dest === proc.stderr) + opts.end = false; + else + opts.end = opts.end !== false; + opts.proxyErrors = !!opts.proxyErrors; + // piping an ended stream ends immediately + if (ended) { + if (opts.end) + dest.end(); + } + else { + // "as" here just ignores the WType, which pipes don't care about, + // since they're only consuming from us, and writing to the dest + this[PIPES].push(!opts.proxyErrors + ? new Pipe(this, dest, opts) + : new PipeProxyErrors(this, dest, opts)); + if (this[ASYNC]) + defer(() => this[RESUME]()); + else + this[RESUME](); + } + return dest; + } + /** + * Fully unhook a piped destination stream. + * + * If the destination stream was the only consumer of this stream (ie, + * there are no other piped destinations or `'data'` event listeners) + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + unpipe(dest) { + const p = this[PIPES].find(p => p.dest === dest); + if (p) { + if (this[PIPES].length === 1) { + if (this[FLOWING] && this[DATALISTENERS] === 0) { + this[FLOWING] = false; + } + this[PIPES] = []; + } + else + this[PIPES].splice(this[PIPES].indexOf(p), 1); + p.unpipe(); + } + } + /** + * Alias for {@link Minipass#on} + */ + addListener(ev, handler) { + return this.on(ev, handler); + } + /** + * Mostly identical to `EventEmitter.on`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * - Adding a 'data' event handler will trigger the flow of data + * + * - Adding a 'readable' event handler when there is data waiting to be read + * will cause 'readable' to be emitted immediately. + * + * - Adding an 'endish' event handler ('end', 'finish', etc.) which has + * already passed will cause the event to be emitted immediately and all + * handlers removed. + * + * - Adding an 'error' event handler after an error has been emitted will + * cause the event to be re-emitted immediately with the error previously + * raised. + */ + on(ev, handler) { + const ret = super.on(ev, handler); + if (ev === 'data') { + this[DISCARDED] = false; + this[DATALISTENERS]++; + if (!this[PIPES].length && !this[FLOWING]) { + this[RESUME](); + } + } + else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) { + super.emit('readable'); + } + else if (isEndish(ev) && this[EMITTED_END]) { + super.emit(ev); + this.removeAllListeners(ev); + } + else if (ev === 'error' && this[EMITTED_ERROR]) { + const h = handler; + if (this[ASYNC]) + defer(() => h.call(this, this[EMITTED_ERROR])); + else + h.call(this, this[EMITTED_ERROR]); + } + return ret; + } + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev, handler) { + return this.off(ev, handler); + } + /** + * Mostly identical to `EventEmitter.off` + * + * If a 'data' event handler is removed, and it was the last consumer + * (ie, there are no pipe destinations or other 'data' event listeners), + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + off(ev, handler) { + const ret = super.off(ev, handler); + // if we previously had listeners, and now we don't, and we don't + // have any pipes, then stop the flow, unless it's been explicitly + // put in a discarded flowing state via stream.resume(). + if (ev === 'data') { + this[DATALISTENERS] = this.listeners('data').length; + if (this[DATALISTENERS] === 0 && + !this[DISCARDED] && + !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * Mostly identical to `EventEmitter.removeAllListeners` + * + * If all 'data' event handlers are removed, and they were the last consumer + * (ie, there are no pipe destinations), then the flow of data will stop + * until there is another consumer or {@link Minipass#resume} is explicitly + * called. + */ + removeAllListeners(ev) { + const ret = super.removeAllListeners(ev); + if (ev === 'data' || ev === undefined) { + this[DATALISTENERS] = 0; + if (!this[DISCARDED] && !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * true if the 'end' event has been emitted + */ + get emittedEnd() { + return this[EMITTED_END]; + } + [MAYBE_EMIT_END]() { + if (!this[EMITTING_END] && + !this[EMITTED_END] && + !this[DESTROYED] && + this[BUFFER].length === 0 && + this[EOF]) { + this[EMITTING_END] = true; + this.emit('end'); + this.emit('prefinish'); + this.emit('finish'); + if (this[CLOSED]) + this.emit('close'); + this[EMITTING_END] = false; + } + } + /** + * Mostly identical to `EventEmitter.emit`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * If the stream has been destroyed, and the event is something other + * than 'close' or 'error', then `false` is returned and no handlers + * are called. + * + * If the event is 'end', and has already been emitted, then the event + * is ignored. If the stream is in a paused or non-flowing state, then + * the event will be deferred until data flow resumes. If the stream is + * async, then handlers will be called on the next tick rather than + * immediately. + * + * If the event is 'close', and 'end' has not yet been emitted, then + * the event will be deferred until after 'end' is emitted. + * + * If the event is 'error', and an AbortSignal was provided for the stream, + * and there are no listeners, then the event is ignored, matching the + * behavior of node core streams in the presense of an AbortSignal. + * + * If the event is 'finish' or 'prefinish', then all listeners will be + * removed after emitting the event, to prevent double-firing. + */ + emit(ev, ...args) { + const data = args[0]; + // error and close are only events allowed after calling destroy() + if (ev !== 'error' && + ev !== 'close' && + ev !== DESTROYED && + this[DESTROYED]) { + return false; + } + else if (ev === 'data') { + return !this[OBJECTMODE] && !data + ? false + : this[ASYNC] + ? (defer(() => this[EMITDATA](data)), true) + : this[EMITDATA](data); + } + else if (ev === 'end') { + return this[EMITEND](); + } + else if (ev === 'close') { + this[CLOSED] = true; + // don't emit close before 'end' and 'finish' + if (!this[EMITTED_END] && !this[DESTROYED]) + return false; + const ret = super.emit('close'); + this.removeAllListeners('close'); + return ret; + } + else if (ev === 'error') { + this[EMITTED_ERROR] = data; + super.emit(ERROR, data); + const ret = !this[SIGNAL] || this.listeners('error').length + ? super.emit('error', data) + : false; + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'resume') { + const ret = super.emit('resume'); + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'finish' || ev === 'prefinish') { + const ret = super.emit(ev); + this.removeAllListeners(ev); + return ret; + } + // Some other unknown event + const ret = super.emit(ev, ...args); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITDATA](data) { + for (const p of this[PIPES]) { + if (p.dest.write(data) === false) + this.pause(); + } + const ret = this[DISCARDED] ? false : super.emit('data', data); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITEND]() { + if (this[EMITTED_END]) + return false; + this[EMITTED_END] = true; + this.readable = false; + return this[ASYNC] + ? (defer(() => this[EMITEND2]()), true) + : this[EMITEND2](); + } + [EMITEND2]() { + if (this[DECODER]) { + const data = this[DECODER].end(); + if (data) { + for (const p of this[PIPES]) { + p.dest.write(data); + } + if (!this[DISCARDED]) + super.emit('data', data); + } + } + for (const p of this[PIPES]) { + p.end(); + } + const ret = super.emit('end'); + this.removeAllListeners('end'); + return ret; + } + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + async collect() { + const buf = Object.assign([], { + dataLength: 0, + }); + if (!this[OBJECTMODE]) + buf.dataLength = 0; + // set the promise first, in case an error is raised + // by triggering the flow here. + const p = this.promise(); + this.on('data', c => { + buf.push(c); + if (!this[OBJECTMODE]) + buf.dataLength += c.length; + }); + await p; + return buf; + } + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + async concat() { + if (this[OBJECTMODE]) { + throw new Error('cannot concat in objectMode'); + } + const buf = await this.collect(); + return (this[ENCODING] + ? buf.join('') + : Buffer.concat(buf, buf.dataLength)); + } + /** + * Return a void Promise that resolves once the stream ends. + */ + async promise() { + return new Promise((resolve, reject) => { + this.on(DESTROYED, () => reject(new Error('stream destroyed'))); + this.on('error', er => reject(er)); + this.on('end', () => resolve()); + }); + } + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = async () => { + this.pause(); + stopped = true; + return { value: undefined, done: true }; + }; + const next = () => { + if (stopped) + return stop(); + const res = this.read(); + if (res !== null) + return Promise.resolve({ done: false, value: res }); + if (this[EOF]) + return stop(); + let resolve; + let reject; + const onerr = (er) => { + this.off('data', ondata); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + stop(); + reject(er); + }; + const ondata = (value) => { + this.off('error', onerr); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + this.pause(); + resolve({ value, done: !!this[EOF] }); + }; + const onend = () => { + this.off('error', onerr); + this.off('data', ondata); + this.off(DESTROYED, ondestroy); + stop(); + resolve({ done: true, value: undefined }); + }; + const ondestroy = () => onerr(new Error('stream destroyed')); + return new Promise((res, rej) => { + reject = rej; + resolve = res; + this.once(DESTROYED, ondestroy); + this.once('error', onerr); + this.once('end', onend); + this.once('data', ondata); + }); + }; + return { + next, + throw: stop, + return: stop, + [Symbol.asyncIterator]() { + return this; + }, + [Symbol.asyncDispose]: async () => { }, + }; + } + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = () => { + this.pause(); + this.off(ERROR, stop); + this.off(DESTROYED, stop); + this.off('end', stop); + stopped = true; + return { done: true, value: undefined }; + }; + const next = () => { + if (stopped) + return stop(); + const value = this.read(); + return value === null ? stop() : { done: false, value }; + }; + this.once('end', stop); + this.once(ERROR, stop); + this.once(DESTROYED, stop); + return { + next, + throw: stop, + return: stop, + [Symbol.iterator]() { + return this; + }, + [Symbol.dispose]: () => { }, + }; + } + /** + * Destroy a stream, preventing it from being used for any further purpose. + * + * If the stream has a `close()` method, then it will be called on + * destruction. + * + * After destruction, any attempt to write data, read data, or emit most + * events will be ignored. + * + * If an error argument is provided, then it will be emitted in an + * 'error' event. + */ + destroy(er) { + if (this[DESTROYED]) { + if (er) + this.emit('error', er); + else + this.emit(DESTROYED); + return this; + } + this[DESTROYED] = true; + this[DISCARDED] = true; + // throw away all buffered data, it's never coming out + this[BUFFER].length = 0; + this[BUFFERLENGTH] = 0; + const wc = this; + if (typeof wc.close === 'function' && !this[CLOSED]) + wc.close(); + if (er) + this.emit('error', er); + // if no error to emit, still reject pending promises + else + this.emit(DESTROYED); + return this; + } + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream() { + return isStream; + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minipass/dist/esm/index.js.map b/node_modules/cmake-js/node_modules/minipass/dist/esm/index.js.map new file mode 100644 index 0000000..4d87920 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minipass/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GACR,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO;IACpC,CAAC,CAAC,OAAO;IACT,CAAC,CAAC;QACE,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;KACb,CAAA;AACP,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AASnD;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,CAAM,EACsC,EAAE,CAC9C,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,CAAC,YAAY,QAAQ;QACpB,CAAC,YAAY,MAAM;QACnB,UAAU,CAAC,CAAC,CAAC;QACb,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;AAElB;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAM,EAA0B,EAAE,CAC3D,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,YAAY,YAAY;IACzB,OAAQ,CAAuB,CAAC,IAAI,KAAK,UAAU;IACnD,iEAAiE;IAChE,CAAuB,CAAC,IAAI,KAAK,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAA;AAElE;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAM,EAA0B,EAAE,CAC3D,CAAC,CAAC,CAAC;I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IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;;gBACzB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YACzB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;QACtB,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;QAEtB,sDAAsD;QACtD,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;QACvB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;QAEtB,MAAM,EAAE,GAAG,IAEV,CAAA;QACD,IAAI,OAAO,EAAE,CAAC,KAAK,KAAK,UAAU,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,EAAE,CAAC,KAAK,EAAE,CAAA;QAE/D,IAAI,EAAE;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;QAC9B,qDAAqD;;YAChD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAEzB,OAAO,IAAI,CAAA;IAAA,CACZ;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ,GAAG;QACpB,OAAO,QAAQ,CAAA;IAAA,CAChB;CACF","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe {\n src: Minipass\n dest: Minipass\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = (er: Error) => this.dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable = Iterable & AsyncIterable\n\n type EventArguments = Record\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events = Minipass.Events\n >\n extends EventEmitter\n implements Minipass.DualIterable\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options]\n : [Minipass.Options])\n ) {\n const options: Minipass.Options = (args[0] ||\n {}) as Minipass.Options\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this as Minipass, dest, opts)\n : new PipeProxyErrors(this as Minipass, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n [Symbol.asyncDispose]: async () => {},\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n [Symbol.dispose]: () => {},\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minipass/dist/esm/package.json b/node_modules/cmake-js/node_modules/minipass/dist/esm/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/node_modules/cmake-js/node_modules/minipass/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/cmake-js/node_modules/minipass/package.json b/node_modules/cmake-js/node_modules/minipass/package.json new file mode 100644 index 0000000..800f215 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minipass/package.json @@ -0,0 +1,77 @@ +{ + "name": "minipass", + "version": "7.1.3", + "description": "minimal implementation of a PassThrough stream", + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js", + "type": "module", + "tshy": { + "selfLink": false, + "compiler": "tsgo", + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + } + }, + "files": [ + "dist" + ], + "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "prepare": "tshy", + "pretest": "npm run prepare", + "presnap": "npm run prepare", + "test": "tap", + "snap": "tap", + "format": "prettier --write . --loglevel warn", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" + }, + "prettier": { + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + }, + "devDependencies": { + "@types/end-of-stream": "^1.4.2", + "@types/node": "^25.2.3", + "end-of-stream": "^1.4.0", + "node-abort-controller": "^3.1.1", + "prettier": "^3.8.1", + "tap": "^21.6.1", + "through2": "^2.0.3", + "tshy": "^3.3.2", + "typedoc": "^0.28.17" + }, + "repository": "https://github.com/isaacs/minipass", + "keywords": [ + "passthrough", + "stream" + ], + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=16 || 14 >=14.17" + } +} diff --git a/node_modules/cmake-js/node_modules/minizlib/LICENSE b/node_modules/cmake-js/node_modules/minizlib/LICENSE new file mode 100644 index 0000000..49f7efe --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/LICENSE @@ -0,0 +1,26 @@ +Minizlib was created by Isaac Z. Schlueter. +It is a derivative work of the Node.js project. + +""" +Copyright (c) 2017-2023 Isaac Z. Schlueter and Contributors +Copyright (c) 2017-2023 Node.js contributors. All rights reserved. +Copyright (c) 2017-2023 Joyent, Inc. and other Node contributors. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +""" diff --git a/node_modules/cmake-js/node_modules/minizlib/README.md b/node_modules/cmake-js/node_modules/minizlib/README.md new file mode 100644 index 0000000..1b6f008 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/README.md @@ -0,0 +1,64 @@ +# minizlib + +A fast zlib stream built on [minipass](http://npm.im/minipass) and +Node.js's zlib binding. + +This module was created to serve the needs of +[node-tar](http://npm.im/tar) and +[minipass-fetch](http://npm.im/minipass-fetch). + +Brotli is supported in versions of node with a Brotli binding. + +## How does this differ from the streams in `'node:zlib'`? + +First, there are no convenience methods to compress or decompress a +buffer. If you want those, use the built-in `zlib` module. This is +only streams. That being said, Minipass streams to make it fairly easy to +use as one-liners: `new zlib.Deflate().end(data).read()` will return the +deflate compressed result. + +This module compresses and decompresses the data as fast as you feed +it in. It is synchronous, and runs on the main process thread. Zlib +and Brotli operations can be high CPU, but they're very fast, and doing it +this way means much less bookkeeping and artificial deferral. + +Node's built in zlib streams are built on top of `stream.Transform`. +They do the maximally safe thing with respect to consistent +asynchrony, buffering, and backpressure. + +See [Minipass](http://npm.im/minipass) for more on the differences between +Node.js core streams and Minipass streams, and the convenience methods +provided by that class. + +## Classes + +- Deflate +- Inflate +- Gzip +- Gunzip +- DeflateRaw +- InflateRaw +- Unzip +- BrotliCompress (Node v10 and higher) +- BrotliDecompress (Node v10 and higher) +- ZstdCompress (Node v22.15 and higher) +- ZstdDecompress (Node v22.15 and higher) + +## USAGE + +```js +import { BrotliDecompress } from 'minizlib' +// or: const BrotliDecompress = require('minizlib') + +const input = sourceOfCompressedData() +const decode = new BrotliDecompress() +const output = whereToWriteTheDecodedData() +input.pipe(decode).pipe(output) +``` + +## REPRODUCIBLE BUILDS + +To create reproducible gzip compressed files across different operating +systems, set `portable: true` in the options. This causes minizlib to set +the `OS` indicator in byte 9 of the extended gzip header to `0xFF` for +'unknown'. diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/constants.d.ts b/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/constants.d.ts new file mode 100644 index 0000000..67c47b4 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/constants.d.ts @@ -0,0 +1,2 @@ +export declare const constants: any; +//# sourceMappingURL=constants.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/constants.d.ts.map b/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/constants.d.ts.map new file mode 100644 index 0000000..25affce --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/constants.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS,KAiHrB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/constants.js b/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/constants.js new file mode 100644 index 0000000..dfc2c19 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/constants.js @@ -0,0 +1,123 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.constants = void 0; +// Update with any zlib constants that are added or changed in the future. +// Node v6 didn't export this, so we just hard code the version and rely +// on all the other hard-coded values from zlib v4736. When node v6 +// support drops, we can just export the realZlibConstants object. +const zlib_1 = __importDefault(require("zlib")); +/* c8 ignore start */ +const realZlibConstants = zlib_1.default.constants || { ZLIB_VERNUM: 4736 }; +/* c8 ignore stop */ +exports.constants = Object.freeze(Object.assign(Object.create(null), { + Z_NO_FLUSH: 0, + Z_PARTIAL_FLUSH: 1, + Z_SYNC_FLUSH: 2, + Z_FULL_FLUSH: 3, + Z_FINISH: 4, + Z_BLOCK: 5, + Z_OK: 0, + Z_STREAM_END: 1, + Z_NEED_DICT: 2, + Z_ERRNO: -1, + Z_STREAM_ERROR: -2, + Z_DATA_ERROR: -3, + Z_MEM_ERROR: -4, + Z_BUF_ERROR: -5, + Z_VERSION_ERROR: -6, + Z_NO_COMPRESSION: 0, + Z_BEST_SPEED: 1, + Z_BEST_COMPRESSION: 9, + Z_DEFAULT_COMPRESSION: -1, + Z_FILTERED: 1, + Z_HUFFMAN_ONLY: 2, + Z_RLE: 3, + Z_FIXED: 4, + Z_DEFAULT_STRATEGY: 0, + DEFLATE: 1, + INFLATE: 2, + GZIP: 3, + GUNZIP: 4, + DEFLATERAW: 5, + INFLATERAW: 6, + UNZIP: 7, + BROTLI_DECODE: 8, + BROTLI_ENCODE: 9, + Z_MIN_WINDOWBITS: 8, + Z_MAX_WINDOWBITS: 15, + Z_DEFAULT_WINDOWBITS: 15, + Z_MIN_CHUNK: 64, + Z_MAX_CHUNK: Infinity, + Z_DEFAULT_CHUNK: 16384, + Z_MIN_MEMLEVEL: 1, + Z_MAX_MEMLEVEL: 9, + Z_DEFAULT_MEMLEVEL: 8, + Z_MIN_LEVEL: -1, + Z_MAX_LEVEL: 9, + Z_DEFAULT_LEVEL: -1, + BROTLI_OPERATION_PROCESS: 0, + BROTLI_OPERATION_FLUSH: 1, + BROTLI_OPERATION_FINISH: 2, + BROTLI_OPERATION_EMIT_METADATA: 3, + BROTLI_MODE_GENERIC: 0, + BROTLI_MODE_TEXT: 1, + BROTLI_MODE_FONT: 2, + BROTLI_DEFAULT_MODE: 0, + BROTLI_MIN_QUALITY: 0, + BROTLI_MAX_QUALITY: 11, + BROTLI_DEFAULT_QUALITY: 11, + BROTLI_MIN_WINDOW_BITS: 10, + BROTLI_MAX_WINDOW_BITS: 24, + BROTLI_LARGE_MAX_WINDOW_BITS: 30, + BROTLI_DEFAULT_WINDOW: 22, + BROTLI_MIN_INPUT_BLOCK_BITS: 16, + BROTLI_MAX_INPUT_BLOCK_BITS: 24, + BROTLI_PARAM_MODE: 0, + BROTLI_PARAM_QUALITY: 1, + BROTLI_PARAM_LGWIN: 2, + BROTLI_PARAM_LGBLOCK: 3, + BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4, + BROTLI_PARAM_SIZE_HINT: 5, + BROTLI_PARAM_LARGE_WINDOW: 6, + BROTLI_PARAM_NPOSTFIX: 7, + BROTLI_PARAM_NDIRECT: 8, + BROTLI_DECODER_RESULT_ERROR: 0, + BROTLI_DECODER_RESULT_SUCCESS: 1, + BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2, + BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3, + BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0, + BROTLI_DECODER_PARAM_LARGE_WINDOW: 1, + BROTLI_DECODER_NO_ERROR: 0, + BROTLI_DECODER_SUCCESS: 1, + BROTLI_DECODER_NEEDS_MORE_INPUT: 2, + BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3, + BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1, + BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2, + BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3, + BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4, + BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5, + BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6, + BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7, + BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8, + BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9, + BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10, + BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11, + BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12, + BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13, + BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14, + BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15, + BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16, + BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19, + BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20, + BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21, + BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22, + BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25, + BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26, + BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27, + BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30, + BROTLI_DECODER_ERROR_UNREACHABLE: -31, +}, realZlibConstants)); +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/constants.js.map b/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/constants.js.map new file mode 100644 index 0000000..3b73335 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/constants.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;;;;AAAA,0EAA0E;AAC1E,wEAAwE;AACxE,oEAAoE;AACpE,kEAAkE;AAClE,gDAA2B;AAC3B,qBAAqB;AACrB,MAAM,iBAAiB,GAAG,cAAQ,CAAC,SAAS,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAA;AACrE,oBAAoB;AAEP,QAAA,SAAS,GAAG,MAAM,CAAC,MAAM,CACpC,MAAM,CAAC,MAAM,CACX,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EACnB;IACE,UAAU,EAAE,CAAC;IACb,eAAe,EAAE,CAAC;IAClB,YAAY,EAAE,CAAC;IACf,YAAY,EAAE,CAAC;IACf,QAAQ,E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,EAAE,CAAC,EAAE;IAC1C,oCAAoC,EAAE,CAAC,EAAE;IACzC,uCAAuC,EAAE,CAAC,EAAE;IAC5C,sCAAsC,EAAE,CAAC,EAAE;IAC3C,wCAAwC,EAAE,CAAC,EAAE;IAC7C,sCAAsC,EAAE,CAAC,EAAE;IAC3C,sCAAsC,EAAE,CAAC,EAAE;IAC3C,wCAAwC,EAAE,CAAC,EAAE;IAC7C,wCAAwC,EAAE,CAAC,EAAE;IAC7C,2CAA2C,EAAE,CAAC,EAAE;IAChD,gCAAgC,EAAE,CAAC,EAAE;CACtC,EACD,iBAAiB,CAClB,CACF,CAAA","sourcesContent":["// Update with any zlib constants that are added or changed in the future.\n// Node v6 didn't export this, so we just hard code the version and rely\n// on all the other hard-coded values from zlib v4736. When node v6\n// support drops, we can just export the realZlibConstants object.\nimport realZlib from 'zlib'\n/* c8 ignore start */\nconst realZlibConstants = realZlib.constants || { ZLIB_VERNUM: 4736 }\n/* c8 ignore stop */\n\nexport const constants = Object.freeze(\n Object.assign(\n Object.create(null),\n {\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n Z_VERSION_ERROR: -6,\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n DEFLATE: 1,\n INFLATE: 2,\n GZIP: 3,\n GUNZIP: 4,\n DEFLATERAW: 5,\n INFLATERAW: 6,\n UNZIP: 7,\n BROTLI_DECODE: 8,\n BROTLI_ENCODE: 9,\n Z_MIN_WINDOWBITS: 8,\n Z_MAX_WINDOWBITS: 15,\n Z_DEFAULT_WINDOWBITS: 15,\n Z_MIN_CHUNK: 64,\n Z_MAX_CHUNK: Infinity,\n Z_DEFAULT_CHUNK: 16384,\n Z_MIN_MEMLEVEL: 1,\n Z_MAX_MEMLEVEL: 9,\n Z_DEFAULT_MEMLEVEL: 8,\n Z_MIN_LEVEL: -1,\n Z_MAX_LEVEL: 9,\n Z_DEFAULT_LEVEL: -1,\n BROTLI_OPERATION_PROCESS: 0,\n BROTLI_OPERATION_FLUSH: 1,\n BROTLI_OPERATION_FINISH: 2,\n BROTLI_OPERATION_EMIT_METADATA: 3,\n BROTLI_MODE_GENERIC: 0,\n BROTLI_MODE_TEXT: 1,\n BROTLI_MODE_FONT: 2,\n BROTLI_DEFAULT_MODE: 0,\n BROTLI_MIN_QUALITY: 0,\n BROTLI_MAX_QUALITY: 11,\n BROTLI_DEFAULT_QUALITY: 11,\n BROTLI_MIN_WINDOW_BITS: 10,\n BROTLI_MAX_WINDOW_BITS: 24,\n BROTLI_LARGE_MAX_WINDOW_BITS: 30,\n BROTLI_DEFAULT_WINDOW: 22,\n BROTLI_MIN_INPUT_BLOCK_BITS: 16,\n BROTLI_MAX_INPUT_BLOCK_BITS: 24,\n BROTLI_PARAM_MODE: 0,\n BROTLI_PARAM_QUALITY: 1,\n BROTLI_PARAM_LGWIN: 2,\n BROTLI_PARAM_LGBLOCK: 3,\n BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,\n BROTLI_PARAM_SIZE_HINT: 5,\n BROTLI_PARAM_LARGE_WINDOW: 6,\n BROTLI_PARAM_NPOSTFIX: 7,\n BROTLI_PARAM_NDIRECT: 8,\n BROTLI_DECODER_RESULT_ERROR: 0,\n BROTLI_DECODER_RESULT_SUCCESS: 1,\n BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,\n BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,\n BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,\n BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,\n BROTLI_DECODER_NO_ERROR: 0,\n BROTLI_DECODER_SUCCESS: 1,\n BROTLI_DECODER_NEEDS_MORE_INPUT: 2,\n BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,\n BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,\n BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,\n BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,\n BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,\n BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,\n BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,\n BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,\n BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,\n BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,\n BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,\n BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,\n BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,\n BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,\n BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,\n BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,\n BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,\n BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,\n BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,\n BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,\n BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,\n BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,\n BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,\n BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,\n BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,\n BROTLI_DECODER_ERROR_UNREACHABLE: -31,\n },\n realZlibConstants,\n ),\n)\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/index.d.ts b/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/index.d.ts new file mode 100644 index 0000000..8044bd0 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/index.d.ts @@ -0,0 +1,99 @@ +import { Buffer } from 'buffer'; +import { Minipass } from 'minipass'; +import * as realZlib from 'zlib'; +export { constants } from './constants.js'; +declare const _superWrite: unique symbol; +export declare class ZlibError extends Error { + code?: string; + errno?: number; + constructor(err: NodeJS.ErrnoException | Error, origin?: Function); + get name(): string; +} +declare const _flushFlag: unique symbol; +export type ChunkWithFlushFlag = Minipass.ContiguousData & { + [_flushFlag]?: number; +}; +export type ZlibBaseOptions = Minipass.Options & { + flush?: number; + finishFlush?: number; + fullFlushFlag?: number; +}; +export type ZlibHandle = realZlib.Gzip | realZlib.Gunzip | realZlib.Deflate | realZlib.Inflate | realZlib.DeflateRaw | realZlib.InflateRaw | realZlib.BrotliCompress | realZlib.BrotliDecompress | realZlib.ZstdCompress | realZlib.ZstdDecompress; +export type ZlibMode = 'Gzip' | 'Gunzip' | 'Deflate' | 'Inflate' | 'DeflateRaw' | 'InflateRaw' | 'Unzip'; +export type BrotliMode = 'BrotliCompress' | 'BrotliDecompress'; +export type ZstdMode = 'ZstdCompress' | 'ZstdDecompress'; +declare abstract class ZlibBase extends Minipass { + #private; + get sawError(): boolean; + get handle(): ZlibHandle | undefined; + get flushFlag(): number; + constructor(opts: ZlibBaseOptions, mode: ZlibMode | BrotliMode | ZstdMode); + close(): void; + reset(): any; + flush(flushFlag?: number): void; + end(cb?: () => void): this; + end(chunk: ChunkWithFlushFlag, cb?: () => void): this; + end(chunk: ChunkWithFlushFlag, encoding?: Minipass.Encoding, cb?: () => void): this; + get ended(): boolean; + [_superWrite](data: Buffer & { + [_flushFlag]?: number; + }): boolean; + write(chunk: ChunkWithFlushFlag, cb?: () => void): boolean; + write(chunk: ChunkWithFlushFlag, encoding?: Minipass.Encoding, cb?: () => void): boolean; +} +export type ZlibOptions = ZlibBaseOptions & { + level?: number; + strategy?: number; +}; +export declare class Zlib extends ZlibBase { + #private; + constructor(opts: ZlibOptions, mode: ZlibMode); + params(level: number, strategy: number): void; +} +export declare class Deflate extends Zlib { + constructor(opts: ZlibOptions); +} +export declare class Inflate extends Zlib { + constructor(opts: ZlibOptions); +} +export type GzipOptions = ZlibOptions & { + portable?: boolean; +}; +export declare class Gzip extends Zlib { + #private; + constructor(opts: GzipOptions); + [_superWrite](data: Buffer & { + [_flushFlag]?: number; + }): boolean; +} +export declare class Gunzip extends Zlib { + constructor(opts: ZlibOptions); +} +export declare class DeflateRaw extends Zlib { + constructor(opts: ZlibOptions); +} +export declare class InflateRaw extends Zlib { + constructor(opts: ZlibOptions); +} +export declare class Unzip extends Zlib { + constructor(opts: ZlibOptions); +} +declare class Brotli extends ZlibBase { + constructor(opts: ZlibOptions, mode: BrotliMode); +} +export declare class BrotliCompress extends Brotli { + constructor(opts: ZlibOptions); +} +export declare class BrotliDecompress extends Brotli { + constructor(opts: ZlibOptions); +} +declare class Zstd extends ZlibBase { + constructor(opts: ZlibOptions, mode: ZstdMode); +} +export declare class ZstdCompress extends Zstd { + constructor(opts: ZlibOptions); +} +export declare class ZstdDecompress extends Zstd { + constructor(opts: ZlibOptions); +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/index.d.ts.map b/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000..dcf6141 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/common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WAAW;CAG9B"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/index.js b/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/index.js new file mode 100644 index 0000000..78c6536 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/index.js @@ -0,0 +1,416 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ZstdDecompress = exports.ZstdCompress = exports.BrotliDecompress = exports.BrotliCompress = exports.Unzip = exports.InflateRaw = exports.DeflateRaw = exports.Gunzip = exports.Gzip = exports.Inflate = exports.Deflate = exports.Zlib = exports.ZlibError = exports.constants = void 0; +const assert_1 = __importDefault(require("assert")); +const buffer_1 = require("buffer"); +const minipass_1 = require("minipass"); +const realZlib = __importStar(require("zlib")); +const constants_js_1 = require("./constants.js"); +var constants_js_2 = require("./constants.js"); +Object.defineProperty(exports, "constants", { enumerable: true, get: function () { return constants_js_2.constants; } }); +const OriginalBufferConcat = buffer_1.Buffer.concat; +const desc = Object.getOwnPropertyDescriptor(buffer_1.Buffer, 'concat'); +const noop = (args) => args; +const passthroughBufferConcat = desc?.writable === true || desc?.set !== undefined + ? (makeNoOp) => { + buffer_1.Buffer.concat = makeNoOp ? noop : OriginalBufferConcat; + } + : (_) => { }; +const _superWrite = Symbol('_superWrite'); +class ZlibError extends Error { + code; + errno; + constructor(err, origin) { + super('zlib: ' + err.message, { cause: err }); + this.code = err.code; + this.errno = err.errno; + /* c8 ignore next */ + if (!this.code) + this.code = 'ZLIB_ERROR'; + this.message = 'zlib: ' + err.message; + Error.captureStackTrace(this, origin ?? this.constructor); + } + get name() { + return 'ZlibError'; + } +} +exports.ZlibError = ZlibError; +// the Zlib class they all inherit from +// This thing manages the queue of requests, and returns +// true or false if there is anything in the queue when +// you call the .write() method. +const _flushFlag = Symbol('flushFlag'); +class ZlibBase extends minipass_1.Minipass { + #sawError = false; + #ended = false; + #flushFlag; + #finishFlushFlag; + #fullFlushFlag; + #handle; + #onError; + get sawError() { + return this.#sawError; + } + get handle() { + return this.#handle; + } + /* c8 ignore start */ + get flushFlag() { + return this.#flushFlag; + } + /* c8 ignore stop */ + constructor(opts, mode) { + if (!opts || typeof opts !== 'object') + throw new TypeError('invalid options for ZlibBase constructor'); + //@ts-ignore + super(opts); + /* c8 ignore start */ + this.#flushFlag = opts.flush ?? 0; + this.#finishFlushFlag = opts.finishFlush ?? 0; + this.#fullFlushFlag = opts.fullFlushFlag ?? 0; + /* c8 ignore stop */ + //@ts-ignore + if (typeof realZlib[mode] !== 'function') { + throw new TypeError('Compression method not supported: ' + mode); + } + // this will throw if any options are invalid for the class selected + try { + // @types/node doesn't know that it exports the classes, but they're there + //@ts-ignore + this.#handle = new realZlib[mode](opts); + } + catch (er) { + // make sure that all errors get decorated properly + throw new ZlibError(er, this.constructor); + } + this.#onError = err => { + // no sense raising multiple errors, since we abort on the first one. + if (this.#sawError) + return; + this.#sawError = true; + // there is no way to cleanly recover. + // continuing only obscures problems. + this.close(); + this.emit('error', err); + }; + this.#handle?.on('error', er => this.#onError(new ZlibError(er))); + this.once('end', () => this.close); + } + close() { + if (this.#handle) { + this.#handle.close(); + this.#handle = undefined; + this.emit('close'); + } + } + reset() { + if (!this.#sawError) { + (0, assert_1.default)(this.#handle, 'zlib binding closed'); + //@ts-ignore + return this.#handle.reset?.(); + } + } + flush(flushFlag) { + if (this.ended) + return; + if (typeof flushFlag !== 'number') + flushFlag = this.#fullFlushFlag; + this.write(Object.assign(buffer_1.Buffer.alloc(0), { [_flushFlag]: flushFlag })); + } + end(chunk, encoding, cb) { + /* c8 ignore start */ + if (typeof chunk === 'function') { + cb = chunk; + encoding = undefined; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + /* c8 ignore stop */ + if (chunk) { + if (encoding) + this.write(chunk, encoding); + else + this.write(chunk); + } + this.flush(this.#finishFlushFlag); + this.#ended = true; + return super.end(cb); + } + get ended() { + return this.#ended; + } + // overridden in the gzip classes to do portable writes + [_superWrite](data) { + return super.write(data); + } + write(chunk, encoding, cb) { + // process the chunk using the sync process + // then super.write() all the outputted chunks + if (typeof encoding === 'function') + (cb = encoding), (encoding = 'utf8'); + if (typeof chunk === 'string') + chunk = buffer_1.Buffer.from(chunk, encoding); + if (this.#sawError) + return; + (0, assert_1.default)(this.#handle, 'zlib binding closed'); + // _processChunk tries to .close() the native handle after it's done, so we + // intercept that by temporarily making it a no-op. + // diving into the node:zlib internals a bit here + const nativeHandle = this.#handle + ._handle; + const originalNativeClose = nativeHandle.close; + nativeHandle.close = () => { }; + const originalClose = this.#handle.close; + this.#handle.close = () => { }; + // It also calls `Buffer.concat()` at the end, which may be convenient + // for some, but which we are not interested in as it slows us down. + passthroughBufferConcat(true); + let result = undefined; + try { + const flushFlag = typeof chunk[_flushFlag] === 'number' + ? chunk[_flushFlag] + : this.#flushFlag; + result = this.#handle._processChunk(chunk, flushFlag); + // if we don't throw, reset it back how it was + passthroughBufferConcat(false); + } + catch (err) { + // or if we do, put Buffer.concat() back before we emit error + // Error events call into user code, which may call Buffer.concat() + passthroughBufferConcat(false); + this.#onError(new ZlibError(err, this.write)); + } + finally { + if (this.#handle) { + // Core zlib resets `_handle` to null after attempting to close the + // native handle. Our no-op handler prevented actual closure, but we + // need to restore the `._handle` property. + ; + this.#handle._handle = + nativeHandle; + nativeHandle.close = originalNativeClose; + this.#handle.close = originalClose; + // `_processChunk()` adds an 'error' listener. If we don't remove it + // after each call, these handlers start piling up. + this.#handle.removeAllListeners('error'); + // make sure OUR error listener is still attached tho + } + } + if (this.#handle) + this.#handle.on('error', er => this.#onError(new ZlibError(er, this.write))); + let writeReturn; + if (result) { + if (Array.isArray(result) && result.length > 0) { + const r = result[0]; + // The first buffer is always `handle._outBuffer`, which would be + // re-used for later invocations; so, we always have to copy that one. + writeReturn = this[_superWrite](buffer_1.Buffer.from(r)); + for (let i = 1; i < result.length; i++) { + writeReturn = this[_superWrite](result[i]); + } + } + else { + // either a single Buffer or an empty array + writeReturn = this[_superWrite](buffer_1.Buffer.from(result)); + } + } + if (cb) + cb(); + return writeReturn; + } +} +class Zlib extends ZlibBase { + #level; + #strategy; + constructor(opts, mode) { + opts = opts || {}; + opts.flush = opts.flush || constants_js_1.constants.Z_NO_FLUSH; + opts.finishFlush = opts.finishFlush || constants_js_1.constants.Z_FINISH; + opts.fullFlushFlag = constants_js_1.constants.Z_FULL_FLUSH; + super(opts, mode); + this.#level = opts.level; + this.#strategy = opts.strategy; + } + params(level, strategy) { + if (this.sawError) + return; + if (!this.handle) + throw new Error('cannot switch params when binding is closed'); + // no way to test this without also not supporting params at all + /* c8 ignore start */ + if (!this.handle.params) + throw new Error('not supported in this implementation'); + /* c8 ignore stop */ + if (this.#level !== level || this.#strategy !== strategy) { + this.flush(constants_js_1.constants.Z_SYNC_FLUSH); + (0, assert_1.default)(this.handle, 'zlib binding closed'); + // .params() calls .flush(), but the latter is always async in the + // core zlib. We override .flush() temporarily to intercept that and + // flush synchronously. + const origFlush = this.handle.flush; + this.handle.flush = (flushFlag, cb) => { + /* c8 ignore start */ + if (typeof flushFlag === 'function') { + cb = flushFlag; + flushFlag = this.flushFlag; + } + /* c8 ignore stop */ + this.flush(flushFlag); + cb?.(); + }; + try { + ; + this.handle.params(level, strategy); + } + finally { + this.handle.flush = origFlush; + } + /* c8 ignore start */ + if (this.handle) { + this.#level = level; + this.#strategy = strategy; + } + /* c8 ignore stop */ + } + } +} +exports.Zlib = Zlib; +// minimal 2-byte header +class Deflate extends Zlib { + constructor(opts) { + super(opts, 'Deflate'); + } +} +exports.Deflate = Deflate; +class Inflate extends Zlib { + constructor(opts) { + super(opts, 'Inflate'); + } +} +exports.Inflate = Inflate; +class Gzip extends Zlib { + #portable; + constructor(opts) { + super(opts, 'Gzip'); + this.#portable = opts && !!opts.portable; + } + [_superWrite](data) { + if (!this.#portable) + return super[_superWrite](data); + // we'll always get the header emitted in one first chunk + // overwrite the OS indicator byte with 0xFF + this.#portable = false; + data[9] = 255; + return super[_superWrite](data); + } +} +exports.Gzip = Gzip; +class Gunzip extends Zlib { + constructor(opts) { + super(opts, 'Gunzip'); + } +} +exports.Gunzip = Gunzip; +// raw - no header +class DeflateRaw extends Zlib { + constructor(opts) { + super(opts, 'DeflateRaw'); + } +} +exports.DeflateRaw = DeflateRaw; +class InflateRaw extends Zlib { + constructor(opts) { + super(opts, 'InflateRaw'); + } +} +exports.InflateRaw = InflateRaw; +// auto-detect header. +class Unzip extends Zlib { + constructor(opts) { + super(opts, 'Unzip'); + } +} +exports.Unzip = Unzip; +class Brotli extends ZlibBase { + constructor(opts, mode) { + opts = opts || {}; + opts.flush = opts.flush || constants_js_1.constants.BROTLI_OPERATION_PROCESS; + opts.finishFlush = + opts.finishFlush || constants_js_1.constants.BROTLI_OPERATION_FINISH; + opts.fullFlushFlag = constants_js_1.constants.BROTLI_OPERATION_FLUSH; + super(opts, mode); + } +} +class BrotliCompress extends Brotli { + constructor(opts) { + super(opts, 'BrotliCompress'); + } +} +exports.BrotliCompress = BrotliCompress; +class BrotliDecompress extends Brotli { + constructor(opts) { + super(opts, 'BrotliDecompress'); + } +} +exports.BrotliDecompress = BrotliDecompress; +class Zstd extends ZlibBase { + constructor(opts, mode) { + opts = opts || {}; + opts.flush = opts.flush || constants_js_1.constants.ZSTD_e_continue; + opts.finishFlush = opts.finishFlush || constants_js_1.constants.ZSTD_e_end; + opts.fullFlushFlag = constants_js_1.constants.ZSTD_e_flush; + super(opts, mode); + } +} +class ZstdCompress extends Zstd { + constructor(opts) { + super(opts, 'ZstdCompress'); + } +} +exports.ZstdCompress = ZstdCompress; +class ZstdDecompress extends Zstd { + constructor(opts) { + super(opts, 'ZstdDecompress'); + } +} +exports.ZstdDecompress = ZstdDecompress; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/index.js.map b/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/index.js.map new file mode 100644 index 0000000..ca84107 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA2B;AAC3B,mCAA+B;AAC/B,uCAAmC;AACnC,+CAAgC;AAChC,iDAA0C;AAC1C,+CAA0C;AAAjC,yGAAA,SAAS,OAAA;AAElB,MAAM,oBAAoB,GAAG,eAAM,CAAC,MAAM,CAAA;AAC1C,MAAM,IAAI,GAAG,MAAM,CAAC,wBAAwB,CAAC,eAAM,EAAE,QAAQ,CAAC,CAAA;AAC9D,MAAM,IAAI,GAAG,CAAC,IAAc,EAAE,EAAE,CAAC,IAAyB,CAAA;AAC1D,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AM;IACxC,YAAY,IAAiB;QAC3B,KAAK,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAA;IAC/B,CAAC;CACF;AAJD,wCAIC;AAED,MAAa,gBAAiB,SAAQ,MAAM;IAC1C,YAAY,IAAiB;QAC3B,KAAK,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAA;IACjC,CAAC;CACF;AAJD,4CAIC;AAED,MAAM,IAAK,SAAQ,QAAQ;IACzB,YAAY,IAAiB,EAAE,IAAc;QAC3C,IAAI,GAAG,IAAI,IAAI,EAAE,CAAA;QAEjB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,wBAAS,CAAC,eAAe,CAAA;QACpD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,wBAAS,CAAC,UAAU,CAAA;QAC3D,IAAI,CAAC,aAAa,GAAG,wBAAS,CAAC,YAAY,CAAA;QAC3C,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IACnB,CAAC;CACF;AAED,MAAa,YAAa,SAAQ,IAAI;IACpC,YAAY,IAAiB;QAC3B,KAAK,CAAC,IAAI,EAAE,cAAc,CAAC,CAAA;IAC7B,CAAC;CACF;AAJD,oCAIC;AAED,MAAa,cAAe,SAAQ,IAAI;IACtC,YAAY,IAAiB;QAC3B,KAAK,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAA;IAC/B,CAAC;CACF;AAJD,wCAIC","sourcesContent":["import assert from 'assert'\nimport { Buffer } from 'buffer'\nimport { Minipass } from 'minipass'\nimport * as realZlib from 'zlib'\nimport { constants } from './constants.js'\nexport { constants } from './constants.js'\n\nconst OriginalBufferConcat = Buffer.concat\nconst desc = Object.getOwnPropertyDescriptor(Buffer, 'concat')\nconst noop = (args: Buffer[]) => args as unknown as Buffer\nconst passthroughBufferConcat =\n desc?.writable === true || desc?.set !== undefined\n ? (makeNoOp: boolean) => {\n Buffer.concat = makeNoOp ? noop : OriginalBufferConcat\n }\n : (_: boolean) => {}\n\nconst _superWrite = Symbol('_superWrite')\n\nexport class ZlibError extends Error {\n code?: string\n errno?: number\n constructor(err: NodeJS.ErrnoException | Error, origin?: Function) {\n super('zlib: ' + err.message, { cause: err })\n this.code = (err as NodeJS.ErrnoException).code\n this.errno = (err as NodeJS.ErrnoException).errno\n /* c8 ignore next */\n if (!this.code) this.code = 'ZLIB_ERROR'\n\n this.message = 'zlib: ' + err.message\n Error.captureStackTrace(this, origin ?? this.constructor)\n }\n\n get name() {\n return 'ZlibError'\n }\n}\n\n// the Zlib class they all inherit from\n// This thing manages the queue of requests, and returns\n// true or false if there is anything in the queue when\n// you call the .write() method.\nconst _flushFlag = Symbol('flushFlag')\n\nexport type ChunkWithFlushFlag = Minipass.ContiguousData & {\n [_flushFlag]?: number\n}\n\nexport type ZlibBaseOptions = Minipass.Options & {\n flush?: number\n finishFlush?: number\n fullFlushFlag?: number\n}\n\nexport type ZlibHandle =\n | realZlib.Gzip\n | realZlib.Gunzip\n | realZlib.Deflate\n | realZlib.Inflate\n | realZlib.DeflateRaw\n | realZlib.InflateRaw\n | realZlib.BrotliCompress\n | realZlib.BrotliDecompress\n | realZlib.ZstdCompress\n | realZlib.ZstdDecompress\nexport type ZlibMode =\n | 'Gzip'\n | 'Gunzip'\n | 'Deflate'\n | 'Inflate'\n | 'DeflateRaw'\n | 'InflateRaw'\n | 'Unzip'\nexport type BrotliMode = 'BrotliCompress' | 'BrotliDecompress'\nexport type ZstdMode = 'ZstdCompress' | 'ZstdDecompress'\n\nabstract class ZlibBase extends Minipass {\n #sawError: boolean = false\n #ended: boolean = false\n #flushFlag: number\n #finishFlushFlag: number\n #fullFlushFlag: number\n #handle?: ZlibHandle\n #onError: (err: ZlibError) => any\n\n get sawError() {\n return this.#sawError\n }\n get handle() {\n return this.#handle\n }\n /* c8 ignore start */\n get flushFlag() {\n return this.#flushFlag\n }\n /* c8 ignore stop */\n\n constructor(opts: ZlibBaseOptions, mode: ZlibMode | BrotliMode | ZstdMode) {\n if (!opts || typeof opts !== 'object')\n throw new TypeError('invalid options for ZlibBase constructor')\n\n //@ts-ignore\n super(opts)\n\n /* c8 ignore start */\n this.#flushFlag = opts.flush ?? 0\n this.#finishFlushFlag = opts.finishFlush ?? 0\n this.#fullFlushFlag = opts.fullFlushFlag ?? 0\n /* c8 ignore stop */\n\n //@ts-ignore\n if (typeof realZlib[mode] !== 'function') {\n throw new TypeError('Compression method not supported: ' + mode)\n }\n\n // this will throw if any options are invalid for the class selected\n try {\n // @types/node doesn't know that it exports the classes, but they're there\n //@ts-ignore\n this.#handle = new realZlib[mode](opts)\n } catch (er) {\n // make sure that all errors get decorated properly\n throw new ZlibError(er as NodeJS.ErrnoException, this.constructor)\n }\n\n this.#onError = err => {\n // no sense raising multiple errors, since we abort on the first one.\n if (this.#sawError) return\n\n this.#sawError = true\n\n // there is no way to cleanly recover.\n // continuing only obscures problems.\n this.close()\n this.emit('error', err)\n }\n\n this.#handle?.on('error', er => this.#onError(new ZlibError(er)))\n this.once('end', () => this.close)\n }\n\n close() {\n if (this.#handle) {\n this.#handle.close()\n this.#handle = undefined\n this.emit('close')\n }\n }\n\n reset() {\n if (!this.#sawError) {\n assert(this.#handle, 'zlib binding closed')\n //@ts-ignore\n return this.#handle.reset?.()\n }\n }\n\n flush(flushFlag?: number) {\n if (this.ended) return\n\n if (typeof flushFlag !== 'number') flushFlag = this.#fullFlushFlag\n\n this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag }))\n }\n\n end(cb?: () => void): this\n end(chunk: ChunkWithFlushFlag, cb?: () => void): this\n end(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding,\n cb?: () => void,\n ): this\n end(\n chunk?: ChunkWithFlushFlag | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void,\n ) {\n /* c8 ignore start */\n if (typeof chunk === 'function') {\n cb = chunk\n encoding = undefined\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n /* c8 ignore stop */\n if (chunk) {\n if (encoding) this.write(chunk, encoding)\n else this.write(chunk)\n }\n this.flush(this.#finishFlushFlag)\n this.#ended = true\n return super.end(cb)\n }\n\n get ended() {\n return this.#ended\n }\n\n // overridden in the gzip classes to do portable writes\n [_superWrite](data: Buffer & { [_flushFlag]?: number }) {\n return super.write(data)\n }\n\n write(chunk: ChunkWithFlushFlag, cb?: () => void): boolean\n write(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding,\n cb?: () => void,\n ): boolean\n write(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void,\n ) {\n // process the chunk using the sync process\n // then super.write() all the outputted chunks\n if (typeof encoding === 'function')\n (cb = encoding), (encoding = 'utf8')\n\n if (typeof chunk === 'string')\n chunk = Buffer.from(chunk as string, encoding as BufferEncoding)\n\n if (this.#sawError) return\n assert(this.#handle, 'zlib binding closed')\n\n // _processChunk tries to .close() the native handle after it's done, so we\n // intercept that by temporarily making it a no-op.\n // diving into the node:zlib internals a bit here\n const nativeHandle = (this.#handle as unknown as { _handle: any })\n ._handle\n const originalNativeClose = nativeHandle.close\n nativeHandle.close = () => {}\n const originalClose = this.#handle.close\n this.#handle.close = () => {}\n // It also calls `Buffer.concat()` at the end, which may be convenient\n // for some, but which we are not interested in as it slows us down.\n passthroughBufferConcat(true)\n let result: undefined | Buffer | Buffer[] = undefined\n try {\n const flushFlag =\n typeof chunk[_flushFlag] === 'number'\n ? chunk[_flushFlag]\n : this.#flushFlag\n result = (\n this.#handle as unknown as {\n _processChunk: (chunk: Buffer, flushFlag: number) => Buffer[]\n }\n )._processChunk(chunk as Buffer, flushFlag)\n // if we don't throw, reset it back how it was\n passthroughBufferConcat(false)\n } catch (err) {\n // or if we do, put Buffer.concat() back before we emit error\n // Error events call into user code, which may call Buffer.concat()\n passthroughBufferConcat(false)\n this.#onError(new ZlibError(err as NodeJS.ErrnoException, this.write))\n } finally {\n if (this.#handle) {\n // Core zlib resets `_handle` to null after attempting to close the\n // native handle. Our no-op handler prevented actual closure, but we\n // need to restore the `._handle` property.\n ;(this.#handle as unknown as { _handle: any })._handle =\n nativeHandle\n nativeHandle.close = originalNativeClose\n this.#handle.close = originalClose\n // `_processChunk()` adds an 'error' listener. If we don't remove it\n // after each call, these handlers start piling up.\n this.#handle.removeAllListeners('error')\n // make sure OUR error listener is still attached tho\n }\n }\n\n if (this.#handle)\n this.#handle.on('error', er => this.#onError(new ZlibError(er, this.write)))\n\n let writeReturn\n if (result) {\n if (Array.isArray(result) && result.length > 0) {\n const r = result[0]\n // The first buffer is always `handle._outBuffer`, which would be\n // re-used for later invocations; so, we always have to copy that one.\n writeReturn = this[_superWrite](Buffer.from(r as Buffer))\n for (let i = 1; i < result.length; i++) {\n writeReturn = this[_superWrite](result[i] as Buffer)\n }\n } else {\n // either a single Buffer or an empty array\n writeReturn = this[_superWrite](Buffer.from(result as Buffer | []))\n }\n }\n\n if (cb) cb()\n return writeReturn\n }\n}\n\nexport type ZlibOptions = ZlibBaseOptions & {\n level?: number\n strategy?: number\n}\n\nexport class Zlib extends ZlibBase {\n #level?: number\n #strategy?: number\n\n constructor(opts: ZlibOptions, mode: ZlibMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.Z_NO_FLUSH\n opts.finishFlush = opts.finishFlush || constants.Z_FINISH\n opts.fullFlushFlag = constants.Z_FULL_FLUSH\n super(opts, mode)\n\n this.#level = opts.level\n this.#strategy = opts.strategy\n }\n\n params(level: number, strategy: number) {\n if (this.sawError) return\n\n if (!this.handle)\n throw new Error('cannot switch params when binding is closed')\n\n // no way to test this without also not supporting params at all\n /* c8 ignore start */\n if (!(this.handle as { params?: any }).params)\n throw new Error('not supported in this implementation')\n /* c8 ignore stop */\n\n if (this.#level !== level || this.#strategy !== strategy) {\n this.flush(constants.Z_SYNC_FLUSH)\n assert(this.handle, 'zlib binding closed')\n // .params() calls .flush(), but the latter is always async in the\n // core zlib. We override .flush() temporarily to intercept that and\n // flush synchronously.\n const origFlush = this.handle.flush\n this.handle.flush = (\n flushFlag?: (() => void) | number,\n cb?: () => void,\n ) => {\n /* c8 ignore start */\n if (typeof flushFlag === 'function') {\n cb = flushFlag\n flushFlag = this.flushFlag\n }\n /* c8 ignore stop */\n this.flush(flushFlag)\n cb?.()\n }\n try {\n ;(\n this.handle as unknown as {\n params: (level?: number, strategy?: number) => void\n }\n ).params(level, strategy)\n } finally {\n this.handle.flush = origFlush\n }\n /* c8 ignore start */\n if (this.handle) {\n this.#level = level\n this.#strategy = strategy\n }\n /* c8 ignore stop */\n }\n }\n}\n\n// minimal 2-byte header\nexport class Deflate extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Deflate')\n }\n}\n\nexport class Inflate extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Inflate')\n }\n}\n\n// gzip - bigger header, same deflate compression\nexport type GzipOptions = ZlibOptions & { portable?: boolean }\nexport class Gzip extends Zlib {\n #portable: boolean\n constructor(opts: GzipOptions) {\n super(opts, 'Gzip')\n this.#portable = opts && !!opts.portable\n }\n\n [_superWrite](data: Buffer & { [_flushFlag]?: number }) {\n if (!this.#portable) return super[_superWrite](data)\n\n // we'll always get the header emitted in one first chunk\n // overwrite the OS indicator byte with 0xFF\n this.#portable = false\n data[9] = 255\n return super[_superWrite](data)\n }\n}\n\nexport class Gunzip extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Gunzip')\n }\n}\n\n// raw - no header\nexport class DeflateRaw extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'DeflateRaw')\n }\n}\n\nexport class InflateRaw extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'InflateRaw')\n }\n}\n\n// auto-detect header.\nexport class Unzip extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Unzip')\n }\n}\n\nclass Brotli extends ZlibBase {\n constructor(opts: ZlibOptions, mode: BrotliMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS\n opts.finishFlush =\n opts.finishFlush || constants.BROTLI_OPERATION_FINISH\n opts.fullFlushFlag = constants.BROTLI_OPERATION_FLUSH\n super(opts, mode)\n }\n}\n\nexport class BrotliCompress extends Brotli {\n constructor(opts: ZlibOptions) {\n super(opts, 'BrotliCompress')\n }\n}\n\nexport class BrotliDecompress extends Brotli {\n constructor(opts: ZlibOptions) {\n super(opts, 'BrotliDecompress')\n }\n}\n\nclass Zstd extends ZlibBase {\n constructor(opts: ZlibOptions, mode: ZstdMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.ZSTD_e_continue\n opts.finishFlush = opts.finishFlush || constants.ZSTD_e_end\n opts.fullFlushFlag = constants.ZSTD_e_flush\n super(opts, mode)\n }\n}\n\nexport class ZstdCompress extends Zstd {\n constructor(opts: ZlibOptions) {\n super(opts, 'ZstdCompress')\n }\n}\n\nexport class ZstdDecompress extends Zstd {\n constructor(opts: ZlibOptions) {\n super(opts, 'ZstdDecompress')\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/package.json b/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/package.json new file mode 100644 index 0000000..5bbefff --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/esm/constants.d.ts b/node_modules/cmake-js/node_modules/minizlib/dist/esm/constants.d.ts new file mode 100644 index 0000000..67c47b4 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/esm/constants.d.ts @@ -0,0 +1,2 @@ +export declare const constants: any; +//# sourceMappingURL=constants.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/esm/constants.d.ts.map b/node_modules/cmake-js/node_modules/minizlib/dist/esm/constants.d.ts.map new file mode 100644 index 0000000..25affce --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/esm/constants.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS,KAiHrB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/esm/constants.js b/node_modules/cmake-js/node_modules/minizlib/dist/esm/constants.js new file mode 100644 index 0000000..7faf40b --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/esm/constants.js @@ -0,0 +1,117 @@ +// Update with any zlib constants that are added or changed in the future. +// Node v6 didn't export this, so we just hard code the version and rely +// on all the other hard-coded values from zlib v4736. When node v6 +// support drops, we can just export the realZlibConstants object. +import realZlib from 'zlib'; +/* c8 ignore start */ +const realZlibConstants = realZlib.constants || { ZLIB_VERNUM: 4736 }; +/* c8 ignore stop */ +export const constants = Object.freeze(Object.assign(Object.create(null), { + Z_NO_FLUSH: 0, + Z_PARTIAL_FLUSH: 1, + Z_SYNC_FLUSH: 2, + Z_FULL_FLUSH: 3, + Z_FINISH: 4, + Z_BLOCK: 5, + Z_OK: 0, + Z_STREAM_END: 1, + Z_NEED_DICT: 2, + Z_ERRNO: -1, + Z_STREAM_ERROR: -2, + Z_DATA_ERROR: -3, + Z_MEM_ERROR: -4, + Z_BUF_ERROR: -5, + Z_VERSION_ERROR: -6, + Z_NO_COMPRESSION: 0, + Z_BEST_SPEED: 1, + Z_BEST_COMPRESSION: 9, + Z_DEFAULT_COMPRESSION: -1, + Z_FILTERED: 1, + Z_HUFFMAN_ONLY: 2, + Z_RLE: 3, + Z_FIXED: 4, + Z_DEFAULT_STRATEGY: 0, + DEFLATE: 1, + INFLATE: 2, + GZIP: 3, + GUNZIP: 4, + DEFLATERAW: 5, + INFLATERAW: 6, + UNZIP: 7, + BROTLI_DECODE: 8, + BROTLI_ENCODE: 9, + Z_MIN_WINDOWBITS: 8, + Z_MAX_WINDOWBITS: 15, + Z_DEFAULT_WINDOWBITS: 15, + Z_MIN_CHUNK: 64, + Z_MAX_CHUNK: Infinity, + Z_DEFAULT_CHUNK: 16384, + Z_MIN_MEMLEVEL: 1, + Z_MAX_MEMLEVEL: 9, + Z_DEFAULT_MEMLEVEL: 8, + Z_MIN_LEVEL: -1, + Z_MAX_LEVEL: 9, + Z_DEFAULT_LEVEL: -1, + BROTLI_OPERATION_PROCESS: 0, + BROTLI_OPERATION_FLUSH: 1, + BROTLI_OPERATION_FINISH: 2, + BROTLI_OPERATION_EMIT_METADATA: 3, + BROTLI_MODE_GENERIC: 0, + BROTLI_MODE_TEXT: 1, + BROTLI_MODE_FONT: 2, + BROTLI_DEFAULT_MODE: 0, + BROTLI_MIN_QUALITY: 0, + BROTLI_MAX_QUALITY: 11, + BROTLI_DEFAULT_QUALITY: 11, + BROTLI_MIN_WINDOW_BITS: 10, + BROTLI_MAX_WINDOW_BITS: 24, + BROTLI_LARGE_MAX_WINDOW_BITS: 30, + BROTLI_DEFAULT_WINDOW: 22, + BROTLI_MIN_INPUT_BLOCK_BITS: 16, + BROTLI_MAX_INPUT_BLOCK_BITS: 24, + BROTLI_PARAM_MODE: 0, + BROTLI_PARAM_QUALITY: 1, + BROTLI_PARAM_LGWIN: 2, + BROTLI_PARAM_LGBLOCK: 3, + BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4, + BROTLI_PARAM_SIZE_HINT: 5, + BROTLI_PARAM_LARGE_WINDOW: 6, + BROTLI_PARAM_NPOSTFIX: 7, + BROTLI_PARAM_NDIRECT: 8, + BROTLI_DECODER_RESULT_ERROR: 0, + BROTLI_DECODER_RESULT_SUCCESS: 1, + BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2, + BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3, + BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0, + BROTLI_DECODER_PARAM_LARGE_WINDOW: 1, + BROTLI_DECODER_NO_ERROR: 0, + BROTLI_DECODER_SUCCESS: 1, + BROTLI_DECODER_NEEDS_MORE_INPUT: 2, + BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3, + BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1, + BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2, + BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3, + BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4, + BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5, + BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6, + BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7, + BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8, + BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9, + BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10, + BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11, + BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12, + BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13, + BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14, + BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15, + BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16, + BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19, + BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20, + BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21, + BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22, + BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25, + BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26, + BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27, + BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30, + BROTLI_DECODER_ERROR_UNREACHABLE: -31, +}, realZlibConstants)); +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/esm/constants.js.map b/node_modules/cmake-js/node_modules/minizlib/dist/esm/constants.js.map new file mode 100644 index 0000000..bf23cbb --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/esm/constants.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,wEAAwE;AACxE,oEAAoE;AACpE,kEAAkE;AAClE,OAAO,QAAQ,MAAM,MAAM,CAAA;AAC3B,qBAAqB;AACrB,MAAM,iBAAiB,GAAG,QAAQ,CAAC,SAAS,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAA;AACrE,oBAAoB;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CACpC,MAAM,CAAC,MAAM,CACX,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EACnB;IACE,UAAU,EAAE,CAAC;IACb,eAAe,EAAE,CAAC;IAClB,YAAY,EAAE,CAAC;IACf,YAAY,EAAE,CAAC;IACf,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC;IACP,YAAY,EAAE,CAAC;IACf,WAAW,EAAE,CAAC;IACd,OAAO,EAAE,CAAC,CAAC;IACX,cAAc,EAAE,CAAC,CAAC;IAClB,YAAY,EAAE,CAAC,CAAC;IAChB,WAAW,EAAE,CAAC,CAAC;IACf,WAAW,EAAE,CAAC,CAAC;IACf,eAAe,EAAE,CAAC,CAAC;IACnB,gBAAgB,EAAE,CAAC;IACnB,YAAY,EAAE,CAAC;IACf,kBAAkB,EAAE,CAAC;IACrB,qBAAqB,EAAE,CAAC,CAAC;IACzB,UAAU,EAAE,CAAC;IACb,cAAc,EAAE,CAAC;IACjB,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,kBAAkB,EAAE,CAAC;IACrB,OAAO,EAAE,CAAC;IACV,OAAO,EAA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ChC,sCAAsC,EAAE,CAAC;IACzC,uCAAuC,EAAE,CAAC;IAC1C,qDAAqD,EAAE,CAAC;IACxD,iCAAiC,EAAE,CAAC;IACpC,uBAAuB,EAAE,CAAC;IAC1B,sBAAsB,EAAE,CAAC;IACzB,+BAA+B,EAAE,CAAC;IAClC,gCAAgC,EAAE,CAAC;IACnC,4CAA4C,EAAE,CAAC,CAAC;IAChD,oCAAoC,EAAE,CAAC,CAAC;IACxC,iDAAiD,EAAE,CAAC,CAAC;IACrD,mDAAmD,EAAE,CAAC,CAAC;IACvD,+CAA+C,EAAE,CAAC,CAAC;IACnD,oCAAoC,EAAE,CAAC,CAAC;IACxC,yCAAyC,EAAE,CAAC,CAAC;IAC7C,8CAA8C,EAAE,CAAC,CAAC;IAClD,0CAA0C,EAAE,CAAC,CAAC;IAC9C,0CAA0C,EAAE,CAAC,EAAE;IAC/C,qCAAqC,EAAE,CAAC,EAAE;IAC1C,sCAAsC,EAAE,CAAC,EAAE;IAC3C,uCAAuC,EAAE,CAAC,EAAE;IAC5C,qCAAqC,EAAE,CAAC,EAAE;IAC1C,qCAAqC,EAAE,CAAC,EAAE;IAC1C,oCAAoC,EAAE,CAAC,EAAE;IACzC,uCAAuC,EAAE,CAAC,EAAE;IAC5C,sCAAsC,EAAE,CAAC,EAAE;IAC3C,wCAAwC,EAAE,CAAC,EAAE;IAC7C,sCAAsC,EAAE,CAAC,EAAE;IAC3C,sCAAsC,EAAE,CAAC,EAAE;IAC3C,wCAAwC,EAAE,CAAC,EAAE;IAC7C,wCAAwC,EAAE,CAAC,EAAE;IAC7C,2CAA2C,EAAE,CAAC,EAAE;IAChD,gCAAgC,EAAE,CAAC,EAAE;CACtC,EACD,iBAAiB,CAClB,CACF,CAAA","sourcesContent":["// Update with any zlib constants that are added or changed in the future.\n// Node v6 didn't export this, so we just hard code the version and rely\n// on all the other hard-coded values from zlib v4736. When node v6\n// support drops, we can just export the realZlibConstants object.\nimport realZlib from 'zlib'\n/* c8 ignore start */\nconst realZlibConstants = realZlib.constants || { ZLIB_VERNUM: 4736 }\n/* c8 ignore stop */\n\nexport const constants = Object.freeze(\n Object.assign(\n Object.create(null),\n {\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n Z_VERSION_ERROR: -6,\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n DEFLATE: 1,\n INFLATE: 2,\n GZIP: 3,\n GUNZIP: 4,\n DEFLATERAW: 5,\n INFLATERAW: 6,\n UNZIP: 7,\n BROTLI_DECODE: 8,\n BROTLI_ENCODE: 9,\n Z_MIN_WINDOWBITS: 8,\n Z_MAX_WINDOWBITS: 15,\n Z_DEFAULT_WINDOWBITS: 15,\n Z_MIN_CHUNK: 64,\n Z_MAX_CHUNK: Infinity,\n Z_DEFAULT_CHUNK: 16384,\n Z_MIN_MEMLEVEL: 1,\n Z_MAX_MEMLEVEL: 9,\n Z_DEFAULT_MEMLEVEL: 8,\n Z_MIN_LEVEL: -1,\n Z_MAX_LEVEL: 9,\n Z_DEFAULT_LEVEL: -1,\n BROTLI_OPERATION_PROCESS: 0,\n BROTLI_OPERATION_FLUSH: 1,\n BROTLI_OPERATION_FINISH: 2,\n BROTLI_OPERATION_EMIT_METADATA: 3,\n BROTLI_MODE_GENERIC: 0,\n BROTLI_MODE_TEXT: 1,\n BROTLI_MODE_FONT: 2,\n BROTLI_DEFAULT_MODE: 0,\n BROTLI_MIN_QUALITY: 0,\n BROTLI_MAX_QUALITY: 11,\n BROTLI_DEFAULT_QUALITY: 11,\n BROTLI_MIN_WINDOW_BITS: 10,\n BROTLI_MAX_WINDOW_BITS: 24,\n BROTLI_LARGE_MAX_WINDOW_BITS: 30,\n BROTLI_DEFAULT_WINDOW: 22,\n BROTLI_MIN_INPUT_BLOCK_BITS: 16,\n BROTLI_MAX_INPUT_BLOCK_BITS: 24,\n BROTLI_PARAM_MODE: 0,\n BROTLI_PARAM_QUALITY: 1,\n BROTLI_PARAM_LGWIN: 2,\n BROTLI_PARAM_LGBLOCK: 3,\n BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,\n BROTLI_PARAM_SIZE_HINT: 5,\n BROTLI_PARAM_LARGE_WINDOW: 6,\n BROTLI_PARAM_NPOSTFIX: 7,\n BROTLI_PARAM_NDIRECT: 8,\n BROTLI_DECODER_RESULT_ERROR: 0,\n BROTLI_DECODER_RESULT_SUCCESS: 1,\n BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,\n BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,\n BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,\n BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,\n BROTLI_DECODER_NO_ERROR: 0,\n BROTLI_DECODER_SUCCESS: 1,\n BROTLI_DECODER_NEEDS_MORE_INPUT: 2,\n BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,\n BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,\n BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,\n BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,\n BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,\n BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,\n BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,\n BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,\n BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,\n BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,\n BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,\n BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,\n BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,\n BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,\n BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,\n BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,\n BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,\n BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,\n BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,\n BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,\n BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,\n BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,\n BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,\n BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,\n BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,\n BROTLI_DECODER_ERROR_UNREACHABLE: -31,\n },\n realZlibConstants,\n ),\n)\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/esm/index.d.ts b/node_modules/cmake-js/node_modules/minizlib/dist/esm/index.d.ts new file mode 100644 index 0000000..8044bd0 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/esm/index.d.ts @@ -0,0 +1,99 @@ +import { Buffer } from 'buffer'; +import { Minipass } from 'minipass'; +import * as realZlib from 'zlib'; +export { constants } from './constants.js'; +declare const _superWrite: unique symbol; +export declare class ZlibError extends Error { + code?: string; + errno?: number; + constructor(err: NodeJS.ErrnoException | Error, origin?: Function); + get name(): string; +} +declare const _flushFlag: unique symbol; +export type ChunkWithFlushFlag = Minipass.ContiguousData & { + [_flushFlag]?: number; +}; +export type ZlibBaseOptions = Minipass.Options & { + flush?: number; + finishFlush?: number; + fullFlushFlag?: number; +}; +export type ZlibHandle = realZlib.Gzip | realZlib.Gunzip | realZlib.Deflate | realZlib.Inflate | realZlib.DeflateRaw | realZlib.InflateRaw | realZlib.BrotliCompress | realZlib.BrotliDecompress | realZlib.ZstdCompress | realZlib.ZstdDecompress; +export type ZlibMode = 'Gzip' | 'Gunzip' | 'Deflate' | 'Inflate' | 'DeflateRaw' | 'InflateRaw' | 'Unzip'; +export type BrotliMode = 'BrotliCompress' | 'BrotliDecompress'; +export type ZstdMode = 'ZstdCompress' | 'ZstdDecompress'; +declare abstract class ZlibBase extends Minipass { + #private; + get sawError(): boolean; + get handle(): ZlibHandle | undefined; + get flushFlag(): number; + constructor(opts: ZlibBaseOptions, mode: ZlibMode | BrotliMode | ZstdMode); + close(): void; + reset(): any; + flush(flushFlag?: number): void; + end(cb?: () => void): this; + end(chunk: ChunkWithFlushFlag, cb?: () => void): this; + end(chunk: ChunkWithFlushFlag, encoding?: Minipass.Encoding, cb?: () => void): this; + get ended(): boolean; + [_superWrite](data: Buffer & { + [_flushFlag]?: number; + }): boolean; + write(chunk: ChunkWithFlushFlag, cb?: () => void): boolean; + write(chunk: ChunkWithFlushFlag, encoding?: Minipass.Encoding, cb?: () => void): boolean; +} +export type ZlibOptions = ZlibBaseOptions & { + level?: number; + strategy?: number; +}; +export declare class Zlib extends ZlibBase { + #private; + constructor(opts: ZlibOptions, mode: ZlibMode); + params(level: number, strategy: number): void; +} +export declare class Deflate extends Zlib { + constructor(opts: ZlibOptions); +} +export declare class Inflate extends Zlib { + constructor(opts: ZlibOptions); +} +export type GzipOptions = ZlibOptions & { + portable?: boolean; +}; +export declare class Gzip extends Zlib { + #private; + constructor(opts: GzipOptions); + [_superWrite](data: Buffer & { + [_flushFlag]?: number; + }): boolean; +} +export declare class Gunzip extends Zlib { + constructor(opts: ZlibOptions); +} +export declare class DeflateRaw extends Zlib { + constructor(opts: ZlibOptions); +} +export declare class InflateRaw extends Zlib { + constructor(opts: ZlibOptions); +} +export declare class Unzip extends Zlib { + constructor(opts: ZlibOptions); +} +declare class Brotli extends ZlibBase { + constructor(opts: ZlibOptions, mode: BrotliMode); +} +export declare class BrotliCompress extends Brotli { + constructor(opts: ZlibOptions); +} +export declare class BrotliDecompress extends Brotli { + constructor(opts: ZlibOptions); +} +declare class Zstd extends ZlibBase { + constructor(opts: ZlibOptions, mode: ZstdMode); +} +export declare class ZstdCompress extends Zstd { + constructor(opts: ZlibOptions); +} +export declare class ZstdDecompress extends Zstd { + constructor(opts: ZlibOptions); +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/esm/index.d.ts.map b/node_modules/cmake-js/node_modules/minizlib/dist/esm/index.d.ts.map new file mode 100644 index 0000000..dcf6141 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,KAAK,QAAQ,MAAM,MAAM,CAAA;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAY1C,QAAA,MAAM,WAAW,eAAwB,CAAA;AAEzC,qBAAa,SAAU,SAAQ,KAAK;IAClC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;gBACF,GAAG,EAAE,MAAM,CAAC,cAAc,GAAG,KAAK,EAAE,MAAM,CAAC,EAAE,QAAQ;IAWjE,IAAI,IAAI,WAEP;CACF;AAMD,QAAA,MAAM,U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BAAa,MAAO,SAAQ,IAAI;gBAClB,IAAI,EAAE,WAAW;CAG9B;AAGD,qBAAa,UAAW,SAAQ,IAAI;gBACtB,IAAI,EAAE,WAAW;CAG9B;AAED,qBAAa,UAAW,SAAQ,IAAI;gBACtB,IAAI,EAAE,WAAW;CAG9B;AAGD,qBAAa,KAAM,SAAQ,IAAI;gBACjB,IAAI,EAAE,WAAW;CAG9B;AAED,cAAM,MAAO,SAAQ,QAAQ;gBACf,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU;CAShD;AAED,qBAAa,cAAe,SAAQ,MAAM;gBAC5B,IAAI,EAAE,WAAW;CAG9B;AAED,qBAAa,gBAAiB,SAAQ,MAAM;gBAC9B,IAAI,EAAE,WAAW;CAG9B;AAED,cAAM,IAAK,SAAQ,QAAQ;gBACb,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ;CAQ9C;AAED,qBAAa,YAAa,SAAQ,IAAI;gBACxB,IAAI,EAAE,WAAW;CAG9B;AAED,qBAAa,cAAe,SAAQ,IAAI;gBAC1B,IAAI,EAAE,WAAW;CAG9B"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/esm/index.js b/node_modules/cmake-js/node_modules/minizlib/dist/esm/index.js new file mode 100644 index 0000000..b70ba1f --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/esm/index.js @@ -0,0 +1,363 @@ +import assert from 'assert'; +import { Buffer } from 'buffer'; +import { Minipass } from 'minipass'; +import * as realZlib from 'zlib'; +import { constants } from './constants.js'; +export { constants } from './constants.js'; +const OriginalBufferConcat = Buffer.concat; +const desc = Object.getOwnPropertyDescriptor(Buffer, 'concat'); +const noop = (args) => args; +const passthroughBufferConcat = desc?.writable === true || desc?.set !== undefined + ? (makeNoOp) => { + Buffer.concat = makeNoOp ? noop : OriginalBufferConcat; + } + : (_) => { }; +const _superWrite = Symbol('_superWrite'); +export class ZlibError extends Error { + code; + errno; + constructor(err, origin) { + super('zlib: ' + err.message, { cause: err }); + this.code = err.code; + this.errno = err.errno; + /* c8 ignore next */ + if (!this.code) + this.code = 'ZLIB_ERROR'; + this.message = 'zlib: ' + err.message; + Error.captureStackTrace(this, origin ?? this.constructor); + } + get name() { + return 'ZlibError'; + } +} +// the Zlib class they all inherit from +// This thing manages the queue of requests, and returns +// true or false if there is anything in the queue when +// you call the .write() method. +const _flushFlag = Symbol('flushFlag'); +class ZlibBase extends Minipass { + #sawError = false; + #ended = false; + #flushFlag; + #finishFlushFlag; + #fullFlushFlag; + #handle; + #onError; + get sawError() { + return this.#sawError; + } + get handle() { + return this.#handle; + } + /* c8 ignore start */ + get flushFlag() { + return this.#flushFlag; + } + /* c8 ignore stop */ + constructor(opts, mode) { + if (!opts || typeof opts !== 'object') + throw new TypeError('invalid options for ZlibBase constructor'); + //@ts-ignore + super(opts); + /* c8 ignore start */ + this.#flushFlag = opts.flush ?? 0; + this.#finishFlushFlag = opts.finishFlush ?? 0; + this.#fullFlushFlag = opts.fullFlushFlag ?? 0; + /* c8 ignore stop */ + //@ts-ignore + if (typeof realZlib[mode] !== 'function') { + throw new TypeError('Compression method not supported: ' + mode); + } + // this will throw if any options are invalid for the class selected + try { + // @types/node doesn't know that it exports the classes, but they're there + //@ts-ignore + this.#handle = new realZlib[mode](opts); + } + catch (er) { + // make sure that all errors get decorated properly + throw new ZlibError(er, this.constructor); + } + this.#onError = err => { + // no sense raising multiple errors, since we abort on the first one. + if (this.#sawError) + return; + this.#sawError = true; + // there is no way to cleanly recover. + // continuing only obscures problems. + this.close(); + this.emit('error', err); + }; + this.#handle?.on('error', er => this.#onError(new ZlibError(er))); + this.once('end', () => this.close); + } + close() { + if (this.#handle) { + this.#handle.close(); + this.#handle = undefined; + this.emit('close'); + } + } + reset() { + if (!this.#sawError) { + assert(this.#handle, 'zlib binding closed'); + //@ts-ignore + return this.#handle.reset?.(); + } + } + flush(flushFlag) { + if (this.ended) + return; + if (typeof flushFlag !== 'number') + flushFlag = this.#fullFlushFlag; + this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag })); + } + end(chunk, encoding, cb) { + /* c8 ignore start */ + if (typeof chunk === 'function') { + cb = chunk; + encoding = undefined; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + /* c8 ignore stop */ + if (chunk) { + if (encoding) + this.write(chunk, encoding); + else + this.write(chunk); + } + this.flush(this.#finishFlushFlag); + this.#ended = true; + return super.end(cb); + } + get ended() { + return this.#ended; + } + // overridden in the gzip classes to do portable writes + [_superWrite](data) { + return super.write(data); + } + write(chunk, encoding, cb) { + // process the chunk using the sync process + // then super.write() all the outputted chunks + if (typeof encoding === 'function') + (cb = encoding), (encoding = 'utf8'); + if (typeof chunk === 'string') + chunk = Buffer.from(chunk, encoding); + if (this.#sawError) + return; + assert(this.#handle, 'zlib binding closed'); + // _processChunk tries to .close() the native handle after it's done, so we + // intercept that by temporarily making it a no-op. + // diving into the node:zlib internals a bit here + const nativeHandle = this.#handle + ._handle; + const originalNativeClose = nativeHandle.close; + nativeHandle.close = () => { }; + const originalClose = this.#handle.close; + this.#handle.close = () => { }; + // It also calls `Buffer.concat()` at the end, which may be convenient + // for some, but which we are not interested in as it slows us down. + passthroughBufferConcat(true); + let result = undefined; + try { + const flushFlag = typeof chunk[_flushFlag] === 'number' + ? chunk[_flushFlag] + : this.#flushFlag; + result = this.#handle._processChunk(chunk, flushFlag); + // if we don't throw, reset it back how it was + passthroughBufferConcat(false); + } + catch (err) { + // or if we do, put Buffer.concat() back before we emit error + // Error events call into user code, which may call Buffer.concat() + passthroughBufferConcat(false); + this.#onError(new ZlibError(err, this.write)); + } + finally { + if (this.#handle) { + // Core zlib resets `_handle` to null after attempting to close the + // native handle. Our no-op handler prevented actual closure, but we + // need to restore the `._handle` property. + ; + this.#handle._handle = + nativeHandle; + nativeHandle.close = originalNativeClose; + this.#handle.close = originalClose; + // `_processChunk()` adds an 'error' listener. If we don't remove it + // after each call, these handlers start piling up. + this.#handle.removeAllListeners('error'); + // make sure OUR error listener is still attached tho + } + } + if (this.#handle) + this.#handle.on('error', er => this.#onError(new ZlibError(er, this.write))); + let writeReturn; + if (result) { + if (Array.isArray(result) && result.length > 0) { + const r = result[0]; + // The first buffer is always `handle._outBuffer`, which would be + // re-used for later invocations; so, we always have to copy that one. + writeReturn = this[_superWrite](Buffer.from(r)); + for (let i = 1; i < result.length; i++) { + writeReturn = this[_superWrite](result[i]); + } + } + else { + // either a single Buffer or an empty array + writeReturn = this[_superWrite](Buffer.from(result)); + } + } + if (cb) + cb(); + return writeReturn; + } +} +export class Zlib extends ZlibBase { + #level; + #strategy; + constructor(opts, mode) { + opts = opts || {}; + opts.flush = opts.flush || constants.Z_NO_FLUSH; + opts.finishFlush = opts.finishFlush || constants.Z_FINISH; + opts.fullFlushFlag = constants.Z_FULL_FLUSH; + super(opts, mode); + this.#level = opts.level; + this.#strategy = opts.strategy; + } + params(level, strategy) { + if (this.sawError) + return; + if (!this.handle) + throw new Error('cannot switch params when binding is closed'); + // no way to test this without also not supporting params at all + /* c8 ignore start */ + if (!this.handle.params) + throw new Error('not supported in this implementation'); + /* c8 ignore stop */ + if (this.#level !== level || this.#strategy !== strategy) { + this.flush(constants.Z_SYNC_FLUSH); + assert(this.handle, 'zlib binding closed'); + // .params() calls .flush(), but the latter is always async in the + // core zlib. We override .flush() temporarily to intercept that and + // flush synchronously. + const origFlush = this.handle.flush; + this.handle.flush = (flushFlag, cb) => { + /* c8 ignore start */ + if (typeof flushFlag === 'function') { + cb = flushFlag; + flushFlag = this.flushFlag; + } + /* c8 ignore stop */ + this.flush(flushFlag); + cb?.(); + }; + try { + ; + this.handle.params(level, strategy); + } + finally { + this.handle.flush = origFlush; + } + /* c8 ignore start */ + if (this.handle) { + this.#level = level; + this.#strategy = strategy; + } + /* c8 ignore stop */ + } + } +} +// minimal 2-byte header +export class Deflate extends Zlib { + constructor(opts) { + super(opts, 'Deflate'); + } +} +export class Inflate extends Zlib { + constructor(opts) { + super(opts, 'Inflate'); + } +} +export class Gzip extends Zlib { + #portable; + constructor(opts) { + super(opts, 'Gzip'); + this.#portable = opts && !!opts.portable; + } + [_superWrite](data) { + if (!this.#portable) + return super[_superWrite](data); + // we'll always get the header emitted in one first chunk + // overwrite the OS indicator byte with 0xFF + this.#portable = false; + data[9] = 255; + return super[_superWrite](data); + } +} +export class Gunzip extends Zlib { + constructor(opts) { + super(opts, 'Gunzip'); + } +} +// raw - no header +export class DeflateRaw extends Zlib { + constructor(opts) { + super(opts, 'DeflateRaw'); + } +} +export class InflateRaw extends Zlib { + constructor(opts) { + super(opts, 'InflateRaw'); + } +} +// auto-detect header. +export class Unzip extends Zlib { + constructor(opts) { + super(opts, 'Unzip'); + } +} +class Brotli extends ZlibBase { + constructor(opts, mode) { + opts = opts || {}; + opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS; + opts.finishFlush = + opts.finishFlush || constants.BROTLI_OPERATION_FINISH; + opts.fullFlushFlag = constants.BROTLI_OPERATION_FLUSH; + super(opts, mode); + } +} +export class BrotliCompress extends Brotli { + constructor(opts) { + super(opts, 'BrotliCompress'); + } +} +export class BrotliDecompress extends Brotli { + constructor(opts) { + super(opts, 'BrotliDecompress'); + } +} +class Zstd extends ZlibBase { + constructor(opts, mode) { + opts = opts || {}; + opts.flush = opts.flush || constants.ZSTD_e_continue; + opts.finishFlush = opts.finishFlush || constants.ZSTD_e_end; + opts.fullFlushFlag = constants.ZSTD_e_flush; + super(opts, mode); + } +} +export class ZstdCompress extends Zstd { + constructor(opts) { + super(opts, 'ZstdCompress'); + } +} +export class ZstdDecompress extends Zstd { + constructor(opts) { + super(opts, 'ZstdDecompress'); + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/esm/index.js.map b/node_modules/cmake-js/node_modules/minizlib/dist/esm/index.js.map new file mode 100644 index 0000000..1cbc650 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/esm/index.js.map @@ -0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IACtC,YAAY,IAAiB;QAC3B,KAAK,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAA;IAC/B,CAAC;CACF","sourcesContent":["import assert from 'assert'\nimport { Buffer } from 'buffer'\nimport { Minipass } from 'minipass'\nimport * as realZlib from 'zlib'\nimport { constants } from './constants.js'\nexport { constants } from './constants.js'\n\nconst OriginalBufferConcat = Buffer.concat\nconst desc = Object.getOwnPropertyDescriptor(Buffer, 'concat')\nconst noop = (args: Buffer[]) => args as unknown as Buffer\nconst passthroughBufferConcat =\n desc?.writable === true || desc?.set !== undefined\n ? (makeNoOp: boolean) => {\n Buffer.concat = makeNoOp ? noop : OriginalBufferConcat\n }\n : (_: boolean) => {}\n\nconst _superWrite = Symbol('_superWrite')\n\nexport class ZlibError extends Error {\n code?: string\n errno?: number\n constructor(err: NodeJS.ErrnoException | Error, origin?: Function) {\n super('zlib: ' + err.message, { cause: err })\n this.code = (err as NodeJS.ErrnoException).code\n this.errno = (err as NodeJS.ErrnoException).errno\n /* c8 ignore next */\n if (!this.code) this.code = 'ZLIB_ERROR'\n\n this.message = 'zlib: ' + err.message\n Error.captureStackTrace(this, origin ?? this.constructor)\n }\n\n get name() {\n return 'ZlibError'\n }\n}\n\n// the Zlib class they all inherit from\n// This thing manages the queue of requests, and returns\n// true or false if there is anything in the queue when\n// you call the .write() method.\nconst _flushFlag = Symbol('flushFlag')\n\nexport type ChunkWithFlushFlag = Minipass.ContiguousData & {\n [_flushFlag]?: number\n}\n\nexport type ZlibBaseOptions = Minipass.Options & {\n flush?: number\n finishFlush?: number\n fullFlushFlag?: number\n}\n\nexport type ZlibHandle =\n | realZlib.Gzip\n | realZlib.Gunzip\n | realZlib.Deflate\n | realZlib.Inflate\n | realZlib.DeflateRaw\n | realZlib.InflateRaw\n | realZlib.BrotliCompress\n | realZlib.BrotliDecompress\n | realZlib.ZstdCompress\n | realZlib.ZstdDecompress\nexport type ZlibMode =\n | 'Gzip'\n | 'Gunzip'\n | 'Deflate'\n | 'Inflate'\n | 'DeflateRaw'\n | 'InflateRaw'\n | 'Unzip'\nexport type BrotliMode = 'BrotliCompress' | 'BrotliDecompress'\nexport type ZstdMode = 'ZstdCompress' | 'ZstdDecompress'\n\nabstract class ZlibBase extends Minipass {\n #sawError: boolean = false\n #ended: boolean = false\n #flushFlag: number\n #finishFlushFlag: number\n #fullFlushFlag: number\n #handle?: ZlibHandle\n #onError: (err: ZlibError) => any\n\n get sawError() {\n return this.#sawError\n }\n get handle() {\n return this.#handle\n }\n /* c8 ignore start */\n get flushFlag() {\n return this.#flushFlag\n }\n /* c8 ignore stop */\n\n constructor(opts: ZlibBaseOptions, mode: ZlibMode | BrotliMode | ZstdMode) {\n if (!opts || typeof opts !== 'object')\n throw new TypeError('invalid options for ZlibBase constructor')\n\n //@ts-ignore\n super(opts)\n\n /* c8 ignore start */\n this.#flushFlag = opts.flush ?? 0\n this.#finishFlushFlag = opts.finishFlush ?? 0\n this.#fullFlushFlag = opts.fullFlushFlag ?? 0\n /* c8 ignore stop */\n\n //@ts-ignore\n if (typeof realZlib[mode] !== 'function') {\n throw new TypeError('Compression method not supported: ' + mode)\n }\n\n // this will throw if any options are invalid for the class selected\n try {\n // @types/node doesn't know that it exports the classes, but they're there\n //@ts-ignore\n this.#handle = new realZlib[mode](opts)\n } catch (er) {\n // make sure that all errors get decorated properly\n throw new ZlibError(er as NodeJS.ErrnoException, this.constructor)\n }\n\n this.#onError = err => {\n // no sense raising multiple errors, since we abort on the first one.\n if (this.#sawError) return\n\n this.#sawError = true\n\n // there is no way to cleanly recover.\n // continuing only obscures problems.\n this.close()\n this.emit('error', err)\n }\n\n this.#handle?.on('error', er => this.#onError(new ZlibError(er)))\n this.once('end', () => this.close)\n }\n\n close() {\n if (this.#handle) {\n this.#handle.close()\n this.#handle = undefined\n this.emit('close')\n }\n }\n\n reset() {\n if (!this.#sawError) {\n assert(this.#handle, 'zlib binding closed')\n //@ts-ignore\n return this.#handle.reset?.()\n }\n }\n\n flush(flushFlag?: number) {\n if (this.ended) return\n\n if (typeof flushFlag !== 'number') flushFlag = this.#fullFlushFlag\n\n this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag }))\n }\n\n end(cb?: () => void): this\n end(chunk: ChunkWithFlushFlag, cb?: () => void): this\n end(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding,\n cb?: () => void,\n ): this\n end(\n chunk?: ChunkWithFlushFlag | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void,\n ) {\n /* c8 ignore start */\n if (typeof chunk === 'function') {\n cb = chunk\n encoding = undefined\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n /* c8 ignore stop */\n if (chunk) {\n if (encoding) this.write(chunk, encoding)\n else this.write(chunk)\n }\n this.flush(this.#finishFlushFlag)\n this.#ended = true\n return super.end(cb)\n }\n\n get ended() {\n return this.#ended\n }\n\n // overridden in the gzip classes to do portable writes\n [_superWrite](data: Buffer & { [_flushFlag]?: number }) {\n return super.write(data)\n }\n\n write(chunk: ChunkWithFlushFlag, cb?: () => void): boolean\n write(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding,\n cb?: () => void,\n ): boolean\n write(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void,\n ) {\n // process the chunk using the sync process\n // then super.write() all the outputted chunks\n if (typeof encoding === 'function')\n (cb = encoding), (encoding = 'utf8')\n\n if (typeof chunk === 'string')\n chunk = Buffer.from(chunk as string, encoding as BufferEncoding)\n\n if (this.#sawError) return\n assert(this.#handle, 'zlib binding closed')\n\n // _processChunk tries to .close() the native handle after it's done, so we\n // intercept that by temporarily making it a no-op.\n // diving into the node:zlib internals a bit here\n const nativeHandle = (this.#handle as unknown as { _handle: any })\n ._handle\n const originalNativeClose = nativeHandle.close\n nativeHandle.close = () => {}\n const originalClose = this.#handle.close\n this.#handle.close = () => {}\n // It also calls `Buffer.concat()` at the end, which may be convenient\n // for some, but which we are not interested in as it slows us down.\n passthroughBufferConcat(true)\n let result: undefined | Buffer | Buffer[] = undefined\n try {\n const flushFlag =\n typeof chunk[_flushFlag] === 'number'\n ? chunk[_flushFlag]\n : this.#flushFlag\n result = (\n this.#handle as unknown as {\n _processChunk: (chunk: Buffer, flushFlag: number) => Buffer[]\n }\n )._processChunk(chunk as Buffer, flushFlag)\n // if we don't throw, reset it back how it was\n passthroughBufferConcat(false)\n } catch (err) {\n // or if we do, put Buffer.concat() back before we emit error\n // Error events call into user code, which may call Buffer.concat()\n passthroughBufferConcat(false)\n this.#onError(new ZlibError(err as NodeJS.ErrnoException, this.write))\n } finally {\n if (this.#handle) {\n // Core zlib resets `_handle` to null after attempting to close the\n // native handle. Our no-op handler prevented actual closure, but we\n // need to restore the `._handle` property.\n ;(this.#handle as unknown as { _handle: any })._handle =\n nativeHandle\n nativeHandle.close = originalNativeClose\n this.#handle.close = originalClose\n // `_processChunk()` adds an 'error' listener. If we don't remove it\n // after each call, these handlers start piling up.\n this.#handle.removeAllListeners('error')\n // make sure OUR error listener is still attached tho\n }\n }\n\n if (this.#handle)\n this.#handle.on('error', er => this.#onError(new ZlibError(er, this.write)))\n\n let writeReturn\n if (result) {\n if (Array.isArray(result) && result.length > 0) {\n const r = result[0]\n // The first buffer is always `handle._outBuffer`, which would be\n // re-used for later invocations; so, we always have to copy that one.\n writeReturn = this[_superWrite](Buffer.from(r as Buffer))\n for (let i = 1; i < result.length; i++) {\n writeReturn = this[_superWrite](result[i] as Buffer)\n }\n } else {\n // either a single Buffer or an empty array\n writeReturn = this[_superWrite](Buffer.from(result as Buffer | []))\n }\n }\n\n if (cb) cb()\n return writeReturn\n }\n}\n\nexport type ZlibOptions = ZlibBaseOptions & {\n level?: number\n strategy?: number\n}\n\nexport class Zlib extends ZlibBase {\n #level?: number\n #strategy?: number\n\n constructor(opts: ZlibOptions, mode: ZlibMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.Z_NO_FLUSH\n opts.finishFlush = opts.finishFlush || constants.Z_FINISH\n opts.fullFlushFlag = constants.Z_FULL_FLUSH\n super(opts, mode)\n\n this.#level = opts.level\n this.#strategy = opts.strategy\n }\n\n params(level: number, strategy: number) {\n if (this.sawError) return\n\n if (!this.handle)\n throw new Error('cannot switch params when binding is closed')\n\n // no way to test this without also not supporting params at all\n /* c8 ignore start */\n if (!(this.handle as { params?: any }).params)\n throw new Error('not supported in this implementation')\n /* c8 ignore stop */\n\n if (this.#level !== level || this.#strategy !== strategy) {\n this.flush(constants.Z_SYNC_FLUSH)\n assert(this.handle, 'zlib binding closed')\n // .params() calls .flush(), but the latter is always async in the\n // core zlib. We override .flush() temporarily to intercept that and\n // flush synchronously.\n const origFlush = this.handle.flush\n this.handle.flush = (\n flushFlag?: (() => void) | number,\n cb?: () => void,\n ) => {\n /* c8 ignore start */\n if (typeof flushFlag === 'function') {\n cb = flushFlag\n flushFlag = this.flushFlag\n }\n /* c8 ignore stop */\n this.flush(flushFlag)\n cb?.()\n }\n try {\n ;(\n this.handle as unknown as {\n params: (level?: number, strategy?: number) => void\n }\n ).params(level, strategy)\n } finally {\n this.handle.flush = origFlush\n }\n /* c8 ignore start */\n if (this.handle) {\n this.#level = level\n this.#strategy = strategy\n }\n /* c8 ignore stop */\n }\n }\n}\n\n// minimal 2-byte header\nexport class Deflate extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Deflate')\n }\n}\n\nexport class Inflate extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Inflate')\n }\n}\n\n// gzip - bigger header, same deflate compression\nexport type GzipOptions = ZlibOptions & { portable?: boolean }\nexport class Gzip extends Zlib {\n #portable: boolean\n constructor(opts: GzipOptions) {\n super(opts, 'Gzip')\n this.#portable = opts && !!opts.portable\n }\n\n [_superWrite](data: Buffer & { [_flushFlag]?: number }) {\n if (!this.#portable) return super[_superWrite](data)\n\n // we'll always get the header emitted in one first chunk\n // overwrite the OS indicator byte with 0xFF\n this.#portable = false\n data[9] = 255\n return super[_superWrite](data)\n }\n}\n\nexport class Gunzip extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Gunzip')\n }\n}\n\n// raw - no header\nexport class DeflateRaw extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'DeflateRaw')\n }\n}\n\nexport class InflateRaw extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'InflateRaw')\n }\n}\n\n// auto-detect header.\nexport class Unzip extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Unzip')\n }\n}\n\nclass Brotli extends ZlibBase {\n constructor(opts: ZlibOptions, mode: BrotliMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS\n opts.finishFlush =\n opts.finishFlush || constants.BROTLI_OPERATION_FINISH\n opts.fullFlushFlag = constants.BROTLI_OPERATION_FLUSH\n super(opts, mode)\n }\n}\n\nexport class BrotliCompress extends Brotli {\n constructor(opts: ZlibOptions) {\n super(opts, 'BrotliCompress')\n }\n}\n\nexport class BrotliDecompress extends Brotli {\n constructor(opts: ZlibOptions) {\n super(opts, 'BrotliDecompress')\n }\n}\n\nclass Zstd extends ZlibBase {\n constructor(opts: ZlibOptions, mode: ZstdMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.ZSTD_e_continue\n opts.finishFlush = opts.finishFlush || constants.ZSTD_e_end\n opts.fullFlushFlag = constants.ZSTD_e_flush\n super(opts, mode)\n }\n}\n\nexport class ZstdCompress extends Zstd {\n constructor(opts: ZlibOptions) {\n super(opts, 'ZstdCompress')\n }\n}\n\nexport class ZstdDecompress extends Zstd {\n constructor(opts: ZlibOptions) {\n super(opts, 'ZstdDecompress')\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/minizlib/dist/esm/package.json b/node_modules/cmake-js/node_modules/minizlib/dist/esm/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/cmake-js/node_modules/minizlib/package.json b/node_modules/cmake-js/node_modules/minizlib/package.json new file mode 100644 index 0000000..dceaed9 --- /dev/null +++ b/node_modules/cmake-js/node_modules/minizlib/package.json @@ -0,0 +1,80 @@ +{ + "name": "minizlib", + "version": "3.1.0", + "description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.", + "main": "./dist/commonjs/index.js", + "dependencies": { + "minipass": "^7.1.2" + }, + "scripts": { + "prepare": "tshy", + "pretest": "npm run prepare", + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "format": "prettier --write . --loglevel warn", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/minizlib.git" + }, + "keywords": [ + "zlib", + "gzip", + "gunzip", + "deflate", + "inflate", + "compression", + "zip", + "unzip" + ], + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "MIT", + "devDependencies": { + "@types/node": "^24.5.2", + "tap": "^21.1.0", + "tshy": "^3.0.2", + "typedoc": "^0.28.1" + }, + "files": [ + "dist" + ], + "engines": { + "node": ">= 18" + }, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + } + }, + "types": "./dist/commonjs/index.d.ts", + "type": "module", + "prettier": { + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + }, + "module": "./dist/esm/index.js" +} diff --git a/node_modules/cmake-js/node_modules/tar/LICENSE.md b/node_modules/cmake-js/node_modules/tar/LICENSE.md new file mode 100644 index 0000000..c5402b9 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/LICENSE.md @@ -0,0 +1,55 @@ +# Blue Oak Model License + +Version 1.0.0 + +## Purpose + +This license gives everyone as much permission to work with +this software as possible, while protecting contributors +from liability. + +## Acceptance + +In order to receive this license, you must agree to its +rules. The rules of this license are both obligations +under that agreement and conditions to your license. +You must not do anything with this software that triggers +a rule that you cannot or will not follow. + +## Copyright + +Each contributor licenses you to do everything with this +software that would otherwise infringe that contributor's +copyright in it. + +## Notices + +You must ensure that everyone who gets a copy of +any part of this software from you, with or without +changes, also gets the text of this license or a link to +. + +## Excuse + +If anyone notifies you in writing that you have not +complied with [Notices](#notices), you can keep your +license by taking all practical steps to comply within 30 +days after the notice. If you do not do so, your license +ends immediately. + +## Patent + +Each contributor licenses you to do everything with this +software that would otherwise infringe any patent claims +they can license or become able to license. + +## Reliability + +No contributor can revoke this license. + +## No Liability + +***As far as the law allows, this software comes as is, +without any warranty or condition, and no contributor +will be liable to anyone for any damages related to this +software or this license, under any kind of legal claim.*** diff --git a/node_modules/cmake-js/node_modules/tar/README.md b/node_modules/cmake-js/node_modules/tar/README.md new file mode 100644 index 0000000..1bf3656 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/README.md @@ -0,0 +1,1145 @@ +# node-tar + +Fast and full-featured Tar for Node.js + +The API is designed to mimic the behavior of `tar(1)` on unix systems. +If you are familiar with how tar works, most of this will hopefully be +straightforward for you. If not, then hopefully this module can teach +you useful unix skills that may come in handy someday :) + +## Background + +A "tar file" or "tarball" is an archive of file system entries +(directories, files, links, etc.) The name comes from "tape archive". +If you run `man tar` on almost any Unix command line, you'll learn +quite a bit about what it can do, and its history. + +Tar has 5 main top-level commands: + +- `c` Create an archive +- `r` Replace entries within an archive +- `u` Update entries within an archive (ie, replace if they're newer) +- `t` List out the contents of an archive +- `x` Extract an archive to disk + +The other flags and options modify how this top level function works. + +## High-Level API + +These 5 functions are the high-level API. All of them have a +single-character name (for unix nerds familiar with `tar(1)`) as well +as a long name (for everyone else). + +All the high-level functions take the following arguments, all three +of which are optional and may be omitted. + +1. `options` - An optional object specifying various options +2. `paths` - An array of paths to add or extract +3. `callback` - Called when the command is completed, if async. (If + sync or no file specified, providing a callback throws a + `TypeError`.) + +If the command is sync (ie, if `options.sync=true`), then the +callback is not allowed, since the action will be completed immediately. + +If a `file` argument is specified, and the command is async, then a +`Promise` is returned. In this case, if async, a callback may be +provided which is called when the command is completed. + +If a `file` option is not specified, then a stream is returned. For +`create`, this is a readable stream of the generated archive. For +`list` and `extract` this is a writable stream that an archive should +be written into. If a file is not specified, then a callback is not +allowed, because you're already getting a stream to work with. + +`replace` and `update` only work on existing archives, and so require +a `file` argument. + +Sync commands without a file argument return a stream that acts on its +input immediately in the same tick. For readable streams, this means +that all of the data is immediately available by calling +`stream.read()`. For writable streams, it will be acted upon as soon +as it is provided, but this can be at any time. + +### Warnings and Errors + +Tar emits warnings and errors for recoverable and unrecoverable situations, +respectively. In many cases, a warning only affects a single entry in an +archive, or is simply informing you that it's modifying an entry to comply +with the settings provided. + +Unrecoverable warnings will always raise an error (ie, emit `'error'` on +streaming actions, throw for non-streaming sync actions, reject the +returned Promise for non-streaming async operations, or call a provided +callback with an `Error` as the first argument). Recoverable errors will +raise an error only if `strict: true` is set in the options. + +Respond to (recoverable) warnings by listening to the `warn` event. +Handlers receive 3 arguments: + +- `code` String. One of the error codes below. This may not match + `data.code`, which preserves the original error code from fs and zlib. +- `message` String. More details about the error. +- `data` Metadata about the error. An `Error` object for errors raised by + fs and zlib. All fields are attached to errors raisd by tar. Typically + contains the following fields, as relevant: + - `tarCode` The tar error code. + - `code` Either the tar error code, or the error code set by the + underlying system. + - `file` The archive file being read or written. + - `cwd` Working directory for creation and extraction operations. + - `entry` The entry object (if it could be created) for `TAR_ENTRY_INFO`, + `TAR_ENTRY_INVALID`, and `TAR_ENTRY_ERROR` warnings. + - `header` The header object (if it could be created, and the entry could + not be created) for `TAR_ENTRY_INFO` and `TAR_ENTRY_INVALID` warnings. + - `recoverable` Boolean. If `false`, then the warning will emit an + `error`, even in non-strict mode. + +#### Error Codes + +- `TAR_ENTRY_INFO` An informative error indicating that an entry is being + modified, but otherwise processed normally. For example, removing `/` or + `C:\` from absolute paths if `preservePaths` is not set. + +- `TAR_ENTRY_INVALID` An indication that a given entry is not a valid tar + archive entry, and will be skipped. This occurs when: + - a checksum fails, + - a `linkpath` is missing for a link type, or + - a `linkpath` is provided for a non-link type. + + If every entry in a parsed archive raises an `TAR_ENTRY_INVALID` error, + then the archive is presumed to be unrecoverably broken, and + `TAR_BAD_ARCHIVE` will be raised. + +- `TAR_ENTRY_ERROR` The entry appears to be a valid tar archive entry, but + encountered an error which prevented it from being unpacked. This occurs + when: + - an unrecoverable fs error happens during unpacking, + - an entry is trying to extract into an excessively deep + location (by default, limited to 1024 subfolders), + - an entry has `..` in the path and `preservePaths` is not set, or + - an entry is extracting through a symbolic link, when `preservePaths` is + not set. + +- `TAR_ENTRY_UNSUPPORTED` An indication that a given entry is + a valid archive entry, but of a type that is unsupported, and so will be + skipped in archive creation or extracting. + +- `TAR_ABORT` When parsing gzipped-encoded archives, the parser will + abort the parse process raise a warning for any zlib errors encountered. + Aborts are considered unrecoverable for both parsing and unpacking. + +- `TAR_BAD_ARCHIVE` The archive file is totally hosed. This can happen for + a number of reasons, and always occurs at the end of a parse or extract: + - An entry body was truncated before seeing the full number of bytes. + - The archive contained only invalid entries, indicating that it is + likely not an archive, or at least, not an archive this library can + parse. + + `TAR_BAD_ARCHIVE` is considered informative for parse operations, but + unrecoverable for extraction. Note that, if encountered at the end of an + extraction, tar WILL still have extracted as much it could from the + archive, so there may be some garbage files to clean up. + +Errors that occur deeper in the system (ie, either the filesystem or zlib) +will have their error codes left intact, and a `tarCode` matching one of +the above will be added to the warning metadata or the raised error object. + +Errors generated by tar will have one of the above codes set as the +`error.code` field as well, but since errors originating in zlib or fs will +have their original codes, it's better to read `error.tarCode` if you wish +to see how tar is handling the issue. + +### Examples + +The API mimics the `tar(1)` command line functionality, with aliases +for more human-readable option and function names. The goal is that +if you know how to use `tar(1)` in Unix, then you know how to use +`import('tar')` in JavaScript. + +To replicate `tar czf my-tarball.tgz files and folders`, you'd do: + +```js +import { create } from 'tar' +create( + { + gzip: , + file: 'my-tarball.tgz' + }, + ['some', 'files', 'and', 'folders'] +).then(_ => { .. tarball has been created .. }) +``` + +To replicate `tar cz files and folders > my-tarball.tgz`, you'd do: + +```js +// if you're familiar with the tar(1) cli flags, this can be nice +import * as tar from 'tar' +tar.c( + { + // 'z' is alias for 'gzip' option + z: + }, + ['some', 'files', 'and', 'folders'] +).pipe(fs.createWriteStream('my-tarball.tgz')) +``` + +To replicate `tar xf my-tarball.tgz` you'd do: + +```js +tar.x( // or `tar.extract` + { + // or `file:` + f: 'my-tarball.tgz' + } +).then(_=> { .. tarball has been dumped in cwd .. }) +``` + +To replicate `cat my-tarball.tgz | tar x -C some-dir --strip=1`: + +```js +fs.createReadStream('my-tarball.tgz').pipe( + tar.x({ + strip: 1, + C: 'some-dir', // alias for cwd:'some-dir', also ok + }), +) +``` + +To replicate `tar tf my-tarball.tgz`, do this: + +```js +tar.t({ + file: 'my-tarball.tgz', + onReadEntry: entry => { .. do whatever with it .. } +}) +``` + +For example, to just get the list of filenames from an archive: + +```js +const getEntryFilenames = async tarballFilename => { + const filenames = [] + await tar.t({ + file: tarballFilename, + onReadEntry: entry => filenames.push(entry.path), + }) + return filenames +} +``` + +To replicate `cat my-tarball.tgz | tar t` do: + +```js +fs.createReadStream('my-tarball.tgz') + .pipe(tar.t()) + .on('entry', entry => { .. do whatever with it .. }) +``` + +To do anything synchronous, add `sync: true` to the options. Note +that sync functions don't take a callback and don't return a promise. +When the function returns, it's already done. Sync methods without a +file argument return a sync stream, which flushes immediately. But, +of course, it still won't be done until you `.end()` it. + +```js +const getEntryFilenamesSync = tarballFilename => { + const filenames = [] + tar.t({ + file: tarballFilename, + onReadEntry: entry => filenames.push(entry.path), + sync: true, + }) + return filenames +} +``` + +To filter entries, add `filter: ` to the options. +Tar-creating methods call the filter with `filter(path, stat)`. +Tar-reading methods (including extraction) call the filter with +`filter(path, entry)`. The filter is called in the `this`-context of +the `Pack` or `Unpack` stream object. + +The arguments list to `tar t` and `tar x` specify a list of filenames +to extract or list, so they're equivalent to a filter that tests if +the file is in the list. + +For those who _aren't_ fans of tar's single-character command names: + +``` +tar.c === tar.create +tar.r === tar.replace (appends to archive, file is required) +tar.u === tar.update (appends if newer, file is required) +tar.x === tar.extract +tar.t === tar.list +``` + +Keep reading for all the command descriptions and options, as well as +the low-level API that they are built on. + +### tar.c(options, fileList, callback) [alias: tar.create] + +Create a tarball archive. + +The `fileList` is an array of paths to add to the tarball. Adding a +directory also adds its children recursively. + +An entry in `fileList` that starts with an `@` symbol is a tar archive +whose entries will be added. To add a file that starts with `@`, +prepend it with `./`. + +The following options are supported: + +- `file` Write the tarball archive to the specified filename. If this + is specified, then the callback will be fired when the file has been + written, and a promise will be returned that resolves when the file + is written. If a filename is not specified, then a Readable Stream + will be returned which will emit the file data. [Alias: `f`] +- `sync` Act synchronously. If this is set, then any provided file + will be fully written after the call to `tar.c`. If this is set, + and a file is not provided, then the resulting stream will already + have the data ready to `read` or `emit('data')` as soon as you + request it. +- `onwarn` A function that will get called with `(code, message, data)` for + any warnings encountered. (See "Warnings and Errors") +- `strict` Treat warnings as crash-worthy errors. Default false. +- `cwd` The current working directory for creating the archive. + Defaults to `process.cwd()`. [Alias: `C`] +- `prefix` A path portion to prefix onto the entries in the archive. +- `gzip` Set to any truthy value to create a gzipped archive, or an + object with settings for `zlib.Gzip()` [Alias: `z`] +- `filter` A function that gets called with `(path, stat)` for each + entry being added. Return `true` to add the entry to the archive, + or `false` to omit it. +- `portable` Omit metadata that is system-specific: `ctime`, `atime`, + `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`. Note + that `mtime` is still included, because this is necessary for other + time-based operations. Additionally, `mode` is set to a "reasonable + default" for most unix systems, based on a `umask` value of `0o22`. +- `preservePaths` Allow absolute paths. By default, `/` is stripped + from absolute paths. [Alias: `P`] +- `mode` The mode to set on the created file archive +- `noDirRecurse` Do not recursively archive the contents of + directories. [Alias: `n`] +- `follow` Set to true to pack the targets of symbolic links. Without + this option, symbolic links are archived as such. [Alias: `L`, `h`] +- `noPax` Suppress pax extended headers. Note that this means that + long paths and linkpaths will be truncated, and large or negative + numeric values may be interpreted incorrectly. +- `noMtime` Set to true to omit writing `mtime` values for entries. + Note that this prevents using other mtime-based features like + `tar.update` or the `keepNewer` option with the resulting tar archive. + [Alias: `m`, `no-mtime`] +- `mtime` Set to a `Date` object to force a specific `mtime` for + everything added to the archive. Overridden by `noMtime`. +- `onWriteEntry` Called with each `WriteEntry` or + `WriteEntrySync` that is created in the course of writing the + archive. + +The following options are mostly internal, but can be modified in some +advanced use cases, such as re-using caches between runs. + +- `linkCache` A Map object containing the device and inode value for + any file whose nlink is > 1, to identify hard links. +- `statCache` A Map object that caches calls `lstat`. +- `readdirCache` A Map object that caches calls to `readdir`. +- `jobs` A number specifying how many concurrent jobs to run. + Defaults to 4. +- `maxReadSize` The maximum buffer size for `fs.read()` operations. + Defaults to 16 MB. + +#### Using `onWriteEntry` to alter entries + +The `onWriteEntry` function, if provided, will get a reference +to each `entry` object on its way into the archive. + +If any fields on this entry are changed, then these changes will +be reflected in the entry that is written to the archive. + +The return value of the function is ignored. All that matters is +the final state of the entry object. This can also be used to +track the files added to an archive, for example. + +```js +import * as tar from 'tar' +const filesAdded = [] +tar.c( + { + sync: true, + file: 'lowercase-executable.tar', + onWriteEntry(entry) { + // initially, it's uppercase and 0o644 + console.log('adding', entry.path, entry.stat.mode.toString(8)) + // make all the paths lowercase + entry.path = entry.path.toLowerCase() + // make the entry executable + entry.stat.mode = 0o755 + // in the archive, it's lowercase and 0o755 + filesAdded.push([entry.path, entry.stat.mode.toString(8)]) + }, + }, + ['./bin'], +) +console.log('added', filesAdded) +``` + +Then, if the `./bin` directory contained `SOME-BIN`, it would +show up in the archive as: + +``` +$ node create-lowercase-executable.js +adding ./bin/SOME-BIN 644 +added [[ './bin/some-bin', '755' ]] + +$ tar cvf lowercase-executable.tar +-rwxr-xr-x 0 isaacs 20 47731 Aug 14 08:56 ./bin/some-bin +``` + +with a lowercase name and a mode of `0o755`. + +### tar.x(options, fileList, callback) [alias: tar.extract] + +Extract a tarball archive. + +The `fileList` is an array of paths to extract from the tarball. If +no paths are provided, then all the entries are extracted. + +If the archive is gzipped, then tar will detect this and unzip it. + +Note that all directories that are created will be forced to be +writable, readable, and listable by their owner, to avoid cases where +a directory prevents extraction of child entries by virtue of its +mode. + +Most extraction errors will cause a `warn` event to be emitted. If +the `cwd` is missing, or not a directory, then the extraction will +fail completely. + +The following options are supported: + +- `cwd` Extract files relative to the specified directory. Defaults + to `process.cwd()`. If provided, this must exist and must be a + directory. [Alias: `C`] +- `file` The archive file to extract. If not specified, then a + Writable stream is returned where the archive data should be + written. [Alias: `f`] +- `sync` Create files and directories synchronously. +- `strict` Treat warnings as crash-worthy errors. Default false. +- `filter` A function that gets called with `(path, entry)` for each + entry being unpacked. Return `true` to unpack the entry from the + archive, or `false` to skip it. +- `newer` Set to true to keep the existing file on disk if it's newer + than the file in the archive. [Alias: `keep-newer`, + `keep-newer-files`] +- `keep` Do not overwrite existing files. In particular, if a file + appears more than once in an archive, later copies will not + overwrite earlier copies. [Alias: `k`, `keep-existing`] +- `preservePaths` Allow absolute paths, paths containing `..`, and + extracting through symbolic links. By default, `/` is stripped from + absolute paths, `..` paths are not extracted, and any file whose + location would be modified by a symbolic link is not extracted. + [Alias: `P`] +- `unlink` Unlink files before creating them. Without this option, + tar overwrites existing files, which preserves existing hardlinks. + With this option, existing hardlinks will be broken, as will any + symlink that would affect the location of an extracted file. [Alias: + `U`] +- `strip` Remove the specified number of leading path elements. + Pathnames with fewer elements will be silently skipped. Note that + the pathname is edited after applying the filter, but before + security checks. [Alias: `strip-components`, `stripComponents`] +- `preserveOwner` If true, tar will set the `uid` and `gid` of + extracted entries to the `uid` and `gid` fields in the archive. + This defaults to true when run as root, and false otherwise. If + false, then files and directories will be set with the owner and + group of the user running the process. This is similar to `-p` in + `tar(1)`, but ACLs and other system-specific data is never unpacked + in this implementation, and modes are set by default already. + [Alias: `p`] +- `uid` Set to a number to force ownership of all extracted files and + folders, and all implicitly created directories, to be owned by the + specified user id, regardless of the `uid` field in the archive. + Cannot be used along with `preserveOwner`. Requires also setting a + `gid` option. +- `gid` Set to a number to force ownership of all extracted files and + folders, and all implicitly created directories, to be owned by the + specified group id, regardless of the `gid` field in the archive. + Cannot be used along with `preserveOwner`. Requires also setting a + `uid` option. +- `noMtime` Set to true to omit writing `mtime` value for extracted + entries. [Alias: `m`, `no-mtime`] +- `transform` Provide a function that takes an `entry` object, and + returns a stream, or any falsey value. If a stream is provided, + then that stream's data will be written instead of the contents of + the archive entry. If a falsey value is provided, then the entry is + written to disk as normal. (To exclude items from extraction, use + the `filter` option described above.) +- `onReadEntry` A function that gets called with `(entry)` for each entry + that passes the filter. +- `onwarn` A function that will get called with `(code, message, data)` for + any warnings encountered. (See "Warnings and Errors") +- `chmod` Set to true to call `fs.chmod()` to ensure that the + extracted file matches the entry mode. This may necessitate a + call to the deprecated and thread-unsafe `process.umask()` + method to determine the default umask value, unless a + `processUmask` options is also provided. Otherwise tar will + extract with whatever mode is provided, and let the process + `umask` apply normally. +- `processUmask` Set to an explicit numeric value to avoid + calling `process.umask()` when `chmod: true` is set. +- `maxDepth` The maximum depth of subfolders to extract into. This + defaults to 1024. Anything deeper than the limit will raise a + warning and skip the entry. Set to `Infinity` to remove the + limitation. + +The following options are mostly internal, but can be modified in some +advanced use cases, such as re-using caches between runs. + +- `maxReadSize` The maximum buffer size for `fs.read()` operations. + Defaults to 16 MB. +- `umask` Filter the modes of entries like `process.umask()`. +- `dmode` Default mode for directories +- `fmode` Default mode for files +- `maxMetaEntrySize` The maximum size of meta entries that is + supported. Defaults to 1 MB. + +Note that using an asynchronous stream type with the `transform` +option will cause undefined behavior in sync extractions. +[MiniPass](http://npm.im/minipass)-based streams are designed for this +use case. + +### tar.t(options, fileList, callback) [alias: tar.list] + +List the contents of a tarball archive. + +The `fileList` is an array of paths to list from the tarball. If +no paths are provided, then all the entries are listed. + +If the archive is gzipped, then tar will detect this and unzip it. + +If the `file` option is _not_ provided, then returns an event emitter that +emits `entry` events with `tar.ReadEntry` objects. However, they don't +emit `'data'` or `'end'` events. (If you want to get actual readable +entries, use the `tar.Parser` class instead.) + +If a `file` option _is_ provided, then the return value will be a promise +that resolves when the file has been fully traversed in async mode, or +`undefined` if `sync: true` is set. Thus, you _must_ specify an `onReadEntry` +method in order to do anything useful with the data it parses. + +The following options are supported: + +- `file` The archive file to list. If not specified, then a + Writable stream is returned where the archive data should be + written. [Alias: `f`] +- `sync` Read the specified file synchronously. (This has no effect + when a file option isn't specified, because entries are emitted as + fast as they are parsed from the stream anyway.) +- `strict` Treat warnings as crash-worthy errors. Default false. +- `filter` A function that gets called with `(path, entry)` for each + entry being listed. Return `true` to emit the entry from the + archive, or `false` to skip it. +- `onReadEntry` A function that gets called with `(entry)` for each entry + that passes the filter. This is important for when `file` is set, + because there is no other way to do anything useful with this method. +- `maxReadSize` The maximum buffer size for `fs.read()` operations. + Defaults to 16 MB. +- `noResume` By default, `entry` streams are resumed immediately after + the call to `onReadEntry`. Set `noResume: true` to suppress this + behavior. Note that by opting into this, the stream will never + complete until the entry data is consumed. +- `onwarn` A function that will get called with `(code, message, data)` for + any warnings encountered. (See "Warnings and Errors") + +### tar.u(options, fileList, callback) [alias: tar.update] + +Add files to an archive if they are newer than the entry already in +the tarball archive. + +The `fileList` is an array of paths to add to the tarball. Adding a +directory also adds its children recursively. + +An entry in `fileList` that starts with an `@` symbol is a tar archive +whose entries will be added. To add a file that starts with `@`, +prepend it with `./`. + +The following options are supported: + +- `file` Required. Write the tarball archive to the specified + filename. [Alias: `f`] +- `sync` Act synchronously. If this is set, then any provided file + will be fully written after the call to `tar.c`. +- `onwarn` A function that will get called with `(code, message, data)` for + any warnings encountered. (See "Warnings and Errors") +- `strict` Treat warnings as crash-worthy errors. Default false. +- `cwd` The current working directory for adding entries to the + archive. Defaults to `process.cwd()`. [Alias: `C`] +- `prefix` A path portion to prefix onto the entries in the archive. +- `gzip` Set to any truthy value to create a gzipped archive, or an + object with settings for `zlib.Gzip()` [Alias: `z`] +- `filter` A function that gets called with `(path, stat)` for each + entry being added. Return `true` to add the entry to the archive, + or `false` to omit it. +- `portable` Omit metadata that is system-specific: `ctime`, `atime`, + `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`. Note + that `mtime` is still included, because this is necessary for other + time-based operations. Additionally, `mode` is set to a "reasonable + default" for most unix systems, based on a `umask` value of `0o22`. +- `preservePaths` Allow absolute paths. By default, `/` is stripped + from absolute paths. [Alias: `P`] +- `maxReadSize` The maximum buffer size for `fs.read()` operations. + Defaults to 16 MB. +- `noDirRecurse` Do not recursively archive the contents of + directories. [Alias: `n`] +- `follow` Set to true to pack the targets of symbolic links. Without + this option, symbolic links are archived as such. [Alias: `L`, `h`] +- `noPax` Suppress pax extended headers. Note that this means that + long paths and linkpaths will be truncated, and large or negative + numeric values may be interpreted incorrectly. +- `noMtime` Set to true to omit writing `mtime` values for entries. + Note that this prevents using other mtime-based features like + `tar.update` or the `keepNewer` option with the resulting tar archive. + [Alias: `m`, `no-mtime`] +- `mtime` Set to a `Date` object to force a specific `mtime` for + everything added to the archive. Overridden by `noMtime`. +- `onWriteEntry` Called with each `WriteEntry` or + `WriteEntrySync` that is created in the course of writing the + archive. + +### tar.r(options, fileList, callback) [alias: tar.replace] + +Add files to an existing archive. Because later entries override +earlier entries, this effectively replaces any existing entries. + +The `fileList` is an array of paths to add to the tarball. Adding a +directory also adds its children recursively. + +An entry in `fileList` that starts with an `@` symbol is a tar archive +whose entries will be added. To add a file that starts with `@`, +prepend it with `./`. + +The following options are supported: + +- `file` Required. Write the tarball archive to the specified + filename. [Alias: `f`] +- `sync` Act synchronously. If this is set, then any provided file + will be fully written after the call to `tar.c`. +- `onwarn` A function that will get called with `(code, message, data)` for + any warnings encountered. (See "Warnings and Errors") +- `strict` Treat warnings as crash-worthy errors. Default false. +- `cwd` The current working directory for adding entries to the + archive. Defaults to `process.cwd()`. [Alias: `C`] +- `prefix` A path portion to prefix onto the entries in the archive. +- `gzip` Set to any truthy value to create a gzipped archive, or an + object with settings for `zlib.Gzip()` [Alias: `z`] +- `filter` A function that gets called with `(path, stat)` for each + entry being added. Return `true` to add the entry to the archive, + or `false` to omit it. +- `portable` Omit metadata that is system-specific: `ctime`, `atime`, + `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`. Note + that `mtime` is still included, because this is necessary for other + time-based operations. Additionally, `mode` is set to a "reasonable + default" for most unix systems, based on a `umask` value of `0o22`. +- `preservePaths` Allow absolute paths. By default, `/` is stripped + from absolute paths. [Alias: `P`] +- `maxReadSize` The maximum buffer size for `fs.read()` operations. + Defaults to 16 MB. +- `noDirRecurse` Do not recursively archive the contents of + directories. [Alias: `n`] +- `follow` Set to true to pack the targets of symbolic links. Without + this option, symbolic links are archived as such. [Alias: `L`, `h`] +- `noPax` Suppress pax extended headers. Note that this means that + long paths and linkpaths will be truncated, and large or negative + numeric values may be interpreted incorrectly. +- `noMtime` Set to true to omit writing `mtime` values for entries. + Note that this prevents using other mtime-based features like + `tar.update` or the `keepNewer` option with the resulting tar archive. + [Alias: `m`, `no-mtime`] +- `mtime` Set to a `Date` object to force a specific `mtime` for + everything added to the archive. Overridden by `noMtime`. +- `onWriteEntry` Called with each `WriteEntry` or + `WriteEntrySync` that is created in the course of writing the + archive. + +## Low-Level API + +### class Pack + +A readable tar stream. + +Has all the standard readable stream interface stuff. `'data'` and +`'end'` events, `read()` method, `pause()` and `resume()`, etc. + +#### constructor(options) + +The following options are supported: + +- `onwarn` A function that will get called with `(code, message, data)` for + any warnings encountered. (See "Warnings and Errors") +- `strict` Treat warnings as crash-worthy errors. Default false. +- `cwd` The current working directory for creating the archive. + Defaults to `process.cwd()`. +- `prefix` A path portion to prefix onto the entries in the archive. +- `gzip` Set to any truthy value to create a gzipped archive, or an + object with settings for `zlib.Gzip()` +- `filter` A function that gets called with `(path, stat)` for each + entry being added. Return `true` to add the entry to the archive, + or `false` to omit it. +- `portable` Omit metadata that is system-specific: `ctime`, `atime`, + `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`. Note + that `mtime` is still included, because this is necessary for other + time-based operations. Additionally, `mode` is set to a "reasonable + default" for most unix systems, based on a `umask` value of `0o22`. +- `preservePaths` Allow absolute paths. By default, `/` is stripped + from absolute paths. +- `linkCache` A Map object containing the device and inode value for + any file whose nlink is > 1, to identify hard links. +- `statCache` A Map object that caches calls `lstat`. +- `readdirCache` A Map object that caches calls to `readdir`. +- `jobs` A number specifying how many concurrent jobs to run. + Defaults to 4. +- `maxReadSize` The maximum buffer size for `fs.read()` operations. + Defaults to 16 MB. +- `noDirRecurse` Do not recursively archive the contents of + directories. +- `follow` Set to true to pack the targets of symbolic links. Without + this option, symbolic links are archived as such. +- `noPax` Suppress pax extended headers. Note that this means that + long paths and linkpaths will be truncated, and large or negative + numeric values may be interpreted incorrectly. +- `noMtime` Set to true to omit writing `mtime` values for entries. + Note that this prevents using other mtime-based features like + `tar.update` or the `keepNewer` option with the resulting tar archive. +- `mtime` Set to a `Date` object to force a specific `mtime` for + everything added to the archive. Overridden by `noMtime`. +- `onWriteEntry` Called with each `WriteEntry` or + `WriteEntrySync` that is created in the course of writing the + archive. + +#### add(path) + +Adds an entry to the archive. Returns the Pack stream. + +#### write(path) + +Adds an entry to the archive. Returns true if flushed. + +#### end() + +Finishes the archive. + +### class PackSync + +Synchronous version of `Pack`. + +### class Unpack + +A writable stream that unpacks a tar archive onto the file system. + +All the normal writable stream stuff is supported. `write()` and +`end()` methods, `'drain'` events, etc. + +Note that all directories that are created will be forced to be +writable, readable, and listable by their owner, to avoid cases where +a directory prevents extraction of child entries by virtue of its +mode. + +`'close'` is emitted when it's done writing stuff to the file system. + +Most unpack errors will cause a `warn` event to be emitted. If the +`cwd` is missing, or not a directory, then an error will be emitted. + +#### constructor(options) + +- `cwd` Extract files relative to the specified directory. Defaults + to `process.cwd()`. If provided, this must exist and must be a + directory. +- `filter` A function that gets called with `(path, entry)` for each + entry being unpacked. Return `true` to unpack the entry from the + archive, or `false` to skip it. +- `newer` Set to true to keep the existing file on disk if it's newer + than the file in the archive. +- `keep` Do not overwrite existing files. In particular, if a file + appears more than once in an archive, later copies will not + overwrite earlier copies. +- `preservePaths` Allow absolute paths, paths containing `..`, and + extracting through symbolic links. By default, `/` is stripped from + absolute paths, `..` paths are not extracted, and any file whose + location would be modified by a symbolic link is not extracted. +- `unlink` Unlink files before creating them. Without this option, + tar overwrites existing files, which preserves existing hardlinks. + With this option, existing hardlinks will be broken, as will any + symlink that would affect the location of an extracted file. +- `strip` Remove the specified number of leading path elements. + Pathnames with fewer elements will be silently skipped. Note that + the pathname is edited after applying the filter, but before + security checks. +- `umask` Filter the modes of entries like `process.umask()`. +- `dmode` Default mode for directories +- `fmode` Default mode for files +- `maxMetaEntrySize` The maximum size of meta entries that is + supported. Defaults to 1 MB. +- `preserveOwner` If true, tar will set the `uid` and `gid` of + extracted entries to the `uid` and `gid` fields in the archive. + This defaults to true when run as root, and false otherwise. If + false, then files and directories will be set with the owner and + group of the user running the process. This is similar to `-p` in + `tar(1)`, but ACLs and other system-specific data is never unpacked + in this implementation, and modes are set by default already. +- `win32` True if on a windows platform. Causes behavior where + filenames containing `<|>?` chars are converted to + windows-compatible values while being unpacked. +- `uid` Set to a number to force ownership of all extracted files and + folders, and all implicitly created directories, to be owned by the + specified user id, regardless of the `uid` field in the archive. + Cannot be used along with `preserveOwner`. Requires also setting a + `gid` option. +- `gid` Set to a number to force ownership of all extracted files and + folders, and all implicitly created directories, to be owned by the + specified group id, regardless of the `gid` field in the archive. + Cannot be used along with `preserveOwner`. Requires also setting a + `uid` option. +- `noMtime` Set to true to omit writing `mtime` value for extracted + entries. +- `transform` Provide a function that takes an `entry` object, and + returns a stream, or any falsey value. If a stream is provided, + then that stream's data will be written instead of the contents of + the archive entry. If a falsey value is provided, then the entry is + written to disk as normal. (To exclude items from extraction, use + the `filter` option described above.) +- `strict` Treat warnings as crash-worthy errors. Default false. +- `onReadEntry` A function that gets called with `(entry)` for each entry + that passes the filter. +- `onwarn` A function that will get called with `(code, message, data)` for + any warnings encountered. (See "Warnings and Errors") +- `chmod` Set to true to call `fs.chmod()` to ensure that the + extracted file matches the entry mode. This may necessitate a + call to the deprecated and thread-unsafe `process.umask()` + method to determine the default umask value, unless a + `processUmask` options is also provided. Otherwise tar will + extract with whatever mode is provided, and let the process + `umask` apply normally. +- `processUmask` Set to an explicit numeric value to avoid + calling `process.umask()` when `chmod: true` is set. +- `maxDepth` The maximum depth of subfolders to extract into. This + defaults to 1024. Anything deeper than the limit will raise a + warning and skip the entry. Set to `Infinity` to remove the + limitation. + +### class UnpackSync + +Synchronous version of `Unpack`. + +Note that using an asynchronous stream type with the `transform` +option will cause undefined behavior in sync unpack streams. +[MiniPass](http://npm.im/minipass)-based streams are designed for this +use case. + +### class tar.Parser + +A writable stream that parses a tar archive stream. All the standard +writable stream stuff is supported. + +If the archive is gzipped, then tar will detect this and unzip it. + +Emits `'entry'` events with `tar.ReadEntry` objects, which are +themselves readable streams that you can pipe wherever. + +Each `entry` will not emit until the one before it is flushed through, +so make sure to either consume the data (with `on('data', ...)` or +`.pipe(...)`) or throw it away with `.resume()` to keep the stream +flowing. + +#### constructor(options) + +Returns an event emitter that emits `entry` events with +`tar.ReadEntry` objects. + +The following options are supported: + +- `strict` Treat warnings as crash-worthy errors. Default false. +- `filter` A function that gets called with `(path, entry)` for each + entry being listed. Return `true` to emit the entry from the + archive, or `false` to skip it. +- `onReadEntry` A function that gets called with `(entry)` for each entry + that passes the filter. +- `onwarn` A function that will get called with `(code, message, data)` for + any warnings encountered. (See "Warnings and Errors") + +#### abort(error) + +Stop all parsing activities. This is called when there are zlib +errors. It also emits an unrecoverable warning with the error provided. + +### class tar.ReadEntry extends [MiniPass](http://npm.im/minipass) + +A representation of an entry that is being read out of a tar archive. + +It has the following fields: + +- `extended` The extended metadata object provided to the constructor. +- `globalExtended` The global extended metadata object provided to the + constructor. +- `remain` The number of bytes remaining to be written into the + stream. +- `blockRemain` The number of 512-byte blocks remaining to be written + into the stream. +- `ignore` Whether this entry should be ignored. +- `meta` True if this represents metadata about the next entry, false + if it represents a filesystem object. +- All the fields from the header, extended header, and global extended + header are added to the ReadEntry object. So it has `path`, `type`, + `size`, `mode`, and so on. + +#### constructor(header, extended, globalExtended) + +Create a new ReadEntry object with the specified header, extended +header, and global extended header values. + +### class tar.WriteEntry extends [MiniPass](http://npm.im/minipass) + +A representation of an entry that is being written from the file +system into a tar archive. + +Emits data for the Header, and for the Pax Extended Header if one is +required, as well as any body data. + +Creating a WriteEntry for a directory does not also create +WriteEntry objects for all of the directory contents. + +It has the following fields: + +- `path` The path field that will be written to the archive. By + default, this is also the path from the cwd to the file system + object. +- `portable` Omit metadata that is system-specific: `ctime`, `atime`, + `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`. Note + that `mtime` is still included, because this is necessary for other + time-based operations. Additionally, `mode` is set to a "reasonable + default" for most unix systems, based on a `umask` value of `0o22`. +- `myuid` If supported, the uid of the user running the current + process. +- `myuser` The `env.USER` string if set, or `''`. Set as the entry + `uname` field if the file's `uid` matches `this.myuid`. +- `maxReadSize` The maximum buffer size for `fs.read()` operations. + Defaults to 1 MB. +- `linkCache` A Map object containing the device and inode value for + any file whose nlink is > 1, to identify hard links. +- `statCache` A Map object that caches calls `lstat`. +- `preservePaths` Allow absolute paths. By default, `/` is stripped + from absolute paths. +- `cwd` The current working directory for creating the archive. + Defaults to `process.cwd()`. +- `absolute` The absolute path to the entry on the filesystem. By + default, this is `path.resolve(this.cwd, this.path)`, but it can be + overridden explicitly. +- `strict` Treat warnings as crash-worthy errors. Default false. +- `win32` True if on a windows platform. Causes behavior where paths + replace `\` with `/` and filenames containing the windows-compatible + forms of `<|>?:` characters are converted to actual `<|>?:` characters + in the archive. +- `noPax` Suppress pax extended headers. Note that this means that + long paths and linkpaths will be truncated, and large or negative + numeric values may be interpreted incorrectly. +- `noMtime` Set to true to omit writing `mtime` values for entries. + Note that this prevents using other mtime-based features like + `tar.update` or the `keepNewer` option with the resulting tar archive. + +#### constructor(path, options) + +`path` is the path of the entry as it is written in the archive. + +The following options are supported: + +- `portable` Omit metadata that is system-specific: `ctime`, `atime`, + `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`. Note + that `mtime` is still included, because this is necessary for other + time-based operations. Additionally, `mode` is set to a "reasonable + default" for most unix systems, based on a `umask` value of `0o22`. +- `maxReadSize` The maximum buffer size for `fs.read()` operations. + Defaults to 1 MB. +- `linkCache` A Map object containing the device and inode value for + any file whose nlink is > 1, to identify hard links. +- `statCache` A Map object that caches calls `lstat`. +- `preservePaths` Allow absolute paths. By default, `/` is stripped + from absolute paths. +- `cwd` The current working directory for creating the archive. + Defaults to `process.cwd()`. +- `absolute` The absolute path to the entry on the filesystem. By + default, this is `path.resolve(this.cwd, this.path)`, but it can be + overridden explicitly. +- `strict` Treat warnings as crash-worthy errors. Default false. +- `win32` True if on a windows platform. Causes behavior where paths + replace `\` with `/`. +- `onwarn` A function that will get called with `(code, message, data)` for + any warnings encountered. (See "Warnings and Errors") +- `noMtime` Set to true to omit writing `mtime` values for entries. + Note that this prevents using other mtime-based features like + `tar.update` or the `keepNewer` option with the resulting tar archive. +- `umask` Set to restrict the modes on the entries in the archive, + somewhat like how umask works on file creation. Defaults to + `process.umask()` on unix systems, or `0o22` on Windows. + +#### warn(message, data) + +If strict, emit an error with the provided message. + +Otherwise, emit a `'warn'` event with the provided message and data. + +### class tar.WriteEntry.Sync + +Synchronous version of tar.WriteEntry + +### class tar.WriteEntry.Tar + +A version of tar.WriteEntry that gets its data from a tar.ReadEntry +instead of from the filesystem. + +#### constructor(readEntry, options) + +`readEntry` is the entry being read out of another archive. + +The following options are supported: + +- `portable` Omit metadata that is system-specific: `ctime`, `atime`, + `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`. Note + that `mtime` is still included, because this is necessary for other + time-based operations. Additionally, `mode` is set to a "reasonable + default" for most unix systems, based on a `umask` value of `0o22`. +- `preservePaths` Allow absolute paths. By default, `/` is stripped + from absolute paths. +- `strict` Treat warnings as crash-worthy errors. Default false. +- `onwarn` A function that will get called with `(code, message, data)` for + any warnings encountered. (See "Warnings and Errors") +- `noMtime` Set to true to omit writing `mtime` values for entries. + Note that this prevents using other mtime-based features like + `tar.update` or the `keepNewer` option with the resulting tar archive. + +### class tar.Header + +A class for reading and writing header blocks. + +It has the following fields: + +- `nullBlock` True if decoding a block which is entirely composed of + `0x00` null bytes. (Useful because tar files are terminated by + at least 2 null blocks.) +- `cksumValid` True if the checksum in the header is valid, false + otherwise. +- `needPax` True if the values, as encoded, will require a Pax + extended header. +- `path` The path of the entry. +- `mode` The 4 lowest-order octal digits of the file mode. That is, + read/write/execute permissions for world, group, and owner, and the + setuid, setgid, and sticky bits. +- `uid` Numeric user id of the file owner +- `gid` Numeric group id of the file owner +- `size` Size of the file in bytes +- `mtime` Modified time of the file +- `cksum` The checksum of the header. This is generated by adding all + the bytes of the header block, treating the checksum field itself as + all ascii space characters (that is, `0x20`). +- `type` The human-readable name of the type of entry this represents, + or the alphanumeric key if unknown. +- `typeKey` The alphanumeric key for the type of entry this header + represents. +- `linkpath` The target of Link and SymbolicLink entries. +- `uname` Human-readable user name of the file owner +- `gname` Human-readable group name of the file owner +- `devmaj` The major portion of the device number. Always `0` for + files, directories, and links. +- `devmin` The minor portion of the device number. Always `0` for + files, directories, and links. +- `atime` File access time. +- `ctime` File change time. + +#### constructor(data, [offset=0]) + +`data` is optional. It is either a Buffer that should be interpreted +as a tar Header starting at the specified offset and continuing for +512 bytes, or a data object of keys and values to set on the header +object, and eventually encode as a tar Header. + +#### decode(block, offset) + +Decode the provided buffer starting at the specified offset. + +Buffer length must be greater than 512 bytes. + +#### set(data) + +Set the fields in the data object. + +#### encode(buffer, offset) + +Encode the header fields into the buffer at the specified offset. + +Returns `this.needPax` to indicate whether a Pax Extended Header is +required to properly encode the specified data. + +### class tar.Pax + +An object representing a set of key-value pairs in an Pax extended +header entry. + +It has the following fields. Where the same name is used, they have +the same semantics as the tar.Header field of the same name. + +- `global` True if this represents a global extended header, or false + if it is for a single entry. +- `atime` +- `charset` +- `comment` +- `ctime` +- `gid` +- `gname` +- `linkpath` +- `mtime` +- `path` +- `size` +- `uid` +- `uname` +- `dev` +- `ino` +- `nlink` + +#### constructor(object, global) + +Set the fields set in the object. `global` is a boolean that defaults +to false. + +#### encode() + +Return a Buffer containing the header and body for the Pax extended +header entry, or `null` if there is nothing to encode. + +#### encodeBody() + +Return a string representing the body of the pax extended header +entry. + +#### encodeField(fieldName) + +Return a string representing the key/value encoding for the specified +fieldName, or `''` if the field is unset. + +### tar.Pax.parse(string, extended, global) + +Return a new Pax object created by parsing the contents of the string +provided. + +If the `extended` object is set, then also add the fields from that +object. (This is necessary because multiple metadata entries can +occur in sequence.) + +### tar.types + +A translation table for the `type` field in tar headers. + +#### tar.types.name.get(code) + +Get the human-readable name for a given alphanumeric code. + +#### tar.types.code.get(name) + +Get the alphanumeric code for a given human-readable name. diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/create.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/create.d.ts new file mode 100644 index 0000000..867c5e9 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/create.d.ts @@ -0,0 +1,3 @@ +import { Pack, PackSync } from './pack.js'; +export declare const create: import("./make-command.js").TarCommand; +//# sourceMappingURL=create.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/create.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/create.d.ts.map new file mode 100644 index 0000000..82be947 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/create.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/create.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AA8E1C,eAAO,MAAM,MAAM,wDAUlB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/create.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/create.js new file mode 100644 index 0000000..3190afc --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/create.js @@ -0,0 +1,83 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.create = void 0; +const fs_minipass_1 = require("@isaacs/fs-minipass"); +const node_path_1 = __importDefault(require("node:path")); +const list_js_1 = require("./list.js"); +const make_command_js_1 = require("./make-command.js"); +const pack_js_1 = require("./pack.js"); +const createFileSync = (opt, files) => { + const p = new pack_js_1.PackSync(opt); + const stream = new fs_minipass_1.WriteStreamSync(opt.file, { + mode: opt.mode || 0o666, + }); + p.pipe(stream); + addFilesSync(p, files); +}; +const createFile = (opt, files) => { + const p = new pack_js_1.Pack(opt); + const stream = new fs_minipass_1.WriteStream(opt.file, { + mode: opt.mode || 0o666, + }); + p.pipe(stream); + const promise = new Promise((res, rej) => { + stream.on('error', rej); + stream.on('close', res); + p.on('error', rej); + }); + addFilesAsync(p, files); + return promise; +}; +const addFilesSync = (p, files) => { + files.forEach(file => { + if (file.charAt(0) === '@') { + (0, list_js_1.list)({ + file: node_path_1.default.resolve(p.cwd, file.slice(1)), + sync: true, + noResume: true, + onReadEntry: entry => p.add(entry), + }); + } + else { + p.add(file); + } + }); + p.end(); +}; +const addFilesAsync = async (p, files) => { + for (let i = 0; i < files.length; i++) { + const file = String(files[i]); + if (file.charAt(0) === '@') { + await (0, list_js_1.list)({ + file: node_path_1.default.resolve(String(p.cwd), file.slice(1)), + noResume: true, + onReadEntry: entry => { + p.add(entry); + }, + }); + } + else { + p.add(file); + } + } + p.end(); +}; +const createSync = (opt, files) => { + const p = new pack_js_1.PackSync(opt); + addFilesSync(p, files); + return p; +}; +const createAsync = (opt, files) => { + const p = new pack_js_1.Pack(opt); + addFilesAsync(p, files); + return p; +}; +exports.create = (0, make_command_js_1.makeCommand)(createFileSync, createFile, createSync, createAsync, (_opt, files) => { + if (!files?.length) { + throw new TypeError('no paths specified to add to archive'); + } +}); +//# sourceMappingURL=create.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/create.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/create.js.map new file mode 100644 index 0000000..6325273 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/create.js.map @@ -0,0 +1 @@ +{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/create.ts"],"names":[],"mappings":";;;;;;AAAA,qDAAkE;AAElE,0DAA4B;AAC5B,uCAAgC;AAChC,uDAA+C;AAO/C,uCAA0C;AAE1C,MAAM,cAAc,GAAG,CAAC,GAAuB,EAAE,KAAe,EAAE,EAAE;IAClE,MAAM,CAAC,GAAG,IAAI,kBAAQ,CAAC,GAAG,CAAC,CAAA;IAC3B,MAAM,MAAM,GAAG,IAAI,6BAAe,CAAC,GAAG,CAAC,IAAI,EAAE;QAC3C,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,KAAK;KACxB,CAAC,CAAA;IACF,CAAC,CAAC,IAAI,CAAC,MAAsC,CAAC,CAAA;IAC9C,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AACxB,CAAC,CAAA;AAED,MAAM,UAAU,GAAG,CAAC,GAAmB,EAAE,KAAe,EAAE,EAAE;IAC1D,MAAM,CAAC,GAAG,IAAI,cAAI,CAAC,GAAG,CAAC,CAAA;IACvB,MAAM,MAAM,GAAG,IAAI,yBAAW,CAAC,GAAG,CAAC,IAAI,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nB,MAAM,IAAI,SAAS,CAAC,sCAAsC,CAAC,CAAA;IAC7D,CAAC;AACH,CAAC,CACF,CAAA","sourcesContent":["import { WriteStream, WriteStreamSync } from '@isaacs/fs-minipass'\nimport { Minipass } from 'minipass'\nimport path from 'node:path'\nimport { list } from './list.js'\nimport { makeCommand } from './make-command.js'\nimport {\n TarOptions,\n TarOptionsFile,\n TarOptionsSync,\n TarOptionsSyncFile,\n} from './options.js'\nimport { Pack, PackSync } from './pack.js'\n\nconst createFileSync = (opt: TarOptionsSyncFile, files: string[]) => {\n const p = new PackSync(opt)\n const stream = new WriteStreamSync(opt.file, {\n mode: opt.mode || 0o666,\n })\n p.pipe(stream as unknown as Minipass.Writable)\n addFilesSync(p, files)\n}\n\nconst createFile = (opt: TarOptionsFile, files: string[]) => {\n const p = new Pack(opt)\n const stream = new WriteStream(opt.file, {\n mode: opt.mode || 0o666,\n })\n p.pipe(stream as unknown as Minipass.Writable)\n\n const promise = new Promise((res, rej) => {\n stream.on('error', rej)\n stream.on('close', res)\n p.on('error', rej)\n })\n\n addFilesAsync(p, files)\n\n return promise\n}\n\nconst addFilesSync = (p: PackSync, files: string[]) => {\n files.forEach(file => {\n if (file.charAt(0) === '@') {\n list({\n file: path.resolve(p.cwd, file.slice(1)),\n sync: true,\n noResume: true,\n onReadEntry: entry => p.add(entry),\n })\n } else {\n p.add(file)\n }\n })\n p.end()\n}\n\nconst addFilesAsync = async (\n p: Pack,\n files: string[],\n): Promise => {\n for (let i = 0; i < files.length; i++) {\n const file = String(files[i])\n if (file.charAt(0) === '@') {\n await list({\n file: path.resolve(String(p.cwd), file.slice(1)),\n noResume: true,\n onReadEntry: entry => {\n p.add(entry)\n },\n })\n } else {\n p.add(file)\n }\n }\n p.end()\n}\n\nconst createSync = (opt: TarOptionsSync, files: string[]) => {\n const p = new PackSync(opt)\n addFilesSync(p, files)\n return p\n}\n\nconst createAsync = (opt: TarOptions, files: string[]) => {\n const p = new Pack(opt)\n addFilesAsync(p, files)\n return p\n}\n\nexport const create = makeCommand(\n createFileSync,\n createFile,\n createSync,\n createAsync,\n (_opt, files) => {\n if (!files?.length) {\n throw new TypeError('no paths specified to add to archive')\n }\n },\n)\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/cwd-error.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/cwd-error.d.ts new file mode 100644 index 0000000..16c6460 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/cwd-error.d.ts @@ -0,0 +1,8 @@ +export declare class CwdError extends Error { + path: string; + code: string; + syscall: 'chdir'; + constructor(path: string, code: string); + get name(): string; +} +//# sourceMappingURL=cwd-error.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/cwd-error.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/cwd-error.d.ts.map new file mode 100644 index 0000000..6b9a1a2 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/cwd-error.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"cwd-error.d.ts","sourceRoot":"","sources":["../../src/cwd-error.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAS,SAAQ,KAAK;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAU;gBAEd,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAMtC,IAAI,IAAI,WAEP;CACF"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/cwd-error.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/cwd-error.js new file mode 100644 index 0000000..d703a77 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/cwd-error.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CwdError = void 0; +class CwdError extends Error { + path; + code; + syscall = 'chdir'; + constructor(path, code) { + super(`${code}: Cannot cd into '${path}'`); + this.path = path; + this.code = code; + } + get name() { + return 'CwdError'; + } +} +exports.CwdError = CwdError; +//# sourceMappingURL=cwd-error.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/cwd-error.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/cwd-error.js.map new file mode 100644 index 0000000..d189590 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/cwd-error.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cwd-error.js","sourceRoot":"","sources":["../../src/cwd-error.ts"],"names":[],"mappings":";;;AAAA,MAAa,QAAS,SAAQ,KAAK;IACjC,IAAI,CAAQ;IACZ,IAAI,CAAQ;IACZ,OAAO,GAAY,OAAO,CAAA;IAE1B,YAAY,IAAY,EAAE,IAAY;QACpC,KAAK,CAAC,GAAG,IAAI,qBAAqB,IAAI,GAAG,CAAC,CAAA;QAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,UAAU,CAAA;IACnB,CAAC;CACF;AAdD,4BAcC","sourcesContent":["export class CwdError extends Error {\n path: string\n code: string\n syscall: 'chdir' = 'chdir'\n\n constructor(path: string, code: string) {\n super(`${code}: Cannot cd into '${path}'`)\n this.path = path\n this.code = code\n }\n\n get name() {\n return 'CwdError'\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/extract.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/extract.d.ts new file mode 100644 index 0000000..9cbb18c --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/extract.d.ts @@ -0,0 +1,3 @@ +import { Unpack, UnpackSync } from './unpack.js'; +export declare const extract: import("./make-command.js").TarCommand; +//# sourceMappingURL=extract.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/extract.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/extract.d.ts.map new file mode 100644 index 0000000..31008e1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/extract.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/extract.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AA2ChD,eAAO,MAAM,OAAO,4DAQnB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/extract.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/extract.js new file mode 100644 index 0000000..86deb30 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/extract.js @@ -0,0 +1,88 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.extract = void 0; +// tar -x +const fsm = __importStar(require("@isaacs/fs-minipass")); +const node_fs_1 = __importDefault(require("node:fs")); +const list_js_1 = require("./list.js"); +const make_command_js_1 = require("./make-command.js"); +const unpack_js_1 = require("./unpack.js"); +const extractFileSync = (opt) => { + const u = new unpack_js_1.UnpackSync(opt); + const file = opt.file; + const stat = node_fs_1.default.statSync(file); + // This trades a zero-byte read() syscall for a stat + // However, it will usually result in less memory allocation + const readSize = opt.maxReadSize || 16 * 1024 * 1024; + const stream = new fsm.ReadStreamSync(file, { + readSize: readSize, + size: stat.size, + }); + stream.pipe(u); +}; +const extractFile = (opt, _) => { + const u = new unpack_js_1.Unpack(opt); + const readSize = opt.maxReadSize || 16 * 1024 * 1024; + const file = opt.file; + const p = new Promise((resolve, reject) => { + u.on('error', reject); + u.on('close', resolve); + // This trades a zero-byte read() syscall for a stat + // However, it will usually result in less memory allocation + node_fs_1.default.stat(file, (er, stat) => { + if (er) { + reject(er); + } + else { + const stream = new fsm.ReadStream(file, { + readSize: readSize, + size: stat.size, + }); + stream.on('error', reject); + stream.pipe(u); + } + }); + }); + return p; +}; +exports.extract = (0, make_command_js_1.makeCommand)(extractFileSync, extractFile, opt => new unpack_js_1.UnpackSync(opt), opt => new unpack_js_1.Unpack(opt), (opt, files) => { + if (files?.length) + (0, list_js_1.filesFilter)(opt, files); +}); +//# sourceMappingURL=extract.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/extract.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/extract.js.map new file mode 100644 index 0000000..de6436f --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/extract.js.map @@ -0,0 +1 @@ +{"version":3,"file":"extract.js","sourceRoot":"","sources":["../../src/extract.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA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,CAAC;gBACP,MAAM,CAAC,EAAE,CAAC,CAAA;YACZ,CAAC;iBAAM,CAAC;gBACN,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE;oBACtC,QAAQ,EAAE,QAAQ;oBAClB,IAAI,EAAE,IAAI,CAAC,IAAI;iBAChB,CAAC,CAAA;gBACF,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;gBAC1B,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YAChB,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IACF,OAAO,CAAC,CAAA;AACV,CAAC,CAAA;AAEY,QAAA,OAAO,GAAG,IAAA,6BAAW,EAChC,eAAe,EACf,WAAW,EACX,GAAG,CAAC,EAAE,CAAC,IAAI,sBAAU,CAAC,GAAG,CAAC,EAC1B,GAAG,CAAC,EAAE,CAAC,IAAI,kBAAM,CAAC,GAAG,CAAC,EACtB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;IACb,IAAI,KAAK,EAAE,MAAM;QAAE,IAAA,qBAAW,EAAC,GAAG,EAAE,KAAK,CAAC,CAAA;AAC5C,CAAC,CACF,CAAA","sourcesContent":["// tar -x\nimport * as fsm from '@isaacs/fs-minipass'\nimport fs from 'node:fs'\nimport { filesFilter } from './list.js'\nimport { makeCommand } from './make-command.js'\nimport { TarOptionsFile, TarOptionsSyncFile } from './options.js'\nimport { Unpack, UnpackSync } from './unpack.js'\n\nconst extractFileSync = (opt: TarOptionsSyncFile) => {\n const u = new UnpackSync(opt)\n const file = opt.file\n const stat = fs.statSync(file)\n // This trades a zero-byte read() syscall for a stat\n // However, it will usually result in less memory allocation\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n const stream = new fsm.ReadStreamSync(file, {\n readSize: readSize,\n size: stat.size,\n })\n stream.pipe(u)\n}\n\nconst extractFile = (opt: TarOptionsFile, _?: string[]) => {\n const u = new Unpack(opt)\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n\n const file = opt.file\n const p = new Promise((resolve, reject) => {\n u.on('error', reject)\n u.on('close', resolve)\n\n // This trades a zero-byte read() syscall for a stat\n // However, it will usually result in less memory allocation\n fs.stat(file, (er, stat) => {\n if (er) {\n reject(er)\n } else {\n const stream = new fsm.ReadStream(file, {\n readSize: readSize,\n size: stat.size,\n })\n stream.on('error', reject)\n stream.pipe(u)\n }\n })\n })\n return p\n}\n\nexport const extract = makeCommand(\n extractFileSync,\n extractFile,\n opt => new UnpackSync(opt),\n opt => new Unpack(opt),\n (opt, files) => {\n if (files?.length) filesFilter(opt, files)\n },\n)\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/get-write-flag.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/get-write-flag.d.ts new file mode 100644 index 0000000..d35ec71 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/get-write-flag.d.ts @@ -0,0 +1,2 @@ +export declare const getWriteFlag: (() => string) | ((size: number) => number | "w"); +//# sourceMappingURL=get-write-flag.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/get-write-flag.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/get-write-flag.d.ts.map new file mode 100644 index 0000000..79af1e1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/get-write-flag.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"get-write-flag.d.ts","sourceRoot":"","sources":["../../src/get-write-flag.ts"],"names":[],"mappings":"AAwBA,eAAO,MAAM,YAAY,2BAGd,MAAM,kBAAwC,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/get-write-flag.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/get-write-flag.js new file mode 100644 index 0000000..94add8f --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/get-write-flag.js @@ -0,0 +1,29 @@ +"use strict"; +// Get the appropriate flag to use for creating files +// We use fmap on Windows platforms for files less than +// 512kb. This is a fairly low limit, but avoids making +// things slower in some cases. Since most of what this +// library is used for is extracting tarballs of many +// relatively small files in npm packages and the like, +// it can be a big boost on Windows platforms. +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getWriteFlag = void 0; +const fs_1 = __importDefault(require("fs")); +const platform = process.env.__FAKE_PLATFORM__ || process.platform; +const isWindows = platform === 'win32'; +/* c8 ignore start */ +const { O_CREAT, O_TRUNC, O_WRONLY } = fs_1.default.constants; +const UV_FS_O_FILEMAP = Number(process.env.__FAKE_FS_O_FILENAME__) || + fs_1.default.constants.UV_FS_O_FILEMAP || + 0; +/* c8 ignore stop */ +const fMapEnabled = isWindows && !!UV_FS_O_FILEMAP; +const fMapLimit = 512 * 1024; +const fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY; +exports.getWriteFlag = !fMapEnabled ? + () => 'w' + : (size) => (size < fMapLimit ? fMapFlag : 'w'); +//# sourceMappingURL=get-write-flag.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/get-write-flag.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/get-write-flag.js.map new file mode 100644 index 0000000..91e47a0 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/get-write-flag.js.map @@ -0,0 +1 @@ +{"version":3,"file":"get-write-flag.js","sourceRoot":"","sources":["../../src/get-write-flag.ts"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,uDAAuD;AACvD,wDAAwD;AACxD,wDAAwD;AACxD,qDAAqD;AACrD,uDAAuD;AACvD,8CAA8C;;;;;;AAE9C,4CAAmB;AAEnB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,OAAO,CAAC,QAAQ,CAAA;AAClE,MAAM,SAAS,GAAG,QAAQ,KAAK,OAAO,CAAA;AAEtC,qBAAqB;AACrB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,YAAE,CAAC,SAAS,CAAA;AACnD,MAAM,eAAe,GACnB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;IAC1C,YAAE,CAAC,SAAS,CAAC,eAAe;IAC5B,CAAC,CAAA;AACH,oBAAoB;AAEpB,MAAM,WAAW,GAAG,SAAS,IAAI,CAAC,CAAC,eAAe,CAAA;AAClD,MAAM,SAAS,GAAG,GAAG,GAAG,IAAI,CAAA;AAC5B,MAAM,QAAQ,GAAG,eAAe,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAA;AAClD,QAAA,YAAY,GACvB,CAAC,WAAW,CAAC,CAAC;IACZ,GAAG,EAAE,CAAC,GAAG;IACX,CAAC,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA","sourcesContent":["// Get the appropriate flag to use for creating files\n// We use fmap on Windows platforms for files less than\n// 512kb. This is a fairly low limit, but avoids making\n// things slower in some cases. Since most of what this\n// library is used for is extracting tarballs of many\n// relatively small files in npm packages and the like,\n// it can be a big boost on Windows platforms.\n\nimport fs from 'fs'\n\nconst platform = process.env.__FAKE_PLATFORM__ || process.platform\nconst isWindows = platform === 'win32'\n\n/* c8 ignore start */\nconst { O_CREAT, O_TRUNC, O_WRONLY } = fs.constants\nconst UV_FS_O_FILEMAP =\n Number(process.env.__FAKE_FS_O_FILENAME__) ||\n fs.constants.UV_FS_O_FILEMAP ||\n 0\n/* c8 ignore stop */\n\nconst fMapEnabled = isWindows && !!UV_FS_O_FILEMAP\nconst fMapLimit = 512 * 1024\nconst fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY\nexport const getWriteFlag =\n !fMapEnabled ?\n () => 'w'\n : (size: number) => (size < fMapLimit ? fMapFlag : 'w')\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/header.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/header.d.ts new file mode 100644 index 0000000..58f1b43 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/header.d.ts @@ -0,0 +1,53 @@ +import type { EntryTypeCode, EntryTypeName } from './types.js'; +export type HeaderData = { + path?: string; + mode?: number; + uid?: number; + gid?: number; + size?: number; + cksum?: number; + type?: EntryTypeName | 'Unsupported'; + linkpath?: string; + uname?: string; + gname?: string; + devmaj?: number; + devmin?: number; + atime?: Date; + ctime?: Date; + mtime?: Date; + charset?: string; + comment?: string; + dev?: number; + ino?: number; + nlink?: number; +}; +export declare class Header implements HeaderData { + #private; + cksumValid: boolean; + needPax: boolean; + nullBlock: boolean; + block?: Buffer; + path?: string; + mode?: number; + uid?: number; + gid?: number; + size?: number; + cksum?: number; + linkpath?: string; + uname?: string; + gname?: string; + devmaj: number; + devmin: number; + atime?: Date; + ctime?: Date; + mtime?: Date; + charset?: string; + comment?: string; + constructor(data?: Buffer | HeaderData, off?: number, ex?: HeaderData, gex?: HeaderData); + decode(buf: Buffer, off: number, ex?: HeaderData, gex?: HeaderData): void; + encode(buf?: Buffer, off?: number): boolean; + get type(): EntryTypeName; + get typeKey(): EntryTypeCode | 'Unsupported'; + set type(type: EntryTypeCode | EntryTypeName | 'Unsupported'); +} +//# sourceMappingURL=header.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/header.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/header.d.ts.map new file mode 100644 index 0000000..279dccf --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/header.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/header.ts"],"names":[],"mappings":"AAOA,OAAO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AAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAI;IAClB,MAAM,EAAE,MAAM,CAAI;IAClB,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,KAAK,CAAC,EAAE,IAAI,CAAA;IAEZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;gBAGd,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,EAC1B,GAAG,GAAE,MAAU,EACf,EAAE,CAAC,EAAE,UAAU,EACf,GAAG,CAAC,EAAE,UAAU;IASlB,MAAM,CACJ,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,EAAE,CAAC,EAAE,UAAU,EACf,GAAG,CAAC,EAAE,UAAU;IA+GlB,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,GAAE,MAAU;IAwEpC,IAAI,IAAI,IAAI,aAAa,CAKxB;IAED,IAAI,OAAO,IAAI,aAAa,GAAG,aAAa,CAE3C;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,aAAa,GAAG,aAAa,GAAG,aAAa,EAS3D;CACF"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/header.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/header.js new file mode 100644 index 0000000..12558ed --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/header.js @@ -0,0 +1,325 @@ +"use strict"; +// parse a 512-byte header block to a data object, or vice-versa +// encode returns `true` if a pax extended header is needed, because +// the data could not be faithfully encoded in a simple header. +// (Also, check header.needPax to see if it needs a pax header.) +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Header = void 0; +const node_path_1 = require("node:path"); +const large = __importStar(require("./large-numbers.js")); +const types = __importStar(require("./types.js")); +class Header { + cksumValid = false; + needPax = false; + nullBlock = false; + block; + path; + mode; + uid; + gid; + size; + cksum; + #type = 'Unsupported'; + linkpath; + uname; + gname; + devmaj = 0; + devmin = 0; + atime; + ctime; + mtime; + charset; + comment; + constructor(data, off = 0, ex, gex) { + if (Buffer.isBuffer(data)) { + this.decode(data, off || 0, ex, gex); + } + else if (data) { + this.#slurp(data); + } + } + decode(buf, off, ex, gex) { + if (!off) { + off = 0; + } + if (!buf || !(buf.length >= off + 512)) { + throw new Error('need 512 bytes for header'); + } + this.path = ex?.path ?? decString(buf, off, 100); + this.mode = ex?.mode ?? gex?.mode ?? decNumber(buf, off + 100, 8); + this.uid = ex?.uid ?? gex?.uid ?? decNumber(buf, off + 108, 8); + this.gid = ex?.gid ?? gex?.gid ?? decNumber(buf, off + 116, 8); + this.size = ex?.size ?? gex?.size ?? decNumber(buf, off + 124, 12); + this.mtime = + ex?.mtime ?? gex?.mtime ?? decDate(buf, off + 136, 12); + this.cksum = decNumber(buf, off + 148, 12); + // if we have extended or global extended headers, apply them now + // See https://github.com/npm/node-tar/pull/187 + // Apply global before local, so it overrides + if (gex) + this.#slurp(gex, true); + if (ex) + this.#slurp(ex); + // old tar versions marked dirs as a file with a trailing / + const t = decString(buf, off + 156, 1); + if (types.isCode(t)) { + this.#type = t || '0'; + } + if (this.#type === '0' && this.path.slice(-1) === '/') { + this.#type = '5'; + } + // tar implementations sometimes incorrectly put the stat(dir).size + // as the size in the tarball, even though Directory entries are + // not able to have any body at all. In the very rare chance that + // it actually DOES have a body, we weren't going to do anything with + // it anyway, and it'll just be a warning about an invalid header. + if (this.#type === '5') { + this.size = 0; + } + this.linkpath = decString(buf, off + 157, 100); + if (buf.subarray(off + 257, off + 265).toString() === + 'ustar\u000000') { + /* c8 ignore start */ + this.uname = + ex?.uname ?? gex?.uname ?? decString(buf, off + 265, 32); + this.gname = + ex?.gname ?? gex?.gname ?? decString(buf, off + 297, 32); + this.devmaj = + ex?.devmaj ?? gex?.devmaj ?? decNumber(buf, off + 329, 8) ?? 0; + this.devmin = + ex?.devmin ?? gex?.devmin ?? decNumber(buf, off + 337, 8) ?? 0; + /* c8 ignore stop */ + if (buf[off + 475] !== 0) { + // definitely a prefix, definitely >130 chars. + const prefix = decString(buf, off + 345, 155); + this.path = prefix + '/' + this.path; + } + else { + const prefix = decString(buf, off + 345, 130); + if (prefix) { + this.path = prefix + '/' + this.path; + } + /* c8 ignore start */ + this.atime = + ex?.atime ?? gex?.atime ?? decDate(buf, off + 476, 12); + this.ctime = + ex?.ctime ?? gex?.ctime ?? decDate(buf, off + 488, 12); + /* c8 ignore stop */ + } + } + let sum = 8 * 0x20; + for (let i = off; i < off + 148; i++) { + sum += buf[i]; + } + for (let i = off + 156; i < off + 512; i++) { + sum += buf[i]; + } + this.cksumValid = sum === this.cksum; + if (this.cksum === undefined && sum === 8 * 0x20) { + this.nullBlock = true; + } + } + #slurp(ex, gex = false) { + Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => { + // we slurp in everything except for the path attribute in + // a global extended header, because that's weird. Also, any + // null/undefined values are ignored. + return !(v === null || + v === undefined || + (k === 'path' && gex) || + (k === 'linkpath' && gex) || + k === 'global'); + }))); + } + encode(buf, off = 0) { + if (!buf) { + buf = this.block = Buffer.alloc(512); + } + if (this.#type === 'Unsupported') { + this.#type = '0'; + } + if (!(buf.length >= off + 512)) { + throw new Error('need 512 bytes for header'); + } + const prefixSize = this.ctime || this.atime ? 130 : 155; + const split = splitPrefix(this.path || '', prefixSize); + const path = split[0]; + const prefix = split[1]; + this.needPax = !!split[2]; + this.needPax = encString(buf, off, 100, path) || this.needPax; + this.needPax = + encNumber(buf, off + 100, 8, this.mode) || this.needPax; + this.needPax = + encNumber(buf, off + 108, 8, this.uid) || this.needPax; + this.needPax = + encNumber(buf, off + 116, 8, this.gid) || this.needPax; + this.needPax = + encNumber(buf, off + 124, 12, this.size) || this.needPax; + this.needPax = + encDate(buf, off + 136, 12, this.mtime) || this.needPax; + buf[off + 156] = this.#type.charCodeAt(0); + this.needPax = + encString(buf, off + 157, 100, this.linkpath) || this.needPax; + buf.write('ustar\u000000', off + 257, 8); + this.needPax = + encString(buf, off + 265, 32, this.uname) || this.needPax; + this.needPax = + encString(buf, off + 297, 32, this.gname) || this.needPax; + this.needPax = + encNumber(buf, off + 329, 8, this.devmaj) || this.needPax; + this.needPax = + encNumber(buf, off + 337, 8, this.devmin) || this.needPax; + this.needPax = + encString(buf, off + 345, prefixSize, prefix) || this.needPax; + if (buf[off + 475] !== 0) { + this.needPax = + encString(buf, off + 345, 155, prefix) || this.needPax; + } + else { + this.needPax = + encString(buf, off + 345, 130, prefix) || this.needPax; + this.needPax = + encDate(buf, off + 476, 12, this.atime) || this.needPax; + this.needPax = + encDate(buf, off + 488, 12, this.ctime) || this.needPax; + } + let sum = 8 * 0x20; + for (let i = off; i < off + 148; i++) { + sum += buf[i]; + } + for (let i = off + 156; i < off + 512; i++) { + sum += buf[i]; + } + this.cksum = sum; + encNumber(buf, off + 148, 8, this.cksum); + this.cksumValid = true; + return this.needPax; + } + get type() { + return (this.#type === 'Unsupported' ? + this.#type + : types.name.get(this.#type)); + } + get typeKey() { + return this.#type; + } + set type(type) { + const c = String(types.code.get(type)); + if (types.isCode(c) || c === 'Unsupported') { + this.#type = c; + } + else if (types.isCode(type)) { + this.#type = type; + } + else { + throw new TypeError('invalid entry type: ' + type); + } + } +} +exports.Header = Header; +const splitPrefix = (p, prefixSize) => { + const pathSize = 100; + let pp = p; + let prefix = ''; + let ret = undefined; + const root = node_path_1.posix.parse(p).root || '.'; + if (Buffer.byteLength(pp) < pathSize) { + ret = [pp, prefix, false]; + } + else { + // first set prefix to the dir, and path to the base + prefix = node_path_1.posix.dirname(pp); + pp = node_path_1.posix.basename(pp); + do { + if (Buffer.byteLength(pp) <= pathSize && + Buffer.byteLength(prefix) <= prefixSize) { + // both fit! + ret = [pp, prefix, false]; + } + else if (Buffer.byteLength(pp) > pathSize && + Buffer.byteLength(prefix) <= prefixSize) { + // prefix fits in prefix, but path doesn't fit in path + ret = [pp.slice(0, pathSize - 1), prefix, true]; + } + else { + // make path take a bit from prefix + pp = node_path_1.posix.join(node_path_1.posix.basename(prefix), pp); + prefix = node_path_1.posix.dirname(prefix); + } + } while (prefix !== root && ret === undefined); + // at this point, found no resolution, just truncate + if (!ret) { + ret = [p.slice(0, pathSize - 1), '', true]; + } + } + return ret; +}; +const decString = (buf, off, size) => buf + .subarray(off, off + size) + .toString('utf8') + .replace(/\0.*/, ''); +const decDate = (buf, off, size) => numToDate(decNumber(buf, off, size)); +const numToDate = (num) => num === undefined ? undefined : new Date(num * 1000); +const decNumber = (buf, off, size) => Number(buf[off]) & 0x80 ? + large.parse(buf.subarray(off, off + size)) + : decSmallNumber(buf, off, size); +const nanUndef = (value) => (isNaN(value) ? undefined : value); +const decSmallNumber = (buf, off, size) => nanUndef(parseInt(buf + .subarray(off, off + size) + .toString('utf8') + .replace(/\0.*$/, '') + .trim(), 8)); +// the maximum encodable as a null-terminated octal, by field size +const MAXNUM = { + 12: 0o77777777777, + 8: 0o7777777, +}; +const encNumber = (buf, off, size, num) => num === undefined ? false + : num > MAXNUM[size] || num < 0 ? + (large.encode(num, buf.subarray(off, off + size)), true) + : (encSmallNumber(buf, off, size, num), false); +const encSmallNumber = (buf, off, size, num) => buf.write(octalString(num, size), off, size, 'ascii'); +const octalString = (num, size) => padOctal(Math.floor(num).toString(8), size); +const padOctal = (str, size) => (str.length === size - 1 ? + str + : new Array(size - str.length - 1).join('0') + str + ' ') + '\0'; +const encDate = (buf, off, size, date) => date === undefined ? false : (encNumber(buf, off, size, date.getTime() / 1000)); +// enough to fill the longest string we've got +const NULLS = new Array(156).join('\0'); +// pad with nulls, return true if it's longer or non-ascii +const encString = (buf, off, size, str) => str === undefined ? false : ((buf.write(str + NULLS, off, size, 'utf8'), + str.length !== Buffer.byteLength(str) || str.length > size)); +//# sourceMappingURL=header.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/header.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/header.js.map new file mode 100644 index 0000000..ed2f698 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/header.js.map @@ -0,0 +1 @@ +{"version":3,"file":"header.js","sourceRoot":"","sources":["../../src/header.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,oEAAoE;AACpE,+DAA+D;AAC/D,gEAAgE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhE,yCAA+C;AAC/C,0DAA2C;AAE3C,kDAAmC;AA4BnC,MAAa,MAAM;IACjB,UAAU,GAAY,KAAK,CAAA;IAC3B,OAAO,GAAY,KAAK,CAAA;IACxB,SAAS,GAAY,KAAK,CAAA;IAE1B,KAAK,CAAS;IACd,IAAI,CAAS;IACb,IAAI,CAAS;IACb,GAAG,CAAS;IACZ,GAAG,CAAS;IACZ,IAAI,CAAS;IACb,KAAK,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CAC1B,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC;IAC1C,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAC5D,CAAA","sourcesContent":["// parse a 512-byte header block to a data object, or vice-versa\n// encode returns `true` if a pax extended header is needed, because\n// the data could not be faithfully encoded in a simple header.\n// (Also, check header.needPax to see if it needs a pax header.)\n\nimport { posix as pathModule } from 'node:path'\nimport * as large from './large-numbers.js'\nimport type { EntryTypeCode, EntryTypeName } from './types.js'\nimport * as types from './types.js'\n\nexport type HeaderData = {\n path?: string\n mode?: number\n uid?: number\n gid?: number\n size?: number\n cksum?: number\n type?: EntryTypeName | 'Unsupported'\n linkpath?: string\n uname?: string\n gname?: string\n devmaj?: number\n devmin?: number\n atime?: Date\n ctime?: Date\n mtime?: Date\n\n // fields that are common in extended PAX headers, but not in the\n // \"standard\" tar header block\n charset?: string\n comment?: string\n dev?: number\n ino?: number\n nlink?: number\n}\n\nexport class Header implements HeaderData {\n cksumValid: boolean = false\n needPax: boolean = false\n nullBlock: boolean = false\n\n block?: Buffer\n path?: string\n mode?: number\n uid?: number\n gid?: number\n size?: number\n cksum?: number\n #type: EntryTypeCode | 'Unsupported' = 'Unsupported'\n linkpath?: string\n uname?: string\n gname?: string\n devmaj: number = 0\n devmin: number = 0\n atime?: Date\n ctime?: Date\n mtime?: Date\n\n charset?: string\n comment?: string\n\n constructor(\n data?: Buffer | HeaderData,\n off: number = 0,\n ex?: HeaderData,\n gex?: HeaderData,\n ) {\n if (Buffer.isBuffer(data)) {\n this.decode(data, off || 0, ex, gex)\n } else if (data) {\n this.#slurp(data)\n }\n }\n\n decode(\n buf: Buffer,\n off: number,\n ex?: HeaderData,\n gex?: HeaderData,\n ) {\n if (!off) {\n off = 0\n }\n\n if (!buf || !(buf.length >= off + 512)) {\n throw new Error('need 512 bytes for header')\n }\n\n this.path = ex?.path ?? decString(buf, off, 100)\n this.mode = ex?.mode ?? gex?.mode ?? decNumber(buf, off + 100, 8)\n this.uid = ex?.uid ?? gex?.uid ?? decNumber(buf, off + 108, 8)\n this.gid = ex?.gid ?? gex?.gid ?? decNumber(buf, off + 116, 8)\n this.size = ex?.size ?? gex?.size ?? decNumber(buf, off + 124, 12)\n this.mtime =\n ex?.mtime ?? gex?.mtime ?? decDate(buf, off + 136, 12)\n this.cksum = decNumber(buf, off + 148, 12)\n\n // if we have extended or global extended headers, apply them now\n // See https://github.com/npm/node-tar/pull/187\n // Apply global before local, so it overrides\n if (gex) this.#slurp(gex, true)\n if (ex) this.#slurp(ex)\n\n // old tar versions marked dirs as a file with a trailing /\n const t = decString(buf, off + 156, 1)\n if (types.isCode(t)) {\n this.#type = t || '0'\n }\n if (this.#type === '0' && this.path.slice(-1) === '/') {\n this.#type = '5'\n }\n\n // tar implementations sometimes incorrectly put the stat(dir).size\n // as the size in the tarball, even though Directory entries are\n // not able to have any body at all. In the very rare chance that\n // it actually DOES have a body, we weren't going to do anything with\n // it anyway, and it'll just be a warning about an invalid header.\n if (this.#type === '5') {\n this.size = 0\n }\n\n this.linkpath = decString(buf, off + 157, 100)\n if (\n buf.subarray(off + 257, off + 265).toString() ===\n 'ustar\\u000000'\n ) {\n /* c8 ignore start */\n this.uname =\n ex?.uname ?? gex?.uname ?? decString(buf, off + 265, 32)\n this.gname =\n ex?.gname ?? gex?.gname ?? decString(buf, off + 297, 32)\n this.devmaj =\n ex?.devmaj ?? gex?.devmaj ?? decNumber(buf, off + 329, 8) ?? 0\n this.devmin =\n ex?.devmin ?? gex?.devmin ?? decNumber(buf, off + 337, 8) ?? 0\n /* c8 ignore stop */\n if (buf[off + 475] !== 0) {\n // definitely a prefix, definitely >130 chars.\n const prefix = decString(buf, off + 345, 155)\n this.path = prefix + '/' + this.path\n } else {\n const prefix = decString(buf, off + 345, 130)\n if (prefix) {\n this.path = prefix + '/' + this.path\n }\n /* c8 ignore start */\n this.atime =\n ex?.atime ?? gex?.atime ?? decDate(buf, off + 476, 12)\n this.ctime =\n ex?.ctime ?? gex?.ctime ?? decDate(buf, off + 488, 12)\n /* c8 ignore stop */\n }\n }\n\n let sum = 8 * 0x20\n for (let i = off; i < off + 148; i++) {\n sum += buf[i] as number\n }\n\n for (let i = off + 156; i < off + 512; i++) {\n sum += buf[i] as number\n }\n\n this.cksumValid = sum === this.cksum\n if (this.cksum === undefined && sum === 8 * 0x20) {\n this.nullBlock = true\n }\n }\n\n #slurp(ex: HeaderData, gex: boolean = false) {\n Object.assign(\n this,\n Object.fromEntries(\n Object.entries(ex).filter(([k, v]) => {\n // we slurp in everything except for the path attribute in\n // a global extended header, because that's weird. Also, any\n // null/undefined values are ignored.\n return !(\n v === null ||\n v === undefined ||\n (k === 'path' && gex) ||\n (k === 'linkpath' && gex) ||\n k === 'global'\n )\n }),\n ),\n )\n }\n\n encode(buf?: Buffer, off: number = 0) {\n if (!buf) {\n buf = this.block = Buffer.alloc(512)\n }\n\n if (this.#type === 'Unsupported') {\n this.#type = '0'\n }\n\n if (!(buf.length >= off + 512)) {\n throw new Error('need 512 bytes for header')\n }\n\n const prefixSize = this.ctime || this.atime ? 130 : 155\n const split = splitPrefix(this.path || '', prefixSize)\n const path = split[0]\n const prefix = split[1]\n this.needPax = !!split[2]\n\n this.needPax = encString(buf, off, 100, path) || this.needPax\n this.needPax =\n encNumber(buf, off + 100, 8, this.mode) || this.needPax\n this.needPax =\n encNumber(buf, off + 108, 8, this.uid) || this.needPax\n this.needPax =\n encNumber(buf, off + 116, 8, this.gid) || this.needPax\n this.needPax =\n encNumber(buf, off + 124, 12, this.size) || this.needPax\n this.needPax =\n encDate(buf, off + 136, 12, this.mtime) || this.needPax\n buf[off + 156] = this.#type.charCodeAt(0)\n this.needPax =\n encString(buf, off + 157, 100, this.linkpath) || this.needPax\n buf.write('ustar\\u000000', off + 257, 8)\n this.needPax =\n encString(buf, off + 265, 32, this.uname) || this.needPax\n this.needPax =\n encString(buf, off + 297, 32, this.gname) || this.needPax\n this.needPax =\n encNumber(buf, off + 329, 8, this.devmaj) || this.needPax\n this.needPax =\n encNumber(buf, off + 337, 8, this.devmin) || this.needPax\n this.needPax =\n encString(buf, off + 345, prefixSize, prefix) || this.needPax\n if (buf[off + 475] !== 0) {\n this.needPax =\n encString(buf, off + 345, 155, prefix) || this.needPax\n } else {\n this.needPax =\n encString(buf, off + 345, 130, prefix) || this.needPax\n this.needPax =\n encDate(buf, off + 476, 12, this.atime) || this.needPax\n this.needPax =\n encDate(buf, off + 488, 12, this.ctime) || this.needPax\n }\n\n let sum = 8 * 0x20\n for (let i = off; i < off + 148; i++) {\n sum += buf[i] as number\n }\n\n for (let i = off + 156; i < off + 512; i++) {\n sum += buf[i] as number\n }\n\n this.cksum = sum\n encNumber(buf, off + 148, 8, this.cksum)\n this.cksumValid = true\n\n return this.needPax\n }\n\n get type(): EntryTypeName {\n return (\n this.#type === 'Unsupported' ?\n this.#type\n : types.name.get(this.#type)) as EntryTypeName\n }\n\n get typeKey(): EntryTypeCode | 'Unsupported' {\n return this.#type\n }\n\n set type(type: EntryTypeCode | EntryTypeName | 'Unsupported') {\n const c = String(types.code.get(type as EntryTypeName))\n if (types.isCode(c) || c === 'Unsupported') {\n this.#type = c\n } else if (types.isCode(type)) {\n this.#type = type\n } else {\n throw new TypeError('invalid entry type: ' + type)\n }\n }\n}\n\nconst splitPrefix = (\n p: string,\n prefixSize: number,\n): [string, string, boolean] => {\n const pathSize = 100\n let pp = p\n let prefix = ''\n let ret: undefined | [string, string, boolean] = undefined\n const root = pathModule.parse(p).root || '.'\n\n if (Buffer.byteLength(pp) < pathSize) {\n ret = [pp, prefix, false]\n } else {\n // first set prefix to the dir, and path to the base\n prefix = pathModule.dirname(pp)\n pp = pathModule.basename(pp)\n\n do {\n if (\n Buffer.byteLength(pp) <= pathSize &&\n Buffer.byteLength(prefix) <= prefixSize\n ) {\n // both fit!\n ret = [pp, prefix, false]\n } else if (\n Buffer.byteLength(pp) > pathSize &&\n Buffer.byteLength(prefix) <= prefixSize\n ) {\n // prefix fits in prefix, but path doesn't fit in path\n ret = [pp.slice(0, pathSize - 1), prefix, true]\n } else {\n // make path take a bit from prefix\n pp = pathModule.join(pathModule.basename(prefix), pp)\n prefix = pathModule.dirname(prefix)\n }\n } while (prefix !== root && ret === undefined)\n\n // at this point, found no resolution, just truncate\n if (!ret) {\n ret = [p.slice(0, pathSize - 1), '', true]\n }\n }\n return ret\n}\n\nconst decString = (buf: Buffer, off: number, size: number) =>\n buf\n .subarray(off, off + size)\n .toString('utf8')\n .replace(/\\0.*/, '')\n\nconst decDate = (buf: Buffer, off: number, size: number) =>\n numToDate(decNumber(buf, off, size))\n\nconst numToDate = (num?: number) =>\n num === undefined ? undefined : new Date(num * 1000)\n\nconst decNumber = (buf: Buffer, off: number, size: number) =>\n Number(buf[off]) & 0x80 ?\n large.parse(buf.subarray(off, off + size))\n : decSmallNumber(buf, off, size)\n\nconst nanUndef = (value: number) => (isNaN(value) ? undefined : value)\n\nconst decSmallNumber = (buf: Buffer, off: number, size: number) =>\n nanUndef(\n parseInt(\n buf\n .subarray(off, off + size)\n .toString('utf8')\n .replace(/\\0.*$/, '')\n .trim(),\n 8,\n ),\n )\n\n// the maximum encodable as a null-terminated octal, by field size\nconst MAXNUM = {\n 12: 0o77777777777,\n 8: 0o7777777,\n}\n\nconst encNumber = (\n buf: Buffer,\n off: number,\n size: 12 | 8,\n num?: number,\n) =>\n num === undefined ? false\n : num > MAXNUM[size] || num < 0 ?\n (large.encode(num, buf.subarray(off, off + size)), true)\n : (encSmallNumber(buf, off, size, num), false)\n\nconst encSmallNumber = (\n buf: Buffer,\n off: number,\n size: number,\n num: number,\n) => buf.write(octalString(num, size), off, size, 'ascii')\n\nconst octalString = (num: number, size: number) =>\n padOctal(Math.floor(num).toString(8), size)\n\nconst padOctal = (str: string, size: number) =>\n (str.length === size - 1 ?\n str\n : new Array(size - str.length - 1).join('0') + str + ' ') + '\\0'\n\nconst encDate = (\n buf: Buffer,\n off: number,\n size: 8 | 12,\n date?: Date,\n) =>\n date === undefined ? false : (\n encNumber(buf, off, size, date.getTime() / 1000)\n )\n\n// enough to fill the longest string we've got\nconst NULLS = new Array(156).join('\\0')\n// pad with nulls, return true if it's longer or non-ascii\nconst encString = (\n buf: Buffer,\n off: number,\n size: number,\n str?: string,\n) =>\n str === undefined ? false : (\n (buf.write(str + NULLS, off, size, 'utf8'),\n str.length !== Buffer.byteLength(str) || str.length > size)\n )\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/index.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/index.d.ts new file mode 100644 index 0000000..a582123 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/index.d.ts @@ -0,0 +1,20 @@ +export { type TarOptionsWithAliasesAsync, type TarOptionsWithAliasesAsyncFile, type TarOptionsWithAliasesAsyncNoFile, type TarOptionsWithAliasesSyncNoFile, type TarOptionsWithAliases, type TarOptionsWithAliasesFile, type TarOptionsWithAliasesSync, type TarOptionsWithAliasesSyncFile, } from './options.js'; +export * from './create.js'; +export { create as c } from './create.js'; +export * from './extract.js'; +export { extract as x } from './extract.js'; +export * from './header.js'; +export * from './list.js'; +export { list as t } from './list.js'; +export * from './pack.js'; +export * from './parse.js'; +export * from './pax.js'; +export * from './read-entry.js'; +export * from './replace.js'; +export { replace as r } from './replace.js'; +export * as types from './types.js'; +export * from './unpack.js'; +export * from './update.js'; +export { update as u } from './update.js'; +export * from './write-entry.js'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/index.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000..71d3bed --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,8BAA8B,EACnC,KAAK,gCAAgC,EACrC,KAAK,+BAA+B,EACpC,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,GACnC,MAAM,cAAc,CAAA;AAErB,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,aAAa,CAAA;AACzC,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,cAAc,CAAA;AAC3C,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,WAAW,CAAA;AAErC,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,aAAa,CAAA;AACzC,cAAc,kBAAkB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/index.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/index.js new file mode 100644 index 0000000..bd975c7 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/index.js @@ -0,0 +1,64 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.u = exports.types = exports.r = exports.t = exports.x = exports.c = void 0; +__exportStar(require("./create.js"), exports); +var create_js_1 = require("./create.js"); +Object.defineProperty(exports, "c", { enumerable: true, get: function () { return create_js_1.create; } }); +__exportStar(require("./extract.js"), exports); +var extract_js_1 = require("./extract.js"); +Object.defineProperty(exports, "x", { enumerable: true, get: function () { return extract_js_1.extract; } }); +__exportStar(require("./header.js"), exports); +__exportStar(require("./list.js"), exports); +var list_js_1 = require("./list.js"); +Object.defineProperty(exports, "t", { enumerable: true, get: function () { return list_js_1.list; } }); +// classes +__exportStar(require("./pack.js"), exports); +__exportStar(require("./parse.js"), exports); +__exportStar(require("./pax.js"), exports); +__exportStar(require("./read-entry.js"), exports); +__exportStar(require("./replace.js"), exports); +var replace_js_1 = require("./replace.js"); +Object.defineProperty(exports, "r", { enumerable: true, get: function () { return replace_js_1.replace; } }); +exports.types = __importStar(require("./types.js")); +__exportStar(require("./unpack.js"), exports); +__exportStar(require("./update.js"), exports); +var update_js_1 = require("./update.js"); +Object.defineProperty(exports, "u", { enumerable: true, get: function () { return update_js_1.update; } }); +__exportStar(require("./write-entry.js"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/index.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/index.js.map new file mode 100644 index 0000000..243dcd3 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,8CAA2B;AAC3B,yCAAyC;AAAhC,8FAAA,MAAM,OAAK;AACpB,+CAA4B;AAC5B,2CAA2C;AAAlC,+FAAA,OAAO,OAAK;AACrB,8CAA2B;AAC3B,4CAAyB;AACzB,qCAAqC;AAA5B,4FAAA,IAAI,OAAK;AAClB,UAAU;AACV,4CAAyB;AACzB,6CAA0B;AAC1B,2CAAwB;AACxB,kDAA+B;AAC/B,+CAA4B;AAC5B,2CAA2C;AAAlC,+FAAA,OAAO,OAAK;AACrB,oDAAmC;AACnC,8CAA2B;AAC3B,8CAA2B;AAC3B,yCAAyC;AAAhC,8FAAA,MAAM,OAAK;AACpB,mDAAgC","sourcesContent":["export {\n type TarOptionsWithAliasesAsync,\n type TarOptionsWithAliasesAsyncFile,\n type TarOptionsWithAliasesAsyncNoFile,\n type TarOptionsWithAliasesSyncNoFile,\n type TarOptionsWithAliases,\n type TarOptionsWithAliasesFile,\n type TarOptionsWithAliasesSync,\n type TarOptionsWithAliasesSyncFile,\n} from './options.js'\n\nexport * from './create.js'\nexport { create as c } from './create.js'\nexport * from './extract.js'\nexport { extract as x } from './extract.js'\nexport * from './header.js'\nexport * from './list.js'\nexport { list as t } from './list.js'\n// classes\nexport * from './pack.js'\nexport * from './parse.js'\nexport * from './pax.js'\nexport * from './read-entry.js'\nexport * from './replace.js'\nexport { replace as r } from './replace.js'\nexport * as types from './types.js'\nexport * from './unpack.js'\nexport * from './update.js'\nexport { update as u } from './update.js'\nexport * from './write-entry.js'\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/index.min.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/index.min.js new file mode 100644 index 0000000..4ae8fa0 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/index.min.js @@ -0,0 +1,4 @@ +"use strict";var d=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var We=d(C=>{"use strict";var yo=C&&C.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(C,"__esModule",{value:!0});C.Minipass=C.isWritable=C.isReadable=C.isStream=void 0;var Br=typeof process=="object"&&process?process:{stdout:null,stderr:null},es=require("node:events"),xr=yo(require("node:stream")),Eo=require("node:string_decoder"),bo=s=>!!s&&typeof s=="object"&&(s instanceof Wt||s instanceof xr.default||(0,C.isReadable)(s)||(0,C.isWritable)(s));C.isStream=bo;var So=s=>!!s&&typeof s=="object"&&s instanceof es.EventEmitter&&typeof s.pipe=="function"&&s.pipe!==xr.default.Writable.prototype.pipe;C.isReadable=So;var go=s=>!!s&&typeof s=="object"&&s instanceof es.EventEmitter&&typeof s.write=="function"&&typeof s.end=="function";C.isWritable=go;var le=Symbol("EOF"),ue=Symbol("maybeEmitEnd"),_e=Symbol("emittedEnd"),zt=Symbol("emittingEnd"),ft=Symbol("emittedError"),kt=Symbol("closed"),zr=Symbol("read"),jt=Symbol("flush"),kr=Symbol("flushChunk"),K=Symbol("encoding"),Ue=Symbol("decoder"),R=Symbol("flowing"),dt=Symbol("paused"),qe=Symbol("resume"),O=Symbol("buffer"),I=Symbol("pipes"),v=Symbol("bufferLength"),Ki=Symbol("bufferPush"),xt=Symbol("bufferShift"),N=Symbol("objectMode"),y=Symbol("destroyed"),Vi=Symbol("error"),$i=Symbol("emitData"),jr=Symbol("emitEnd"),Xi=Symbol("emitEnd2"),J=Symbol("async"),Qi=Symbol("abort"),Ut=Symbol("aborted"),mt=Symbol("signal"),Pe=Symbol("dataListeners"),k=Symbol("discarded"),pt=s=>Promise.resolve().then(s),Ro=s=>s(),Oo=s=>s==="end"||s==="finish"||s==="prefinish",vo=s=>s instanceof ArrayBuffer||!!s&&typeof s=="object"&&s.constructor&&s.constructor.name==="ArrayBuffer"&&s.byteLength>=0,To=s=>!Buffer.isBuffer(s)&&ArrayBuffer.isView(s),qt=class{src;dest;opts;ondrain;constructor(e,t,i){this.src=e,this.dest=t,this.opts=i,this.ondrain=()=>e[qe](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Ji=class extends qt{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,i){super(e,t,i),this.proxyErrors=r=>t.emit("error",r),e.on("error",this.proxyErrors)}},Do=s=>!!s.objectMode,Po=s=>!s.objectMode&&!!s.encoding&&s.encoding!=="buffer",Wt=class extends es.EventEmitter{[R]=!1;[dt]=!1;[I]=[];[O]=[];[N];[K];[J];[Ue];[le]=!1;[_e]=!1;[zt]=!1;[kt]=!1;[ft]=null;[v]=0;[y]=!1;[mt];[Ut]=!1;[Pe]=0;[k]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Do(t)?(this[N]=!0,this[K]=null):Po(t)?(this[K]=t.encoding,this[N]=!1):(this[N]=!1,this[K]=null),this[J]=!!t.async,this[Ue]=this[K]?new Eo.StringDecoder(this[K]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[O]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[I]});let{signal:i}=t;i&&(this[mt]=i,i.aborted?this[Qi]():i.addEventListener("abort",()=>this[Qi]()))}get bufferLength(){return this[v]}get encoding(){return this[K]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[N]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[J]}set async(e){this[J]=this[J]||!!e}[Qi](){this[Ut]=!0,this.emit("abort",this[mt]?.reason),this.destroy(this[mt]?.reason)}get aborted(){return this[Ut]}set aborted(e){}write(e,t,i){if(this[Ut])return!1;if(this[le])throw new Error("write after end");if(this[y])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(i=t,t="utf8"),t||(t="utf8");let r=this[J]?pt:Ro;if(!this[N]&&!Buffer.isBuffer(e)){if(To(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(vo(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[N]?(this[R]&&this[v]!==0&&this[jt](!0),this[R]?this.emit("data",e):this[Ki](e),this[v]!==0&&this.emit("readable"),i&&r(i),this[R]):e.length?(typeof e=="string"&&!(t===this[K]&&!this[Ue]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[K]&&(e=this[Ue].write(e)),this[R]&&this[v]!==0&&this[jt](!0),this[R]?this.emit("data",e):this[Ki](e),this[v]!==0&&this.emit("readable"),i&&r(i),this[R]):(this[v]!==0&&this.emit("readable"),i&&r(i),this[R])}read(e){if(this[y])return null;if(this[k]=!1,this[v]===0||e===0||e&&e>this[v])return this[ue](),null;this[N]&&(e=null),this[O].length>1&&!this[N]&&(this[O]=[this[K]?this[O].join(""):Buffer.concat(this[O],this[v])]);let t=this[zr](e||null,this[O][0]);return this[ue](),t}[zr](e,t){if(this[N])this[xt]();else{let i=t;e===i.length||e===null?this[xt]():typeof i=="string"?(this[O][0]=i.slice(e),t=i.slice(0,e),this[v]-=e):(this[O][0]=i.subarray(e),t=i.subarray(0,e),this[v]-=e)}return this.emit("data",t),!this[O].length&&!this[le]&&this.emit("drain"),t}end(e,t,i){return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t="utf8"),e!==void 0&&this.write(e,t),i&&this.once("end",i),this[le]=!0,this.writable=!1,(this[R]||!this[dt])&&this[ue](),this}[qe](){this[y]||(!this[Pe]&&!this[I].length&&(this[k]=!0),this[dt]=!1,this[R]=!0,this.emit("resume"),this[O].length?this[jt]():this[le]?this[ue]():this.emit("drain"))}resume(){return this[qe]()}pause(){this[R]=!1,this[dt]=!0,this[k]=!1}get destroyed(){return this[y]}get flowing(){return this[R]}get paused(){return this[dt]}[Ki](e){this[N]?this[v]+=1:this[v]+=e.length,this[O].push(e)}[xt](){return this[N]?this[v]-=1:this[v]-=this[O][0].length,this[O].shift()}[jt](e=!1){do;while(this[kr](this[xt]())&&this[O].length);!e&&!this[O].length&&!this[le]&&this.emit("drain")}[kr](e){return this.emit("data",e),this[R]}pipe(e,t){if(this[y])return e;this[k]=!1;let i=this[_e];return t=t||{},e===Br.stdout||e===Br.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,i?t.end&&e.end():(this[I].push(t.proxyErrors?new Ji(this,e,t):new qt(this,e,t)),this[J]?pt(()=>this[qe]()):this[qe]()),e}unpipe(e){let t=this[I].find(i=>i.dest===e);t&&(this[I].length===1?(this[R]&&this[Pe]===0&&(this[R]=!1),this[I]=[]):this[I].splice(this[I].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let i=super.on(e,t);if(e==="data")this[k]=!1,this[Pe]++,!this[I].length&&!this[R]&&this[qe]();else if(e==="readable"&&this[v]!==0)super.emit("readable");else if(Oo(e)&&this[_e])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[ft]){let r=t;this[J]?pt(()=>r.call(this,this[ft])):r.call(this,this[ft])}return i}removeListener(e,t){return this.off(e,t)}off(e,t){let i=super.off(e,t);return e==="data"&&(this[Pe]=this.listeners("data").length,this[Pe]===0&&!this[k]&&!this[I].length&&(this[R]=!1)),i}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Pe]=0,!this[k]&&!this[I].length&&(this[R]=!1)),t}get emittedEnd(){return this[_e]}[ue](){!this[zt]&&!this[_e]&&!this[y]&&this[O].length===0&&this[le]&&(this[zt]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[kt]&&this.emit("close"),this[zt]=!1)}emit(e,...t){let i=t[0];if(e!=="error"&&e!=="close"&&e!==y&&this[y])return!1;if(e==="data")return!this[N]&&!i?!1:this[J]?(pt(()=>this[$i](i)),!0):this[$i](i);if(e==="end")return this[jr]();if(e==="close"){if(this[kt]=!0,!this[_e]&&!this[y])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(e==="error"){this[ft]=i,super.emit(Vi,i);let n=!this[mt]||this.listeners("error").length?super.emit("error",i):!1;return this[ue](),n}else if(e==="resume"){let n=super.emit("resume");return this[ue](),n}else if(e==="finish"||e==="prefinish"){let n=super.emit(e);return this.removeAllListeners(e),n}let r=super.emit(e,...t);return this[ue](),r}[$i](e){for(let i of this[I])i.dest.write(e)===!1&&this.pause();let t=this[k]?!1:super.emit("data",e);return this[ue](),t}[jr](){return this[_e]?!1:(this[_e]=!0,this.readable=!1,this[J]?(pt(()=>this[Xi]()),!0):this[Xi]())}[Xi](){if(this[Ue]){let t=this[Ue].end();if(t){for(let i of this[I])i.dest.write(t);this[k]||super.emit("data",t)}}for(let t of this[I])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[N]||(e.dataLength=0);let t=this.promise();return this.on("data",i=>{e.push(i),this[N]||(e.dataLength+=i.length)}),await t,e}async concat(){if(this[N])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[K]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(y,()=>t(new Error("stream destroyed"))),this.on("error",i=>t(i)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[k]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[le])return t();let n,o,a=c=>{this.off("data",h),this.off("end",l),this.off(y,u),t(),o(c)},h=c=>{this.off("error",a),this.off("end",l),this.off(y,u),this.pause(),n({value:c,done:!!this[le]})},l=()=>{this.off("error",a),this.off("data",h),this.off(y,u),t(),n({done:!0,value:void 0})},u=()=>a(new Error("stream destroyed"));return new Promise((c,E)=>{o=E,n=c,this.once(y,u),this.once("error",a),this.once("end",l),this.once("data",h)})},throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[k]=!1;let e=!1,t=()=>(this.pause(),this.off(Vi,t),this.off(y,t),this.off("end",t),e=!0,{done:!0,value:void 0}),i=()=>{if(e)return t();let r=this.read();return r===null?t():{done:!1,value:r}};return this.once("end",t),this.once(Vi,t),this.once(y,t),{next:i,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[y])return e?this.emit("error",e):this.emit(y),this;this[y]=!0,this[k]=!0,this[O].length=0,this[v]=0;let t=this;return typeof t.close=="function"&&!this[kt]&&t.close(),e?this.emit("error",e):this.emit(y),this}static get isStream(){return C.isStream}};C.Minipass=Wt});var Ke=d(W=>{"use strict";var Ur=W&&W.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(W,"__esModule",{value:!0});W.WriteStreamSync=W.WriteStream=W.ReadStreamSync=W.ReadStream=void 0;var No=Ur(require("events")),B=Ur(require("fs")),Mo=We(),Lo=B.default.writev,ye=Symbol("_autoClose"),$=Symbol("_close"),_t=Symbol("_ended"),p=Symbol("_fd"),ts=Symbol("_finished"),fe=Symbol("_flags"),is=Symbol("_flush"),os=Symbol("_handleChunk"),as=Symbol("_makeBuf"),yt=Symbol("_mode"),Ht=Symbol("_needDrain"),Ge=Symbol("_onerror"),Ye=Symbol("_onopen"),ss=Symbol("_onread"),He=Symbol("_onwrite"),Ee=Symbol("_open"),V=Symbol("_path"),we=Symbol("_pos"),ee=Symbol("_queue"),Ze=Symbol("_read"),rs=Symbol("_readSize"),ce=Symbol("_reading"),wt=Symbol("_remain"),ns=Symbol("_size"),Zt=Symbol("_write"),Ne=Symbol("_writing"),Gt=Symbol("_defaultFlag"),Me=Symbol("_errored"),Yt=class extends Mo.Minipass{[Me]=!1;[p];[V];[rs];[ce]=!1;[ns];[wt];[ye];constructor(e,t){if(t=t||{},super(t),this.readable=!0,this.writable=!1,typeof e!="string")throw new TypeError("path must be a string");this[Me]=!1,this[p]=typeof t.fd=="number"?t.fd:void 0,this[V]=e,this[rs]=t.readSize||16*1024*1024,this[ce]=!1,this[ns]=typeof t.size=="number"?t.size:1/0,this[wt]=this[ns],this[ye]=typeof t.autoClose=="boolean"?t.autoClose:!0,typeof this[p]=="number"?this[Ze]():this[Ee]()}get fd(){return this[p]}get path(){return this[V]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[Ee](){B.default.open(this[V],"r",(e,t)=>this[Ye](e,t))}[Ye](e,t){e?this[Ge](e):(this[p]=t,this.emit("open",t),this[Ze]())}[as](){return Buffer.allocUnsafe(Math.min(this[rs],this[wt]))}[Ze](){if(!this[ce]){this[ce]=!0;let e=this[as]();if(e.length===0)return process.nextTick(()=>this[ss](null,0,e));B.default.read(this[p],e,0,e.length,null,(t,i,r)=>this[ss](t,i,r))}}[ss](e,t,i){this[ce]=!1,e?this[Ge](e):this[os](t,i)&&this[Ze]()}[$](){if(this[ye]&&typeof this[p]=="number"){let e=this[p];this[p]=void 0,B.default.close(e,t=>t?this.emit("error",t):this.emit("close"))}}[Ge](e){this[ce]=!0,this[$](),this.emit("error",e)}[os](e,t){let i=!1;return this[wt]-=e,e>0&&(i=super.write(ethis[Ye](e,t))}[Ye](e,t){this[Gt]&&this[fe]==="r+"&&e&&e.code==="ENOENT"?(this[fe]="w",this[Ee]()):e?this[Ge](e):(this[p]=t,this.emit("open",t),this[Ne]||this[is]())}end(e,t){return e&&this.write(e,t),this[_t]=!0,!this[Ne]&&!this[ee].length&&typeof this[p]=="number"&&this[He](null,0),this}write(e,t){return typeof e=="string"&&(e=Buffer.from(e,t)),this[_t]?(this.emit("error",new Error("write() after end()")),!1):this[p]===void 0||this[Ne]||this[ee].length?(this[ee].push(e),this[Ht]=!0,!1):(this[Ne]=!0,this[Zt](e),!0)}[Zt](e){B.default.write(this[p],e,0,e.length,this[we],(t,i)=>this[He](t,i))}[He](e,t){e?this[Ge](e):(this[we]!==void 0&&typeof t=="number"&&(this[we]+=t),this[ee].length?this[is]():(this[Ne]=!1,this[_t]&&!this[ts]?(this[ts]=!0,this[$](),this.emit("finish")):this[Ht]&&(this[Ht]=!1,this.emit("drain"))))}[is](){if(this[ee].length===0)this[_t]&&this[He](null,0);else if(this[ee].length===1)this[Zt](this[ee].pop());else{let e=this[ee];this[ee]=[],Lo(this[p],e,this[we],(t,i)=>this[He](t,i))}}[$](){if(this[ye]&&typeof this[p]=="number"){let e=this[p];this[p]=void 0,B.default.close(e,t=>t?this.emit("error",t):this.emit("close"))}}};W.WriteStream=Kt;var ls=class extends Kt{[Ee](){let e;if(this[Gt]&&this[fe]==="r+")try{e=B.default.openSync(this[V],this[fe],this[yt])}catch(t){if(t?.code==="ENOENT")return this[fe]="w",this[Ee]();throw t}else e=B.default.openSync(this[V],this[fe],this[yt]);this[Ye](null,e)}[$](){if(this[ye]&&typeof this[p]=="number"){let e=this[p];this[p]=void 0,B.default.closeSync(e),this.emit("close")}}[Zt](e){let t=!0;try{this[He](null,B.default.writeSync(this[p],e,0,e.length,this[we])),t=!1}finally{if(t)try{this[$]()}catch{}}}};W.WriteStreamSync=ls});var Vt=d(b=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});b.dealias=b.isNoFile=b.isFile=b.isAsync=b.isSync=b.isAsyncNoFile=b.isSyncNoFile=b.isAsyncFile=b.isSyncFile=void 0;var Ao=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),Io=s=>!!s.sync&&!!s.file;b.isSyncFile=Io;var Co=s=>!s.sync&&!!s.file;b.isAsyncFile=Co;var Fo=s=>!!s.sync&&!s.file;b.isSyncNoFile=Fo;var Bo=s=>!s.sync&&!s.file;b.isAsyncNoFile=Bo;var zo=s=>!!s.sync;b.isSync=zo;var ko=s=>!s.sync;b.isAsync=ko;var jo=s=>!!s.file;b.isFile=jo;var xo=s=>!s.file;b.isNoFile=xo;var Uo=s=>{let e=Ao.get(s);return e||s},qo=(s={})=>{if(!s)return{};let e={};for(let[t,i]of Object.entries(s)){let r=Uo(t);e[r]=i}return e.chmod===void 0&&e.noChmod===!1&&(e.chmod=!0),delete e.noChmod,e};b.dealias=qo});var Ve=d($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.makeCommand=void 0;var Et=Vt(),Wo=(s,e,t,i,r)=>Object.assign((n=[],o,a)=>{Array.isArray(n)&&(o=n,n={}),typeof o=="function"&&(a=o,o=void 0),o?o=Array.from(o):o=[];let h=(0,Et.dealias)(n);if(r?.(h,o),(0,Et.isSyncFile)(h)){if(typeof a=="function")throw new TypeError("callback not supported for sync tar functions");return s(h,o)}else if((0,Et.isAsyncFile)(h)){let l=e(h,o),u=a||void 0;return u?l.then(()=>u(),u):l}else if((0,Et.isSyncNoFile)(h)){if(typeof a=="function")throw new TypeError("callback not supported for sync tar functions");return t(h,o)}else if((0,Et.isAsyncNoFile)(h)){if(typeof a=="function")throw new TypeError("callback only supported with file option");return i(h,o)}else throw new Error("impossible options??")},{syncFile:s,asyncFile:e,syncNoFile:t,asyncNoFile:i,validate:r});$t.makeCommand=Wo});var us=d($e=>{"use strict";var Ho=$e&&$e.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty($e,"__esModule",{value:!0});$e.constants=void 0;var Zo=Ho(require("zlib")),Go=Zo.default.constants||{ZLIB_VERNUM:4736};$e.constants=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},Go))});var vs=d(f=>{"use strict";var Yo=f&&f.__createBinding||(Object.create?(function(s,e,t,i){i===void 0&&(i=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,i,r)}):(function(s,e,t,i){i===void 0&&(i=t),s[i]=e[t]})),Ko=f&&f.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),Vo=f&&f.__importStar||(function(){var s=function(e){return s=Object.getOwnPropertyNames||function(t){var i=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[i.length]=r);return i},s(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i=s(e),r=0;rs,cs=Wr?.writable===!0||Wr?.set!==void 0?s=>{Le.Buffer.concat=s?ea:Jo}:s=>{},Ae=Symbol("_superWrite"),Ie=class extends Error{code;errno;constructor(e,t){super("zlib: "+e.message,{cause:e}),this.code=e.code,this.errno=e.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+e.message,Error.captureStackTrace(this,t??this.constructor)}get name(){return"ZlibError"}};f.ZlibError=Ie;var fs=Symbol("flushFlag"),bt=class extends Xo.Minipass{#e=!1;#i=!1;#s;#n;#r;#t;#o;get sawError(){return this.#e}get handle(){return this.#t}get flushFlag(){return this.#s}constructor(e,t){if(!e||typeof e!="object")throw new TypeError("invalid options for ZlibBase constructor");if(super(e),this.#s=e.flush??0,this.#n=e.finishFlush??0,this.#r=e.fullFlushFlag??0,typeof qr[t]!="function")throw new TypeError("Compression method not supported: "+t);try{this.#t=new qr[t](e)}catch(i){throw new Ie(i,this.constructor)}this.#o=i=>{this.#e||(this.#e=!0,this.close(),this.emit("error",i))},this.#t?.on("error",i=>this.#o(new Ie(i))),this.once("end",()=>this.close)}close(){this.#t&&(this.#t.close(),this.#t=void 0,this.emit("close"))}reset(){if(!this.#e)return(0,ds.default)(this.#t,"zlib binding closed"),this.#t.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#r),this.write(Object.assign(Le.Buffer.alloc(0),{[fs]:e})))}end(e,t,i){return typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),e&&(t?this.write(e,t):this.write(e)),this.flush(this.#n),this.#i=!0,super.end(i)}get ended(){return this.#i}[Ae](e){return super.write(e)}write(e,t,i){if(typeof t=="function"&&(i=t,t="utf8"),typeof e=="string"&&(e=Le.Buffer.from(e,t)),this.#e)return;(0,ds.default)(this.#t,"zlib binding closed");let r=this.#t._handle,n=r.close;r.close=()=>{};let o=this.#t.close;this.#t.close=()=>{},cs(!0);let a;try{let l=typeof e[fs]=="number"?e[fs]:this.#s;a=this.#t._processChunk(e,l),cs(!1)}catch(l){cs(!1),this.#o(new Ie(l,this.write))}finally{this.#t&&(this.#t._handle=r,r.close=n,this.#t.close=o,this.#t.removeAllListeners("error"))}this.#t&&this.#t.on("error",l=>this.#o(new Ie(l,this.write)));let h;if(a)if(Array.isArray(a)&&a.length>0){let l=a[0];h=this[Ae](Le.Buffer.from(l));for(let u=1;u{typeof r=="function"&&(n=r,r=this.flushFlag),this.flush(r),n?.()};try{this.handle.params(e,t)}finally{this.handle.flush=i}this.handle&&(this.#e=e,this.#i=t)}}}};f.Zlib=ie;var ms=class extends ie{constructor(e){super(e,"Deflate")}};f.Deflate=ms;var ps=class extends ie{constructor(e){super(e,"Inflate")}};f.Inflate=ps;var _s=class extends ie{#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[Ae](e){return this.#e?(this.#e=!1,e[9]=255,super[Ae](e)):super[Ae](e)}};f.Gzip=_s;var ws=class extends ie{constructor(e){super(e,"Gunzip")}};f.Gunzip=ws;var ys=class extends ie{constructor(e){super(e,"DeflateRaw")}};f.DeflateRaw=ys;var Es=class extends ie{constructor(e){super(e,"InflateRaw")}};f.InflateRaw=Es;var bs=class extends ie{constructor(e){super(e,"Unzip")}};f.Unzip=bs;var Xt=class extends bt{constructor(e,t){e=e||{},e.flush=e.flush||te.constants.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||te.constants.BROTLI_OPERATION_FINISH,e.fullFlushFlag=te.constants.BROTLI_OPERATION_FLUSH,super(e,t)}},Ss=class extends Xt{constructor(e){super(e,"BrotliCompress")}};f.BrotliCompress=Ss;var gs=class extends Xt{constructor(e){super(e,"BrotliDecompress")}};f.BrotliDecompress=gs;var Qt=class extends bt{constructor(e,t){e=e||{},e.flush=e.flush||te.constants.ZSTD_e_continue,e.finishFlush=e.finishFlush||te.constants.ZSTD_e_end,e.fullFlushFlag=te.constants.ZSTD_e_flush,super(e,t)}},Rs=class extends Qt{constructor(e){super(e,"ZstdCompress")}};f.ZstdCompress=Rs;var Os=class extends Qt{constructor(e){super(e,"ZstdDecompress")}};f.ZstdDecompress=Os});var Gr=d(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.parse=Xe.encode=void 0;var ta=(s,e)=>{if(Number.isSafeInteger(s))s<0?sa(s,e):ia(s,e);else throw Error("cannot encode number outside of javascript safe integer range");return e};Xe.encode=ta;var ia=(s,e)=>{e[0]=128;for(var t=e.length;t>1;t--)e[t-1]=s&255,s=Math.floor(s/256)},sa=(s,e)=>{e[0]=255;var t=!1;s=s*-1;for(var i=e.length;i>1;i--){var r=s&255;s=Math.floor(s/256),t?e[i-1]=Hr(r):r===0?e[i-1]=0:(t=!0,e[i-1]=Zr(r))}},ra=s=>{let e=s[0],t=e===128?oa(s.subarray(1,s.length)):e===255?na(s):null;if(t===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(t))throw Error("parsed number outside of javascript safe integer range");return t};Xe.parse=ra;var na=s=>{for(var e=s.length,t=0,i=!1,r=e-1;r>-1;r--){var n=Number(s[r]),o;i?o=Hr(n):n===0?o=n:(i=!0,o=Zr(n)),o!==0&&(t-=o*Math.pow(256,e-r-1))}return t},oa=s=>{for(var e=s.length,t=0,i=e-1;i>-1;i--){var r=Number(s[i]);r!==0&&(t+=r*Math.pow(256,e-i-1))}return t},Hr=s=>(255^s)&255,Zr=s=>(255^s)+1&255});var Ts=d(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.code=j.name=j.isName=j.isCode=void 0;var aa=s=>j.name.has(s);j.isCode=aa;var ha=s=>j.code.has(s);j.isName=ha;j.name=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]);j.code=new Map(Array.from(j.name).map(s=>[s[1],s[0]]))});var Je=d(se=>{"use strict";var la=se&&se.__createBinding||(Object.create?(function(s,e,t,i){i===void 0&&(i=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,i,r)}):(function(s,e,t,i){i===void 0&&(i=t),s[i]=e[t]})),ua=se&&se.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),Yr=se&&se.__importStar||(function(){var s=function(e){return s=Object.getOwnPropertyNames||function(t){var i=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[i.length]=r);return i},s(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i=s(e),r=0;r=t+512))throw new Error("need 512 bytes for header");this.path=i?.path??Ce(e,t,100),this.mode=i?.mode??r?.mode??be(e,t+100,8),this.uid=i?.uid??r?.uid??be(e,t+108,8),this.gid=i?.gid??r?.gid??be(e,t+116,8),this.size=i?.size??r?.size??be(e,t+124,12),this.mtime=i?.mtime??r?.mtime??Ds(e,t+136,12),this.cksum=be(e,t+148,12),r&&this.#i(r,!0),i&&this.#i(i);let n=Ce(e,t+156,1);if(St.isCode(n)&&(this.#e=n||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=Ce(e,t+157,100),e.subarray(t+257,t+265).toString()==="ustar\x0000")if(this.uname=i?.uname??r?.uname??Ce(e,t+265,32),this.gname=i?.gname??r?.gname??Ce(e,t+297,32),this.devmaj=i?.devmaj??r?.devmaj??be(e,t+329,8)??0,this.devmin=i?.devmin??r?.devmin??be(e,t+337,8)??0,e[t+475]!==0){let a=Ce(e,t+345,155);this.path=a+"/"+this.path}else{let a=Ce(e,t+345,130);a&&(this.path=a+"/"+this.path),this.atime=i?.atime??r?.atime??Ds(e,t+476,12),this.ctime=i?.ctime??r?.ctime??Ds(e,t+488,12)}let o=256;for(let a=t;a!(r==null||i==="path"&&t||i==="linkpath"&&t||i==="global"))))}encode(e,t=0){if(e||(e=this.block=Buffer.alloc(512)),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=t+512))throw new Error("need 512 bytes for header");let i=this.ctime||this.atime?130:155,r=ca(this.path||"",i),n=r[0],o=r[1];this.needPax=!!r[2],this.needPax=Fe(e,t,100,n)||this.needPax,this.needPax=Se(e,t+100,8,this.mode)||this.needPax,this.needPax=Se(e,t+108,8,this.uid)||this.needPax,this.needPax=Se(e,t+116,8,this.gid)||this.needPax,this.needPax=Se(e,t+124,12,this.size)||this.needPax,this.needPax=Ps(e,t+136,12,this.mtime)||this.needPax,e[t+156]=this.#e.charCodeAt(0),this.needPax=Fe(e,t+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",t+257,8),this.needPax=Fe(e,t+265,32,this.uname)||this.needPax,this.needPax=Fe(e,t+297,32,this.gname)||this.needPax,this.needPax=Se(e,t+329,8,this.devmaj)||this.needPax,this.needPax=Se(e,t+337,8,this.devmin)||this.needPax,this.needPax=Fe(e,t+345,i,o)||this.needPax,e[t+475]!==0?this.needPax=Fe(e,t+345,155,o)||this.needPax:(this.needPax=Fe(e,t+345,130,o)||this.needPax,this.needPax=Ps(e,t+476,12,this.atime)||this.needPax,this.needPax=Ps(e,t+488,12,this.ctime)||this.needPax);let a=256;for(let h=t;h{let i=s,r="",n,o=Qe.posix.parse(s).root||".";if(Buffer.byteLength(i)<100)n=[i,r,!1];else{r=Qe.posix.dirname(i),i=Qe.posix.basename(i);do Buffer.byteLength(i)<=100&&Buffer.byteLength(r)<=e?n=[i,r,!1]:Buffer.byteLength(i)>100&&Buffer.byteLength(r)<=e?n=[i.slice(0,99),r,!0]:(i=Qe.posix.join(Qe.posix.basename(r),i),r=Qe.posix.dirname(r));while(r!==o&&n===void 0);n||(n=[s.slice(0,99),"",!0])}return n},Ce=(s,e,t)=>s.subarray(e,e+t).toString("utf8").replace(/\0.*/,""),Ds=(s,e,t)=>fa(be(s,e,t)),fa=s=>s===void 0?void 0:new Date(s*1e3),be=(s,e,t)=>Number(s[e])&128?Kr.parse(s.subarray(e,e+t)):ma(s,e,t),da=s=>isNaN(s)?void 0:s,ma=(s,e,t)=>da(parseInt(s.subarray(e,e+t).toString("utf8").replace(/\0.*$/,"").trim(),8)),pa={12:8589934591,8:2097151},Se=(s,e,t,i)=>i===void 0?!1:i>pa[t]||i<0?(Kr.encode(i,s.subarray(e,e+t)),!0):(_a(s,e,t,i),!1),_a=(s,e,t,i)=>s.write(wa(i,t),e,t,"ascii"),wa=(s,e)=>ya(Math.floor(s).toString(8),e),ya=(s,e)=>(s.length===e-1?s:new Array(e-s.length-1).join("0")+s+" ")+"\0",Ps=(s,e,t,i)=>i===void 0?!1:Se(s,e,t,i.getTime()/1e3),Ea=new Array(156).join("\0"),Fe=(s,e,t,i)=>i===void 0?!1:(s.write(i+Ea,e,t,"utf8"),i.length!==Buffer.byteLength(i)||i.length>t)});var ei=d(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.Pax=void 0;var ba=require("node:path"),Sa=Je(),Ms=class s{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(e,t=!1){this.atime=e.atime,this.charset=e.charset,this.comment=e.comment,this.ctime=e.ctime,this.dev=e.dev,this.gid=e.gid,this.global=t,this.gname=e.gname,this.ino=e.ino,this.linkpath=e.linkpath,this.mtime=e.mtime,this.nlink=e.nlink,this.path=e.path,this.size=e.size,this.uid=e.uid,this.uname=e.uname}encode(){let e=this.encodeBody();if(e==="")return Buffer.allocUnsafe(0);let t=Buffer.byteLength(e),i=512*Math.ceil(1+t/512),r=Buffer.allocUnsafe(i);for(let n=0;n<512;n++)r[n]=0;new Sa.Header({path:("PaxHeader/"+(0,ba.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:t,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(r),r.write(e,512,t,"utf8");for(let n=t+512;n=Math.pow(10,o)&&(o+=1),o+n+r}static parse(e,t,i=!1){return new s(ga(Ra(e),t),i)}};Jt.Pax=Ms;var ga=(s,e)=>e?Object.assign({},e,s):s,Ra=s=>s.replace(/\n$/,"").split(` +`).reduce(Oa,Object.create(null)),Oa=(s,e)=>{let t=parseInt(e,10);if(t!==Buffer.byteLength(e)+1)return s;e=e.slice((t+" ").length);let i=e.split("="),r=i.shift();if(!r)return s;let n=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),o=i.join("=");return s[n]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(n)?new Date(Number(o)*1e3):/^[0-9]+$/.test(o)?+o:o,s}});var et=d(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.normalizeWindowsPath=void 0;var va=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;ti.normalizeWindowsPath=va!=="win32"?s=>s:s=>s&&s.replace(/\\/g,"/")});var ri=d(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.ReadEntry=void 0;var Ta=We(),ii=et(),Ls=class extends Ta.Minipass{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(e,t,i){switch(super({}),this.pause(),this.extended=t,this.globalExtended=i,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!e.path)throw new Error("no path provided for tar.ReadEntry");this.path=(0,ii.normalizeWindowsPath)(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?(0,ii.normalizeWindowsPath)(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,t&&this.#e(t),i&&this.#e(i,!0)}write(e){let t=e.length;if(t>this.blockRemain)throw new Error("writing more to entry than is appropriate");let i=this.remain,r=this.blockRemain;return this.remain=Math.max(0,i-t),this.blockRemain=Math.max(0,r-t),this.ignore?!0:i>=t?super.write(e):super.write(e.subarray(0,i))}#e(e,t=!1){e.path&&(e.path=(0,ii.normalizeWindowsPath)(e.path)),e.linkpath&&(e.linkpath=(0,ii.normalizeWindowsPath)(e.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([i,r])=>!(r==null||i==="path"&&t))))}};si.ReadEntry=Ls});var oi=d(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.warnMethod=void 0;var Da=(s,e,t,i={})=>{s.file&&(i.file=s.file),s.cwd&&(i.cwd=s.cwd),i.code=t instanceof Error&&t.code||e,i.tarCode=e,!s.strict&&i.recoverable!==!1?(t instanceof Error&&(i=Object.assign(t,i),t=t.message),s.emit("warn",e,t,i)):t instanceof Error?s.emit("error",Object.assign(t,i)):s.emit("error",Object.assign(new Error(`${e}: ${t}`),i))};ni.warnMethod=Da});var mi=d(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.Parser=void 0;var Pa=require("events"),As=vs(),Vr=Je(),$r=ei(),Na=ri(),Ma=oi(),La=1024*1024,zs=Buffer.from([31,139]),ks=Buffer.from([40,181,47,253]),Aa=Math.max(zs.length,ks.length),H=Symbol("state"),Be=Symbol("writeEntry"),de=Symbol("readEntry"),Is=Symbol("nextEntry"),Xr=Symbol("processEntry"),re=Symbol("extendedHeader"),gt=Symbol("globalExtendedHeader"),ge=Symbol("meta"),Qr=Symbol("emitMeta"),_=Symbol("buffer"),me=Symbol("queue"),Re=Symbol("ended"),Cs=Symbol("emittedEnd"),ze=Symbol("emit"),S=Symbol("unzip"),ai=Symbol("consumeChunk"),hi=Symbol("consumeChunkSub"),Fs=Symbol("consumeBody"),Jr=Symbol("consumeMeta"),en=Symbol("consumeHeader"),Rt=Symbol("consuming"),Bs=Symbol("bufferConcat"),li=Symbol("maybeEnd"),tt=Symbol("writing"),Oe=Symbol("aborted"),ui=Symbol("onDone"),ke=Symbol("sawValidEntry"),ci=Symbol("sawNullBlock"),fi=Symbol("sawEOF"),tn=Symbol("closeStream"),Ia=()=>!0,js=class extends Pa.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[me]=[];[_];[de];[Be];[H]="begin";[ge]="";[re];[gt];[Re]=!1;[S];[Oe]=!1;[ke];[ci]=!1;[fi]=!1;[tt]=!1;[Rt]=!1;[Cs]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(ui,()=>{(this[H]==="begin"||this[ke]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(ui,e.ondone):this.on(ui,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||La,this.filter=typeof e.filter=="function"?e.filter:Ia;let t=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!(e.gzip||e.zstd)&&e.brotli!==void 0?e.brotli:t?void 0:!1;let i=e.file&&(e.file.endsWith(".tar.zst")||e.file.endsWith(".tzst"));this.zstd=!(e.gzip||e.brotli)&&e.zstd!==void 0?e.zstd:i?!0:void 0,this.on("end",()=>this[tn]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,t,i={}){(0,Ma.warnMethod)(this,e,t,i)}[en](e,t){this[ke]===void 0&&(this[ke]=!1);let i;try{i=new Vr.Header(e,t,this[re],this[gt])}catch(r){return this.warn("TAR_ENTRY_INVALID",r)}if(i.nullBlock)this[ci]?(this[fi]=!0,this[H]==="begin"&&(this[H]="header"),this[ze]("eof")):(this[ci]=!0,this[ze]("nullBlock"));else if(this[ci]=!1,!i.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i});else if(!i.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else{let r=i.type;if(/^(Symbolic)?Link$/.test(r)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(!/^(Symbolic)?Link$/.test(r)&&!/^(Global)?ExtendedHeader$/.test(r)&&i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i});else{let n=this[Be]=new Na.ReadEntry(i,this[re],this[gt]);if(!this[ke])if(n.remain){let o=()=>{n.invalid||(this[ke]=!0)};n.on("end",o)}else this[ke]=!0;n.meta?n.size>this.maxMetaEntrySize?(n.ignore=!0,this[ze]("ignoredEntry",n),this[H]="ignore",n.resume()):n.size>0&&(this[ge]="",n.on("data",o=>this[ge]+=o),this[H]="meta"):(this[re]=void 0,n.ignore=n.ignore||!this.filter(n.path,n),n.ignore?(this[ze]("ignoredEntry",n),this[H]=n.remain?"ignore":"header",n.resume()):(n.remain?this[H]="body":(this[H]="header",n.end()),this[de]?this[me].push(n):(this[me].push(n),this[Is]())))}}}[tn](){queueMicrotask(()=>this.emit("close"))}[Xr](e){let t=!0;if(!e)this[de]=void 0,t=!1;else if(Array.isArray(e)){let[i,...r]=e;this.emit(i,...r)}else this[de]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[Is]()),t=!1);return t}[Is](){do;while(this[Xr](this[me].shift()));if(!this[me].length){let e=this[de];!e||e.flowing||e.size===e.remain?this[tt]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[Fs](e,t){let i=this[Be];if(!i)throw new Error("attempt to consume body without entry??");let r=i.blockRemain??0,n=r>=e.length&&t===0?e:e.subarray(t,t+r);return i.write(n),i.blockRemain||(this[H]="header",this[Be]=void 0,i.end()),n.length}[Jr](e,t){let i=this[Be],r=this[Fs](e,t);return!this[Be]&&i&&this[Qr](i),r}[ze](e,t,i){!this[me].length&&!this[de]?this.emit(e,t,i):this[me].push([e,t,i])}[Qr](e){switch(this[ze]("meta",this[ge]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[re]=$r.Pax.parse(this[ge],this[re],!1);break;case"GlobalExtendedHeader":this[gt]=$r.Pax.parse(this[ge],this[gt],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let t=this[re]??Object.create(null);this[re]=t,t.path=this[ge].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let t=this[re]||Object.create(null);this[re]=t,t.linkpath=this[ge].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+e.type)}}abort(e){this[Oe]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e,t,i){if(typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this[Oe])return i?.(),!1;if((this[S]===void 0||this.brotli===void 0&&this[S]===!1)&&e){if(this[_]&&(e=Buffer.concat([this[_],e]),this[_]=void 0),e.lengththis[ai](u)),this[S].on("error",u=>this.abort(u)),this[S].on("end",()=>{this[Re]=!0,this[ai]()}),this[tt]=!0;let l=!!this[S][h?"end":"write"](e);return this[tt]=!1,i?.(),l}}this[tt]=!0,this[S]?this[S].write(e):this[ai](e),this[tt]=!1;let n=this[me].length?!1:this[de]?this[de].flowing:!0;return!n&&!this[me].length&&this[de]?.once("drain",()=>this.emit("drain")),i?.(),n}[Bs](e){e&&!this[Oe]&&(this[_]=this[_]?Buffer.concat([this[_],e]):e)}[li](){if(this[Re]&&!this[Cs]&&!this[Oe]&&!this[Rt]){this[Cs]=!0;let e=this[Be];if(e&&e.blockRemain){let t=this[_]?this[_].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${t} available)`,{entry:e}),this[_]&&e.write(this[_]),e.end()}this[ze](ui)}}[ai](e){if(this[Rt]&&e)this[Bs](e);else if(!e&&!this[_])this[li]();else if(e){if(this[Rt]=!0,this[_]){this[Bs](e);let t=this[_];this[_]=void 0,this[hi](t)}else this[hi](e);for(;this[_]&&this[_]?.length>=512&&!this[Oe]&&!this[fi];){let t=this[_];this[_]=void 0,this[hi](t)}this[Rt]=!1}(!this[_]||this[Re])&&this[li]()}[hi](e){let t=0,i=e.length;for(;t+512<=i&&!this[Oe]&&!this[fi];)switch(this[H]){case"begin":case"header":this[en](e,t),t+=512;break;case"ignore":case"body":t+=this[Fs](e,t);break;case"meta":t+=this[Jr](e,t);break;default:throw new Error("invalid state: "+this[H])}t{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.stripTrailingSlashes=void 0;var Ca=s=>{let e=s.length-1,t=-1;for(;e>-1&&s.charAt(e)==="/";)t=e,e--;return t===-1?s:s.slice(0,t)};pi.stripTrailingSlashes=Ca});var st=d(F=>{"use strict";var Fa=F&&F.__createBinding||(Object.create?(function(s,e,t,i){i===void 0&&(i=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,i,r)}):(function(s,e,t,i){i===void 0&&(i=t),s[i]=e[t]})),Ba=F&&F.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),za=F&&F.__importStar||(function(){var s=function(e){return s=Object.getOwnPropertyNames||function(t){var i=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[i.length]=r);return i},s(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i=s(e),r=0;r{let e=s.onReadEntry;s.onReadEntry=e?t=>{e(t),t.resume()}:t=>t.resume()},qa=(s,e)=>{let t=new Map(e.map(n=>[(0,xs.stripTrailingSlashes)(n),!0])),i=s.filter,r=(n,o="")=>{let a=o||(0,sn.parse)(n).root||".",h;if(n===a)h=!1;else{let l=t.get(n);l!==void 0?h=l:h=r((0,sn.dirname)(n),a)}return t.set(n,h),h};s.filter=i?(n,o)=>i(n,o)&&r((0,xs.stripTrailingSlashes)(n)):n=>r((0,xs.stripTrailingSlashes)(n))};F.filesFilter=qa;var Wa=s=>{let e=new wi.Parser(s),t=s.file,i;try{i=it.default.openSync(t,"r");let r=it.default.fstatSync(i),n=s.maxReadSize||16*1024*1024;if(r.size{let t=new wi.Parser(s),i=s.maxReadSize||16*1024*1024,r=s.file;return new Promise((o,a)=>{t.on("error",a),t.on("end",o),it.default.stat(r,(h,l)=>{if(h)a(h);else{let u=new ja.ReadStream(r,{readSize:i,size:l.size});u.on("error",a),u.pipe(t)}})})};F.list=(0,xa.makeCommand)(Wa,Ha,s=>new wi.Parser(s),s=>new wi.Parser(s),(s,e)=>{e?.length&&(0,F.filesFilter)(s,e),s.noResume||Ua(s)})});var rn=d(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.modeFix=void 0;var Za=(s,e,t)=>(s&=4095,t&&(s=(s|384)&-19),e&&(s&256&&(s|=64),s&32&&(s|=8),s&4&&(s|=1)),s);yi.modeFix=Za});var Us=d(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.stripAbsolutePath=void 0;var Ga=require("node:path"),{isAbsolute:Ya,parse:nn}=Ga.win32,Ka=s=>{let e="",t=nn(s);for(;Ya(s)||t.root;){let i=s.charAt(0)==="/"&&s.slice(0,4)!=="//?/"?"/":t.root;s=s.slice(i.length),e+=i,t=nn(s)}return[e,s]};Ei.stripAbsolutePath=Ka});var Ws=d(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.decode=rt.encode=void 0;var bi=["|","<",">","?",":"],qs=bi.map(s=>String.fromCharCode(61440+s.charCodeAt(0))),Va=new Map(bi.map((s,e)=>[s,qs[e]])),$a=new Map(qs.map((s,e)=>[s,bi[e]])),Xa=s=>bi.reduce((e,t)=>e.split(t).join(Va.get(t)),s);rt.encode=Xa;var Qa=s=>qs.reduce((e,t)=>e.split(t).join($a.get(t)),s);rt.decode=Qa});var er=d(M=>{"use strict";var Ja=M&&M.__createBinding||(Object.create?(function(s,e,t,i){i===void 0&&(i=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,i,r)}):(function(s,e,t,i){i===void 0&&(i=t),s[i]=e[t]})),eh=M&&M.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),th=M&&M.__importStar||(function(){var s=function(e){return s=Object.getOwnPropertyNames||function(t){var i=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[i.length]=r);return i},s(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i=s(e),r=0;re?(s=(0,ne.normalizeWindowsPath)(s).replace(/^\.(\/|$)/,""),(0,ih.stripTrailingSlashes)(e)+"/"+s):(0,ne.normalizeWindowsPath)(s),rh=16*1024*1024,an=Symbol("process"),hn=Symbol("file"),ln=Symbol("directory"),Zs=Symbol("symlink"),un=Symbol("hardlink"),Ot=Symbol("header"),Si=Symbol("read"),Gs=Symbol("lstat"),gi=Symbol("onlstat"),Ys=Symbol("onread"),Ks=Symbol("onreadlink"),Vs=Symbol("openfile"),$s=Symbol("onopenfile"),ve=Symbol("close"),Ri=Symbol("mode"),Xs=Symbol("awaitDrain"),Hs=Symbol("ondrain"),ae=Symbol("prefix"),Oi=class extends fn.Minipass{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#e=!1;constructor(e,t={}){let i=(0,pn.dealias)(t);super(),this.path=(0,ne.normalizeWindowsPath)(e),this.portable=!!i.portable,this.maxReadSize=i.maxReadSize||rh,this.linkCache=i.linkCache||new Map,this.statCache=i.statCache||new Map,this.preservePaths=!!i.preservePaths,this.cwd=(0,ne.normalizeWindowsPath)(i.cwd||process.cwd()),this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.mtime=i.mtime,this.prefix=i.prefix?(0,ne.normalizeWindowsPath)(i.prefix):void 0,this.onWriteEntry=i.onWriteEntry,typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let r=!1;if(!this.preservePaths){let[o,a]=(0,wn.stripAbsolutePath)(this.path);o&&typeof a=="string"&&(this.path=a,r=o)}this.win32=!!i.win32||process.platform==="win32",this.win32&&(this.path=sh.decode(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=(0,ne.normalizeWindowsPath)(i.absolute||on.default.resolve(this.cwd,e)),this.path===""&&(this.path="./"),r&&this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:this,path:r+this.path});let n=this.statCache.get(this.absolute);n?this[gi](n):this[Gs]()}warn(e,t,i={}){return(0,yn.warnMethod)(this,e,t,i)}emit(e,...t){return e==="error"&&(this.#e=!0),super.emit(e,...t)}[Gs](){oe.default.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[gi](t)})}[gi](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=nh(e),this.emit("stat",e),this[an]()}[an](){switch(this.type){case"File":return this[hn]();case"Directory":return this[ln]();case"SymbolicLink":return this[Zs]();default:return this.end()}}[Ri](e){return(0,mn.modeFix)(e,this.type==="Directory",this.portable)}[ae](e){return En(e,this.prefix)}[Ot](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new dn.Header({path:this[ae](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[ae](this.linkpath):this.linkpath,mode:this[Ri](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new _n.Pax({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[ae](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[ae](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let e=this.header?.block;if(!e)throw new Error("failed to encode header");super.write(e)}[ln](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Ot](),this.end()}[Zs](){oe.default.readlink(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Ks](t)})}[Ks](e){this.linkpath=(0,ne.normalizeWindowsPath)(e),this[Ot](),this.end()}[un](e){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=(0,ne.normalizeWindowsPath)(on.default.relative(this.cwd,e)),this.stat.size=0,this[Ot](),this.end()}[hn](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,t=this.linkCache.get(e);if(t?.indexOf(this.cwd)===0)return this[un](t);this.linkCache.set(e,this.absolute)}if(this[Ot](),this.stat.size===0)return this.end();this[Vs]()}[Vs](){oe.default.open(this.absolute,"r",(e,t)=>{if(e)return this.emit("error",e);this[$s](t)})}[$s](e){if(this.fd=e,this.#e)return this[ve]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let t=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(t),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[Si]()}[Si](){let{fd:e,buf:t,offset:i,length:r,pos:n}=this;if(e===void 0||t===void 0)throw new Error("cannot read file without first opening");oe.default.read(e,t,i,r,n,(o,a)=>{if(o)return this[ve](()=>this.emit("error",o));this[Ys](a)})}[ve](e=()=>{}){this.fd!==void 0&&oe.default.close(this.fd,e)}[Ys](e){if(e<=0&&this.remain>0){let r=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[ve](()=>this.emit("error",r))}if(e>this.remain){let r=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[ve](()=>this.emit("error",r))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(e===this.remain)for(let r=e;rthis[Hs]())}[Xs](e){this.once("drain",e)}write(e,t,i){if(typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this.blockRemaine?this.emit("error",e):this.end());if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[Si]()}};M.WriteEntry=Oi;var Qs=class extends Oi{sync=!0;[Gs](){this[gi](oe.default.lstatSync(this.absolute))}[Zs](){this[Ks](oe.default.readlinkSync(this.absolute))}[Vs](){this[$s](oe.default.openSync(this.absolute,"r"))}[Si](){let e=!0;try{let{fd:t,buf:i,offset:r,length:n,pos:o}=this;if(t===void 0||i===void 0)throw new Error("fd and buf must be set in READ method");let a=oe.default.readSync(t,i,r,n,o);this[Ys](a),e=!1}finally{if(e)try{this[ve](()=>{})}catch{}}}[Xs](e){e()}[ve](e=()=>{}){this.fd!==void 0&&oe.default.closeSync(this.fd),e()}};M.WriteEntrySync=Qs;var Js=class extends fn.Minipass{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(e,t,i={}){return(0,yn.warnMethod)(this,e,t,i)}constructor(e,t={}){let i=(0,pn.dealias)(t);super(),this.preservePaths=!!i.preservePaths,this.portable=!!i.portable,this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.onWriteEntry=i.onWriteEntry,this.readEntry=e;let{type:r}=e;if(r==="Unsupported")throw new Error("writing entry that should be ignored");this.type=r,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=i.prefix,this.path=(0,ne.normalizeWindowsPath)(e.path),this.mode=e.mode!==void 0?this[Ri](e.mode):void 0,this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:i.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath!==void 0?(0,ne.normalizeWindowsPath)(e.linkpath):void 0,typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let n=!1;if(!this.preservePaths){let[a,h]=(0,wn.stripAbsolutePath)(this.path);a&&typeof h=="string"&&(this.path=h,n=a)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new dn.Header({path:this[ae](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[ae](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),n&&this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute path`,{entry:this,path:n+this.path}),this.header.encode()&&!this.noPax&&super.write(new _n.Pax({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[ae](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[ae](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let o=this.header?.block;if(!o)throw new Error("failed to encode header");super.write(o),e.pipe(this)}[ae](e){return En(e,this.prefix)}[Ri](e){return(0,mn.modeFix)(e,this.type==="Directory",this.portable)}write(e,t,i){typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8"));let r=e.length;if(r>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=r,super.write(e,i)}end(e,t,i){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t??"utf8")),i&&this.once("finish",i),e?super.end(e,i):super.end(i),this}};M.WriteEntryTar=Js;var nh=s=>s.isFile()?"File":s.isDirectory()?"Directory":s.isSymbolicLink()?"SymbolicLink":"Unsupported"});var bn=d(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.Node=ot.Yallist=void 0;var tr=class s{tail;head;length=0;static create(e=[]){return new s(e)}constructor(e=[]){for(let t of e)this.push(t)}*[Symbol.iterator](){for(let e=this.head;e;e=e.next)yield e.value}removeNode(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");let t=e.next,i=e.prev;return t&&(t.prev=i),i&&(i.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=i),this.length--,e.next=void 0,e.prev=void 0,e.list=void 0,t}unshiftNode(e){if(e===this.head)return;e.list&&e.list.removeNode(e);let t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}pushNode(e){if(e===this.tail)return;e.list&&e.list.removeNode(e);let t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}push(...e){for(let t=0,i=e.length;t1)i=t;else if(this.head)r=this.head.next,i=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=0;r;n++)i=e(i,r.value,n),r=r.next;return i}reduceReverse(e,t){let i,r=this.tail;if(arguments.length>1)i=t;else if(this.tail)r=this.tail.prev,i=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let n=this.length-1;r;n--)i=e(i,r.value,n),r=r.prev;return i}toArray(){let e=new Array(this.length);for(let t=0,i=this.head;i;t++)e[t]=i.value,i=i.next;return e}toArrayReverse(){let e=new Array(this.length);for(let t=0,i=this.tail;i;t++)e[t]=i.value,i=i.prev;return e}slice(e=0,t=this.length){t<0&&(t+=this.length),e<0&&(e+=this.length);let i=new s;if(tthis.length&&(t=this.length);let r=this.head,n=0;for(n=0;r&&nthis.length&&(t=this.length);let r=this.length,n=this.tail;for(;n&&r>t;r--)n=n.prev;for(;n&&r>e;r--,n=n.prev)i.push(n.value);return i}splice(e,t=0,...i){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);let r=this.head;for(let o=0;r&&o{"use strict";var lh=L&&L.__createBinding||(Object.create?(function(s,e,t,i){i===void 0&&(i=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,i,r)}):(function(s,e,t,i){i===void 0&&(i=t),s[i]=e[t]})),uh=L&&L.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),ch=L&&L.__importStar||(function(){var s=function(e){return s=Object.getOwnPropertyNames||function(t){var i=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[i.length]=r);return i},s(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i=s(e),r=0;r1)throw new TypeError("gzip, brotli, zstd are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new ir.Gzip(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new ir.BrotliCompress(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new ir.ZstdCompress(e.zstd)),!this.zip)throw new Error("impossible");let t=this.zip;t.on("data",i=>super.write(i)),t.on("end",()=>super.end()),t.on("drain",()=>this[or]()),this.on("resume",()=>t.resume())}else this.on("drain",this[or]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>!0,this[X]=new dh.Yallist,this[Q]=0,this.jobs=Number(e.jobs)||4,this[Tt]=!1,this[vt]=!1}[Tn](e){return super.write(e)}add(e){return this.write(e),this}end(e,t,i){return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t=void 0),e&&this.add(e),this[vt]=!0,this[xe](),i&&i(),this}write(e){if(this[vt])throw new Error("write after end");return e instanceof mh.ReadEntry?this[gn](e):this[Ti](e),this.flowing}[gn](e){let t=(0,ar.normalizeWindowsPath)(On.default.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let i=new Dt(e.path,t);i.entry=new hr.WriteEntryTar(e,this[nr](i)),i.entry.on("end",()=>this[rr](i)),this[Q]+=1,this[X].push(i)}this[xe]()}[Ti](e){let t=(0,ar.normalizeWindowsPath)(On.default.resolve(this.cwd,e));this[X].push(new Dt(e,t)),this[xe]()}[lr](e){e.pending=!0,this[Q]+=1;let t=this.follow?"stat":"lstat";Mi.default[t](e.absolute,(i,r)=>{e.pending=!1,this[Q]-=1,i?this.emit("error",i):this[vi](e,r)})}[vi](e,t){this.statCache.set(e.absolute,t),e.stat=t,this.filter(e.path,t)?t.isFile()&&t.nlink>1&&e===this[je]&&!this.linkCache.get(`${t.dev}:${t.ino}`)&&!this.sync&&this[sr](e):e.ignore=!0,this[xe]()}[ur](e){e.pending=!0,this[Q]+=1,Mi.default.readdir(e.absolute,(t,i)=>{if(e.pending=!1,this[Q]-=1,t)return this.emit("error",t);this[Di](e,i)})}[Di](e,t){this.readdirCache.set(e.absolute,t),e.readdir=t,this[xe]()}[xe](){if(!this[Tt]){this[Tt]=!0;for(let e=this[X].head;e&&this[Q]this.warn(t,i,r),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[Rn](e){this[Q]+=1;try{return new this[Ni](e.path,this[nr](e)).on("end",()=>this[rr](e)).on("error",i=>this.emit("error",i))}catch(t){this.emit("error",t)}}[or](){this[je]&&this[je].entry&&this[je].entry.resume()}[Pi](e){e.piped=!0,e.readdir&&e.readdir.forEach(r=>{let n=e.path,o=n==="./"?"":n.replace(/\/*$/,"/");this[Ti](o+r)});let t=e.entry,i=this.zip;if(!t)throw new Error("cannot pipe without source");i?t.on("data",r=>{i.write(r)||t.pause()}):t.on("data",r=>{super.write(r)||t.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,t,i={}){(0,ph.warnMethod)(this,e,t,i)}};L.Pack=Li;var cr=class extends Li{sync=!0;constructor(e){super(e),this[Ni]=hr.WriteEntrySync}pause(){}resume(){}[lr](e){let t=this.follow?"statSync":"lstatSync";this[vi](e,Mi.default[t](e.absolute))}[ur](e){this[Di](e,Mi.default.readdirSync(e.absolute))}[Pi](e){let t=e.entry,i=this.zip;if(e.readdir&&e.readdir.forEach(r=>{let n=e.path,o=n==="./"?"":n.replace(/\/*$/,"/");this[Ti](o+r)}),!t)throw new Error("Cannot pipe without source");i?t.on("data",r=>{i.write(r)}):t.on("data",r=>{super[Tn](r)})}};L.PackSync=cr});var fr=d(at=>{"use strict";var _h=at&&at.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(at,"__esModule",{value:!0});at.create=void 0;var Dn=Ke(),Pn=_h(require("node:path")),Nn=st(),wh=Ve(),Ii=Ai(),yh=(s,e)=>{let t=new Ii.PackSync(s),i=new Dn.WriteStreamSync(s.file,{mode:s.mode||438});t.pipe(i),Mn(t,e)},Eh=(s,e)=>{let t=new Ii.Pack(s),i=new Dn.WriteStream(s.file,{mode:s.mode||438});t.pipe(i);let r=new Promise((n,o)=>{i.on("error",o),i.on("close",n),t.on("error",o)});return Ln(t,e),r},Mn=(s,e)=>{e.forEach(t=>{t.charAt(0)==="@"?(0,Nn.list)({file:Pn.default.resolve(s.cwd,t.slice(1)),sync:!0,noResume:!0,onReadEntry:i=>s.add(i)}):s.add(t)}),s.end()},Ln=async(s,e)=>{for(let t=0;t{s.add(r)}}):s.add(i)}s.end()},bh=(s,e)=>{let t=new Ii.PackSync(s);return Mn(t,e),t},Sh=(s,e)=>{let t=new Ii.Pack(s);return Ln(t,e),t};at.create=(0,wh.makeCommand)(yh,Eh,bh,Sh,(s,e)=>{if(!e?.length)throw new TypeError("no paths specified to add to archive")})});var Cn=d(ht=>{"use strict";var gh=ht&&ht.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ht,"__esModule",{value:!0});ht.getWriteFlag=void 0;var An=gh(require("fs")),Rh=process.env.__FAKE_PLATFORM__||process.platform,Oh=Rh==="win32",{O_CREAT:vh,O_TRUNC:Th,O_WRONLY:Dh}=An.default.constants,In=Number(process.env.__FAKE_FS_O_FILENAME__)||An.default.constants.UV_FS_O_FILEMAP||0,Ph=Oh&&!!In,Nh=512*1024,Mh=In|Th|vh|Dh;ht.getWriteFlag=Ph?s=>s"w"});var Bn=d(he=>{"use strict";var Fn=he&&he.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(he,"__esModule",{value:!0});he.chownrSync=he.chownr=void 0;var Fi=Fn(require("node:fs")),Pt=Fn(require("node:path")),dr=(s,e,t)=>{try{return Fi.default.lchownSync(s,e,t)}catch(i){if(i?.code!=="ENOENT")throw i}},Ci=(s,e,t,i)=>{Fi.default.lchown(s,e,t,r=>{i(r&&r?.code!=="ENOENT"?r:null)})},Lh=(s,e,t,i,r)=>{if(e.isDirectory())(0,he.chownr)(Pt.default.resolve(s,e.name),t,i,n=>{if(n)return r(n);let o=Pt.default.resolve(s,e.name);Ci(o,t,i,r)});else{let n=Pt.default.resolve(s,e.name);Ci(n,t,i,r)}},Ah=(s,e,t,i)=>{Fi.default.readdir(s,{withFileTypes:!0},(r,n)=>{if(r){if(r.code==="ENOENT")return i();if(r.code!=="ENOTDIR"&&r.code!=="ENOTSUP")return i(r)}if(r||!n.length)return Ci(s,e,t,i);let o=n.length,a=null,h=l=>{if(!a){if(l)return i(a=l);if(--o===0)return Ci(s,e,t,i)}};for(let l of n)Lh(s,l,e,t,h)})};he.chownr=Ah;var Ih=(s,e,t,i)=>{e.isDirectory()&&(0,he.chownrSync)(Pt.default.resolve(s,e.name),t,i),dr(Pt.default.resolve(s,e.name),t,i)},Ch=(s,e,t)=>{let i;try{i=Fi.default.readdirSync(s,{withFileTypes:!0})}catch(r){let n=r;if(n?.code==="ENOENT")return;if(n?.code==="ENOTDIR"||n?.code==="ENOTSUP")return dr(s,e,t);throw n}for(let r of i)Ih(s,r,e,t);return dr(s,e,t)};he.chownrSync=Ch});var zn=d(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.CwdError=void 0;var mr=class extends Error{path;code;syscall="chdir";constructor(e,t){super(`${t}: Cannot cd into '${e}'`),this.path=e,this.code=t}get name(){return"CwdError"}};Bi.CwdError=mr});var _r=d(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.SymlinkError=void 0;var pr=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,t){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=t}get name(){return"SymlinkError"}};zi.SymlinkError=pr});var qn=d(Te=>{"use strict";var yr=Te&&Te.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Te,"__esModule",{value:!0});Te.mkdirSync=Te.mkdir=void 0;var kn=Bn(),x=yr(require("node:fs")),Fh=yr(require("node:fs/promises")),ki=yr(require("node:path")),jn=zn(),pe=et(),xn=_r(),Bh=(s,e)=>{x.default.stat(s,(t,i)=>{(t||!i.isDirectory())&&(t=new jn.CwdError(s,t?.code||"ENOTDIR")),e(t)})},zh=(s,e,t)=>{s=(0,pe.normalizeWindowsPath)(s);let i=e.umask??18,r=e.mode|448,n=(r&i)!==0,o=e.uid,a=e.gid,h=typeof o=="number"&&typeof a=="number"&&(o!==e.processUid||a!==e.processGid),l=e.preserve,u=e.unlink,c=(0,pe.normalizeWindowsPath)(e.cwd),E=(w,P)=>{w?t(w):P&&h?(0,kn.chownr)(P,o,a,Cr=>E(Cr)):n?x.default.chmod(s,r,t):t()};if(s===c)return Bh(s,E);if(l)return Fh.default.mkdir(s,{mode:r,recursive:!0}).then(w=>E(null,w??void 0),E);let A=(0,pe.normalizeWindowsPath)(ki.default.relative(c,s)).split("/");wr(c,A,r,u,c,void 0,E)};Te.mkdir=zh;var wr=(s,e,t,i,r,n,o)=>{if(!e.length)return o(null,n);let a=e.shift(),h=(0,pe.normalizeWindowsPath)(ki.default.resolve(s+"/"+a));x.default.mkdir(h,t,Un(h,e,t,i,r,n,o))},Un=(s,e,t,i,r,n,o)=>a=>{a?x.default.lstat(s,(h,l)=>{if(h)h.path=h.path&&(0,pe.normalizeWindowsPath)(h.path),o(h);else if(l.isDirectory())wr(s,e,t,i,r,n,o);else if(i)x.default.unlink(s,u=>{if(u)return o(u);x.default.mkdir(s,t,Un(s,e,t,i,r,n,o))});else{if(l.isSymbolicLink())return o(new xn.SymlinkError(s,s+"/"+e.join("/")));o(a)}}):(n=n||s,wr(s,e,t,i,r,n,o))},kh=s=>{let e=!1,t;try{e=x.default.statSync(s).isDirectory()}catch(i){t=i?.code}finally{if(!e)throw new jn.CwdError(s,t??"ENOTDIR")}},jh=(s,e)=>{s=(0,pe.normalizeWindowsPath)(s);let t=e.umask??18,i=e.mode|448,r=(i&t)!==0,n=e.uid,o=e.gid,a=typeof n=="number"&&typeof o=="number"&&(n!==e.processUid||o!==e.processGid),h=e.preserve,l=e.unlink,u=(0,pe.normalizeWindowsPath)(e.cwd),c=w=>{w&&a&&(0,kn.chownrSync)(w,n,o),r&&x.default.chmodSync(s,i)};if(s===u)return kh(u),c();if(h)return c(x.default.mkdirSync(s,{mode:i,recursive:!0})??void 0);let D=(0,pe.normalizeWindowsPath)(ki.default.relative(u,s)).split("/"),A;for(let w=D.shift(),P=u;w&&(P+="/"+w);w=D.shift()){P=(0,pe.normalizeWindowsPath)(ki.default.resolve(P));try{x.default.mkdirSync(P,i),A=A||P}catch{let Fr=x.default.lstatSync(P);if(Fr.isDirectory())continue;if(l){x.default.unlinkSync(P),x.default.mkdirSync(P,i),A=A||P;continue}else if(Fr.isSymbolicLink())return new xn.SymlinkError(P,P+"/"+D.join("/"))}}return c(A)};Te.mkdirSync=jh});var Hn=d(ji=>{"use strict";Object.defineProperty(ji,"__esModule",{value:!0});ji.normalizeUnicode=void 0;var Er=Object.create(null),Wn=1e4,lt=new Set,xh=s=>{lt.has(s)?lt.delete(s):Er[s]=s.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),lt.add(s);let e=Er[s],t=lt.size-Wn;if(t>Wn/10){for(let i of lt)if(lt.delete(i),delete Er[i],--t<=0)break}return e};ji.normalizeUnicode=xh});var Gn=d(xi=>{"use strict";Object.defineProperty(xi,"__esModule",{value:!0});xi.PathReservations=void 0;var Zn=require("node:path"),Uh=Hn(),qh=_i(),Wh=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Hh=Wh==="win32",Zh=s=>s.split("/").slice(0,-1).reduce((t,i)=>{let r=t[t.length-1];return r!==void 0&&(i=(0,Zn.join)(r,i)),t.push(i||"/"),t},[]),br=class{#e=new Map;#i=new Map;#s=new Set;reserve(e,t){e=Hh?["win32 parallelization disabled"]:e.map(r=>(0,qh.stripTrailingSlashes)((0,Zn.join)((0,Uh.normalizeUnicode)(r))));let i=new Set(e.map(r=>Zh(r)).reduce((r,n)=>r.concat(n)));this.#i.set(t,{dirs:i,paths:e});for(let r of e){let n=this.#e.get(r);n?n.push(t):this.#e.set(r,[t])}for(let r of i){let n=this.#e.get(r);if(!n)this.#e.set(r,[new Set([t])]);else{let o=n[n.length-1];o instanceof Set?o.add(t):n.push(new Set([t]))}}return this.#r(t)}#n(e){let t=this.#i.get(e);if(!t)throw new Error("function does not have any path reservations");return{paths:t.paths.map(i=>this.#e.get(i)),dirs:[...t.dirs].map(i=>this.#e.get(i))}}check(e){let{paths:t,dirs:i}=this.#n(e);return t.every(r=>r&&r[0]===e)&&i.every(r=>r&&r[0]instanceof Set&&r[0].has(e))}#r(e){return this.#s.has(e)||!this.check(e)?!1:(this.#s.add(e),e(()=>this.#t(e)),!0)}#t(e){if(!this.#s.has(e))return!1;let t=this.#i.get(e);if(!t)throw new Error("invalid reservation");let{paths:i,dirs:r}=t,n=new Set;for(let o of i){let a=this.#e.get(o);if(!a||a?.[0]!==e)continue;let h=a[1];if(!h){this.#e.delete(o);continue}if(a.shift(),typeof h=="function")n.add(h);else for(let l of h)n.add(l)}for(let o of r){let a=this.#e.get(o),h=a?.[0];if(!(!a||!(h instanceof Set)))if(h.size===1&&a.length===1){this.#e.delete(o);continue}else if(h.size===1){a.shift();let l=a[0];typeof l=="function"&&n.add(l)}else h.delete(e)}return this.#s.delete(e),n.forEach(o=>this.#r(o)),!0}};xi.PathReservations=br});var Yn=d(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.umask=void 0;var Gh=()=>process.umask();Ui.umask=Gh});var Lr=d(z=>{"use strict";var Yh=z&&z.__createBinding||(Object.create?(function(s,e,t,i){i===void 0&&(i=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,i,r)}):(function(s,e,t,i){i===void 0&&(i=t),s[i]=e[t]})),Kh=z&&z.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),so=z&&z.__importStar||(function(){var s=function(e){return s=Object.getOwnPropertyNames||function(t){var i=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[i.length]=r);return i},s(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i=s(e),r=0;r{if(!Ft)return m.default.unlink(s,e);let t=s+".DELETE."+(0,ro.randomBytes)(16).toString("hex");m.default.rename(s,t,i=>{if(i)return e(i);m.default.unlink(t,e)})},rl=s=>{if(!Ft)return m.default.unlinkSync(s);let e=s+".DELETE."+(0,ro.randomBytes)(16).toString("hex");m.default.renameSync(s,e),m.default.unlinkSync(e)},io=(s,e,t)=>s!==void 0&&s===s>>>0?s:e!==void 0&&e===e>>>0?e:t,Hi=class extends Xh.Parser{[gr]=!1;[Ct]=!1;[qi]=0;reservations=new Jh.PathReservations;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[gr]=!0,this[Rr]()},super(e),this.transform=e.transform,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;e.preserveOwner===void 0&&typeof e.uid!="number"?this.preserveOwner=!!(process.getuid&&process.getuid()===0):this.preserveOwner=!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:il,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||Ft,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=(0,U.normalizeWindowsPath)(g.default.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:(0,el.umask)():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",t=>this[Vn](t))}warn(e,t,i={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(i.recoverable=!1),super.warn(e,t,i)}[Rr](){this[gr]&&this[qi]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[Sr](e,t){let i=e[t],{type:r}=e;if(!i||this.preservePaths)return!0;let n=i.split("/");if(n.includes("..")||Ft&&/^[a-z]:\.\.$/i.test(n[0]??"")){if(t==="path"||r==="Link")return this.warn("TAR_ENTRY_ERROR",`${t} contains '..'`,{entry:e,[t]:i}),!1;{let h=g.default.posix.dirname(e.path),l=g.default.posix.normalize(g.default.posix.join(h,i));if(l.startsWith("../")||l==="..")return this.warn("TAR_ENTRY_ERROR",`${t} escapes extraction directory`,{entry:e,[t]:i}),!1}}let[o,a]=(0,Qh.stripAbsolutePath)(i);return o&&(e[t]=String(a),this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute ${t}`,{entry:e,[t]:i})),!0}[eo](e){let t=(0,U.normalizeWindowsPath)(e.path),i=t.split("/");if(this.strip){if(i.length=this.strip)e.linkpath=r.slice(this.strip).join("/");else return!1}i.splice(0,this.strip),e.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:t,depth:i.length,maxDepth:this.maxDepth}),!1;if(!this[Sr](e,"path")||!this[Sr](e,"linkpath"))return!1;if(g.default.isAbsolute(e.path)?e.absolute=(0,U.normalizeWindowsPath)(g.default.resolve(e.path)):e.absolute=(0,U.normalizeWindowsPath)(g.default.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:(0,U.normalizeWindowsPath)(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:r}=g.default.win32.parse(String(e.absolute));e.absolute=r+Kn.encode(String(e.absolute).slice(r.length));let{root:n}=g.default.win32.parse(e.path);e.path=n+Kn.encode(e.path.slice(n.length))}return!0}[Vn](e){if(!this[eo](e))return e.resume();switch($h.default.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode=e.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[Or](e);default:return this[Jn](e)}}[T](e,t){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:t}),this[ut](),t.resume())}[De](e,t,i){(0,oo.mkdir)((0,U.normalizeWindowsPath)(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t},i)}[Lt](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[At](e){return io(this.uid,e.uid,this.processUid)}[It](e){return io(this.gid,e.gid,this.processGid)}[Tr](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.fmode,r=new Vh.WriteStream(String(e.absolute),{flags:(0,no.getWriteFlag)(e.size),mode:i,autoClose:!1});r.on("error",h=>{r.fd&&m.default.close(r.fd,()=>{}),r.write=()=>!0,this[T](h,e),t()});let n=1,o=h=>{if(h){r.fd&&m.default.close(r.fd,()=>{}),this[T](h,e),t();return}--n===0&&r.fd!==void 0&&m.default.close(r.fd,l=>{l?this[T](l,e):this[ut](),t()})};r.on("finish",()=>{let h=String(e.absolute),l=r.fd;if(typeof l=="number"&&e.mtime&&!this.noMtime){n++;let u=e.atime||new Date,c=e.mtime;m.default.futimes(l,u,c,E=>E?m.default.utimes(h,u,c,D=>o(D&&E)):o())}if(typeof l=="number"&&this[Lt](e)){n++;let u=this[At](e),c=this[It](e);typeof u=="number"&&typeof c=="number"&&m.default.fchown(l,u,c,E=>E?m.default.chown(h,u,c,D=>o(D&&E)):o())}o()});let a=this.transform&&this.transform(e)||e;a!==e&&(a.on("error",h=>{this[T](h,e),t()}),e.pipe(a)),a.pipe(r)}[Dr](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.dmode;this[De](String(e.absolute),i,r=>{if(r){this[T](r,e),t();return}let n=1,o=()=>{--n===0&&(t(),this[ut](),e.resume())};e.mtime&&!this.noMtime&&(n++,m.default.utimes(String(e.absolute),e.atime||new Date,e.mtime,o)),this[Lt](e)&&(n++,m.default.chown(String(e.absolute),Number(this[At](e)),Number(this[It](e)),o)),o()})}[Jn](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[Xn](e,t){let i=(0,U.normalizeWindowsPath)(g.default.relative(this.cwd,g.default.resolve(g.default.dirname(String(e.absolute)),String(e.linkpath)))).split("/");this[Mt](e,this.cwd,i,()=>this[Wi](e,String(e.linkpath),"symlink",t),r=>{this[T](r,e),t()})}[Qn](e,t){let i=(0,U.normalizeWindowsPath)(g.default.resolve(this.cwd,String(e.linkpath))),r=(0,U.normalizeWindowsPath)(String(e.linkpath)).split("/");this[Mt](e,this.cwd,r,()=>this[Wi](e,i,"link",t),n=>{this[T](n,e),t()})}[Mt](e,t,i,r,n){let o=i.shift();if(this.preservePaths||o===void 0)return r();let a=g.default.resolve(t,o);m.default.lstat(a,(h,l)=>{if(h)return r();if(l?.isSymbolicLink())return n(new ao.SymlinkError(a,g.default.resolve(a,i.join("/"))));this[Mt](e,a,i,r,n)})}[to](){this[qi]++}[ut](){this[qi]--,this[Rr]()}[Pr](e){this[ut](),e.resume()}[vr](e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&!Ft}[Or](e){this[to]();let t=[e.path];e.linkpath&&t.push(e.linkpath),this.reservations.reserve(t,i=>this[$n](e,i))}[$n](e,t){let i=a=>{t(a)},r=()=>{this[De](this.cwd,this.dmode,a=>{if(a){this[T](a,e),i();return}this[Ct]=!0,n()})},n=()=>{if(e.absolute!==this.cwd){let a=(0,U.normalizeWindowsPath)(g.default.dirname(String(e.absolute)));if(a!==this.cwd)return this[De](a,this.dmode,h=>{if(h){this[T](h,e),i();return}o()})}o()},o=()=>{m.default.lstat(String(e.absolute),(a,h)=>{if(h&&(this.keep||this.newer&&h.mtime>(e.mtime??h.mtime))){this[Pr](e),i();return}if(a||this[vr](e,h))return this[Z](null,e,i);if(h.isDirectory()){if(e.type==="Directory"){let l=this.chmod&&e.mode&&(h.mode&4095)!==e.mode,u=c=>this[Z](c??null,e,i);return l?m.default.chmod(String(e.absolute),Number(e.mode),u):u()}if(e.absolute!==this.cwd)return m.default.rmdir(String(e.absolute),l=>this[Z](l??null,e,i))}if(e.absolute===this.cwd)return this[Z](null,e,i);sl(String(e.absolute),l=>this[Z](l??null,e,i))})};this[Ct]?n():r()}[Z](e,t,i){if(e){this[T](e,t),i();return}switch(t.type){case"File":case"OldFile":case"ContiguousFile":return this[Tr](t,i);case"Link":return this[Qn](t,i);case"SymbolicLink":return this[Xn](t,i);case"Directory":case"GNUDumpDir":return this[Dr](t,i)}}[Wi](e,t,i,r){m.default[i](t,String(e.absolute),n=>{n?this[T](n,e):(this[ut](),e.resume()),r()})}};z.Unpack=Hi;var Nt=s=>{try{return[null,s()]}catch(e){return[e,null]}},Nr=class extends Hi{sync=!0;[Z](e,t){return super[Z](e,t,()=>{})}[Or](e){if(!this[Ct]){let n=this[De](this.cwd,this.dmode);if(n)return this[T](n,e);this[Ct]=!0}if(e.absolute!==this.cwd){let n=(0,U.normalizeWindowsPath)(g.default.dirname(String(e.absolute)));if(n!==this.cwd){let o=this[De](n,this.dmode);if(o)return this[T](o,e)}}let[t,i]=Nt(()=>m.default.lstatSync(String(e.absolute)));if(i&&(this.keep||this.newer&&i.mtime>(e.mtime??i.mtime)))return this[Pr](e);if(t||this[vr](e,i))return this[Z](null,e);if(i.isDirectory()){if(e.type==="Directory"){let o=this.chmod&&e.mode&&(i.mode&4095)!==e.mode,[a]=o?Nt(()=>{m.default.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[Z](a,e)}let[n]=Nt(()=>m.default.rmdirSync(String(e.absolute)));this[Z](n,e)}let[r]=e.absolute===this.cwd?[]:Nt(()=>rl(String(e.absolute)));this[Z](r,e)}[Tr](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.fmode,r=a=>{let h;try{m.default.closeSync(n)}catch(l){h=l}(a||h)&&this[T](a||h,e),t()},n;try{n=m.default.openSync(String(e.absolute),(0,no.getWriteFlag)(e.size),i)}catch(a){return r(a)}let o=this.transform&&this.transform(e)||e;o!==e&&(o.on("error",a=>this[T](a,e)),e.pipe(o)),o.on("data",a=>{try{m.default.writeSync(n,a,0,a.length)}catch(h){r(h)}}),o.on("end",()=>{let a=null;if(e.mtime&&!this.noMtime){let h=e.atime||new Date,l=e.mtime;try{m.default.futimesSync(n,h,l)}catch(u){try{m.default.utimesSync(String(e.absolute),h,l)}catch{a=u}}}if(this[Lt](e)){let h=this[At](e),l=this[It](e);try{m.default.fchownSync(n,Number(h),Number(l))}catch(u){try{m.default.chownSync(String(e.absolute),Number(h),Number(l))}catch{a=a||u}}}r(a)})}[Dr](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.dmode,r=this[De](String(e.absolute),i);if(r){this[T](r,e),t();return}if(e.mtime&&!this.noMtime)try{m.default.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[Lt](e))try{m.default.chownSync(String(e.absolute),Number(this[At](e)),Number(this[It](e)))}catch{}t(),e.resume()}[De](e,t){try{return(0,oo.mkdirSync)((0,U.normalizeWindowsPath)(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t})}catch(i){return i}}[Mt](e,t,i,r,n){if(this.preservePaths||!i.length)return r();let o=t;for(let a of i){o=g.default.resolve(o,a);let[h,l]=Nt(()=>m.default.lstatSync(o));if(h)return r();if(l.isSymbolicLink())return n(new ao.SymlinkError(o,g.default.resolve(t,i.join("/"))))}r()}[Wi](e,t,i,r){let n=`${i}Sync`;try{m.default[n](t,String(e.absolute)),r(),e.resume()}catch(o){return this[T](o,e)}}};z.UnpackSync=Nr});var Ar=d(G=>{"use strict";var nl=G&&G.__createBinding||(Object.create?(function(s,e,t,i){i===void 0&&(i=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,i,r)}):(function(s,e,t,i){i===void 0&&(i=t),s[i]=e[t]})),ol=G&&G.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),al=G&&G.__importStar||(function(){var s=function(e){return s=Object.getOwnPropertyNames||function(t){var i=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[i.length]=r);return i},s(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i=s(e),r=0;r{let e=new Zi.UnpackSync(s),t=s.file,i=lo.default.statSync(t),r=s.maxReadSize||16*1024*1024;new ho.ReadStreamSync(t,{readSize:r,size:i.size}).pipe(e)},fl=(s,e)=>{let t=new Zi.Unpack(s),i=s.maxReadSize||16*1024*1024,r=s.file;return new Promise((o,a)=>{t.on("error",a),t.on("close",o),lo.default.stat(r,(h,l)=>{if(h)a(h);else{let u=new ho.ReadStream(r,{readSize:i,size:l.size});u.on("error",a),u.pipe(t)}})})};G.extract=(0,ul.makeCommand)(cl,fl,s=>new Zi.UnpackSync(s),s=>new Zi.Unpack(s),(s,e)=>{e?.length&&(0,ll.filesFilter)(s,e)})});var Gi=d(ct=>{"use strict";var uo=ct&&ct.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ct,"__esModule",{value:!0});ct.replace=void 0;var co=Ke(),q=uo(require("node:fs")),fo=uo(require("node:path")),mo=Je(),po=st(),dl=Ve(),ml=Vt(),_o=Ai(),pl=(s,e)=>{let t=new _o.PackSync(s),i=!0,r,n;try{try{r=q.default.openSync(s.file,"r+")}catch(h){if(h?.code==="ENOENT")r=q.default.openSync(s.file,"w+");else throw h}let o=q.default.fstatSync(r),a=Buffer.alloc(512);e:for(n=0;no.size)break;n+=l,s.mtimeCache&&h.mtime&&s.mtimeCache.set(String(h.path),h.mtime)}i=!1,_l(s,t,n,r,e)}finally{if(i)try{q.default.closeSync(r)}catch{}}},_l=(s,e,t,i,r)=>{let n=new co.WriteStreamSync(s.file,{fd:i,start:t});e.pipe(n),yl(e,r)},wl=(s,e)=>{e=Array.from(e);let t=new _o.Pack(s),i=(n,o,a)=>{let h=(D,A)=>{D?q.default.close(n,w=>a(D)):a(null,A)},l=0;if(o===0)return h(null,0);let u=0,c=Buffer.alloc(512),E=(D,A)=>{if(D||typeof A>"u")return h(D);if(u+=A,u<512&&A)return q.default.read(n,c,u,c.length-u,l+u,E);if(l===0&&c[0]===31&&c[1]===139)return h(new Error("cannot append to compressed archives"));if(u<512)return h(null,l);let w=new mo.Header(c);if(!w.cksumValid)return h(null,l);let P=512*Math.ceil((w.size??0)/512);if(l+P+512>o||(l+=P+512,l>=o))return h(null,l);s.mtimeCache&&w.mtime&&s.mtimeCache.set(String(w.path),w.mtime),u=0,q.default.read(n,c,0,512,l,E)};q.default.read(n,c,0,512,l,E)};return new Promise((n,o)=>{t.on("error",o);let a="r+",h=(l,u)=>{if(l&&l.code==="ENOENT"&&a==="r+")return a="w+",q.default.open(s.file,a,h);if(l||!u)return o(l);q.default.fstat(u,(c,E)=>{if(c)return q.default.close(u,()=>o(c));i(u,E.size,(D,A)=>{if(D)return o(D);let w=new co.WriteStream(s.file,{fd:u,start:A});t.pipe(w),w.on("error",o),w.on("close",n),El(t,e)})})};q.default.open(s.file,a,h)})},yl=(s,e)=>{e.forEach(t=>{t.charAt(0)==="@"?(0,po.list)({file:fo.default.resolve(s.cwd,t.slice(1)),sync:!0,noResume:!0,onReadEntry:i=>s.add(i)}):s.add(t)}),s.end()},El=async(s,e)=>{for(let t=0;ts.add(r)}):s.add(i)}s.end()};ct.replace=(0,dl.makeCommand)(pl,wl,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(s,e)=>{if(!(0,ml.isFile)(s))throw new TypeError("file is required");if(s.gzip||s.brotli||s.zstd||s.file.endsWith(".br")||s.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!e?.length)throw new TypeError("no paths specified to add/replace")})});var Ir=d(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.update=void 0;var bl=Ve(),Bt=Gi();Yi.update=(0,bl.makeCommand)(Bt.replace.syncFile,Bt.replace.asyncFile,Bt.replace.syncNoFile,Bt.replace.asyncNoFile,(s,e=[])=>{Bt.replace.validate?.(s,e),Sl(s)});var Sl=s=>{let e=s.filter;s.mtimeCache||(s.mtimeCache=new Map),s.filter=e?(t,i)=>e(t,i)&&!((s.mtimeCache?.get(t)??i.mtime??0)>(i.mtime??0)):(t,i)=>!((s.mtimeCache?.get(t)??i.mtime??0)>(i.mtime??0))}});var wo=exports&&exports.__createBinding||(Object.create?(function(s,e,t,i){i===void 0&&(i=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,i,r)}):(function(s,e,t,i){i===void 0&&(i=t),s[i]=e[t]})),gl=exports&&exports.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),Y=exports&&exports.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&wo(e,s,t)},Rl=exports&&exports.__importStar||(function(){var s=function(e){return s=Object.getOwnPropertyNames||function(t){var i=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[i.length]=r);return i},s(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i=s(e),r=0;r\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe {\n src: Minipass\n dest: Minipass\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = er => dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable = Iterable & AsyncIterable\n\n type EventArguments = Record\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events = Minipass.Events\n >\n extends EventEmitter\n implements Minipass.DualIterable\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options]\n : [Minipass.Options])\n ) {\n const options: Minipass.Options = (args[0] ||\n {}) as Minipass.Options\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this as Minipass, dest, opts)\n : new PipeProxyErrors(this as Minipass, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n", "import EE from 'events'\nimport fs from 'fs'\nimport { Minipass } from 'minipass'\n\nconst writev = fs.writev\n\nconst _autoClose = Symbol('_autoClose')\nconst _close = Symbol('_close')\nconst _ended = Symbol('_ended')\nconst _fd = Symbol('_fd')\nconst _finished = Symbol('_finished')\nconst _flags = Symbol('_flags')\nconst _flush = Symbol('_flush')\nconst _handleChunk = Symbol('_handleChunk')\nconst _makeBuf = Symbol('_makeBuf')\nconst _mode = Symbol('_mode')\nconst _needDrain = Symbol('_needDrain')\nconst _onerror = Symbol('_onerror')\nconst _onopen = Symbol('_onopen')\nconst _onread = Symbol('_onread')\nconst _onwrite = Symbol('_onwrite')\nconst _open = Symbol('_open')\nconst _path = Symbol('_path')\nconst _pos = Symbol('_pos')\nconst _queue = Symbol('_queue')\nconst _read = Symbol('_read')\nconst _readSize = Symbol('_readSize')\nconst _reading = Symbol('_reading')\nconst _remain = Symbol('_remain')\nconst _size = Symbol('_size')\nconst _write = Symbol('_write')\nconst _writing = Symbol('_writing')\nconst _defaultFlag = Symbol('_defaultFlag')\nconst _errored = Symbol('_errored')\n\nexport type ReadStreamOptions =\n Minipass.Options & {\n fd?: number\n readSize?: number\n size?: number\n autoClose?: boolean\n }\n\nexport type ReadStreamEvents = Minipass.Events & {\n open: [fd: number]\n}\n\nexport class ReadStream extends Minipass<\n Minipass.ContiguousData,\n Buffer,\n ReadStreamEvents\n> {\n [_errored]: boolean = false;\n [_fd]?: number;\n [_path]: string;\n [_readSize]: number;\n [_reading]: boolean = false;\n [_size]: number;\n [_remain]: number;\n [_autoClose]: boolean\n\n constructor(path: string, opt: ReadStreamOptions) {\n opt = opt || {}\n super(opt)\n\n this.readable = true\n this.writable = false\n\n if (typeof path !== 'string') {\n throw new TypeError('path must be a string')\n }\n\n this[_errored] = false\n this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined\n this[_path] = path\n this[_readSize] = opt.readSize || 16 * 1024 * 1024\n this[_reading] = false\n this[_size] = typeof opt.size === 'number' ? opt.size : Infinity\n this[_remain] = this[_size]\n this[_autoClose] =\n typeof opt.autoClose === 'boolean' ? opt.autoClose : true\n\n if (typeof this[_fd] === 'number') {\n this[_read]()\n } else {\n this[_open]()\n }\n }\n\n get fd() {\n return this[_fd]\n }\n\n get path() {\n return this[_path]\n }\n\n //@ts-ignore\n write() {\n throw new TypeError('this is a readable stream')\n }\n\n //@ts-ignore\n end() {\n throw new TypeError('this is a readable stream')\n }\n\n [_open]() {\n fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd))\n }\n\n [_onopen](er?: NodeJS.ErrnoException | null, fd?: number) {\n if (er) {\n this[_onerror](er)\n } else {\n this[_fd] = fd\n this.emit('open', fd as number)\n this[_read]()\n }\n }\n\n [_makeBuf]() {\n return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain]))\n }\n\n [_read]() {\n if (!this[_reading]) {\n this[_reading] = true\n const buf = this[_makeBuf]()\n /* c8 ignore start */\n if (buf.length === 0) {\n return process.nextTick(() => this[_onread](null, 0, buf))\n }\n /* c8 ignore stop */\n fs.read(this[_fd] as number, buf, 0, buf.length, null, (er, br, b) =>\n this[_onread](er, br, b),\n )\n }\n }\n\n [_onread](er?: NodeJS.ErrnoException | null, br?: number, buf?: Buffer) {\n this[_reading] = false\n if (er) {\n this[_onerror](er)\n } else if (this[_handleChunk](br as number, buf as Buffer)) {\n this[_read]()\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.close(fd, er =>\n er ? this.emit('error', er) : this.emit('close'),\n )\n }\n }\n\n [_onerror](er: NodeJS.ErrnoException) {\n this[_reading] = true\n this[_close]()\n this.emit('error', er)\n }\n\n [_handleChunk](br: number, buf: Buffer) {\n let ret = false\n // no effect if infinite\n this[_remain] -= br\n if (br > 0) {\n ret = super.write(br < buf.length ? buf.subarray(0, br) : buf)\n }\n\n if (br === 0 || this[_remain] <= 0) {\n ret = false\n this[_close]()\n super.end()\n }\n\n return ret\n }\n\n emit(\n ev: Event,\n ...args: ReadStreamEvents[Event]\n ): boolean {\n switch (ev) {\n case 'prefinish':\n case 'finish':\n return false\n\n case 'drain':\n if (typeof this[_fd] === 'number') {\n this[_read]()\n }\n return false\n\n case 'error':\n if (this[_errored]) {\n return false\n }\n this[_errored] = true\n return super.emit(ev, ...args)\n\n default:\n return super.emit(ev, ...args)\n }\n }\n}\n\nexport class ReadStreamSync extends ReadStream {\n [_open]() {\n let threw = true\n try {\n this[_onopen](null, fs.openSync(this[_path], 'r'))\n threw = false\n } finally {\n if (threw) {\n this[_close]()\n }\n }\n }\n\n [_read]() {\n let threw = true\n try {\n if (!this[_reading]) {\n this[_reading] = true\n do {\n const buf = this[_makeBuf]()\n /* c8 ignore start */\n const br =\n buf.length === 0\n ? 0\n : fs.readSync(this[_fd] as number, buf, 0, buf.length, null)\n /* c8 ignore stop */\n if (!this[_handleChunk](br, buf)) {\n break\n }\n } while (true)\n this[_reading] = false\n }\n threw = false\n } finally {\n if (threw) {\n this[_close]()\n }\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.closeSync(fd)\n this.emit('close')\n }\n }\n}\n\nexport type WriteStreamOptions = {\n fd?: number\n autoClose?: boolean\n mode?: number\n captureRejections?: boolean\n start?: number\n flags?: string\n}\n\nexport class WriteStream extends EE {\n readable: false = false\n writable: boolean = true;\n [_errored]: boolean = false;\n [_writing]: boolean = false;\n [_ended]: boolean = false;\n [_queue]: Buffer[] = [];\n [_needDrain]: boolean = false;\n [_path]: string;\n [_mode]: number;\n [_autoClose]: boolean;\n [_fd]?: number;\n [_defaultFlag]: boolean;\n [_flags]: string;\n [_finished]: boolean = false;\n [_pos]?: number\n\n constructor(path: string, opt: WriteStreamOptions) {\n opt = opt || {}\n super(opt)\n this[_path] = path\n this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined\n this[_mode] = opt.mode === undefined ? 0o666 : opt.mode\n this[_pos] = typeof opt.start === 'number' ? opt.start : undefined\n this[_autoClose] =\n typeof opt.autoClose === 'boolean' ? opt.autoClose : true\n\n // truncating makes no sense when writing into the middle\n const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w'\n this[_defaultFlag] = opt.flags === undefined\n this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags\n\n if (this[_fd] === undefined) {\n this[_open]()\n }\n }\n\n emit(ev: string, ...args: any[]) {\n if (ev === 'error') {\n if (this[_errored]) {\n return false\n }\n this[_errored] = true\n }\n return super.emit(ev, ...args)\n }\n\n get fd() {\n return this[_fd]\n }\n\n get path() {\n return this[_path]\n }\n\n [_onerror](er: NodeJS.ErrnoException) {\n this[_close]()\n this[_writing] = true\n this.emit('error', er)\n }\n\n [_open]() {\n fs.open(this[_path], this[_flags], this[_mode], (er, fd) =>\n this[_onopen](er, fd),\n )\n }\n\n [_onopen](er?: null | NodeJS.ErrnoException, fd?: number) {\n if (\n this[_defaultFlag] &&\n this[_flags] === 'r+' &&\n er &&\n er.code === 'ENOENT'\n ) {\n this[_flags] = 'w'\n this[_open]()\n } else if (er) {\n this[_onerror](er)\n } else {\n this[_fd] = fd\n this.emit('open', fd)\n if (!this[_writing]) {\n this[_flush]()\n }\n }\n }\n\n end(buf: string, enc?: BufferEncoding): this\n end(buf?: Buffer, enc?: undefined): this\n end(buf?: Buffer | string, enc?: BufferEncoding): this {\n if (buf) {\n //@ts-ignore\n this.write(buf, enc)\n }\n\n this[_ended] = true\n\n // synthetic after-write logic, where drain/finish live\n if (\n !this[_writing] &&\n !this[_queue].length &&\n typeof this[_fd] === 'number'\n ) {\n this[_onwrite](null, 0)\n }\n return this\n }\n\n write(buf: string, enc?: BufferEncoding): boolean\n write(buf: Buffer, enc?: undefined): boolean\n write(buf: Buffer | string, enc?: BufferEncoding): boolean {\n if (typeof buf === 'string') {\n buf = Buffer.from(buf, enc)\n }\n\n if (this[_ended]) {\n this.emit('error', new Error('write() after end()'))\n return false\n }\n\n if (this[_fd] === undefined || this[_writing] || this[_queue].length) {\n this[_queue].push(buf)\n this[_needDrain] = true\n return false\n }\n\n this[_writing] = true\n this[_write](buf)\n return true\n }\n\n [_write](buf: Buffer) {\n fs.write(\n this[_fd] as number,\n buf,\n 0,\n buf.length,\n this[_pos],\n (er, bw) => this[_onwrite](er, bw),\n )\n }\n\n [_onwrite](er?: null | NodeJS.ErrnoException, bw?: number) {\n if (er) {\n this[_onerror](er)\n } else {\n if (this[_pos] !== undefined && typeof bw === 'number') {\n this[_pos] += bw\n }\n if (this[_queue].length) {\n this[_flush]()\n } else {\n this[_writing] = false\n\n if (this[_ended] && !this[_finished]) {\n this[_finished] = true\n this[_close]()\n this.emit('finish')\n } else if (this[_needDrain]) {\n this[_needDrain] = false\n this.emit('drain')\n }\n }\n }\n }\n\n [_flush]() {\n if (this[_queue].length === 0) {\n if (this[_ended]) {\n this[_onwrite](null, 0)\n }\n } else if (this[_queue].length === 1) {\n this[_write](this[_queue].pop() as Buffer)\n } else {\n const iovec = this[_queue]\n this[_queue] = []\n writev(this[_fd] as number, iovec, this[_pos] as number, (er, bw) =>\n this[_onwrite](er, bw),\n )\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.close(fd, er =>\n er ? this.emit('error', er) : this.emit('close'),\n )\n }\n }\n}\n\nexport class WriteStreamSync extends WriteStream {\n [_open](): void {\n let fd\n // only wrap in a try{} block if we know we'll retry, to avoid\n // the rethrow obscuring the error's source frame in most cases.\n if (this[_defaultFlag] && this[_flags] === 'r+') {\n try {\n fd = fs.openSync(this[_path], this[_flags], this[_mode])\n } catch (er) {\n if ((er as NodeJS.ErrnoException)?.code === 'ENOENT') {\n this[_flags] = 'w'\n return this[_open]()\n } else {\n throw er\n }\n }\n } else {\n fd = fs.openSync(this[_path], this[_flags], this[_mode])\n }\n\n this[_onopen](null, fd)\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.closeSync(fd)\n this.emit('close')\n }\n }\n\n [_write](buf: Buffer) {\n // throw the original, but try to close if it fails\n let threw = true\n try {\n this[_onwrite](\n null,\n fs.writeSync(this[_fd] as number, buf, 0, buf.length, this[_pos]),\n )\n threw = false\n } finally {\n if (threw) {\n try {\n this[_close]()\n } catch {\n // ok error\n }\n }\n }\n }\n}\n", "// turn tar(1) style args like `C` into the more verbose things like `cwd`\n\nimport { type GzipOptions, type ZlibOptions } from 'minizlib'\nimport { type Stats } from 'node:fs'\nimport { type ReadEntry } from './read-entry.js'\nimport { type WarnData } from './warn-method.js'\nimport { WriteEntry } from './write-entry.js'\n\nconst argmap = new Map(\n [\n ['C', 'cwd'],\n ['f', 'file'],\n ['z', 'gzip'],\n ['P', 'preservePaths'],\n ['U', 'unlink'],\n ['strip-components', 'strip'],\n ['stripComponents', 'strip'],\n ['keep-newer', 'newer'],\n ['keepNewer', 'newer'],\n ['keep-newer-files', 'newer'],\n ['keepNewerFiles', 'newer'],\n ['k', 'keep'],\n ['keep-existing', 'keep'],\n ['keepExisting', 'keep'],\n ['m', 'noMtime'],\n ['no-mtime', 'noMtime'],\n ['p', 'preserveOwner'],\n ['L', 'follow'],\n ['h', 'follow'],\n ['onentry', 'onReadEntry'],\n ],\n)\n\n/**\n * The options that can be provided to tar commands.\n *\n * Note that some of these are only relevant for certain commands, since\n * they are specific to reading or writing.\n *\n * Aliases are provided in the {@link TarOptionsWithAliases} type.\n */\nexport interface TarOptions {\n //////////////////////////\n // shared options\n\n /**\n * Perform all I/O operations synchronously. If the stream is ended\n * immediately, then it will be processed entirely synchronously.\n */\n sync?: boolean\n\n /**\n * The tar file to be read and/or written. When this is set, a stream\n * is not returned. Asynchronous commands will return a promise indicating\n * when the operation is completed, and synchronous commands will return\n * immediately.\n */\n file?: string\n\n /**\n * Treat warnings as crash-worthy errors. Defaults false.\n */\n strict?: boolean\n\n /**\n * The effective current working directory for this tar command\n */\n cwd?: string\n\n /**\n * When creating a tar archive, this can be used to compress it as well.\n * Set to `true` to use the default gzip options, or customize them as\n * needed.\n *\n * When reading, if this is unset, then the compression status will be\n * inferred from the archive data. This is generally best, unless you are\n * sure of the compression settings in use to create the archive, and want to\n * fail if the archive doesn't match expectations.\n */\n gzip?: boolean | GzipOptions\n\n /**\n * When creating archives, preserve absolute and `..` paths in the archive,\n * rather than sanitizing them under the cwd.\n *\n * When extracting, allow absolute paths, paths containing `..`, and\n * extracting through symbolic links. By default, the root `/` is stripped\n * from absolute paths (eg, turning `/x/y/z` into `x/y/z`), paths containing\n * `..` are not extracted, and any file whose location would be modified by a\n * symbolic link is not extracted.\n *\n * **WARNING** This is almost always unsafe, and must NEVER be used on\n * archives from untrusted sources, such as user input, and every entry must\n * be validated to ensure it is safe to write. Even if the input is not\n * malicious, mistakes can cause a lot of damage!\n */\n preservePaths?: boolean\n\n /**\n * When extracting, do not set the `mtime` value for extracted entries to\n * match the `mtime` in the archive.\n *\n * When creating archives, do not store the `mtime` value in the entry. Note\n * that this prevents properly using other mtime-based features (such as\n * `tar.update` or the `newer` option) with the resulting archive.\n */\n noMtime?: boolean\n\n /**\n * Set to `true` or an object with settings for `zlib.BrotliCompress()` to\n * create a brotli-compressed archive\n *\n * When extracting, this will cause the archive to be treated as a\n * brotli-compressed file if set to `true` or a ZlibOptions object.\n *\n * If set `false`, then brotli options will not be used.\n *\n * If this, the `gzip`, and `zstd` options are left `undefined`, then tar\n * will attempt to infer the brotli compression status, but can only do so\n * based on the filename. If the filename ends in `.tbr` or `.tar.br`, and\n * the first 512 bytes are not a valid tar header, then brotli decompression\n * will be attempted.\n */\n brotli?: boolean | ZlibOptions\n\n /**\n * Set to `true` or an object with settings for `zstd.compress()` to\n * create a zstd-compressed archive\n *\n * When extracting, this will cause the archive to be treated as a\n * zstd-compressed file if set to `true` or a ZlibOptions object.\n *\n * If set `false`, then zstd options will not be used.\n *\n * If this, the `gzip`, and `brotli` options are left `undefined`, then tar\n * will attempt to infer the zstd compression status, but can only do so\n * based on the filename. If the filename ends in `.tzst` or `.tar.zst`, and\n * the first 512 bytes are not a valid tar header, then zstd decompression\n * will be attempted.\n */\n zstd?: boolean | ZlibOptions\n\n /**\n * A function that is called with `(path, stat)` when creating an archive, or\n * `(path, entry)` when extracting. Return true to process the file/entry, or\n * false to exclude it.\n */\n filter?: (path: string, entry: Stats | ReadEntry) => boolean\n\n /**\n * A function that gets called for any warning encountered.\n *\n * Note: if `strict` is set, then the warning will throw, and this method\n * will not be called.\n */\n onwarn?: (code: string, message: string, data: WarnData) => any\n\n //////////////////////////\n // extraction options\n\n /**\n * When extracting, unlink files before creating them. Without this option,\n * tar overwrites existing files, which preserves existing hardlinks. With\n * this option, existing hardlinks will be broken, as will any symlink that\n * would affect the location of an extracted file.\n */\n unlink?: boolean\n\n /**\n * When extracting, strip the specified number of path portions from the\n * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be\n * extracted to `{cwd}/c/d`.\n *\n * Any entry whose entire path is stripped will be excluded.\n */\n strip?: number\n\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n newer?: boolean\n\n /**\n * When extracting, do not overwrite existing files at all.\n */\n keep?: boolean\n\n /**\n * When extracting, set the `uid` and `gid` of extracted entries to the `uid`\n * and `gid` fields in the archive. Defaults to true when run as root, and\n * false otherwise.\n *\n * If false, then files and directories will be set with the owner and group\n * of the user running the process. This is similar to `-p` in `tar(1)`, but\n * ACLs and other system-specific data is never unpacked in this\n * implementation, and modes are set by default already.\n */\n preserveOwner?: boolean\n\n /**\n * The maximum depth of subfolders to extract into. This defaults to 1024.\n * Anything deeper than the limit will raise a warning and skip the entry.\n * Set to `Infinity` to remove the limitation.\n */\n maxDepth?: number\n\n /**\n * When extracting, force all created files and directories, and all\n * implicitly created directories, to be owned by the specified user id,\n * regardless of the `uid` field in the archive.\n *\n * Cannot be used along with `preserveOwner`. Requires also setting the `gid`\n * option.\n */\n uid?: number\n\n /**\n * When extracting, force all created files and directories, and all\n * implicitly created directories, to be owned by the specified group id,\n * regardless of the `gid` field in the archive.\n *\n * Cannot be used along with `preserveOwner`. Requires also setting the `uid`\n * option.\n */\n gid?: number\n\n /**\n * When extracting, provide a function that takes an `entry` object, and\n * returns a stream, or any falsey value. If a stream is provided, then that\n * stream's data will be written instead of the contents of the archive\n * entry. If a falsey value is provided, then the entry is written to disk as\n * normal.\n *\n * To exclude items from extraction, use the `filter` option.\n *\n * Note that using an asynchronous stream type with the `transform` option\n * will cause undefined behavior in synchronous extractions.\n * [MiniPass](http://npm.im/minipass)-based streams are designed for this use\n * case.\n */\n transform?: (entry: ReadEntry) => any\n\n /**\n * Call `chmod()` to ensure that extracted files match the entry's mode\n * field. Without this field set, all mode fields in archive entries are a\n * best effort attempt only.\n *\n * Setting this necessitates a call to the deprecated `process.umask()`\n * method to determine the default umask value, unless a `processUmask`\n * config is provided as well.\n *\n * If not set, tar will attempt to create file system entries with whatever\n * mode is provided, and let the implicit process `umask` apply normally, but\n * if a file already exists to be written to, then its existing mode will not\n * be modified.\n *\n * When setting `chmod: true`, it is highly recommend to set the\n * {@link TarOptions#processUmask} option as well, to avoid the call to the\n * deprecated (and thread-unsafe) `process.umask()` method.\n */\n chmod?: boolean\n\n /**\n * When setting the {@link TarOptions#chmod} option to `true`, you may\n * provide a value here to avoid having to call the deprecated and\n * thread-unsafe `process.umask()` method.\n *\n * This has no effect with `chmod` is not set to true, as mode values are not\n * set explicitly anyway. If `chmod` is set to `true`, and a value is not\n * provided here, then `process.umask()` must be called, which will result in\n * deprecation warnings.\n *\n * The most common values for this are `0o22` (resulting in directories\n * created with mode `0o755` and files with `0o644` by default) and `0o2`\n * (resulting in directores created with mode `0o775` and files `0o664`, so\n * they are group-writable).\n */\n processUmask?: number\n\n //////////////////////////\n // archive creation options\n\n /**\n * When parsing/listing archives, `entry` streams are by default resumed\n * (set into \"flowing\" mode) immediately after the call to `onReadEntry()`.\n * Set `noResume: true` to suppress this behavior.\n *\n * Note that when this is set, the stream will never complete until the\n * data is consumed somehow.\n *\n * Set automatically in extract operations, since the entry is piped to\n * a file system entry right away. Only relevant when parsing.\n */\n noResume?: boolean\n\n /**\n * When creating, updating, or replacing within archives, this method will\n * be called with each WriteEntry that is created.\n */\n onWriteEntry?: (entry: WriteEntry) => any\n\n /**\n * When extracting or listing archives, this method will be called with\n * each entry that is not excluded by a `filter`.\n *\n * Important when listing archives synchronously from a file, because there\n * is otherwise no way to interact with the data!\n */\n onReadEntry?: (entry: ReadEntry) => any\n\n /**\n * Pack the targets of symbolic links rather than the link itself.\n */\n follow?: boolean\n\n /**\n * When creating archives, omit any metadata that is system-specific:\n * `ctime`, `atime`, `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and\n * `nlink`. Note that `mtime` is still included, because this is necessary\n * for other time-based operations such as `tar.update`. Additionally, `mode`\n * is set to a \"reasonable default\" for mose unix systems, based on an\n * effective `umask` of `0o22`.\n *\n * This also defaults the `portable` option in the gzip configs when creating\n * a compressed archive, in order to produce deterministic archives that are\n * not operating-system specific.\n */\n portable?: boolean\n\n /**\n * When creating archives, do not recursively archive the contents of\n * directories. By default, archiving a directory archives all of its\n * contents as well.\n */\n noDirRecurse?: boolean\n\n /**\n * Suppress Pax extended headers when creating archives. Note that this means\n * long paths and linkpaths will be truncated, and large or negative numeric\n * values may be interpreted incorrectly.\n */\n noPax?: boolean\n\n /**\n * Set to a `Date` object to force a specific `mtime` value for everything\n * written to an archive.\n *\n * This is useful when creating archives that are intended to be\n * deterministic based on their contents, irrespective of the file's last\n * modification time.\n *\n * Overridden by `noMtime`.\n */\n mtime?: Date\n\n /**\n * A path portion to prefix onto the entries added to an archive.\n */\n prefix?: string\n\n /**\n * The mode to set on any created file archive, defaults to 0o666\n * masked by the process umask, often resulting in 0o644.\n *\n * This does *not* affect the mode fields of individual entries, or the\n * mode status of extracted entries on the filesystem.\n */\n mode?: number\n\n //////////////////////////\n // internal options\n\n /**\n * A cache of mtime values, to avoid having to stat the same file repeatedly.\n *\n * @internal\n */\n mtimeCache?: Map\n\n /**\n * maximum buffer size for `fs.read()` operations.\n *\n * @internal\n */\n maxReadSize?: number\n\n /**\n * Filter modes of entries being unpacked, like `process.umask()`\n *\n * @internal\n */\n umask?: number\n\n /**\n * Default mode for directories. Used for all implicitly created directories,\n * and any directories in the archive that do not have a mode field.\n *\n * @internal\n */\n dmode?: number\n\n /**\n * default mode for files\n *\n * @internal\n */\n fmode?: number\n\n /**\n * Map that tracks which directories already exist, for extraction\n *\n * @internal\n */\n dirCache?: Map\n /**\n * maximum supported size of meta entries. Defaults to 1MB\n *\n * @internal\n */\n maxMetaEntrySize?: number\n\n /**\n * A Map object containing the device and inode value for any file whose\n * `nlink` value is greater than 1, to identify hard links when creating\n * archives.\n *\n * @internal\n */\n linkCache?: Map\n\n /**\n * A map object containing the results of `fs.readdir()` calls.\n *\n * @internal\n */\n readdirCache?: Map\n\n /**\n * A cache of all `lstat` results, for use in creating archives.\n *\n * @internal\n */\n statCache?: Map\n\n /**\n * Number of concurrent jobs to run when creating archives.\n *\n * Defaults to 4.\n *\n * @internal\n */\n jobs?: number\n\n /**\n * Automatically set to true on Windows systems.\n *\n * When extracting, causes behavior where filenames containing `<|>?:`\n * characters are converted to windows-compatible escape sequences in the\n * created filesystem entries.\n *\n * When packing, causes behavior where paths replace `\\` with `/`, and\n * filenames containing the windows-compatible escaped forms of `<|>?:` are\n * converted to actual `<|>?:` characters in the archive.\n *\n * @internal\n */\n win32?: boolean\n\n /**\n * For `WriteEntry` objects, the absolute path to the entry on the\n * filesystem. By default, this is `resolve(cwd, entry.path)`, but it can be\n * overridden explicitly.\n *\n * @internal\n */\n absolute?: string\n\n /**\n * Used with Parser stream interface, to attach and take over when the\n * stream is completely parsed. If this is set, then the prefinish,\n * finish, and end events will not fire, and are the responsibility of\n * the ondone method to emit properly.\n *\n * @internal\n */\n ondone?: () => void\n\n /**\n * Mostly for testing, but potentially useful in some cases.\n * Forcibly trigger a chown on every entry, no matter what.\n */\n forceChown?: boolean\n\n /**\n * ambiguous deprecated name for {@link onReadEntry}\n *\n * @deprecated\n */\n onentry?: (entry: ReadEntry) => any\n}\n\nexport type TarOptionsSync = TarOptions & { sync: true }\nexport type TarOptionsAsync = TarOptions & { sync?: false }\nexport type TarOptionsFile = TarOptions & { file: string }\nexport type TarOptionsNoFile = TarOptions & { file?: undefined }\nexport type TarOptionsSyncFile = TarOptionsSync & TarOptionsFile\nexport type TarOptionsAsyncFile = TarOptionsAsync & TarOptionsFile\nexport type TarOptionsSyncNoFile = TarOptionsSync & TarOptionsNoFile\nexport type TarOptionsAsyncNoFile = TarOptionsAsync & TarOptionsNoFile\n\nexport type LinkCacheKey = `${number}:${number}`\n\nexport interface TarOptionsWithAliases extends TarOptions {\n /**\n * The effective current working directory for this tar command\n */\n C?: TarOptions['cwd']\n /**\n * The tar file to be read and/or written. When this is set, a stream\n * is not returned. Asynchronous commands will return a promise indicating\n * when the operation is completed, and synchronous commands will return\n * immediately.\n */\n f?: TarOptions['file']\n /**\n * When creating a tar archive, this can be used to compress it as well.\n * Set to `true` to use the default gzip options, or customize them as\n * needed.\n *\n * When reading, if this is unset, then the compression status will be\n * inferred from the archive data. This is generally best, unless you are\n * sure of the compression settings in use to create the archive, and want to\n * fail if the archive doesn't match expectations.\n */\n z?: TarOptions['gzip']\n /**\n * When creating archives, preserve absolute and `..` paths in the archive,\n * rather than sanitizing them under the cwd.\n *\n * When extracting, allow absolute paths, paths containing `..`, and\n * extracting through symbolic links. By default, the root `/` is stripped\n * from absolute paths (eg, turning `/x/y/z` into `x/y/z`), paths containing\n * `..` are not extracted, and any file whose location would be modified by a\n * symbolic link is not extracted.\n *\n * **WARNING** This is almost always unsafe, and must NEVER be used on\n * archives from untrusted sources, such as user input, and every entry must\n * be validated to ensure it is safe to write. Even if the input is not\n * malicious, mistakes can cause a lot of damage!\n */\n P?: TarOptions['preservePaths']\n /**\n * When extracting, unlink files before creating them. Without this option,\n * tar overwrites existing files, which preserves existing hardlinks. With\n * this option, existing hardlinks will be broken, as will any symlink that\n * would affect the location of an extracted file.\n */\n U?: TarOptions['unlink']\n /**\n * When extracting, strip the specified number of path portions from the\n * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be\n * extracted to `{cwd}/c/d`.\n */\n 'strip-components'?: TarOptions['strip']\n /**\n * When extracting, strip the specified number of path portions from the\n * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be\n * extracted to `{cwd}/c/d`.\n */\n stripComponents?: TarOptions['strip']\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n 'keep-newer'?: TarOptions['newer']\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n keepNewer?: TarOptions['newer']\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n 'keep-newer-files'?: TarOptions['newer']\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n keepNewerFiles?: TarOptions['newer']\n /**\n * When extracting, do not overwrite existing files at all.\n */\n k?: TarOptions['keep']\n /**\n * When extracting, do not overwrite existing files at all.\n */\n 'keep-existing'?: TarOptions['keep']\n /**\n * When extracting, do not overwrite existing files at all.\n */\n keepExisting?: TarOptions['keep']\n /**\n * When extracting, do not set the `mtime` value for extracted entries to\n * match the `mtime` in the archive.\n *\n * When creating archives, do not store the `mtime` value in the entry. Note\n * that this prevents properly using other mtime-based features (such as\n * `tar.update` or the `newer` option) with the resulting archive.\n */\n m?: TarOptions['noMtime']\n /**\n * When extracting, do not set the `mtime` value for extracted entries to\n * match the `mtime` in the archive.\n *\n * When creating archives, do not store the `mtime` value in the entry. Note\n * that this prevents properly using other mtime-based features (such as\n * `tar.update` or the `newer` option) with the resulting archive.\n */\n 'no-mtime'?: TarOptions['noMtime']\n /**\n * When extracting, set the `uid` and `gid` of extracted entries to the `uid`\n * and `gid` fields in the archive. Defaults to true when run as root, and\n * false otherwise.\n *\n * If false, then files and directories will be set with the owner and group\n * of the user running the process. This is similar to `-p` in `tar(1)`, but\n * ACLs and other system-specific data is never unpacked in this\n * implementation, and modes are set by default already.\n */\n p?: TarOptions['preserveOwner']\n /**\n * Pack the targets of symbolic links rather than the link itself.\n */\n L?: TarOptions['follow']\n /**\n * Pack the targets of symbolic links rather than the link itself.\n */\n h?: TarOptions['follow']\n\n /**\n * Deprecated option. Set explicitly false to set `chmod: true`. Ignored\n * if {@link TarOptions#chmod} is set to any boolean value.\n *\n * @deprecated\n */\n noChmod?: boolean\n}\n\nexport type TarOptionsWithAliasesSync = TarOptionsWithAliases & {\n sync: true\n}\nexport type TarOptionsWithAliasesAsync = TarOptionsWithAliases & {\n sync?: false\n}\nexport type TarOptionsWithAliasesFile =\n | (TarOptionsWithAliases & {\n file: string\n })\n | (TarOptionsWithAliases & { f: string })\nexport type TarOptionsWithAliasesSyncFile =\n TarOptionsWithAliasesSync & TarOptionsWithAliasesFile\nexport type TarOptionsWithAliasesAsyncFile =\n TarOptionsWithAliasesAsync & TarOptionsWithAliasesFile\n\nexport type TarOptionsWithAliasesNoFile = TarOptionsWithAliases & {\n f?: undefined\n file?: undefined\n}\n\nexport type TarOptionsWithAliasesSyncNoFile =\n TarOptionsWithAliasesSync & TarOptionsWithAliasesNoFile\nexport type TarOptionsWithAliasesAsyncNoFile =\n TarOptionsWithAliasesAsync & TarOptionsWithAliasesNoFile\n\nexport const isSyncFile = (\n o: O,\n): o is O & TarOptionsSyncFile => !!o.sync && !!o.file\nexport const isAsyncFile = (\n o: O,\n): o is O & TarOptionsAsyncFile => !o.sync && !!o.file\nexport const isSyncNoFile = (\n o: O,\n): o is O & TarOptionsSyncNoFile => !!o.sync && !o.file\nexport const isAsyncNoFile = (\n o: O,\n): o is O & TarOptionsAsyncNoFile => !o.sync && !o.file\nexport const isSync = (\n o: O,\n): o is O & TarOptionsSync => !!o.sync\nexport const isAsync = (\n o: O,\n): o is O & TarOptionsAsync => !o.sync\nexport const isFile = (\n o: O,\n): o is O & TarOptionsFile => !!o.file\nexport const isNoFile = (\n o: O,\n): o is O & TarOptionsNoFile => !o.file\n\nconst dealiasKey = (\n k: keyof TarOptionsWithAliases,\n): keyof TarOptions => {\n const d = argmap.get(k)\n if (d) return d\n return k as keyof TarOptions\n}\n\nexport const dealias = (\n opt: TarOptionsWithAliases = {},\n): TarOptions => {\n if (!opt) return {}\n const result: Record = {}\n for (const [key, v] of Object.entries(opt) as [\n keyof TarOptionsWithAliases,\n any,\n ][]) {\n // TS doesn't know that aliases are going to always be the same type\n const k = dealiasKey(key)\n result[k] = v\n }\n // affordance for deprecated noChmod -> chmod\n if (result.chmod === undefined && result.noChmod === false) {\n result.chmod = true\n }\n delete result.noChmod\n return result as TarOptions\n}\n", "import {\n dealias,\n isAsyncFile,\n isAsyncNoFile,\n isSyncFile,\n isSyncNoFile,\n TarOptions,\n TarOptionsAsyncFile,\n TarOptionsAsyncNoFile,\n TarOptionsSyncFile,\n TarOptionsSyncNoFile,\n TarOptionsWithAliases,\n TarOptionsWithAliasesAsync,\n TarOptionsWithAliasesAsyncFile,\n TarOptionsWithAliasesAsyncNoFile,\n TarOptionsWithAliasesFile,\n TarOptionsWithAliasesNoFile,\n TarOptionsWithAliasesSync,\n TarOptionsWithAliasesSyncFile,\n TarOptionsWithAliasesSyncNoFile,\n} from './options.js'\n\nexport type CB = (er?: Error) => any\n\nexport type TarCommand<\n AsyncClass,\n SyncClass extends { sync: true },\n> = {\n // async and no file specified\n (): AsyncClass\n (opt: TarOptionsWithAliasesAsyncNoFile): AsyncClass\n (entries: string[]): AsyncClass\n (\n opt: TarOptionsWithAliasesAsyncNoFile,\n entries: string[],\n ): AsyncClass\n} & {\n // sync and no file\n (opt: TarOptionsWithAliasesSyncNoFile): SyncClass\n (opt: TarOptionsWithAliasesSyncNoFile, entries: string[]): SyncClass\n} & {\n // async and file\n (opt: TarOptionsWithAliasesAsyncFile): Promise\n (\n opt: TarOptionsWithAliasesAsyncFile,\n entries: string[],\n ): Promise\n (opt: TarOptionsWithAliasesAsyncFile, cb: CB): Promise\n (\n opt: TarOptionsWithAliasesAsyncFile,\n entries: string[],\n cb: CB,\n ): Promise\n} & {\n // sync and file\n (opt: TarOptionsWithAliasesSyncFile): void\n (opt: TarOptionsWithAliasesSyncFile, entries: string[]): void\n} & {\n // sync, maybe file\n (opt: TarOptionsWithAliasesSync): typeof opt extends (\n TarOptionsWithAliasesFile\n ) ?\n void\n : typeof opt extends TarOptionsWithAliasesNoFile ? SyncClass\n : void | SyncClass\n (\n opt: TarOptionsWithAliasesSync,\n entries: string[],\n ): typeof opt extends TarOptionsWithAliasesFile ? void\n : typeof opt extends TarOptionsWithAliasesNoFile ? SyncClass\n : void | SyncClass\n} & {\n // async, maybe file\n (opt: TarOptionsWithAliasesAsync): typeof opt extends (\n TarOptionsWithAliasesFile\n ) ?\n Promise\n : typeof opt extends TarOptionsWithAliasesNoFile ? AsyncClass\n : Promise | AsyncClass\n (\n opt: TarOptionsWithAliasesAsync,\n entries: string[],\n ): typeof opt extends TarOptionsWithAliasesFile ? Promise\n : typeof opt extends TarOptionsWithAliasesNoFile ? AsyncClass\n : Promise | AsyncClass\n (opt: TarOptionsWithAliasesAsync, cb: CB): Promise\n (\n opt: TarOptionsWithAliasesAsync,\n entries: string[],\n cb: CB,\n ): typeof opt extends TarOptionsWithAliasesFile ? Promise\n : typeof opt extends TarOptionsWithAliasesNoFile ? never\n : Promise\n} & {\n // maybe sync, file\n (opt: TarOptionsWithAliasesFile): Promise | void\n (\n opt: TarOptionsWithAliasesFile,\n entries: string[],\n ): typeof opt extends TarOptionsWithAliasesSync ? void\n : typeof opt extends TarOptionsWithAliasesAsync ? Promise\n : Promise | void\n (opt: TarOptionsWithAliasesFile, cb: CB): Promise\n (\n opt: TarOptionsWithAliasesFile,\n entries: string[],\n cb: CB,\n ): typeof opt extends TarOptionsWithAliasesSync ? never\n : typeof opt extends TarOptionsWithAliasesAsync ? Promise\n : Promise\n} & {\n // maybe sync, no file\n (opt: TarOptionsWithAliasesNoFile): typeof opt extends (\n TarOptionsWithAliasesSync\n ) ?\n SyncClass\n : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass\n : SyncClass | AsyncClass\n (\n opt: TarOptionsWithAliasesNoFile,\n entries: string[],\n ): typeof opt extends TarOptionsWithAliasesSync ? SyncClass\n : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass\n : SyncClass | AsyncClass\n} & {\n // maybe sync, maybe file\n (opt: TarOptionsWithAliases): typeof opt extends (\n TarOptionsWithAliasesFile\n ) ?\n typeof opt extends TarOptionsWithAliasesSync ? void\n : typeof opt extends TarOptionsWithAliasesAsync ? Promise\n : void | Promise\n : typeof opt extends TarOptionsWithAliasesNoFile ?\n typeof opt extends TarOptionsWithAliasesSync ? SyncClass\n : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass\n : SyncClass | AsyncClass\n : typeof opt extends TarOptionsWithAliasesSync ? SyncClass | void\n : typeof opt extends TarOptionsWithAliasesAsync ?\n AsyncClass | Promise\n : SyncClass | void | AsyncClass | Promise\n} & {\n // extras\n syncFile: (opt: TarOptionsSyncFile, entries: string[]) => void\n asyncFile: (\n opt: TarOptionsAsyncFile,\n entries: string[],\n cb?: CB,\n ) => Promise\n syncNoFile: (\n opt: TarOptionsSyncNoFile,\n entries: string[],\n ) => SyncClass\n asyncNoFile: (\n opt: TarOptionsAsyncNoFile,\n entries: string[],\n ) => AsyncClass\n validate?: (opt: TarOptions, entries?: string[]) => void\n}\n\nexport const makeCommand = <\n AsyncClass,\n SyncClass extends { sync: true },\n>(\n syncFile: (opt: TarOptionsSyncFile, entries: string[]) => void,\n asyncFile: (\n opt: TarOptionsAsyncFile,\n entries: string[],\n cb?: CB,\n ) => Promise,\n syncNoFile: (\n opt: TarOptionsSyncNoFile,\n entries: string[],\n ) => SyncClass,\n asyncNoFile: (\n opt: TarOptionsAsyncNoFile,\n entries: string[],\n ) => AsyncClass,\n validate?: (opt: TarOptions, entries?: string[]) => void,\n): TarCommand => {\n return Object.assign(\n (\n opt_: TarOptionsWithAliases | string[] = [],\n entries?: string[] | CB,\n cb?: CB,\n ) => {\n if (Array.isArray(opt_)) {\n entries = opt_\n opt_ = {}\n }\n\n if (typeof entries === 'function') {\n cb = entries\n entries = undefined\n }\n\n if (!entries) {\n entries = []\n } else {\n entries = Array.from(entries)\n }\n\n const opt = dealias(opt_)\n\n validate?.(opt, entries)\n\n if (isSyncFile(opt)) {\n if (typeof cb === 'function') {\n throw new TypeError(\n 'callback not supported for sync tar functions',\n )\n }\n return syncFile(opt, entries)\n } else if (isAsyncFile(opt)) {\n const p = asyncFile(opt, entries)\n // weirdness to make TS happy\n const c = cb ? cb : undefined\n return c ? p.then(() => c(), c) : p\n } else if (isSyncNoFile(opt)) {\n if (typeof cb === 'function') {\n throw new TypeError(\n 'callback not supported for sync tar functions',\n )\n }\n return syncNoFile(opt, entries)\n } else if (isAsyncNoFile(opt)) {\n if (typeof cb === 'function') {\n throw new TypeError(\n 'callback only supported with file option',\n )\n }\n return asyncNoFile(opt, entries)\n /* c8 ignore start */\n } else {\n throw new Error('impossible options??')\n }\n /* c8 ignore stop */\n },\n {\n syncFile,\n asyncFile,\n syncNoFile,\n asyncNoFile,\n validate,\n },\n ) as TarCommand\n}\n", "// Update with any zlib constants that are added or changed in the future.\n// Node v6 didn't export this, so we just hard code the version and rely\n// on all the other hard-coded values from zlib v4736. When node v6\n// support drops, we can just export the realZlibConstants object.\nimport realZlib from 'zlib'\n/* c8 ignore start */\nconst realZlibConstants = realZlib.constants || { ZLIB_VERNUM: 4736 }\n/* c8 ignore stop */\n\nexport const constants = Object.freeze(\n Object.assign(\n Object.create(null),\n {\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n Z_VERSION_ERROR: -6,\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n DEFLATE: 1,\n INFLATE: 2,\n GZIP: 3,\n GUNZIP: 4,\n DEFLATERAW: 5,\n INFLATERAW: 6,\n UNZIP: 7,\n BROTLI_DECODE: 8,\n BROTLI_ENCODE: 9,\n Z_MIN_WINDOWBITS: 8,\n Z_MAX_WINDOWBITS: 15,\n Z_DEFAULT_WINDOWBITS: 15,\n Z_MIN_CHUNK: 64,\n Z_MAX_CHUNK: Infinity,\n Z_DEFAULT_CHUNK: 16384,\n Z_MIN_MEMLEVEL: 1,\n Z_MAX_MEMLEVEL: 9,\n Z_DEFAULT_MEMLEVEL: 8,\n Z_MIN_LEVEL: -1,\n Z_MAX_LEVEL: 9,\n Z_DEFAULT_LEVEL: -1,\n BROTLI_OPERATION_PROCESS: 0,\n BROTLI_OPERATION_FLUSH: 1,\n BROTLI_OPERATION_FINISH: 2,\n BROTLI_OPERATION_EMIT_METADATA: 3,\n BROTLI_MODE_GENERIC: 0,\n BROTLI_MODE_TEXT: 1,\n BROTLI_MODE_FONT: 2,\n BROTLI_DEFAULT_MODE: 0,\n BROTLI_MIN_QUALITY: 0,\n BROTLI_MAX_QUALITY: 11,\n BROTLI_DEFAULT_QUALITY: 11,\n BROTLI_MIN_WINDOW_BITS: 10,\n BROTLI_MAX_WINDOW_BITS: 24,\n BROTLI_LARGE_MAX_WINDOW_BITS: 30,\n BROTLI_DEFAULT_WINDOW: 22,\n BROTLI_MIN_INPUT_BLOCK_BITS: 16,\n BROTLI_MAX_INPUT_BLOCK_BITS: 24,\n BROTLI_PARAM_MODE: 0,\n BROTLI_PARAM_QUALITY: 1,\n BROTLI_PARAM_LGWIN: 2,\n BROTLI_PARAM_LGBLOCK: 3,\n BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,\n BROTLI_PARAM_SIZE_HINT: 5,\n BROTLI_PARAM_LARGE_WINDOW: 6,\n BROTLI_PARAM_NPOSTFIX: 7,\n BROTLI_PARAM_NDIRECT: 8,\n BROTLI_DECODER_RESULT_ERROR: 0,\n BROTLI_DECODER_RESULT_SUCCESS: 1,\n BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,\n BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,\n BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,\n BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,\n BROTLI_DECODER_NO_ERROR: 0,\n BROTLI_DECODER_SUCCESS: 1,\n BROTLI_DECODER_NEEDS_MORE_INPUT: 2,\n BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,\n BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,\n BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,\n BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,\n BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,\n BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,\n BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,\n BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,\n BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,\n BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,\n BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,\n BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,\n BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,\n BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,\n BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,\n BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,\n BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,\n BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,\n BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,\n BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,\n BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,\n BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,\n BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,\n BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,\n BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,\n BROTLI_DECODER_ERROR_UNREACHABLE: -31,\n },\n realZlibConstants,\n ),\n)\n", "import assert from 'assert'\nimport { Buffer } from 'buffer'\nimport { Minipass } from 'minipass'\nimport * as realZlib from 'zlib'\nimport { constants } from './constants.js'\nexport { constants } from './constants.js'\n\nconst OriginalBufferConcat = Buffer.concat\nconst desc = Object.getOwnPropertyDescriptor(Buffer, 'concat')\nconst noop = (args: Buffer[]) => args as unknown as Buffer\nconst passthroughBufferConcat =\n desc?.writable === true || desc?.set !== undefined\n ? (makeNoOp: boolean) => {\n Buffer.concat = makeNoOp ? noop : OriginalBufferConcat\n }\n : (_: boolean) => {}\n\nconst _superWrite = Symbol('_superWrite')\n\nexport class ZlibError extends Error {\n code?: string\n errno?: number\n constructor(err: NodeJS.ErrnoException | Error, origin?: Function) {\n super('zlib: ' + err.message, { cause: err })\n this.code = (err as NodeJS.ErrnoException).code\n this.errno = (err as NodeJS.ErrnoException).errno\n /* c8 ignore next */\n if (!this.code) this.code = 'ZLIB_ERROR'\n\n this.message = 'zlib: ' + err.message\n Error.captureStackTrace(this, origin ?? this.constructor)\n }\n\n get name() {\n return 'ZlibError'\n }\n}\n\n// the Zlib class they all inherit from\n// This thing manages the queue of requests, and returns\n// true or false if there is anything in the queue when\n// you call the .write() method.\nconst _flushFlag = Symbol('flushFlag')\n\nexport type ChunkWithFlushFlag = Minipass.ContiguousData & {\n [_flushFlag]?: number\n}\n\nexport type ZlibBaseOptions = Minipass.Options & {\n flush?: number\n finishFlush?: number\n fullFlushFlag?: number\n}\n\nexport type ZlibHandle =\n | realZlib.Gzip\n | realZlib.Gunzip\n | realZlib.Deflate\n | realZlib.Inflate\n | realZlib.DeflateRaw\n | realZlib.InflateRaw\n | realZlib.BrotliCompress\n | realZlib.BrotliDecompress\n | realZlib.ZstdCompress\n | realZlib.ZstdDecompress\nexport type ZlibMode =\n | 'Gzip'\n | 'Gunzip'\n | 'Deflate'\n | 'Inflate'\n | 'DeflateRaw'\n | 'InflateRaw'\n | 'Unzip'\nexport type BrotliMode = 'BrotliCompress' | 'BrotliDecompress'\nexport type ZstdMode = 'ZstdCompress' | 'ZstdDecompress'\n\nabstract class ZlibBase extends Minipass {\n #sawError: boolean = false\n #ended: boolean = false\n #flushFlag: number\n #finishFlushFlag: number\n #fullFlushFlag: number\n #handle?: ZlibHandle\n #onError: (err: ZlibError) => any\n\n get sawError() {\n return this.#sawError\n }\n get handle() {\n return this.#handle\n }\n /* c8 ignore start */\n get flushFlag() {\n return this.#flushFlag\n }\n /* c8 ignore stop */\n\n constructor(opts: ZlibBaseOptions, mode: ZlibMode | BrotliMode | ZstdMode) {\n if (!opts || typeof opts !== 'object')\n throw new TypeError('invalid options for ZlibBase constructor')\n\n //@ts-ignore\n super(opts)\n\n /* c8 ignore start */\n this.#flushFlag = opts.flush ?? 0\n this.#finishFlushFlag = opts.finishFlush ?? 0\n this.#fullFlushFlag = opts.fullFlushFlag ?? 0\n /* c8 ignore stop */\n\n //@ts-ignore\n if (typeof realZlib[mode] !== 'function') {\n throw new TypeError('Compression method not supported: ' + mode)\n }\n\n // this will throw if any options are invalid for the class selected\n try {\n // @types/node doesn't know that it exports the classes, but they're there\n //@ts-ignore\n this.#handle = new realZlib[mode](opts)\n } catch (er) {\n // make sure that all errors get decorated properly\n throw new ZlibError(er as NodeJS.ErrnoException, this.constructor)\n }\n\n this.#onError = err => {\n // no sense raising multiple errors, since we abort on the first one.\n if (this.#sawError) return\n\n this.#sawError = true\n\n // there is no way to cleanly recover.\n // continuing only obscures problems.\n this.close()\n this.emit('error', err)\n }\n\n this.#handle?.on('error', er => this.#onError(new ZlibError(er)))\n this.once('end', () => this.close)\n }\n\n close() {\n if (this.#handle) {\n this.#handle.close()\n this.#handle = undefined\n this.emit('close')\n }\n }\n\n reset() {\n if (!this.#sawError) {\n assert(this.#handle, 'zlib binding closed')\n //@ts-ignore\n return this.#handle.reset?.()\n }\n }\n\n flush(flushFlag?: number) {\n if (this.ended) return\n\n if (typeof flushFlag !== 'number') flushFlag = this.#fullFlushFlag\n\n this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag }))\n }\n\n end(cb?: () => void): this\n end(chunk: ChunkWithFlushFlag, cb?: () => void): this\n end(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding,\n cb?: () => void,\n ): this\n end(\n chunk?: ChunkWithFlushFlag | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void,\n ) {\n /* c8 ignore start */\n if (typeof chunk === 'function') {\n cb = chunk\n encoding = undefined\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n /* c8 ignore stop */\n if (chunk) {\n if (encoding) this.write(chunk, encoding)\n else this.write(chunk)\n }\n this.flush(this.#finishFlushFlag)\n this.#ended = true\n return super.end(cb)\n }\n\n get ended() {\n return this.#ended\n }\n\n // overridden in the gzip classes to do portable writes\n [_superWrite](data: Buffer & { [_flushFlag]?: number }) {\n return super.write(data)\n }\n\n write(chunk: ChunkWithFlushFlag, cb?: () => void): boolean\n write(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding,\n cb?: () => void,\n ): boolean\n write(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void,\n ) {\n // process the chunk using the sync process\n // then super.write() all the outputted chunks\n if (typeof encoding === 'function')\n (cb = encoding), (encoding = 'utf8')\n\n if (typeof chunk === 'string')\n chunk = Buffer.from(chunk as string, encoding as BufferEncoding)\n\n if (this.#sawError) return\n assert(this.#handle, 'zlib binding closed')\n\n // _processChunk tries to .close() the native handle after it's done, so we\n // intercept that by temporarily making it a no-op.\n // diving into the node:zlib internals a bit here\n const nativeHandle = (this.#handle as unknown as { _handle: any })\n ._handle\n const originalNativeClose = nativeHandle.close\n nativeHandle.close = () => {}\n const originalClose = this.#handle.close\n this.#handle.close = () => {}\n // It also calls `Buffer.concat()` at the end, which may be convenient\n // for some, but which we are not interested in as it slows us down.\n passthroughBufferConcat(true)\n let result: undefined | Buffer | Buffer[] = undefined\n try {\n const flushFlag =\n typeof chunk[_flushFlag] === 'number'\n ? chunk[_flushFlag]\n : this.#flushFlag\n result = (\n this.#handle as unknown as {\n _processChunk: (chunk: Buffer, flushFlag: number) => Buffer[]\n }\n )._processChunk(chunk as Buffer, flushFlag)\n // if we don't throw, reset it back how it was\n passthroughBufferConcat(false)\n } catch (err) {\n // or if we do, put Buffer.concat() back before we emit error\n // Error events call into user code, which may call Buffer.concat()\n passthroughBufferConcat(false)\n this.#onError(new ZlibError(err as NodeJS.ErrnoException, this.write))\n } finally {\n if (this.#handle) {\n // Core zlib resets `_handle` to null after attempting to close the\n // native handle. Our no-op handler prevented actual closure, but we\n // need to restore the `._handle` property.\n ;(this.#handle as unknown as { _handle: any })._handle =\n nativeHandle\n nativeHandle.close = originalNativeClose\n this.#handle.close = originalClose\n // `_processChunk()` adds an 'error' listener. If we don't remove it\n // after each call, these handlers start piling up.\n this.#handle.removeAllListeners('error')\n // make sure OUR error listener is still attached tho\n }\n }\n\n if (this.#handle)\n this.#handle.on('error', er => this.#onError(new ZlibError(er, this.write)))\n\n let writeReturn\n if (result) {\n if (Array.isArray(result) && result.length > 0) {\n const r = result[0]\n // The first buffer is always `handle._outBuffer`, which would be\n // re-used for later invocations; so, we always have to copy that one.\n writeReturn = this[_superWrite](Buffer.from(r as Buffer))\n for (let i = 1; i < result.length; i++) {\n writeReturn = this[_superWrite](result[i] as Buffer)\n }\n } else {\n // either a single Buffer or an empty array\n writeReturn = this[_superWrite](Buffer.from(result as Buffer | []))\n }\n }\n\n if (cb) cb()\n return writeReturn\n }\n}\n\nexport type ZlibOptions = ZlibBaseOptions & {\n level?: number\n strategy?: number\n}\n\nexport class Zlib extends ZlibBase {\n #level?: number\n #strategy?: number\n\n constructor(opts: ZlibOptions, mode: ZlibMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.Z_NO_FLUSH\n opts.finishFlush = opts.finishFlush || constants.Z_FINISH\n opts.fullFlushFlag = constants.Z_FULL_FLUSH\n super(opts, mode)\n\n this.#level = opts.level\n this.#strategy = opts.strategy\n }\n\n params(level: number, strategy: number) {\n if (this.sawError) return\n\n if (!this.handle)\n throw new Error('cannot switch params when binding is closed')\n\n // no way to test this without also not supporting params at all\n /* c8 ignore start */\n if (!(this.handle as { params?: any }).params)\n throw new Error('not supported in this implementation')\n /* c8 ignore stop */\n\n if (this.#level !== level || this.#strategy !== strategy) {\n this.flush(constants.Z_SYNC_FLUSH)\n assert(this.handle, 'zlib binding closed')\n // .params() calls .flush(), but the latter is always async in the\n // core zlib. We override .flush() temporarily to intercept that and\n // flush synchronously.\n const origFlush = this.handle.flush\n this.handle.flush = (\n flushFlag?: (() => void) | number,\n cb?: () => void,\n ) => {\n /* c8 ignore start */\n if (typeof flushFlag === 'function') {\n cb = flushFlag\n flushFlag = this.flushFlag\n }\n /* c8 ignore stop */\n this.flush(flushFlag)\n cb?.()\n }\n try {\n ;(\n this.handle as unknown as {\n params: (level?: number, strategy?: number) => void\n }\n ).params(level, strategy)\n } finally {\n this.handle.flush = origFlush\n }\n /* c8 ignore start */\n if (this.handle) {\n this.#level = level\n this.#strategy = strategy\n }\n /* c8 ignore stop */\n }\n }\n}\n\n// minimal 2-byte header\nexport class Deflate extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Deflate')\n }\n}\n\nexport class Inflate extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Inflate')\n }\n}\n\n// gzip - bigger header, same deflate compression\nexport type GzipOptions = ZlibOptions & { portable?: boolean }\nexport class Gzip extends Zlib {\n #portable: boolean\n constructor(opts: GzipOptions) {\n super(opts, 'Gzip')\n this.#portable = opts && !!opts.portable\n }\n\n [_superWrite](data: Buffer & { [_flushFlag]?: number }) {\n if (!this.#portable) return super[_superWrite](data)\n\n // we'll always get the header emitted in one first chunk\n // overwrite the OS indicator byte with 0xFF\n this.#portable = false\n data[9] = 255\n return super[_superWrite](data)\n }\n}\n\nexport class Gunzip extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Gunzip')\n }\n}\n\n// raw - no header\nexport class DeflateRaw extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'DeflateRaw')\n }\n}\n\nexport class InflateRaw extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'InflateRaw')\n }\n}\n\n// auto-detect header.\nexport class Unzip extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Unzip')\n }\n}\n\nclass Brotli extends ZlibBase {\n constructor(opts: ZlibOptions, mode: BrotliMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS\n opts.finishFlush =\n opts.finishFlush || constants.BROTLI_OPERATION_FINISH\n opts.fullFlushFlag = constants.BROTLI_OPERATION_FLUSH\n super(opts, mode)\n }\n}\n\nexport class BrotliCompress extends Brotli {\n constructor(opts: ZlibOptions) {\n super(opts, 'BrotliCompress')\n }\n}\n\nexport class BrotliDecompress extends Brotli {\n constructor(opts: ZlibOptions) {\n super(opts, 'BrotliDecompress')\n }\n}\n\nclass Zstd extends ZlibBase {\n constructor(opts: ZlibOptions, mode: ZstdMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.ZSTD_e_continue\n opts.finishFlush = opts.finishFlush || constants.ZSTD_e_end\n opts.fullFlushFlag = constants.ZSTD_e_flush\n super(opts, mode)\n }\n}\n\nexport class ZstdCompress extends Zstd {\n constructor(opts: ZlibOptions) {\n super(opts, 'ZstdCompress')\n }\n}\n\nexport class ZstdDecompress extends Zstd {\n constructor(opts: ZlibOptions) {\n super(opts, 'ZstdDecompress')\n }\n}\n", "// Tar can encode large and negative numbers using a leading byte of\n// 0xff for negative, and 0x80 for positive.\n\nexport const encode = (num: number, buf: Buffer) => {\n if (!Number.isSafeInteger(num)) {\n // The number is so large that javascript cannot represent it with integer\n // precision.\n throw Error(\n 'cannot encode number outside of javascript safe integer range',\n )\n } else if (num < 0) {\n encodeNegative(num, buf)\n } else {\n encodePositive(num, buf)\n }\n return buf\n}\n\nconst encodePositive = (num: number, buf: Buffer) => {\n buf[0] = 0x80\n\n for (var i = buf.length; i > 1; i--) {\n buf[i - 1] = num & 0xff\n num = Math.floor(num / 0x100)\n }\n}\n\nconst encodeNegative = (num: number, buf: Buffer) => {\n buf[0] = 0xff\n var flipped = false\n num = num * -1\n for (var i = buf.length; i > 1; i--) {\n var byte = num & 0xff\n num = Math.floor(num / 0x100)\n if (flipped) {\n buf[i - 1] = onesComp(byte)\n } else if (byte === 0) {\n buf[i - 1] = 0\n } else {\n flipped = true\n buf[i - 1] = twosComp(byte)\n }\n }\n}\n\nexport const parse = (buf: Buffer) => {\n const pre = buf[0]\n const value =\n pre === 0x80 ? pos(buf.subarray(1, buf.length))\n : pre === 0xff ? twos(buf)\n : null\n if (value === null) {\n throw Error('invalid base256 encoding')\n }\n\n if (!Number.isSafeInteger(value)) {\n // The number is so large that javascript cannot represent it with integer\n // precision.\n throw Error(\n 'parsed number outside of javascript safe integer range',\n )\n }\n\n return value\n}\n\nconst twos = (buf: Buffer) => {\n var len = buf.length\n var sum = 0\n var flipped = false\n for (var i = len - 1; i > -1; i--) {\n var byte = Number(buf[i])\n var f\n if (flipped) {\n f = onesComp(byte)\n } else if (byte === 0) {\n f = byte\n } else {\n flipped = true\n f = twosComp(byte)\n }\n if (f !== 0) {\n sum -= f * Math.pow(256, len - i - 1)\n }\n }\n return sum\n}\n\nconst pos = (buf: Buffer) => {\n var len = buf.length\n var sum = 0\n for (var i = len - 1; i > -1; i--) {\n var byte = Number(buf[i])\n if (byte !== 0) {\n sum += byte * Math.pow(256, len - i - 1)\n }\n }\n return sum\n}\n\nconst onesComp = (byte: number) => (0xff ^ byte) & 0xff\n\nconst twosComp = (byte: number) => ((0xff ^ byte) + 1) & 0xff\n", "export const isCode = (c: string): c is EntryTypeCode =>\n name.has(c as EntryTypeCode)\n\nexport const isName = (c: string): c is EntryTypeName =>\n code.has(c as EntryTypeName)\n\nexport type EntryTypeCode =\n | '0'\n | ''\n | '1'\n | '2'\n | '3'\n | '4'\n | '5'\n | '6'\n | '7'\n | 'g'\n | 'x'\n | 'A'\n | 'D'\n | 'I'\n | 'K'\n | 'L'\n | 'M'\n | 'N'\n | 'S'\n | 'V'\n | 'X'\n\nexport type EntryTypeName =\n | 'File'\n | 'OldFile'\n | 'Link'\n | 'SymbolicLink'\n | 'CharacterDevice'\n | 'BlockDevice'\n | 'Directory'\n | 'FIFO'\n | 'ContiguousFile'\n | 'GlobalExtendedHeader'\n | 'ExtendedHeader'\n | 'SolarisACL'\n | 'GNUDumpDir'\n | 'Inode'\n | 'NextFileHasLongLinkpath'\n | 'NextFileHasLongPath'\n | 'ContinuationFile'\n | 'OldGnuLongPath'\n | 'SparseFile'\n | 'TapeVolumeHeader'\n | 'OldExtendedHeader'\n | 'Unsupported'\n\n// map types from key to human-friendly name\nexport const name = new Map([\n ['0', 'File'],\n // same as File\n ['', 'OldFile'],\n ['1', 'Link'],\n ['2', 'SymbolicLink'],\n // Devices and FIFOs aren't fully supported\n // they are parsed, but skipped when unpacking\n ['3', 'CharacterDevice'],\n ['4', 'BlockDevice'],\n ['5', 'Directory'],\n ['6', 'FIFO'],\n // same as File\n ['7', 'ContiguousFile'],\n // pax headers\n ['g', 'GlobalExtendedHeader'],\n ['x', 'ExtendedHeader'],\n // vendor-specific stuff\n // skip\n ['A', 'SolarisACL'],\n // like 5, but with data, which should be skipped\n ['D', 'GNUDumpDir'],\n // metadata only, skip\n ['I', 'Inode'],\n // data = link path of next file\n ['K', 'NextFileHasLongLinkpath'],\n // data = path of next file\n ['L', 'NextFileHasLongPath'],\n // skip\n ['M', 'ContinuationFile'],\n // like L\n ['N', 'OldGnuLongPath'],\n // skip\n ['S', 'SparseFile'],\n // skip\n ['V', 'TapeVolumeHeader'],\n // like x\n ['X', 'OldExtendedHeader'],\n])\n\n// map the other direction\nexport const code = new Map(\n Array.from(name).map(kv => [kv[1], kv[0]]),\n)\n", "// parse a 512-byte header block to a data object, or vice-versa\n// encode returns `true` if a pax extended header is needed, because\n// the data could not be faithfully encoded in a simple header.\n// (Also, check header.needPax to see if it needs a pax header.)\n\nimport { posix as pathModule } from 'node:path'\nimport * as large from './large-numbers.js'\nimport type { EntryTypeCode, EntryTypeName } from './types.js'\nimport * as types from './types.js'\n\nexport type HeaderData = {\n path?: string\n mode?: number\n uid?: number\n gid?: number\n size?: number\n cksum?: number\n type?: EntryTypeName | 'Unsupported'\n linkpath?: string\n uname?: string\n gname?: string\n devmaj?: number\n devmin?: number\n atime?: Date\n ctime?: Date\n mtime?: Date\n\n // fields that are common in extended PAX headers, but not in the\n // \"standard\" tar header block\n charset?: string\n comment?: string\n dev?: number\n ino?: number\n nlink?: number\n}\n\nexport class Header implements HeaderData {\n cksumValid: boolean = false\n needPax: boolean = false\n nullBlock: boolean = false\n\n block?: Buffer\n path?: string\n mode?: number\n uid?: number\n gid?: number\n size?: number\n cksum?: number\n #type: EntryTypeCode | 'Unsupported' = 'Unsupported'\n linkpath?: string\n uname?: string\n gname?: string\n devmaj: number = 0\n devmin: number = 0\n atime?: Date\n ctime?: Date\n mtime?: Date\n\n charset?: string\n comment?: string\n\n constructor(\n data?: Buffer | HeaderData,\n off: number = 0,\n ex?: HeaderData,\n gex?: HeaderData,\n ) {\n if (Buffer.isBuffer(data)) {\n this.decode(data, off || 0, ex, gex)\n } else if (data) {\n this.#slurp(data)\n }\n }\n\n decode(\n buf: Buffer,\n off: number,\n ex?: HeaderData,\n gex?: HeaderData,\n ) {\n if (!off) {\n off = 0\n }\n\n if (!buf || !(buf.length >= off + 512)) {\n throw new Error('need 512 bytes for header')\n }\n\n this.path = ex?.path ?? decString(buf, off, 100)\n this.mode = ex?.mode ?? gex?.mode ?? decNumber(buf, off + 100, 8)\n this.uid = ex?.uid ?? gex?.uid ?? decNumber(buf, off + 108, 8)\n this.gid = ex?.gid ?? gex?.gid ?? decNumber(buf, off + 116, 8)\n this.size = ex?.size ?? gex?.size ?? decNumber(buf, off + 124, 12)\n this.mtime =\n ex?.mtime ?? gex?.mtime ?? decDate(buf, off + 136, 12)\n this.cksum = decNumber(buf, off + 148, 12)\n\n // if we have extended or global extended headers, apply them now\n // See https://github.com/npm/node-tar/pull/187\n // Apply global before local, so it overrides\n if (gex) this.#slurp(gex, true)\n if (ex) this.#slurp(ex)\n\n // old tar versions marked dirs as a file with a trailing /\n const t = decString(buf, off + 156, 1)\n if (types.isCode(t)) {\n this.#type = t || '0'\n }\n if (this.#type === '0' && this.path.slice(-1) === '/') {\n this.#type = '5'\n }\n\n // tar implementations sometimes incorrectly put the stat(dir).size\n // as the size in the tarball, even though Directory entries are\n // not able to have any body at all. In the very rare chance that\n // it actually DOES have a body, we weren't going to do anything with\n // it anyway, and it'll just be a warning about an invalid header.\n if (this.#type === '5') {\n this.size = 0\n }\n\n this.linkpath = decString(buf, off + 157, 100)\n if (\n buf.subarray(off + 257, off + 265).toString() ===\n 'ustar\\u000000'\n ) {\n /* c8 ignore start */\n this.uname =\n ex?.uname ?? gex?.uname ?? decString(buf, off + 265, 32)\n this.gname =\n ex?.gname ?? gex?.gname ?? decString(buf, off + 297, 32)\n this.devmaj =\n ex?.devmaj ?? gex?.devmaj ?? decNumber(buf, off + 329, 8) ?? 0\n this.devmin =\n ex?.devmin ?? gex?.devmin ?? decNumber(buf, off + 337, 8) ?? 0\n /* c8 ignore stop */\n if (buf[off + 475] !== 0) {\n // definitely a prefix, definitely >130 chars.\n const prefix = decString(buf, off + 345, 155)\n this.path = prefix + '/' + this.path\n } else {\n const prefix = decString(buf, off + 345, 130)\n if (prefix) {\n this.path = prefix + '/' + this.path\n }\n /* c8 ignore start */\n this.atime =\n ex?.atime ?? gex?.atime ?? decDate(buf, off + 476, 12)\n this.ctime =\n ex?.ctime ?? gex?.ctime ?? decDate(buf, off + 488, 12)\n /* c8 ignore stop */\n }\n }\n\n let sum = 8 * 0x20\n for (let i = off; i < off + 148; i++) {\n sum += buf[i] as number\n }\n\n for (let i = off + 156; i < off + 512; i++) {\n sum += buf[i] as number\n }\n\n this.cksumValid = sum === this.cksum\n if (this.cksum === undefined && sum === 8 * 0x20) {\n this.nullBlock = true\n }\n }\n\n #slurp(ex: HeaderData, gex: boolean = false) {\n Object.assign(\n this,\n Object.fromEntries(\n Object.entries(ex).filter(([k, v]) => {\n // we slurp in everything except for the path attribute in\n // a global extended header, because that's weird. Also, any\n // null/undefined values are ignored.\n return !(\n v === null ||\n v === undefined ||\n (k === 'path' && gex) ||\n (k === 'linkpath' && gex) ||\n k === 'global'\n )\n }),\n ),\n )\n }\n\n encode(buf?: Buffer, off: number = 0) {\n if (!buf) {\n buf = this.block = Buffer.alloc(512)\n }\n\n if (this.#type === 'Unsupported') {\n this.#type = '0'\n }\n\n if (!(buf.length >= off + 512)) {\n throw new Error('need 512 bytes for header')\n }\n\n const prefixSize = this.ctime || this.atime ? 130 : 155\n const split = splitPrefix(this.path || '', prefixSize)\n const path = split[0]\n const prefix = split[1]\n this.needPax = !!split[2]\n\n this.needPax = encString(buf, off, 100, path) || this.needPax\n this.needPax =\n encNumber(buf, off + 100, 8, this.mode) || this.needPax\n this.needPax =\n encNumber(buf, off + 108, 8, this.uid) || this.needPax\n this.needPax =\n encNumber(buf, off + 116, 8, this.gid) || this.needPax\n this.needPax =\n encNumber(buf, off + 124, 12, this.size) || this.needPax\n this.needPax =\n encDate(buf, off + 136, 12, this.mtime) || this.needPax\n buf[off + 156] = this.#type.charCodeAt(0)\n this.needPax =\n encString(buf, off + 157, 100, this.linkpath) || this.needPax\n buf.write('ustar\\u000000', off + 257, 8)\n this.needPax =\n encString(buf, off + 265, 32, this.uname) || this.needPax\n this.needPax =\n encString(buf, off + 297, 32, this.gname) || this.needPax\n this.needPax =\n encNumber(buf, off + 329, 8, this.devmaj) || this.needPax\n this.needPax =\n encNumber(buf, off + 337, 8, this.devmin) || this.needPax\n this.needPax =\n encString(buf, off + 345, prefixSize, prefix) || this.needPax\n if (buf[off + 475] !== 0) {\n this.needPax =\n encString(buf, off + 345, 155, prefix) || this.needPax\n } else {\n this.needPax =\n encString(buf, off + 345, 130, prefix) || this.needPax\n this.needPax =\n encDate(buf, off + 476, 12, this.atime) || this.needPax\n this.needPax =\n encDate(buf, off + 488, 12, this.ctime) || this.needPax\n }\n\n let sum = 8 * 0x20\n for (let i = off; i < off + 148; i++) {\n sum += buf[i] as number\n }\n\n for (let i = off + 156; i < off + 512; i++) {\n sum += buf[i] as number\n }\n\n this.cksum = sum\n encNumber(buf, off + 148, 8, this.cksum)\n this.cksumValid = true\n\n return this.needPax\n }\n\n get type(): EntryTypeName {\n return (\n this.#type === 'Unsupported' ?\n this.#type\n : types.name.get(this.#type)) as EntryTypeName\n }\n\n get typeKey(): EntryTypeCode | 'Unsupported' {\n return this.#type\n }\n\n set type(type: EntryTypeCode | EntryTypeName | 'Unsupported') {\n const c = String(types.code.get(type as EntryTypeName))\n if (types.isCode(c) || c === 'Unsupported') {\n this.#type = c\n } else if (types.isCode(type)) {\n this.#type = type\n } else {\n throw new TypeError('invalid entry type: ' + type)\n }\n }\n}\n\nconst splitPrefix = (\n p: string,\n prefixSize: number,\n): [string, string, boolean] => {\n const pathSize = 100\n let pp = p\n let prefix = ''\n let ret: undefined | [string, string, boolean] = undefined\n const root = pathModule.parse(p).root || '.'\n\n if (Buffer.byteLength(pp) < pathSize) {\n ret = [pp, prefix, false]\n } else {\n // first set prefix to the dir, and path to the base\n prefix = pathModule.dirname(pp)\n pp = pathModule.basename(pp)\n\n do {\n if (\n Buffer.byteLength(pp) <= pathSize &&\n Buffer.byteLength(prefix) <= prefixSize\n ) {\n // both fit!\n ret = [pp, prefix, false]\n } else if (\n Buffer.byteLength(pp) > pathSize &&\n Buffer.byteLength(prefix) <= prefixSize\n ) {\n // prefix fits in prefix, but path doesn't fit in path\n ret = [pp.slice(0, pathSize - 1), prefix, true]\n } else {\n // make path take a bit from prefix\n pp = pathModule.join(pathModule.basename(prefix), pp)\n prefix = pathModule.dirname(prefix)\n }\n } while (prefix !== root && ret === undefined)\n\n // at this point, found no resolution, just truncate\n if (!ret) {\n ret = [p.slice(0, pathSize - 1), '', true]\n }\n }\n return ret\n}\n\nconst decString = (buf: Buffer, off: number, size: number) =>\n buf\n .subarray(off, off + size)\n .toString('utf8')\n .replace(/\\0.*/, '')\n\nconst decDate = (buf: Buffer, off: number, size: number) =>\n numToDate(decNumber(buf, off, size))\n\nconst numToDate = (num?: number) =>\n num === undefined ? undefined : new Date(num * 1000)\n\nconst decNumber = (buf: Buffer, off: number, size: number) =>\n Number(buf[off]) & 0x80 ?\n large.parse(buf.subarray(off, off + size))\n : decSmallNumber(buf, off, size)\n\nconst nanUndef = (value: number) => (isNaN(value) ? undefined : value)\n\nconst decSmallNumber = (buf: Buffer, off: number, size: number) =>\n nanUndef(\n parseInt(\n buf\n .subarray(off, off + size)\n .toString('utf8')\n .replace(/\\0.*$/, '')\n .trim(),\n 8,\n ),\n )\n\n// the maximum encodable as a null-terminated octal, by field size\nconst MAXNUM = {\n 12: 0o77777777777,\n 8: 0o7777777,\n}\n\nconst encNumber = (\n buf: Buffer,\n off: number,\n size: 12 | 8,\n num?: number,\n) =>\n num === undefined ? false\n : num > MAXNUM[size] || num < 0 ?\n (large.encode(num, buf.subarray(off, off + size)), true)\n : (encSmallNumber(buf, off, size, num), false)\n\nconst encSmallNumber = (\n buf: Buffer,\n off: number,\n size: number,\n num: number,\n) => buf.write(octalString(num, size), off, size, 'ascii')\n\nconst octalString = (num: number, size: number) =>\n padOctal(Math.floor(num).toString(8), size)\n\nconst padOctal = (str: string, size: number) =>\n (str.length === size - 1 ?\n str\n : new Array(size - str.length - 1).join('0') + str + ' ') + '\\0'\n\nconst encDate = (\n buf: Buffer,\n off: number,\n size: 8 | 12,\n date?: Date,\n) =>\n date === undefined ? false : (\n encNumber(buf, off, size, date.getTime() / 1000)\n )\n\n// enough to fill the longest string we've got\nconst NULLS = new Array(156).join('\\0')\n// pad with nulls, return true if it's longer or non-ascii\nconst encString = (\n buf: Buffer,\n off: number,\n size: number,\n str?: string,\n) =>\n str === undefined ? false : (\n (buf.write(str + NULLS, off, size, 'utf8'),\n str.length !== Buffer.byteLength(str) || str.length > size)\n )\n", "import { basename } from 'node:path'\nimport { Header, HeaderData } from './header.js'\n\nexport class Pax implements HeaderData {\n atime?: Date\n mtime?: Date\n ctime?: Date\n\n charset?: string\n comment?: string\n\n gid?: number\n uid?: number\n\n gname?: string\n uname?: string\n linkpath?: string\n dev?: number\n ino?: number\n nlink?: number\n path?: string\n size?: number\n mode?: number\n\n global: boolean\n\n constructor(obj: HeaderData, global: boolean = false) {\n this.atime = obj.atime\n this.charset = obj.charset\n this.comment = obj.comment\n this.ctime = obj.ctime\n this.dev = obj.dev\n this.gid = obj.gid\n this.global = global\n this.gname = obj.gname\n this.ino = obj.ino\n this.linkpath = obj.linkpath\n this.mtime = obj.mtime\n this.nlink = obj.nlink\n this.path = obj.path\n this.size = obj.size\n this.uid = obj.uid\n this.uname = obj.uname\n }\n\n encode() {\n const body = this.encodeBody()\n if (body === '') {\n return Buffer.allocUnsafe(0)\n }\n\n const bodyLen = Buffer.byteLength(body)\n // round up to 512 bytes\n // add 512 for header\n const bufLen = 512 * Math.ceil(1 + bodyLen / 512)\n const buf = Buffer.allocUnsafe(bufLen)\n\n // 0-fill the header section, it might not hit every field\n for (let i = 0; i < 512; i++) {\n buf[i] = 0\n }\n\n new Header({\n // XXX split the path\n // then the path should be PaxHeader + basename, but less than 99,\n // prepend with the dirname\n /* c8 ignore start */\n path: ('PaxHeader/' + basename(this.path ?? '')).slice(0, 99),\n /* c8 ignore stop */\n mode: this.mode || 0o644,\n uid: this.uid,\n gid: this.gid,\n size: bodyLen,\n mtime: this.mtime,\n type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader',\n linkpath: '',\n uname: this.uname || '',\n gname: this.gname || '',\n devmaj: 0,\n devmin: 0,\n atime: this.atime,\n ctime: this.ctime,\n }).encode(buf)\n\n buf.write(body, 512, bodyLen, 'utf8')\n\n // null pad after the body\n for (let i = bodyLen + 512; i < buf.length; i++) {\n buf[i] = 0\n }\n\n return buf\n }\n\n encodeBody() {\n return (\n this.encodeField('path') +\n this.encodeField('ctime') +\n this.encodeField('atime') +\n this.encodeField('dev') +\n this.encodeField('ino') +\n this.encodeField('nlink') +\n this.encodeField('charset') +\n this.encodeField('comment') +\n this.encodeField('gid') +\n this.encodeField('gname') +\n this.encodeField('linkpath') +\n this.encodeField('mtime') +\n this.encodeField('size') +\n this.encodeField('uid') +\n this.encodeField('uname')\n )\n }\n\n encodeField(field: keyof Pax): string {\n if (this[field] === undefined) {\n return ''\n }\n const r = this[field]\n const v = r instanceof Date ? r.getTime() / 1000 : r\n const s =\n ' ' +\n (field === 'dev' || field === 'ino' || field === 'nlink' ?\n 'SCHILY.'\n : '') +\n field +\n '=' +\n v +\n '\\n'\n const byteLen = Buffer.byteLength(s)\n // the digits includes the length of the digits in ascii base-10\n // so if it's 9 characters, then adding 1 for the 9 makes it 10\n // which makes it 11 chars.\n let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1\n if (byteLen + digits >= Math.pow(10, digits)) {\n digits += 1\n }\n const len = digits + byteLen\n return len + s\n }\n\n static parse(str: string, ex?: HeaderData, g: boolean = false) {\n return new Pax(merge(parseKV(str), ex), g)\n }\n}\n\nconst merge = (a: HeaderData, b?: HeaderData) =>\n b ? Object.assign({}, b, a) : a\n\nconst parseKV = (str: string) =>\n str\n .replace(/\\n$/, '')\n .split('\\n')\n .reduce(parseKVLine, Object.create(null))\n\nconst parseKVLine = (set: Record, line: string) => {\n const n = parseInt(line, 10)\n\n // XXX Values with \\n in them will fail this.\n // Refactor to not be a naive line-by-line parse.\n if (n !== Buffer.byteLength(line) + 1) {\n return set\n }\n\n line = line.slice((n + ' ').length)\n const kv = line.split('=')\n const r = kv.shift()\n\n if (!r) {\n return set\n }\n\n const k = r.replace(/^SCHILY\\.(dev|ino|nlink)/, '$1')\n\n const v = kv.join('=')\n set[k] =\n /^([A-Z]+\\.)?([mac]|birth|creation)time$/.test(k) ?\n new Date(Number(v) * 1000)\n : /^[0-9]+$/.test(v) ? +v\n : v\n return set\n}\n", "// on windows, either \\ or / are valid directory separators.\n// on unix, \\ is a valid character in filenames.\n// so, on windows, and only on windows, we replace all \\ chars with /,\n// so that we can use / as our one and only directory separator char.\n\nconst platform =\n process.env.TESTING_TAR_FAKE_PLATFORM || process.platform\n\nexport const normalizeWindowsPath =\n platform !== 'win32' ?\n (p: string) => p\n : (p: string) => p && p.replace(/\\\\/g, '/')\n", "import { Minipass } from 'minipass'\nimport { Header } from './header.js'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport { Pax } from './pax.js'\nimport { EntryTypeName } from './types.js'\n\nexport class ReadEntry extends Minipass {\n extended?: Pax\n globalExtended?: Pax\n header: Header\n startBlockSize: number\n blockRemain: number\n remain: number\n type: EntryTypeName\n meta: boolean = false\n ignore: boolean = false\n path: string\n mode?: number\n uid?: number\n gid?: number\n uname?: string\n gname?: string\n size: number = 0\n mtime?: Date\n atime?: Date\n ctime?: Date\n linkpath?: string\n\n dev?: number\n ino?: number\n nlink?: number\n invalid: boolean = false\n absolute?: string\n unsupported: boolean = false\n\n constructor(header: Header, ex?: Pax, gex?: Pax) {\n super({})\n // read entries always start life paused. this is to avoid the\n // situation where Minipass's auto-ending empty streams results\n // in an entry ending before we're ready for it.\n this.pause()\n this.extended = ex\n this.globalExtended = gex\n this.header = header\n /* c8 ignore start */\n this.remain = header.size ?? 0\n /* c8 ignore stop */\n this.startBlockSize = 512 * Math.ceil(this.remain / 512)\n this.blockRemain = this.startBlockSize\n this.type = header.type\n switch (this.type) {\n case 'File':\n case 'OldFile':\n case 'Link':\n case 'SymbolicLink':\n case 'CharacterDevice':\n case 'BlockDevice':\n case 'Directory':\n case 'FIFO':\n case 'ContiguousFile':\n case 'GNUDumpDir':\n break\n\n case 'NextFileHasLongLinkpath':\n case 'NextFileHasLongPath':\n case 'OldGnuLongPath':\n case 'GlobalExtendedHeader':\n case 'ExtendedHeader':\n case 'OldExtendedHeader':\n this.meta = true\n break\n\n // NOTE: gnutar and bsdtar treat unrecognized types as 'File'\n // it may be worth doing the same, but with a warning.\n default:\n this.ignore = true\n }\n\n /* c8 ignore start */\n if (!header.path) {\n throw new Error('no path provided for tar.ReadEntry')\n }\n /* c8 ignore stop */\n\n this.path = normalizeWindowsPath(header.path) as string\n this.mode = header.mode\n if (this.mode) {\n this.mode = this.mode & 0o7777\n }\n this.uid = header.uid\n this.gid = header.gid\n this.uname = header.uname\n this.gname = header.gname\n this.size = this.remain\n this.mtime = header.mtime\n this.atime = header.atime\n this.ctime = header.ctime\n /* c8 ignore start */\n this.linkpath =\n header.linkpath ?\n normalizeWindowsPath(header.linkpath)\n : undefined\n /* c8 ignore stop */\n this.uname = header.uname\n this.gname = header.gname\n\n if (ex) {\n this.#slurp(ex)\n }\n if (gex) {\n this.#slurp(gex, true)\n }\n }\n\n write(data: Buffer) {\n const writeLen = data.length\n if (writeLen > this.blockRemain) {\n throw new Error('writing more to entry than is appropriate')\n }\n\n const r = this.remain\n const br = this.blockRemain\n this.remain = Math.max(0, r - writeLen)\n this.blockRemain = Math.max(0, br - writeLen)\n if (this.ignore) {\n return true\n }\n\n if (r >= writeLen) {\n return super.write(data)\n }\n\n // r < writeLen\n return super.write(data.subarray(0, r))\n }\n\n #slurp(ex: Pax, gex: boolean = false) {\n if (ex.path) ex.path = normalizeWindowsPath(ex.path)\n if (ex.linkpath) ex.linkpath = normalizeWindowsPath(ex.linkpath)\n Object.assign(\n this,\n Object.fromEntries(\n Object.entries(ex).filter(([k, v]) => {\n // we slurp in everything except for the path attribute in\n // a global extended header, because that's weird. Also, any\n // null/undefined values are ignored.\n return !(\n v === null ||\n v === undefined ||\n (k === 'path' && gex)\n )\n }),\n ),\n )\n }\n}\n", "import { type Minipass } from 'minipass'\n\n/** has a warn method */\nexport type Warner = {\n warn(code: string, message: string | Error, data: any): void\n file?: string\n cwd?: string\n strict?: boolean\n\n emit(\n event: 'warn',\n code: string,\n message: string,\n data?: WarnData,\n ): void\n emit(event: 'error', error: TarError): void\n}\n\nexport type WarnEvent = Minipass.Events & {\n warn: [code: string, message: string, data: WarnData]\n}\n\nexport type WarnData = {\n file?: string\n cwd?: string\n code?: string\n tarCode?: string\n recoverable?: boolean\n [k: string]: any\n}\n\nexport type TarError = Error & WarnData\n\nexport const warnMethod = (\n self: Warner,\n code: string,\n message: string | Error,\n data: WarnData = {},\n) => {\n if (self.file) {\n data.file = self.file\n }\n if (self.cwd) {\n data.cwd = self.cwd\n }\n data.code =\n (message instanceof Error &&\n (message as NodeJS.ErrnoException).code) ||\n code\n data.tarCode = code\n if (!self.strict && data.recoverable !== false) {\n if (message instanceof Error) {\n data = Object.assign(message, data)\n message = message.message\n }\n self.emit('warn', code, message, data)\n } else if (message instanceof Error) {\n self.emit('error', Object.assign(message, data))\n } else {\n self.emit(\n 'error',\n Object.assign(new Error(`${code}: ${message}`), data),\n )\n }\n}\n", "// this[BUFFER] is the remainder of a chunk if we're waiting for\n// the full 512 bytes of a header to come in. We will Buffer.concat()\n// it to the next write(), which is a mem copy, but a small one.\n//\n// this[QUEUE] is a list of entries that haven't been emitted\n// yet this can only get filled up if the user keeps write()ing after\n// a write() returns false, or does a write() with more than one entry\n//\n// We don't buffer chunks, we always parse them and either create an\n// entry, or push it into the active entry. The ReadEntry class knows\n// to throw data away if .ignore=true\n//\n// Shift entry off the buffer when it emits 'end', and emit 'entry' for\n// the next one in the list.\n//\n// At any time, we're pushing body chunks into the entry at WRITEENTRY,\n// and waiting for 'end' on the entry at READENTRY\n//\n// ignored entries get .resume() called on them straight away\n\nimport { EventEmitter as EE } from 'events'\nimport { BrotliDecompress, Unzip, ZstdDecompress } from 'minizlib'\nimport { Header } from './header.js'\nimport { TarOptions } from './options.js'\nimport { Pax } from './pax.js'\nimport { ReadEntry } from './read-entry.js'\nimport {\n warnMethod,\n type WarnData,\n type Warner,\n} from './warn-method.js'\n\nconst maxMetaEntrySize = 1024 * 1024\nconst gzipHeader = Buffer.from([0x1f, 0x8b])\nconst zstdHeader = Buffer.from([0x28, 0xb5, 0x2f, 0xfd])\nconst ZIP_HEADER_LEN = Math.max(gzipHeader.length, zstdHeader.length)\n\nconst STATE = Symbol('state')\nconst WRITEENTRY = Symbol('writeEntry')\nconst READENTRY = Symbol('readEntry')\nconst NEXTENTRY = Symbol('nextEntry')\nconst PROCESSENTRY = Symbol('processEntry')\nconst EX = Symbol('extendedHeader')\nconst GEX = Symbol('globalExtendedHeader')\nconst META = Symbol('meta')\nconst EMITMETA = Symbol('emitMeta')\nconst BUFFER = Symbol('buffer')\nconst QUEUE = Symbol('queue')\nconst ENDED = Symbol('ended')\nconst EMITTEDEND = Symbol('emittedEnd')\nconst EMIT = Symbol('emit')\nconst UNZIP = Symbol('unzip')\nconst CONSUMECHUNK = Symbol('consumeChunk')\nconst CONSUMECHUNKSUB = Symbol('consumeChunkSub')\nconst CONSUMEBODY = Symbol('consumeBody')\nconst CONSUMEMETA = Symbol('consumeMeta')\nconst CONSUMEHEADER = Symbol('consumeHeader')\nconst CONSUMING = Symbol('consuming')\nconst BUFFERCONCAT = Symbol('bufferConcat')\nconst MAYBEEND = Symbol('maybeEnd')\nconst WRITING = Symbol('writing')\nconst ABORTED = Symbol('aborted')\nconst DONE = Symbol('onDone')\nconst SAW_VALID_ENTRY = Symbol('sawValidEntry')\nconst SAW_NULL_BLOCK = Symbol('sawNullBlock')\nconst SAW_EOF = Symbol('sawEOF')\nconst CLOSESTREAM = Symbol('closeStream')\n\nconst noop = () => true\n\nexport type State = 'begin' | 'header' | 'ignore' | 'meta' | 'body'\n\nexport class Parser extends EE implements Warner {\n file: string\n strict: boolean\n maxMetaEntrySize: number\n filter: Exclude\n brotli?: TarOptions['brotli']\n zstd?: TarOptions['zstd']\n\n writable: true = true\n readable: false = false;\n\n [QUEUE]: (ReadEntry | [string | symbol, any, any])[] = [];\n [BUFFER]?: Buffer;\n [READENTRY]?: ReadEntry;\n [WRITEENTRY]?: ReadEntry;\n [STATE]: State = 'begin';\n [META]: string = '';\n [EX]?: Pax;\n [GEX]?: Pax;\n [ENDED]: boolean = false;\n [UNZIP]?: false | Unzip | BrotliDecompress | ZstdDecompress;\n [ABORTED]: boolean = false;\n [SAW_VALID_ENTRY]?: boolean;\n [SAW_NULL_BLOCK]: boolean = false;\n [SAW_EOF]: boolean = false;\n [WRITING]: boolean = false;\n [CONSUMING]: boolean = false;\n [EMITTEDEND]: boolean = false\n\n constructor(opt: TarOptions = {}) {\n super()\n\n this.file = opt.file || ''\n\n // these BADARCHIVE errors can't be detected early. listen on DONE.\n this.on(DONE, () => {\n if (\n this[STATE] === 'begin' ||\n this[SAW_VALID_ENTRY] === false\n ) {\n // either less than 1 block of data, or all entries were invalid.\n // Either way, probably not even a tarball.\n this.warn('TAR_BAD_ARCHIVE', 'Unrecognized archive format')\n }\n })\n\n if (opt.ondone) {\n this.on(DONE, opt.ondone)\n } else {\n this.on(DONE, () => {\n this.emit('prefinish')\n this.emit('finish')\n this.emit('end')\n })\n }\n\n this.strict = !!opt.strict\n this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize\n this.filter = typeof opt.filter === 'function' ? opt.filter : noop\n // Unlike gzip, brotli doesn't have any magic bytes to identify it\n // Users need to explicitly tell us they're extracting a brotli file\n // Or we infer from the file extension\n const isTBR =\n opt.file &&\n (opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr'))\n // if it's a tbr file it MIGHT be brotli, but we don't know until\n // we look at it and verify it's not a valid tar file.\n this.brotli =\n !(opt.gzip || opt.zstd) && opt.brotli !== undefined ? opt.brotli\n : isTBR ? undefined\n : false\n\n // zstd has magic bytes to identify it, but we also support explicit options\n // and file extension detection\n const isTZST =\n opt.file &&\n (opt.file.endsWith('.tar.zst') || opt.file.endsWith('.tzst'))\n this.zstd =\n !(opt.gzip || opt.brotli) && opt.zstd !== undefined ? opt.zstd\n : isTZST ? true\n : undefined\n\n // have to set this so that streams are ok piping into it\n this.on('end', () => this[CLOSESTREAM]())\n\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n if (typeof opt.onReadEntry === 'function') {\n this.on('entry', opt.onReadEntry)\n }\n }\n\n warn(\n code: string,\n message: string | Error,\n data: WarnData = {},\n ): void {\n warnMethod(this, code, message, data)\n }\n\n [CONSUMEHEADER](chunk: Buffer, position: number) {\n if (this[SAW_VALID_ENTRY] === undefined) {\n this[SAW_VALID_ENTRY] = false\n }\n let header\n try {\n header = new Header(chunk, position, this[EX], this[GEX])\n } catch (er) {\n return this.warn('TAR_ENTRY_INVALID', er as Error)\n }\n\n if (header.nullBlock) {\n if (this[SAW_NULL_BLOCK]) {\n this[SAW_EOF] = true\n // ending an archive with no entries. pointless, but legal.\n if (this[STATE] === 'begin') {\n this[STATE] = 'header'\n }\n this[EMIT]('eof')\n } else {\n this[SAW_NULL_BLOCK] = true\n this[EMIT]('nullBlock')\n }\n } else {\n this[SAW_NULL_BLOCK] = false\n if (!header.cksumValid) {\n this.warn('TAR_ENTRY_INVALID', 'checksum failure', { header })\n } else if (!header.path) {\n this.warn('TAR_ENTRY_INVALID', 'path is required', { header })\n } else {\n const type = header.type\n if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) {\n this.warn('TAR_ENTRY_INVALID', 'linkpath required', {\n header,\n })\n } else if (\n !/^(Symbolic)?Link$/.test(type) &&\n !/^(Global)?ExtendedHeader$/.test(type) &&\n header.linkpath\n ) {\n this.warn('TAR_ENTRY_INVALID', 'linkpath forbidden', {\n header,\n })\n } else {\n const entry = (this[WRITEENTRY] = new ReadEntry(\n header,\n this[EX],\n this[GEX],\n ))\n\n // we do this for meta & ignored entries as well, because they\n // are still valid tar, or else we wouldn't know to ignore them\n if (!this[SAW_VALID_ENTRY]) {\n if (entry.remain) {\n // this might be the one!\n const onend = () => {\n if (!entry.invalid) {\n this[SAW_VALID_ENTRY] = true\n }\n }\n entry.on('end', onend)\n } else {\n this[SAW_VALID_ENTRY] = true\n }\n }\n\n if (entry.meta) {\n if (entry.size > this.maxMetaEntrySize) {\n entry.ignore = true\n this[EMIT]('ignoredEntry', entry)\n this[STATE] = 'ignore'\n entry.resume()\n } else if (entry.size > 0) {\n this[META] = ''\n entry.on('data', c => (this[META] += c))\n this[STATE] = 'meta'\n }\n } else {\n this[EX] = undefined\n entry.ignore =\n entry.ignore || !this.filter(entry.path, entry)\n\n if (entry.ignore) {\n // probably valid, just not something we care about\n this[EMIT]('ignoredEntry', entry)\n this[STATE] = entry.remain ? 'ignore' : 'header'\n entry.resume()\n } else {\n if (entry.remain) {\n this[STATE] = 'body'\n } else {\n this[STATE] = 'header'\n entry.end()\n }\n\n if (!this[READENTRY]) {\n this[QUEUE].push(entry)\n this[NEXTENTRY]()\n } else {\n this[QUEUE].push(entry)\n }\n }\n }\n }\n }\n }\n }\n\n [CLOSESTREAM]() {\n queueMicrotask(() => this.emit('close'))\n }\n\n [PROCESSENTRY](entry?: ReadEntry | [string | symbol, any, any]) {\n let go = true\n\n if (!entry) {\n this[READENTRY] = undefined\n go = false\n } else if (Array.isArray(entry)) {\n const [ev, ...args]: [string | symbol, any, any] = entry\n this.emit(ev, ...args)\n } else {\n this[READENTRY] = entry\n this.emit('entry', entry)\n if (!entry.emittedEnd) {\n entry.on('end', () => this[NEXTENTRY]())\n go = false\n }\n }\n\n return go\n }\n\n [NEXTENTRY]() {\n do {} while (this[PROCESSENTRY](this[QUEUE].shift()))\n\n if (!this[QUEUE].length) {\n // At this point, there's nothing in the queue, but we may have an\n // entry which is being consumed (readEntry).\n // If we don't, then we definitely can handle more data.\n // If we do, and either it's flowing, or it has never had any data\n // written to it, then it needs more.\n // The only other possibility is that it has returned false from a\n // write() call, so we wait for the next drain to continue.\n const re = this[READENTRY]\n const drainNow = !re || re.flowing || re.size === re.remain\n if (drainNow) {\n if (!this[WRITING]) {\n this.emit('drain')\n }\n } else {\n re.once('drain', () => this.emit('drain'))\n }\n }\n }\n\n [CONSUMEBODY](chunk: Buffer, position: number) {\n // write up to but no more than writeEntry.blockRemain\n const entry = this[WRITEENTRY]\n /* c8 ignore start */\n if (!entry) {\n throw new Error('attempt to consume body without entry??')\n }\n const br = entry.blockRemain ?? 0\n /* c8 ignore stop */\n const c =\n br >= chunk.length && position === 0 ?\n chunk\n : chunk.subarray(position, position + br)\n\n entry.write(c)\n\n if (!entry.blockRemain) {\n this[STATE] = 'header'\n this[WRITEENTRY] = undefined\n entry.end()\n }\n\n return c.length\n }\n\n [CONSUMEMETA](chunk: Buffer, position: number) {\n const entry = this[WRITEENTRY]\n const ret = this[CONSUMEBODY](chunk, position)\n\n // if we finished, then the entry is reset\n if (!this[WRITEENTRY] && entry) {\n this[EMITMETA](entry)\n }\n\n return ret\n }\n\n [EMIT](ev: string | symbol, data?: any, extra?: any) {\n if (!this[QUEUE].length && !this[READENTRY]) {\n this.emit(ev, data, extra)\n } else {\n this[QUEUE].push([ev, data, extra])\n }\n }\n\n [EMITMETA](entry: ReadEntry) {\n this[EMIT]('meta', this[META])\n switch (entry.type) {\n case 'ExtendedHeader':\n case 'OldExtendedHeader':\n this[EX] = Pax.parse(this[META], this[EX], false)\n break\n\n case 'GlobalExtendedHeader':\n this[GEX] = Pax.parse(this[META], this[GEX], true)\n break\n\n case 'NextFileHasLongPath':\n case 'OldGnuLongPath': {\n const ex = this[EX] ?? Object.create(null)\n this[EX] = ex\n ex.path = this[META].replace(/\\0.*/, '')\n break\n }\n\n case 'NextFileHasLongLinkpath': {\n const ex = this[EX] || Object.create(null)\n this[EX] = ex\n ex.linkpath = this[META].replace(/\\0.*/, '')\n break\n }\n\n /* c8 ignore start */\n default:\n throw new Error('unknown meta: ' + entry.type)\n /* c8 ignore stop */\n }\n }\n\n abort(error: Error) {\n this[ABORTED] = true\n this.emit('abort', error)\n // always throws, even in non-strict mode\n this.warn('TAR_ABORT', error, { recoverable: false })\n }\n\n write(\n buffer: Uint8Array | string,\n cb?: (err?: Error | null) => void,\n ): boolean\n write(\n str: string,\n encoding?: BufferEncoding,\n cb?: (err?: Error | null) => void,\n ): boolean\n write(\n chunk: Buffer | string,\n encoding?: BufferEncoding | (() => any),\n cb?: () => any,\n ): boolean {\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(\n chunk,\n /* c8 ignore next */\n typeof encoding === 'string' ? encoding : 'utf8',\n )\n }\n if (this[ABORTED]) {\n /* c8 ignore next */\n cb?.()\n return false\n }\n\n // first write, might be gzipped, zstd, or brotli compressed\n const needSniff =\n this[UNZIP] === undefined ||\n (this.brotli === undefined && this[UNZIP] === false)\n if (needSniff && chunk) {\n if (this[BUFFER]) {\n chunk = Buffer.concat([this[BUFFER], chunk])\n this[BUFFER] = undefined\n }\n if (chunk.length < ZIP_HEADER_LEN) {\n this[BUFFER] = chunk\n /* c8 ignore next */\n cb?.()\n return true\n }\n\n // look for gzip header\n for (\n let i = 0;\n this[UNZIP] === undefined && i < gzipHeader.length;\n i++\n ) {\n if (chunk[i] !== gzipHeader[i]) {\n this[UNZIP] = false\n }\n }\n\n // look for zstd header if gzip header not found\n let isZstd = false\n if (this[UNZIP] === false && this.zstd !== false) {\n isZstd = true\n for (let i = 0; i < zstdHeader.length; i++) {\n if (chunk[i] !== zstdHeader[i]) {\n isZstd = false\n break\n }\n }\n }\n\n const maybeBrotli = this.brotli === undefined && !isZstd\n if (this[UNZIP] === false && maybeBrotli) {\n // read the first header to see if it's a valid tar file. If so,\n // we can safely assume that it's not actually brotli, despite the\n // .tbr or .tar.br file extension.\n // if we ended before getting a full chunk, yes, def brotli\n if (chunk.length < 512) {\n if (this[ENDED]) {\n this.brotli = true\n } else {\n this[BUFFER] = chunk\n /* c8 ignore next */\n cb?.()\n return true\n }\n } else {\n // if it's tar, it's pretty reliably not brotli, chances of\n // that happening are astronomical.\n try {\n new Header(chunk.subarray(0, 512))\n this.brotli = false\n } catch (_) {\n this.brotli = true\n }\n }\n }\n\n if (\n this[UNZIP] === undefined ||\n (this[UNZIP] === false && (this.brotli || isZstd))\n ) {\n const ended = this[ENDED]\n this[ENDED] = false\n this[UNZIP] =\n this[UNZIP] === undefined ? new Unzip({})\n : isZstd ? new ZstdDecompress({})\n : new BrotliDecompress({})\n this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk))\n this[UNZIP].on('error', er => this.abort(er as Error))\n this[UNZIP].on('end', () => {\n this[ENDED] = true\n this[CONSUMECHUNK]()\n })\n this[WRITING] = true\n const ret = !!this[UNZIP][ended ? 'end' : 'write'](chunk)\n this[WRITING] = false\n cb?.()\n return ret\n }\n }\n\n this[WRITING] = true\n if (this[UNZIP]) {\n this[UNZIP].write(chunk)\n } else {\n this[CONSUMECHUNK](chunk)\n }\n this[WRITING] = false\n\n // return false if there's a queue, or if the current entry isn't flowing\n const ret =\n this[QUEUE].length ? false\n : this[READENTRY] ? this[READENTRY].flowing\n : true\n\n // if we have no queue, then that means a clogged READENTRY\n if (!ret && !this[QUEUE].length) {\n this[READENTRY]?.once('drain', () => this.emit('drain'))\n }\n\n /* c8 ignore next */\n cb?.()\n return ret\n }\n\n [BUFFERCONCAT](c: Buffer) {\n if (c && !this[ABORTED]) {\n this[BUFFER] =\n this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c\n }\n }\n\n [MAYBEEND]() {\n if (\n this[ENDED] &&\n !this[EMITTEDEND] &&\n !this[ABORTED] &&\n !this[CONSUMING]\n ) {\n this[EMITTEDEND] = true\n const entry = this[WRITEENTRY]\n if (entry && entry.blockRemain) {\n // truncated, likely a damaged file\n const have = this[BUFFER] ? this[BUFFER].length : 0\n this.warn(\n 'TAR_BAD_ARCHIVE',\n `Truncated input (needed ${entry.blockRemain} more bytes, only ${have} available)`,\n { entry },\n )\n if (this[BUFFER]) {\n entry.write(this[BUFFER])\n }\n entry.end()\n }\n this[EMIT](DONE)\n }\n }\n\n [CONSUMECHUNK](chunk?: Buffer) {\n if (this[CONSUMING] && chunk) {\n this[BUFFERCONCAT](chunk)\n } else if (!chunk && !this[BUFFER]) {\n this[MAYBEEND]()\n } else if (chunk) {\n this[CONSUMING] = true\n if (this[BUFFER]) {\n this[BUFFERCONCAT](chunk)\n const c = this[BUFFER]\n this[BUFFER] = undefined\n this[CONSUMECHUNKSUB](c)\n } else {\n this[CONSUMECHUNKSUB](chunk)\n }\n\n while (\n this[BUFFER] &&\n (this[BUFFER] as Buffer)?.length >= 512 &&\n !this[ABORTED] &&\n !this[SAW_EOF]\n ) {\n const c = this[BUFFER]\n this[BUFFER] = undefined\n this[CONSUMECHUNKSUB](c)\n }\n this[CONSUMING] = false\n }\n\n if (!this[BUFFER] || this[ENDED]) {\n this[MAYBEEND]()\n }\n }\n\n [CONSUMECHUNKSUB](chunk: Buffer) {\n // we know that we are in CONSUMING mode, so anything written goes into\n // the buffer. Advance the position and put any remainder in the buffer.\n let position = 0\n const length = chunk.length\n while (\n position + 512 <= length &&\n !this[ABORTED] &&\n !this[SAW_EOF]\n ) {\n switch (this[STATE]) {\n case 'begin':\n case 'header':\n this[CONSUMEHEADER](chunk, position)\n position += 512\n break\n\n case 'ignore':\n case 'body':\n position += this[CONSUMEBODY](chunk, position)\n break\n\n case 'meta':\n position += this[CONSUMEMETA](chunk, position)\n break\n\n /* c8 ignore start */\n default:\n throw new Error('invalid state: ' + this[STATE])\n /* c8 ignore stop */\n }\n }\n\n if (position < length) {\n if (this[BUFFER]) {\n this[BUFFER] = Buffer.concat([\n chunk.subarray(position),\n this[BUFFER],\n ])\n } else {\n this[BUFFER] = chunk.subarray(position)\n }\n }\n }\n\n end(cb?: () => void): this\n end(data: string | Buffer, cb?: () => void): this\n end(str: string, encoding?: BufferEncoding, cb?: () => void): this\n end(\n chunk?: string | Buffer | (() => void),\n encoding?: BufferEncoding | (() => void),\n cb?: () => void,\n ) {\n if (typeof chunk === 'function') {\n cb = chunk\n encoding = undefined\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding)\n }\n if (cb) this.once('finish', cb)\n if (!this[ABORTED]) {\n if (this[UNZIP]) {\n /* c8 ignore start */\n if (chunk) this[UNZIP].write(chunk)\n /* c8 ignore stop */\n this[UNZIP].end()\n } else {\n this[ENDED] = true\n if (this.brotli === undefined || this.zstd === undefined)\n chunk = chunk || Buffer.alloc(0)\n if (chunk) this.write(chunk)\n this[MAYBEEND]()\n }\n }\n return this\n }\n}\n", "// warning: extremely hot code path.\n// This has been meticulously optimized for use\n// within npm install on large package trees.\n// Do not edit without careful benchmarking.\nexport const stripTrailingSlashes = (str: string) => {\n let i = str.length - 1\n let slashesStart = -1\n while (i > -1 && str.charAt(i) === '/') {\n slashesStart = i\n i--\n }\n return slashesStart === -1 ? str : str.slice(0, slashesStart)\n}\n", "// tar -t\nimport * as fsm from '@isaacs/fs-minipass'\nimport fs from 'node:fs'\nimport { dirname, parse } from 'path'\nimport { makeCommand } from './make-command.js'\nimport {\n TarOptions,\n TarOptionsFile,\n TarOptionsSyncFile,\n} from './options.js'\nimport { Parser } from './parse.js'\nimport { stripTrailingSlashes } from './strip-trailing-slashes.js'\n\nconst onReadEntryFunction = (opt: TarOptions) => {\n const onReadEntry = opt.onReadEntry\n opt.onReadEntry =\n onReadEntry ?\n e => {\n onReadEntry(e)\n e.resume()\n }\n : e => e.resume()\n}\n\n// construct a filter that limits the file entries listed\n// include child entries if a dir is included\nexport const filesFilter = (opt: TarOptions, files: string[]) => {\n const map = new Map(\n files.map(f => [stripTrailingSlashes(f), true]),\n )\n const filter = opt.filter\n\n const mapHas = (file: string, r: string = ''): boolean => {\n const root = r || parse(file).root || '.'\n let ret: boolean\n if (file === root) ret = false\n else {\n const m = map.get(file)\n if (m !== undefined) {\n ret = m\n } else {\n ret = mapHas(dirname(file), root)\n }\n }\n\n map.set(file, ret)\n return ret\n }\n\n opt.filter =\n filter ?\n (file, entry) =>\n filter(file, entry) && mapHas(stripTrailingSlashes(file))\n : file => mapHas(stripTrailingSlashes(file))\n}\n\nconst listFileSync = (opt: TarOptionsSyncFile) => {\n const p = new Parser(opt)\n const file = opt.file\n let fd: number | undefined\n try {\n fd = fs.openSync(file, 'r')\n const stat: fs.Stats = fs.fstatSync(fd)\n const readSize: number = opt.maxReadSize || 16 * 1024 * 1024\n if (stat.size < readSize) {\n const buf = Buffer.allocUnsafe(stat.size)\n const read = fs.readSync(fd, buf, 0, stat.size, 0)\n p.end(read === buf.byteLength ? buf : buf.subarray(0, read))\n } else {\n let pos = 0\n const buf = Buffer.allocUnsafe(readSize)\n while (pos < stat.size) {\n const bytesRead = fs.readSync(fd, buf, 0, readSize, pos)\n if (bytesRead === 0) break\n pos += bytesRead\n p.write(buf.subarray(0, bytesRead))\n }\n p.end()\n }\n } finally {\n if (typeof fd === 'number') {\n try {\n fs.closeSync(fd)\n /* c8 ignore next */\n } catch (er) {}\n }\n }\n}\n\nconst listFile = (\n opt: TarOptionsFile,\n _files: string[],\n): Promise => {\n const parse = new Parser(opt)\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n\n const file = opt.file\n const p = new Promise((resolve, reject) => {\n parse.on('error', reject)\n parse.on('end', resolve)\n\n fs.stat(file, (er, stat) => {\n if (er) {\n reject(er)\n } else {\n const stream = new fsm.ReadStream(file, {\n readSize: readSize,\n size: stat.size,\n })\n stream.on('error', reject)\n stream.pipe(parse)\n }\n })\n })\n return p\n}\n\nexport const list = makeCommand(\n listFileSync,\n listFile,\n opt => new Parser(opt) as Parser & { sync: true },\n opt => new Parser(opt),\n (opt, files) => {\n if (files?.length) filesFilter(opt, files)\n if (!opt.noResume) onReadEntryFunction(opt)\n },\n)\n", "export const modeFix = (\n mode: number,\n isDir: boolean,\n portable: boolean,\n) => {\n mode &= 0o7777\n\n // in portable mode, use the minimum reasonable umask\n // if this system creates files with 0o664 by default\n // (as some linux distros do), then we'll write the\n // archive with 0o644 instead. Also, don't ever create\n // a file that is not readable/writable by the owner.\n if (portable) {\n mode = (mode | 0o600) & ~0o22\n }\n\n // if dirs are readable, then they should be listable\n if (isDir) {\n if (mode & 0o400) {\n mode |= 0o100\n }\n if (mode & 0o40) {\n mode |= 0o10\n }\n if (mode & 0o4) {\n mode |= 0o1\n }\n }\n return mode\n}\n", "// unix absolute paths are also absolute on win32, so we use this for both\nimport { win32 } from 'node:path'\nconst { isAbsolute, parse } = win32\n\n// returns [root, stripped]\n// Note that windows will think that //x/y/z/a has a \"root\" of //x/y, and in\n// those cases, we want to sanitize it to x/y/z/a, not z/a, so we strip /\n// explicitly if it's the first character.\n// drive-specific relative paths on Windows get their root stripped off even\n// though they are not absolute, so `c:../foo` becomes ['c:', '../foo']\nexport const stripAbsolutePath = (path: string) => {\n let r = ''\n\n let parsed = parse(path)\n while (isAbsolute(path) || parsed.root) {\n // windows will think that //x/y/z has a \"root\" of //x/y/\n // but strip the //?/C:/ off of //?/C:/path\n const root =\n path.charAt(0) === '/' && path.slice(0, 4) !== '//?/' ?\n '/'\n : parsed.root\n path = path.slice(root.length)\n r += root\n parsed = parse(path)\n }\n return [r, path]\n}\n", "// When writing files on Windows, translate the characters to their\n// 0xf000 higher-encoded versions.\n\nconst raw = ['|', '<', '>', '?', ':']\n\nconst win = raw.map(char =>\n String.fromCharCode(0xf000 + char.charCodeAt(0)),\n)\n\nconst toWin = new Map(raw.map((char, i) => [char, win[i]]))\nconst toRaw = new Map(win.map((char, i) => [char, raw[i]]))\n\nexport const encode = (s: string) =>\n raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s)\nexport const decode = (s: string) =>\n win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s)\n", "import fs, { type Stats } from 'fs'\nimport { Minipass } from 'minipass'\nimport path from 'path'\nimport { Header } from './header.js'\nimport { modeFix } from './mode-fix.js'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport {\n dealias,\n LinkCacheKey,\n TarOptions,\n TarOptionsWithAliases,\n} from './options.js'\nimport { Pax } from './pax.js'\nimport { ReadEntry } from './read-entry.js'\nimport { stripAbsolutePath } from './strip-absolute-path.js'\nimport { stripTrailingSlashes } from './strip-trailing-slashes.js'\nimport { EntryTypeName } from './types.js'\nimport {\n WarnData,\n Warner,\n WarnEvent,\n warnMethod,\n} from './warn-method.js'\nimport * as winchars from './winchars.js'\n\nconst prefixPath = (path: string, prefix?: string) => {\n if (!prefix) {\n return normalizeWindowsPath(path)\n }\n path = normalizeWindowsPath(path).replace(/^\\.(\\/|$)/, '')\n return stripTrailingSlashes(prefix) + '/' + path\n}\n\nconst maxReadSize = 16 * 1024 * 1024\n\nconst PROCESS = Symbol('process')\nconst FILE = Symbol('file')\nconst DIRECTORY = Symbol('directory')\nconst SYMLINK = Symbol('symlink')\nconst HARDLINK = Symbol('hardlink')\nconst HEADER = Symbol('header')\nconst READ = Symbol('read')\nconst LSTAT = Symbol('lstat')\nconst ONLSTAT = Symbol('onlstat')\nconst ONREAD = Symbol('onread')\nconst ONREADLINK = Symbol('onreadlink')\nconst OPENFILE = Symbol('openfile')\nconst ONOPENFILE = Symbol('onopenfile')\nconst CLOSE = Symbol('close')\nconst MODE = Symbol('mode')\nconst AWAITDRAIN = Symbol('awaitDrain')\nconst ONDRAIN = Symbol('ondrain')\nconst PREFIX = Symbol('prefix')\n\nexport class WriteEntry\n extends Minipass\n implements Warner\n{\n path: string\n portable: boolean\n myuid: number = (process.getuid && process.getuid()) || 0\n // until node has builtin pwnam functions, this'll have to do\n myuser: string = process.env.USER || ''\n maxReadSize: number\n linkCache: Exclude\n statCache: Exclude\n preservePaths: boolean\n cwd: string\n strict: boolean\n mtime?: Date\n noPax: boolean\n noMtime: boolean\n prefix?: string\n fd?: number\n\n blockLen: number = 0\n blockRemain: number = 0\n buf?: Buffer\n pos: number = 0\n remain: number = 0\n length: number = 0\n offset: number = 0\n\n win32: boolean\n absolute: string\n\n header?: Header\n type?: EntryTypeName | 'Unsupported'\n linkpath?: string\n stat?: Stats\n onWriteEntry?: (entry: WriteEntry) => any\n\n #hadError: boolean = false\n\n constructor(p: string, opt_: TarOptionsWithAliases = {}) {\n const opt = dealias(opt_)\n super()\n this.path = normalizeWindowsPath(p)\n // suppress atime, ctime, uid, gid, uname, gname\n this.portable = !!opt.portable\n this.maxReadSize = opt.maxReadSize || maxReadSize\n this.linkCache = opt.linkCache || new Map()\n this.statCache = opt.statCache || new Map()\n this.preservePaths = !!opt.preservePaths\n this.cwd = normalizeWindowsPath(opt.cwd || process.cwd())\n this.strict = !!opt.strict\n this.noPax = !!opt.noPax\n this.noMtime = !!opt.noMtime\n this.mtime = opt.mtime\n this.prefix =\n opt.prefix ? normalizeWindowsPath(opt.prefix) : undefined\n this.onWriteEntry = opt.onWriteEntry\n\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n\n let pathWarn: string | boolean = false\n if (!this.preservePaths) {\n const [root, stripped] = stripAbsolutePath(this.path)\n if (root && typeof stripped === 'string') {\n this.path = stripped\n pathWarn = root\n }\n }\n\n this.win32 = !!opt.win32 || process.platform === 'win32'\n if (this.win32) {\n // force the \\ to / normalization, since we might not *actually*\n // be on windows, but want \\ to be considered a path separator.\n this.path = winchars.decode(this.path.replace(/\\\\/g, '/'))\n p = p.replace(/\\\\/g, '/')\n }\n\n this.absolute = normalizeWindowsPath(\n opt.absolute || path.resolve(this.cwd, p),\n )\n\n if (this.path === '') {\n this.path = './'\n }\n\n if (pathWarn) {\n this.warn(\n 'TAR_ENTRY_INFO',\n `stripping ${pathWarn} from absolute path`,\n {\n entry: this,\n path: pathWarn + this.path,\n },\n )\n }\n\n const cs = this.statCache.get(this.absolute)\n if (cs) {\n this[ONLSTAT](cs)\n } else {\n this[LSTAT]()\n }\n }\n\n warn(code: string, message: string | Error, data: WarnData = {}) {\n return warnMethod(this, code, message, data)\n }\n\n emit(ev: keyof WarnEvent, ...data: any[]) {\n if (ev === 'error') {\n this.#hadError = true\n }\n return super.emit(ev, ...data)\n }\n\n [LSTAT]() {\n fs.lstat(this.absolute, (er, stat) => {\n if (er) {\n return this.emit('error', er)\n }\n this[ONLSTAT](stat)\n })\n }\n\n [ONLSTAT](stat: Stats) {\n this.statCache.set(this.absolute, stat)\n this.stat = stat\n if (!stat.isFile()) {\n stat.size = 0\n }\n this.type = getType(stat)\n this.emit('stat', stat)\n this[PROCESS]()\n }\n\n [PROCESS]() {\n switch (this.type) {\n case 'File':\n return this[FILE]()\n case 'Directory':\n return this[DIRECTORY]()\n case 'SymbolicLink':\n return this[SYMLINK]()\n // unsupported types are ignored.\n default:\n return this.end()\n }\n }\n\n [MODE](mode: number) {\n return modeFix(mode, this.type === 'Directory', this.portable)\n }\n\n [PREFIX](path: string) {\n return prefixPath(path, this.prefix)\n }\n\n [HEADER]() {\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('cannot write header before stat')\n }\n /* c8 ignore stop */\n\n if (this.type === 'Directory' && this.portable) {\n this.noMtime = true\n }\n\n this.onWriteEntry?.(this)\n this.header = new Header({\n path: this[PREFIX](this.path),\n // only apply the prefix to hard links.\n linkpath:\n this.type === 'Link' && this.linkpath !== undefined ?\n this[PREFIX](this.linkpath)\n : this.linkpath,\n // only the permissions and setuid/setgid/sticky bitflags\n // not the higher-order bits that specify file type\n mode: this[MODE](this.stat.mode),\n uid: this.portable ? undefined : this.stat.uid,\n gid: this.portable ? undefined : this.stat.gid,\n size: this.stat.size,\n mtime: this.noMtime ? undefined : this.mtime || this.stat.mtime,\n /* c8 ignore next */\n type: this.type === 'Unsupported' ? undefined : this.type,\n uname:\n this.portable ? undefined\n : this.stat.uid === this.myuid ? this.myuser\n : '',\n atime: this.portable ? undefined : this.stat.atime,\n ctime: this.portable ? undefined : this.stat.ctime,\n })\n\n if (this.header.encode() && !this.noPax) {\n super.write(\n new Pax({\n atime: this.portable ? undefined : this.header.atime,\n ctime: this.portable ? undefined : this.header.ctime,\n gid: this.portable ? undefined : this.header.gid,\n mtime:\n this.noMtime ? undefined : (\n this.mtime || this.header.mtime\n ),\n path: this[PREFIX](this.path),\n linkpath:\n this.type === 'Link' && this.linkpath !== undefined ?\n this[PREFIX](this.linkpath)\n : this.linkpath,\n size: this.header.size,\n uid: this.portable ? undefined : this.header.uid,\n uname: this.portable ? undefined : this.header.uname,\n dev: this.portable ? undefined : this.stat.dev,\n ino: this.portable ? undefined : this.stat.ino,\n nlink: this.portable ? undefined : this.stat.nlink,\n }).encode(),\n )\n }\n const block = this.header?.block\n /* c8 ignore start */\n if (!block) {\n throw new Error('failed to encode header')\n }\n /* c8 ignore stop */\n super.write(block)\n }\n\n [DIRECTORY]() {\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('cannot create directory entry without stat')\n }\n /* c8 ignore stop */\n if (this.path.slice(-1) !== '/') {\n this.path += '/'\n }\n this.stat.size = 0\n this[HEADER]()\n this.end()\n }\n\n [SYMLINK]() {\n fs.readlink(this.absolute, (er, linkpath) => {\n if (er) {\n return this.emit('error', er)\n }\n this[ONREADLINK](linkpath)\n })\n }\n\n [ONREADLINK](linkpath: string) {\n this.linkpath = normalizeWindowsPath(linkpath)\n this[HEADER]()\n this.end()\n }\n\n [HARDLINK](linkpath: string) {\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('cannot create link entry without stat')\n }\n /* c8 ignore stop */\n this.type = 'Link'\n this.linkpath = normalizeWindowsPath(\n path.relative(this.cwd, linkpath),\n )\n this.stat.size = 0\n this[HEADER]()\n this.end()\n }\n\n [FILE]() {\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('cannot create file entry without stat')\n }\n /* c8 ignore stop */\n if (this.stat.nlink > 1) {\n const linkKey =\n `${this.stat.dev}:${this.stat.ino}` as LinkCacheKey\n const linkpath = this.linkCache.get(linkKey)\n if (linkpath?.indexOf(this.cwd) === 0) {\n return this[HARDLINK](linkpath)\n }\n this.linkCache.set(linkKey, this.absolute)\n }\n\n this[HEADER]()\n if (this.stat.size === 0) {\n return this.end()\n }\n\n this[OPENFILE]()\n }\n\n [OPENFILE]() {\n fs.open(this.absolute, 'r', (er, fd) => {\n if (er) {\n return this.emit('error', er)\n }\n this[ONOPENFILE](fd)\n })\n }\n\n [ONOPENFILE](fd: number) {\n this.fd = fd\n if (this.#hadError) {\n return this[CLOSE]()\n }\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('should stat before calling onopenfile')\n }\n /* c8 ignore start */\n\n this.blockLen = 512 * Math.ceil(this.stat.size / 512)\n this.blockRemain = this.blockLen\n const bufLen = Math.min(this.blockLen, this.maxReadSize)\n this.buf = Buffer.allocUnsafe(bufLen)\n this.offset = 0\n this.pos = 0\n this.remain = this.stat.size\n this.length = this.buf.length\n this[READ]()\n }\n\n [READ]() {\n const { fd, buf, offset, length, pos } = this\n if (fd === undefined || buf === undefined) {\n throw new Error('cannot read file without first opening')\n }\n fs.read(fd, buf, offset, length, pos, (er, bytesRead) => {\n if (er) {\n // ignoring the error from close(2) is a bad practice, but at\n // this point we already have an error, don't need another one\n return this[CLOSE](() => this.emit('error', er))\n }\n this[ONREAD](bytesRead)\n })\n }\n\n /* c8 ignore start */\n [CLOSE](\n cb: (er?: null | Error | NodeJS.ErrnoException) => any = () => {},\n ) {\n /* c8 ignore stop */\n if (this.fd !== undefined) fs.close(this.fd, cb)\n }\n\n [ONREAD](bytesRead: number) {\n if (bytesRead <= 0 && this.remain > 0) {\n const er = Object.assign(\n new Error('encountered unexpected EOF'),\n {\n path: this.absolute,\n syscall: 'read',\n code: 'EOF',\n },\n )\n return this[CLOSE](() => this.emit('error', er))\n }\n\n if (bytesRead > this.remain) {\n const er = Object.assign(\n new Error('did not encounter expected EOF'),\n {\n path: this.absolute,\n syscall: 'read',\n code: 'EOF',\n },\n )\n return this[CLOSE](() => this.emit('error', er))\n }\n\n /* c8 ignore start */\n if (!this.buf) {\n throw new Error('should have created buffer prior to reading')\n }\n /* c8 ignore stop */\n\n // null out the rest of the buffer, if we could fit the block padding\n // at the end of this loop, we've incremented bytesRead and this.remain\n // to be incremented up to the blockRemain level, as if we had expected\n // to get a null-padded file, and read it until the end. then we will\n // decrement both remain and blockRemain by bytesRead, and know that we\n // reached the expected EOF, without any null buffer to append.\n if (bytesRead === this.remain) {\n for (\n let i = bytesRead;\n i < this.length && bytesRead < this.blockRemain;\n i++\n ) {\n this.buf[i + this.offset] = 0\n bytesRead++\n this.remain++\n }\n }\n\n const chunk =\n this.offset === 0 && bytesRead === this.buf.length ?\n this.buf\n : this.buf.subarray(this.offset, this.offset + bytesRead)\n\n const flushed = this.write(chunk)\n if (!flushed) {\n this[AWAITDRAIN](() => this[ONDRAIN]())\n } else {\n this[ONDRAIN]()\n }\n }\n\n [AWAITDRAIN](cb: () => any) {\n this.once('drain', cb)\n }\n\n write(buffer: Buffer | string, cb?: () => void): boolean\n write(\n str: Buffer | string,\n encoding?: BufferEncoding | null,\n cb?: () => void,\n ): boolean\n write(\n chunk: Buffer | string,\n encoding?: BufferEncoding | (() => any) | null,\n cb?: () => any,\n ): boolean {\n /* c8 ignore start - just junk to comply with NodeJS.WritableStream */\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(\n chunk,\n typeof encoding === 'string' ? encoding : 'utf8',\n )\n }\n /* c8 ignore stop */\n\n if (this.blockRemain < chunk.length) {\n const er = Object.assign(\n new Error('writing more data than expected'),\n {\n path: this.absolute,\n },\n )\n return this.emit('error', er)\n }\n this.remain -= chunk.length\n this.blockRemain -= chunk.length\n this.pos += chunk.length\n this.offset += chunk.length\n return super.write(chunk, null, cb)\n }\n\n [ONDRAIN]() {\n if (!this.remain) {\n if (this.blockRemain) {\n super.write(Buffer.alloc(this.blockRemain))\n }\n return this[CLOSE](er =>\n er ? this.emit('error', er) : this.end(),\n )\n }\n\n /* c8 ignore start */\n if (!this.buf) {\n throw new Error('buffer lost somehow in ONDRAIN')\n }\n /* c8 ignore stop */\n\n if (this.offset >= this.length) {\n // if we only have a smaller bit left to read, alloc a smaller buffer\n // otherwise, keep it the same length it was before.\n this.buf = Buffer.allocUnsafe(\n Math.min(this.blockRemain, this.buf.length),\n )\n this.offset = 0\n }\n this.length = this.buf.length - this.offset\n this[READ]()\n }\n}\n\nexport class WriteEntrySync extends WriteEntry implements Warner {\n sync: true = true;\n\n [LSTAT]() {\n this[ONLSTAT](fs.lstatSync(this.absolute))\n }\n\n [SYMLINK]() {\n this[ONREADLINK](fs.readlinkSync(this.absolute))\n }\n\n [OPENFILE]() {\n this[ONOPENFILE](fs.openSync(this.absolute, 'r'))\n }\n\n [READ]() {\n let threw = true\n try {\n const { fd, buf, offset, length, pos } = this\n /* c8 ignore start */\n if (fd === undefined || buf === undefined) {\n throw new Error('fd and buf must be set in READ method')\n }\n /* c8 ignore stop */\n const bytesRead = fs.readSync(fd, buf, offset, length, pos)\n this[ONREAD](bytesRead)\n threw = false\n } finally {\n // ignoring the error from close(2) is a bad practice, but at\n // this point we already have an error, don't need another one\n if (threw) {\n try {\n this[CLOSE](() => {})\n } catch (er) {}\n }\n }\n }\n\n [AWAITDRAIN](cb: () => any) {\n cb()\n }\n\n /* c8 ignore start */\n [CLOSE](\n cb: (er?: null | Error | NodeJS.ErrnoException) => any = () => {},\n ) {\n /* c8 ignore stop */\n if (this.fd !== undefined) fs.closeSync(this.fd)\n cb()\n }\n}\n\nexport class WriteEntryTar\n extends Minipass\n implements Warner\n{\n blockLen: number = 0\n blockRemain: number = 0\n buf: number = 0\n pos: number = 0\n remain: number = 0\n length: number = 0\n preservePaths: boolean\n portable: boolean\n strict: boolean\n noPax: boolean\n noMtime: boolean\n readEntry: ReadEntry\n type: EntryTypeName\n prefix?: string\n path: string\n mode?: number\n uid?: number\n gid?: number\n uname?: string\n gname?: string\n header?: Header\n mtime?: Date\n atime?: Date\n ctime?: Date\n linkpath?: string\n size: number\n onWriteEntry?: (entry: WriteEntry) => any\n\n warn(code: string, message: string | Error, data: WarnData = {}) {\n return warnMethod(this, code, message, data)\n }\n\n constructor(\n readEntry: ReadEntry,\n opt_: TarOptionsWithAliases = {},\n ) {\n const opt = dealias(opt_)\n super()\n this.preservePaths = !!opt.preservePaths\n this.portable = !!opt.portable\n this.strict = !!opt.strict\n this.noPax = !!opt.noPax\n this.noMtime = !!opt.noMtime\n this.onWriteEntry = opt.onWriteEntry\n\n this.readEntry = readEntry\n const { type } = readEntry\n /* c8 ignore start */\n if (type === 'Unsupported') {\n throw new Error('writing entry that should be ignored')\n }\n /* c8 ignore stop */\n this.type = type\n if (this.type === 'Directory' && this.portable) {\n this.noMtime = true\n }\n\n this.prefix = opt.prefix\n\n this.path = normalizeWindowsPath(readEntry.path)\n this.mode =\n readEntry.mode !== undefined ?\n this[MODE](readEntry.mode)\n : undefined\n this.uid = this.portable ? undefined : readEntry.uid\n this.gid = this.portable ? undefined : readEntry.gid\n this.uname = this.portable ? undefined : readEntry.uname\n this.gname = this.portable ? undefined : readEntry.gname\n this.size = readEntry.size\n this.mtime =\n this.noMtime ? undefined : opt.mtime || readEntry.mtime\n this.atime = this.portable ? undefined : readEntry.atime\n this.ctime = this.portable ? undefined : readEntry.ctime\n this.linkpath =\n readEntry.linkpath !== undefined ?\n normalizeWindowsPath(readEntry.linkpath)\n : undefined\n\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n\n let pathWarn: false | string = false\n if (!this.preservePaths) {\n const [root, stripped] = stripAbsolutePath(this.path)\n if (root && typeof stripped === 'string') {\n this.path = stripped\n pathWarn = root\n }\n }\n\n this.remain = readEntry.size\n this.blockRemain = readEntry.startBlockSize\n\n this.onWriteEntry?.(this as unknown as WriteEntry)\n this.header = new Header({\n path: this[PREFIX](this.path),\n linkpath:\n this.type === 'Link' && this.linkpath !== undefined ?\n this[PREFIX](this.linkpath)\n : this.linkpath,\n // only the permissions and setuid/setgid/sticky bitflags\n // not the higher-order bits that specify file type\n mode: this.mode,\n uid: this.portable ? undefined : this.uid,\n gid: this.portable ? undefined : this.gid,\n size: this.size,\n mtime: this.noMtime ? undefined : this.mtime,\n type: this.type,\n uname: this.portable ? undefined : this.uname,\n atime: this.portable ? undefined : this.atime,\n ctime: this.portable ? undefined : this.ctime,\n })\n\n if (pathWarn) {\n this.warn(\n 'TAR_ENTRY_INFO',\n `stripping ${pathWarn} from absolute path`,\n {\n entry: this,\n path: pathWarn + this.path,\n },\n )\n }\n\n if (this.header.encode() && !this.noPax) {\n super.write(\n new Pax({\n atime: this.portable ? undefined : this.atime,\n ctime: this.portable ? undefined : this.ctime,\n gid: this.portable ? undefined : this.gid,\n mtime: this.noMtime ? undefined : this.mtime,\n path: this[PREFIX](this.path),\n linkpath:\n this.type === 'Link' && this.linkpath !== undefined ?\n this[PREFIX](this.linkpath)\n : this.linkpath,\n size: this.size,\n uid: this.portable ? undefined : this.uid,\n uname: this.portable ? undefined : this.uname,\n dev: this.portable ? undefined : this.readEntry.dev,\n ino: this.portable ? undefined : this.readEntry.ino,\n nlink: this.portable ? undefined : this.readEntry.nlink,\n }).encode(),\n )\n }\n\n const b = this.header?.block\n /* c8 ignore start */\n if (!b) throw new Error('failed to encode header')\n /* c8 ignore stop */\n super.write(b)\n readEntry.pipe(this)\n }\n\n [PREFIX](path: string) {\n return prefixPath(path, this.prefix)\n }\n\n [MODE](mode: number) {\n return modeFix(mode, this.type === 'Directory', this.portable)\n }\n\n write(buffer: Buffer | string, cb?: () => void): boolean\n write(\n str: Buffer | string,\n encoding?: BufferEncoding | null,\n cb?: () => void,\n ): boolean\n write(\n chunk: Buffer | string,\n encoding?: BufferEncoding | (() => any) | null,\n cb?: () => any,\n ): boolean {\n /* c8 ignore start - just junk to comply with NodeJS.WritableStream */\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(\n chunk,\n typeof encoding === 'string' ? encoding : 'utf8',\n )\n }\n /* c8 ignore stop */\n const writeLen = chunk.length\n if (writeLen > this.blockRemain) {\n throw new Error('writing more to entry than is appropriate')\n }\n this.blockRemain -= writeLen\n return super.write(chunk, cb)\n }\n\n end(cb?: () => void): this\n end(chunk: Buffer | string, cb?: () => void): this\n end(\n chunk: Buffer | string,\n encoding?: BufferEncoding,\n cb?: () => void,\n ): this\n end(\n chunk?: Buffer | string | (() => void),\n encoding?: BufferEncoding | (() => void),\n cb?: () => void,\n ): this {\n if (this.blockRemain) {\n super.write(Buffer.alloc(this.blockRemain))\n }\n /* c8 ignore start - just junk to comply with NodeJS.WritableStream */\n if (typeof chunk === 'function') {\n cb = chunk\n encoding = undefined\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding ?? 'utf8')\n }\n if (cb) this.once('finish', cb)\n chunk ? super.end(chunk, cb) : super.end(cb)\n /* c8 ignore stop */\n return this\n }\n}\n\nconst getType = (stat: Stats): EntryTypeName | 'Unsupported' =>\n stat.isFile() ? 'File'\n : stat.isDirectory() ? 'Directory'\n : stat.isSymbolicLink() ? 'SymbolicLink'\n : 'Unsupported'\n", "export class Yallist {\n tail?: Node\n head?: Node\n length: number = 0\n\n static create(list: Iterable = []) {\n return new Yallist(list)\n }\n\n constructor(list: Iterable = []) {\n for (const item of list) {\n this.push(item)\n }\n }\n\n *[Symbol.iterator]() {\n for (let walker = this.head; walker; walker = walker.next) {\n yield walker.value\n }\n }\n\n removeNode(node: Node) {\n if (node.list !== this) {\n throw new Error(\n 'removing node which does not belong to this list',\n )\n }\n\n const next = node.next\n const prev = node.prev\n\n if (next) {\n next.prev = prev\n }\n\n if (prev) {\n prev.next = next\n }\n\n if (node === this.head) {\n this.head = next\n }\n if (node === this.tail) {\n this.tail = prev\n }\n\n this.length--\n node.next = undefined\n node.prev = undefined\n node.list = undefined\n\n return next\n }\n\n unshiftNode(node: Node) {\n if (node === this.head) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n const head = this.head\n node.list = this\n node.next = head\n if (head) {\n head.prev = node\n }\n\n this.head = node\n if (!this.tail) {\n this.tail = node\n }\n this.length++\n }\n\n pushNode(node: Node) {\n if (node === this.tail) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n const tail = this.tail\n node.list = this\n node.prev = tail\n if (tail) {\n tail.next = node\n }\n\n this.tail = node\n if (!this.head) {\n this.head = node\n }\n this.length++\n }\n\n push(...args: T[]) {\n for (let i = 0, l = args.length; i < l; i++) {\n push(this, args[i])\n }\n return this.length\n }\n\n unshift(...args: T[]) {\n for (var i = 0, l = args.length; i < l; i++) {\n unshift(this, args[i])\n }\n return this.length\n }\n\n pop() {\n if (!this.tail) {\n return undefined\n }\n\n const res = this.tail.value\n const t = this.tail\n this.tail = this.tail.prev\n if (this.tail) {\n this.tail.next = undefined\n } else {\n this.head = undefined\n }\n t.list = undefined\n this.length--\n return res\n }\n\n shift() {\n if (!this.head) {\n return undefined\n }\n\n const res = this.head.value\n const h = this.head\n this.head = this.head.next\n if (this.head) {\n this.head.prev = undefined\n } else {\n this.tail = undefined\n }\n h.list = undefined\n this.length--\n return res\n }\n\n forEach(\n fn: (value: T, i: number, list: Yallist) => any,\n thisp?: any,\n ) {\n thisp = thisp || this\n for (let walker = this.head, i = 0; !!walker; i++) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.next\n }\n }\n\n forEachReverse(\n fn: (value: T, i: number, list: Yallist) => any,\n thisp?: any,\n ) {\n thisp = thisp || this\n for (let walker = this.tail, i = this.length - 1; !!walker; i--) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.prev\n }\n }\n\n get(n: number) {\n let i = 0\n let walker = this.head\n for (; !!walker && i < n; i++) {\n walker = walker.next\n }\n if (i === n && !!walker) {\n return walker.value\n }\n }\n\n getReverse(n: number) {\n let i = 0\n let walker = this.tail\n for (; !!walker && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.prev\n }\n if (i === n && !!walker) {\n return walker.value\n }\n }\n\n map(\n fn: (value: T, list: Yallist) => R,\n thisp?: any,\n ): Yallist {\n thisp = thisp || this\n const res = new Yallist()\n for (let walker = this.head; !!walker; ) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.next\n }\n return res\n }\n\n mapReverse(\n fn: (value: T, list: Yallist) => R,\n thisp?: any,\n ): Yallist {\n thisp = thisp || this\n var res = new Yallist()\n for (let walker = this.tail; !!walker; ) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.prev\n }\n return res\n }\n\n reduce(fn: (left: T, right: T, i: number) => T): T\n reduce(\n fn: (acc: R, next: T, i: number) => R,\n initial: R,\n ): R\n reduce(\n fn: (acc: R, next: T, i: number) => R,\n initial?: R,\n ): R {\n let acc: R | T\n let walker = this.head\n if (arguments.length > 1) {\n acc = initial as R\n } else if (this.head) {\n walker = this.head.next\n acc = this.head.value\n } else {\n throw new TypeError(\n 'Reduce of empty list with no initial value',\n )\n }\n\n for (var i = 0; !!walker; i++) {\n acc = fn(acc as R, walker.value, i)\n walker = walker.next\n }\n\n return acc as R\n }\n\n reduceReverse(fn: (left: T, right: T, i: number) => T): T\n reduceReverse(\n fn: (acc: R, next: T, i: number) => R,\n initial: R,\n ): R\n reduceReverse(\n fn: (acc: R, next: T, i: number) => R,\n initial?: R,\n ): R {\n let acc: R | T\n let walker = this.tail\n if (arguments.length > 1) {\n acc = initial as R\n } else if (this.tail) {\n walker = this.tail.prev\n acc = this.tail.value\n } else {\n throw new TypeError(\n 'Reduce of empty list with no initial value',\n )\n }\n\n for (let i = this.length - 1; !!walker; i--) {\n acc = fn(acc as R, walker.value, i)\n walker = walker.prev\n }\n\n return acc as R\n }\n\n toArray() {\n const arr = new Array(this.length)\n for (let i = 0, walker = this.head; !!walker; i++) {\n arr[i] = walker.value\n walker = walker.next\n }\n return arr\n }\n\n toArrayReverse() {\n const arr = new Array(this.length)\n for (let i = 0, walker = this.tail; !!walker; i++) {\n arr[i] = walker.value\n walker = walker.prev\n }\n return arr\n }\n\n slice(from: number = 0, to: number = this.length) {\n if (to < 0) {\n to += this.length\n }\n if (from < 0) {\n from += this.length\n }\n const ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n let walker = this.head\n let i = 0\n for (i = 0; !!walker && i < from; i++) {\n walker = walker.next\n }\n for (; !!walker && i < to; i++, walker = walker.next) {\n ret.push(walker.value)\n }\n return ret\n }\n\n sliceReverse(from: number = 0, to: number = this.length) {\n if (to < 0) {\n to += this.length\n }\n if (from < 0) {\n from += this.length\n }\n const ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n let i = this.length\n let walker = this.tail\n for (; !!walker && i > to; i--) {\n walker = walker.prev\n }\n for (; !!walker && i > from; i--, walker = walker.prev) {\n ret.push(walker.value)\n }\n return ret\n }\n\n splice(start: number, deleteCount: number = 0, ...nodes: T[]) {\n if (start > this.length) {\n start = this.length - 1\n }\n if (start < 0) {\n start = this.length + start\n }\n\n let walker = this.head\n\n for (let i = 0; !!walker && i < start; i++) {\n walker = walker.next\n }\n\n const ret: T[] = []\n for (let i = 0; !!walker && i < deleteCount; i++) {\n ret.push(walker.value)\n walker = this.removeNode(walker)\n }\n if (!walker) {\n walker = this.tail\n } else if (walker !== this.tail) {\n walker = walker.prev\n }\n\n for (const v of nodes) {\n walker = insertAfter(this, walker, v)\n }\n\n return ret\n }\n\n reverse() {\n const head = this.head\n const tail = this.tail\n for (let walker = head; !!walker; walker = walker.prev) {\n const p = walker.prev\n walker.prev = walker.next\n walker.next = p\n }\n this.head = tail\n this.tail = head\n return this\n }\n}\n\n// insertAfter undefined means \"make the node the new head of list\"\nfunction insertAfter(\n self: Yallist,\n node: Node | undefined,\n value: T,\n) {\n const prev = node\n const next = node ? node.next : self.head\n const inserted = new Node(value, prev, next, self)\n\n if (inserted.next === undefined) {\n self.tail = inserted\n }\n if (inserted.prev === undefined) {\n self.head = inserted\n }\n\n self.length++\n\n return inserted\n}\n\nfunction push(self: Yallist, item: T) {\n self.tail = new Node(item, self.tail, undefined, self)\n if (!self.head) {\n self.head = self.tail\n }\n self.length++\n}\n\nfunction unshift(self: Yallist, item: T) {\n self.head = new Node(item, undefined, self.head, self)\n if (!self.tail) {\n self.tail = self.head\n }\n self.length++\n}\n\nexport class Node {\n list?: Yallist\n next?: Node\n prev?: Node\n value: T\n\n constructor(\n value: T,\n prev?: Node | undefined,\n next?: Node | undefined,\n list?: Yallist | undefined,\n ) {\n this.list = list\n this.value = value\n\n if (prev) {\n prev.next = this\n this.prev = prev\n } else {\n this.prev = undefined\n }\n\n if (next) {\n next.prev = this\n this.next = next\n } else {\n this.next = undefined\n }\n }\n}\n", "// A readable tar stream creator\n// Technically, this is a transform stream that you write paths into,\n// and tar format comes out of.\n// The `add()` method is like `write()` but returns this,\n// and end() return `this` as well, so you can\n// do `new Pack(opt).add('files').add('dir').end().pipe(output)\n// You could also do something like:\n// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar'))\n\nimport fs, { type Stats } from 'fs'\nimport {\n WriteEntry,\n WriteEntrySync,\n WriteEntryTar,\n} from './write-entry.js'\n\nexport class PackJob {\n path: string\n absolute: string\n entry?: WriteEntry | WriteEntryTar\n stat?: Stats\n readdir?: string[]\n pending: boolean = false\n ignore: boolean = false\n piped: boolean = false\n constructor(path: string, absolute: string) {\n this.path = path || './'\n this.absolute = absolute\n }\n}\n\nimport { Minipass } from 'minipass'\nimport * as zlib from 'minizlib'\nimport { Yallist } from 'yallist'\nimport { ReadEntry } from './read-entry.js'\nimport {\n WarnEvent,\n warnMethod,\n type WarnData,\n type Warner,\n} from './warn-method.js'\n\nconst EOF = Buffer.alloc(1024)\nconst ONSTAT = Symbol('onStat')\nconst ENDED = Symbol('ended')\nconst QUEUE = Symbol('queue')\nconst CURRENT = Symbol('current')\nconst PROCESS = Symbol('process')\nconst PROCESSING = Symbol('processing')\nconst PROCESSJOB = Symbol('processJob')\nconst JOBS = Symbol('jobs')\nconst JOBDONE = Symbol('jobDone')\nconst ADDFSENTRY = Symbol('addFSEntry')\nconst ADDTARENTRY = Symbol('addTarEntry')\nconst STAT = Symbol('stat')\nconst READDIR = Symbol('readdir')\nconst ONREADDIR = Symbol('onreaddir')\nconst PIPE = Symbol('pipe')\nconst ENTRY = Symbol('entry')\nconst ENTRYOPT = Symbol('entryOpt')\nconst WRITEENTRYCLASS = Symbol('writeEntryClass')\nconst WRITE = Symbol('write')\nconst ONDRAIN = Symbol('ondrain')\n\nimport path from 'path'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport { TarOptions } from './options.js'\n\nexport class Pack\n extends Minipass>\n implements Warner\n{\n sync: boolean = false\n opt: TarOptions\n cwd: string\n maxReadSize?: number\n preservePaths: boolean\n strict: boolean\n noPax: boolean\n prefix: string\n linkCache: Exclude\n statCache: Exclude\n file: string\n portable: boolean\n zip?: zlib.BrotliCompress | zlib.Gzip | zlib.ZstdCompress\n readdirCache: Exclude\n noDirRecurse: boolean\n follow: boolean\n noMtime: boolean\n mtime?: Date\n filter: Exclude\n jobs: number;\n\n [WRITEENTRYCLASS]: typeof WriteEntry | typeof WriteEntrySync\n onWriteEntry?: (entry: WriteEntry) => void;\n // Note: we actually DO need a linked list here, because we\n // shift() to update the head of the list where we start, but still\n // while that happens, need to know what the next item in the queue\n // will be. Since we do multiple jobs in parallel, it's not as simple\n // as just an Array.shift(), since that would lose the information about\n // the next job in the list. We could add a .next field on the PackJob\n // class, but then we'd have to be tracking the tail of the queue the\n // whole time, and Yallist just does that for us anyway.\n [QUEUE]: Yallist;\n [JOBS]: number = 0;\n [PROCESSING]: boolean = false;\n [ENDED]: boolean = false\n\n constructor(opt: TarOptions = {}) {\n //@ts-ignore\n super()\n this.opt = opt\n this.file = opt.file || ''\n this.cwd = opt.cwd || process.cwd()\n this.maxReadSize = opt.maxReadSize\n this.preservePaths = !!opt.preservePaths\n this.strict = !!opt.strict\n this.noPax = !!opt.noPax\n this.prefix = normalizeWindowsPath(opt.prefix || '')\n this.linkCache = opt.linkCache || new Map()\n this.statCache = opt.statCache || new Map()\n this.readdirCache = opt.readdirCache || new Map()\n this.onWriteEntry = opt.onWriteEntry\n\n this[WRITEENTRYCLASS] = WriteEntry\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n\n this.portable = !!opt.portable\n\n if (opt.gzip || opt.brotli || opt.zstd) {\n if (\n (opt.gzip ? 1 : 0) +\n (opt.brotli ? 1 : 0) +\n (opt.zstd ? 1 : 0) >\n 1\n ) {\n throw new TypeError(\n 'gzip, brotli, zstd are mutually exclusive',\n )\n }\n if (opt.gzip) {\n if (typeof opt.gzip !== 'object') {\n opt.gzip = {}\n }\n if (this.portable) {\n opt.gzip.portable = true\n }\n this.zip = new zlib.Gzip(opt.gzip)\n }\n if (opt.brotli) {\n if (typeof opt.brotli !== 'object') {\n opt.brotli = {}\n }\n this.zip = new zlib.BrotliCompress(opt.brotli)\n }\n if (opt.zstd) {\n if (typeof opt.zstd !== 'object') {\n opt.zstd = {}\n }\n this.zip = new zlib.ZstdCompress(opt.zstd)\n }\n /* c8 ignore next */\n if (!this.zip) throw new Error('impossible')\n const zip = this.zip\n zip.on('data', chunk => super.write(chunk as unknown as string))\n zip.on('end', () => super.end())\n zip.on('drain', () => this[ONDRAIN]())\n this.on('resume', () => zip.resume())\n } else {\n this.on('drain', this[ONDRAIN])\n }\n\n this.noDirRecurse = !!opt.noDirRecurse\n this.follow = !!opt.follow\n this.noMtime = !!opt.noMtime\n if (opt.mtime) this.mtime = opt.mtime\n\n this.filter =\n typeof opt.filter === 'function' ? opt.filter : () => true\n\n this[QUEUE] = new Yallist()\n this[JOBS] = 0\n this.jobs = Number(opt.jobs) || 4\n this[PROCESSING] = false\n this[ENDED] = false\n }\n\n [WRITE](chunk: Buffer) {\n return super.write(chunk as unknown as string)\n }\n\n add(path: string | ReadEntry) {\n this.write(path)\n return this\n }\n\n end(cb?: () => void): this\n end(path: string | ReadEntry, cb?: () => void): this\n end(\n path: string | ReadEntry,\n encoding?: Minipass.Encoding,\n cb?: () => void,\n ): this\n end(\n path?: string | ReadEntry | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void,\n ) {\n /* c8 ignore start */\n if (typeof path === 'function') {\n cb = path\n path = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n /* c8 ignore stop */\n if (path) {\n this.add(path)\n }\n this[ENDED] = true\n this[PROCESS]()\n /* c8 ignore next */\n if (cb) cb()\n return this\n }\n\n write(path: string | ReadEntry) {\n if (this[ENDED]) {\n throw new Error('write after end')\n }\n\n if (path instanceof ReadEntry) {\n this[ADDTARENTRY](path)\n } else {\n this[ADDFSENTRY](path)\n }\n return this.flowing\n }\n\n [ADDTARENTRY](p: ReadEntry) {\n const absolute = normalizeWindowsPath(\n path.resolve(this.cwd, p.path),\n )\n // in this case, we don't have to wait for the stat\n if (!this.filter(p.path, p)) {\n p.resume()\n } else {\n const job = new PackJob(p.path, absolute)\n job.entry = new WriteEntryTar(p, this[ENTRYOPT](job))\n job.entry.on('end', () => this[JOBDONE](job))\n this[JOBS] += 1\n this[QUEUE].push(job)\n }\n\n this[PROCESS]()\n }\n\n [ADDFSENTRY](p: string) {\n const absolute = normalizeWindowsPath(path.resolve(this.cwd, p))\n this[QUEUE].push(new PackJob(p, absolute))\n this[PROCESS]()\n }\n\n [STAT](job: PackJob) {\n job.pending = true\n this[JOBS] += 1\n const stat = this.follow ? 'stat' : 'lstat'\n fs[stat](job.absolute, (er, stat) => {\n job.pending = false\n this[JOBS] -= 1\n if (er) {\n this.emit('error', er)\n } else {\n this[ONSTAT](job, stat)\n }\n })\n }\n\n [ONSTAT](job: PackJob, stat: Stats) {\n this.statCache.set(job.absolute, stat)\n job.stat = stat\n\n // now we have the stat, we can filter it.\n if (!this.filter(job.path, stat)) {\n job.ignore = true\n } else if (\n stat.isFile() &&\n stat.nlink > 1 &&\n job === this[CURRENT] &&\n !this.linkCache.get(`${stat.dev}:${stat.ino}`) &&\n !this.sync\n ) {\n // if it's not filtered, and it's a new File entry,\n // jump the queue in case any pending Link entries are about\n // to try to link to it. This prevents a hardlink from coming ahead\n // of its target in the archive.\n this[PROCESSJOB](job)\n }\n\n this[PROCESS]()\n }\n\n [READDIR](job: PackJob) {\n job.pending = true\n this[JOBS] += 1\n fs.readdir(job.absolute, (er, entries) => {\n job.pending = false\n this[JOBS] -= 1\n if (er) {\n return this.emit('error', er)\n }\n this[ONREADDIR](job, entries)\n })\n }\n\n [ONREADDIR](job: PackJob, entries: string[]) {\n this.readdirCache.set(job.absolute, entries)\n job.readdir = entries\n this[PROCESS]()\n }\n\n [PROCESS]() {\n if (this[PROCESSING]) {\n return\n }\n\n this[PROCESSING] = true\n for (\n let w = this[QUEUE].head;\n !!w && this[JOBS] < this.jobs;\n w = w.next\n ) {\n this[PROCESSJOB](w.value)\n if (w.value.ignore) {\n const p = w.next\n this[QUEUE].removeNode(w)\n w.next = p\n }\n }\n\n this[PROCESSING] = false\n\n if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) {\n if (this.zip) {\n this.zip.end(EOF)\n } else {\n super.write(EOF as unknown as string)\n super.end()\n }\n }\n }\n\n get [CURRENT]() {\n return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value\n }\n\n [JOBDONE](_job: PackJob) {\n this[QUEUE].shift()\n this[JOBS] -= 1\n this[PROCESS]()\n }\n\n [PROCESSJOB](job: PackJob) {\n if (job.pending) {\n return\n }\n\n if (job.entry) {\n if (job === this[CURRENT] && !job.piped) {\n this[PIPE](job)\n }\n return\n }\n\n if (!job.stat) {\n const sc = this.statCache.get(job.absolute)\n if (sc) {\n this[ONSTAT](job, sc)\n } else {\n this[STAT](job)\n }\n }\n if (!job.stat) {\n return\n }\n\n // filtered out!\n if (job.ignore) {\n return\n }\n\n if (\n !this.noDirRecurse &&\n job.stat.isDirectory() &&\n !job.readdir\n ) {\n const rc = this.readdirCache.get(job.absolute)\n if (rc) {\n this[ONREADDIR](job, rc)\n } else {\n this[READDIR](job)\n }\n if (!job.readdir) {\n return\n }\n }\n\n // we know it doesn't have an entry, because that got checked above\n job.entry = this[ENTRY](job)\n if (!job.entry) {\n job.ignore = true\n return\n }\n\n if (job === this[CURRENT] && !job.piped) {\n this[PIPE](job)\n }\n }\n\n [ENTRYOPT](job: PackJob): TarOptions {\n return {\n onwarn: (code, msg, data) => this.warn(code, msg, data),\n noPax: this.noPax,\n cwd: this.cwd,\n absolute: job.absolute,\n preservePaths: this.preservePaths,\n maxReadSize: this.maxReadSize,\n strict: this.strict,\n portable: this.portable,\n linkCache: this.linkCache,\n statCache: this.statCache,\n noMtime: this.noMtime,\n mtime: this.mtime,\n prefix: this.prefix,\n onWriteEntry: this.onWriteEntry,\n }\n }\n\n [ENTRY](job: PackJob) {\n this[JOBS] += 1\n try {\n const e = new this[WRITEENTRYCLASS](\n job.path,\n this[ENTRYOPT](job),\n )\n return e\n .on('end', () => this[JOBDONE](job))\n .on('error', er => this.emit('error', er))\n } catch (er) {\n this.emit('error', er)\n }\n }\n\n [ONDRAIN]() {\n if (this[CURRENT] && this[CURRENT].entry) {\n this[CURRENT].entry.resume()\n }\n }\n\n // like .pipe() but using super, because our write() is special\n [PIPE](job: PackJob) {\n job.piped = true\n\n if (job.readdir) {\n job.readdir.forEach(entry => {\n const p = job.path\n const base = p === './' ? '' : p.replace(/\\/*$/, '/')\n this[ADDFSENTRY](base + entry)\n })\n }\n\n const source = job.entry\n const zip = this.zip\n /* c8 ignore start */\n if (!source) throw new Error('cannot pipe without source')\n /* c8 ignore stop */\n\n if (zip) {\n source.on('data', chunk => {\n if (!zip.write(chunk)) {\n source.pause()\n }\n })\n } else {\n source.on('data', chunk => {\n if (!super.write(chunk as unknown as string)) {\n source.pause()\n }\n })\n }\n }\n\n pause() {\n if (this.zip) {\n this.zip.pause()\n }\n return super.pause()\n }\n warn(\n code: string,\n message: string | Error,\n data: WarnData = {},\n ): void {\n warnMethod(this, code, message, data)\n }\n}\n\nexport class PackSync extends Pack {\n sync: true = true\n constructor(opt: TarOptions) {\n super(opt)\n this[WRITEENTRYCLASS] = WriteEntrySync\n }\n\n // pause/resume are no-ops in sync streams.\n pause() {}\n resume() {}\n\n [STAT](job: PackJob) {\n const stat = this.follow ? 'statSync' : 'lstatSync'\n this[ONSTAT](job, fs[stat](job.absolute))\n }\n\n [READDIR](job: PackJob) {\n this[ONREADDIR](job, fs.readdirSync(job.absolute))\n }\n\n // gotta get it all in this tick\n [PIPE](job: PackJob) {\n const source = job.entry\n const zip = this.zip\n\n if (job.readdir) {\n job.readdir.forEach(entry => {\n const p = job.path\n const base = p === './' ? '' : p.replace(/\\/*$/, '/')\n this[ADDFSENTRY](base + entry)\n })\n }\n\n /* c8 ignore start */\n if (!source) throw new Error('Cannot pipe without source')\n /* c8 ignore stop */\n\n if (zip) {\n source.on('data', chunk => {\n zip.write(chunk)\n })\n } else {\n source.on('data', chunk => {\n super[WRITE](chunk)\n })\n }\n }\n}\n", "import { WriteStream, WriteStreamSync } from '@isaacs/fs-minipass'\nimport { Minipass } from 'minipass'\nimport path from 'node:path'\nimport { list } from './list.js'\nimport { makeCommand } from './make-command.js'\nimport {\n TarOptions,\n TarOptionsFile,\n TarOptionsSync,\n TarOptionsSyncFile,\n} from './options.js'\nimport { Pack, PackSync } from './pack.js'\n\nconst createFileSync = (opt: TarOptionsSyncFile, files: string[]) => {\n const p = new PackSync(opt)\n const stream = new WriteStreamSync(opt.file, {\n mode: opt.mode || 0o666,\n })\n p.pipe(stream as unknown as Minipass.Writable)\n addFilesSync(p, files)\n}\n\nconst createFile = (opt: TarOptionsFile, files: string[]) => {\n const p = new Pack(opt)\n const stream = new WriteStream(opt.file, {\n mode: opt.mode || 0o666,\n })\n p.pipe(stream as unknown as Minipass.Writable)\n\n const promise = new Promise((res, rej) => {\n stream.on('error', rej)\n stream.on('close', res)\n p.on('error', rej)\n })\n\n addFilesAsync(p, files)\n\n return promise\n}\n\nconst addFilesSync = (p: PackSync, files: string[]) => {\n files.forEach(file => {\n if (file.charAt(0) === '@') {\n list({\n file: path.resolve(p.cwd, file.slice(1)),\n sync: true,\n noResume: true,\n onReadEntry: entry => p.add(entry),\n })\n } else {\n p.add(file)\n }\n })\n p.end()\n}\n\nconst addFilesAsync = async (\n p: Pack,\n files: string[],\n): Promise => {\n for (let i = 0; i < files.length; i++) {\n const file = String(files[i])\n if (file.charAt(0) === '@') {\n await list({\n file: path.resolve(String(p.cwd), file.slice(1)),\n noResume: true,\n onReadEntry: entry => {\n p.add(entry)\n },\n })\n } else {\n p.add(file)\n }\n }\n p.end()\n}\n\nconst createSync = (opt: TarOptionsSync, files: string[]) => {\n const p = new PackSync(opt)\n addFilesSync(p, files)\n return p\n}\n\nconst createAsync = (opt: TarOptions, files: string[]) => {\n const p = new Pack(opt)\n addFilesAsync(p, files)\n return p\n}\n\nexport const create = makeCommand(\n createFileSync,\n createFile,\n createSync,\n createAsync,\n (_opt, files) => {\n if (!files?.length) {\n throw new TypeError('no paths specified to add to archive')\n }\n },\n)\n", "// Get the appropriate flag to use for creating files\n// We use fmap on Windows platforms for files less than\n// 512kb. This is a fairly low limit, but avoids making\n// things slower in some cases. Since most of what this\n// library is used for is extracting tarballs of many\n// relatively small files in npm packages and the like,\n// it can be a big boost on Windows platforms.\n\nimport fs from 'fs'\n\nconst platform = process.env.__FAKE_PLATFORM__ || process.platform\nconst isWindows = platform === 'win32'\n\n/* c8 ignore start */\nconst { O_CREAT, O_TRUNC, O_WRONLY } = fs.constants\nconst UV_FS_O_FILEMAP =\n Number(process.env.__FAKE_FS_O_FILENAME__) ||\n fs.constants.UV_FS_O_FILEMAP ||\n 0\n/* c8 ignore stop */\n\nconst fMapEnabled = isWindows && !!UV_FS_O_FILEMAP\nconst fMapLimit = 512 * 1024\nconst fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY\nexport const getWriteFlag =\n !fMapEnabled ?\n () => 'w'\n : (size: number) => (size < fMapLimit ? fMapFlag : 'w')\n", "import fs, { type Dirent } from 'node:fs'\nimport path from 'node:path'\n\nconst lchownSync = (path: string, uid: number, gid: number) => {\n try {\n return fs.lchownSync(path, uid, gid)\n } catch (er) {\n if ((er as NodeJS.ErrnoException)?.code !== 'ENOENT') throw er\n }\n}\n\nconst chown = (\n cpath: string,\n uid: number,\n gid: number,\n cb: (er?: unknown) => any,\n) => {\n fs.lchown(cpath, uid, gid, er => {\n // Skip ENOENT error\n cb(er && (er as NodeJS.ErrnoException)?.code !== 'ENOENT' ? er : null)\n })\n}\n\nconst chownrKid = (\n p: string,\n child: Dirent,\n uid: number,\n gid: number,\n cb: (er?: unknown) => any,\n) => {\n if (child.isDirectory()) {\n chownr(path.resolve(p, child.name), uid, gid, (er: unknown) => {\n if (er) return cb(er)\n const cpath = path.resolve(p, child.name)\n chown(cpath, uid, gid, cb)\n })\n } else {\n const cpath = path.resolve(p, child.name)\n chown(cpath, uid, gid, cb)\n }\n}\n\nexport const chownr = (\n p: string,\n uid: number,\n gid: number,\n cb: (er?: unknown) => any,\n) => {\n fs.readdir(p, { withFileTypes: true }, (er, children) => {\n // any error other than ENOTDIR or ENOTSUP means it's not readable,\n // or doesn't exist. give up.\n if (er) {\n if (er.code === 'ENOENT') return cb()\n else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP')\n return cb(er)\n }\n if (er || !children.length) return chown(p, uid, gid, cb)\n\n let len = children.length\n let errState: null | NodeJS.ErrnoException = null\n const then = (er?: unknown) => {\n /* c8 ignore start */\n if (errState) return\n /* c8 ignore stop */\n if (er) return cb((errState = er as NodeJS.ErrnoException))\n if (--len === 0) return chown(p, uid, gid, cb)\n }\n\n for (const child of children) {\n chownrKid(p, child, uid, gid, then)\n }\n })\n}\n\nconst chownrKidSync = (\n p: string,\n child: Dirent,\n uid: number,\n gid: number,\n) => {\n if (child.isDirectory())\n chownrSync(path.resolve(p, child.name), uid, gid)\n\n lchownSync(path.resolve(p, child.name), uid, gid)\n}\n\nexport const chownrSync = (p: string, uid: number, gid: number) => {\n let children: Dirent[]\n try {\n children = fs.readdirSync(p, { withFileTypes: true })\n } catch (er) {\n const e = er as NodeJS.ErrnoException\n if (e?.code === 'ENOENT') return\n else if (e?.code === 'ENOTDIR' || e?.code === 'ENOTSUP')\n return lchownSync(p, uid, gid)\n else throw e\n }\n\n for (const child of children) {\n chownrKidSync(p, child, uid, gid)\n }\n\n return lchownSync(p, uid, gid)\n}\n", "export class CwdError extends Error {\n path: string\n code: string\n syscall: 'chdir' = 'chdir'\n\n constructor(path: string, code: string) {\n super(`${code}: Cannot cd into '${path}'`)\n this.path = path\n this.code = code\n }\n\n get name() {\n return 'CwdError'\n }\n}\n", "export class SymlinkError extends Error {\n path: string\n symlink: string\n syscall: 'symlink' = 'symlink'\n code: 'TAR_SYMLINK_ERROR' = 'TAR_SYMLINK_ERROR'\n constructor(symlink: string, path: string) {\n super('TAR_SYMLINK_ERROR: Cannot extract through symbolic link')\n this.symlink = symlink\n this.path = path\n }\n get name() {\n return 'SymlinkError'\n }\n}\n", "import { chownr, chownrSync } from 'chownr'\nimport fs from 'node:fs'\nimport fsp from 'node:fs/promises'\nimport path from 'node:path'\nimport { CwdError } from './cwd-error.js'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport { SymlinkError } from './symlink-error.js'\n\nexport type MkdirOptions = {\n uid?: number\n gid?: number\n processUid?: number\n processGid?: number\n umask?: number\n preserve: boolean\n unlink: boolean\n cwd: string\n mode: number\n}\n\nexport type MkdirError =\n | NodeJS.ErrnoException\n | CwdError\n | SymlinkError\n\nconst checkCwd = (\n dir: string,\n cb: (er?: null | MkdirError) => any,\n) => {\n fs.stat(dir, (er, st) => {\n if (er || !st.isDirectory()) {\n er = new CwdError(\n dir,\n (er as NodeJS.ErrnoException)?.code || 'ENOTDIR',\n )\n }\n cb(er)\n })\n}\n\n/**\n * Wrapper around fs/promises.mkdir for tar's needs.\n *\n * The main purpose is to avoid creating directories if we know that\n * they already exist (and track which ones exist for this purpose),\n * and prevent entries from being extracted into symlinked folders,\n * if `preservePaths` is not set.\n */\nexport const mkdir = (\n dir: string,\n opt: MkdirOptions,\n cb: (er?: null | MkdirError, made?: string) => void,\n) => {\n dir = normalizeWindowsPath(dir)\n\n // if there's any overlap between mask and mode,\n // then we'll need an explicit chmod\n /* c8 ignore next */\n const umask = opt.umask ?? 0o22\n const mode = opt.mode | 0o0700\n const needChmod = (mode & umask) !== 0\n\n const uid = opt.uid\n const gid = opt.gid\n const doChown =\n typeof uid === 'number' &&\n typeof gid === 'number' &&\n (uid !== opt.processUid || gid !== opt.processGid)\n\n const preserve = opt.preserve\n const unlink = opt.unlink\n const cwd = normalizeWindowsPath(opt.cwd)\n\n const done = (er?: null | MkdirError, created?: string) => {\n if (er) {\n cb(er)\n } else {\n if (created && doChown) {\n chownr(created, uid, gid, er =>\n done(er as NodeJS.ErrnoException),\n )\n } else if (needChmod) {\n fs.chmod(dir, mode, cb)\n } else {\n cb()\n }\n }\n }\n\n if (dir === cwd) {\n return checkCwd(dir, done)\n }\n\n if (preserve) {\n return fsp.mkdir(dir, { mode, recursive: true }).then(\n made => done(null, made ?? undefined), // oh, ts\n done,\n )\n }\n\n const sub = normalizeWindowsPath(path.relative(cwd, dir))\n const parts = sub.split('/')\n mkdir_(cwd, parts, mode, unlink, cwd, undefined, done)\n}\n\nconst mkdir_ = (\n base: string,\n parts: string[],\n mode: number,\n unlink: boolean,\n cwd: string,\n created: string | undefined,\n cb: (er?: null | MkdirError, made?: string) => void,\n): void => {\n if (!parts.length) {\n return cb(null, created)\n }\n const p = parts.shift()\n const part = normalizeWindowsPath(path.resolve(base + '/' + p))\n fs.mkdir(\n part,\n mode,\n onmkdir(part, parts, mode, unlink, cwd, created, cb),\n )\n}\n\nconst onmkdir =\n (\n part: string,\n parts: string[],\n mode: number,\n unlink: boolean,\n cwd: string,\n created: string | undefined,\n cb: (er?: null | MkdirError, made?: string) => void,\n ) =>\n (er?: null | NodeJS.ErrnoException) => {\n if (er) {\n fs.lstat(part, (statEr, st) => {\n if (statEr) {\n statEr.path =\n statEr.path && normalizeWindowsPath(statEr.path)\n cb(statEr)\n } else if (st.isDirectory()) {\n mkdir_(part, parts, mode, unlink, cwd, created, cb)\n } else if (unlink) {\n fs.unlink(part, er => {\n if (er) {\n return cb(er)\n }\n fs.mkdir(\n part,\n mode,\n onmkdir(part, parts, mode, unlink, cwd, created, cb),\n )\n })\n } else if (st.isSymbolicLink()) {\n return cb(\n new SymlinkError(part, part + '/' + parts.join('/')),\n )\n } else {\n cb(er)\n }\n })\n } else {\n created = created || part\n mkdir_(part, parts, mode, unlink, cwd, created, cb)\n }\n }\n\nconst checkCwdSync = (dir: string) => {\n let ok = false\n let code: string | undefined = undefined\n try {\n ok = fs.statSync(dir).isDirectory()\n } catch (er) {\n code = (er as NodeJS.ErrnoException)?.code\n } finally {\n if (!ok) {\n throw new CwdError(dir, code ?? 'ENOTDIR')\n }\n }\n}\n\nexport const mkdirSync = (dir: string, opt: MkdirOptions) => {\n dir = normalizeWindowsPath(dir)\n // if there's any overlap between mask and mode,\n // then we'll need an explicit chmod\n /* c8 ignore next */\n const umask = opt.umask ?? 0o22\n const mode = opt.mode | 0o700\n const needChmod = (mode & umask) !== 0\n\n const uid = opt.uid\n const gid = opt.gid\n const doChown =\n typeof uid === 'number' &&\n typeof gid === 'number' &&\n (uid !== opt.processUid || gid !== opt.processGid)\n\n const preserve = opt.preserve\n const unlink = opt.unlink\n const cwd = normalizeWindowsPath(opt.cwd)\n\n const done = (created?: string | undefined) => {\n if (created && doChown) {\n chownrSync(created, uid, gid)\n }\n if (needChmod) {\n fs.chmodSync(dir, mode)\n }\n }\n\n if (dir === cwd) {\n checkCwdSync(cwd)\n return done()\n }\n\n if (preserve) {\n return done(\n fs.mkdirSync(dir, { mode, recursive: true }) ?? undefined,\n )\n }\n\n const sub = normalizeWindowsPath(path.relative(cwd, dir))\n const parts = sub.split('/')\n let created: string | undefined = undefined\n for (\n let p = parts.shift(), part = cwd;\n p && (part += '/' + p);\n p = parts.shift()\n ) {\n part = normalizeWindowsPath(path.resolve(part))\n\n try {\n fs.mkdirSync(part, mode)\n created = created || part\n } catch (er) {\n const st = fs.lstatSync(part)\n if (st.isDirectory()) {\n continue\n } else if (unlink) {\n fs.unlinkSync(part)\n fs.mkdirSync(part, mode)\n created = created || part\n continue\n } else if (st.isSymbolicLink()) {\n return new SymlinkError(part, part + '/' + parts.join('/'))\n }\n }\n }\n\n return done(created)\n}\n", "// warning: extremely hot code path.\n// This has been meticulously optimized for use\n// within npm install on large package trees.\n// Do not edit without careful benchmarking.\nconst normalizeCache: Record = Object.create(null)\n\n// Limit the size of this. Very low-sophistication LRU cache\nconst MAX = 10000\nconst cache = new Set()\nexport const normalizeUnicode = (s: string): string => {\n if (!cache.has(s)) {\n // shake out identical accents and ligatures\n normalizeCache[s] = s\n .normalize('NFD')\n .toLocaleLowerCase('en')\n .toLocaleUpperCase('en')\n } else {\n cache.delete(s)\n }\n cache.add(s)\n\n const ret = normalizeCache[s] as string\n\n let i = cache.size - MAX\n // only prune when we're 10% over the max\n if (i > MAX / 10) {\n for (const s of cache) {\n cache.delete(s)\n delete normalizeCache[s]\n if (--i <= 0) break\n }\n }\n\n return ret\n}\n", "// A path exclusive reservation system\n// reserve([list, of, paths], fn)\n// When the fn is first in line for all its paths, it\n// is called with a cb that clears the reservation.\n//\n// Used by async unpack to avoid clobbering paths in use,\n// while still allowing maximal safe parallelization.\n\nimport { join } from 'node:path'\nimport { normalizeUnicode } from './normalize-unicode.js'\nimport { stripTrailingSlashes } from './strip-trailing-slashes.js'\n\nconst platform =\n process.env.TESTING_TAR_FAKE_PLATFORM || process.platform\nconst isWindows = platform === 'win32'\n\nexport type Reservation = {\n paths: string[]\n dirs: Set\n}\n\nexport type Handler = (clear: () => void) => void\n\n// return a set of parent dirs for a given path\n// '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d']\nconst getDirs = (path: string) => {\n const dirs = path\n .split('/')\n .slice(0, -1)\n .reduce((set: string[], path) => {\n const s = set[set.length - 1]\n if (s !== undefined) {\n path = join(s, path)\n }\n set.push(path || '/')\n return set\n }, [])\n return dirs\n}\n\nexport class PathReservations {\n // path => [function or Set]\n // A Set object means a directory reservation\n // A fn is a direct reservation on that path\n #queues = new Map)[]>()\n\n // fn => {paths:[path,...], dirs:[path, ...]}\n #reservations = new Map()\n\n // functions currently running\n #running = new Set()\n\n reserve(paths: string[], fn: Handler) {\n paths =\n isWindows ?\n ['win32 parallelization disabled']\n : paths.map(p => {\n // don't need normPath, because we skip this entirely for windows\n return stripTrailingSlashes(join(normalizeUnicode(p)))\n })\n\n const dirs = new Set(\n paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b)),\n )\n this.#reservations.set(fn, { dirs, paths })\n for (const p of paths) {\n const q = this.#queues.get(p)\n if (!q) {\n this.#queues.set(p, [fn])\n } else {\n q.push(fn)\n }\n }\n for (const dir of dirs) {\n const q = this.#queues.get(dir)\n if (!q) {\n this.#queues.set(dir, [new Set([fn])])\n } else {\n const l = q[q.length - 1]\n if (l instanceof Set) {\n l.add(fn)\n } else {\n q.push(new Set([fn]))\n }\n }\n }\n return this.#run(fn)\n }\n\n // return the queues for each path the function cares about\n // fn => {paths, dirs}\n #getQueues(fn: Handler): {\n paths: Handler[][]\n dirs: (Handler | Set)[][]\n } {\n const res = this.#reservations.get(fn)\n /* c8 ignore start */\n if (!res) {\n throw new Error('function does not have any path reservations')\n }\n /* c8 ignore stop */\n return {\n paths: res.paths.map((path: string) =>\n this.#queues.get(path),\n ) as Handler[][],\n dirs: [...res.dirs].map(path => this.#queues.get(path)) as (\n | Handler\n | Set\n )[][],\n }\n }\n\n // check if fn is first in line for all its paths, and is\n // included in the first set for all its dir queues\n check(fn: Handler) {\n const { paths, dirs } = this.#getQueues(fn)\n return (\n paths.every(q => q && q[0] === fn) &&\n dirs.every(q => q && q[0] instanceof Set && q[0].has(fn))\n )\n }\n\n // run the function if it's first in line and not already running\n #run(fn: Handler) {\n if (this.#running.has(fn) || !this.check(fn)) {\n return false\n }\n this.#running.add(fn)\n fn(() => this.#clear(fn))\n return true\n }\n\n #clear(fn: Handler) {\n if (!this.#running.has(fn)) {\n return false\n }\n const res = this.#reservations.get(fn)\n /* c8 ignore start */\n if (!res) {\n throw new Error('invalid reservation')\n }\n /* c8 ignore stop */\n const { paths, dirs } = res\n\n const next = new Set()\n for (const path of paths) {\n const q = this.#queues.get(path)\n /* c8 ignore start */\n if (!q || q?.[0] !== fn) {\n continue\n }\n /* c8 ignore stop */\n const q0 = q[1]\n if (!q0) {\n this.#queues.delete(path)\n continue\n }\n q.shift()\n if (typeof q0 === 'function') {\n next.add(q0)\n } else {\n for (const f of q0) {\n next.add(f)\n }\n }\n }\n\n for (const dir of dirs) {\n const q = this.#queues.get(dir)\n const q0 = q?.[0]\n /* c8 ignore next - type safety only */\n if (!q || !(q0 instanceof Set)) continue\n if (q0.size === 1 && q.length === 1) {\n this.#queues.delete(dir)\n continue\n } else if (q0.size === 1) {\n q.shift()\n // next one must be a function,\n // or else the Set would've been reused\n const n = q[0]\n if (typeof n === 'function') {\n next.add(n)\n }\n } else {\n q0.delete(fn)\n }\n }\n\n this.#running.delete(fn)\n next.forEach(fn => this.#run(fn))\n return true\n }\n}\n", "// separate file so I stop getting nagged in vim about deprecated API.\nexport const umask = () => process.umask()\n", "// the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet.\n// but the path reservations are required to avoid race conditions where\n// parallelized unpack ops may mess with one another, due to dependencies\n// (like a Link depending on its target) or destructive operations (like\n// clobbering an fs object to create one of a different type.)\n\nimport * as fsm from '@isaacs/fs-minipass'\nimport assert from 'node:assert'\nimport { randomBytes } from 'node:crypto'\nimport fs, { type Stats } from 'node:fs'\nimport path from 'node:path'\nimport { getWriteFlag } from './get-write-flag.js'\nimport { mkdir, MkdirError, mkdirSync } from './mkdir.js'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport { Parser } from './parse.js'\nimport { stripAbsolutePath } from './strip-absolute-path.js'\nimport * as wc from './winchars.js'\n\nimport { TarOptions } from './options.js'\nimport { PathReservations } from './path-reservations.js'\nimport { ReadEntry } from './read-entry.js'\nimport { WarnData } from './warn-method.js'\nimport { SymlinkError } from './symlink-error.js'\nimport { umask } from './process-umask.js'\n\nconst ONENTRY = Symbol('onEntry')\nconst CHECKFS = Symbol('checkFs')\nconst CHECKFS2 = Symbol('checkFs2')\nconst ISREUSABLE = Symbol('isReusable')\nconst MAKEFS = Symbol('makeFs')\nconst FILE = Symbol('file')\nconst DIRECTORY = Symbol('directory')\nconst LINK = Symbol('link')\nconst SYMLINK = Symbol('symlink')\nconst HARDLINK = Symbol('hardlink')\nconst ENSURE_NO_SYMLINK = Symbol('ensureNoSymlink')\nconst UNSUPPORTED = Symbol('unsupported')\nconst CHECKPATH = Symbol('checkPath')\nconst STRIPABSOLUTEPATH = Symbol('stripAbsolutePath')\nconst MKDIR = Symbol('mkdir')\nconst ONERROR = Symbol('onError')\nconst PENDING = Symbol('pending')\nconst PEND = Symbol('pend')\nconst UNPEND = Symbol('unpend')\nconst ENDED = Symbol('ended')\nconst MAYBECLOSE = Symbol('maybeClose')\nconst SKIP = Symbol('skip')\nconst DOCHOWN = Symbol('doChown')\nconst UID = Symbol('uid')\nconst GID = Symbol('gid')\nconst CHECKED_CWD = Symbol('checkedCwd')\nconst platform =\n process.env.TESTING_TAR_FAKE_PLATFORM || process.platform\nconst isWindows = platform === 'win32'\nconst DEFAULT_MAX_DEPTH = 1024\n\n// Unlinks on Windows are not atomic.\n//\n// This means that if you have a file entry, followed by another\n// file entry with an identical name, and you cannot re-use the file\n// (because it's a hardlink, or because unlink:true is set, or it's\n// Windows, which does not have useful nlink values), then the unlink\n// will be committed to the disk AFTER the new file has been written\n// over the old one, deleting the new file.\n//\n// To work around this, on Windows systems, we rename the file and then\n// delete the renamed file. It's a sloppy kludge, but frankly, I do not\n// know of a better way to do this, given windows' non-atomic unlink\n// semantics.\n//\n// See: https://github.com/npm/node-tar/issues/183\n/* c8 ignore start */\nconst unlinkFile = (\n path: string,\n cb: (er?: Error | null) => void,\n) => {\n if (!isWindows) {\n return fs.unlink(path, cb)\n }\n\n const name = path + '.DELETE.' + randomBytes(16).toString('hex')\n fs.rename(path, name, er => {\n if (er) {\n return cb(er)\n }\n fs.unlink(name, cb)\n })\n}\n/* c8 ignore stop */\n\n/* c8 ignore start */\nconst unlinkFileSync = (path: string) => {\n if (!isWindows) {\n return fs.unlinkSync(path)\n }\n\n const name = path + '.DELETE.' + randomBytes(16).toString('hex')\n fs.renameSync(path, name)\n fs.unlinkSync(name)\n}\n/* c8 ignore stop */\n\n// this.gid, entry.gid, this.processUid\nconst uint32 = (\n a: number | undefined,\n b: number | undefined,\n c: number | undefined,\n) =>\n a !== undefined && a === a >>> 0 ? a\n : b !== undefined && b === b >>> 0 ? b\n : c\n\nexport class Unpack extends Parser {\n [ENDED]: boolean = false;\n [CHECKED_CWD]: boolean = false;\n [PENDING]: number = 0\n\n reservations: PathReservations = new PathReservations()\n transform?: TarOptions['transform']\n writable: true = true\n readable: false = false\n uid?: number\n gid?: number\n setOwner: boolean\n preserveOwner: boolean\n processGid?: number\n processUid?: number\n maxDepth: number\n forceChown: boolean\n win32: boolean\n newer: boolean\n keep: boolean\n noMtime: boolean\n preservePaths: boolean\n unlink: boolean\n cwd: string\n strip: number\n processUmask: number\n umask: number\n dmode: number\n fmode: number\n chmod: boolean\n\n constructor(opt: TarOptions = {}) {\n opt.ondone = () => {\n this[ENDED] = true\n this[MAYBECLOSE]()\n }\n\n super(opt)\n\n this.transform = opt.transform\n\n this.chmod = !!opt.chmod\n\n if (typeof opt.uid === 'number' || typeof opt.gid === 'number') {\n // need both or neither\n if (\n typeof opt.uid !== 'number' ||\n typeof opt.gid !== 'number'\n ) {\n throw new TypeError(\n 'cannot set owner without number uid and gid',\n )\n }\n if (opt.preserveOwner) {\n throw new TypeError(\n 'cannot preserve owner in archive and also set owner explicitly',\n )\n }\n this.uid = opt.uid\n this.gid = opt.gid\n this.setOwner = true\n } else {\n this.uid = undefined\n this.gid = undefined\n this.setOwner = false\n }\n\n // default true for root\n if (\n opt.preserveOwner === undefined &&\n typeof opt.uid !== 'number'\n ) {\n this.preserveOwner = !!(\n process.getuid && process.getuid() === 0\n )\n } else {\n this.preserveOwner = !!opt.preserveOwner\n }\n\n this.processUid =\n (this.preserveOwner || this.setOwner) && process.getuid ?\n process.getuid()\n : undefined\n this.processGid =\n (this.preserveOwner || this.setOwner) && process.getgid ?\n process.getgid()\n : undefined\n\n // prevent excessively deep nesting of subfolders\n // set to `Infinity` to remove this restriction\n this.maxDepth =\n typeof opt.maxDepth === 'number' ?\n opt.maxDepth\n : DEFAULT_MAX_DEPTH\n\n // mostly just for testing, but useful in some cases.\n // Forcibly trigger a chown on every entry, no matter what\n this.forceChown = opt.forceChown === true\n\n // turn > this[ONENTRY](entry))\n }\n\n // a bad or damaged archive is a warning for Parser, but an error\n // when extracting. Mark those errors as unrecoverable, because\n // the Unpack contract cannot be met.\n warn(code: string, msg: string | Error, data: WarnData = {}) {\n if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') {\n data.recoverable = false\n }\n return super.warn(code, msg, data)\n }\n\n [MAYBECLOSE]() {\n if (this[ENDED] && this[PENDING] === 0) {\n this.emit('prefinish')\n this.emit('finish')\n this.emit('end')\n }\n }\n\n // return false if we need to skip this file\n // return true if the field was successfully sanitized\n [STRIPABSOLUTEPATH](\n entry: ReadEntry,\n field: 'path' | 'linkpath',\n ): boolean {\n const p = entry[field]\n const { type } = entry\n if (!p || this.preservePaths) return true\n\n const parts = p.split('/')\n\n if (\n parts.includes('..') ||\n /* c8 ignore next */\n (isWindows && /^[a-z]:\\.\\.$/i.test(parts[0] ?? ''))\n ) {\n // For linkpath, check if the resolved path escapes cwd rather than\n // just rejecting any path with '..' - relative symlinks like\n // '../sibling/file' are valid if they resolve within the cwd.\n // For paths, they just simply may not ever use .. at all.\n if (field === 'path' || type === 'Link') {\n this.warn('TAR_ENTRY_ERROR', `${field} contains '..'`, {\n entry,\n [field]: p,\n })\n // not ok!\n return false\n } else {\n // Resolve linkpath relative to the entry's directory.\n // `path.posix` is safe to use because we're operating on\n // tar paths, not a filesystem.\n const entryDir = path.posix.dirname(entry.path)\n const resolved = path.posix.normalize(\n path.posix.join(entryDir, p),\n )\n // If the resolved path escapes (starts with ..), reject it\n if (resolved.startsWith('../') || resolved === '..') {\n this.warn(\n 'TAR_ENTRY_ERROR',\n `${field} escapes extraction directory`,\n {\n entry,\n [field]: p,\n },\n )\n return false\n }\n }\n }\n\n // strip off the root\n const [root, stripped] = stripAbsolutePath(p)\n if (root) {\n // ok, but triggers warning about stripping root\n entry[field] = String(stripped)\n this.warn(\n 'TAR_ENTRY_INFO',\n `stripping ${root} from absolute ${field}`,\n {\n entry,\n [field]: p,\n },\n )\n }\n return true\n }\n\n // no IO, just string checking for absolute indicators\n [CHECKPATH](entry: ReadEntry) {\n const p = normalizeWindowsPath(entry.path)\n const parts = p.split('/')\n\n if (this.strip) {\n if (parts.length < this.strip) {\n return false\n }\n if (entry.type === 'Link') {\n const linkparts = normalizeWindowsPath(\n String(entry.linkpath),\n ).split('/')\n if (linkparts.length >= this.strip) {\n entry.linkpath = linkparts.slice(this.strip).join('/')\n } else {\n return false\n }\n }\n parts.splice(0, this.strip)\n entry.path = parts.join('/')\n }\n\n if (isFinite(this.maxDepth) && parts.length > this.maxDepth) {\n this.warn('TAR_ENTRY_ERROR', 'path excessively deep', {\n entry,\n path: p,\n depth: parts.length,\n maxDepth: this.maxDepth,\n })\n return false\n }\n\n if (\n !this[STRIPABSOLUTEPATH](entry, 'path') ||\n !this[STRIPABSOLUTEPATH](entry, 'linkpath')\n ) {\n return false\n }\n\n if (path.isAbsolute(entry.path)) {\n entry.absolute = normalizeWindowsPath(path.resolve(entry.path))\n } else {\n entry.absolute = normalizeWindowsPath(\n path.resolve(this.cwd, entry.path),\n )\n }\n\n // if we somehow ended up with a path that escapes the cwd, and we are\n // not in preservePaths mode, then something is fishy! This should have\n // been prevented above, so ignore this for coverage.\n /* c8 ignore start - defense in depth */\n if (\n !this.preservePaths &&\n typeof entry.absolute === 'string' &&\n entry.absolute.indexOf(this.cwd + '/') !== 0 &&\n entry.absolute !== this.cwd\n ) {\n this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', {\n entry,\n path: normalizeWindowsPath(entry.path),\n resolvedPath: entry.absolute,\n cwd: this.cwd,\n })\n return false\n }\n /* c8 ignore stop */\n\n // an archive can set properties on the extraction directory, but it\n // may not replace the cwd with a different kind of thing entirely.\n if (\n entry.absolute === this.cwd &&\n entry.type !== 'Directory' &&\n entry.type !== 'GNUDumpDir'\n ) {\n return false\n }\n\n // only encode : chars that aren't drive letter indicators\n if (this.win32) {\n const { root: aRoot } = path.win32.parse(String(entry.absolute))\n entry.absolute =\n aRoot + wc.encode(String(entry.absolute).slice(aRoot.length))\n const { root: pRoot } = path.win32.parse(entry.path)\n entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length))\n }\n\n return true\n }\n\n [ONENTRY](entry: ReadEntry) {\n if (!this[CHECKPATH](entry)) {\n return entry.resume()\n }\n\n assert.equal(typeof entry.absolute, 'string')\n\n switch (entry.type) {\n case 'Directory':\n case 'GNUDumpDir':\n if (entry.mode) {\n entry.mode = entry.mode | 0o700\n }\n\n // eslint-disable-next-line no-fallthrough\n case 'File':\n case 'OldFile':\n case 'ContiguousFile':\n case 'Link':\n case 'SymbolicLink':\n return this[CHECKFS](entry)\n\n case 'CharacterDevice':\n case 'BlockDevice':\n case 'FIFO':\n default:\n return this[UNSUPPORTED](entry)\n }\n }\n\n [ONERROR](er: Error, entry: ReadEntry) {\n // Cwd has to exist, or else nothing works. That's serious.\n // Other errors are warnings, which raise the error in strict\n // mode, but otherwise continue on.\n if (er.name === 'CwdError') {\n this.emit('error', er)\n } else {\n this.warn('TAR_ENTRY_ERROR', er, { entry })\n this[UNPEND]()\n entry.resume()\n }\n }\n\n [MKDIR](\n dir: string,\n mode: number,\n cb: (er?: null | MkdirError, made?: string) => void,\n ) {\n mkdir(\n normalizeWindowsPath(dir),\n {\n uid: this.uid,\n gid: this.gid,\n processUid: this.processUid,\n processGid: this.processGid,\n umask: this.processUmask,\n preserve: this.preservePaths,\n unlink: this.unlink,\n cwd: this.cwd,\n mode: mode,\n },\n cb,\n )\n }\n\n [DOCHOWN](entry: ReadEntry) {\n // in preserve owner mode, chown if the entry doesn't match process\n // in set owner mode, chown if setting doesn't match process\n return (\n this.forceChown ||\n (this.preserveOwner &&\n ((typeof entry.uid === 'number' &&\n entry.uid !== this.processUid) ||\n (typeof entry.gid === 'number' &&\n entry.gid !== this.processGid))) ||\n (typeof this.uid === 'number' &&\n this.uid !== this.processUid) ||\n (typeof this.gid === 'number' && this.gid !== this.processGid)\n )\n }\n\n [UID](entry: ReadEntry) {\n return uint32(this.uid, entry.uid, this.processUid)\n }\n\n [GID](entry: ReadEntry) {\n return uint32(this.gid, entry.gid, this.processGid)\n }\n\n [FILE](entry: ReadEntry, fullyDone: () => void) {\n const mode =\n typeof entry.mode === 'number' ?\n entry.mode & 0o7777\n : this.fmode\n const stream = new fsm.WriteStream(String(entry.absolute), {\n // slight lie, but it can be numeric flags\n flags: getWriteFlag(entry.size) as string,\n mode: mode,\n autoClose: false,\n })\n stream.on('error', (er: Error) => {\n if (stream.fd) {\n fs.close(stream.fd, () => {})\n }\n\n // flush all the data out so that we aren't left hanging\n // if the error wasn't actually fatal. otherwise the parse\n // is blocked, and we never proceed.\n stream.write = () => true\n this[ONERROR](er, entry)\n fullyDone()\n })\n\n let actions = 1\n const done = (er?: null | Error) => {\n if (er) {\n /* c8 ignore start - we should always have a fd by now */\n if (stream.fd) {\n fs.close(stream.fd, () => {})\n }\n /* c8 ignore stop */\n\n this[ONERROR](er, entry)\n fullyDone()\n return\n }\n\n if (--actions === 0) {\n if (stream.fd !== undefined) {\n fs.close(stream.fd, er => {\n if (er) {\n this[ONERROR](er, entry)\n } else {\n this[UNPEND]()\n }\n fullyDone()\n })\n }\n }\n }\n\n stream.on('finish', () => {\n // if futimes fails, try utimes\n // if utimes fails, fail with the original error\n // same for fchown/chown\n const abs = String(entry.absolute)\n const fd = stream.fd\n\n if (typeof fd === 'number' && entry.mtime && !this.noMtime) {\n actions++\n const atime = entry.atime || new Date()\n const mtime = entry.mtime\n fs.futimes(fd, atime, mtime, er =>\n er ?\n fs.utimes(abs, atime, mtime, er2 => done(er2 && er))\n : done(),\n )\n }\n\n if (typeof fd === 'number' && this[DOCHOWN](entry)) {\n actions++\n const uid = this[UID](entry)\n const gid = this[GID](entry)\n if (typeof uid === 'number' && typeof gid === 'number') {\n fs.fchown(fd, uid, gid, er =>\n er ?\n fs.chown(abs, uid, gid, er2 => done(er2 && er))\n : done(),\n )\n }\n }\n\n done()\n })\n\n const tx = this.transform ? this.transform(entry) || entry : entry\n if (tx !== entry) {\n tx.on('error', (er: Error) => {\n this[ONERROR](er, entry)\n fullyDone()\n })\n entry.pipe(tx)\n }\n tx.pipe(stream)\n }\n\n [DIRECTORY](entry: ReadEntry, fullyDone: () => void) {\n const mode =\n typeof entry.mode === 'number' ?\n entry.mode & 0o7777\n : this.dmode\n this[MKDIR](String(entry.absolute), mode, er => {\n if (er) {\n this[ONERROR](er, entry)\n fullyDone()\n return\n }\n\n let actions = 1\n const done = () => {\n if (--actions === 0) {\n fullyDone()\n this[UNPEND]()\n entry.resume()\n }\n }\n\n if (entry.mtime && !this.noMtime) {\n actions++\n fs.utimes(\n String(entry.absolute),\n entry.atime || new Date(),\n entry.mtime,\n done,\n )\n }\n\n if (this[DOCHOWN](entry)) {\n actions++\n fs.chown(\n String(entry.absolute),\n Number(this[UID](entry)),\n Number(this[GID](entry)),\n done,\n )\n }\n\n done()\n })\n }\n\n [UNSUPPORTED](entry: ReadEntry) {\n entry.unsupported = true\n this.warn(\n 'TAR_ENTRY_UNSUPPORTED',\n `unsupported entry type: ${entry.type}`,\n { entry },\n )\n entry.resume()\n }\n\n [SYMLINK](entry: ReadEntry, done: () => void) {\n const parts = normalizeWindowsPath(\n path.relative(\n this.cwd,\n path.resolve(\n path.dirname(String(entry.absolute)),\n String(entry.linkpath),\n ),\n ),\n ).split('/')\n this[ENSURE_NO_SYMLINK](\n entry,\n this.cwd,\n parts,\n () =>\n this[LINK](entry, String(entry.linkpath), 'symlink', done),\n er => {\n this[ONERROR](er, entry)\n done()\n },\n )\n }\n\n [HARDLINK](entry: ReadEntry, done: () => void) {\n const linkpath = normalizeWindowsPath(\n path.resolve(this.cwd, String(entry.linkpath)),\n )\n const parts = normalizeWindowsPath(String(entry.linkpath)).split(\n '/',\n )\n this[ENSURE_NO_SYMLINK](\n entry,\n this.cwd,\n parts,\n () => this[LINK](entry, linkpath, 'link', done),\n er => {\n this[ONERROR](er, entry)\n done()\n },\n )\n }\n\n [ENSURE_NO_SYMLINK](\n entry: ReadEntry,\n cwd: string,\n parts: string[],\n done: () => void,\n onError: (er: SymlinkError) => void,\n ) {\n const p = parts.shift()\n if (this.preservePaths || p === undefined) return done()\n const t = path.resolve(cwd, p)\n fs.lstat(t, (er, st) => {\n if (er) return done()\n if (st?.isSymbolicLink()) {\n return onError(\n new SymlinkError(t, path.resolve(t, parts.join('/'))),\n )\n }\n this[ENSURE_NO_SYMLINK](entry, t, parts, done, onError)\n })\n }\n\n [PEND]() {\n this[PENDING]++\n }\n\n [UNPEND]() {\n this[PENDING]--\n this[MAYBECLOSE]()\n }\n\n [SKIP](entry: ReadEntry) {\n this[UNPEND]()\n entry.resume()\n }\n\n // Check if we can reuse an existing filesystem entry safely and\n // overwrite it, rather than unlinking and recreating\n // Windows doesn't report a useful nlink, so we just never reuse entries\n [ISREUSABLE](entry: ReadEntry, st: Stats) {\n return (\n entry.type === 'File' &&\n !this.unlink &&\n st.isFile() &&\n st.nlink <= 1 &&\n !isWindows\n )\n }\n\n // check if a thing is there, and if so, try to clobber it\n [CHECKFS](entry: ReadEntry) {\n this[PEND]()\n const paths = [entry.path]\n if (entry.linkpath) {\n paths.push(entry.linkpath)\n }\n this.reservations.reserve(paths, done =>\n this[CHECKFS2](entry, done),\n )\n }\n\n [CHECKFS2](entry: ReadEntry, fullyDone: (er?: Error) => void) {\n const done = (er?: Error) => {\n fullyDone(er)\n }\n\n const checkCwd = () => {\n this[MKDIR](this.cwd, this.dmode, er => {\n if (er) {\n this[ONERROR](er, entry)\n done()\n return\n }\n this[CHECKED_CWD] = true\n start()\n })\n }\n\n const start = () => {\n if (entry.absolute !== this.cwd) {\n const parent = normalizeWindowsPath(\n path.dirname(String(entry.absolute)),\n )\n if (parent !== this.cwd) {\n return this[MKDIR](parent, this.dmode, er => {\n if (er) {\n this[ONERROR](er, entry)\n done()\n return\n }\n afterMakeParent()\n })\n }\n }\n afterMakeParent()\n }\n\n const afterMakeParent = () => {\n fs.lstat(String(entry.absolute), (lstatEr, st) => {\n if (\n st &&\n (this.keep ||\n /* c8 ignore next */\n (this.newer && st.mtime > (entry.mtime ?? st.mtime)))\n ) {\n this[SKIP](entry)\n done()\n return\n }\n if (lstatEr || this[ISREUSABLE](entry, st)) {\n return this[MAKEFS](null, entry, done)\n }\n\n if (st.isDirectory()) {\n if (entry.type === 'Directory') {\n const needChmod =\n this.chmod &&\n entry.mode &&\n (st.mode & 0o7777) !== entry.mode\n const afterChmod = (er?: Error | null | undefined) =>\n this[MAKEFS](er ?? null, entry, done)\n if (!needChmod) {\n return afterChmod()\n }\n return fs.chmod(\n String(entry.absolute),\n Number(entry.mode),\n afterChmod,\n )\n }\n // Not a dir entry, have to remove it.\n // NB: the only way to end up with an entry that is the cwd\n // itself, in such a way that == does not detect, is a\n // tricky windows absolute path with UNC or 8.3 parts (and\n // preservePaths:true, or else it will have been stripped).\n // In that case, the user has opted out of path protections\n // explicitly, so if they blow away the cwd, c'est la vie.\n if (entry.absolute !== this.cwd) {\n return fs.rmdir(\n String(entry.absolute),\n (er?: null | Error) =>\n this[MAKEFS](er ?? null, entry, done),\n )\n }\n }\n\n // not a dir, and not reusable\n // don't remove if the cwd, we want that error\n if (entry.absolute === this.cwd) {\n return this[MAKEFS](null, entry, done)\n }\n\n unlinkFile(String(entry.absolute), er =>\n this[MAKEFS](er ?? null, entry, done),\n )\n })\n }\n\n if (this[CHECKED_CWD]) {\n start()\n } else {\n checkCwd()\n }\n }\n\n [MAKEFS](\n er: null | undefined | Error,\n entry: ReadEntry,\n done: () => void,\n ) {\n if (er) {\n this[ONERROR](er, entry)\n done()\n return\n }\n\n switch (entry.type) {\n case 'File':\n case 'OldFile':\n case 'ContiguousFile':\n return this[FILE](entry, done)\n\n case 'Link':\n return this[HARDLINK](entry, done)\n\n case 'SymbolicLink':\n return this[SYMLINK](entry, done)\n\n case 'Directory':\n case 'GNUDumpDir':\n return this[DIRECTORY](entry, done)\n }\n }\n\n [LINK](\n entry: ReadEntry,\n linkpath: string,\n link: 'link' | 'symlink',\n done: () => void,\n ) {\n fs[link](linkpath, String(entry.absolute), er => {\n if (er) {\n this[ONERROR](er, entry)\n } else {\n this[UNPEND]()\n entry.resume()\n }\n done()\n })\n }\n}\n\nconst callSync = (\n fn: () => T,\n): [null, T] | [NodeJS.ErrnoException, null] => {\n try {\n return [null, fn()]\n } catch (er) {\n return [er as NodeJS.ErrnoException, null]\n }\n}\n\nexport class UnpackSync extends Unpack {\n sync: true = true;\n\n [MAKEFS](er: null | Error | undefined, entry: ReadEntry) {\n return super[MAKEFS](er, entry, () => {})\n }\n\n [CHECKFS](entry: ReadEntry) {\n if (!this[CHECKED_CWD]) {\n const er = this[MKDIR](this.cwd, this.dmode)\n if (er) {\n return this[ONERROR](er as Error, entry)\n }\n this[CHECKED_CWD] = true\n }\n\n // don't bother to make the parent if the current entry is the cwd,\n // we've already checked it.\n if (entry.absolute !== this.cwd) {\n const parent = normalizeWindowsPath(\n path.dirname(String(entry.absolute)),\n )\n if (parent !== this.cwd) {\n const mkParent = this[MKDIR](parent, this.dmode)\n if (mkParent) {\n return this[ONERROR](mkParent as Error, entry)\n }\n }\n }\n\n const [lstatEr, st] = callSync(() =>\n fs.lstatSync(String(entry.absolute)),\n )\n if (\n st &&\n (this.keep ||\n /* c8 ignore next */\n (this.newer && st.mtime > (entry.mtime ?? st.mtime)))\n ) {\n return this[SKIP](entry)\n }\n\n if (lstatEr || this[ISREUSABLE](entry, st)) {\n return this[MAKEFS](null, entry)\n }\n\n if (st.isDirectory()) {\n if (entry.type === 'Directory') {\n const needChmod =\n this.chmod &&\n entry.mode &&\n (st.mode & 0o7777) !== entry.mode\n const [er] =\n needChmod ?\n callSync(() => {\n fs.chmodSync(String(entry.absolute), Number(entry.mode))\n })\n : []\n return this[MAKEFS](er, entry)\n }\n // not a dir entry, have to remove it\n const [er] = callSync(() =>\n fs.rmdirSync(String(entry.absolute)),\n )\n this[MAKEFS](er, entry)\n }\n\n // not a dir, and not reusable.\n // don't remove if it's the cwd, since we want that error.\n const [er] =\n entry.absolute === this.cwd ?\n []\n : callSync(() => unlinkFileSync(String(entry.absolute)))\n this[MAKEFS](er, entry)\n }\n\n [FILE](entry: ReadEntry, done: () => void) {\n const mode =\n typeof entry.mode === 'number' ?\n entry.mode & 0o7777\n : this.fmode\n\n const oner = (er?: null | Error | undefined) => {\n let closeError\n try {\n fs.closeSync(fd)\n } catch (e) {\n closeError = e\n }\n if (er || closeError) {\n this[ONERROR]((er as Error) || closeError, entry)\n }\n done()\n }\n\n let fd: number\n try {\n fd = fs.openSync(\n String(entry.absolute),\n getWriteFlag(entry.size),\n mode,\n )\n /* c8 ignore start - This is only a problem if the file was successfully\n * statted, BUT failed to open. Testing this is annoying, and we\n * already have ample testint for other uses of oner() methods.\n */\n } catch (er) {\n return oner(er as Error)\n }\n /* c8 ignore stop */\n const tx = this.transform ? this.transform(entry) || entry : entry\n if (tx !== entry) {\n tx.on('error', (er: Error) => this[ONERROR](er, entry))\n entry.pipe(tx)\n }\n\n tx.on('data', (chunk: Buffer) => {\n try {\n fs.writeSync(fd, chunk, 0, chunk.length)\n } catch (er) {\n oner(er as Error)\n }\n })\n\n tx.on('end', () => {\n let er = null\n // try both, falling futimes back to utimes\n // if either fails, handle the first error\n if (entry.mtime && !this.noMtime) {\n const atime = entry.atime || new Date()\n const mtime = entry.mtime\n try {\n fs.futimesSync(fd, atime, mtime)\n } catch (futimeser) {\n try {\n fs.utimesSync(String(entry.absolute), atime, mtime)\n } catch (utimeser) {\n er = futimeser\n }\n }\n }\n\n if (this[DOCHOWN](entry)) {\n const uid = this[UID](entry)\n const gid = this[GID](entry)\n\n try {\n fs.fchownSync(fd, Number(uid), Number(gid))\n } catch (fchowner) {\n try {\n fs.chownSync(\n String(entry.absolute),\n Number(uid),\n Number(gid),\n )\n } catch (chowner) {\n er = er || fchowner\n }\n }\n }\n\n oner(er as Error)\n })\n }\n\n [DIRECTORY](entry: ReadEntry, done: () => void) {\n const mode =\n typeof entry.mode === 'number' ?\n entry.mode & 0o7777\n : this.dmode\n const er = this[MKDIR](String(entry.absolute), mode)\n if (er) {\n this[ONERROR](er as Error, entry)\n done()\n return\n }\n if (entry.mtime && !this.noMtime) {\n try {\n fs.utimesSync(\n String(entry.absolute),\n entry.atime || new Date(),\n entry.mtime,\n )\n /* c8 ignore next */\n } catch (er) {}\n }\n if (this[DOCHOWN](entry)) {\n try {\n fs.chownSync(\n String(entry.absolute),\n Number(this[UID](entry)),\n Number(this[GID](entry)),\n )\n } catch (er) {}\n }\n done()\n entry.resume()\n }\n\n [MKDIR](dir: string, mode: number) {\n try {\n return mkdirSync(normalizeWindowsPath(dir), {\n uid: this.uid,\n gid: this.gid,\n processUid: this.processUid,\n processGid: this.processGid,\n umask: this.processUmask,\n preserve: this.preservePaths,\n unlink: this.unlink,\n cwd: this.cwd,\n mode: mode,\n })\n } catch (er) {\n return er\n }\n }\n\n [ENSURE_NO_SYMLINK](\n _entry: ReadEntry,\n cwd: string,\n parts: string[],\n done: () => void,\n onError: (er: SymlinkError) => void,\n ) {\n if (this.preservePaths || !parts.length) return done()\n let t = cwd\n for (const p of parts) {\n t = path.resolve(t, p)\n const [er, st] = callSync(() => fs.lstatSync(t))\n if (er) return done()\n if (st.isSymbolicLink()) {\n return onError(\n new SymlinkError(t, path.resolve(cwd, parts.join('/'))),\n )\n }\n }\n done()\n }\n\n [LINK](\n entry: ReadEntry,\n linkpath: string,\n link: 'link' | 'symlink',\n done: () => void,\n ) {\n const linkSync: `${typeof link}Sync` = `${link}Sync`\n try {\n fs[linkSync](linkpath, String(entry.absolute))\n done()\n entry.resume()\n } catch (er) {\n return this[ONERROR](er as Error, entry)\n }\n }\n}\n", "// tar -x\nimport * as fsm from '@isaacs/fs-minipass'\nimport fs from 'node:fs'\nimport { filesFilter } from './list.js'\nimport { makeCommand } from './make-command.js'\nimport { TarOptionsFile, TarOptionsSyncFile } from './options.js'\nimport { Unpack, UnpackSync } from './unpack.js'\n\nconst extractFileSync = (opt: TarOptionsSyncFile) => {\n const u = new UnpackSync(opt)\n const file = opt.file\n const stat = fs.statSync(file)\n // This trades a zero-byte read() syscall for a stat\n // However, it will usually result in less memory allocation\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n const stream = new fsm.ReadStreamSync(file, {\n readSize: readSize,\n size: stat.size,\n })\n stream.pipe(u)\n}\n\nconst extractFile = (opt: TarOptionsFile, _?: string[]) => {\n const u = new Unpack(opt)\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n\n const file = opt.file\n const p = new Promise((resolve, reject) => {\n u.on('error', reject)\n u.on('close', resolve)\n\n // This trades a zero-byte read() syscall for a stat\n // However, it will usually result in less memory allocation\n fs.stat(file, (er, stat) => {\n if (er) {\n reject(er)\n } else {\n const stream = new fsm.ReadStream(file, {\n readSize: readSize,\n size: stat.size,\n })\n stream.on('error', reject)\n stream.pipe(u)\n }\n })\n })\n return p\n}\n\nexport const extract = makeCommand(\n extractFileSync,\n extractFile,\n opt => new UnpackSync(opt),\n opt => new Unpack(opt),\n (opt, files) => {\n if (files?.length) filesFilter(opt, files)\n },\n)\n", "// tar -r\nimport { WriteStream, WriteStreamSync } from '@isaacs/fs-minipass'\nimport { Minipass } from 'minipass'\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { Header } from './header.js'\nimport { list } from './list.js'\nimport { makeCommand } from './make-command.js'\nimport {\n isFile,\n TarOptionsFile,\n TarOptionsSyncFile,\n} from './options.js'\nimport { Pack, PackSync } from './pack.js'\n\n// starting at the head of the file, read a Header\n// If the checksum is invalid, that's our position to start writing\n// If it is, jump forward by the specified size (round up to 512)\n// and try again.\n// Write the new Pack stream starting there.\n\nconst replaceSync = (opt: TarOptionsSyncFile, files: string[]) => {\n const p = new PackSync(opt)\n\n let threw = true\n let fd\n let position\n\n try {\n try {\n fd = fs.openSync(opt.file, 'r+')\n } catch (er) {\n if ((er as NodeJS.ErrnoException)?.code === 'ENOENT') {\n fd = fs.openSync(opt.file, 'w+')\n } else {\n throw er\n }\n }\n\n const st = fs.fstatSync(fd)\n const headBuf = Buffer.alloc(512)\n\n POSITION: for (\n position = 0;\n position < st.size;\n position += 512\n ) {\n for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) {\n bytes = fs.readSync(\n fd,\n headBuf,\n bufPos,\n headBuf.length - bufPos,\n position + bufPos,\n )\n\n if (\n position === 0 &&\n headBuf[0] === 0x1f &&\n headBuf[1] === 0x8b\n ) {\n throw new Error('cannot append to compressed archives')\n }\n\n if (!bytes) {\n break POSITION\n }\n }\n\n const h = new Header(headBuf)\n if (!h.cksumValid) {\n break\n }\n const entryBlockSize = 512 * Math.ceil((h.size || 0) / 512)\n if (position + entryBlockSize + 512 > st.size) {\n break\n }\n // the 512 for the header we just parsed will be added as well\n // also jump ahead all the blocks for the body\n position += entryBlockSize\n if (opt.mtimeCache && h.mtime) {\n opt.mtimeCache.set(String(h.path), h.mtime)\n }\n }\n threw = false\n\n streamSync(opt, p, position, fd, files)\n } finally {\n if (threw) {\n try {\n fs.closeSync(fd as number)\n } catch (er) {}\n }\n }\n}\n\nconst streamSync = (\n opt: TarOptionsSyncFile,\n p: Pack,\n position: number,\n fd: number,\n files: string[],\n) => {\n const stream = new WriteStreamSync(opt.file, {\n fd: fd,\n start: position,\n })\n p.pipe(stream as unknown as Minipass.Writable)\n addFilesSync(p, files)\n}\n\nconst replaceAsync = (\n opt: TarOptionsFile,\n files: string[],\n): Promise => {\n files = Array.from(files)\n const p = new Pack(opt)\n\n const getPos = (\n fd: number,\n size: number,\n cb_: (er?: null | Error, pos?: number) => void,\n ) => {\n const cb = (er?: Error | null, pos?: number) => {\n if (er) {\n fs.close(fd, _ => cb_(er))\n } else {\n cb_(null, pos)\n }\n }\n\n let position = 0\n if (size === 0) {\n return cb(null, 0)\n }\n\n let bufPos = 0\n const headBuf = Buffer.alloc(512)\n const onread = (er?: null | Error, bytes?: number): void => {\n if (er || typeof bytes === 'undefined') {\n return cb(er)\n }\n bufPos += bytes\n if (bufPos < 512 && bytes) {\n return fs.read(\n fd,\n headBuf,\n bufPos,\n headBuf.length - bufPos,\n position + bufPos,\n onread,\n )\n }\n\n if (\n position === 0 &&\n headBuf[0] === 0x1f &&\n headBuf[1] === 0x8b\n ) {\n return cb(new Error('cannot append to compressed archives'))\n }\n\n // truncated header\n if (bufPos < 512) {\n return cb(null, position)\n }\n\n const h = new Header(headBuf)\n if (!h.cksumValid) {\n return cb(null, position)\n }\n\n /* c8 ignore next */\n const entryBlockSize = 512 * Math.ceil((h.size ?? 0) / 512)\n if (position + entryBlockSize + 512 > size) {\n return cb(null, position)\n }\n\n position += entryBlockSize + 512\n if (position >= size) {\n return cb(null, position)\n }\n\n if (opt.mtimeCache && h.mtime) {\n opt.mtimeCache.set(String(h.path), h.mtime)\n }\n bufPos = 0\n fs.read(fd, headBuf, 0, 512, position, onread)\n }\n fs.read(fd, headBuf, 0, 512, position, onread)\n }\n\n const promise = new Promise((resolve, reject) => {\n p.on('error', reject)\n let flag = 'r+'\n const onopen = (\n er?: NodeJS.ErrnoException | null,\n fd?: number,\n ) => {\n if (er && er.code === 'ENOENT' && flag === 'r+') {\n flag = 'w+'\n return fs.open(opt.file, flag, onopen)\n }\n\n if (er || !fd) {\n return reject(er)\n }\n\n fs.fstat(fd, (er, st) => {\n if (er) {\n return fs.close(fd, () => reject(er))\n }\n\n getPos(fd, st.size, (er, position) => {\n if (er) {\n return reject(er)\n }\n const stream = new WriteStream(opt.file, {\n fd: fd,\n start: position,\n })\n p.pipe(stream as unknown as Minipass.Writable)\n stream.on('error', reject)\n stream.on('close', resolve)\n addFilesAsync(p, files)\n })\n })\n }\n fs.open(opt.file, flag, onopen)\n })\n\n return promise\n}\n\nconst addFilesSync = (p: Pack, files: string[]) => {\n files.forEach(file => {\n if (file.charAt(0) === '@') {\n list({\n file: path.resolve(p.cwd, file.slice(1)),\n sync: true,\n noResume: true,\n onReadEntry: entry => p.add(entry),\n })\n } else {\n p.add(file)\n }\n })\n p.end()\n}\n\nconst addFilesAsync = async (\n p: Pack,\n files: string[],\n): Promise => {\n for (let i = 0; i < files.length; i++) {\n const file = String(files[i])\n if (file.charAt(0) === '@') {\n await list({\n file: path.resolve(String(p.cwd), file.slice(1)),\n noResume: true,\n onReadEntry: entry => p.add(entry),\n })\n } else {\n p.add(file)\n }\n }\n p.end()\n}\n\nexport const replace = makeCommand(\n replaceSync,\n replaceAsync,\n /* c8 ignore start */\n (): never => {\n throw new TypeError('file is required')\n },\n (): never => {\n throw new TypeError('file is required')\n },\n /* c8 ignore stop */\n (opt, entries) => {\n if (!isFile(opt)) {\n throw new TypeError('file is required')\n }\n\n if (\n opt.gzip ||\n opt.brotli ||\n opt.zstd ||\n opt.file.endsWith('.br') ||\n opt.file.endsWith('.tbr')\n ) {\n throw new TypeError('cannot append to compressed archives')\n }\n\n if (!entries?.length) {\n throw new TypeError('no paths specified to add/replace')\n }\n },\n)\n", "// tar -u\n\nimport { makeCommand } from './make-command.js'\nimport { type TarOptionsWithAliases } from './options.js'\n\nimport { replace as r } from './replace.js'\n\n// just call tar.r with the filter and mtimeCache\nexport const update = makeCommand(\n r.syncFile,\n r.asyncFile,\n r.syncNoFile,\n r.asyncNoFile,\n (opt, entries = []) => {\n r.validate?.(opt, entries)\n mtimeFilter(opt)\n },\n)\n\nconst mtimeFilter = (opt: TarOptionsWithAliases) => {\n const filter = opt.filter\n\n if (!opt.mtimeCache) {\n opt.mtimeCache = new Map()\n }\n\n opt.filter =\n filter ?\n (path, stat) =>\n filter(path, stat) &&\n !(\n /* c8 ignore start */\n (\n (opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) >\n (stat.mtime ?? 0)\n )\n /* c8 ignore stop */\n )\n : (path, stat) =>\n !(\n /* c8 ignore start */\n (\n (opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) >\n (stat.mtime ?? 0)\n )\n /* c8 ignore stop */\n )\n}\n", "export {\n type TarOptionsWithAliasesAsync,\n type TarOptionsWithAliasesAsyncFile,\n type TarOptionsWithAliasesAsyncNoFile,\n type TarOptionsWithAliasesSyncNoFile,\n type TarOptionsWithAliases,\n type TarOptionsWithAliasesFile,\n type TarOptionsWithAliasesSync,\n type TarOptionsWithAliasesSyncFile,\n} from './options.js'\n\nexport * from './create.js'\nexport { create as c } from './create.js'\nexport * from './extract.js'\nexport { extract as x } from './extract.js'\nexport * from './header.js'\nexport * from './list.js'\nexport { list as t } from './list.js'\n// classes\nexport * from './pack.js'\nexport * from './parse.js'\nexport * from './pax.js'\nexport * from './read-entry.js'\nexport * from './replace.js'\nexport { replace as r } from './replace.js'\nexport * as types from './types.js'\nexport * from './unpack.js'\nexport * from './update.js'\nexport { update as u } from './update.js'\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AAKC,EAAK,OAAS,IAC3CA,EAAK,OAAS,GAI3B,wlCCpCAC,EAAA,KAAA,OAAA,EACA,IAAAC,GAAA,KAAS,OAAA,eAAA,QAAA,IAAA,CAAA,WAAA,GAAA,IAAA,UAAA,CAAA,OAAAA,GAAA,MAAM,CAAA,CAAA,EACfD,EAAA,KAAA,OAAA,EACA,IAAAE,GAAA,KAAS,OAAA,eAAA,QAAA,IAAA,CAAA,WAAA,GAAA,IAAA,UAAA,CAAA,OAAAA,GAAA,OAAO,CAAA,CAAA,EAChBF,EAAA,KAAA,OAAA,EACAA,EAAA,KAAA,OAAA,EACA,IAAAG,GAAA,KAAS,OAAA,eAAA,QAAA,IAAA,CAAA,WAAA,GAAA,IAAA,UAAA,CAAA,OAAAA,GAAA,IAAI,CAAA,CAAA,EAEbH,EAAA,KAAA,OAAA,EACAA,EAAA,KAAA,OAAA,EACAA,EAAA,KAAA,OAAA,EACAA,EAAA,KAAA,OAAA,EACAA,EAAA,KAAA,OAAA,EACA,IAAAI,GAAA,KAAS,OAAA,eAAA,QAAA,IAAA,CAAA,WAAA,GAAA,IAAA,UAAA,CAAA,OAAAA,GAAA,OAAO,CAAA,CAAA,EAChB,QAAA,MAAAC,GAAA,IAAA,EACAL,EAAA,KAAA,OAAA,EACAA,EAAA,KAAA,OAAA,EACA,IAAAM,GAAA,KAAS,OAAA,eAAA,QAAA,IAAA,CAAA,WAAA,GAAA,IAAA,UAAA,CAAA,OAAAA,GAAA,MAAM,CAAA,CAAA,EACfN,EAAA,KAAA,OAAA", + "names": ["proc", "node_events_1", "node_stream_1", "__importDefault", "node_string_decoder_1", "isStream", "Minipass", "exports", "isReadable", "isWritable", "EOF", "MAYBE_EMIT_END", "EMITTED_END", "EMITTING_END", "EMITTED_ERROR", "CLOSED", "READ", "FLUSH", "FLUSHCHUNK", "ENCODING", "DECODER", "FLOWING", "PAUSED", "RESUME", "BUFFER", "PIPES", "BUFFERLENGTH", "BUFFERPUSH", "BUFFERSHIFT", "OBJECTMODE", "DESTROYED", "ERROR", "EMITDATA", "EMITEND", "EMITEND2", "ASYNC", "ABORT", "ABORTED", "SIGNAL", "DATALISTENERS", "DISCARDED", "defer", "fn", "nodefer", "isEndish", "ev", "isArrayBufferLike", "b", "isArrayBufferView", "Pipe", "src", "dest", "opts", "_er", "PipeProxyErrors", "er", "isObjectModeOptions", "o", "isEncodingOptions", "args", "options", "signal", "_enc", "_om", "a", "_", "chunk", "encoding", "cb", "n", "ret", "c", "noDrain", "ended", "p", "handler", "h", "data", "buf", "resolve", "reject", "stopped", "stop", "res", "onerr", "ondata", "onend", "ondestroy", "value", "rej", "next", "wc", "events_1", "__importDefault", "fs_1", "minipass_1", "writev", "_autoClose", "_close", "_ended", "_fd", "_finished", "_flags", "_flush", "_handleChunk", "_makeBuf", "_mode", "_needDrain", "_onerror", "_onopen", "_onread", "_onwrite", "_open", "_path", "_pos", "_queue", "_read", "_readSize", "_reading", "_remain", "_size", "_write", "_writing", "_defaultFlag", "_errored", "ReadStream", "path", "opt", "er", "fd", "buf", "br", "b", "ret", "ev", "args", "exports", "ReadStreamSync", "threw", "WriteStream", "defaultFlag", "enc", "bw", "iovec", "WriteStreamSync", "argmap", "isSyncFile", "o", "exports", "isAsyncFile", "isSyncNoFile", "isAsyncNoFile", "isSync", "isAsync", "isFile", "isNoFile", "dealiasKey", "k", "d", "dealias", "opt", "result", "key", "v", "options_js_1", "makeCommand", "syncFile", "asyncFile", "syncNoFile", "asyncNoFile", "validate", "opt_", "entries", "cb", "opt", "p", "c", "exports", "zlib_1", "__importDefault", "realZlibConstants", "exports", "assert_1", "__importDefault", "buffer_1", "minipass_1", "realZlib", "__importStar", "constants_js_1", "constants_js_2", "exports", "OriginalBufferConcat", "desc", "noop", "args", "passthroughBufferConcat", "makeNoOp", "_", "_superWrite", "ZlibError", "err", "origin", "_flushFlag", "ZlibBase", "#sawError", "#ended", "#flushFlag", "#finishFlushFlag", "#fullFlushFlag", "#handle", "#onError", "opts", "mode", "er", "flushFlag", "chunk", "encoding", "cb", "data", "nativeHandle", "originalNativeClose", "originalClose", "result", "writeReturn", "r", "i", "Zlib", "#level", "#strategy", "level", "strategy", "origFlush", "Deflate", "Inflate", "Gzip", "#portable", "Gunzip", "DeflateRaw", "InflateRaw", "Unzip", "Brotli", "BrotliCompress", "BrotliDecompress", "Zstd", "ZstdCompress", "ZstdDecompress", "encode", "num", "buf", "encodeNegative", "encodePositive", "exports", "i", "flipped", "byte", "onesComp", "twosComp", "parse", "pre", "value", "pos", "twos", "len", "sum", "f", "isCode", "c", "exports", "isName", "kv", "node_path_1", "large", "__importStar", "types", "Header", "#type", "data", "off", "ex", "gex", "#slurp", "buf", "decString", "decNumber", "decDate", "t", "prefix", "sum", "i", "k", "v", "prefixSize", "split", "splitPrefix", "path", "encString", "encNumber", "encDate", "type", "c", "exports", "p", "pp", "ret", "root", "size", "numToDate", "num", "decSmallNumber", "nanUndef", "value", "MAXNUM", "encSmallNumber", "octalString", "padOctal", "str", "date", "NULLS", "node_path_1", "header_js_1", "Pax", "_Pax", "obj", "global", "body", "bodyLen", "bufLen", "buf", "i", "field", "r", "v", "s", "byteLen", "digits", "str", "ex", "g", "merge", "parseKV", "exports", "a", "b", "parseKVLine", "set", "line", "n", "kv", "k", "platform", "exports", "p", "minipass_1", "normalize_windows_path_js_1", "ReadEntry", "header", "ex", "gex", "#slurp", "data", "writeLen", "r", "br", "k", "v", "exports", "warnMethod", "self", "code", "message", "data", "exports", "events_1", "minizlib_1", "header_js_1", "pax_js_1", "read_entry_js_1", "warn_method_js_1", "maxMetaEntrySize", "gzipHeader", "zstdHeader", "ZIP_HEADER_LEN", "STATE", "WRITEENTRY", "READENTRY", "NEXTENTRY", "PROCESSENTRY", "EX", "GEX", "META", "EMITMETA", "BUFFER", "QUEUE", "ENDED", "EMITTEDEND", "EMIT", "UNZIP", "CONSUMECHUNK", "CONSUMECHUNKSUB", "CONSUMEBODY", "CONSUMEMETA", "CONSUMEHEADER", "CONSUMING", "BUFFERCONCAT", "MAYBEEND", "WRITING", "ABORTED", "DONE", "SAW_VALID_ENTRY", "SAW_NULL_BLOCK", "SAW_EOF", "CLOSESTREAM", "noop", "Parser", "opt", "isTBR", "isTZST", "code", "message", "data", "chunk", "position", "header", "er", "type", "entry", "onend", "c", "go", "ev", "args", "re", "br", "ret", "extra", "ex", "error", "encoding", "cb", "i", "isZstd", "maybeBrotli", "ended", "have", "length", "exports", "stripTrailingSlashes", "str", "i", "slashesStart", "exports", "fsm", "__importStar", "node_fs_1", "__importDefault", "path_1", "make_command_js_1", "parse_js_1", "strip_trailing_slashes_js_1", "onReadEntryFunction", "opt", "onReadEntry", "e", "filesFilter", "files", "map", "f", "filter", "mapHas", "file", "r", "root", "ret", "m", "entry", "exports", "listFileSync", "p", "fd", "stat", "readSize", "buf", "read", "pos", "bytesRead", "listFile", "_files", "parse", "resolve", "reject", "er", "stream", "modeFix", "mode", "isDir", "portable", "exports", "node_path_1", "isAbsolute", "parse", "stripAbsolutePath", "path", "r", "parsed", "root", "exports", "raw", "win", "char", "toWin", "i", "toRaw", "encode", "s", "c", "exports", "decode", "fs_1", "__importDefault", "minipass_1", "path_1", "header_js_1", "mode_fix_js_1", "normalize_windows_path_js_1", "options_js_1", "pax_js_1", "strip_absolute_path_js_1", "strip_trailing_slashes_js_1", "warn_method_js_1", "winchars", "__importStar", "prefixPath", "path", "prefix", "maxReadSize", "PROCESS", "FILE", "DIRECTORY", "SYMLINK", "HARDLINK", "HEADER", "READ", "LSTAT", "ONLSTAT", "ONREAD", "ONREADLINK", "OPENFILE", "ONOPENFILE", "CLOSE", "MODE", "AWAITDRAIN", "ONDRAIN", "PREFIX", "WriteEntry", "#hadError", "p", "opt_", "opt", "pathWarn", "root", "stripped", "cs", "code", "message", "data", "ev", "er", "stat", "getType", "mode", "block", "linkpath", "linkKey", "fd", "bufLen", "buf", "offset", "length", "pos", "bytesRead", "cb", "i", "chunk", "encoding", "exports", "WriteEntrySync", "threw", "WriteEntryTar", "readEntry", "type", "b", "writeLen", "Yallist", "_Yallist", "list", "item", "walker", "node", "next", "prev", "head", "tail", "args", "i", "l", "push", "unshift", "res", "h", "fn", "thisp", "n", "initial", "acc", "arr", "from", "to", "ret", "start", "deleteCount", "nodes", "v", "insertAfter", "p", "exports", "self", "value", "inserted", "Node", "fs_1", "__importDefault", "write_entry_js_1", "PackJob", "path", "absolute", "exports", "minipass_1", "zlib", "__importStar", "yallist_1", "read_entry_js_1", "warn_method_js_1", "EOF", "ONSTAT", "ENDED", "QUEUE", "CURRENT", "PROCESS", "PROCESSING", "PROCESSJOB", "JOBS", "JOBDONE", "ADDFSENTRY", "ADDTARENTRY", "STAT", "READDIR", "ONREADDIR", "PIPE", "ENTRY", "ENTRYOPT", "WRITEENTRYCLASS", "WRITE", "ONDRAIN", "path_1", "normalize_windows_path_js_1", "Pack", "opt", "zip", "chunk", "encoding", "cb", "p", "job", "stat", "er", "entries", "w", "_job", "sc", "rc", "code", "msg", "data", "entry", "base", "source", "message", "PackSync", "fs_minipass_1", "node_path_1", "__importDefault", "list_js_1", "make_command_js_1", "pack_js_1", "createFileSync", "opt", "files", "p", "stream", "addFilesSync", "createFile", "promise", "res", "rej", "addFilesAsync", "file", "entry", "i", "createSync", "createAsync", "exports", "_opt", "fs_1", "__importDefault", "platform", "isWindows", "O_CREAT", "O_TRUNC", "O_WRONLY", "UV_FS_O_FILEMAP", "fMapEnabled", "fMapLimit", "fMapFlag", "exports", "size", "node_fs_1", "__importDefault", "node_path_1", "lchownSync", "path", "uid", "gid", "er", "chown", "cpath", "cb", "chownrKid", "p", "child", "exports", "chownr", "children", "len", "errState", "then", "chownrKidSync", "chownrSync", "e", "CwdError", "path", "code", "exports", "SymlinkError", "symlink", "path", "exports", "chownr_1", "node_fs_1", "__importDefault", "promises_1", "node_path_1", "cwd_error_js_1", "normalize_windows_path_js_1", "symlink_error_js_1", "checkCwd", "dir", "cb", "er", "st", "mkdir", "opt", "umask", "mode", "needChmod", "uid", "gid", "doChown", "preserve", "unlink", "cwd", "done", "created", "made", "parts", "mkdir_", "exports", "base", "p", "part", "onmkdir", "statEr", "checkCwdSync", "ok", "code", "mkdirSync", "normalizeCache", "MAX", "cache", "normalizeUnicode", "ret", "i", "s", "exports", "node_path_1", "normalize_unicode_js_1", "strip_trailing_slashes_js_1", "platform", "isWindows", "getDirs", "path", "set", "s", "PathReservations", "#queues", "#reservations", "#running", "paths", "fn", "p", "dirs", "a", "b", "q", "dir", "l", "#run", "#getQueues", "res", "#clear", "next", "q0", "f", "n", "exports", "umask", "exports", "fsm", "__importStar", "node_assert_1", "__importDefault", "node_crypto_1", "node_fs_1", "node_path_1", "get_write_flag_js_1", "mkdir_js_1", "normalize_windows_path_js_1", "parse_js_1", "strip_absolute_path_js_1", "wc", "path_reservations_js_1", "symlink_error_js_1", "process_umask_js_1", "ONENTRY", "CHECKFS", "CHECKFS2", "ISREUSABLE", "MAKEFS", "FILE", "DIRECTORY", "LINK", "SYMLINK", "HARDLINK", "ENSURE_NO_SYMLINK", "UNSUPPORTED", "CHECKPATH", "STRIPABSOLUTEPATH", "MKDIR", "ONERROR", "PENDING", "PEND", "UNPEND", "ENDED", "MAYBECLOSE", "SKIP", "DOCHOWN", "UID", "GID", "CHECKED_CWD", "platform", "isWindows", "DEFAULT_MAX_DEPTH", "unlinkFile", "path", "cb", "name", "er", "unlinkFileSync", "uint32", "a", "b", "c", "Unpack", "opt", "entry", "code", "msg", "data", "field", "p", "type", "parts", "entryDir", "resolved", "root", "stripped", "linkparts", "aRoot", "pRoot", "dir", "mode", "fullyDone", "stream", "actions", "done", "abs", "fd", "atime", "mtime", "er2", "uid", "gid", "tx", "linkpath", "cwd", "onError", "t", "st", "paths", "checkCwd", "start", "parent", "afterMakeParent", "lstatEr", "needChmod", "afterChmod", "link", "exports", "callSync", "fn", "UnpackSync", "mkParent", "oner", "closeError", "e", "chunk", "futimeser", "fchowner", "_entry", "linkSync", "fsm", "__importStar", "node_fs_1", "__importDefault", "list_js_1", "make_command_js_1", "unpack_js_1", "extractFileSync", "opt", "u", "file", "stat", "readSize", "extractFile", "_", "resolve", "reject", "er", "stream", "exports", "files", "fs_minipass_1", "node_fs_1", "__importDefault", "node_path_1", "header_js_1", "list_js_1", "make_command_js_1", "options_js_1", "pack_js_1", "replaceSync", "opt", "files", "p", "threw", "fd", "position", "er", "st", "headBuf", "POSITION", "bufPos", "bytes", "entryBlockSize", "streamSync", "stream", "addFilesSync", "replaceAsync", "getPos", "size", "cb_", "cb", "pos", "_", "onread", "h", "resolve", "reject", "flag", "onopen", "addFilesAsync", "file", "entry", "i", "exports", "entries", "make_command_js_1", "replace_js_1", "exports", "opt", "entries", "mtimeFilter", "filter", "path", "stat", "__exportStar", "create_js_1", "extract_js_1", "list_js_1", "replace_js_1", "__importStar", "update_js_1"] +} diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/large-numbers.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/large-numbers.d.ts new file mode 100644 index 0000000..a1ec25e --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/large-numbers.d.ts @@ -0,0 +1,3 @@ +export declare const encode: (num: number, buf: Buffer) => Buffer; +export declare const parse: (buf: Buffer) => number; +//# sourceMappingURL=large-numbers.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/large-numbers.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/large-numbers.d.ts.map new file mode 100644 index 0000000..2c6b7b2 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/large-numbers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"large-numbers.d.ts","sourceRoot":"","sources":["../../src/large-numbers.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM,EAAE,KAAK,MAAM,4BAa9C,CAAA;AA6BD,eAAO,MAAM,KAAK,GAAI,KAAK,MAAM,WAmBhC,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/large-numbers.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/large-numbers.js new file mode 100644 index 0000000..5b07aa7 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/large-numbers.js @@ -0,0 +1,99 @@ +"use strict"; +// Tar can encode large and negative numbers using a leading byte of +// 0xff for negative, and 0x80 for positive. +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parse = exports.encode = void 0; +const encode = (num, buf) => { + if (!Number.isSafeInteger(num)) { + // The number is so large that javascript cannot represent it with integer + // precision. + throw Error('cannot encode number outside of javascript safe integer range'); + } + else if (num < 0) { + encodeNegative(num, buf); + } + else { + encodePositive(num, buf); + } + return buf; +}; +exports.encode = encode; +const encodePositive = (num, buf) => { + buf[0] = 0x80; + for (var i = buf.length; i > 1; i--) { + buf[i - 1] = num & 0xff; + num = Math.floor(num / 0x100); + } +}; +const encodeNegative = (num, buf) => { + buf[0] = 0xff; + var flipped = false; + num = num * -1; + for (var i = buf.length; i > 1; i--) { + var byte = num & 0xff; + num = Math.floor(num / 0x100); + if (flipped) { + buf[i - 1] = onesComp(byte); + } + else if (byte === 0) { + buf[i - 1] = 0; + } + else { + flipped = true; + buf[i - 1] = twosComp(byte); + } + } +}; +const parse = (buf) => { + const pre = buf[0]; + const value = pre === 0x80 ? pos(buf.subarray(1, buf.length)) + : pre === 0xff ? twos(buf) + : null; + if (value === null) { + throw Error('invalid base256 encoding'); + } + if (!Number.isSafeInteger(value)) { + // The number is so large that javascript cannot represent it with integer + // precision. + throw Error('parsed number outside of javascript safe integer range'); + } + return value; +}; +exports.parse = parse; +const twos = (buf) => { + var len = buf.length; + var sum = 0; + var flipped = false; + for (var i = len - 1; i > -1; i--) { + var byte = Number(buf[i]); + var f; + if (flipped) { + f = onesComp(byte); + } + else if (byte === 0) { + f = byte; + } + else { + flipped = true; + f = twosComp(byte); + } + if (f !== 0) { + sum -= f * Math.pow(256, len - i - 1); + } + } + return sum; +}; +const pos = (buf) => { + var len = buf.length; + var sum = 0; + for (var i = len - 1; i > -1; i--) { + var byte = Number(buf[i]); + if (byte !== 0) { + sum += byte * Math.pow(256, len - i - 1); + } + } + return sum; +}; +const onesComp = (byte) => (0xff ^ byte) & 0xff; +const twosComp = (byte) => ((0xff ^ byte) + 1) & 0xff; +//# sourceMappingURL=large-numbers.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/large-numbers.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/large-numbers.js.map new file mode 100644 index 0000000..31ddcd2 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/large-numbers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"large-numbers.js","sourceRoot":"","sources":["../../src/large-numbers.ts"],"names":[],"mappings":";AAAA,oEAAoE;AACpE,4CAA4C;;;AAErC,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,EAAE;IACjD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,0EAA0E;QAC1E,aAAa;QACb,MAAM,KAAK,CACT,+DAA+D,CAChE,CAAA;IACH,CAAC;SAAM,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;QACnB,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC1B,CAAC;SAAM,CAAC;QACN,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC1B,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAbY,QAAA,MAAM,UAalB;AAED,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,EAAE;IAClD,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;IAEb,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,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AG,CAAC,GAAW,EAAE,EAAE;IAC1B,IAAI,GAAG,GAAG,GAAG,CAAC,MAAM,CAAA;IACpB,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,KAAK,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,IAAI,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QACzB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;YACf,GAAG,IAAI,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;QAC1C,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,IAAI,CAAA;AAEvD,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAA","sourcesContent":["// Tar can encode large and negative numbers using a leading byte of\n// 0xff for negative, and 0x80 for positive.\n\nexport const encode = (num: number, buf: Buffer) => {\n if (!Number.isSafeInteger(num)) {\n // The number is so large that javascript cannot represent it with integer\n // precision.\n throw Error(\n 'cannot encode number outside of javascript safe integer range',\n )\n } else if (num < 0) {\n encodeNegative(num, buf)\n } else {\n encodePositive(num, buf)\n }\n return buf\n}\n\nconst encodePositive = (num: number, buf: Buffer) => {\n buf[0] = 0x80\n\n for (var i = buf.length; i > 1; i--) {\n buf[i - 1] = num & 0xff\n num = Math.floor(num / 0x100)\n }\n}\n\nconst encodeNegative = (num: number, buf: Buffer) => {\n buf[0] = 0xff\n var flipped = false\n num = num * -1\n for (var i = buf.length; i > 1; i--) {\n var byte = num & 0xff\n num = Math.floor(num / 0x100)\n if (flipped) {\n buf[i - 1] = onesComp(byte)\n } else if (byte === 0) {\n buf[i - 1] = 0\n } else {\n flipped = true\n buf[i - 1] = twosComp(byte)\n }\n }\n}\n\nexport const parse = (buf: Buffer) => {\n const pre = buf[0]\n const value =\n pre === 0x80 ? pos(buf.subarray(1, buf.length))\n : pre === 0xff ? twos(buf)\n : null\n if (value === null) {\n throw Error('invalid base256 encoding')\n }\n\n if (!Number.isSafeInteger(value)) {\n // The number is so large that javascript cannot represent it with integer\n // precision.\n throw Error(\n 'parsed number outside of javascript safe integer range',\n )\n }\n\n return value\n}\n\nconst twos = (buf: Buffer) => {\n var len = buf.length\n var sum = 0\n var flipped = false\n for (var i = len - 1; i > -1; i--) {\n var byte = Number(buf[i])\n var f\n if (flipped) {\n f = onesComp(byte)\n } else if (byte === 0) {\n f = byte\n } else {\n flipped = true\n f = twosComp(byte)\n }\n if (f !== 0) {\n sum -= f * Math.pow(256, len - i - 1)\n }\n }\n return sum\n}\n\nconst pos = (buf: Buffer) => {\n var len = buf.length\n var sum = 0\n for (var i = len - 1; i > -1; i--) {\n var byte = Number(buf[i])\n if (byte !== 0) {\n sum += byte * Math.pow(256, len - i - 1)\n }\n }\n return sum\n}\n\nconst onesComp = (byte: number) => (0xff ^ byte) & 0xff\n\nconst twosComp = (byte: number) => ((0xff ^ byte) + 1) & 0xff\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/list.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/list.d.ts new file mode 100644 index 0000000..890a11b --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/list.d.ts @@ -0,0 +1,7 @@ +import { TarOptions } from './options.js'; +import { Parser } from './parse.js'; +export declare const filesFilter: (opt: TarOptions, files: string[]) => void; +export declare const list: import("./make-command.js").TarCommand; +//# sourceMappingURL=list.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/list.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/list.d.ts.map new file mode 100644 index 0000000..2612f9e --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/list.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/list.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,UAAU,EAGX,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAgBnC,eAAO,MAAM,WAAW,GAAI,KAAK,UAAU,EAAE,OAAO,MAAM,EAAE,SA4B3D,CAAA;AA+DD,eAAO,MAAM,IAAI;UAG4B,IAAI;EAMhD,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/list.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/list.js new file mode 100644 index 0000000..5157bc8 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/list.js @@ -0,0 +1,150 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.list = exports.filesFilter = void 0; +// tar -t +const fsm = __importStar(require("@isaacs/fs-minipass")); +const node_fs_1 = __importDefault(require("node:fs")); +const path_1 = require("path"); +const make_command_js_1 = require("./make-command.js"); +const parse_js_1 = require("./parse.js"); +const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js"); +const onReadEntryFunction = (opt) => { + const onReadEntry = opt.onReadEntry; + opt.onReadEntry = + onReadEntry ? + e => { + onReadEntry(e); + e.resume(); + } + : e => e.resume(); +}; +// construct a filter that limits the file entries listed +// include child entries if a dir is included +const filesFilter = (opt, files) => { + const map = new Map(files.map(f => [(0, strip_trailing_slashes_js_1.stripTrailingSlashes)(f), true])); + const filter = opt.filter; + const mapHas = (file, r = '') => { + const root = r || (0, path_1.parse)(file).root || '.'; + let ret; + if (file === root) + ret = false; + else { + const m = map.get(file); + if (m !== undefined) { + ret = m; + } + else { + ret = mapHas((0, path_1.dirname)(file), root); + } + } + map.set(file, ret); + return ret; + }; + opt.filter = + filter ? + (file, entry) => filter(file, entry) && mapHas((0, strip_trailing_slashes_js_1.stripTrailingSlashes)(file)) + : file => mapHas((0, strip_trailing_slashes_js_1.stripTrailingSlashes)(file)); +}; +exports.filesFilter = filesFilter; +const listFileSync = (opt) => { + const p = new parse_js_1.Parser(opt); + const file = opt.file; + let fd; + try { + fd = node_fs_1.default.openSync(file, 'r'); + const stat = node_fs_1.default.fstatSync(fd); + const readSize = opt.maxReadSize || 16 * 1024 * 1024; + if (stat.size < readSize) { + const buf = Buffer.allocUnsafe(stat.size); + const read = node_fs_1.default.readSync(fd, buf, 0, stat.size, 0); + p.end(read === buf.byteLength ? buf : buf.subarray(0, read)); + } + else { + let pos = 0; + const buf = Buffer.allocUnsafe(readSize); + while (pos < stat.size) { + const bytesRead = node_fs_1.default.readSync(fd, buf, 0, readSize, pos); + if (bytesRead === 0) + break; + pos += bytesRead; + p.write(buf.subarray(0, bytesRead)); + } + p.end(); + } + } + finally { + if (typeof fd === 'number') { + try { + node_fs_1.default.closeSync(fd); + /* c8 ignore next */ + } + catch (er) { } + } + } +}; +const listFile = (opt, _files) => { + const parse = new parse_js_1.Parser(opt); + const readSize = opt.maxReadSize || 16 * 1024 * 1024; + const file = opt.file; + const p = new Promise((resolve, reject) => { + parse.on('error', reject); + parse.on('end', resolve); + node_fs_1.default.stat(file, (er, stat) => { + if (er) { + reject(er); + } + else { + const stream = new fsm.ReadStream(file, { + readSize: readSize, + size: stat.size, + }); + stream.on('error', reject); + stream.pipe(parse); + } + }); + }); + return p; +}; +exports.list = (0, make_command_js_1.makeCommand)(listFileSync, listFile, opt => new parse_js_1.Parser(opt), opt => new parse_js_1.Parser(opt), (opt, files) => { + if (files?.length) + (0, exports.filesFilter)(opt, files); + if (!opt.noResume) + onReadEntryFunction(opt); +}); +//# sourceMappingURL=list.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/list.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/list.js.map new file mode 100644 index 0000000..b81bdba --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/list.js.map @@ -0,0 +1 @@ +{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/list.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS;AACT,yDAA0C;AAC1C,sDAAwB;AACxB,+BAAqC;AACrC,uDAA+C;AAM/C,yCAAmC;AACnC,2EAAkE;AAElE,MAAM,mBAAmB,GAAG,CAAC,GAAe,EAAE,EAAE;IAC9C,MAAM,WAAW,GAAG,GAAG,CAAC,WAAW,CAAA;IACnC,GAAG,CAAC,WAAW;QACb,WAAW,CAAC,CAAC;YACX,CAAC,CAAC,E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CAAC;gBACN,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE;oBACtC,QAAQ,EAAE,QAAQ;oBAClB,IAAI,EAAE,IAAI,CAAC,IAAI;iBAChB,CAAC,CAAA;gBACF,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;gBAC1B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACpB,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IACF,OAAO,CAAC,CAAA;AACV,CAAC,CAAA;AAEY,QAAA,IAAI,GAAG,IAAA,6BAAW,EAC7B,YAAY,EACZ,QAAQ,EACR,GAAG,CAAC,EAAE,CAAC,IAAI,iBAAM,CAAC,GAAG,CAA4B,EACjD,GAAG,CAAC,EAAE,CAAC,IAAI,iBAAM,CAAC,GAAG,CAAC,EACtB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;IACb,IAAI,KAAK,EAAE,MAAM;QAAE,IAAA,mBAAW,EAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IAC1C,IAAI,CAAC,GAAG,CAAC,QAAQ;QAAE,mBAAmB,CAAC,GAAG,CAAC,CAAA;AAC7C,CAAC,CACF,CAAA","sourcesContent":["// tar -t\nimport * as fsm from '@isaacs/fs-minipass'\nimport fs from 'node:fs'\nimport { dirname, parse } from 'path'\nimport { makeCommand } from './make-command.js'\nimport {\n TarOptions,\n TarOptionsFile,\n TarOptionsSyncFile,\n} from './options.js'\nimport { Parser } from './parse.js'\nimport { stripTrailingSlashes } from './strip-trailing-slashes.js'\n\nconst onReadEntryFunction = (opt: TarOptions) => {\n const onReadEntry = opt.onReadEntry\n opt.onReadEntry =\n onReadEntry ?\n e => {\n onReadEntry(e)\n e.resume()\n }\n : e => e.resume()\n}\n\n// construct a filter that limits the file entries listed\n// include child entries if a dir is included\nexport const filesFilter = (opt: TarOptions, files: string[]) => {\n const map = new Map(\n files.map(f => [stripTrailingSlashes(f), true]),\n )\n const filter = opt.filter\n\n const mapHas = (file: string, r: string = ''): boolean => {\n const root = r || parse(file).root || '.'\n let ret: boolean\n if (file === root) ret = false\n else {\n const m = map.get(file)\n if (m !== undefined) {\n ret = m\n } else {\n ret = mapHas(dirname(file), root)\n }\n }\n\n map.set(file, ret)\n return ret\n }\n\n opt.filter =\n filter ?\n (file, entry) =>\n filter(file, entry) && mapHas(stripTrailingSlashes(file))\n : file => mapHas(stripTrailingSlashes(file))\n}\n\nconst listFileSync = (opt: TarOptionsSyncFile) => {\n const p = new Parser(opt)\n const file = opt.file\n let fd: number | undefined\n try {\n fd = fs.openSync(file, 'r')\n const stat: fs.Stats = fs.fstatSync(fd)\n const readSize: number = opt.maxReadSize || 16 * 1024 * 1024\n if (stat.size < readSize) {\n const buf = Buffer.allocUnsafe(stat.size)\n const read = fs.readSync(fd, buf, 0, stat.size, 0)\n p.end(read === buf.byteLength ? buf : buf.subarray(0, read))\n } else {\n let pos = 0\n const buf = Buffer.allocUnsafe(readSize)\n while (pos < stat.size) {\n const bytesRead = fs.readSync(fd, buf, 0, readSize, pos)\n if (bytesRead === 0) break\n pos += bytesRead\n p.write(buf.subarray(0, bytesRead))\n }\n p.end()\n }\n } finally {\n if (typeof fd === 'number') {\n try {\n fs.closeSync(fd)\n /* c8 ignore next */\n } catch (er) {}\n }\n }\n}\n\nconst listFile = (\n opt: TarOptionsFile,\n _files: string[],\n): Promise => {\n const parse = new Parser(opt)\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n\n const file = opt.file\n const p = new Promise((resolve, reject) => {\n parse.on('error', reject)\n parse.on('end', resolve)\n\n fs.stat(file, (er, stat) => {\n if (er) {\n reject(er)\n } else {\n const stream = new fsm.ReadStream(file, {\n readSize: readSize,\n size: stat.size,\n })\n stream.on('error', reject)\n stream.pipe(parse)\n }\n })\n })\n return p\n}\n\nexport const list = makeCommand(\n listFileSync,\n listFile,\n opt => new Parser(opt) as Parser & { sync: true },\n opt => new Parser(opt),\n (opt, files) => {\n if (files?.length) filesFilter(opt, files)\n if (!opt.noResume) onReadEntryFunction(opt)\n },\n)\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/make-command.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/make-command.d.ts new file mode 100644 index 0000000..cd88929 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/make-command.d.ts @@ -0,0 +1,49 @@ +import { TarOptions, TarOptionsAsyncFile, TarOptionsAsyncNoFile, TarOptionsSyncFile, TarOptionsSyncNoFile, TarOptionsWithAliases, TarOptionsWithAliasesAsync, TarOptionsWithAliasesAsyncFile, TarOptionsWithAliasesAsyncNoFile, TarOptionsWithAliasesFile, TarOptionsWithAliasesNoFile, TarOptionsWithAliasesSync, TarOptionsWithAliasesSyncFile, TarOptionsWithAliasesSyncNoFile } from './options.js'; +export type CB = (er?: Error) => any; +export type TarCommand = { + (): AsyncClass; + (opt: TarOptionsWithAliasesAsyncNoFile): AsyncClass; + (entries: string[]): AsyncClass; + (opt: TarOptionsWithAliasesAsyncNoFile, entries: string[]): AsyncClass; +} & { + (opt: TarOptionsWithAliasesSyncNoFile): SyncClass; + (opt: TarOptionsWithAliasesSyncNoFile, entries: string[]): SyncClass; +} & { + (opt: TarOptionsWithAliasesAsyncFile): Promise; + (opt: TarOptionsWithAliasesAsyncFile, entries: string[]): Promise; + (opt: TarOptionsWithAliasesAsyncFile, cb: CB): Promise; + (opt: TarOptionsWithAliasesAsyncFile, entries: string[], cb: CB): Promise; +} & { + (opt: TarOptionsWithAliasesSyncFile): void; + (opt: TarOptionsWithAliasesSyncFile, entries: string[]): void; +} & { + (opt: TarOptionsWithAliasesSync): typeof opt extends (TarOptionsWithAliasesFile) ? void : typeof opt extends TarOptionsWithAliasesNoFile ? SyncClass : void | SyncClass; + (opt: TarOptionsWithAliasesSync, entries: string[]): typeof opt extends TarOptionsWithAliasesFile ? void : typeof opt extends TarOptionsWithAliasesNoFile ? SyncClass : void | SyncClass; +} & { + (opt: TarOptionsWithAliasesAsync): typeof opt extends (TarOptionsWithAliasesFile) ? Promise : typeof opt extends TarOptionsWithAliasesNoFile ? AsyncClass : Promise | AsyncClass; + (opt: TarOptionsWithAliasesAsync, entries: string[]): typeof opt extends TarOptionsWithAliasesFile ? Promise : typeof opt extends TarOptionsWithAliasesNoFile ? AsyncClass : Promise | AsyncClass; + (opt: TarOptionsWithAliasesAsync, cb: CB): Promise; + (opt: TarOptionsWithAliasesAsync, entries: string[], cb: CB): typeof opt extends TarOptionsWithAliasesFile ? Promise : typeof opt extends TarOptionsWithAliasesNoFile ? never : Promise; +} & { + (opt: TarOptionsWithAliasesFile): Promise | void; + (opt: TarOptionsWithAliasesFile, entries: string[]): typeof opt extends TarOptionsWithAliasesSync ? void : typeof opt extends TarOptionsWithAliasesAsync ? Promise : Promise | void; + (opt: TarOptionsWithAliasesFile, cb: CB): Promise; + (opt: TarOptionsWithAliasesFile, entries: string[], cb: CB): typeof opt extends TarOptionsWithAliasesSync ? never : typeof opt extends TarOptionsWithAliasesAsync ? Promise : Promise; +} & { + (opt: TarOptionsWithAliasesNoFile): typeof opt extends (TarOptionsWithAliasesSync) ? SyncClass : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass : SyncClass | AsyncClass; + (opt: TarOptionsWithAliasesNoFile, entries: string[]): typeof opt extends TarOptionsWithAliasesSync ? SyncClass : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass : SyncClass | AsyncClass; +} & { + (opt: TarOptionsWithAliases): typeof opt extends (TarOptionsWithAliasesFile) ? typeof opt extends TarOptionsWithAliasesSync ? void : typeof opt extends TarOptionsWithAliasesAsync ? Promise : void | Promise : typeof opt extends TarOptionsWithAliasesNoFile ? typeof opt extends TarOptionsWithAliasesSync ? SyncClass : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass : SyncClass | AsyncClass : typeof opt extends TarOptionsWithAliasesSync ? SyncClass | void : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass | Promise : SyncClass | void | AsyncClass | Promise; +} & { + syncFile: (opt: TarOptionsSyncFile, entries: string[]) => void; + asyncFile: (opt: TarOptionsAsyncFile, entries: string[], cb?: CB) => Promise; + syncNoFile: (opt: TarOptionsSyncNoFile, entries: string[]) => SyncClass; + asyncNoFile: (opt: TarOptionsAsyncNoFile, entries: string[]) => AsyncClass; + validate?: (opt: TarOptions, entries?: string[]) => void; +}; +export declare const makeCommand: (syncFile: (opt: TarOptionsSyncFile, entries: string[]) => void, asyncFile: (opt: TarOptionsAsyncFile, entries: string[], cb?: CB) => Promise, syncNoFile: (opt: TarOptionsSyncNoFile, entries: string[]) => SyncClass, asyncNoFile: (opt: TarOptionsAsyncNoFile, entries: string[]) => AsyncClass, validate?: (opt: TarOptions, entries?: string[]) => void) => TarCommand; +//# sourceMappingURL=make-command.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/make-command.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/make-command.d.ts.map new file mode 100644 index 0000000..f587cbf --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/make-command.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"make-command.d.ts","sourceRoot":"","sources":["../../src/make-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,UAAU,EACV,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,EAC1B,8BAA8B,EAC9B,gCAAgC,EAChC,yBAAyB,EACzB,2BAA2B,EAC3B,yBAAyB,EACzB,6BAA6B,EAC7B,+BAA+B,EAChC,MAAM,cAAc,CAAA;AAErB,MAAM,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,KAAK,GAAG,CAAA;AAEpC,MAAM,MAAM,UAAU,CACpB,UAAU,EACV,SAAS,SAAS;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,IAC9B;IAEF,IAAI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AS,EAAE,CACT,GAAG,EAAE,mBAAmB,EACxB,OAAO,EAAE,MAAM,EAAE,EACjB,EAAE,CAAC,EAAE,EAAE,KACJ,OAAO,CAAC,IAAI,CAAC,CAAA;IAClB,UAAU,EAAE,CACV,GAAG,EAAE,oBAAoB,EACzB,OAAO,EAAE,MAAM,EAAE,KACd,SAAS,CAAA;IACd,WAAW,EAAE,CACX,GAAG,EAAE,qBAAqB,EAC1B,OAAO,EAAE,MAAM,EAAE,KACd,UAAU,CAAA;IACf,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;CACzD,CAAA;AAED,eAAO,MAAM,WAAW,GACtB,UAAU,EACV,SAAS,SAAS;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,EAEhC,UAAU,CAAC,GAAG,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,EAC9D,WAAW,CACT,GAAG,EAAE,mBAAmB,EACxB,OAAO,EAAE,MAAM,EAAE,EACjB,EAAE,CAAC,EAAE,EAAE,KACJ,OAAO,CAAC,IAAI,CAAC,EAClB,YAAY,CACV,GAAG,EAAE,oBAAoB,EACzB,OAAO,EAAE,MAAM,EAAE,KACd,SAAS,EACd,aAAa,CACX,GAAG,EAAE,qBAAqB,EAC1B,OAAO,EAAE,MAAM,EAAE,KACd,UAAU,EACf,WAAW,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,IAAI,KACvD,UAAU,CAAC,UAAU,EAAE,SAAS,CAmElC,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/make-command.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/make-command.js new file mode 100644 index 0000000..1814319 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/make-command.js @@ -0,0 +1,61 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeCommand = void 0; +const options_js_1 = require("./options.js"); +const makeCommand = (syncFile, asyncFile, syncNoFile, asyncNoFile, validate) => { + return Object.assign((opt_ = [], entries, cb) => { + if (Array.isArray(opt_)) { + entries = opt_; + opt_ = {}; + } + if (typeof entries === 'function') { + cb = entries; + entries = undefined; + } + if (!entries) { + entries = []; + } + else { + entries = Array.from(entries); + } + const opt = (0, options_js_1.dealias)(opt_); + validate?.(opt, entries); + if ((0, options_js_1.isSyncFile)(opt)) { + if (typeof cb === 'function') { + throw new TypeError('callback not supported for sync tar functions'); + } + return syncFile(opt, entries); + } + else if ((0, options_js_1.isAsyncFile)(opt)) { + const p = asyncFile(opt, entries); + // weirdness to make TS happy + const c = cb ? cb : undefined; + return c ? p.then(() => c(), c) : p; + } + else if ((0, options_js_1.isSyncNoFile)(opt)) { + if (typeof cb === 'function') { + throw new TypeError('callback not supported for sync tar functions'); + } + return syncNoFile(opt, entries); + } + else if ((0, options_js_1.isAsyncNoFile)(opt)) { + if (typeof cb === 'function') { + throw new TypeError('callback only supported with file option'); + } + return asyncNoFile(opt, entries); + /* c8 ignore start */ + } + else { + throw new Error('impossible options??'); + } + /* c8 ignore stop */ + }, { + syncFile, + asyncFile, + syncNoFile, + asyncNoFile, + validate, + }); +}; +exports.makeCommand = makeCommand; +//# sourceMappingURL=make-command.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/make-command.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/make-command.js.map new file mode 100644 index 0000000..1f1cdeb --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/make-command.js.map @@ -0,0 +1 @@ +{"version":3,"file":"make-command.js","sourceRoot":"","sources":["../../src/make-command.ts"],"names":[],"mappings":";;;AAAA,6CAoBqB;AA2Id,MAAM,WAAW,GAAG,CAIzB,QAA8D,EAC9D,SAIkB,EAClB,UAGc,EACd,WAGe,EACf,QAAwD,EACrB,EAAE;IACrC,OAAO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BAAY,EAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;gBAC7B,MAAM,IAAI,SAAS,CACjB,+CAA+C,CAChD,CAAA;YACH,CAAC;YACD,OAAO,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QACjC,CAAC;aAAM,IAAI,IAAA,0BAAa,EAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;gBAC7B,MAAM,IAAI,SAAS,CACjB,0CAA0C,CAC3C,CAAA;YACH,CAAC;YACD,OAAO,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;YAChC,qBAAqB;QACvB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;QACzC,CAAC;QACD,oBAAoB;IACtB,CAAC,EACD;QACE,QAAQ;QACR,SAAS;QACT,UAAU;QACV,WAAW;QACX,QAAQ;KACT,CACmC,CAAA;AACxC,CAAC,CAAA;AAtFY,QAAA,WAAW,eAsFvB","sourcesContent":["import {\n dealias,\n isAsyncFile,\n isAsyncNoFile,\n isSyncFile,\n isSyncNoFile,\n TarOptions,\n TarOptionsAsyncFile,\n TarOptionsAsyncNoFile,\n TarOptionsSyncFile,\n TarOptionsSyncNoFile,\n TarOptionsWithAliases,\n TarOptionsWithAliasesAsync,\n TarOptionsWithAliasesAsyncFile,\n TarOptionsWithAliasesAsyncNoFile,\n TarOptionsWithAliasesFile,\n TarOptionsWithAliasesNoFile,\n TarOptionsWithAliasesSync,\n TarOptionsWithAliasesSyncFile,\n TarOptionsWithAliasesSyncNoFile,\n} from './options.js'\n\nexport type CB = (er?: Error) => any\n\nexport type TarCommand<\n AsyncClass,\n SyncClass extends { sync: true },\n> = {\n // async and no file specified\n (): AsyncClass\n (opt: TarOptionsWithAliasesAsyncNoFile): AsyncClass\n (entries: string[]): AsyncClass\n (\n opt: TarOptionsWithAliasesAsyncNoFile,\n entries: string[],\n ): AsyncClass\n} & {\n // sync and no file\n (opt: TarOptionsWithAliasesSyncNoFile): SyncClass\n (opt: TarOptionsWithAliasesSyncNoFile, entries: string[]): SyncClass\n} & {\n // async and file\n (opt: TarOptionsWithAliasesAsyncFile): Promise\n (\n opt: TarOptionsWithAliasesAsyncFile,\n entries: string[],\n ): Promise\n (opt: TarOptionsWithAliasesAsyncFile, cb: CB): Promise\n (\n opt: TarOptionsWithAliasesAsyncFile,\n entries: string[],\n cb: CB,\n ): Promise\n} & {\n // sync and file\n (opt: TarOptionsWithAliasesSyncFile): void\n (opt: TarOptionsWithAliasesSyncFile, entries: string[]): void\n} & {\n // sync, maybe file\n (opt: TarOptionsWithAliasesSync): typeof opt extends (\n TarOptionsWithAliasesFile\n ) ?\n void\n : typeof opt extends TarOptionsWithAliasesNoFile ? SyncClass\n : void | SyncClass\n (\n opt: TarOptionsWithAliasesSync,\n entries: string[],\n ): typeof opt extends TarOptionsWithAliasesFile ? void\n : typeof opt extends TarOptionsWithAliasesNoFile ? SyncClass\n : void | SyncClass\n} & {\n // async, maybe file\n (opt: TarOptionsWithAliasesAsync): typeof opt extends (\n TarOptionsWithAliasesFile\n ) ?\n Promise\n : typeof opt extends TarOptionsWithAliasesNoFile ? AsyncClass\n : Promise | AsyncClass\n (\n opt: TarOptionsWithAliasesAsync,\n entries: string[],\n ): typeof opt extends TarOptionsWithAliasesFile ? Promise\n : typeof opt extends TarOptionsWithAliasesNoFile ? AsyncClass\n : Promise | AsyncClass\n (opt: TarOptionsWithAliasesAsync, cb: CB): Promise\n (\n opt: TarOptionsWithAliasesAsync,\n entries: string[],\n cb: CB,\n ): typeof opt extends TarOptionsWithAliasesFile ? Promise\n : typeof opt extends TarOptionsWithAliasesNoFile ? never\n : Promise\n} & {\n // maybe sync, file\n (opt: TarOptionsWithAliasesFile): Promise | void\n (\n opt: TarOptionsWithAliasesFile,\n entries: string[],\n ): typeof opt extends TarOptionsWithAliasesSync ? void\n : typeof opt extends TarOptionsWithAliasesAsync ? Promise\n : Promise | void\n (opt: TarOptionsWithAliasesFile, cb: CB): Promise\n (\n opt: TarOptionsWithAliasesFile,\n entries: string[],\n cb: CB,\n ): typeof opt extends TarOptionsWithAliasesSync ? never\n : typeof opt extends TarOptionsWithAliasesAsync ? Promise\n : Promise\n} & {\n // maybe sync, no file\n (opt: TarOptionsWithAliasesNoFile): typeof opt extends (\n TarOptionsWithAliasesSync\n ) ?\n SyncClass\n : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass\n : SyncClass | AsyncClass\n (\n opt: TarOptionsWithAliasesNoFile,\n entries: string[],\n ): typeof opt extends TarOptionsWithAliasesSync ? SyncClass\n : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass\n : SyncClass | AsyncClass\n} & {\n // maybe sync, maybe file\n (opt: TarOptionsWithAliases): typeof opt extends (\n TarOptionsWithAliasesFile\n ) ?\n typeof opt extends TarOptionsWithAliasesSync ? void\n : typeof opt extends TarOptionsWithAliasesAsync ? Promise\n : void | Promise\n : typeof opt extends TarOptionsWithAliasesNoFile ?\n typeof opt extends TarOptionsWithAliasesSync ? SyncClass\n : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass\n : SyncClass | AsyncClass\n : typeof opt extends TarOptionsWithAliasesSync ? SyncClass | void\n : typeof opt extends TarOptionsWithAliasesAsync ?\n AsyncClass | Promise\n : SyncClass | void | AsyncClass | Promise\n} & {\n // extras\n syncFile: (opt: TarOptionsSyncFile, entries: string[]) => void\n asyncFile: (\n opt: TarOptionsAsyncFile,\n entries: string[],\n cb?: CB,\n ) => Promise\n syncNoFile: (\n opt: TarOptionsSyncNoFile,\n entries: string[],\n ) => SyncClass\n asyncNoFile: (\n opt: TarOptionsAsyncNoFile,\n entries: string[],\n ) => AsyncClass\n validate?: (opt: TarOptions, entries?: string[]) => void\n}\n\nexport const makeCommand = <\n AsyncClass,\n SyncClass extends { sync: true },\n>(\n syncFile: (opt: TarOptionsSyncFile, entries: string[]) => void,\n asyncFile: (\n opt: TarOptionsAsyncFile,\n entries: string[],\n cb?: CB,\n ) => Promise,\n syncNoFile: (\n opt: TarOptionsSyncNoFile,\n entries: string[],\n ) => SyncClass,\n asyncNoFile: (\n opt: TarOptionsAsyncNoFile,\n entries: string[],\n ) => AsyncClass,\n validate?: (opt: TarOptions, entries?: string[]) => void,\n): TarCommand => {\n return Object.assign(\n (\n opt_: TarOptionsWithAliases | string[] = [],\n entries?: string[] | CB,\n cb?: CB,\n ) => {\n if (Array.isArray(opt_)) {\n entries = opt_\n opt_ = {}\n }\n\n if (typeof entries === 'function') {\n cb = entries\n entries = undefined\n }\n\n if (!entries) {\n entries = []\n } else {\n entries = Array.from(entries)\n }\n\n const opt = dealias(opt_)\n\n validate?.(opt, entries)\n\n if (isSyncFile(opt)) {\n if (typeof cb === 'function') {\n throw new TypeError(\n 'callback not supported for sync tar functions',\n )\n }\n return syncFile(opt, entries)\n } else if (isAsyncFile(opt)) {\n const p = asyncFile(opt, entries)\n // weirdness to make TS happy\n const c = cb ? cb : undefined\n return c ? p.then(() => c(), c) : p\n } else if (isSyncNoFile(opt)) {\n if (typeof cb === 'function') {\n throw new TypeError(\n 'callback not supported for sync tar functions',\n )\n }\n return syncNoFile(opt, entries)\n } else if (isAsyncNoFile(opt)) {\n if (typeof cb === 'function') {\n throw new TypeError(\n 'callback only supported with file option',\n )\n }\n return asyncNoFile(opt, entries)\n /* c8 ignore start */\n } else {\n throw new Error('impossible options??')\n }\n /* c8 ignore stop */\n },\n {\n syncFile,\n asyncFile,\n syncNoFile,\n asyncNoFile,\n validate,\n },\n ) as TarCommand\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/mkdir.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/mkdir.d.ts new file mode 100644 index 0000000..dcbea5c --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/mkdir.d.ts @@ -0,0 +1,25 @@ +import { CwdError } from './cwd-error.js'; +import { SymlinkError } from './symlink-error.js'; +export type MkdirOptions = { + uid?: number; + gid?: number; + processUid?: number; + processGid?: number; + umask?: number; + preserve: boolean; + unlink: boolean; + cwd: string; + mode: number; +}; +export type MkdirError = NodeJS.ErrnoException | CwdError | SymlinkError; +/** + * Wrapper around fs/promises.mkdir for tar's needs. + * + * The main purpose is to avoid creating directories if we know that + * they already exist (and track which ones exist for this purpose), + * and prevent entries from being extracted into symlinked folders, + * if `preservePaths` is not set. + */ +export declare const mkdir: (dir: string, opt: MkdirOptions, cb: (er?: null | MkdirError, made?: string) => void) => void | Promise; +export declare const mkdirSync: (dir: string, opt: MkdirOptions) => void | SymlinkError; +//# sourceMappingURL=mkdir.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/mkdir.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/mkdir.d.ts.map new file mode 100644 index 0000000..3d6b446 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/mkdir.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mkdir.d.ts","sourceRoot":"","sources":["../../src/mkdir.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,OAAO,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,UAAU,GAClB,MAAM,CAAC,cAAc,GACrB,QAAQ,GACR,YAAY,CAAA;AAiBhB;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,GAChB,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,GAAG,UAAU,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,yBAoDpD,CAAA;AAiFD,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,EAAE,KAAK,YAAY,wBAqEvD,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/mkdir.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/mkdir.js new file mode 100644 index 0000000..606619e --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/mkdir.js @@ -0,0 +1,188 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.mkdirSync = exports.mkdir = void 0; +const chownr_1 = require("chownr"); +const node_fs_1 = __importDefault(require("node:fs")); +const promises_1 = __importDefault(require("node:fs/promises")); +const node_path_1 = __importDefault(require("node:path")); +const cwd_error_js_1 = require("./cwd-error.js"); +const normalize_windows_path_js_1 = require("./normalize-windows-path.js"); +const symlink_error_js_1 = require("./symlink-error.js"); +const checkCwd = (dir, cb) => { + node_fs_1.default.stat(dir, (er, st) => { + if (er || !st.isDirectory()) { + er = new cwd_error_js_1.CwdError(dir, er?.code || 'ENOTDIR'); + } + cb(er); + }); +}; +/** + * Wrapper around fs/promises.mkdir for tar's needs. + * + * The main purpose is to avoid creating directories if we know that + * they already exist (and track which ones exist for this purpose), + * and prevent entries from being extracted into symlinked folders, + * if `preservePaths` is not set. + */ +const mkdir = (dir, opt, cb) => { + dir = (0, normalize_windows_path_js_1.normalizeWindowsPath)(dir); + // if there's any overlap between mask and mode, + // then we'll need an explicit chmod + /* c8 ignore next */ + const umask = opt.umask ?? 0o22; + const mode = opt.mode | 0o0700; + const needChmod = (mode & umask) !== 0; + const uid = opt.uid; + const gid = opt.gid; + const doChown = typeof uid === 'number' && + typeof gid === 'number' && + (uid !== opt.processUid || gid !== opt.processGid); + const preserve = opt.preserve; + const unlink = opt.unlink; + const cwd = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.cwd); + const done = (er, created) => { + if (er) { + cb(er); + } + else { + if (created && doChown) { + (0, chownr_1.chownr)(created, uid, gid, er => done(er)); + } + else if (needChmod) { + node_fs_1.default.chmod(dir, mode, cb); + } + else { + cb(); + } + } + }; + if (dir === cwd) { + return checkCwd(dir, done); + } + if (preserve) { + return promises_1.default.mkdir(dir, { mode, recursive: true }).then(made => done(null, made ?? undefined), // oh, ts + done); + } + const sub = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.relative(cwd, dir)); + const parts = sub.split('/'); + mkdir_(cwd, parts, mode, unlink, cwd, undefined, done); +}; +exports.mkdir = mkdir; +const mkdir_ = (base, parts, mode, unlink, cwd, created, cb) => { + if (!parts.length) { + return cb(null, created); + } + const p = parts.shift(); + const part = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(base + '/' + p)); + node_fs_1.default.mkdir(part, mode, onmkdir(part, parts, mode, unlink, cwd, created, cb)); +}; +const onmkdir = (part, parts, mode, unlink, cwd, created, cb) => (er) => { + if (er) { + node_fs_1.default.lstat(part, (statEr, st) => { + if (statEr) { + statEr.path = + statEr.path && (0, normalize_windows_path_js_1.normalizeWindowsPath)(statEr.path); + cb(statEr); + } + else if (st.isDirectory()) { + mkdir_(part, parts, mode, unlink, cwd, created, cb); + } + else if (unlink) { + node_fs_1.default.unlink(part, er => { + if (er) { + return cb(er); + } + node_fs_1.default.mkdir(part, mode, onmkdir(part, parts, mode, unlink, cwd, created, cb)); + }); + } + else if (st.isSymbolicLink()) { + return cb(new symlink_error_js_1.SymlinkError(part, part + '/' + parts.join('/'))); + } + else { + cb(er); + } + }); + } + else { + created = created || part; + mkdir_(part, parts, mode, unlink, cwd, created, cb); + } +}; +const checkCwdSync = (dir) => { + let ok = false; + let code = undefined; + try { + ok = node_fs_1.default.statSync(dir).isDirectory(); + } + catch (er) { + code = er?.code; + } + finally { + if (!ok) { + throw new cwd_error_js_1.CwdError(dir, code ?? 'ENOTDIR'); + } + } +}; +const mkdirSync = (dir, opt) => { + dir = (0, normalize_windows_path_js_1.normalizeWindowsPath)(dir); + // if there's any overlap between mask and mode, + // then we'll need an explicit chmod + /* c8 ignore next */ + const umask = opt.umask ?? 0o22; + const mode = opt.mode | 0o700; + const needChmod = (mode & umask) !== 0; + const uid = opt.uid; + const gid = opt.gid; + const doChown = typeof uid === 'number' && + typeof gid === 'number' && + (uid !== opt.processUid || gid !== opt.processGid); + const preserve = opt.preserve; + const unlink = opt.unlink; + const cwd = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.cwd); + const done = (created) => { + if (created && doChown) { + (0, chownr_1.chownrSync)(created, uid, gid); + } + if (needChmod) { + node_fs_1.default.chmodSync(dir, mode); + } + }; + if (dir === cwd) { + checkCwdSync(cwd); + return done(); + } + if (preserve) { + return done(node_fs_1.default.mkdirSync(dir, { mode, recursive: true }) ?? undefined); + } + const sub = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.relative(cwd, dir)); + const parts = sub.split('/'); + let created = undefined; + for (let p = parts.shift(), part = cwd; p && (part += '/' + p); p = parts.shift()) { + part = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(part)); + try { + node_fs_1.default.mkdirSync(part, mode); + created = created || part; + } + catch (er) { + const st = node_fs_1.default.lstatSync(part); + if (st.isDirectory()) { + continue; + } + else if (unlink) { + node_fs_1.default.unlinkSync(part); + node_fs_1.default.mkdirSync(part, mode); + created = created || part; + continue; + } + else if (st.isSymbolicLink()) { + return new symlink_error_js_1.SymlinkError(part, part + '/' + parts.join('/')); + } + } + } + return done(created); +}; +exports.mkdirSync = mkdirSync; +//# sourceMappingURL=mkdir.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/mkdir.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/mkdir.js.map new file mode 100644 index 0000000..392e943 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/mkdir.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mkdir.js","sourceRoot":"","sources":["../../src/mkdir.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA2C;AAC3C,sDAAwB;AACxB,gEAAkC;AAClC,0DAA4B;AAC5B,iDAAyC;AACzC,2EAAkE;AAClE,yDAAiD;AAmBjD,MAAM,QAAQ,GAAG,CACf,GAAW,EACX,EAAmC,EACnC,EAAE;IACF,iBAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;QACtB,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;YAC5B,EAAE,GAAG,IAAI,uBAAQ,CACf,GAAG,EACF,EAA4B,EAAE,IAAI,IAAI,SAAS,CACjD,CAAA;QACH,CAAC;QACD,EAAE,CAAC,EAAE,CAAC,CAAA;IACR,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED;;;;;;;GAOG;AACI,MAAM,KAAK,GAAG,CACnB,GAAW,EACX,GAAiB,EACjB,EAAmD,EACnD,EAAE;IACF,GAAG,GAAG,IAAA,gDAAoB,EAAC,GAAG,CAAC,CAAA;IAE/B,gDAAgD;IAChD,oCAAoC;IACpC,oBAAoB;IACpB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,IAAI,IAAI,CAAA;IAC/B,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,MAAM,CAAA;IAC9B,MAAM,SAAS,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAA;IAEtC,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAA;IACnB,MAAM,GAAG,GAAG,GAAG,CAAC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AM,EAAE,GAAG,iBAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;YAC7B,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;gBACrB,SAAQ;YACV,CAAC;iBAAM,IAAI,MAAM,EAAE,CAAC;gBAClB,iBAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;gBACnB,iBAAE,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;gBACxB,OAAO,GAAG,OAAO,IAAI,IAAI,CAAA;gBACzB,SAAQ;YACV,CAAC;iBAAM,IAAI,EAAE,CAAC,cAAc,EAAE,EAAE,CAAC;gBAC/B,OAAO,IAAI,+BAAY,CAAC,IAAI,EAAE,IAAI,GAAG,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YAC7D,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC,OAAO,CAAC,CAAA;AACtB,CAAC,CAAA;AArEY,QAAA,SAAS,aAqErB","sourcesContent":["import { chownr, chownrSync } from 'chownr'\nimport fs from 'node:fs'\nimport fsp from 'node:fs/promises'\nimport path from 'node:path'\nimport { CwdError } from './cwd-error.js'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport { SymlinkError } from './symlink-error.js'\n\nexport type MkdirOptions = {\n uid?: number\n gid?: number\n processUid?: number\n processGid?: number\n umask?: number\n preserve: boolean\n unlink: boolean\n cwd: string\n mode: number\n}\n\nexport type MkdirError =\n | NodeJS.ErrnoException\n | CwdError\n | SymlinkError\n\nconst checkCwd = (\n dir: string,\n cb: (er?: null | MkdirError) => any,\n) => {\n fs.stat(dir, (er, st) => {\n if (er || !st.isDirectory()) {\n er = new CwdError(\n dir,\n (er as NodeJS.ErrnoException)?.code || 'ENOTDIR',\n )\n }\n cb(er)\n })\n}\n\n/**\n * Wrapper around fs/promises.mkdir for tar's needs.\n *\n * The main purpose is to avoid creating directories if we know that\n * they already exist (and track which ones exist for this purpose),\n * and prevent entries from being extracted into symlinked folders,\n * if `preservePaths` is not set.\n */\nexport const mkdir = (\n dir: string,\n opt: MkdirOptions,\n cb: (er?: null | MkdirError, made?: string) => void,\n) => {\n dir = normalizeWindowsPath(dir)\n\n // if there's any overlap between mask and mode,\n // then we'll need an explicit chmod\n /* c8 ignore next */\n const umask = opt.umask ?? 0o22\n const mode = opt.mode | 0o0700\n const needChmod = (mode & umask) !== 0\n\n const uid = opt.uid\n const gid = opt.gid\n const doChown =\n typeof uid === 'number' &&\n typeof gid === 'number' &&\n (uid !== opt.processUid || gid !== opt.processGid)\n\n const preserve = opt.preserve\n const unlink = opt.unlink\n const cwd = normalizeWindowsPath(opt.cwd)\n\n const done = (er?: null | MkdirError, created?: string) => {\n if (er) {\n cb(er)\n } else {\n if (created && doChown) {\n chownr(created, uid, gid, er =>\n done(er as NodeJS.ErrnoException),\n )\n } else if (needChmod) {\n fs.chmod(dir, mode, cb)\n } else {\n cb()\n }\n }\n }\n\n if (dir === cwd) {\n return checkCwd(dir, done)\n }\n\n if (preserve) {\n return fsp.mkdir(dir, { mode, recursive: true }).then(\n made => done(null, made ?? undefined), // oh, ts\n done,\n )\n }\n\n const sub = normalizeWindowsPath(path.relative(cwd, dir))\n const parts = sub.split('/')\n mkdir_(cwd, parts, mode, unlink, cwd, undefined, done)\n}\n\nconst mkdir_ = (\n base: string,\n parts: string[],\n mode: number,\n unlink: boolean,\n cwd: string,\n created: string | undefined,\n cb: (er?: null | MkdirError, made?: string) => void,\n): void => {\n if (!parts.length) {\n return cb(null, created)\n }\n const p = parts.shift()\n const part = normalizeWindowsPath(path.resolve(base + '/' + p))\n fs.mkdir(\n part,\n mode,\n onmkdir(part, parts, mode, unlink, cwd, created, cb),\n )\n}\n\nconst onmkdir =\n (\n part: string,\n parts: string[],\n mode: number,\n unlink: boolean,\n cwd: string,\n created: string | undefined,\n cb: (er?: null | MkdirError, made?: string) => void,\n ) =>\n (er?: null | NodeJS.ErrnoException) => {\n if (er) {\n fs.lstat(part, (statEr, st) => {\n if (statEr) {\n statEr.path =\n statEr.path && normalizeWindowsPath(statEr.path)\n cb(statEr)\n } else if (st.isDirectory()) {\n mkdir_(part, parts, mode, unlink, cwd, created, cb)\n } else if (unlink) {\n fs.unlink(part, er => {\n if (er) {\n return cb(er)\n }\n fs.mkdir(\n part,\n mode,\n onmkdir(part, parts, mode, unlink, cwd, created, cb),\n )\n })\n } else if (st.isSymbolicLink()) {\n return cb(\n new SymlinkError(part, part + '/' + parts.join('/')),\n )\n } else {\n cb(er)\n }\n })\n } else {\n created = created || part\n mkdir_(part, parts, mode, unlink, cwd, created, cb)\n }\n }\n\nconst checkCwdSync = (dir: string) => {\n let ok = false\n let code: string | undefined = undefined\n try {\n ok = fs.statSync(dir).isDirectory()\n } catch (er) {\n code = (er as NodeJS.ErrnoException)?.code\n } finally {\n if (!ok) {\n throw new CwdError(dir, code ?? 'ENOTDIR')\n }\n }\n}\n\nexport const mkdirSync = (dir: string, opt: MkdirOptions) => {\n dir = normalizeWindowsPath(dir)\n // if there's any overlap between mask and mode,\n // then we'll need an explicit chmod\n /* c8 ignore next */\n const umask = opt.umask ?? 0o22\n const mode = opt.mode | 0o700\n const needChmod = (mode & umask) !== 0\n\n const uid = opt.uid\n const gid = opt.gid\n const doChown =\n typeof uid === 'number' &&\n typeof gid === 'number' &&\n (uid !== opt.processUid || gid !== opt.processGid)\n\n const preserve = opt.preserve\n const unlink = opt.unlink\n const cwd = normalizeWindowsPath(opt.cwd)\n\n const done = (created?: string | undefined) => {\n if (created && doChown) {\n chownrSync(created, uid, gid)\n }\n if (needChmod) {\n fs.chmodSync(dir, mode)\n }\n }\n\n if (dir === cwd) {\n checkCwdSync(cwd)\n return done()\n }\n\n if (preserve) {\n return done(\n fs.mkdirSync(dir, { mode, recursive: true }) ?? undefined,\n )\n }\n\n const sub = normalizeWindowsPath(path.relative(cwd, dir))\n const parts = sub.split('/')\n let created: string | undefined = undefined\n for (\n let p = parts.shift(), part = cwd;\n p && (part += '/' + p);\n p = parts.shift()\n ) {\n part = normalizeWindowsPath(path.resolve(part))\n\n try {\n fs.mkdirSync(part, mode)\n created = created || part\n } catch (er) {\n const st = fs.lstatSync(part)\n if (st.isDirectory()) {\n continue\n } else if (unlink) {\n fs.unlinkSync(part)\n fs.mkdirSync(part, mode)\n created = created || part\n continue\n } else if (st.isSymbolicLink()) {\n return new SymlinkError(part, part + '/' + parts.join('/'))\n }\n }\n }\n\n return done(created)\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/mode-fix.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/mode-fix.d.ts new file mode 100644 index 0000000..38f3d93 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/mode-fix.d.ts @@ -0,0 +1,2 @@ +export declare const modeFix: (mode: number, isDir: boolean, portable: boolean) => number; +//# sourceMappingURL=mode-fix.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/mode-fix.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/mode-fix.d.ts.map new file mode 100644 index 0000000..d51aa06 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/mode-fix.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-fix.d.ts","sourceRoot":"","sources":["../../src/mode-fix.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,GAClB,MAAM,MAAM,EACZ,OAAO,OAAO,EACd,UAAU,OAAO,WA0BlB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/mode-fix.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/mode-fix.js new file mode 100644 index 0000000..49dd727 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/mode-fix.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.modeFix = void 0; +const modeFix = (mode, isDir, portable) => { + mode &= 0o7777; + // in portable mode, use the minimum reasonable umask + // if this system creates files with 0o664 by default + // (as some linux distros do), then we'll write the + // archive with 0o644 instead. Also, don't ever create + // a file that is not readable/writable by the owner. + if (portable) { + mode = (mode | 0o600) & ~0o22; + } + // if dirs are readable, then they should be listable + if (isDir) { + if (mode & 0o400) { + mode |= 0o100; + } + if (mode & 0o40) { + mode |= 0o10; + } + if (mode & 0o4) { + mode |= 0o1; + } + } + return mode; +}; +exports.modeFix = modeFix; +//# sourceMappingURL=mode-fix.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/mode-fix.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/mode-fix.js.map new file mode 100644 index 0000000..a44f846 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/mode-fix.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-fix.js","sourceRoot":"","sources":["../../src/mode-fix.ts"],"names":[],"mappings":";;;AAAO,MAAM,OAAO,GAAG,CACrB,IAAY,EACZ,KAAc,EACd,QAAiB,EACjB,EAAE;IACF,IAAI,IAAI,MAAM,CAAA;IAEd,qDAAqD;IACrD,qDAAqD;IACrD,mDAAmD;IACnD,uDAAuD;IACvD,qDAAqD;IACrD,IAAI,QAAQ,EAAE,CAAC;QACb,IAAI,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAA;IAC/B,CAAC;IAED,qDAAqD;IACrD,IAAI,KAAK,EAAE,CAAC;QACV,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;YACjB,IAAI,IAAI,KAAK,CAAA;QACf,CAAC;QACD,IAAI,IAAI,GAAG,IAAI,EAAE,CAAC;YAChB,IAAI,IAAI,IAAI,CAAA;QACd,CAAC;QACD,IAAI,IAAI,GAAG,GAAG,EAAE,CAAC;YACf,IAAI,IAAI,GAAG,CAAA;QACb,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AA7BY,QAAA,OAAO,WA6BnB","sourcesContent":["export const modeFix = (\n mode: number,\n isDir: boolean,\n portable: boolean,\n) => {\n mode &= 0o7777\n\n // in portable mode, use the minimum reasonable umask\n // if this system creates files with 0o664 by default\n // (as some linux distros do), then we'll write the\n // archive with 0o644 instead. Also, don't ever create\n // a file that is not readable/writable by the owner.\n if (portable) {\n mode = (mode | 0o600) & ~0o22\n }\n\n // if dirs are readable, then they should be listable\n if (isDir) {\n if (mode & 0o400) {\n mode |= 0o100\n }\n if (mode & 0o40) {\n mode |= 0o10\n }\n if (mode & 0o4) {\n mode |= 0o1\n }\n }\n return mode\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-unicode.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-unicode.d.ts new file mode 100644 index 0000000..71df092 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-unicode.d.ts @@ -0,0 +1,2 @@ +export declare const normalizeUnicode: (s: string) => string; +//# sourceMappingURL=normalize-unicode.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-unicode.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-unicode.d.ts.map new file mode 100644 index 0000000..459f68f --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-unicode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"normalize-unicode.d.ts","sourceRoot":"","sources":["../../src/normalize-unicode.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,gBAAgB,GAAI,GAAG,MAAM,KAAG,MAyB5C,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-unicode.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-unicode.js new file mode 100644 index 0000000..5b0eaec --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-unicode.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.normalizeUnicode = void 0; +// warning: extremely hot code path. +// This has been meticulously optimized for use +// within npm install on large package trees. +// Do not edit without careful benchmarking. +const normalizeCache = Object.create(null); +// Limit the size of this. Very low-sophistication LRU cache +const MAX = 10000; +const cache = new Set(); +const normalizeUnicode = (s) => { + if (!cache.has(s)) { + // shake out identical accents and ligatures + normalizeCache[s] = s + .normalize('NFD') + .toLocaleLowerCase('en') + .toLocaleUpperCase('en'); + } + else { + cache.delete(s); + } + cache.add(s); + const ret = normalizeCache[s]; + let i = cache.size - MAX; + // only prune when we're 10% over the max + if (i > MAX / 10) { + for (const s of cache) { + cache.delete(s); + delete normalizeCache[s]; + if (--i <= 0) + break; + } + } + return ret; +}; +exports.normalizeUnicode = normalizeUnicode; +//# sourceMappingURL=normalize-unicode.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-unicode.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-unicode.js.map new file mode 100644 index 0000000..b11b643 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-unicode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalize-unicode.js","sourceRoot":"","sources":["../../src/normalize-unicode.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,+CAA+C;AAC/C,6CAA6C;AAC7C,4CAA4C;AAC5C,MAAM,cAAc,GAA2B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AAElE,4DAA4D;AAC5D,MAAM,GAAG,GAAG,KAAK,CAAA;AACjB,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;AACxB,MAAM,gBAAgB,GAAG,CAAC,CAAS,EAAU,EAAE;IACpD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAClB,4CAA4C;QAC5C,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC;aAClB,SAAS,CAAC,KAAK,CAAC;aAChB,iBAAiB,CAAC,IAAI,CAAC;aACvB,iBAAiB,CAAC,IAAI,CAAC,CAAA;IAC5B,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IAEZ,MAAM,GAAG,GAAG,cAAc,CAAC,CAAC,CAAW,CAAA;IAEvC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG,GAAG,CAAA;IACxB,yCAAyC;IACzC,IAAI,CAAC,GAAG,GAAG,GAAG,EAAE,EAAE,CAAC;QACjB,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;YACf,OAAO,cAAc,CAAC,CAAC,CAAC,CAAA;YACxB,IAAI,EAAE,CAAC,IAAI,CAAC;gBAAE,MAAK;QACrB,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAzBY,QAAA,gBAAgB,oBAyB5B","sourcesContent":["// warning: extremely hot code path.\n// This has been meticulously optimized for use\n// within npm install on large package trees.\n// Do not edit without careful benchmarking.\nconst normalizeCache: Record = Object.create(null)\n\n// Limit the size of this. Very low-sophistication LRU cache\nconst MAX = 10000\nconst cache = new Set()\nexport const normalizeUnicode = (s: string): string => {\n if (!cache.has(s)) {\n // shake out identical accents and ligatures\n normalizeCache[s] = s\n .normalize('NFD')\n .toLocaleLowerCase('en')\n .toLocaleUpperCase('en')\n } else {\n cache.delete(s)\n }\n cache.add(s)\n\n const ret = normalizeCache[s] as string\n\n let i = cache.size - MAX\n // only prune when we're 10% over the max\n if (i > MAX / 10) {\n for (const s of cache) {\n cache.delete(s)\n delete normalizeCache[s]\n if (--i <= 0) break\n }\n }\n\n return ret\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts new file mode 100644 index 0000000..8581105 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts @@ -0,0 +1,2 @@ +export declare const normalizeWindowsPath: (p: string) => string; +//# sourceMappingURL=normalize-windows-path.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts.map new file mode 100644 index 0000000..25de3c0 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"normalize-windows-path.d.ts","sourceRoot":"","sources":["../../src/normalize-windows-path.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,oBAAoB,MAEzB,MAAM,WAC+B,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-windows-path.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-windows-path.js new file mode 100644 index 0000000..b0c7aaa --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-windows-path.js @@ -0,0 +1,12 @@ +"use strict"; +// on windows, either \ or / are valid directory separators. +// on unix, \ is a valid character in filenames. +// so, on windows, and only on windows, we replace all \ chars with /, +// so that we can use / as our one and only directory separator char. +Object.defineProperty(exports, "__esModule", { value: true }); +exports.normalizeWindowsPath = void 0; +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; +exports.normalizeWindowsPath = platform !== 'win32' ? + (p) => p + : (p) => p && p.replace(/\\/g, '/'); +//# sourceMappingURL=normalize-windows-path.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-windows-path.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-windows-path.js.map new file mode 100644 index 0000000..8d31dc4 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/normalize-windows-path.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalize-windows-path.js","sourceRoot":"","sources":["../../src/normalize-windows-path.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,gDAAgD;AAChD,sEAAsE;AACtE,qEAAqE;;;AAErE,MAAM,QAAQ,GACZ,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,OAAO,CAAC,QAAQ,CAAA;AAE9C,QAAA,oBAAoB,GAC/B,QAAQ,KAAK,OAAO,CAAC,CAAC;IACpB,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA","sourcesContent":["// on windows, either \\ or / are valid directory separators.\n// on unix, \\ is a valid character in filenames.\n// so, on windows, and only on windows, we replace all \\ chars with /,\n// so that we can use / as our one and only directory separator char.\n\nconst platform =\n process.env.TESTING_TAR_FAKE_PLATFORM || process.platform\n\nexport const normalizeWindowsPath =\n platform !== 'win32' ?\n (p: string) => p\n : (p: string) => p && p.replace(/\\\\/g, '/')\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/options.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/options.d.ts new file mode 100644 index 0000000..f6ccc8f --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/options.d.ts @@ -0,0 +1,596 @@ +import { type GzipOptions, type ZlibOptions } from 'minizlib'; +import { type Stats } from 'node:fs'; +import { type ReadEntry } from './read-entry.js'; +import { type WarnData } from './warn-method.js'; +import { WriteEntry } from './write-entry.js'; +/** + * The options that can be provided to tar commands. + * + * Note that some of these are only relevant for certain commands, since + * they are specific to reading or writing. + * + * Aliases are provided in the {@link TarOptionsWithAliases} type. + */ +export interface TarOptions { + /** + * Perform all I/O operations synchronously. If the stream is ended + * immediately, then it will be processed entirely synchronously. + */ + sync?: boolean; + /** + * The tar file to be read and/or written. When this is set, a stream + * is not returned. Asynchronous commands will return a promise indicating + * when the operation is completed, and synchronous commands will return + * immediately. + */ + file?: string; + /** + * Treat warnings as crash-worthy errors. Defaults false. + */ + strict?: boolean; + /** + * The effective current working directory for this tar command + */ + cwd?: string; + /** + * When creating a tar archive, this can be used to compress it as well. + * Set to `true` to use the default gzip options, or customize them as + * needed. + * + * When reading, if this is unset, then the compression status will be + * inferred from the archive data. This is generally best, unless you are + * sure of the compression settings in use to create the archive, and want to + * fail if the archive doesn't match expectations. + */ + gzip?: boolean | GzipOptions; + /** + * When creating archives, preserve absolute and `..` paths in the archive, + * rather than sanitizing them under the cwd. + * + * When extracting, allow absolute paths, paths containing `..`, and + * extracting through symbolic links. By default, the root `/` is stripped + * from absolute paths (eg, turning `/x/y/z` into `x/y/z`), paths containing + * `..` are not extracted, and any file whose location would be modified by a + * symbolic link is not extracted. + * + * **WARNING** This is almost always unsafe, and must NEVER be used on + * archives from untrusted sources, such as user input, and every entry must + * be validated to ensure it is safe to write. Even if the input is not + * malicious, mistakes can cause a lot of damage! + */ + preservePaths?: boolean; + /** + * When extracting, do not set the `mtime` value for extracted entries to + * match the `mtime` in the archive. + * + * When creating archives, do not store the `mtime` value in the entry. Note + * that this prevents properly using other mtime-based features (such as + * `tar.update` or the `newer` option) with the resulting archive. + */ + noMtime?: boolean; + /** + * Set to `true` or an object with settings for `zlib.BrotliCompress()` to + * create a brotli-compressed archive + * + * When extracting, this will cause the archive to be treated as a + * brotli-compressed file if set to `true` or a ZlibOptions object. + * + * If set `false`, then brotli options will not be used. + * + * If this, the `gzip`, and `zstd` options are left `undefined`, then tar + * will attempt to infer the brotli compression status, but can only do so + * based on the filename. If the filename ends in `.tbr` or `.tar.br`, and + * the first 512 bytes are not a valid tar header, then brotli decompression + * will be attempted. + */ + brotli?: boolean | ZlibOptions; + /** + * Set to `true` or an object with settings for `zstd.compress()` to + * create a zstd-compressed archive + * + * When extracting, this will cause the archive to be treated as a + * zstd-compressed file if set to `true` or a ZlibOptions object. + * + * If set `false`, then zstd options will not be used. + * + * If this, the `gzip`, and `brotli` options are left `undefined`, then tar + * will attempt to infer the zstd compression status, but can only do so + * based on the filename. If the filename ends in `.tzst` or `.tar.zst`, and + * the first 512 bytes are not a valid tar header, then zstd decompression + * will be attempted. + */ + zstd?: boolean | ZlibOptions; + /** + * A function that is called with `(path, stat)` when creating an archive, or + * `(path, entry)` when extracting. Return true to process the file/entry, or + * false to exclude it. + */ + filter?: (path: string, entry: Stats | ReadEntry) => boolean; + /** + * A function that gets called for any warning encountered. + * + * Note: if `strict` is set, then the warning will throw, and this method + * will not be called. + */ + onwarn?: (code: string, message: string, data: WarnData) => any; + /** + * When extracting, unlink files before creating them. Without this option, + * tar overwrites existing files, which preserves existing hardlinks. With + * this option, existing hardlinks will be broken, as will any symlink that + * would affect the location of an extracted file. + */ + unlink?: boolean; + /** + * When extracting, strip the specified number of path portions from the + * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be + * extracted to `{cwd}/c/d`. + * + * Any entry whose entire path is stripped will be excluded. + */ + strip?: number; + /** + * When extracting, keep the existing file on disk if it's newer than the + * file in the archive. + */ + newer?: boolean; + /** + * When extracting, do not overwrite existing files at all. + */ + keep?: boolean; + /** + * When extracting, set the `uid` and `gid` of extracted entries to the `uid` + * and `gid` fields in the archive. Defaults to true when run as root, and + * false otherwise. + * + * If false, then files and directories will be set with the owner and group + * of the user running the process. This is similar to `-p` in `tar(1)`, but + * ACLs and other system-specific data is never unpacked in this + * implementation, and modes are set by default already. + */ + preserveOwner?: boolean; + /** + * The maximum depth of subfolders to extract into. This defaults to 1024. + * Anything deeper than the limit will raise a warning and skip the entry. + * Set to `Infinity` to remove the limitation. + */ + maxDepth?: number; + /** + * When extracting, force all created files and directories, and all + * implicitly created directories, to be owned by the specified user id, + * regardless of the `uid` field in the archive. + * + * Cannot be used along with `preserveOwner`. Requires also setting the `gid` + * option. + */ + uid?: number; + /** + * When extracting, force all created files and directories, and all + * implicitly created directories, to be owned by the specified group id, + * regardless of the `gid` field in the archive. + * + * Cannot be used along with `preserveOwner`. Requires also setting the `uid` + * option. + */ + gid?: number; + /** + * When extracting, provide a function that takes an `entry` object, and + * returns a stream, or any falsey value. If a stream is provided, then that + * stream's data will be written instead of the contents of the archive + * entry. If a falsey value is provided, then the entry is written to disk as + * normal. + * + * To exclude items from extraction, use the `filter` option. + * + * Note that using an asynchronous stream type with the `transform` option + * will cause undefined behavior in synchronous extractions. + * [MiniPass](http://npm.im/minipass)-based streams are designed for this use + * case. + */ + transform?: (entry: ReadEntry) => any; + /** + * Call `chmod()` to ensure that extracted files match the entry's mode + * field. Without this field set, all mode fields in archive entries are a + * best effort attempt only. + * + * Setting this necessitates a call to the deprecated `process.umask()` + * method to determine the default umask value, unless a `processUmask` + * config is provided as well. + * + * If not set, tar will attempt to create file system entries with whatever + * mode is provided, and let the implicit process `umask` apply normally, but + * if a file already exists to be written to, then its existing mode will not + * be modified. + * + * When setting `chmod: true`, it is highly recommend to set the + * {@link TarOptions#processUmask} option as well, to avoid the call to the + * deprecated (and thread-unsafe) `process.umask()` method. + */ + chmod?: boolean; + /** + * When setting the {@link TarOptions#chmod} option to `true`, you may + * provide a value here to avoid having to call the deprecated and + * thread-unsafe `process.umask()` method. + * + * This has no effect with `chmod` is not set to true, as mode values are not + * set explicitly anyway. If `chmod` is set to `true`, and a value is not + * provided here, then `process.umask()` must be called, which will result in + * deprecation warnings. + * + * The most common values for this are `0o22` (resulting in directories + * created with mode `0o755` and files with `0o644` by default) and `0o2` + * (resulting in directores created with mode `0o775` and files `0o664`, so + * they are group-writable). + */ + processUmask?: number; + /** + * When parsing/listing archives, `entry` streams are by default resumed + * (set into "flowing" mode) immediately after the call to `onReadEntry()`. + * Set `noResume: true` to suppress this behavior. + * + * Note that when this is set, the stream will never complete until the + * data is consumed somehow. + * + * Set automatically in extract operations, since the entry is piped to + * a file system entry right away. Only relevant when parsing. + */ + noResume?: boolean; + /** + * When creating, updating, or replacing within archives, this method will + * be called with each WriteEntry that is created. + */ + onWriteEntry?: (entry: WriteEntry) => any; + /** + * When extracting or listing archives, this method will be called with + * each entry that is not excluded by a `filter`. + * + * Important when listing archives synchronously from a file, because there + * is otherwise no way to interact with the data! + */ + onReadEntry?: (entry: ReadEntry) => any; + /** + * Pack the targets of symbolic links rather than the link itself. + */ + follow?: boolean; + /** + * When creating archives, omit any metadata that is system-specific: + * `ctime`, `atime`, `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and + * `nlink`. Note that `mtime` is still included, because this is necessary + * for other time-based operations such as `tar.update`. Additionally, `mode` + * is set to a "reasonable default" for mose unix systems, based on an + * effective `umask` of `0o22`. + * + * This also defaults the `portable` option in the gzip configs when creating + * a compressed archive, in order to produce deterministic archives that are + * not operating-system specific. + */ + portable?: boolean; + /** + * When creating archives, do not recursively archive the contents of + * directories. By default, archiving a directory archives all of its + * contents as well. + */ + noDirRecurse?: boolean; + /** + * Suppress Pax extended headers when creating archives. Note that this means + * long paths and linkpaths will be truncated, and large or negative numeric + * values may be interpreted incorrectly. + */ + noPax?: boolean; + /** + * Set to a `Date` object to force a specific `mtime` value for everything + * written to an archive. + * + * This is useful when creating archives that are intended to be + * deterministic based on their contents, irrespective of the file's last + * modification time. + * + * Overridden by `noMtime`. + */ + mtime?: Date; + /** + * A path portion to prefix onto the entries added to an archive. + */ + prefix?: string; + /** + * The mode to set on any created file archive, defaults to 0o666 + * masked by the process umask, often resulting in 0o644. + * + * This does *not* affect the mode fields of individual entries, or the + * mode status of extracted entries on the filesystem. + */ + mode?: number; + /** + * A cache of mtime values, to avoid having to stat the same file repeatedly. + * + * @internal + */ + mtimeCache?: Map; + /** + * maximum buffer size for `fs.read()` operations. + * + * @internal + */ + maxReadSize?: number; + /** + * Filter modes of entries being unpacked, like `process.umask()` + * + * @internal + */ + umask?: number; + /** + * Default mode for directories. Used for all implicitly created directories, + * and any directories in the archive that do not have a mode field. + * + * @internal + */ + dmode?: number; + /** + * default mode for files + * + * @internal + */ + fmode?: number; + /** + * Map that tracks which directories already exist, for extraction + * + * @internal + */ + dirCache?: Map; + /** + * maximum supported size of meta entries. Defaults to 1MB + * + * @internal + */ + maxMetaEntrySize?: number; + /** + * A Map object containing the device and inode value for any file whose + * `nlink` value is greater than 1, to identify hard links when creating + * archives. + * + * @internal + */ + linkCache?: Map; + /** + * A map object containing the results of `fs.readdir()` calls. + * + * @internal + */ + readdirCache?: Map; + /** + * A cache of all `lstat` results, for use in creating archives. + * + * @internal + */ + statCache?: Map; + /** + * Number of concurrent jobs to run when creating archives. + * + * Defaults to 4. + * + * @internal + */ + jobs?: number; + /** + * Automatically set to true on Windows systems. + * + * When extracting, causes behavior where filenames containing `<|>?:` + * characters are converted to windows-compatible escape sequences in the + * created filesystem entries. + * + * When packing, causes behavior where paths replace `\` with `/`, and + * filenames containing the windows-compatible escaped forms of `<|>?:` are + * converted to actual `<|>?:` characters in the archive. + * + * @internal + */ + win32?: boolean; + /** + * For `WriteEntry` objects, the absolute path to the entry on the + * filesystem. By default, this is `resolve(cwd, entry.path)`, but it can be + * overridden explicitly. + * + * @internal + */ + absolute?: string; + /** + * Used with Parser stream interface, to attach and take over when the + * stream is completely parsed. If this is set, then the prefinish, + * finish, and end events will not fire, and are the responsibility of + * the ondone method to emit properly. + * + * @internal + */ + ondone?: () => void; + /** + * Mostly for testing, but potentially useful in some cases. + * Forcibly trigger a chown on every entry, no matter what. + */ + forceChown?: boolean; + /** + * ambiguous deprecated name for {@link onReadEntry} + * + * @deprecated + */ + onentry?: (entry: ReadEntry) => any; +} +export type TarOptionsSync = TarOptions & { + sync: true; +}; +export type TarOptionsAsync = TarOptions & { + sync?: false; +}; +export type TarOptionsFile = TarOptions & { + file: string; +}; +export type TarOptionsNoFile = TarOptions & { + file?: undefined; +}; +export type TarOptionsSyncFile = TarOptionsSync & TarOptionsFile; +export type TarOptionsAsyncFile = TarOptionsAsync & TarOptionsFile; +export type TarOptionsSyncNoFile = TarOptionsSync & TarOptionsNoFile; +export type TarOptionsAsyncNoFile = TarOptionsAsync & TarOptionsNoFile; +export type LinkCacheKey = `${number}:${number}`; +export interface TarOptionsWithAliases extends TarOptions { + /** + * The effective current working directory for this tar command + */ + C?: TarOptions['cwd']; + /** + * The tar file to be read and/or written. When this is set, a stream + * is not returned. Asynchronous commands will return a promise indicating + * when the operation is completed, and synchronous commands will return + * immediately. + */ + f?: TarOptions['file']; + /** + * When creating a tar archive, this can be used to compress it as well. + * Set to `true` to use the default gzip options, or customize them as + * needed. + * + * When reading, if this is unset, then the compression status will be + * inferred from the archive data. This is generally best, unless you are + * sure of the compression settings in use to create the archive, and want to + * fail if the archive doesn't match expectations. + */ + z?: TarOptions['gzip']; + /** + * When creating archives, preserve absolute and `..` paths in the archive, + * rather than sanitizing them under the cwd. + * + * When extracting, allow absolute paths, paths containing `..`, and + * extracting through symbolic links. By default, the root `/` is stripped + * from absolute paths (eg, turning `/x/y/z` into `x/y/z`), paths containing + * `..` are not extracted, and any file whose location would be modified by a + * symbolic link is not extracted. + * + * **WARNING** This is almost always unsafe, and must NEVER be used on + * archives from untrusted sources, such as user input, and every entry must + * be validated to ensure it is safe to write. Even if the input is not + * malicious, mistakes can cause a lot of damage! + */ + P?: TarOptions['preservePaths']; + /** + * When extracting, unlink files before creating them. Without this option, + * tar overwrites existing files, which preserves existing hardlinks. With + * this option, existing hardlinks will be broken, as will any symlink that + * would affect the location of an extracted file. + */ + U?: TarOptions['unlink']; + /** + * When extracting, strip the specified number of path portions from the + * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be + * extracted to `{cwd}/c/d`. + */ + 'strip-components'?: TarOptions['strip']; + /** + * When extracting, strip the specified number of path portions from the + * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be + * extracted to `{cwd}/c/d`. + */ + stripComponents?: TarOptions['strip']; + /** + * When extracting, keep the existing file on disk if it's newer than the + * file in the archive. + */ + 'keep-newer'?: TarOptions['newer']; + /** + * When extracting, keep the existing file on disk if it's newer than the + * file in the archive. + */ + keepNewer?: TarOptions['newer']; + /** + * When extracting, keep the existing file on disk if it's newer than the + * file in the archive. + */ + 'keep-newer-files'?: TarOptions['newer']; + /** + * When extracting, keep the existing file on disk if it's newer than the + * file in the archive. + */ + keepNewerFiles?: TarOptions['newer']; + /** + * When extracting, do not overwrite existing files at all. + */ + k?: TarOptions['keep']; + /** + * When extracting, do not overwrite existing files at all. + */ + 'keep-existing'?: TarOptions['keep']; + /** + * When extracting, do not overwrite existing files at all. + */ + keepExisting?: TarOptions['keep']; + /** + * When extracting, do not set the `mtime` value for extracted entries to + * match the `mtime` in the archive. + * + * When creating archives, do not store the `mtime` value in the entry. Note + * that this prevents properly using other mtime-based features (such as + * `tar.update` or the `newer` option) with the resulting archive. + */ + m?: TarOptions['noMtime']; + /** + * When extracting, do not set the `mtime` value for extracted entries to + * match the `mtime` in the archive. + * + * When creating archives, do not store the `mtime` value in the entry. Note + * that this prevents properly using other mtime-based features (such as + * `tar.update` or the `newer` option) with the resulting archive. + */ + 'no-mtime'?: TarOptions['noMtime']; + /** + * When extracting, set the `uid` and `gid` of extracted entries to the `uid` + * and `gid` fields in the archive. Defaults to true when run as root, and + * false otherwise. + * + * If false, then files and directories will be set with the owner and group + * of the user running the process. This is similar to `-p` in `tar(1)`, but + * ACLs and other system-specific data is never unpacked in this + * implementation, and modes are set by default already. + */ + p?: TarOptions['preserveOwner']; + /** + * Pack the targets of symbolic links rather than the link itself. + */ + L?: TarOptions['follow']; + /** + * Pack the targets of symbolic links rather than the link itself. + */ + h?: TarOptions['follow']; + /** + * Deprecated option. Set explicitly false to set `chmod: true`. Ignored + * if {@link TarOptions#chmod} is set to any boolean value. + * + * @deprecated + */ + noChmod?: boolean; +} +export type TarOptionsWithAliasesSync = TarOptionsWithAliases & { + sync: true; +}; +export type TarOptionsWithAliasesAsync = TarOptionsWithAliases & { + sync?: false; +}; +export type TarOptionsWithAliasesFile = (TarOptionsWithAliases & { + file: string; +}) | (TarOptionsWithAliases & { + f: string; +}); +export type TarOptionsWithAliasesSyncFile = TarOptionsWithAliasesSync & TarOptionsWithAliasesFile; +export type TarOptionsWithAliasesAsyncFile = TarOptionsWithAliasesAsync & TarOptionsWithAliasesFile; +export type TarOptionsWithAliasesNoFile = TarOptionsWithAliases & { + f?: undefined; + file?: undefined; +}; +export type TarOptionsWithAliasesSyncNoFile = TarOptionsWithAliasesSync & TarOptionsWithAliasesNoFile; +export type TarOptionsWithAliasesAsyncNoFile = TarOptionsWithAliasesAsync & TarOptionsWithAliasesNoFile; +export declare const isSyncFile: (o: O) => o is O & TarOptionsSyncFile; +export declare const isAsyncFile: (o: O) => o is O & TarOptionsAsyncFile; +export declare const isSyncNoFile: (o: O) => o is O & TarOptionsSyncNoFile; +export declare const isAsyncNoFile: (o: O) => o is O & TarOptionsAsyncNoFile; +export declare const isSync: (o: O) => o is O & TarOptionsSync; +export declare const isAsync: (o: O) => o is O & TarOptionsAsync; +export declare const isFile: (o: O) => o is O & TarOptionsFile; +export declare const isNoFile: (o: O) => o is O & TarOptionsNoFile; +export declare const dealias: (opt?: TarOptionsWithAliases) => TarOptions; +//# sourceMappingURL=options.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/options.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/options.d.ts.map new file mode 100644 index 0000000..1171ea7 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/options.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,KAAK,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U,EAC9C,GAAG,CAAC,KACH,CAAC,IAAI,CAAC,GAAG,mBAA0C,CAAA;AACtD,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,UAAU,EAC/C,GAAG,CAAC,KACH,CAAC,IAAI,CAAC,GAAG,oBAA2C,CAAA;AACvD,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,UAAU,EAChD,GAAG,CAAC,KACH,CAAC,IAAI,CAAC,GAAG,qBAA2C,CAAA;AACvD,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,UAAU,EACzC,GAAG,CAAC,KACH,CAAC,IAAI,CAAC,GAAG,cAA0B,CAAA;AACtC,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,UAAU,EAC1C,GAAG,CAAC,KACH,CAAC,IAAI,CAAC,GAAG,eAA0B,CAAA;AACtC,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,UAAU,EACzC,GAAG,CAAC,KACH,CAAC,IAAI,CAAC,GAAG,cAA0B,CAAA;AACtC,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,UAAU,EAC3C,GAAG,CAAC,KACH,CAAC,IAAI,CAAC,GAAG,gBAA2B,CAAA;AAUvC,eAAO,MAAM,OAAO,GAClB,MAAK,qBAA0B,KAC9B,UAiBF,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/options.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/options.js new file mode 100644 index 0000000..4cd0650 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/options.js @@ -0,0 +1,66 @@ +"use strict"; +// turn tar(1) style args like `C` into the more verbose things like `cwd` +Object.defineProperty(exports, "__esModule", { value: true }); +exports.dealias = exports.isNoFile = exports.isFile = exports.isAsync = exports.isSync = exports.isAsyncNoFile = exports.isSyncNoFile = exports.isAsyncFile = exports.isSyncFile = void 0; +const argmap = new Map([ + ['C', 'cwd'], + ['f', 'file'], + ['z', 'gzip'], + ['P', 'preservePaths'], + ['U', 'unlink'], + ['strip-components', 'strip'], + ['stripComponents', 'strip'], + ['keep-newer', 'newer'], + ['keepNewer', 'newer'], + ['keep-newer-files', 'newer'], + ['keepNewerFiles', 'newer'], + ['k', 'keep'], + ['keep-existing', 'keep'], + ['keepExisting', 'keep'], + ['m', 'noMtime'], + ['no-mtime', 'noMtime'], + ['p', 'preserveOwner'], + ['L', 'follow'], + ['h', 'follow'], + ['onentry', 'onReadEntry'], +]); +const isSyncFile = (o) => !!o.sync && !!o.file; +exports.isSyncFile = isSyncFile; +const isAsyncFile = (o) => !o.sync && !!o.file; +exports.isAsyncFile = isAsyncFile; +const isSyncNoFile = (o) => !!o.sync && !o.file; +exports.isSyncNoFile = isSyncNoFile; +const isAsyncNoFile = (o) => !o.sync && !o.file; +exports.isAsyncNoFile = isAsyncNoFile; +const isSync = (o) => !!o.sync; +exports.isSync = isSync; +const isAsync = (o) => !o.sync; +exports.isAsync = isAsync; +const isFile = (o) => !!o.file; +exports.isFile = isFile; +const isNoFile = (o) => !o.file; +exports.isNoFile = isNoFile; +const dealiasKey = (k) => { + const d = argmap.get(k); + if (d) + return d; + return k; +}; +const dealias = (opt = {}) => { + if (!opt) + return {}; + const result = {}; + for (const [key, v] of Object.entries(opt)) { + // TS doesn't know that aliases are going to always be the same type + const k = dealiasKey(key); + result[k] = v; + } + // affordance for deprecated noChmod -> chmod + if (result.chmod === undefined && result.noChmod === false) { + result.chmod = true; + } + delete result.noChmod; + return result; +}; +exports.dealias = dealias; +//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/options.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/options.js.map new file mode 100644 index 0000000..f696d74 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/options.js.map @@ -0,0 +1 @@ +{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":";AAAA,0EAA0E;;;AAQ1E,MAAM,MAAM,GAAG,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MAAM,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;QAC3D,MAAM,CAAC,KAAK,GAAG,IAAI,CAAA;IACrB,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAA;IACrB,OAAO,MAAoB,CAAA;AAC7B,CAAC,CAAA;AAnBY,QAAA,OAAO,WAmBnB","sourcesContent":["// turn tar(1) style args like `C` into the more verbose things like `cwd`\n\nimport { type GzipOptions, type ZlibOptions } from 'minizlib'\nimport { type Stats } from 'node:fs'\nimport { type ReadEntry } from './read-entry.js'\nimport { type WarnData } from './warn-method.js'\nimport { WriteEntry } from './write-entry.js'\n\nconst argmap = new Map(\n [\n ['C', 'cwd'],\n ['f', 'file'],\n ['z', 'gzip'],\n ['P', 'preservePaths'],\n ['U', 'unlink'],\n ['strip-components', 'strip'],\n ['stripComponents', 'strip'],\n ['keep-newer', 'newer'],\n ['keepNewer', 'newer'],\n ['keep-newer-files', 'newer'],\n ['keepNewerFiles', 'newer'],\n ['k', 'keep'],\n ['keep-existing', 'keep'],\n ['keepExisting', 'keep'],\n ['m', 'noMtime'],\n ['no-mtime', 'noMtime'],\n ['p', 'preserveOwner'],\n ['L', 'follow'],\n ['h', 'follow'],\n ['onentry', 'onReadEntry'],\n ],\n)\n\n/**\n * The options that can be provided to tar commands.\n *\n * Note that some of these are only relevant for certain commands, since\n * they are specific to reading or writing.\n *\n * Aliases are provided in the {@link TarOptionsWithAliases} type.\n */\nexport interface TarOptions {\n //////////////////////////\n // shared options\n\n /**\n * Perform all I/O operations synchronously. If the stream is ended\n * immediately, then it will be processed entirely synchronously.\n */\n sync?: boolean\n\n /**\n * The tar file to be read and/or written. When this is set, a stream\n * is not returned. Asynchronous commands will return a promise indicating\n * when the operation is completed, and synchronous commands will return\n * immediately.\n */\n file?: string\n\n /**\n * Treat warnings as crash-worthy errors. Defaults false.\n */\n strict?: boolean\n\n /**\n * The effective current working directory for this tar command\n */\n cwd?: string\n\n /**\n * When creating a tar archive, this can be used to compress it as well.\n * Set to `true` to use the default gzip options, or customize them as\n * needed.\n *\n * When reading, if this is unset, then the compression status will be\n * inferred from the archive data. This is generally best, unless you are\n * sure of the compression settings in use to create the archive, and want to\n * fail if the archive doesn't match expectations.\n */\n gzip?: boolean | GzipOptions\n\n /**\n * When creating archives, preserve absolute and `..` paths in the archive,\n * rather than sanitizing them under the cwd.\n *\n * When extracting, allow absolute paths, paths containing `..`, and\n * extracting through symbolic links. By default, the root `/` is stripped\n * from absolute paths (eg, turning `/x/y/z` into `x/y/z`), paths containing\n * `..` are not extracted, and any file whose location would be modified by a\n * symbolic link is not extracted.\n *\n * **WARNING** This is almost always unsafe, and must NEVER be used on\n * archives from untrusted sources, such as user input, and every entry must\n * be validated to ensure it is safe to write. Even if the input is not\n * malicious, mistakes can cause a lot of damage!\n */\n preservePaths?: boolean\n\n /**\n * When extracting, do not set the `mtime` value for extracted entries to\n * match the `mtime` in the archive.\n *\n * When creating archives, do not store the `mtime` value in the entry. Note\n * that this prevents properly using other mtime-based features (such as\n * `tar.update` or the `newer` option) with the resulting archive.\n */\n noMtime?: boolean\n\n /**\n * Set to `true` or an object with settings for `zlib.BrotliCompress()` to\n * create a brotli-compressed archive\n *\n * When extracting, this will cause the archive to be treated as a\n * brotli-compressed file if set to `true` or a ZlibOptions object.\n *\n * If set `false`, then brotli options will not be used.\n *\n * If this, the `gzip`, and `zstd` options are left `undefined`, then tar\n * will attempt to infer the brotli compression status, but can only do so\n * based on the filename. If the filename ends in `.tbr` or `.tar.br`, and\n * the first 512 bytes are not a valid tar header, then brotli decompression\n * will be attempted.\n */\n brotli?: boolean | ZlibOptions\n\n /**\n * Set to `true` or an object with settings for `zstd.compress()` to\n * create a zstd-compressed archive\n *\n * When extracting, this will cause the archive to be treated as a\n * zstd-compressed file if set to `true` or a ZlibOptions object.\n *\n * If set `false`, then zstd options will not be used.\n *\n * If this, the `gzip`, and `brotli` options are left `undefined`, then tar\n * will attempt to infer the zstd compression status, but can only do so\n * based on the filename. If the filename ends in `.tzst` or `.tar.zst`, and\n * the first 512 bytes are not a valid tar header, then zstd decompression\n * will be attempted.\n */\n zstd?: boolean | ZlibOptions\n\n /**\n * A function that is called with `(path, stat)` when creating an archive, or\n * `(path, entry)` when extracting. Return true to process the file/entry, or\n * false to exclude it.\n */\n filter?: (path: string, entry: Stats | ReadEntry) => boolean\n\n /**\n * A function that gets called for any warning encountered.\n *\n * Note: if `strict` is set, then the warning will throw, and this method\n * will not be called.\n */\n onwarn?: (code: string, message: string, data: WarnData) => any\n\n //////////////////////////\n // extraction options\n\n /**\n * When extracting, unlink files before creating them. Without this option,\n * tar overwrites existing files, which preserves existing hardlinks. With\n * this option, existing hardlinks will be broken, as will any symlink that\n * would affect the location of an extracted file.\n */\n unlink?: boolean\n\n /**\n * When extracting, strip the specified number of path portions from the\n * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be\n * extracted to `{cwd}/c/d`.\n *\n * Any entry whose entire path is stripped will be excluded.\n */\n strip?: number\n\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n newer?: boolean\n\n /**\n * When extracting, do not overwrite existing files at all.\n */\n keep?: boolean\n\n /**\n * When extracting, set the `uid` and `gid` of extracted entries to the `uid`\n * and `gid` fields in the archive. Defaults to true when run as root, and\n * false otherwise.\n *\n * If false, then files and directories will be set with the owner and group\n * of the user running the process. This is similar to `-p` in `tar(1)`, but\n * ACLs and other system-specific data is never unpacked in this\n * implementation, and modes are set by default already.\n */\n preserveOwner?: boolean\n\n /**\n * The maximum depth of subfolders to extract into. This defaults to 1024.\n * Anything deeper than the limit will raise a warning and skip the entry.\n * Set to `Infinity` to remove the limitation.\n */\n maxDepth?: number\n\n /**\n * When extracting, force all created files and directories, and all\n * implicitly created directories, to be owned by the specified user id,\n * regardless of the `uid` field in the archive.\n *\n * Cannot be used along with `preserveOwner`. Requires also setting the `gid`\n * option.\n */\n uid?: number\n\n /**\n * When extracting, force all created files and directories, and all\n * implicitly created directories, to be owned by the specified group id,\n * regardless of the `gid` field in the archive.\n *\n * Cannot be used along with `preserveOwner`. Requires also setting the `uid`\n * option.\n */\n gid?: number\n\n /**\n * When extracting, provide a function that takes an `entry` object, and\n * returns a stream, or any falsey value. If a stream is provided, then that\n * stream's data will be written instead of the contents of the archive\n * entry. If a falsey value is provided, then the entry is written to disk as\n * normal.\n *\n * To exclude items from extraction, use the `filter` option.\n *\n * Note that using an asynchronous stream type with the `transform` option\n * will cause undefined behavior in synchronous extractions.\n * [MiniPass](http://npm.im/minipass)-based streams are designed for this use\n * case.\n */\n transform?: (entry: ReadEntry) => any\n\n /**\n * Call `chmod()` to ensure that extracted files match the entry's mode\n * field. Without this field set, all mode fields in archive entries are a\n * best effort attempt only.\n *\n * Setting this necessitates a call to the deprecated `process.umask()`\n * method to determine the default umask value, unless a `processUmask`\n * config is provided as well.\n *\n * If not set, tar will attempt to create file system entries with whatever\n * mode is provided, and let the implicit process `umask` apply normally, but\n * if a file already exists to be written to, then its existing mode will not\n * be modified.\n *\n * When setting `chmod: true`, it is highly recommend to set the\n * {@link TarOptions#processUmask} option as well, to avoid the call to the\n * deprecated (and thread-unsafe) `process.umask()` method.\n */\n chmod?: boolean\n\n /**\n * When setting the {@link TarOptions#chmod} option to `true`, you may\n * provide a value here to avoid having to call the deprecated and\n * thread-unsafe `process.umask()` method.\n *\n * This has no effect with `chmod` is not set to true, as mode values are not\n * set explicitly anyway. If `chmod` is set to `true`, and a value is not\n * provided here, then `process.umask()` must be called, which will result in\n * deprecation warnings.\n *\n * The most common values for this are `0o22` (resulting in directories\n * created with mode `0o755` and files with `0o644` by default) and `0o2`\n * (resulting in directores created with mode `0o775` and files `0o664`, so\n * they are group-writable).\n */\n processUmask?: number\n\n //////////////////////////\n // archive creation options\n\n /**\n * When parsing/listing archives, `entry` streams are by default resumed\n * (set into \"flowing\" mode) immediately after the call to `onReadEntry()`.\n * Set `noResume: true` to suppress this behavior.\n *\n * Note that when this is set, the stream will never complete until the\n * data is consumed somehow.\n *\n * Set automatically in extract operations, since the entry is piped to\n * a file system entry right away. Only relevant when parsing.\n */\n noResume?: boolean\n\n /**\n * When creating, updating, or replacing within archives, this method will\n * be called with each WriteEntry that is created.\n */\n onWriteEntry?: (entry: WriteEntry) => any\n\n /**\n * When extracting or listing archives, this method will be called with\n * each entry that is not excluded by a `filter`.\n *\n * Important when listing archives synchronously from a file, because there\n * is otherwise no way to interact with the data!\n */\n onReadEntry?: (entry: ReadEntry) => any\n\n /**\n * Pack the targets of symbolic links rather than the link itself.\n */\n follow?: boolean\n\n /**\n * When creating archives, omit any metadata that is system-specific:\n * `ctime`, `atime`, `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and\n * `nlink`. Note that `mtime` is still included, because this is necessary\n * for other time-based operations such as `tar.update`. Additionally, `mode`\n * is set to a \"reasonable default\" for mose unix systems, based on an\n * effective `umask` of `0o22`.\n *\n * This also defaults the `portable` option in the gzip configs when creating\n * a compressed archive, in order to produce deterministic archives that are\n * not operating-system specific.\n */\n portable?: boolean\n\n /**\n * When creating archives, do not recursively archive the contents of\n * directories. By default, archiving a directory archives all of its\n * contents as well.\n */\n noDirRecurse?: boolean\n\n /**\n * Suppress Pax extended headers when creating archives. Note that this means\n * long paths and linkpaths will be truncated, and large or negative numeric\n * values may be interpreted incorrectly.\n */\n noPax?: boolean\n\n /**\n * Set to a `Date` object to force a specific `mtime` value for everything\n * written to an archive.\n *\n * This is useful when creating archives that are intended to be\n * deterministic based on their contents, irrespective of the file's last\n * modification time.\n *\n * Overridden by `noMtime`.\n */\n mtime?: Date\n\n /**\n * A path portion to prefix onto the entries added to an archive.\n */\n prefix?: string\n\n /**\n * The mode to set on any created file archive, defaults to 0o666\n * masked by the process umask, often resulting in 0o644.\n *\n * This does *not* affect the mode fields of individual entries, or the\n * mode status of extracted entries on the filesystem.\n */\n mode?: number\n\n //////////////////////////\n // internal options\n\n /**\n * A cache of mtime values, to avoid having to stat the same file repeatedly.\n *\n * @internal\n */\n mtimeCache?: Map\n\n /**\n * maximum buffer size for `fs.read()` operations.\n *\n * @internal\n */\n maxReadSize?: number\n\n /**\n * Filter modes of entries being unpacked, like `process.umask()`\n *\n * @internal\n */\n umask?: number\n\n /**\n * Default mode for directories. Used for all implicitly created directories,\n * and any directories in the archive that do not have a mode field.\n *\n * @internal\n */\n dmode?: number\n\n /**\n * default mode for files\n *\n * @internal\n */\n fmode?: number\n\n /**\n * Map that tracks which directories already exist, for extraction\n *\n * @internal\n */\n dirCache?: Map\n /**\n * maximum supported size of meta entries. Defaults to 1MB\n *\n * @internal\n */\n maxMetaEntrySize?: number\n\n /**\n * A Map object containing the device and inode value for any file whose\n * `nlink` value is greater than 1, to identify hard links when creating\n * archives.\n *\n * @internal\n */\n linkCache?: Map\n\n /**\n * A map object containing the results of `fs.readdir()` calls.\n *\n * @internal\n */\n readdirCache?: Map\n\n /**\n * A cache of all `lstat` results, for use in creating archives.\n *\n * @internal\n */\n statCache?: Map\n\n /**\n * Number of concurrent jobs to run when creating archives.\n *\n * Defaults to 4.\n *\n * @internal\n */\n jobs?: number\n\n /**\n * Automatically set to true on Windows systems.\n *\n * When extracting, causes behavior where filenames containing `<|>?:`\n * characters are converted to windows-compatible escape sequences in the\n * created filesystem entries.\n *\n * When packing, causes behavior where paths replace `\\` with `/`, and\n * filenames containing the windows-compatible escaped forms of `<|>?:` are\n * converted to actual `<|>?:` characters in the archive.\n *\n * @internal\n */\n win32?: boolean\n\n /**\n * For `WriteEntry` objects, the absolute path to the entry on the\n * filesystem. By default, this is `resolve(cwd, entry.path)`, but it can be\n * overridden explicitly.\n *\n * @internal\n */\n absolute?: string\n\n /**\n * Used with Parser stream interface, to attach and take over when the\n * stream is completely parsed. If this is set, then the prefinish,\n * finish, and end events will not fire, and are the responsibility of\n * the ondone method to emit properly.\n *\n * @internal\n */\n ondone?: () => void\n\n /**\n * Mostly for testing, but potentially useful in some cases.\n * Forcibly trigger a chown on every entry, no matter what.\n */\n forceChown?: boolean\n\n /**\n * ambiguous deprecated name for {@link onReadEntry}\n *\n * @deprecated\n */\n onentry?: (entry: ReadEntry) => any\n}\n\nexport type TarOptionsSync = TarOptions & { sync: true }\nexport type TarOptionsAsync = TarOptions & { sync?: false }\nexport type TarOptionsFile = TarOptions & { file: string }\nexport type TarOptionsNoFile = TarOptions & { file?: undefined }\nexport type TarOptionsSyncFile = TarOptionsSync & TarOptionsFile\nexport type TarOptionsAsyncFile = TarOptionsAsync & TarOptionsFile\nexport type TarOptionsSyncNoFile = TarOptionsSync & TarOptionsNoFile\nexport type TarOptionsAsyncNoFile = TarOptionsAsync & TarOptionsNoFile\n\nexport type LinkCacheKey = `${number}:${number}`\n\nexport interface TarOptionsWithAliases extends TarOptions {\n /**\n * The effective current working directory for this tar command\n */\n C?: TarOptions['cwd']\n /**\n * The tar file to be read and/or written. When this is set, a stream\n * is not returned. Asynchronous commands will return a promise indicating\n * when the operation is completed, and synchronous commands will return\n * immediately.\n */\n f?: TarOptions['file']\n /**\n * When creating a tar archive, this can be used to compress it as well.\n * Set to `true` to use the default gzip options, or customize them as\n * needed.\n *\n * When reading, if this is unset, then the compression status will be\n * inferred from the archive data. This is generally best, unless you are\n * sure of the compression settings in use to create the archive, and want to\n * fail if the archive doesn't match expectations.\n */\n z?: TarOptions['gzip']\n /**\n * When creating archives, preserve absolute and `..` paths in the archive,\n * rather than sanitizing them under the cwd.\n *\n * When extracting, allow absolute paths, paths containing `..`, and\n * extracting through symbolic links. By default, the root `/` is stripped\n * from absolute paths (eg, turning `/x/y/z` into `x/y/z`), paths containing\n * `..` are not extracted, and any file whose location would be modified by a\n * symbolic link is not extracted.\n *\n * **WARNING** This is almost always unsafe, and must NEVER be used on\n * archives from untrusted sources, such as user input, and every entry must\n * be validated to ensure it is safe to write. Even if the input is not\n * malicious, mistakes can cause a lot of damage!\n */\n P?: TarOptions['preservePaths']\n /**\n * When extracting, unlink files before creating them. Without this option,\n * tar overwrites existing files, which preserves existing hardlinks. With\n * this option, existing hardlinks will be broken, as will any symlink that\n * would affect the location of an extracted file.\n */\n U?: TarOptions['unlink']\n /**\n * When extracting, strip the specified number of path portions from the\n * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be\n * extracted to `{cwd}/c/d`.\n */\n 'strip-components'?: TarOptions['strip']\n /**\n * When extracting, strip the specified number of path portions from the\n * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be\n * extracted to `{cwd}/c/d`.\n */\n stripComponents?: TarOptions['strip']\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n 'keep-newer'?: TarOptions['newer']\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n keepNewer?: TarOptions['newer']\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n 'keep-newer-files'?: TarOptions['newer']\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n keepNewerFiles?: TarOptions['newer']\n /**\n * When extracting, do not overwrite existing files at all.\n */\n k?: TarOptions['keep']\n /**\n * When extracting, do not overwrite existing files at all.\n */\n 'keep-existing'?: TarOptions['keep']\n /**\n * When extracting, do not overwrite existing files at all.\n */\n keepExisting?: TarOptions['keep']\n /**\n * When extracting, do not set the `mtime` value for extracted entries to\n * match the `mtime` in the archive.\n *\n * When creating archives, do not store the `mtime` value in the entry. Note\n * that this prevents properly using other mtime-based features (such as\n * `tar.update` or the `newer` option) with the resulting archive.\n */\n m?: TarOptions['noMtime']\n /**\n * When extracting, do not set the `mtime` value for extracted entries to\n * match the `mtime` in the archive.\n *\n * When creating archives, do not store the `mtime` value in the entry. Note\n * that this prevents properly using other mtime-based features (such as\n * `tar.update` or the `newer` option) with the resulting archive.\n */\n 'no-mtime'?: TarOptions['noMtime']\n /**\n * When extracting, set the `uid` and `gid` of extracted entries to the `uid`\n * and `gid` fields in the archive. Defaults to true when run as root, and\n * false otherwise.\n *\n * If false, then files and directories will be set with the owner and group\n * of the user running the process. This is similar to `-p` in `tar(1)`, but\n * ACLs and other system-specific data is never unpacked in this\n * implementation, and modes are set by default already.\n */\n p?: TarOptions['preserveOwner']\n /**\n * Pack the targets of symbolic links rather than the link itself.\n */\n L?: TarOptions['follow']\n /**\n * Pack the targets of symbolic links rather than the link itself.\n */\n h?: TarOptions['follow']\n\n /**\n * Deprecated option. Set explicitly false to set `chmod: true`. Ignored\n * if {@link TarOptions#chmod} is set to any boolean value.\n *\n * @deprecated\n */\n noChmod?: boolean\n}\n\nexport type TarOptionsWithAliasesSync = TarOptionsWithAliases & {\n sync: true\n}\nexport type TarOptionsWithAliasesAsync = TarOptionsWithAliases & {\n sync?: false\n}\nexport type TarOptionsWithAliasesFile =\n | (TarOptionsWithAliases & {\n file: string\n })\n | (TarOptionsWithAliases & { f: string })\nexport type TarOptionsWithAliasesSyncFile =\n TarOptionsWithAliasesSync & TarOptionsWithAliasesFile\nexport type TarOptionsWithAliasesAsyncFile =\n TarOptionsWithAliasesAsync & TarOptionsWithAliasesFile\n\nexport type TarOptionsWithAliasesNoFile = TarOptionsWithAliases & {\n f?: undefined\n file?: undefined\n}\n\nexport type TarOptionsWithAliasesSyncNoFile =\n TarOptionsWithAliasesSync & TarOptionsWithAliasesNoFile\nexport type TarOptionsWithAliasesAsyncNoFile =\n TarOptionsWithAliasesAsync & TarOptionsWithAliasesNoFile\n\nexport const isSyncFile = (\n o: O,\n): o is O & TarOptionsSyncFile => !!o.sync && !!o.file\nexport const isAsyncFile = (\n o: O,\n): o is O & TarOptionsAsyncFile => !o.sync && !!o.file\nexport const isSyncNoFile = (\n o: O,\n): o is O & TarOptionsSyncNoFile => !!o.sync && !o.file\nexport const isAsyncNoFile = (\n o: O,\n): o is O & TarOptionsAsyncNoFile => !o.sync && !o.file\nexport const isSync = (\n o: O,\n): o is O & TarOptionsSync => !!o.sync\nexport const isAsync = (\n o: O,\n): o is O & TarOptionsAsync => !o.sync\nexport const isFile = (\n o: O,\n): o is O & TarOptionsFile => !!o.file\nexport const isNoFile = (\n o: O,\n): o is O & TarOptionsNoFile => !o.file\n\nconst dealiasKey = (\n k: keyof TarOptionsWithAliases,\n): keyof TarOptions => {\n const d = argmap.get(k)\n if (d) return d\n return k as keyof TarOptions\n}\n\nexport const dealias = (\n opt: TarOptionsWithAliases = {},\n): TarOptions => {\n if (!opt) return {}\n const result: Record = {}\n for (const [key, v] of Object.entries(opt) as [\n keyof TarOptionsWithAliases,\n any,\n ][]) {\n // TS doesn't know that aliases are going to always be the same type\n const k = dealiasKey(key)\n result[k] = v\n }\n // affordance for deprecated noChmod -> chmod\n if (result.chmod === undefined && result.noChmod === false) {\n result.chmod = true\n }\n delete result.noChmod\n return result as TarOptions\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/pack.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/pack.d.ts new file mode 100644 index 0000000..14ce0c1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/pack.d.ts @@ -0,0 +1,101 @@ +import { type Stats } from 'fs'; +import { WriteEntry, WriteEntrySync, WriteEntryTar } from './write-entry.js'; +export declare class PackJob { + path: string; + absolute: string; + entry?: WriteEntry | WriteEntryTar; + stat?: Stats; + readdir?: string[]; + pending: boolean; + ignore: boolean; + piped: boolean; + constructor(path: string, absolute: string); +} +import { Minipass } from 'minipass'; +import * as zlib from 'minizlib'; +import { Yallist } from 'yallist'; +import { ReadEntry } from './read-entry.js'; +import { WarnEvent, type WarnData, type Warner } from './warn-method.js'; +declare const ONSTAT: unique symbol; +declare const ENDED: unique symbol; +declare const QUEUE: unique symbol; +declare const CURRENT: unique symbol; +declare const PROCESS: unique symbol; +declare const PROCESSING: unique symbol; +declare const PROCESSJOB: unique symbol; +declare const JOBS: unique symbol; +declare const JOBDONE: unique symbol; +declare const ADDFSENTRY: unique symbol; +declare const ADDTARENTRY: unique symbol; +declare const STAT: unique symbol; +declare const READDIR: unique symbol; +declare const ONREADDIR: unique symbol; +declare const PIPE: unique symbol; +declare const ENTRY: unique symbol; +declare const ENTRYOPT: unique symbol; +declare const WRITEENTRYCLASS: unique symbol; +declare const WRITE: unique symbol; +declare const ONDRAIN: unique symbol; +import { TarOptions } from './options.js'; +export declare class Pack extends Minipass> implements Warner { + sync: boolean; + opt: TarOptions; + cwd: string; + maxReadSize?: number; + preservePaths: boolean; + strict: boolean; + noPax: boolean; + prefix: string; + linkCache: Exclude; + statCache: Exclude; + file: string; + portable: boolean; + zip?: zlib.BrotliCompress | zlib.Gzip | zlib.ZstdCompress; + readdirCache: Exclude; + noDirRecurse: boolean; + follow: boolean; + noMtime: boolean; + mtime?: Date; + filter: Exclude; + jobs: number; + [WRITEENTRYCLASS]: typeof WriteEntry | typeof WriteEntrySync; + onWriteEntry?: (entry: WriteEntry) => void; + [QUEUE]: Yallist; + [JOBS]: number; + [PROCESSING]: boolean; + [ENDED]: boolean; + constructor(opt?: TarOptions); + [WRITE](chunk: Buffer): boolean; + add(path: string | ReadEntry): this; + end(cb?: () => void): this; + end(path: string | ReadEntry, cb?: () => void): this; + end(path: string | ReadEntry, encoding?: Minipass.Encoding, cb?: () => void): this; + write(path: string | ReadEntry): boolean; + [ADDTARENTRY](p: ReadEntry): void; + [ADDFSENTRY](p: string): void; + [STAT](job: PackJob): void; + [ONSTAT](job: PackJob, stat: Stats): void; + [READDIR](job: PackJob): void; + [ONREADDIR](job: PackJob, entries: string[]): void; + [PROCESS](): void; + get [CURRENT](): PackJob | undefined; + [JOBDONE](_job: PackJob): void; + [PROCESSJOB](job: PackJob): void; + [ENTRYOPT](job: PackJob): TarOptions; + [ENTRY](job: PackJob): WriteEntry | undefined; + [ONDRAIN](): void; + [PIPE](job: PackJob): void; + pause(): void; + warn(code: string, message: string | Error, data?: WarnData): void; +} +export declare class PackSync extends Pack { + sync: true; + constructor(opt: TarOptions); + pause(): void; + resume(): void; + [STAT](job: PackJob): void; + [READDIR](job: PackJob): void; + [PIPE](job: PackJob): void; +} +export {}; +//# sourceMappingURL=pack.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/pack.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/pack.d.ts.map new file mode 100644 index 0000000..05086e5 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/pack.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../../src/pack.ts"],"names":[],"mappings":"AASA,OAAW,EAAE,KAAK,KAAK,EAAE,MAAM,IAAI,CAAA;AACnC,OAAO,EACL,UAAU,EACV,cAAc,EACd,aAAa,EACd,MAAM,kBAAkB,CAAA;AAEzB,qBAAa,OAAO;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,UAAU,GAAG,aAAa,CAAA;IAClC,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,EAAE,OAAO,CAAQ;IACxB,MAAM,EAAE,OAAO,CAAQ;IACvB,KAAK,EAAE,OAAO,CAAQ;gBACV,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAI3C;AAED,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EACL,SAAS,EAET,KAAK,QAAQ,EACb,KAAK,MAAM,EACZ,MAAM,kBAAkB,CAAA;AAGzB,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,M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AAC,IAAI,CAAC,CAAC,GAAG,EAAE,OAAO;IAenB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK;IAwBlC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,OAAO;IAatB,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE;IAM3C,CAAC,OAAO,CAAC;IA+BT,IAAI,CAAC,OAAO,CAAC,wBAEZ;IAED,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,OAAO;IAMvB,CAAC,UAAU,CAAC,CAAC,GAAG,EAAE,OAAO;IAyDzB,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU;IAmBpC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,OAAO;IAepB,CAAC,OAAO,CAAC;IAOT,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,OAAO;IAgCnB,KAAK;IAML,IAAI,CACF,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,KAAK,EACvB,IAAI,GAAE,QAAa,GAClB,IAAI;CAGR;AAED,qBAAa,QAAS,SAAQ,IAAI;IAChC,IAAI,EAAE,IAAI,CAAO;gBACL,GAAG,EAAE,UAAU;IAM3B,KAAK;IACL,MAAM;IAEN,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,OAAO;IAKnB,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,OAAO;IAKtB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,OAAO;CA0BpB"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/pack.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/pack.js new file mode 100644 index 0000000..67de827 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/pack.js @@ -0,0 +1,516 @@ +"use strict"; +// A readable tar stream creator +// Technically, this is a transform stream that you write paths into, +// and tar format comes out of. +// The `add()` method is like `write()` but returns this, +// and end() return `this` as well, so you can +// do `new Pack(opt).add('files').add('dir').end().pipe(output) +// You could also do something like: +// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar')) +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PackSync = exports.Pack = exports.PackJob = void 0; +const fs_1 = __importDefault(require("fs")); +const write_entry_js_1 = require("./write-entry.js"); +class PackJob { + path; + absolute; + entry; + stat; + readdir; + pending = false; + ignore = false; + piped = false; + constructor(path, absolute) { + this.path = path || './'; + this.absolute = absolute; + } +} +exports.PackJob = PackJob; +const minipass_1 = require("minipass"); +const zlib = __importStar(require("minizlib")); +const yallist_1 = require("yallist"); +const read_entry_js_1 = require("./read-entry.js"); +const warn_method_js_1 = require("./warn-method.js"); +const EOF = Buffer.alloc(1024); +const ONSTAT = Symbol('onStat'); +const ENDED = Symbol('ended'); +const QUEUE = Symbol('queue'); +const CURRENT = Symbol('current'); +const PROCESS = Symbol('process'); +const PROCESSING = Symbol('processing'); +const PROCESSJOB = Symbol('processJob'); +const JOBS = Symbol('jobs'); +const JOBDONE = Symbol('jobDone'); +const ADDFSENTRY = Symbol('addFSEntry'); +const ADDTARENTRY = Symbol('addTarEntry'); +const STAT = Symbol('stat'); +const READDIR = Symbol('readdir'); +const ONREADDIR = Symbol('onreaddir'); +const PIPE = Symbol('pipe'); +const ENTRY = Symbol('entry'); +const ENTRYOPT = Symbol('entryOpt'); +const WRITEENTRYCLASS = Symbol('writeEntryClass'); +const WRITE = Symbol('write'); +const ONDRAIN = Symbol('ondrain'); +const path_1 = __importDefault(require("path")); +const normalize_windows_path_js_1 = require("./normalize-windows-path.js"); +class Pack extends minipass_1.Minipass { + sync = false; + opt; + cwd; + maxReadSize; + preservePaths; + strict; + noPax; + prefix; + linkCache; + statCache; + file; + portable; + zip; + readdirCache; + noDirRecurse; + follow; + noMtime; + mtime; + filter; + jobs; + [WRITEENTRYCLASS]; + onWriteEntry; + // Note: we actually DO need a linked list here, because we + // shift() to update the head of the list where we start, but still + // while that happens, need to know what the next item in the queue + // will be. Since we do multiple jobs in parallel, it's not as simple + // as just an Array.shift(), since that would lose the information about + // the next job in the list. We could add a .next field on the PackJob + // class, but then we'd have to be tracking the tail of the queue the + // whole time, and Yallist just does that for us anyway. + [QUEUE]; + [JOBS] = 0; + [PROCESSING] = false; + [ENDED] = false; + constructor(opt = {}) { + //@ts-ignore + super(); + this.opt = opt; + this.file = opt.file || ''; + this.cwd = opt.cwd || process.cwd(); + this.maxReadSize = opt.maxReadSize; + this.preservePaths = !!opt.preservePaths; + this.strict = !!opt.strict; + this.noPax = !!opt.noPax; + this.prefix = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.prefix || ''); + this.linkCache = opt.linkCache || new Map(); + this.statCache = opt.statCache || new Map(); + this.readdirCache = opt.readdirCache || new Map(); + this.onWriteEntry = opt.onWriteEntry; + this[WRITEENTRYCLASS] = write_entry_js_1.WriteEntry; + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn); + } + this.portable = !!opt.portable; + if (opt.gzip || opt.brotli || opt.zstd) { + if ((opt.gzip ? 1 : 0) + + (opt.brotli ? 1 : 0) + + (opt.zstd ? 1 : 0) > + 1) { + throw new TypeError('gzip, brotli, zstd are mutually exclusive'); + } + if (opt.gzip) { + if (typeof opt.gzip !== 'object') { + opt.gzip = {}; + } + if (this.portable) { + opt.gzip.portable = true; + } + this.zip = new zlib.Gzip(opt.gzip); + } + if (opt.brotli) { + if (typeof opt.brotli !== 'object') { + opt.brotli = {}; + } + this.zip = new zlib.BrotliCompress(opt.brotli); + } + if (opt.zstd) { + if (typeof opt.zstd !== 'object') { + opt.zstd = {}; + } + this.zip = new zlib.ZstdCompress(opt.zstd); + } + /* c8 ignore next */ + if (!this.zip) + throw new Error('impossible'); + const zip = this.zip; + zip.on('data', chunk => super.write(chunk)); + zip.on('end', () => super.end()); + zip.on('drain', () => this[ONDRAIN]()); + this.on('resume', () => zip.resume()); + } + else { + this.on('drain', this[ONDRAIN]); + } + this.noDirRecurse = !!opt.noDirRecurse; + this.follow = !!opt.follow; + this.noMtime = !!opt.noMtime; + if (opt.mtime) + this.mtime = opt.mtime; + this.filter = + typeof opt.filter === 'function' ? opt.filter : () => true; + this[QUEUE] = new yallist_1.Yallist(); + this[JOBS] = 0; + this.jobs = Number(opt.jobs) || 4; + this[PROCESSING] = false; + this[ENDED] = false; + } + [WRITE](chunk) { + return super.write(chunk); + } + add(path) { + this.write(path); + return this; + } + end(path, encoding, cb) { + /* c8 ignore start */ + if (typeof path === 'function') { + cb = path; + path = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + /* c8 ignore stop */ + if (path) { + this.add(path); + } + this[ENDED] = true; + this[PROCESS](); + /* c8 ignore next */ + if (cb) + cb(); + return this; + } + write(path) { + if (this[ENDED]) { + throw new Error('write after end'); + } + if (path instanceof read_entry_js_1.ReadEntry) { + this[ADDTARENTRY](path); + } + else { + this[ADDFSENTRY](path); + } + return this.flowing; + } + [ADDTARENTRY](p) { + const absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path_1.default.resolve(this.cwd, p.path)); + // in this case, we don't have to wait for the stat + if (!this.filter(p.path, p)) { + p.resume(); + } + else { + const job = new PackJob(p.path, absolute); + job.entry = new write_entry_js_1.WriteEntryTar(p, this[ENTRYOPT](job)); + job.entry.on('end', () => this[JOBDONE](job)); + this[JOBS] += 1; + this[QUEUE].push(job); + } + this[PROCESS](); + } + [ADDFSENTRY](p) { + const absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path_1.default.resolve(this.cwd, p)); + this[QUEUE].push(new PackJob(p, absolute)); + this[PROCESS](); + } + [STAT](job) { + job.pending = true; + this[JOBS] += 1; + const stat = this.follow ? 'stat' : 'lstat'; + fs_1.default[stat](job.absolute, (er, stat) => { + job.pending = false; + this[JOBS] -= 1; + if (er) { + this.emit('error', er); + } + else { + this[ONSTAT](job, stat); + } + }); + } + [ONSTAT](job, stat) { + this.statCache.set(job.absolute, stat); + job.stat = stat; + // now we have the stat, we can filter it. + if (!this.filter(job.path, stat)) { + job.ignore = true; + } + else if (stat.isFile() && + stat.nlink > 1 && + job === this[CURRENT] && + !this.linkCache.get(`${stat.dev}:${stat.ino}`) && + !this.sync) { + // if it's not filtered, and it's a new File entry, + // jump the queue in case any pending Link entries are about + // to try to link to it. This prevents a hardlink from coming ahead + // of its target in the archive. + this[PROCESSJOB](job); + } + this[PROCESS](); + } + [READDIR](job) { + job.pending = true; + this[JOBS] += 1; + fs_1.default.readdir(job.absolute, (er, entries) => { + job.pending = false; + this[JOBS] -= 1; + if (er) { + return this.emit('error', er); + } + this[ONREADDIR](job, entries); + }); + } + [ONREADDIR](job, entries) { + this.readdirCache.set(job.absolute, entries); + job.readdir = entries; + this[PROCESS](); + } + [PROCESS]() { + if (this[PROCESSING]) { + return; + } + this[PROCESSING] = true; + for (let w = this[QUEUE].head; !!w && this[JOBS] < this.jobs; w = w.next) { + this[PROCESSJOB](w.value); + if (w.value.ignore) { + const p = w.next; + this[QUEUE].removeNode(w); + w.next = p; + } + } + this[PROCESSING] = false; + if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) { + if (this.zip) { + this.zip.end(EOF); + } + else { + super.write(EOF); + super.end(); + } + } + } + get [CURRENT]() { + return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value; + } + [JOBDONE](_job) { + this[QUEUE].shift(); + this[JOBS] -= 1; + this[PROCESS](); + } + [PROCESSJOB](job) { + if (job.pending) { + return; + } + if (job.entry) { + if (job === this[CURRENT] && !job.piped) { + this[PIPE](job); + } + return; + } + if (!job.stat) { + const sc = this.statCache.get(job.absolute); + if (sc) { + this[ONSTAT](job, sc); + } + else { + this[STAT](job); + } + } + if (!job.stat) { + return; + } + // filtered out! + if (job.ignore) { + return; + } + if (!this.noDirRecurse && + job.stat.isDirectory() && + !job.readdir) { + const rc = this.readdirCache.get(job.absolute); + if (rc) { + this[ONREADDIR](job, rc); + } + else { + this[READDIR](job); + } + if (!job.readdir) { + return; + } + } + // we know it doesn't have an entry, because that got checked above + job.entry = this[ENTRY](job); + if (!job.entry) { + job.ignore = true; + return; + } + if (job === this[CURRENT] && !job.piped) { + this[PIPE](job); + } + } + [ENTRYOPT](job) { + return { + onwarn: (code, msg, data) => this.warn(code, msg, data), + noPax: this.noPax, + cwd: this.cwd, + absolute: job.absolute, + preservePaths: this.preservePaths, + maxReadSize: this.maxReadSize, + strict: this.strict, + portable: this.portable, + linkCache: this.linkCache, + statCache: this.statCache, + noMtime: this.noMtime, + mtime: this.mtime, + prefix: this.prefix, + onWriteEntry: this.onWriteEntry, + }; + } + [ENTRY](job) { + this[JOBS] += 1; + try { + const e = new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job)); + return e + .on('end', () => this[JOBDONE](job)) + .on('error', er => this.emit('error', er)); + } + catch (er) { + this.emit('error', er); + } + } + [ONDRAIN]() { + if (this[CURRENT] && this[CURRENT].entry) { + this[CURRENT].entry.resume(); + } + } + // like .pipe() but using super, because our write() is special + [PIPE](job) { + job.piped = true; + if (job.readdir) { + job.readdir.forEach(entry => { + const p = job.path; + const base = p === './' ? '' : p.replace(/\/*$/, '/'); + this[ADDFSENTRY](base + entry); + }); + } + const source = job.entry; + const zip = this.zip; + /* c8 ignore start */ + if (!source) + throw new Error('cannot pipe without source'); + /* c8 ignore stop */ + if (zip) { + source.on('data', chunk => { + if (!zip.write(chunk)) { + source.pause(); + } + }); + } + else { + source.on('data', chunk => { + if (!super.write(chunk)) { + source.pause(); + } + }); + } + } + pause() { + if (this.zip) { + this.zip.pause(); + } + return super.pause(); + } + warn(code, message, data = {}) { + (0, warn_method_js_1.warnMethod)(this, code, message, data); + } +} +exports.Pack = Pack; +class PackSync extends Pack { + sync = true; + constructor(opt) { + super(opt); + this[WRITEENTRYCLASS] = write_entry_js_1.WriteEntrySync; + } + // pause/resume are no-ops in sync streams. + pause() { } + resume() { } + [STAT](job) { + const stat = this.follow ? 'statSync' : 'lstatSync'; + this[ONSTAT](job, fs_1.default[stat](job.absolute)); + } + [READDIR](job) { + this[ONREADDIR](job, fs_1.default.readdirSync(job.absolute)); + } + // gotta get it all in this tick + [PIPE](job) { + const source = job.entry; + const zip = this.zip; + if (job.readdir) { + job.readdir.forEach(entry => { + const p = job.path; + const base = p === './' ? '' : p.replace(/\/*$/, '/'); + this[ADDFSENTRY](base + entry); + }); + } + /* c8 ignore start */ + if (!source) + throw new Error('Cannot pipe without source'); + /* c8 ignore stop */ + if (zip) { + source.on('data', chunk => { + zip.write(chunk); + }); + } + else { + source.on('data', chunk => { + super[WRITE](chunk); + }); + } + } +} +exports.PackSync = PackSync; +//# sourceMappingURL=pack.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/pack.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/pack.js.map new file mode 100644 index 0000000..38ef898 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/pack.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pack.js","sourceRoot":"","sources":["../../src/pack.ts"],"names":[],"mappings":";AAAA,gCAAgC;AAChC,qEAAqE;AACrE,+BAA+B;AAC/B,yDAAyD;AACzD,8CAA8C;AAC9C,+DAA+D;AAC/D,oCAAoC;AACpC,uEAAuE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEvE,4CAAmC;AACnC,qDAIyB;AAEzB,MAAa,OAAO;IAClB,IAAI,CAAQ;IACZ,QAAQ,CAAQ;IAChB,KAAK,CAA6B;IAClC,IAAI,CAAQ;IACZ,OAAO,CAAW;IAClB,OAAO,GAAY,KAAK,CAAA;IACxB,MAAM,GAAY,KAAK,CAAA;IACvB,KAAK,GAAY,KAAK,CAAA;IACtB,YAAY,IAAY,EAAE,QAAgB;QACxC,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;CACF;AAbD,0BAaC;AAED,uCAAmC;AACnC,+CAAgC;AAChC,qCAAiC;AACjC,mDAA2C;AAC3C,qDAKyB;AAEzB,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;AACjC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;AACjC,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AACvC,MAAM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AoB;QAEpB,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE;gBACxB,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YAClB,CAAC,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE;gBACxB,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAA;YACrB,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF;AA/CD,4BA+CC","sourcesContent":["// A readable tar stream creator\n// Technically, this is a transform stream that you write paths into,\n// and tar format comes out of.\n// The `add()` method is like `write()` but returns this,\n// and end() return `this` as well, so you can\n// do `new Pack(opt).add('files').add('dir').end().pipe(output)\n// You could also do something like:\n// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar'))\n\nimport fs, { type Stats } from 'fs'\nimport {\n WriteEntry,\n WriteEntrySync,\n WriteEntryTar,\n} from './write-entry.js'\n\nexport class PackJob {\n path: string\n absolute: string\n entry?: WriteEntry | WriteEntryTar\n stat?: Stats\n readdir?: string[]\n pending: boolean = false\n ignore: boolean = false\n piped: boolean = false\n constructor(path: string, absolute: string) {\n this.path = path || './'\n this.absolute = absolute\n }\n}\n\nimport { Minipass } from 'minipass'\nimport * as zlib from 'minizlib'\nimport { Yallist } from 'yallist'\nimport { ReadEntry } from './read-entry.js'\nimport {\n WarnEvent,\n warnMethod,\n type WarnData,\n type Warner,\n} from './warn-method.js'\n\nconst EOF = Buffer.alloc(1024)\nconst ONSTAT = Symbol('onStat')\nconst ENDED = Symbol('ended')\nconst QUEUE = Symbol('queue')\nconst CURRENT = Symbol('current')\nconst PROCESS = Symbol('process')\nconst PROCESSING = Symbol('processing')\nconst PROCESSJOB = Symbol('processJob')\nconst JOBS = Symbol('jobs')\nconst JOBDONE = Symbol('jobDone')\nconst ADDFSENTRY = Symbol('addFSEntry')\nconst ADDTARENTRY = Symbol('addTarEntry')\nconst STAT = Symbol('stat')\nconst READDIR = Symbol('readdir')\nconst ONREADDIR = Symbol('onreaddir')\nconst PIPE = Symbol('pipe')\nconst ENTRY = Symbol('entry')\nconst ENTRYOPT = Symbol('entryOpt')\nconst WRITEENTRYCLASS = Symbol('writeEntryClass')\nconst WRITE = Symbol('write')\nconst ONDRAIN = Symbol('ondrain')\n\nimport path from 'path'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport { TarOptions } from './options.js'\n\nexport class Pack\n extends Minipass>\n implements Warner\n{\n sync: boolean = false\n opt: TarOptions\n cwd: string\n maxReadSize?: number\n preservePaths: boolean\n strict: boolean\n noPax: boolean\n prefix: string\n linkCache: Exclude\n statCache: Exclude\n file: string\n portable: boolean\n zip?: zlib.BrotliCompress | zlib.Gzip | zlib.ZstdCompress\n readdirCache: Exclude\n noDirRecurse: boolean\n follow: boolean\n noMtime: boolean\n mtime?: Date\n filter: Exclude\n jobs: number;\n\n [WRITEENTRYCLASS]: typeof WriteEntry | typeof WriteEntrySync\n onWriteEntry?: (entry: WriteEntry) => void;\n // Note: we actually DO need a linked list here, because we\n // shift() to update the head of the list where we start, but still\n // while that happens, need to know what the next item in the queue\n // will be. Since we do multiple jobs in parallel, it's not as simple\n // as just an Array.shift(), since that would lose the information about\n // the next job in the list. We could add a .next field on the PackJob\n // class, but then we'd have to be tracking the tail of the queue the\n // whole time, and Yallist just does that for us anyway.\n [QUEUE]: Yallist;\n [JOBS]: number = 0;\n [PROCESSING]: boolean = false;\n [ENDED]: boolean = false\n\n constructor(opt: TarOptions = {}) {\n //@ts-ignore\n super()\n this.opt = opt\n this.file = opt.file || ''\n this.cwd = opt.cwd || process.cwd()\n this.maxReadSize = opt.maxReadSize\n this.preservePaths = !!opt.preservePaths\n this.strict = !!opt.strict\n this.noPax = !!opt.noPax\n this.prefix = normalizeWindowsPath(opt.prefix || '')\n this.linkCache = opt.linkCache || new Map()\n this.statCache = opt.statCache || new Map()\n this.readdirCache = opt.readdirCache || new Map()\n this.onWriteEntry = opt.onWriteEntry\n\n this[WRITEENTRYCLASS] = WriteEntry\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n\n this.portable = !!opt.portable\n\n if (opt.gzip || opt.brotli || opt.zstd) {\n if (\n (opt.gzip ? 1 : 0) +\n (opt.brotli ? 1 : 0) +\n (opt.zstd ? 1 : 0) >\n 1\n ) {\n throw new TypeError(\n 'gzip, brotli, zstd are mutually exclusive',\n )\n }\n if (opt.gzip) {\n if (typeof opt.gzip !== 'object') {\n opt.gzip = {}\n }\n if (this.portable) {\n opt.gzip.portable = true\n }\n this.zip = new zlib.Gzip(opt.gzip)\n }\n if (opt.brotli) {\n if (typeof opt.brotli !== 'object') {\n opt.brotli = {}\n }\n this.zip = new zlib.BrotliCompress(opt.brotli)\n }\n if (opt.zstd) {\n if (typeof opt.zstd !== 'object') {\n opt.zstd = {}\n }\n this.zip = new zlib.ZstdCompress(opt.zstd)\n }\n /* c8 ignore next */\n if (!this.zip) throw new Error('impossible')\n const zip = this.zip\n zip.on('data', chunk => super.write(chunk as unknown as string))\n zip.on('end', () => super.end())\n zip.on('drain', () => this[ONDRAIN]())\n this.on('resume', () => zip.resume())\n } else {\n this.on('drain', this[ONDRAIN])\n }\n\n this.noDirRecurse = !!opt.noDirRecurse\n this.follow = !!opt.follow\n this.noMtime = !!opt.noMtime\n if (opt.mtime) this.mtime = opt.mtime\n\n this.filter =\n typeof opt.filter === 'function' ? opt.filter : () => true\n\n this[QUEUE] = new Yallist()\n this[JOBS] = 0\n this.jobs = Number(opt.jobs) || 4\n this[PROCESSING] = false\n this[ENDED] = false\n }\n\n [WRITE](chunk: Buffer) {\n return super.write(chunk as unknown as string)\n }\n\n add(path: string | ReadEntry) {\n this.write(path)\n return this\n }\n\n end(cb?: () => void): this\n end(path: string | ReadEntry, cb?: () => void): this\n end(\n path: string | ReadEntry,\n encoding?: Minipass.Encoding,\n cb?: () => void,\n ): this\n end(\n path?: string | ReadEntry | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void,\n ) {\n /* c8 ignore start */\n if (typeof path === 'function') {\n cb = path\n path = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n /* c8 ignore stop */\n if (path) {\n this.add(path)\n }\n this[ENDED] = true\n this[PROCESS]()\n /* c8 ignore next */\n if (cb) cb()\n return this\n }\n\n write(path: string | ReadEntry) {\n if (this[ENDED]) {\n throw new Error('write after end')\n }\n\n if (path instanceof ReadEntry) {\n this[ADDTARENTRY](path)\n } else {\n this[ADDFSENTRY](path)\n }\n return this.flowing\n }\n\n [ADDTARENTRY](p: ReadEntry) {\n const absolute = normalizeWindowsPath(\n path.resolve(this.cwd, p.path),\n )\n // in this case, we don't have to wait for the stat\n if (!this.filter(p.path, p)) {\n p.resume()\n } else {\n const job = new PackJob(p.path, absolute)\n job.entry = new WriteEntryTar(p, this[ENTRYOPT](job))\n job.entry.on('end', () => this[JOBDONE](job))\n this[JOBS] += 1\n this[QUEUE].push(job)\n }\n\n this[PROCESS]()\n }\n\n [ADDFSENTRY](p: string) {\n const absolute = normalizeWindowsPath(path.resolve(this.cwd, p))\n this[QUEUE].push(new PackJob(p, absolute))\n this[PROCESS]()\n }\n\n [STAT](job: PackJob) {\n job.pending = true\n this[JOBS] += 1\n const stat = this.follow ? 'stat' : 'lstat'\n fs[stat](job.absolute, (er, stat) => {\n job.pending = false\n this[JOBS] -= 1\n if (er) {\n this.emit('error', er)\n } else {\n this[ONSTAT](job, stat)\n }\n })\n }\n\n [ONSTAT](job: PackJob, stat: Stats) {\n this.statCache.set(job.absolute, stat)\n job.stat = stat\n\n // now we have the stat, we can filter it.\n if (!this.filter(job.path, stat)) {\n job.ignore = true\n } else if (\n stat.isFile() &&\n stat.nlink > 1 &&\n job === this[CURRENT] &&\n !this.linkCache.get(`${stat.dev}:${stat.ino}`) &&\n !this.sync\n ) {\n // if it's not filtered, and it's a new File entry,\n // jump the queue in case any pending Link entries are about\n // to try to link to it. This prevents a hardlink from coming ahead\n // of its target in the archive.\n this[PROCESSJOB](job)\n }\n\n this[PROCESS]()\n }\n\n [READDIR](job: PackJob) {\n job.pending = true\n this[JOBS] += 1\n fs.readdir(job.absolute, (er, entries) => {\n job.pending = false\n this[JOBS] -= 1\n if (er) {\n return this.emit('error', er)\n }\n this[ONREADDIR](job, entries)\n })\n }\n\n [ONREADDIR](job: PackJob, entries: string[]) {\n this.readdirCache.set(job.absolute, entries)\n job.readdir = entries\n this[PROCESS]()\n }\n\n [PROCESS]() {\n if (this[PROCESSING]) {\n return\n }\n\n this[PROCESSING] = true\n for (\n let w = this[QUEUE].head;\n !!w && this[JOBS] < this.jobs;\n w = w.next\n ) {\n this[PROCESSJOB](w.value)\n if (w.value.ignore) {\n const p = w.next\n this[QUEUE].removeNode(w)\n w.next = p\n }\n }\n\n this[PROCESSING] = false\n\n if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) {\n if (this.zip) {\n this.zip.end(EOF)\n } else {\n super.write(EOF as unknown as string)\n super.end()\n }\n }\n }\n\n get [CURRENT]() {\n return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value\n }\n\n [JOBDONE](_job: PackJob) {\n this[QUEUE].shift()\n this[JOBS] -= 1\n this[PROCESS]()\n }\n\n [PROCESSJOB](job: PackJob) {\n if (job.pending) {\n return\n }\n\n if (job.entry) {\n if (job === this[CURRENT] && !job.piped) {\n this[PIPE](job)\n }\n return\n }\n\n if (!job.stat) {\n const sc = this.statCache.get(job.absolute)\n if (sc) {\n this[ONSTAT](job, sc)\n } else {\n this[STAT](job)\n }\n }\n if (!job.stat) {\n return\n }\n\n // filtered out!\n if (job.ignore) {\n return\n }\n\n if (\n !this.noDirRecurse &&\n job.stat.isDirectory() &&\n !job.readdir\n ) {\n const rc = this.readdirCache.get(job.absolute)\n if (rc) {\n this[ONREADDIR](job, rc)\n } else {\n this[READDIR](job)\n }\n if (!job.readdir) {\n return\n }\n }\n\n // we know it doesn't have an entry, because that got checked above\n job.entry = this[ENTRY](job)\n if (!job.entry) {\n job.ignore = true\n return\n }\n\n if (job === this[CURRENT] && !job.piped) {\n this[PIPE](job)\n }\n }\n\n [ENTRYOPT](job: PackJob): TarOptions {\n return {\n onwarn: (code, msg, data) => this.warn(code, msg, data),\n noPax: this.noPax,\n cwd: this.cwd,\n absolute: job.absolute,\n preservePaths: this.preservePaths,\n maxReadSize: this.maxReadSize,\n strict: this.strict,\n portable: this.portable,\n linkCache: this.linkCache,\n statCache: this.statCache,\n noMtime: this.noMtime,\n mtime: this.mtime,\n prefix: this.prefix,\n onWriteEntry: this.onWriteEntry,\n }\n }\n\n [ENTRY](job: PackJob) {\n this[JOBS] += 1\n try {\n const e = new this[WRITEENTRYCLASS](\n job.path,\n this[ENTRYOPT](job),\n )\n return e\n .on('end', () => this[JOBDONE](job))\n .on('error', er => this.emit('error', er))\n } catch (er) {\n this.emit('error', er)\n }\n }\n\n [ONDRAIN]() {\n if (this[CURRENT] && this[CURRENT].entry) {\n this[CURRENT].entry.resume()\n }\n }\n\n // like .pipe() but using super, because our write() is special\n [PIPE](job: PackJob) {\n job.piped = true\n\n if (job.readdir) {\n job.readdir.forEach(entry => {\n const p = job.path\n const base = p === './' ? '' : p.replace(/\\/*$/, '/')\n this[ADDFSENTRY](base + entry)\n })\n }\n\n const source = job.entry\n const zip = this.zip\n /* c8 ignore start */\n if (!source) throw new Error('cannot pipe without source')\n /* c8 ignore stop */\n\n if (zip) {\n source.on('data', chunk => {\n if (!zip.write(chunk)) {\n source.pause()\n }\n })\n } else {\n source.on('data', chunk => {\n if (!super.write(chunk as unknown as string)) {\n source.pause()\n }\n })\n }\n }\n\n pause() {\n if (this.zip) {\n this.zip.pause()\n }\n return super.pause()\n }\n warn(\n code: string,\n message: string | Error,\n data: WarnData = {},\n ): void {\n warnMethod(this, code, message, data)\n }\n}\n\nexport class PackSync extends Pack {\n sync: true = true\n constructor(opt: TarOptions) {\n super(opt)\n this[WRITEENTRYCLASS] = WriteEntrySync\n }\n\n // pause/resume are no-ops in sync streams.\n pause() {}\n resume() {}\n\n [STAT](job: PackJob) {\n const stat = this.follow ? 'statSync' : 'lstatSync'\n this[ONSTAT](job, fs[stat](job.absolute))\n }\n\n [READDIR](job: PackJob) {\n this[ONREADDIR](job, fs.readdirSync(job.absolute))\n }\n\n // gotta get it all in this tick\n [PIPE](job: PackJob) {\n const source = job.entry\n const zip = this.zip\n\n if (job.readdir) {\n job.readdir.forEach(entry => {\n const p = job.path\n const base = p === './' ? '' : p.replace(/\\/*$/, '/')\n this[ADDFSENTRY](base + entry)\n })\n }\n\n /* c8 ignore start */\n if (!source) throw new Error('Cannot pipe without source')\n /* c8 ignore stop */\n\n if (zip) {\n source.on('data', chunk => {\n zip.write(chunk)\n })\n } else {\n source.on('data', chunk => {\n super[WRITE](chunk)\n })\n }\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/package.json b/node_modules/cmake-js/node_modules/tar/dist/commonjs/package.json new file mode 100644 index 0000000..5bbefff --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/parse.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/parse.d.ts new file mode 100644 index 0000000..6aba1f6 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/parse.d.ts @@ -0,0 +1,85 @@ +import { EventEmitter as EE } from 'events'; +import { BrotliDecompress, Unzip, ZstdDecompress } from 'minizlib'; +import { TarOptions } from './options.js'; +import { Pax } from './pax.js'; +import { ReadEntry } from './read-entry.js'; +import { type WarnData, type Warner } from './warn-method.js'; +declare const STATE: unique symbol; +declare const WRITEENTRY: unique symbol; +declare const READENTRY: unique symbol; +declare const NEXTENTRY: unique symbol; +declare const PROCESSENTRY: unique symbol; +declare const EX: unique symbol; +declare const GEX: unique symbol; +declare const META: unique symbol; +declare const EMITMETA: unique symbol; +declare const BUFFER: unique symbol; +declare const QUEUE: unique symbol; +declare const ENDED: unique symbol; +declare const EMITTEDEND: unique symbol; +declare const EMIT: unique symbol; +declare const UNZIP: unique symbol; +declare const CONSUMECHUNK: unique symbol; +declare const CONSUMECHUNKSUB: unique symbol; +declare const CONSUMEBODY: unique symbol; +declare const CONSUMEMETA: unique symbol; +declare const CONSUMEHEADER: unique symbol; +declare const CONSUMING: unique symbol; +declare const BUFFERCONCAT: unique symbol; +declare const MAYBEEND: unique symbol; +declare const WRITING: unique symbol; +declare const ABORTED: unique symbol; +declare const SAW_VALID_ENTRY: unique symbol; +declare const SAW_NULL_BLOCK: unique symbol; +declare const SAW_EOF: unique symbol; +declare const CLOSESTREAM: unique symbol; +export type State = 'begin' | 'header' | 'ignore' | 'meta' | 'body'; +export declare class Parser extends EE implements Warner { + file: string; + strict: boolean; + maxMetaEntrySize: number; + filter: Exclude; + brotli?: TarOptions['brotli']; + zstd?: TarOptions['zstd']; + writable: true; + readable: false; + [QUEUE]: (ReadEntry | [string | symbol, any, any])[]; + [BUFFER]?: Buffer; + [READENTRY]?: ReadEntry; + [WRITEENTRY]?: ReadEntry; + [STATE]: State; + [META]: string; + [EX]?: Pax; + [GEX]?: Pax; + [ENDED]: boolean; + [UNZIP]?: false | Unzip | BrotliDecompress | ZstdDecompress; + [ABORTED]: boolean; + [SAW_VALID_ENTRY]?: boolean; + [SAW_NULL_BLOCK]: boolean; + [SAW_EOF]: boolean; + [WRITING]: boolean; + [CONSUMING]: boolean; + [EMITTEDEND]: boolean; + constructor(opt?: TarOptions); + warn(code: string, message: string | Error, data?: WarnData): void; + [CONSUMEHEADER](chunk: Buffer, position: number): void; + [CLOSESTREAM](): void; + [PROCESSENTRY](entry?: ReadEntry | [string | symbol, any, any]): boolean; + [NEXTENTRY](): void; + [CONSUMEBODY](chunk: Buffer, position: number): number; + [CONSUMEMETA](chunk: Buffer, position: number): number; + [EMIT](ev: string | symbol, data?: any, extra?: any): void; + [EMITMETA](entry: ReadEntry): void; + abort(error: Error): void; + write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean; + write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean; + [BUFFERCONCAT](c: Buffer): void; + [MAYBEEND](): void; + [CONSUMECHUNK](chunk?: Buffer): void; + [CONSUMECHUNKSUB](chunk: Buffer): void; + end(cb?: () => void): this; + end(data: string | Buffer, cb?: () => void): this; + end(str: string, encoding?: BufferEncoding, cb?: () => void): this; +} +export {}; +//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/parse.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/parse.d.ts.map new file mode 100644 index 0000000..80aa723 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/parse.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/parse.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,YAAY,IAAI,EAAE,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAElE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,MAAM,EACZ,MAAM,kBAAkB,CAAA;AAOzB,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,SAAS,eAAsB,CAAA;AACrC,QAAA,MAAM,SAAS,eAAsB,CAAA;AACrC,QAAA,MAAM,YAAY,eAAyB,CAAA;AAC3C,QAAA,MAAM,EAAE,eAA2B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E,EAAE,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI;CAmCnE"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/parse.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/parse.js new file mode 100644 index 0000000..db7b012 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/parse.js @@ -0,0 +1,620 @@ +"use strict"; +// this[BUFFER] is the remainder of a chunk if we're waiting for +// the full 512 bytes of a header to come in. We will Buffer.concat() +// it to the next write(), which is a mem copy, but a small one. +// +// this[QUEUE] is a list of entries that haven't been emitted +// yet this can only get filled up if the user keeps write()ing after +// a write() returns false, or does a write() with more than one entry +// +// We don't buffer chunks, we always parse them and either create an +// entry, or push it into the active entry. The ReadEntry class knows +// to throw data away if .ignore=true +// +// Shift entry off the buffer when it emits 'end', and emit 'entry' for +// the next one in the list. +// +// At any time, we're pushing body chunks into the entry at WRITEENTRY, +// and waiting for 'end' on the entry at READENTRY +// +// ignored entries get .resume() called on them straight away +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Parser = void 0; +const events_1 = require("events"); +const minizlib_1 = require("minizlib"); +const header_js_1 = require("./header.js"); +const pax_js_1 = require("./pax.js"); +const read_entry_js_1 = require("./read-entry.js"); +const warn_method_js_1 = require("./warn-method.js"); +const maxMetaEntrySize = 1024 * 1024; +const gzipHeader = Buffer.from([0x1f, 0x8b]); +const zstdHeader = Buffer.from([0x28, 0xb5, 0x2f, 0xfd]); +const ZIP_HEADER_LEN = Math.max(gzipHeader.length, zstdHeader.length); +const STATE = Symbol('state'); +const WRITEENTRY = Symbol('writeEntry'); +const READENTRY = Symbol('readEntry'); +const NEXTENTRY = Symbol('nextEntry'); +const PROCESSENTRY = Symbol('processEntry'); +const EX = Symbol('extendedHeader'); +const GEX = Symbol('globalExtendedHeader'); +const META = Symbol('meta'); +const EMITMETA = Symbol('emitMeta'); +const BUFFER = Symbol('buffer'); +const QUEUE = Symbol('queue'); +const ENDED = Symbol('ended'); +const EMITTEDEND = Symbol('emittedEnd'); +const EMIT = Symbol('emit'); +const UNZIP = Symbol('unzip'); +const CONSUMECHUNK = Symbol('consumeChunk'); +const CONSUMECHUNKSUB = Symbol('consumeChunkSub'); +const CONSUMEBODY = Symbol('consumeBody'); +const CONSUMEMETA = Symbol('consumeMeta'); +const CONSUMEHEADER = Symbol('consumeHeader'); +const CONSUMING = Symbol('consuming'); +const BUFFERCONCAT = Symbol('bufferConcat'); +const MAYBEEND = Symbol('maybeEnd'); +const WRITING = Symbol('writing'); +const ABORTED = Symbol('aborted'); +const DONE = Symbol('onDone'); +const SAW_VALID_ENTRY = Symbol('sawValidEntry'); +const SAW_NULL_BLOCK = Symbol('sawNullBlock'); +const SAW_EOF = Symbol('sawEOF'); +const CLOSESTREAM = Symbol('closeStream'); +const noop = () => true; +class Parser extends events_1.EventEmitter { + file; + strict; + maxMetaEntrySize; + filter; + brotli; + zstd; + writable = true; + readable = false; + [QUEUE] = []; + [BUFFER]; + [READENTRY]; + [WRITEENTRY]; + [STATE] = 'begin'; + [META] = ''; + [EX]; + [GEX]; + [ENDED] = false; + [UNZIP]; + [ABORTED] = false; + [SAW_VALID_ENTRY]; + [SAW_NULL_BLOCK] = false; + [SAW_EOF] = false; + [WRITING] = false; + [CONSUMING] = false; + [EMITTEDEND] = false; + constructor(opt = {}) { + super(); + this.file = opt.file || ''; + // these BADARCHIVE errors can't be detected early. listen on DONE. + this.on(DONE, () => { + if (this[STATE] === 'begin' || + this[SAW_VALID_ENTRY] === false) { + // either less than 1 block of data, or all entries were invalid. + // Either way, probably not even a tarball. + this.warn('TAR_BAD_ARCHIVE', 'Unrecognized archive format'); + } + }); + if (opt.ondone) { + this.on(DONE, opt.ondone); + } + else { + this.on(DONE, () => { + this.emit('prefinish'); + this.emit('finish'); + this.emit('end'); + }); + } + this.strict = !!opt.strict; + this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize; + this.filter = typeof opt.filter === 'function' ? opt.filter : noop; + // Unlike gzip, brotli doesn't have any magic bytes to identify it + // Users need to explicitly tell us they're extracting a brotli file + // Or we infer from the file extension + const isTBR = opt.file && + (opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr')); + // if it's a tbr file it MIGHT be brotli, but we don't know until + // we look at it and verify it's not a valid tar file. + this.brotli = + !(opt.gzip || opt.zstd) && opt.brotli !== undefined ? opt.brotli + : isTBR ? undefined + : false; + // zstd has magic bytes to identify it, but we also support explicit options + // and file extension detection + const isTZST = opt.file && + (opt.file.endsWith('.tar.zst') || opt.file.endsWith('.tzst')); + this.zstd = + !(opt.gzip || opt.brotli) && opt.zstd !== undefined ? opt.zstd + : isTZST ? true + : undefined; + // have to set this so that streams are ok piping into it + this.on('end', () => this[CLOSESTREAM]()); + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn); + } + if (typeof opt.onReadEntry === 'function') { + this.on('entry', opt.onReadEntry); + } + } + warn(code, message, data = {}) { + (0, warn_method_js_1.warnMethod)(this, code, message, data); + } + [CONSUMEHEADER](chunk, position) { + if (this[SAW_VALID_ENTRY] === undefined) { + this[SAW_VALID_ENTRY] = false; + } + let header; + try { + header = new header_js_1.Header(chunk, position, this[EX], this[GEX]); + } + catch (er) { + return this.warn('TAR_ENTRY_INVALID', er); + } + if (header.nullBlock) { + if (this[SAW_NULL_BLOCK]) { + this[SAW_EOF] = true; + // ending an archive with no entries. pointless, but legal. + if (this[STATE] === 'begin') { + this[STATE] = 'header'; + } + this[EMIT]('eof'); + } + else { + this[SAW_NULL_BLOCK] = true; + this[EMIT]('nullBlock'); + } + } + else { + this[SAW_NULL_BLOCK] = false; + if (!header.cksumValid) { + this.warn('TAR_ENTRY_INVALID', 'checksum failure', { header }); + } + else if (!header.path) { + this.warn('TAR_ENTRY_INVALID', 'path is required', { header }); + } + else { + const type = header.type; + if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) { + this.warn('TAR_ENTRY_INVALID', 'linkpath required', { + header, + }); + } + else if (!/^(Symbolic)?Link$/.test(type) && + !/^(Global)?ExtendedHeader$/.test(type) && + header.linkpath) { + this.warn('TAR_ENTRY_INVALID', 'linkpath forbidden', { + header, + }); + } + else { + const entry = (this[WRITEENTRY] = new read_entry_js_1.ReadEntry(header, this[EX], this[GEX])); + // we do this for meta & ignored entries as well, because they + // are still valid tar, or else we wouldn't know to ignore them + if (!this[SAW_VALID_ENTRY]) { + if (entry.remain) { + // this might be the one! + const onend = () => { + if (!entry.invalid) { + this[SAW_VALID_ENTRY] = true; + } + }; + entry.on('end', onend); + } + else { + this[SAW_VALID_ENTRY] = true; + } + } + if (entry.meta) { + if (entry.size > this.maxMetaEntrySize) { + entry.ignore = true; + this[EMIT]('ignoredEntry', entry); + this[STATE] = 'ignore'; + entry.resume(); + } + else if (entry.size > 0) { + this[META] = ''; + entry.on('data', c => (this[META] += c)); + this[STATE] = 'meta'; + } + } + else { + this[EX] = undefined; + entry.ignore = + entry.ignore || !this.filter(entry.path, entry); + if (entry.ignore) { + // probably valid, just not something we care about + this[EMIT]('ignoredEntry', entry); + this[STATE] = entry.remain ? 'ignore' : 'header'; + entry.resume(); + } + else { + if (entry.remain) { + this[STATE] = 'body'; + } + else { + this[STATE] = 'header'; + entry.end(); + } + if (!this[READENTRY]) { + this[QUEUE].push(entry); + this[NEXTENTRY](); + } + else { + this[QUEUE].push(entry); + } + } + } + } + } + } + } + [CLOSESTREAM]() { + queueMicrotask(() => this.emit('close')); + } + [PROCESSENTRY](entry) { + let go = true; + if (!entry) { + this[READENTRY] = undefined; + go = false; + } + else if (Array.isArray(entry)) { + const [ev, ...args] = entry; + this.emit(ev, ...args); + } + else { + this[READENTRY] = entry; + this.emit('entry', entry); + if (!entry.emittedEnd) { + entry.on('end', () => this[NEXTENTRY]()); + go = false; + } + } + return go; + } + [NEXTENTRY]() { + do { } while (this[PROCESSENTRY](this[QUEUE].shift())); + if (!this[QUEUE].length) { + // At this point, there's nothing in the queue, but we may have an + // entry which is being consumed (readEntry). + // If we don't, then we definitely can handle more data. + // If we do, and either it's flowing, or it has never had any data + // written to it, then it needs more. + // The only other possibility is that it has returned false from a + // write() call, so we wait for the next drain to continue. + const re = this[READENTRY]; + const drainNow = !re || re.flowing || re.size === re.remain; + if (drainNow) { + if (!this[WRITING]) { + this.emit('drain'); + } + } + else { + re.once('drain', () => this.emit('drain')); + } + } + } + [CONSUMEBODY](chunk, position) { + // write up to but no more than writeEntry.blockRemain + const entry = this[WRITEENTRY]; + /* c8 ignore start */ + if (!entry) { + throw new Error('attempt to consume body without entry??'); + } + const br = entry.blockRemain ?? 0; + /* c8 ignore stop */ + const c = br >= chunk.length && position === 0 ? + chunk + : chunk.subarray(position, position + br); + entry.write(c); + if (!entry.blockRemain) { + this[STATE] = 'header'; + this[WRITEENTRY] = undefined; + entry.end(); + } + return c.length; + } + [CONSUMEMETA](chunk, position) { + const entry = this[WRITEENTRY]; + const ret = this[CONSUMEBODY](chunk, position); + // if we finished, then the entry is reset + if (!this[WRITEENTRY] && entry) { + this[EMITMETA](entry); + } + return ret; + } + [EMIT](ev, data, extra) { + if (!this[QUEUE].length && !this[READENTRY]) { + this.emit(ev, data, extra); + } + else { + this[QUEUE].push([ev, data, extra]); + } + } + [EMITMETA](entry) { + this[EMIT]('meta', this[META]); + switch (entry.type) { + case 'ExtendedHeader': + case 'OldExtendedHeader': + this[EX] = pax_js_1.Pax.parse(this[META], this[EX], false); + break; + case 'GlobalExtendedHeader': + this[GEX] = pax_js_1.Pax.parse(this[META], this[GEX], true); + break; + case 'NextFileHasLongPath': + case 'OldGnuLongPath': { + const ex = this[EX] ?? Object.create(null); + this[EX] = ex; + ex.path = this[META].replace(/\0.*/, ''); + break; + } + case 'NextFileHasLongLinkpath': { + const ex = this[EX] || Object.create(null); + this[EX] = ex; + ex.linkpath = this[META].replace(/\0.*/, ''); + break; + } + /* c8 ignore start */ + default: + throw new Error('unknown meta: ' + entry.type); + /* c8 ignore stop */ + } + } + abort(error) { + this[ABORTED] = true; + this.emit('abort', error); + // always throws, even in non-strict mode + this.warn('TAR_ABORT', error, { recoverable: false }); + } + write(chunk, encoding, cb) { + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, + /* c8 ignore next */ + typeof encoding === 'string' ? encoding : 'utf8'); + } + if (this[ABORTED]) { + /* c8 ignore next */ + cb?.(); + return false; + } + // first write, might be gzipped, zstd, or brotli compressed + const needSniff = this[UNZIP] === undefined || + (this.brotli === undefined && this[UNZIP] === false); + if (needSniff && chunk) { + if (this[BUFFER]) { + chunk = Buffer.concat([this[BUFFER], chunk]); + this[BUFFER] = undefined; + } + if (chunk.length < ZIP_HEADER_LEN) { + this[BUFFER] = chunk; + /* c8 ignore next */ + cb?.(); + return true; + } + // look for gzip header + for (let i = 0; this[UNZIP] === undefined && i < gzipHeader.length; i++) { + if (chunk[i] !== gzipHeader[i]) { + this[UNZIP] = false; + } + } + // look for zstd header if gzip header not found + let isZstd = false; + if (this[UNZIP] === false && this.zstd !== false) { + isZstd = true; + for (let i = 0; i < zstdHeader.length; i++) { + if (chunk[i] !== zstdHeader[i]) { + isZstd = false; + break; + } + } + } + const maybeBrotli = this.brotli === undefined && !isZstd; + if (this[UNZIP] === false && maybeBrotli) { + // read the first header to see if it's a valid tar file. If so, + // we can safely assume that it's not actually brotli, despite the + // .tbr or .tar.br file extension. + // if we ended before getting a full chunk, yes, def brotli + if (chunk.length < 512) { + if (this[ENDED]) { + this.brotli = true; + } + else { + this[BUFFER] = chunk; + /* c8 ignore next */ + cb?.(); + return true; + } + } + else { + // if it's tar, it's pretty reliably not brotli, chances of + // that happening are astronomical. + try { + new header_js_1.Header(chunk.subarray(0, 512)); + this.brotli = false; + } + catch (_) { + this.brotli = true; + } + } + } + if (this[UNZIP] === undefined || + (this[UNZIP] === false && (this.brotli || isZstd))) { + const ended = this[ENDED]; + this[ENDED] = false; + this[UNZIP] = + this[UNZIP] === undefined ? new minizlib_1.Unzip({}) + : isZstd ? new minizlib_1.ZstdDecompress({}) + : new minizlib_1.BrotliDecompress({}); + this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk)); + this[UNZIP].on('error', er => this.abort(er)); + this[UNZIP].on('end', () => { + this[ENDED] = true; + this[CONSUMECHUNK](); + }); + this[WRITING] = true; + const ret = !!this[UNZIP][ended ? 'end' : 'write'](chunk); + this[WRITING] = false; + cb?.(); + return ret; + } + } + this[WRITING] = true; + if (this[UNZIP]) { + this[UNZIP].write(chunk); + } + else { + this[CONSUMECHUNK](chunk); + } + this[WRITING] = false; + // return false if there's a queue, or if the current entry isn't flowing + const ret = this[QUEUE].length ? false + : this[READENTRY] ? this[READENTRY].flowing + : true; + // if we have no queue, then that means a clogged READENTRY + if (!ret && !this[QUEUE].length) { + this[READENTRY]?.once('drain', () => this.emit('drain')); + } + /* c8 ignore next */ + cb?.(); + return ret; + } + [BUFFERCONCAT](c) { + if (c && !this[ABORTED]) { + this[BUFFER] = + this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c; + } + } + [MAYBEEND]() { + if (this[ENDED] && + !this[EMITTEDEND] && + !this[ABORTED] && + !this[CONSUMING]) { + this[EMITTEDEND] = true; + const entry = this[WRITEENTRY]; + if (entry && entry.blockRemain) { + // truncated, likely a damaged file + const have = this[BUFFER] ? this[BUFFER].length : 0; + this.warn('TAR_BAD_ARCHIVE', `Truncated input (needed ${entry.blockRemain} more bytes, only ${have} available)`, { entry }); + if (this[BUFFER]) { + entry.write(this[BUFFER]); + } + entry.end(); + } + this[EMIT](DONE); + } + } + [CONSUMECHUNK](chunk) { + if (this[CONSUMING] && chunk) { + this[BUFFERCONCAT](chunk); + } + else if (!chunk && !this[BUFFER]) { + this[MAYBEEND](); + } + else if (chunk) { + this[CONSUMING] = true; + if (this[BUFFER]) { + this[BUFFERCONCAT](chunk); + const c = this[BUFFER]; + this[BUFFER] = undefined; + this[CONSUMECHUNKSUB](c); + } + else { + this[CONSUMECHUNKSUB](chunk); + } + while (this[BUFFER] && + this[BUFFER]?.length >= 512 && + !this[ABORTED] && + !this[SAW_EOF]) { + const c = this[BUFFER]; + this[BUFFER] = undefined; + this[CONSUMECHUNKSUB](c); + } + this[CONSUMING] = false; + } + if (!this[BUFFER] || this[ENDED]) { + this[MAYBEEND](); + } + } + [CONSUMECHUNKSUB](chunk) { + // we know that we are in CONSUMING mode, so anything written goes into + // the buffer. Advance the position and put any remainder in the buffer. + let position = 0; + const length = chunk.length; + while (position + 512 <= length && + !this[ABORTED] && + !this[SAW_EOF]) { + switch (this[STATE]) { + case 'begin': + case 'header': + this[CONSUMEHEADER](chunk, position); + position += 512; + break; + case 'ignore': + case 'body': + position += this[CONSUMEBODY](chunk, position); + break; + case 'meta': + position += this[CONSUMEMETA](chunk, position); + break; + /* c8 ignore start */ + default: + throw new Error('invalid state: ' + this[STATE]); + /* c8 ignore stop */ + } + } + if (position < length) { + if (this[BUFFER]) { + this[BUFFER] = Buffer.concat([ + chunk.subarray(position), + this[BUFFER], + ]); + } + else { + this[BUFFER] = chunk.subarray(position); + } + } + } + end(chunk, encoding, cb) { + if (typeof chunk === 'function') { + cb = chunk; + encoding = undefined; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + if (cb) + this.once('finish', cb); + if (!this[ABORTED]) { + if (this[UNZIP]) { + /* c8 ignore start */ + if (chunk) + this[UNZIP].write(chunk); + /* c8 ignore stop */ + this[UNZIP].end(); + } + else { + this[ENDED] = true; + if (this.brotli === undefined || this.zstd === undefined) + chunk = chunk || Buffer.alloc(0); + if (chunk) + this.write(chunk); + this[MAYBEEND](); + } + } + return this; + } +} +exports.Parser = Parser; +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/parse.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/parse.js.map new file mode 100644 index 0000000..f7b1f3b --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/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AA;YAClB,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA7nBD,wBA6nBC","sourcesContent":["// this[BUFFER] is the remainder of a chunk if we're waiting for\n// the full 512 bytes of a header to come in. We will Buffer.concat()\n// it to the next write(), which is a mem copy, but a small one.\n//\n// this[QUEUE] is a list of entries that haven't been emitted\n// yet this can only get filled up if the user keeps write()ing after\n// a write() returns false, or does a write() with more than one entry\n//\n// We don't buffer chunks, we always parse them and either create an\n// entry, or push it into the active entry. The ReadEntry class knows\n// to throw data away if .ignore=true\n//\n// Shift entry off the buffer when it emits 'end', and emit 'entry' for\n// the next one in the list.\n//\n// At any time, we're pushing body chunks into the entry at WRITEENTRY,\n// and waiting for 'end' on the entry at READENTRY\n//\n// ignored entries get .resume() called on them straight away\n\nimport { EventEmitter as EE } from 'events'\nimport { BrotliDecompress, Unzip, ZstdDecompress } from 'minizlib'\nimport { Header } from './header.js'\nimport { TarOptions } from './options.js'\nimport { Pax } from './pax.js'\nimport { ReadEntry } from './read-entry.js'\nimport {\n warnMethod,\n type WarnData,\n type Warner,\n} from './warn-method.js'\n\nconst maxMetaEntrySize = 1024 * 1024\nconst gzipHeader = Buffer.from([0x1f, 0x8b])\nconst zstdHeader = Buffer.from([0x28, 0xb5, 0x2f, 0xfd])\nconst ZIP_HEADER_LEN = Math.max(gzipHeader.length, zstdHeader.length)\n\nconst STATE = Symbol('state')\nconst WRITEENTRY = Symbol('writeEntry')\nconst READENTRY = Symbol('readEntry')\nconst NEXTENTRY = Symbol('nextEntry')\nconst PROCESSENTRY = Symbol('processEntry')\nconst EX = Symbol('extendedHeader')\nconst GEX = Symbol('globalExtendedHeader')\nconst META = Symbol('meta')\nconst EMITMETA = Symbol('emitMeta')\nconst BUFFER = Symbol('buffer')\nconst QUEUE = Symbol('queue')\nconst ENDED = Symbol('ended')\nconst EMITTEDEND = Symbol('emittedEnd')\nconst EMIT = Symbol('emit')\nconst UNZIP = Symbol('unzip')\nconst CONSUMECHUNK = Symbol('consumeChunk')\nconst CONSUMECHUNKSUB = Symbol('consumeChunkSub')\nconst CONSUMEBODY = Symbol('consumeBody')\nconst CONSUMEMETA = Symbol('consumeMeta')\nconst CONSUMEHEADER = Symbol('consumeHeader')\nconst CONSUMING = Symbol('consuming')\nconst BUFFERCONCAT = Symbol('bufferConcat')\nconst MAYBEEND = Symbol('maybeEnd')\nconst WRITING = Symbol('writing')\nconst ABORTED = Symbol('aborted')\nconst DONE = Symbol('onDone')\nconst SAW_VALID_ENTRY = Symbol('sawValidEntry')\nconst SAW_NULL_BLOCK = Symbol('sawNullBlock')\nconst SAW_EOF = Symbol('sawEOF')\nconst CLOSESTREAM = Symbol('closeStream')\n\nconst noop = () => true\n\nexport type State = 'begin' | 'header' | 'ignore' | 'meta' | 'body'\n\nexport class Parser extends EE implements Warner {\n file: string\n strict: boolean\n maxMetaEntrySize: number\n filter: Exclude\n brotli?: TarOptions['brotli']\n zstd?: TarOptions['zstd']\n\n writable: true = true\n readable: false = false;\n\n [QUEUE]: (ReadEntry | [string | symbol, any, any])[] = [];\n [BUFFER]?: Buffer;\n [READENTRY]?: ReadEntry;\n [WRITEENTRY]?: ReadEntry;\n [STATE]: State = 'begin';\n [META]: string = '';\n [EX]?: Pax;\n [GEX]?: Pax;\n [ENDED]: boolean = false;\n [UNZIP]?: false | Unzip | BrotliDecompress | ZstdDecompress;\n [ABORTED]: boolean = false;\n [SAW_VALID_ENTRY]?: boolean;\n [SAW_NULL_BLOCK]: boolean = false;\n [SAW_EOF]: boolean = false;\n [WRITING]: boolean = false;\n [CONSUMING]: boolean = false;\n [EMITTEDEND]: boolean = false\n\n constructor(opt: TarOptions = {}) {\n super()\n\n this.file = opt.file || ''\n\n // these BADARCHIVE errors can't be detected early. listen on DONE.\n this.on(DONE, () => {\n if (\n this[STATE] === 'begin' ||\n this[SAW_VALID_ENTRY] === false\n ) {\n // either less than 1 block of data, or all entries were invalid.\n // Either way, probably not even a tarball.\n this.warn('TAR_BAD_ARCHIVE', 'Unrecognized archive format')\n }\n })\n\n if (opt.ondone) {\n this.on(DONE, opt.ondone)\n } else {\n this.on(DONE, () => {\n this.emit('prefinish')\n this.emit('finish')\n this.emit('end')\n })\n }\n\n this.strict = !!opt.strict\n this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize\n this.filter = typeof opt.filter === 'function' ? opt.filter : noop\n // Unlike gzip, brotli doesn't have any magic bytes to identify it\n // Users need to explicitly tell us they're extracting a brotli file\n // Or we infer from the file extension\n const isTBR =\n opt.file &&\n (opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr'))\n // if it's a tbr file it MIGHT be brotli, but we don't know until\n // we look at it and verify it's not a valid tar file.\n this.brotli =\n !(opt.gzip || opt.zstd) && opt.brotli !== undefined ? opt.brotli\n : isTBR ? undefined\n : false\n\n // zstd has magic bytes to identify it, but we also support explicit options\n // and file extension detection\n const isTZST =\n opt.file &&\n (opt.file.endsWith('.tar.zst') || opt.file.endsWith('.tzst'))\n this.zstd =\n !(opt.gzip || opt.brotli) && opt.zstd !== undefined ? opt.zstd\n : isTZST ? true\n : undefined\n\n // have to set this so that streams are ok piping into it\n this.on('end', () => this[CLOSESTREAM]())\n\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n if (typeof opt.onReadEntry === 'function') {\n this.on('entry', opt.onReadEntry)\n }\n }\n\n warn(\n code: string,\n message: string | Error,\n data: WarnData = {},\n ): void {\n warnMethod(this, code, message, data)\n }\n\n [CONSUMEHEADER](chunk: Buffer, position: number) {\n if (this[SAW_VALID_ENTRY] === undefined) {\n this[SAW_VALID_ENTRY] = false\n }\n let header\n try {\n header = new Header(chunk, position, this[EX], this[GEX])\n } catch (er) {\n return this.warn('TAR_ENTRY_INVALID', er as Error)\n }\n\n if (header.nullBlock) {\n if (this[SAW_NULL_BLOCK]) {\n this[SAW_EOF] = true\n // ending an archive with no entries. pointless, but legal.\n if (this[STATE] === 'begin') {\n this[STATE] = 'header'\n }\n this[EMIT]('eof')\n } else {\n this[SAW_NULL_BLOCK] = true\n this[EMIT]('nullBlock')\n }\n } else {\n this[SAW_NULL_BLOCK] = false\n if (!header.cksumValid) {\n this.warn('TAR_ENTRY_INVALID', 'checksum failure', { header })\n } else if (!header.path) {\n this.warn('TAR_ENTRY_INVALID', 'path is required', { header })\n } else {\n const type = header.type\n if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) {\n this.warn('TAR_ENTRY_INVALID', 'linkpath required', {\n header,\n })\n } else if (\n !/^(Symbolic)?Link$/.test(type) &&\n !/^(Global)?ExtendedHeader$/.test(type) &&\n header.linkpath\n ) {\n this.warn('TAR_ENTRY_INVALID', 'linkpath forbidden', {\n header,\n })\n } else {\n const entry = (this[WRITEENTRY] = new ReadEntry(\n header,\n this[EX],\n this[GEX],\n ))\n\n // we do this for meta & ignored entries as well, because they\n // are still valid tar, or else we wouldn't know to ignore them\n if (!this[SAW_VALID_ENTRY]) {\n if (entry.remain) {\n // this might be the one!\n const onend = () => {\n if (!entry.invalid) {\n this[SAW_VALID_ENTRY] = true\n }\n }\n entry.on('end', onend)\n } else {\n this[SAW_VALID_ENTRY] = true\n }\n }\n\n if (entry.meta) {\n if (entry.size > this.maxMetaEntrySize) {\n entry.ignore = true\n this[EMIT]('ignoredEntry', entry)\n this[STATE] = 'ignore'\n entry.resume()\n } else if (entry.size > 0) {\n this[META] = ''\n entry.on('data', c => (this[META] += c))\n this[STATE] = 'meta'\n }\n } else {\n this[EX] = undefined\n entry.ignore =\n entry.ignore || !this.filter(entry.path, entry)\n\n if (entry.ignore) {\n // probably valid, just not something we care about\n this[EMIT]('ignoredEntry', entry)\n this[STATE] = entry.remain ? 'ignore' : 'header'\n entry.resume()\n } else {\n if (entry.remain) {\n this[STATE] = 'body'\n } else {\n this[STATE] = 'header'\n entry.end()\n }\n\n if (!this[READENTRY]) {\n this[QUEUE].push(entry)\n this[NEXTENTRY]()\n } else {\n this[QUEUE].push(entry)\n }\n }\n }\n }\n }\n }\n }\n\n [CLOSESTREAM]() {\n queueMicrotask(() => this.emit('close'))\n }\n\n [PROCESSENTRY](entry?: ReadEntry | [string | symbol, any, any]) {\n let go = true\n\n if (!entry) {\n this[READENTRY] = undefined\n go = false\n } else if (Array.isArray(entry)) {\n const [ev, ...args]: [string | symbol, any, any] = entry\n this.emit(ev, ...args)\n } else {\n this[READENTRY] = entry\n this.emit('entry', entry)\n if (!entry.emittedEnd) {\n entry.on('end', () => this[NEXTENTRY]())\n go = false\n }\n }\n\n return go\n }\n\n [NEXTENTRY]() {\n do {} while (this[PROCESSENTRY](this[QUEUE].shift()))\n\n if (!this[QUEUE].length) {\n // At this point, there's nothing in the queue, but we may have an\n // entry which is being consumed (readEntry).\n // If we don't, then we definitely can handle more data.\n // If we do, and either it's flowing, or it has never had any data\n // written to it, then it needs more.\n // The only other possibility is that it has returned false from a\n // write() call, so we wait for the next drain to continue.\n const re = this[READENTRY]\n const drainNow = !re || re.flowing || re.size === re.remain\n if (drainNow) {\n if (!this[WRITING]) {\n this.emit('drain')\n }\n } else {\n re.once('drain', () => this.emit('drain'))\n }\n }\n }\n\n [CONSUMEBODY](chunk: Buffer, position: number) {\n // write up to but no more than writeEntry.blockRemain\n const entry = this[WRITEENTRY]\n /* c8 ignore start */\n if (!entry) {\n throw new Error('attempt to consume body without entry??')\n }\n const br = entry.blockRemain ?? 0\n /* c8 ignore stop */\n const c =\n br >= chunk.length && position === 0 ?\n chunk\n : chunk.subarray(position, position + br)\n\n entry.write(c)\n\n if (!entry.blockRemain) {\n this[STATE] = 'header'\n this[WRITEENTRY] = undefined\n entry.end()\n }\n\n return c.length\n }\n\n [CONSUMEMETA](chunk: Buffer, position: number) {\n const entry = this[WRITEENTRY]\n const ret = this[CONSUMEBODY](chunk, position)\n\n // if we finished, then the entry is reset\n if (!this[WRITEENTRY] && entry) {\n this[EMITMETA](entry)\n }\n\n return ret\n }\n\n [EMIT](ev: string | symbol, data?: any, extra?: any) {\n if (!this[QUEUE].length && !this[READENTRY]) {\n this.emit(ev, data, extra)\n } else {\n this[QUEUE].push([ev, data, extra])\n }\n }\n\n [EMITMETA](entry: ReadEntry) {\n this[EMIT]('meta', this[META])\n switch (entry.type) {\n case 'ExtendedHeader':\n case 'OldExtendedHeader':\n this[EX] = Pax.parse(this[META], this[EX], false)\n break\n\n case 'GlobalExtendedHeader':\n this[GEX] = Pax.parse(this[META], this[GEX], true)\n break\n\n case 'NextFileHasLongPath':\n case 'OldGnuLongPath': {\n const ex = this[EX] ?? Object.create(null)\n this[EX] = ex\n ex.path = this[META].replace(/\\0.*/, '')\n break\n }\n\n case 'NextFileHasLongLinkpath': {\n const ex = this[EX] || Object.create(null)\n this[EX] = ex\n ex.linkpath = this[META].replace(/\\0.*/, '')\n break\n }\n\n /* c8 ignore start */\n default:\n throw new Error('unknown meta: ' + entry.type)\n /* c8 ignore stop */\n }\n }\n\n abort(error: Error) {\n this[ABORTED] = true\n this.emit('abort', error)\n // always throws, even in non-strict mode\n this.warn('TAR_ABORT', error, { recoverable: false })\n }\n\n write(\n buffer: Uint8Array | string,\n cb?: (err?: Error | null) => void,\n ): boolean\n write(\n str: string,\n encoding?: BufferEncoding,\n cb?: (err?: Error | null) => void,\n ): boolean\n write(\n chunk: Buffer | string,\n encoding?: BufferEncoding | (() => any),\n cb?: () => any,\n ): boolean {\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(\n chunk,\n /* c8 ignore next */\n typeof encoding === 'string' ? encoding : 'utf8',\n )\n }\n if (this[ABORTED]) {\n /* c8 ignore next */\n cb?.()\n return false\n }\n\n // first write, might be gzipped, zstd, or brotli compressed\n const needSniff =\n this[UNZIP] === undefined ||\n (this.brotli === undefined && this[UNZIP] === false)\n if (needSniff && chunk) {\n if (this[BUFFER]) {\n chunk = Buffer.concat([this[BUFFER], chunk])\n this[BUFFER] = undefined\n }\n if (chunk.length < ZIP_HEADER_LEN) {\n this[BUFFER] = chunk\n /* c8 ignore next */\n cb?.()\n return true\n }\n\n // look for gzip header\n for (\n let i = 0;\n this[UNZIP] === undefined && i < gzipHeader.length;\n i++\n ) {\n if (chunk[i] !== gzipHeader[i]) {\n this[UNZIP] = false\n }\n }\n\n // look for zstd header if gzip header not found\n let isZstd = false\n if (this[UNZIP] === false && this.zstd !== false) {\n isZstd = true\n for (let i = 0; i < zstdHeader.length; i++) {\n if (chunk[i] !== zstdHeader[i]) {\n isZstd = false\n break\n }\n }\n }\n\n const maybeBrotli = this.brotli === undefined && !isZstd\n if (this[UNZIP] === false && maybeBrotli) {\n // read the first header to see if it's a valid tar file. If so,\n // we can safely assume that it's not actually brotli, despite the\n // .tbr or .tar.br file extension.\n // if we ended before getting a full chunk, yes, def brotli\n if (chunk.length < 512) {\n if (this[ENDED]) {\n this.brotli = true\n } else {\n this[BUFFER] = chunk\n /* c8 ignore next */\n cb?.()\n return true\n }\n } else {\n // if it's tar, it's pretty reliably not brotli, chances of\n // that happening are astronomical.\n try {\n new Header(chunk.subarray(0, 512))\n this.brotli = false\n } catch (_) {\n this.brotli = true\n }\n }\n }\n\n if (\n this[UNZIP] === undefined ||\n (this[UNZIP] === false && (this.brotli || isZstd))\n ) {\n const ended = this[ENDED]\n this[ENDED] = false\n this[UNZIP] =\n this[UNZIP] === undefined ? new Unzip({})\n : isZstd ? new ZstdDecompress({})\n : new BrotliDecompress({})\n this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk))\n this[UNZIP].on('error', er => this.abort(er as Error))\n this[UNZIP].on('end', () => {\n this[ENDED] = true\n this[CONSUMECHUNK]()\n })\n this[WRITING] = true\n const ret = !!this[UNZIP][ended ? 'end' : 'write'](chunk)\n this[WRITING] = false\n cb?.()\n return ret\n }\n }\n\n this[WRITING] = true\n if (this[UNZIP]) {\n this[UNZIP].write(chunk)\n } else {\n this[CONSUMECHUNK](chunk)\n }\n this[WRITING] = false\n\n // return false if there's a queue, or if the current entry isn't flowing\n const ret =\n this[QUEUE].length ? false\n : this[READENTRY] ? this[READENTRY].flowing\n : true\n\n // if we have no queue, then that means a clogged READENTRY\n if (!ret && !this[QUEUE].length) {\n this[READENTRY]?.once('drain', () => this.emit('drain'))\n }\n\n /* c8 ignore next */\n cb?.()\n return ret\n }\n\n [BUFFERCONCAT](c: Buffer) {\n if (c && !this[ABORTED]) {\n this[BUFFER] =\n this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c\n }\n }\n\n [MAYBEEND]() {\n if (\n this[ENDED] &&\n !this[EMITTEDEND] &&\n !this[ABORTED] &&\n !this[CONSUMING]\n ) {\n this[EMITTEDEND] = true\n const entry = this[WRITEENTRY]\n if (entry && entry.blockRemain) {\n // truncated, likely a damaged file\n const have = this[BUFFER] ? this[BUFFER].length : 0\n this.warn(\n 'TAR_BAD_ARCHIVE',\n `Truncated input (needed ${entry.blockRemain} more bytes, only ${have} available)`,\n { entry },\n )\n if (this[BUFFER]) {\n entry.write(this[BUFFER])\n }\n entry.end()\n }\n this[EMIT](DONE)\n }\n }\n\n [CONSUMECHUNK](chunk?: Buffer) {\n if (this[CONSUMING] && chunk) {\n this[BUFFERCONCAT](chunk)\n } else if (!chunk && !this[BUFFER]) {\n this[MAYBEEND]()\n } else if (chunk) {\n this[CONSUMING] = true\n if (this[BUFFER]) {\n this[BUFFERCONCAT](chunk)\n const c = this[BUFFER]\n this[BUFFER] = undefined\n this[CONSUMECHUNKSUB](c)\n } else {\n this[CONSUMECHUNKSUB](chunk)\n }\n\n while (\n this[BUFFER] &&\n (this[BUFFER] as Buffer)?.length >= 512 &&\n !this[ABORTED] &&\n !this[SAW_EOF]\n ) {\n const c = this[BUFFER]\n this[BUFFER] = undefined\n this[CONSUMECHUNKSUB](c)\n }\n this[CONSUMING] = false\n }\n\n if (!this[BUFFER] || this[ENDED]) {\n this[MAYBEEND]()\n }\n }\n\n [CONSUMECHUNKSUB](chunk: Buffer) {\n // we know that we are in CONSUMING mode, so anything written goes into\n // the buffer. Advance the position and put any remainder in the buffer.\n let position = 0\n const length = chunk.length\n while (\n position + 512 <= length &&\n !this[ABORTED] &&\n !this[SAW_EOF]\n ) {\n switch (this[STATE]) {\n case 'begin':\n case 'header':\n this[CONSUMEHEADER](chunk, position)\n position += 512\n break\n\n case 'ignore':\n case 'body':\n position += this[CONSUMEBODY](chunk, position)\n break\n\n case 'meta':\n position += this[CONSUMEMETA](chunk, position)\n break\n\n /* c8 ignore start */\n default:\n throw new Error('invalid state: ' + this[STATE])\n /* c8 ignore stop */\n }\n }\n\n if (position < length) {\n if (this[BUFFER]) {\n this[BUFFER] = Buffer.concat([\n chunk.subarray(position),\n this[BUFFER],\n ])\n } else {\n this[BUFFER] = chunk.subarray(position)\n }\n }\n }\n\n end(cb?: () => void): this\n end(data: string | Buffer, cb?: () => void): this\n end(str: string, encoding?: BufferEncoding, cb?: () => void): this\n end(\n chunk?: string | Buffer | (() => void),\n encoding?: BufferEncoding | (() => void),\n cb?: () => void,\n ) {\n if (typeof chunk === 'function') {\n cb = chunk\n encoding = undefined\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding)\n }\n if (cb) this.once('finish', cb)\n if (!this[ABORTED]) {\n if (this[UNZIP]) {\n /* c8 ignore start */\n if (chunk) this[UNZIP].write(chunk)\n /* c8 ignore stop */\n this[UNZIP].end()\n } else {\n this[ENDED] = true\n if (this.brotli === undefined || this.zstd === undefined)\n chunk = chunk || Buffer.alloc(0)\n if (chunk) this.write(chunk)\n this[MAYBEEND]()\n }\n }\n return this\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/path-reservations.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/path-reservations.d.ts new file mode 100644 index 0000000..44f0482 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/path-reservations.d.ts @@ -0,0 +1,11 @@ +export type Reservation = { + paths: string[]; + dirs: Set; +}; +export type Handler = (clear: () => void) => void; +export declare class PathReservations { + #private; + reserve(paths: string[], fn: Handler): boolean; + check(fn: Handler): boolean; +} +//# sourceMappingURL=path-reservations.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/path-reservations.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/path-reservations.d.ts.map new file mode 100644 index 0000000..8ea77e5 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/path-reservations.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"path-reservations.d.ts","sourceRoot":"","sources":["../../src/path-reservations.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;AAmBjD,qBAAa,gBAAgB;;IAY3B,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO;IA8DpC,KAAK,CAAC,EAAE,EAAE,OAAO;CA8ElB"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/path-reservations.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/path-reservations.js new file mode 100644 index 0000000..525d233 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/path-reservations.js @@ -0,0 +1,170 @@ +"use strict"; +// A path exclusive reservation system +// reserve([list, of, paths], fn) +// When the fn is first in line for all its paths, it +// is called with a cb that clears the reservation. +// +// Used by async unpack to avoid clobbering paths in use, +// while still allowing maximal safe parallelization. +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PathReservations = void 0; +const node_path_1 = require("node:path"); +const normalize_unicode_js_1 = require("./normalize-unicode.js"); +const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js"); +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; +const isWindows = platform === 'win32'; +// return a set of parent dirs for a given path +// '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d'] +const getDirs = (path) => { + const dirs = path + .split('/') + .slice(0, -1) + .reduce((set, path) => { + const s = set[set.length - 1]; + if (s !== undefined) { + path = (0, node_path_1.join)(s, path); + } + set.push(path || '/'); + return set; + }, []); + return dirs; +}; +class PathReservations { + // path => [function or Set] + // A Set object means a directory reservation + // A fn is a direct reservation on that path + #queues = new Map(); + // fn => {paths:[path,...], dirs:[path, ...]} + #reservations = new Map(); + // functions currently running + #running = new Set(); + reserve(paths, fn) { + paths = + isWindows ? + ['win32 parallelization disabled'] + : paths.map(p => { + // don't need normPath, because we skip this entirely for windows + return (0, strip_trailing_slashes_js_1.stripTrailingSlashes)((0, node_path_1.join)((0, normalize_unicode_js_1.normalizeUnicode)(p))); + }); + const dirs = new Set(paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b))); + this.#reservations.set(fn, { dirs, paths }); + for (const p of paths) { + const q = this.#queues.get(p); + if (!q) { + this.#queues.set(p, [fn]); + } + else { + q.push(fn); + } + } + for (const dir of dirs) { + const q = this.#queues.get(dir); + if (!q) { + this.#queues.set(dir, [new Set([fn])]); + } + else { + const l = q[q.length - 1]; + if (l instanceof Set) { + l.add(fn); + } + else { + q.push(new Set([fn])); + } + } + } + return this.#run(fn); + } + // return the queues for each path the function cares about + // fn => {paths, dirs} + #getQueues(fn) { + const res = this.#reservations.get(fn); + /* c8 ignore start */ + if (!res) { + throw new Error('function does not have any path reservations'); + } + /* c8 ignore stop */ + return { + paths: res.paths.map((path) => this.#queues.get(path)), + dirs: [...res.dirs].map(path => this.#queues.get(path)), + }; + } + // check if fn is first in line for all its paths, and is + // included in the first set for all its dir queues + check(fn) { + const { paths, dirs } = this.#getQueues(fn); + return (paths.every(q => q && q[0] === fn) && + dirs.every(q => q && q[0] instanceof Set && q[0].has(fn))); + } + // run the function if it's first in line and not already running + #run(fn) { + if (this.#running.has(fn) || !this.check(fn)) { + return false; + } + this.#running.add(fn); + fn(() => this.#clear(fn)); + return true; + } + #clear(fn) { + if (!this.#running.has(fn)) { + return false; + } + const res = this.#reservations.get(fn); + /* c8 ignore start */ + if (!res) { + throw new Error('invalid reservation'); + } + /* c8 ignore stop */ + const { paths, dirs } = res; + const next = new Set(); + for (const path of paths) { + const q = this.#queues.get(path); + /* c8 ignore start */ + if (!q || q?.[0] !== fn) { + continue; + } + /* c8 ignore stop */ + const q0 = q[1]; + if (!q0) { + this.#queues.delete(path); + continue; + } + q.shift(); + if (typeof q0 === 'function') { + next.add(q0); + } + else { + for (const f of q0) { + next.add(f); + } + } + } + for (const dir of dirs) { + const q = this.#queues.get(dir); + const q0 = q?.[0]; + /* c8 ignore next - type safety only */ + if (!q || !(q0 instanceof Set)) + continue; + if (q0.size === 1 && q.length === 1) { + this.#queues.delete(dir); + continue; + } + else if (q0.size === 1) { + q.shift(); + // next one must be a function, + // or else the Set would've been reused + const n = q[0]; + if (typeof n === 'function') { + next.add(n); + } + } + else { + q0.delete(fn); + } + } + this.#running.delete(fn); + next.forEach(fn => this.#run(fn)); + return true; + } +} +exports.PathReservations = PathReservations; +//# sourceMappingURL=path-reservations.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/path-reservations.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/path-reservations.js.map new file mode 100644 index 0000000..5ab3d0f --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/path-reservations.js.map @@ -0,0 +1 @@ +{"version":3,"file":"path-reservations.js","sourceRoot":"","sources":["../../src/path-reservations.ts"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,iCAAiC;AACjC,qDAAqD;AACrD,mDAAmD;AACnD,EAAE;AACF,yDAAyD;AACzD,qDAAqD;;;AAErD,yCAAgC;AAChC,iEAAyD;AACzD,2EAAkE;AAElE,MAAM,QAAQ,GACZ,OAAO,CAAC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I,CAAC,EAAE,CAAC,CAAC,CAAA;QACjC,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAxJD,4CAwJC","sourcesContent":["// A path exclusive reservation system\n// reserve([list, of, paths], fn)\n// When the fn is first in line for all its paths, it\n// is called with a cb that clears the reservation.\n//\n// Used by async unpack to avoid clobbering paths in use,\n// while still allowing maximal safe parallelization.\n\nimport { join } from 'node:path'\nimport { normalizeUnicode } from './normalize-unicode.js'\nimport { stripTrailingSlashes } from './strip-trailing-slashes.js'\n\nconst platform =\n process.env.TESTING_TAR_FAKE_PLATFORM || process.platform\nconst isWindows = platform === 'win32'\n\nexport type Reservation = {\n paths: string[]\n dirs: Set\n}\n\nexport type Handler = (clear: () => void) => void\n\n// return a set of parent dirs for a given path\n// '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d']\nconst getDirs = (path: string) => {\n const dirs = path\n .split('/')\n .slice(0, -1)\n .reduce((set: string[], path) => {\n const s = set[set.length - 1]\n if (s !== undefined) {\n path = join(s, path)\n }\n set.push(path || '/')\n return set\n }, [])\n return dirs\n}\n\nexport class PathReservations {\n // path => [function or Set]\n // A Set object means a directory reservation\n // A fn is a direct reservation on that path\n #queues = new Map)[]>()\n\n // fn => {paths:[path,...], dirs:[path, ...]}\n #reservations = new Map()\n\n // functions currently running\n #running = new Set()\n\n reserve(paths: string[], fn: Handler) {\n paths =\n isWindows ?\n ['win32 parallelization disabled']\n : paths.map(p => {\n // don't need normPath, because we skip this entirely for windows\n return stripTrailingSlashes(join(normalizeUnicode(p)))\n })\n\n const dirs = new Set(\n paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b)),\n )\n this.#reservations.set(fn, { dirs, paths })\n for (const p of paths) {\n const q = this.#queues.get(p)\n if (!q) {\n this.#queues.set(p, [fn])\n } else {\n q.push(fn)\n }\n }\n for (const dir of dirs) {\n const q = this.#queues.get(dir)\n if (!q) {\n this.#queues.set(dir, [new Set([fn])])\n } else {\n const l = q[q.length - 1]\n if (l instanceof Set) {\n l.add(fn)\n } else {\n q.push(new Set([fn]))\n }\n }\n }\n return this.#run(fn)\n }\n\n // return the queues for each path the function cares about\n // fn => {paths, dirs}\n #getQueues(fn: Handler): {\n paths: Handler[][]\n dirs: (Handler | Set)[][]\n } {\n const res = this.#reservations.get(fn)\n /* c8 ignore start */\n if (!res) {\n throw new Error('function does not have any path reservations')\n }\n /* c8 ignore stop */\n return {\n paths: res.paths.map((path: string) =>\n this.#queues.get(path),\n ) as Handler[][],\n dirs: [...res.dirs].map(path => this.#queues.get(path)) as (\n | Handler\n | Set\n )[][],\n }\n }\n\n // check if fn is first in line for all its paths, and is\n // included in the first set for all its dir queues\n check(fn: Handler) {\n const { paths, dirs } = this.#getQueues(fn)\n return (\n paths.every(q => q && q[0] === fn) &&\n dirs.every(q => q && q[0] instanceof Set && q[0].has(fn))\n )\n }\n\n // run the function if it's first in line and not already running\n #run(fn: Handler) {\n if (this.#running.has(fn) || !this.check(fn)) {\n return false\n }\n this.#running.add(fn)\n fn(() => this.#clear(fn))\n return true\n }\n\n #clear(fn: Handler) {\n if (!this.#running.has(fn)) {\n return false\n }\n const res = this.#reservations.get(fn)\n /* c8 ignore start */\n if (!res) {\n throw new Error('invalid reservation')\n }\n /* c8 ignore stop */\n const { paths, dirs } = res\n\n const next = new Set()\n for (const path of paths) {\n const q = this.#queues.get(path)\n /* c8 ignore start */\n if (!q || q?.[0] !== fn) {\n continue\n }\n /* c8 ignore stop */\n const q0 = q[1]\n if (!q0) {\n this.#queues.delete(path)\n continue\n }\n q.shift()\n if (typeof q0 === 'function') {\n next.add(q0)\n } else {\n for (const f of q0) {\n next.add(f)\n }\n }\n }\n\n for (const dir of dirs) {\n const q = this.#queues.get(dir)\n const q0 = q?.[0]\n /* c8 ignore next - type safety only */\n if (!q || !(q0 instanceof Set)) continue\n if (q0.size === 1 && q.length === 1) {\n this.#queues.delete(dir)\n continue\n } else if (q0.size === 1) {\n q.shift()\n // next one must be a function,\n // or else the Set would've been reused\n const n = q[0]\n if (typeof n === 'function') {\n next.add(n)\n }\n } else {\n q0.delete(fn)\n }\n }\n\n this.#running.delete(fn)\n next.forEach(fn => this.#run(fn))\n return true\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/pax.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/pax.d.ts new file mode 100644 index 0000000..d932279 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/pax.d.ts @@ -0,0 +1,26 @@ +import { HeaderData } from './header.js'; +export declare class Pax implements HeaderData { + atime?: Date; + mtime?: Date; + ctime?: Date; + charset?: string; + comment?: string; + gid?: number; + uid?: number; + gname?: string; + uname?: string; + linkpath?: string; + dev?: number; + ino?: number; + nlink?: number; + path?: string; + size?: number; + mode?: number; + global: boolean; + constructor(obj: HeaderData, global?: boolean); + encode(): Buffer; + encodeBody(): string; + encodeField(field: keyof Pax): string; + static parse(str: string, ex?: HeaderData, g?: boolean): Pax; +} +//# sourceMappingURL=pax.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/pax.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/pax.d.ts.map new file mode 100644 index 0000000..da78f0a --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/pax.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pax.d.ts","sourceRoot":"","sources":["../../src/pax.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,UAAU,EAAE,MAAM,aAAa,CAAA;AAEhD,qBAAa,GAAI,YAAW,UAAU;IACpC,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,KAAK,CAAC,EAAE,IAAI,CAAA;IAEZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,MAAM,EAAE,OAAO,CAAA;gBAEH,GAAG,EAAE,UAAU,EAAE,MAAM,GAAE,OAAe;IAmBpD,MAAM;IAiDN,UAAU;IAoBV,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,MAAM;IA2BrC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,GAAE,OAAe;CAG9D"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/pax.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/pax.js new file mode 100644 index 0000000..d30c0f3 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/pax.js @@ -0,0 +1,158 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Pax = void 0; +const node_path_1 = require("node:path"); +const header_js_1 = require("./header.js"); +class Pax { + atime; + mtime; + ctime; + charset; + comment; + gid; + uid; + gname; + uname; + linkpath; + dev; + ino; + nlink; + path; + size; + mode; + global; + constructor(obj, global = false) { + this.atime = obj.atime; + this.charset = obj.charset; + this.comment = obj.comment; + this.ctime = obj.ctime; + this.dev = obj.dev; + this.gid = obj.gid; + this.global = global; + this.gname = obj.gname; + this.ino = obj.ino; + this.linkpath = obj.linkpath; + this.mtime = obj.mtime; + this.nlink = obj.nlink; + this.path = obj.path; + this.size = obj.size; + this.uid = obj.uid; + this.uname = obj.uname; + } + encode() { + const body = this.encodeBody(); + if (body === '') { + return Buffer.allocUnsafe(0); + } + const bodyLen = Buffer.byteLength(body); + // round up to 512 bytes + // add 512 for header + const bufLen = 512 * Math.ceil(1 + bodyLen / 512); + const buf = Buffer.allocUnsafe(bufLen); + // 0-fill the header section, it might not hit every field + for (let i = 0; i < 512; i++) { + buf[i] = 0; + } + new header_js_1.Header({ + // XXX split the path + // then the path should be PaxHeader + basename, but less than 99, + // prepend with the dirname + /* c8 ignore start */ + path: ('PaxHeader/' + (0, node_path_1.basename)(this.path ?? '')).slice(0, 99), + /* c8 ignore stop */ + mode: this.mode || 0o644, + uid: this.uid, + gid: this.gid, + size: bodyLen, + mtime: this.mtime, + type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader', + linkpath: '', + uname: this.uname || '', + gname: this.gname || '', + devmaj: 0, + devmin: 0, + atime: this.atime, + ctime: this.ctime, + }).encode(buf); + buf.write(body, 512, bodyLen, 'utf8'); + // null pad after the body + for (let i = bodyLen + 512; i < buf.length; i++) { + buf[i] = 0; + } + return buf; + } + encodeBody() { + return (this.encodeField('path') + + this.encodeField('ctime') + + this.encodeField('atime') + + this.encodeField('dev') + + this.encodeField('ino') + + this.encodeField('nlink') + + this.encodeField('charset') + + this.encodeField('comment') + + this.encodeField('gid') + + this.encodeField('gname') + + this.encodeField('linkpath') + + this.encodeField('mtime') + + this.encodeField('size') + + this.encodeField('uid') + + this.encodeField('uname')); + } + encodeField(field) { + if (this[field] === undefined) { + return ''; + } + const r = this[field]; + const v = r instanceof Date ? r.getTime() / 1000 : r; + const s = ' ' + + (field === 'dev' || field === 'ino' || field === 'nlink' ? + 'SCHILY.' + : '') + + field + + '=' + + v + + '\n'; + const byteLen = Buffer.byteLength(s); + // the digits includes the length of the digits in ascii base-10 + // so if it's 9 characters, then adding 1 for the 9 makes it 10 + // which makes it 11 chars. + let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1; + if (byteLen + digits >= Math.pow(10, digits)) { + digits += 1; + } + const len = digits + byteLen; + return len + s; + } + static parse(str, ex, g = false) { + return new Pax(merge(parseKV(str), ex), g); + } +} +exports.Pax = Pax; +const merge = (a, b) => b ? Object.assign({}, b, a) : a; +const parseKV = (str) => str + .replace(/\n$/, '') + .split('\n') + .reduce(parseKVLine, Object.create(null)); +const parseKVLine = (set, line) => { + const n = parseInt(line, 10); + // XXX Values with \n in them will fail this. + // Refactor to not be a naive line-by-line parse. + if (n !== Buffer.byteLength(line) + 1) { + return set; + } + line = line.slice((n + ' ').length); + const kv = line.split('='); + const r = kv.shift(); + if (!r) { + return set; + } + const k = r.replace(/^SCHILY\.(dev|ino|nlink)/, '$1'); + const v = kv.join('='); + set[k] = + /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k) ? + new Date(Number(v) * 1000) + : /^[0-9]+$/.test(v) ? +v + : v; + return set; +}; +//# sourceMappingURL=pax.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/pax.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/pax.js.map new file mode 100644 index 0000000..0e216f4 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/pax.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pax.js","sourceRoot":"","sources":["../../src/pax.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AACpC,2CAAgD;AAEhD,MAAa,GAAG;IACd,KAAK,CAAO;IACZ,KAAK,CAAO;IACZ,KAAK,CAAO;IAEZ,OAAO,CAAS;IAChB,OAAO,CAAS;IAEhB,GAAG,CAAS;IACZ,GAAG,CAAS;IAEZ,KAAK,CAAS;IACd,KAAK,CAAS;IACd,QAAQ,CAAS;IACjB,GAAG,CAAS;IACZ,GAAG,CAAS;IACZ,KAAK,CAAS;IACd,IAAI,CAAS;IACb,IAAI,CAAS;IACb,IAAI,CAAS;IAEb,MAAM,CAAS;IAEf,YAAY,GAAe,EAAE,SAAkB,KAAK;QAClD,IAAI,CAAC,KAAK,GA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,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IAE5B,6CAA6C;IAC7C,iDAAiD;IACjD,IAAI,CAAC,KAAK,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACtC,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,CAAA;IACnC,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC1B,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,CAAA;IAEpB,IAAI,CAAC,CAAC,EAAE,CAAC;QACP,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAAA;IAErD,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACtB,GAAG,CAAC,CAAC,CAAC;QACJ,yCAAyC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACjD,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;YAC5B,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACzB,CAAC,CAAC,CAAC,CAAA;IACL,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA","sourcesContent":["import { basename } from 'node:path'\nimport { Header, HeaderData } from './header.js'\n\nexport class Pax implements HeaderData {\n atime?: Date\n mtime?: Date\n ctime?: Date\n\n charset?: string\n comment?: string\n\n gid?: number\n uid?: number\n\n gname?: string\n uname?: string\n linkpath?: string\n dev?: number\n ino?: number\n nlink?: number\n path?: string\n size?: number\n mode?: number\n\n global: boolean\n\n constructor(obj: HeaderData, global: boolean = false) {\n this.atime = obj.atime\n this.charset = obj.charset\n this.comment = obj.comment\n this.ctime = obj.ctime\n this.dev = obj.dev\n this.gid = obj.gid\n this.global = global\n this.gname = obj.gname\n this.ino = obj.ino\n this.linkpath = obj.linkpath\n this.mtime = obj.mtime\n this.nlink = obj.nlink\n this.path = obj.path\n this.size = obj.size\n this.uid = obj.uid\n this.uname = obj.uname\n }\n\n encode() {\n const body = this.encodeBody()\n if (body === '') {\n return Buffer.allocUnsafe(0)\n }\n\n const bodyLen = Buffer.byteLength(body)\n // round up to 512 bytes\n // add 512 for header\n const bufLen = 512 * Math.ceil(1 + bodyLen / 512)\n const buf = Buffer.allocUnsafe(bufLen)\n\n // 0-fill the header section, it might not hit every field\n for (let i = 0; i < 512; i++) {\n buf[i] = 0\n }\n\n new Header({\n // XXX split the path\n // then the path should be PaxHeader + basename, but less than 99,\n // prepend with the dirname\n /* c8 ignore start */\n path: ('PaxHeader/' + basename(this.path ?? '')).slice(0, 99),\n /* c8 ignore stop */\n mode: this.mode || 0o644,\n uid: this.uid,\n gid: this.gid,\n size: bodyLen,\n mtime: this.mtime,\n type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader',\n linkpath: '',\n uname: this.uname || '',\n gname: this.gname || '',\n devmaj: 0,\n devmin: 0,\n atime: this.atime,\n ctime: this.ctime,\n }).encode(buf)\n\n buf.write(body, 512, bodyLen, 'utf8')\n\n // null pad after the body\n for (let i = bodyLen + 512; i < buf.length; i++) {\n buf[i] = 0\n }\n\n return buf\n }\n\n encodeBody() {\n return (\n this.encodeField('path') +\n this.encodeField('ctime') +\n this.encodeField('atime') +\n this.encodeField('dev') +\n this.encodeField('ino') +\n this.encodeField('nlink') +\n this.encodeField('charset') +\n this.encodeField('comment') +\n this.encodeField('gid') +\n this.encodeField('gname') +\n this.encodeField('linkpath') +\n this.encodeField('mtime') +\n this.encodeField('size') +\n this.encodeField('uid') +\n this.encodeField('uname')\n )\n }\n\n encodeField(field: keyof Pax): string {\n if (this[field] === undefined) {\n return ''\n }\n const r = this[field]\n const v = r instanceof Date ? r.getTime() / 1000 : r\n const s =\n ' ' +\n (field === 'dev' || field === 'ino' || field === 'nlink' ?\n 'SCHILY.'\n : '') +\n field +\n '=' +\n v +\n '\\n'\n const byteLen = Buffer.byteLength(s)\n // the digits includes the length of the digits in ascii base-10\n // so if it's 9 characters, then adding 1 for the 9 makes it 10\n // which makes it 11 chars.\n let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1\n if (byteLen + digits >= Math.pow(10, digits)) {\n digits += 1\n }\n const len = digits + byteLen\n return len + s\n }\n\n static parse(str: string, ex?: HeaderData, g: boolean = false) {\n return new Pax(merge(parseKV(str), ex), g)\n }\n}\n\nconst merge = (a: HeaderData, b?: HeaderData) =>\n b ? Object.assign({}, b, a) : a\n\nconst parseKV = (str: string) =>\n str\n .replace(/\\n$/, '')\n .split('\\n')\n .reduce(parseKVLine, Object.create(null))\n\nconst parseKVLine = (set: Record, line: string) => {\n const n = parseInt(line, 10)\n\n // XXX Values with \\n in them will fail this.\n // Refactor to not be a naive line-by-line parse.\n if (n !== Buffer.byteLength(line) + 1) {\n return set\n }\n\n line = line.slice((n + ' ').length)\n const kv = line.split('=')\n const r = kv.shift()\n\n if (!r) {\n return set\n }\n\n const k = r.replace(/^SCHILY\\.(dev|ino|nlink)/, '$1')\n\n const v = kv.join('=')\n set[k] =\n /^([A-Z]+\\.)?([mac]|birth|creation)time$/.test(k) ?\n new Date(Number(v) * 1000)\n : /^[0-9]+$/.test(v) ? +v\n : v\n return set\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/process-umask.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/process-umask.d.ts new file mode 100644 index 0000000..abde1b6 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/process-umask.d.ts @@ -0,0 +1,2 @@ +export declare const umask: () => number; +//# sourceMappingURL=process-umask.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/process-umask.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/process-umask.d.ts.map new file mode 100644 index 0000000..96a5385 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/process-umask.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"process-umask.d.ts","sourceRoot":"","sources":["../../src/process-umask.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,KAAK,cAAwB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/process-umask.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/process-umask.js new file mode 100644 index 0000000..9256bcc --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/process-umask.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.umask = void 0; +// separate file so I stop getting nagged in vim about deprecated API. +const umask = () => process.umask(); +exports.umask = umask; +//# sourceMappingURL=process-umask.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/process-umask.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/process-umask.js.map new file mode 100644 index 0000000..2387e34 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/process-umask.js.map @@ -0,0 +1 @@ +{"version":3,"file":"process-umask.js","sourceRoot":"","sources":["../../src/process-umask.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AAC/D,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;AAA7B,QAAA,KAAK,SAAwB","sourcesContent":["// separate file so I stop getting nagged in vim about deprecated API.\nexport const umask = () => process.umask()\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/read-entry.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/read-entry.d.ts new file mode 100644 index 0000000..11b882b --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/read-entry.d.ts @@ -0,0 +1,36 @@ +import { Minipass } from 'minipass'; +import { Header } from './header.js'; +import { Pax } from './pax.js'; +import { EntryTypeName } from './types.js'; +export declare class ReadEntry extends Minipass { + #private; + extended?: Pax; + globalExtended?: Pax; + header: Header; + startBlockSize: number; + blockRemain: number; + remain: number; + type: EntryTypeName; + meta: boolean; + ignore: boolean; + path: string; + mode?: number; + uid?: number; + gid?: number; + uname?: string; + gname?: string; + size: number; + mtime?: Date; + atime?: Date; + ctime?: Date; + linkpath?: string; + dev?: number; + ino?: number; + nlink?: number; + invalid: boolean; + absolute?: string; + unsupported: boolean; + constructor(header: Header, ex?: Pax, gex?: Pax); + write(data: Buffer): boolean; +} +//# sourceMappingURL=read-entry.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/read-entry.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/read-entry.d.ts.map new file mode 100644 index 0000000..4f16a84 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/read-entry.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"read-entry.d.ts","sourceRoot":"","sources":["../../src/read-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1C,qBAAa,SAAU,SAAQ,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;;IACrD,QAAQ,CAAC,EAAE,GAAG,CAAA;IACd,cAAc,CAAC,EAAE,GAAG,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,aAAa,CAAA;IACnB,IAAI,EAAE,OAAO,CAAQ;IACrB,MAAM,EAAE,OAAO,CAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAI;IAChB,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,OAAO,CAAQ;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,OAAO,CAAQ;gBAEhB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG;IA+E/C,KAAK,CAAC,IAAI,EAAE,MAAM;CAyCnB"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/read-entry.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/read-entry.js new file mode 100644 index 0000000..15e2d55 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/read-entry.js @@ -0,0 +1,140 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ReadEntry = void 0; +const minipass_1 = require("minipass"); +const normalize_windows_path_js_1 = require("./normalize-windows-path.js"); +class ReadEntry extends minipass_1.Minipass { + extended; + globalExtended; + header; + startBlockSize; + blockRemain; + remain; + type; + meta = false; + ignore = false; + path; + mode; + uid; + gid; + uname; + gname; + size = 0; + mtime; + atime; + ctime; + linkpath; + dev; + ino; + nlink; + invalid = false; + absolute; + unsupported = false; + constructor(header, ex, gex) { + super({}); + // read entries always start life paused. this is to avoid the + // situation where Minipass's auto-ending empty streams results + // in an entry ending before we're ready for it. + this.pause(); + this.extended = ex; + this.globalExtended = gex; + this.header = header; + /* c8 ignore start */ + this.remain = header.size ?? 0; + /* c8 ignore stop */ + this.startBlockSize = 512 * Math.ceil(this.remain / 512); + this.blockRemain = this.startBlockSize; + this.type = header.type; + switch (this.type) { + case 'File': + case 'OldFile': + case 'Link': + case 'SymbolicLink': + case 'CharacterDevice': + case 'BlockDevice': + case 'Directory': + case 'FIFO': + case 'ContiguousFile': + case 'GNUDumpDir': + break; + case 'NextFileHasLongLinkpath': + case 'NextFileHasLongPath': + case 'OldGnuLongPath': + case 'GlobalExtendedHeader': + case 'ExtendedHeader': + case 'OldExtendedHeader': + this.meta = true; + break; + // NOTE: gnutar and bsdtar treat unrecognized types as 'File' + // it may be worth doing the same, but with a warning. + default: + this.ignore = true; + } + /* c8 ignore start */ + if (!header.path) { + throw new Error('no path provided for tar.ReadEntry'); + } + /* c8 ignore stop */ + this.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(header.path); + this.mode = header.mode; + if (this.mode) { + this.mode = this.mode & 0o7777; + } + this.uid = header.uid; + this.gid = header.gid; + this.uname = header.uname; + this.gname = header.gname; + this.size = this.remain; + this.mtime = header.mtime; + this.atime = header.atime; + this.ctime = header.ctime; + /* c8 ignore start */ + this.linkpath = + header.linkpath ? + (0, normalize_windows_path_js_1.normalizeWindowsPath)(header.linkpath) + : undefined; + /* c8 ignore stop */ + this.uname = header.uname; + this.gname = header.gname; + if (ex) { + this.#slurp(ex); + } + if (gex) { + this.#slurp(gex, true); + } + } + write(data) { + const writeLen = data.length; + if (writeLen > this.blockRemain) { + throw new Error('writing more to entry than is appropriate'); + } + const r = this.remain; + const br = this.blockRemain; + this.remain = Math.max(0, r - writeLen); + this.blockRemain = Math.max(0, br - writeLen); + if (this.ignore) { + return true; + } + if (r >= writeLen) { + return super.write(data); + } + // r < writeLen + return super.write(data.subarray(0, r)); + } + #slurp(ex, gex = false) { + if (ex.path) + ex.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(ex.path); + if (ex.linkpath) + ex.linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(ex.linkpath); + Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => { + // we slurp in everything except for the path attribute in + // a global extended header, because that's weird. Also, any + // null/undefined values are ignored. + return !(v === null || + v === undefined || + (k === 'path' && gex)); + }))); + } +} +exports.ReadEntry = ReadEntry; +//# sourceMappingURL=read-entry.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/read-entry.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/read-entry.js.map new file mode 100644 index 0000000..8fc8c1d --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/read-entry.js.map @@ -0,0 +1 @@ +{"version":3,"file":"read-entry.js","sourceRoot":"","sources":["../../src/read-entry.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AAEnC,2EAAkE;AAIlE,MAAa,SAAU,SAAQ,mBAAwB;IACrD,QAAQ,CAAM;IACd,cAAc,CAAM;IACpB,MAAM,CAAQ;IACd,cAAc,CAAQ;IACtB,WAAW,CAAQ;IACnB,MAAM,CAAQ;IACd,IAAI,CAAe;IACnB,IAAI,GAAY,KAAK,CAAA;IACrB,MAAM,GAAY,KAAK,CAAA;IACvB,IAAI,CAAQ;IACZ,IAAI,CAAS;IACb,GAAG,CAAS;IACZ,GAAG,CAAS;IACZ,KAAK,CAAS;IACd,KAAK,CAAS;IACd,IAAI,GAAW,CAAC,CAAA;IAChB,KAAK,CAAO;IACZ,KAAK,CAAO;IACZ,KAAK,CAAO;IACZ,QAAQ,CAAS;IAEjB,GAAG,CAAS;IACZ,GAAG,CAAS;IACZ,KAAK,CAAS;IACd,OAAO,GAAY,KAAK,CAAA;IACxB,QAAQ,CAAS;IACjB,WAAW,GA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CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE;YACnC,0DAA0D;YAC1D,4DAA4D;YAC5D,qCAAqC;YACrC,OAAO,CAAC,CACN,CAAC,KAAK,IAAI;gBACV,CAAC,KAAK,SAAS;gBACf,CAAC,CAAC,KAAK,MAAM,IAAI,GAAG,CAAC,CACtB,CAAA;QACH,CAAC,CAAC,CACH,CACF,CAAA;IACH,CAAC;CACF;AArJD,8BAqJC","sourcesContent":["import { Minipass } from 'minipass'\nimport { Header } from './header.js'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport { Pax } from './pax.js'\nimport { EntryTypeName } from './types.js'\n\nexport class ReadEntry extends Minipass {\n extended?: Pax\n globalExtended?: Pax\n header: Header\n startBlockSize: number\n blockRemain: number\n remain: number\n type: EntryTypeName\n meta: boolean = false\n ignore: boolean = false\n path: string\n mode?: number\n uid?: number\n gid?: number\n uname?: string\n gname?: string\n size: number = 0\n mtime?: Date\n atime?: Date\n ctime?: Date\n linkpath?: string\n\n dev?: number\n ino?: number\n nlink?: number\n invalid: boolean = false\n absolute?: string\n unsupported: boolean = false\n\n constructor(header: Header, ex?: Pax, gex?: Pax) {\n super({})\n // read entries always start life paused. this is to avoid the\n // situation where Minipass's auto-ending empty streams results\n // in an entry ending before we're ready for it.\n this.pause()\n this.extended = ex\n this.globalExtended = gex\n this.header = header\n /* c8 ignore start */\n this.remain = header.size ?? 0\n /* c8 ignore stop */\n this.startBlockSize = 512 * Math.ceil(this.remain / 512)\n this.blockRemain = this.startBlockSize\n this.type = header.type\n switch (this.type) {\n case 'File':\n case 'OldFile':\n case 'Link':\n case 'SymbolicLink':\n case 'CharacterDevice':\n case 'BlockDevice':\n case 'Directory':\n case 'FIFO':\n case 'ContiguousFile':\n case 'GNUDumpDir':\n break\n\n case 'NextFileHasLongLinkpath':\n case 'NextFileHasLongPath':\n case 'OldGnuLongPath':\n case 'GlobalExtendedHeader':\n case 'ExtendedHeader':\n case 'OldExtendedHeader':\n this.meta = true\n break\n\n // NOTE: gnutar and bsdtar treat unrecognized types as 'File'\n // it may be worth doing the same, but with a warning.\n default:\n this.ignore = true\n }\n\n /* c8 ignore start */\n if (!header.path) {\n throw new Error('no path provided for tar.ReadEntry')\n }\n /* c8 ignore stop */\n\n this.path = normalizeWindowsPath(header.path) as string\n this.mode = header.mode\n if (this.mode) {\n this.mode = this.mode & 0o7777\n }\n this.uid = header.uid\n this.gid = header.gid\n this.uname = header.uname\n this.gname = header.gname\n this.size = this.remain\n this.mtime = header.mtime\n this.atime = header.atime\n this.ctime = header.ctime\n /* c8 ignore start */\n this.linkpath =\n header.linkpath ?\n normalizeWindowsPath(header.linkpath)\n : undefined\n /* c8 ignore stop */\n this.uname = header.uname\n this.gname = header.gname\n\n if (ex) {\n this.#slurp(ex)\n }\n if (gex) {\n this.#slurp(gex, true)\n }\n }\n\n write(data: Buffer) {\n const writeLen = data.length\n if (writeLen > this.blockRemain) {\n throw new Error('writing more to entry than is appropriate')\n }\n\n const r = this.remain\n const br = this.blockRemain\n this.remain = Math.max(0, r - writeLen)\n this.blockRemain = Math.max(0, br - writeLen)\n if (this.ignore) {\n return true\n }\n\n if (r >= writeLen) {\n return super.write(data)\n }\n\n // r < writeLen\n return super.write(data.subarray(0, r))\n }\n\n #slurp(ex: Pax, gex: boolean = false) {\n if (ex.path) ex.path = normalizeWindowsPath(ex.path)\n if (ex.linkpath) ex.linkpath = normalizeWindowsPath(ex.linkpath)\n Object.assign(\n this,\n Object.fromEntries(\n Object.entries(ex).filter(([k, v]) => {\n // we slurp in everything except for the path attribute in\n // a global extended header, because that's weird. Also, any\n // null/undefined values are ignored.\n return !(\n v === null ||\n v === undefined ||\n (k === 'path' && gex)\n )\n }),\n ),\n )\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/replace.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/replace.d.ts new file mode 100644 index 0000000..8ae4035 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/replace.d.ts @@ -0,0 +1,2 @@ +export declare const replace: import("./make-command.js").TarCommand; +//# sourceMappingURL=replace.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/replace.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/replace.d.ts.map new file mode 100644 index 0000000..24d29cd --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/replace.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"replace.d.ts","sourceRoot":"","sources":["../../src/replace.ts"],"names":[],"mappings":"AA6QA,eAAO,MAAM,OAAO,sDA8BnB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/replace.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/replace.js new file mode 100644 index 0000000..5442c2a --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/replace.js @@ -0,0 +1,232 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.replace = void 0; +// tar -r +const fs_minipass_1 = require("@isaacs/fs-minipass"); +const node_fs_1 = __importDefault(require("node:fs")); +const node_path_1 = __importDefault(require("node:path")); +const header_js_1 = require("./header.js"); +const list_js_1 = require("./list.js"); +const make_command_js_1 = require("./make-command.js"); +const options_js_1 = require("./options.js"); +const pack_js_1 = require("./pack.js"); +// starting at the head of the file, read a Header +// If the checksum is invalid, that's our position to start writing +// If it is, jump forward by the specified size (round up to 512) +// and try again. +// Write the new Pack stream starting there. +const replaceSync = (opt, files) => { + const p = new pack_js_1.PackSync(opt); + let threw = true; + let fd; + let position; + try { + try { + fd = node_fs_1.default.openSync(opt.file, 'r+'); + } + catch (er) { + if (er?.code === 'ENOENT') { + fd = node_fs_1.default.openSync(opt.file, 'w+'); + } + else { + throw er; + } + } + const st = node_fs_1.default.fstatSync(fd); + const headBuf = Buffer.alloc(512); + POSITION: for (position = 0; position < st.size; position += 512) { + for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) { + bytes = node_fs_1.default.readSync(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos); + if (position === 0 && + headBuf[0] === 0x1f && + headBuf[1] === 0x8b) { + throw new Error('cannot append to compressed archives'); + } + if (!bytes) { + break POSITION; + } + } + const h = new header_js_1.Header(headBuf); + if (!h.cksumValid) { + break; + } + const entryBlockSize = 512 * Math.ceil((h.size || 0) / 512); + if (position + entryBlockSize + 512 > st.size) { + break; + } + // the 512 for the header we just parsed will be added as well + // also jump ahead all the blocks for the body + position += entryBlockSize; + if (opt.mtimeCache && h.mtime) { + opt.mtimeCache.set(String(h.path), h.mtime); + } + } + threw = false; + streamSync(opt, p, position, fd, files); + } + finally { + if (threw) { + try { + node_fs_1.default.closeSync(fd); + } + catch (er) { } + } + } +}; +const streamSync = (opt, p, position, fd, files) => { + const stream = new fs_minipass_1.WriteStreamSync(opt.file, { + fd: fd, + start: position, + }); + p.pipe(stream); + addFilesSync(p, files); +}; +const replaceAsync = (opt, files) => { + files = Array.from(files); + const p = new pack_js_1.Pack(opt); + const getPos = (fd, size, cb_) => { + const cb = (er, pos) => { + if (er) { + node_fs_1.default.close(fd, _ => cb_(er)); + } + else { + cb_(null, pos); + } + }; + let position = 0; + if (size === 0) { + return cb(null, 0); + } + let bufPos = 0; + const headBuf = Buffer.alloc(512); + const onread = (er, bytes) => { + if (er || typeof bytes === 'undefined') { + return cb(er); + } + bufPos += bytes; + if (bufPos < 512 && bytes) { + return node_fs_1.default.read(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos, onread); + } + if (position === 0 && + headBuf[0] === 0x1f && + headBuf[1] === 0x8b) { + return cb(new Error('cannot append to compressed archives')); + } + // truncated header + if (bufPos < 512) { + return cb(null, position); + } + const h = new header_js_1.Header(headBuf); + if (!h.cksumValid) { + return cb(null, position); + } + /* c8 ignore next */ + const entryBlockSize = 512 * Math.ceil((h.size ?? 0) / 512); + if (position + entryBlockSize + 512 > size) { + return cb(null, position); + } + position += entryBlockSize + 512; + if (position >= size) { + return cb(null, position); + } + if (opt.mtimeCache && h.mtime) { + opt.mtimeCache.set(String(h.path), h.mtime); + } + bufPos = 0; + node_fs_1.default.read(fd, headBuf, 0, 512, position, onread); + }; + node_fs_1.default.read(fd, headBuf, 0, 512, position, onread); + }; + const promise = new Promise((resolve, reject) => { + p.on('error', reject); + let flag = 'r+'; + const onopen = (er, fd) => { + if (er && er.code === 'ENOENT' && flag === 'r+') { + flag = 'w+'; + return node_fs_1.default.open(opt.file, flag, onopen); + } + if (er || !fd) { + return reject(er); + } + node_fs_1.default.fstat(fd, (er, st) => { + if (er) { + return node_fs_1.default.close(fd, () => reject(er)); + } + getPos(fd, st.size, (er, position) => { + if (er) { + return reject(er); + } + const stream = new fs_minipass_1.WriteStream(opt.file, { + fd: fd, + start: position, + }); + p.pipe(stream); + stream.on('error', reject); + stream.on('close', resolve); + addFilesAsync(p, files); + }); + }); + }; + node_fs_1.default.open(opt.file, flag, onopen); + }); + return promise; +}; +const addFilesSync = (p, files) => { + files.forEach(file => { + if (file.charAt(0) === '@') { + (0, list_js_1.list)({ + file: node_path_1.default.resolve(p.cwd, file.slice(1)), + sync: true, + noResume: true, + onReadEntry: entry => p.add(entry), + }); + } + else { + p.add(file); + } + }); + p.end(); +}; +const addFilesAsync = async (p, files) => { + for (let i = 0; i < files.length; i++) { + const file = String(files[i]); + if (file.charAt(0) === '@') { + await (0, list_js_1.list)({ + file: node_path_1.default.resolve(String(p.cwd), file.slice(1)), + noResume: true, + onReadEntry: entry => p.add(entry), + }); + } + else { + p.add(file); + } + } + p.end(); +}; +exports.replace = (0, make_command_js_1.makeCommand)(replaceSync, replaceAsync, +/* c8 ignore start */ +() => { + throw new TypeError('file is required'); +}, () => { + throw new TypeError('file is required'); +}, +/* c8 ignore stop */ +(opt, entries) => { + if (!(0, options_js_1.isFile)(opt)) { + throw new TypeError('file is required'); + } + if (opt.gzip || + opt.brotli || + opt.zstd || + opt.file.endsWith('.br') || + opt.file.endsWith('.tbr')) { + throw new TypeError('cannot append to compressed archives'); + } + if (!entries?.length) { + throw new TypeError('no paths specified to add/replace'); + } +}); +//# sourceMappingURL=replace.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/replace.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/replace.js.map new file mode 100644 index 0000000..1fefda8 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/replace.js.map @@ -0,0 +1 @@ +{"version":3,"file":"replace.js","sourceRoot":"","sources":["../../src/replace.ts"],"names":[],"mappings":";;;;;;AAAA,SAAS;AACT,qDAAkE;AAElE,sDAAwB;AACxB,0DAA4B;AAC5B,2CAAoC;AACpC,uCAAgC;AAChC,uDAA+C;AAC/C,6CAIqB;AACrB,uCAA0C;AAE1C,kDAAkD;AAClD,mEAAmE;AACnE,iEAAiE;AACjE,iBAAiB;AACjB,4CAA4C;AAE5C,MAAM,WAAW,GAAG,CAAC,GAAuB,EAAE,KAAe,EAAE,EAAE;IAC/D,MAAM,CAAC,GAAG,IAAI,kBAAQ,CAAC,GAAG,CAAC,CAAA;IAE3B,IAAI,KAAK,GAAG,IAAI,CAAA;IAChB,IAAI,EAAE,CAAA;IACN,IAAI,QAAQ,CAAA;IAEZ,IAAI,CAAC;QACH,IAAI,CAAC;YACH,EAAE,GAAG,iBAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC;YACZ,IAAK,EAA4B,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACrD,EAAE,GAAG,iBAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;YAClC,CAAC;iBAAM,CAAC;gBACN,MAAM,EAAE,CAAA;YACV,CAAC;Q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AAE,IAAI;gBACd,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC;aACnC,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACb,CAAC;IACH,CAAC;IACD,CAAC,CAAC,GAAG,EAAE,CAAA;AACT,CAAC,CAAA;AAEY,QAAA,OAAO,GAAG,IAAA,6BAAW,EAChC,WAAW,EACX,YAAY;AACZ,qBAAqB;AACrB,GAAU,EAAE;IACV,MAAM,IAAI,SAAS,CAAC,kBAAkB,CAAC,CAAA;AACzC,CAAC,EACD,GAAU,EAAE;IACV,MAAM,IAAI,SAAS,CAAC,kBAAkB,CAAC,CAAA;AACzC,CAAC;AACD,oBAAoB;AACpB,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;IACf,IAAI,CAAC,IAAA,mBAAM,EAAC,GAAG,CAAC,EAAE,CAAC;QACjB,MAAM,IAAI,SAAS,CAAC,kBAAkB,CAAC,CAAA;IACzC,CAAC;IAED,IACE,GAAG,CAAC,IAAI;QACR,GAAG,CAAC,MAAM;QACV,GAAG,CAAC,IAAI;QACR,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QACxB,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EACzB,CAAC;QACD,MAAM,IAAI,SAAS,CAAC,sCAAsC,CAAC,CAAA;IAC7D,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;QACrB,MAAM,IAAI,SAAS,CAAC,mCAAmC,CAAC,CAAA;IAC1D,CAAC;AACH,CAAC,CACF,CAAA","sourcesContent":["// tar -r\nimport { WriteStream, WriteStreamSync } from '@isaacs/fs-minipass'\nimport { Minipass } from 'minipass'\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { Header } from './header.js'\nimport { list } from './list.js'\nimport { makeCommand } from './make-command.js'\nimport {\n isFile,\n TarOptionsFile,\n TarOptionsSyncFile,\n} from './options.js'\nimport { Pack, PackSync } from './pack.js'\n\n// starting at the head of the file, read a Header\n// If the checksum is invalid, that's our position to start writing\n// If it is, jump forward by the specified size (round up to 512)\n// and try again.\n// Write the new Pack stream starting there.\n\nconst replaceSync = (opt: TarOptionsSyncFile, files: string[]) => {\n const p = new PackSync(opt)\n\n let threw = true\n let fd\n let position\n\n try {\n try {\n fd = fs.openSync(opt.file, 'r+')\n } catch (er) {\n if ((er as NodeJS.ErrnoException)?.code === 'ENOENT') {\n fd = fs.openSync(opt.file, 'w+')\n } else {\n throw er\n }\n }\n\n const st = fs.fstatSync(fd)\n const headBuf = Buffer.alloc(512)\n\n POSITION: for (\n position = 0;\n position < st.size;\n position += 512\n ) {\n for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) {\n bytes = fs.readSync(\n fd,\n headBuf,\n bufPos,\n headBuf.length - bufPos,\n position + bufPos,\n )\n\n if (\n position === 0 &&\n headBuf[0] === 0x1f &&\n headBuf[1] === 0x8b\n ) {\n throw new Error('cannot append to compressed archives')\n }\n\n if (!bytes) {\n break POSITION\n }\n }\n\n const h = new Header(headBuf)\n if (!h.cksumValid) {\n break\n }\n const entryBlockSize = 512 * Math.ceil((h.size || 0) / 512)\n if (position + entryBlockSize + 512 > st.size) {\n break\n }\n // the 512 for the header we just parsed will be added as well\n // also jump ahead all the blocks for the body\n position += entryBlockSize\n if (opt.mtimeCache && h.mtime) {\n opt.mtimeCache.set(String(h.path), h.mtime)\n }\n }\n threw = false\n\n streamSync(opt, p, position, fd, files)\n } finally {\n if (threw) {\n try {\n fs.closeSync(fd as number)\n } catch (er) {}\n }\n }\n}\n\nconst streamSync = (\n opt: TarOptionsSyncFile,\n p: Pack,\n position: number,\n fd: number,\n files: string[],\n) => {\n const stream = new WriteStreamSync(opt.file, {\n fd: fd,\n start: position,\n })\n p.pipe(stream as unknown as Minipass.Writable)\n addFilesSync(p, files)\n}\n\nconst replaceAsync = (\n opt: TarOptionsFile,\n files: string[],\n): Promise => {\n files = Array.from(files)\n const p = new Pack(opt)\n\n const getPos = (\n fd: number,\n size: number,\n cb_: (er?: null | Error, pos?: number) => void,\n ) => {\n const cb = (er?: Error | null, pos?: number) => {\n if (er) {\n fs.close(fd, _ => cb_(er))\n } else {\n cb_(null, pos)\n }\n }\n\n let position = 0\n if (size === 0) {\n return cb(null, 0)\n }\n\n let bufPos = 0\n const headBuf = Buffer.alloc(512)\n const onread = (er?: null | Error, bytes?: number): void => {\n if (er || typeof bytes === 'undefined') {\n return cb(er)\n }\n bufPos += bytes\n if (bufPos < 512 && bytes) {\n return fs.read(\n fd,\n headBuf,\n bufPos,\n headBuf.length - bufPos,\n position + bufPos,\n onread,\n )\n }\n\n if (\n position === 0 &&\n headBuf[0] === 0x1f &&\n headBuf[1] === 0x8b\n ) {\n return cb(new Error('cannot append to compressed archives'))\n }\n\n // truncated header\n if (bufPos < 512) {\n return cb(null, position)\n }\n\n const h = new Header(headBuf)\n if (!h.cksumValid) {\n return cb(null, position)\n }\n\n /* c8 ignore next */\n const entryBlockSize = 512 * Math.ceil((h.size ?? 0) / 512)\n if (position + entryBlockSize + 512 > size) {\n return cb(null, position)\n }\n\n position += entryBlockSize + 512\n if (position >= size) {\n return cb(null, position)\n }\n\n if (opt.mtimeCache && h.mtime) {\n opt.mtimeCache.set(String(h.path), h.mtime)\n }\n bufPos = 0\n fs.read(fd, headBuf, 0, 512, position, onread)\n }\n fs.read(fd, headBuf, 0, 512, position, onread)\n }\n\n const promise = new Promise((resolve, reject) => {\n p.on('error', reject)\n let flag = 'r+'\n const onopen = (\n er?: NodeJS.ErrnoException | null,\n fd?: number,\n ) => {\n if (er && er.code === 'ENOENT' && flag === 'r+') {\n flag = 'w+'\n return fs.open(opt.file, flag, onopen)\n }\n\n if (er || !fd) {\n return reject(er)\n }\n\n fs.fstat(fd, (er, st) => {\n if (er) {\n return fs.close(fd, () => reject(er))\n }\n\n getPos(fd, st.size, (er, position) => {\n if (er) {\n return reject(er)\n }\n const stream = new WriteStream(opt.file, {\n fd: fd,\n start: position,\n })\n p.pipe(stream as unknown as Minipass.Writable)\n stream.on('error', reject)\n stream.on('close', resolve)\n addFilesAsync(p, files)\n })\n })\n }\n fs.open(opt.file, flag, onopen)\n })\n\n return promise\n}\n\nconst addFilesSync = (p: Pack, files: string[]) => {\n files.forEach(file => {\n if (file.charAt(0) === '@') {\n list({\n file: path.resolve(p.cwd, file.slice(1)),\n sync: true,\n noResume: true,\n onReadEntry: entry => p.add(entry),\n })\n } else {\n p.add(file)\n }\n })\n p.end()\n}\n\nconst addFilesAsync = async (\n p: Pack,\n files: string[],\n): Promise => {\n for (let i = 0; i < files.length; i++) {\n const file = String(files[i])\n if (file.charAt(0) === '@') {\n await list({\n file: path.resolve(String(p.cwd), file.slice(1)),\n noResume: true,\n onReadEntry: entry => p.add(entry),\n })\n } else {\n p.add(file)\n }\n }\n p.end()\n}\n\nexport const replace = makeCommand(\n replaceSync,\n replaceAsync,\n /* c8 ignore start */\n (): never => {\n throw new TypeError('file is required')\n },\n (): never => {\n throw new TypeError('file is required')\n },\n /* c8 ignore stop */\n (opt, entries) => {\n if (!isFile(opt)) {\n throw new TypeError('file is required')\n }\n\n if (\n opt.gzip ||\n opt.brotli ||\n opt.zstd ||\n opt.file.endsWith('.br') ||\n opt.file.endsWith('.tbr')\n ) {\n throw new TypeError('cannot append to compressed archives')\n }\n\n if (!entries?.length) {\n throw new TypeError('no paths specified to add/replace')\n }\n },\n)\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts new file mode 100644 index 0000000..170ce2c --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts @@ -0,0 +1,2 @@ +export declare const stripAbsolutePath: (path: string) => string[]; +//# sourceMappingURL=strip-absolute-path.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts.map new file mode 100644 index 0000000..7e5b3c2 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"strip-absolute-path.d.ts","sourceRoot":"","sources":["../../src/strip-absolute-path.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,aAgB7C,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-absolute-path.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-absolute-path.js new file mode 100644 index 0000000..bb7639c --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-absolute-path.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.stripAbsolutePath = void 0; +// unix absolute paths are also absolute on win32, so we use this for both +const node_path_1 = require("node:path"); +const { isAbsolute, parse } = node_path_1.win32; +// returns [root, stripped] +// Note that windows will think that //x/y/z/a has a "root" of //x/y, and in +// those cases, we want to sanitize it to x/y/z/a, not z/a, so we strip / +// explicitly if it's the first character. +// drive-specific relative paths on Windows get their root stripped off even +// though they are not absolute, so `c:../foo` becomes ['c:', '../foo'] +const stripAbsolutePath = (path) => { + let r = ''; + let parsed = parse(path); + while (isAbsolute(path) || parsed.root) { + // windows will think that //x/y/z has a "root" of //x/y/ + // but strip the //?/C:/ off of //?/C:/path + const root = path.charAt(0) === '/' && path.slice(0, 4) !== '//?/' ? + '/' + : parsed.root; + path = path.slice(root.length); + r += root; + parsed = parse(path); + } + return [r, path]; +}; +exports.stripAbsolutePath = stripAbsolutePath; +//# sourceMappingURL=strip-absolute-path.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-absolute-path.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-absolute-path.js.map new file mode 100644 index 0000000..75e5620 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-absolute-path.js.map @@ -0,0 +1 @@ +{"version":3,"file":"strip-absolute-path.js","sourceRoot":"","sources":["../../src/strip-absolute-path.ts"],"names":[],"mappings":";;;AAAA,0EAA0E;AAC1E,yCAAiC;AACjC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,iBAAK,CAAA;AAEnC,2BAA2B;AAC3B,4EAA4E;AAC5E,yEAAyE;AACzE,0CAA0C;AAC1C,4EAA4E;AAC5E,uEAAuE;AAChE,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,EAAE;IAChD,IAAI,CAAC,GAAG,EAAE,CAAA;IAEV,IAAI,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;IACxB,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QACvC,yDAAyD;QACzD,2CAA2C;QAC3C,MAAM,IAAI,GACR,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC;YACrD,GAAG;YACL,CAAC,CAAC,MAAM,CAAC,IAAI,CAAA;QACf,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC9B,CAAC,IAAI,IAAI,CAAA;QACT,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;IACtB,CAAC;IACD,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;AAClB,CAAC,CAAA;AAhBY,QAAA,iBAAiB,qBAgB7B","sourcesContent":["// unix absolute paths are also absolute on win32, so we use this for both\nimport { win32 } from 'node:path'\nconst { isAbsolute, parse } = win32\n\n// returns [root, stripped]\n// Note that windows will think that //x/y/z/a has a \"root\" of //x/y, and in\n// those cases, we want to sanitize it to x/y/z/a, not z/a, so we strip /\n// explicitly if it's the first character.\n// drive-specific relative paths on Windows get their root stripped off even\n// though they are not absolute, so `c:../foo` becomes ['c:', '../foo']\nexport const stripAbsolutePath = (path: string) => {\n let r = ''\n\n let parsed = parse(path)\n while (isAbsolute(path) || parsed.root) {\n // windows will think that //x/y/z has a \"root\" of //x/y/\n // but strip the //?/C:/ off of //?/C:/path\n const root =\n path.charAt(0) === '/' && path.slice(0, 4) !== '//?/' ?\n '/'\n : parsed.root\n path = path.slice(root.length)\n r += root\n parsed = parse(path)\n }\n return [r, path]\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts new file mode 100644 index 0000000..dcc4637 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts @@ -0,0 +1,2 @@ +export declare const stripTrailingSlashes: (str: string) => string; +//# sourceMappingURL=strip-trailing-slashes.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts.map new file mode 100644 index 0000000..88ff178 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"strip-trailing-slashes.d.ts","sourceRoot":"","sources":["../../src/strip-trailing-slashes.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,GAAI,KAAK,MAAM,WAQ/C,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-trailing-slashes.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-trailing-slashes.js new file mode 100644 index 0000000..6fa74ad --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-trailing-slashes.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.stripTrailingSlashes = void 0; +// warning: extremely hot code path. +// This has been meticulously optimized for use +// within npm install on large package trees. +// Do not edit without careful benchmarking. +const stripTrailingSlashes = (str) => { + let i = str.length - 1; + let slashesStart = -1; + while (i > -1 && str.charAt(i) === '/') { + slashesStart = i; + i--; + } + return slashesStart === -1 ? str : str.slice(0, slashesStart); +}; +exports.stripTrailingSlashes = stripTrailingSlashes; +//# sourceMappingURL=strip-trailing-slashes.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-trailing-slashes.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-trailing-slashes.js.map new file mode 100644 index 0000000..1c6204d --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/strip-trailing-slashes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"strip-trailing-slashes.js","sourceRoot":"","sources":["../../src/strip-trailing-slashes.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,+CAA+C;AAC/C,6CAA6C;AAC7C,4CAA4C;AACrC,MAAM,oBAAoB,GAAG,CAAC,GAAW,EAAE,EAAE;IAClD,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAA;IACtB,IAAI,YAAY,GAAG,CAAC,CAAC,CAAA;IACrB,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;QACvC,YAAY,GAAG,CAAC,CAAA;QAChB,CAAC,EAAE,CAAA;IACL,CAAC;IACD,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,CAAA;AAC/D,CAAC,CAAA;AARY,QAAA,oBAAoB,wBAQhC","sourcesContent":["// warning: extremely hot code path.\n// This has been meticulously optimized for use\n// within npm install on large package trees.\n// Do not edit without careful benchmarking.\nexport const stripTrailingSlashes = (str: string) => {\n let i = str.length - 1\n let slashesStart = -1\n while (i > -1 && str.charAt(i) === '/') {\n slashesStart = i\n i--\n }\n return slashesStart === -1 ? str : str.slice(0, slashesStart)\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/symlink-error.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/symlink-error.d.ts new file mode 100644 index 0000000..61b400f --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/symlink-error.d.ts @@ -0,0 +1,9 @@ +export declare class SymlinkError extends Error { + path: string; + symlink: string; + syscall: 'symlink'; + code: 'TAR_SYMLINK_ERROR'; + constructor(symlink: string, path: string); + get name(): string; +} +//# sourceMappingURL=symlink-error.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/symlink-error.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/symlink-error.d.ts.map new file mode 100644 index 0000000..5716e8e --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/symlink-error.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"symlink-error.d.ts","sourceRoot":"","sources":["../../src/symlink-error.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,SAAS,CAAY;IAC9B,IAAI,EAAE,mBAAmB,CAAsB;gBACnC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAKzC,IAAI,IAAI,WAEP;CACF"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/symlink-error.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/symlink-error.js new file mode 100644 index 0000000..cc19ac1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/symlink-error.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SymlinkError = void 0; +class SymlinkError extends Error { + path; + symlink; + syscall = 'symlink'; + code = 'TAR_SYMLINK_ERROR'; + constructor(symlink, path) { + super('TAR_SYMLINK_ERROR: Cannot extract through symbolic link'); + this.symlink = symlink; + this.path = path; + } + get name() { + return 'SymlinkError'; + } +} +exports.SymlinkError = SymlinkError; +//# sourceMappingURL=symlink-error.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/symlink-error.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/symlink-error.js.map new file mode 100644 index 0000000..69fb449 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/symlink-error.js.map @@ -0,0 +1 @@ +{"version":3,"file":"symlink-error.js","sourceRoot":"","sources":["../../src/symlink-error.ts"],"names":[],"mappings":";;;AAAA,MAAa,YAAa,SAAQ,KAAK;IACrC,IAAI,CAAQ;IACZ,OAAO,CAAQ;IACf,OAAO,GAAc,SAAS,CAAA;IAC9B,IAAI,GAAwB,mBAAmB,CAAA;IAC/C,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAAC,yDAAyD,CAAC,CAAA;QAChE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IACD,IAAI,IAAI;QACN,OAAO,cAAc,CAAA;IACvB,CAAC;CACF;AAbD,oCAaC","sourcesContent":["export class SymlinkError extends Error {\n path: string\n symlink: string\n syscall: 'symlink' = 'symlink'\n code: 'TAR_SYMLINK_ERROR' = 'TAR_SYMLINK_ERROR'\n constructor(symlink: string, path: string) {\n super('TAR_SYMLINK_ERROR: Cannot extract through symbolic link')\n this.symlink = symlink\n this.path = path\n }\n get name() {\n return 'SymlinkError'\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/types.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/types.d.ts new file mode 100644 index 0000000..a39f054 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/types.d.ts @@ -0,0 +1,7 @@ +export declare const isCode: (c: string) => c is EntryTypeCode; +export declare const isName: (c: string) => c is EntryTypeName; +export type EntryTypeCode = '0' | '' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | 'g' | 'x' | 'A' | 'D' | 'I' | 'K' | 'L' | 'M' | 'N' | 'S' | 'V' | 'X'; +export type EntryTypeName = 'File' | 'OldFile' | 'Link' | 'SymbolicLink' | 'CharacterDevice' | 'BlockDevice' | 'Directory' | 'FIFO' | 'ContiguousFile' | 'GlobalExtendedHeader' | 'ExtendedHeader' | 'SolarisACL' | 'GNUDumpDir' | 'Inode' | 'NextFileHasLongLinkpath' | 'NextFileHasLongPath' | 'ContinuationFile' | 'OldGnuLongPath' | 'SparseFile' | 'TapeVolumeHeader' | 'OldExtendedHeader' | 'Unsupported'; +export declare const name: Map; +export declare const code: Map; +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/types.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/types.d.ts.map new file mode 100644 index 0000000..5de4248 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,KAAG,CAAC,IAAI,aACV,CAAA;AAE9B,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,KAAG,CAAC,IAAI,aACV,CAAA;AAE9B,MAAM,MAAM,aAAa,GACrB,GAAG,GACH,EAAE,GACF,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,CAAA;AAEP,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,SAAS,GACT,MAAM,GACN,cAAc,GACd,iBAAiB,GACjB,aAAa,GACb,WAAW,GACX,MAAM,GACN,gBAAgB,GAChB,sBAAsB,GACtB,gBAAgB,GAChB,YAAY,GACZ,YAAY,GACZ,OAAO,GACP,yBAAyB,GACzB,qBAAqB,GACrB,kBAAkB,GAClB,gBAAgB,GAChB,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,aAAa,CAAA;AAGjB,eAAO,MAAM,IAAI,mCAsCf,CAAA;AAGF,eAAO,MAAM,IAAI,mCAEhB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/types.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/types.js new file mode 100644 index 0000000..cb9b684 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/types.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.code = exports.name = exports.isName = exports.isCode = void 0; +const isCode = (c) => exports.name.has(c); +exports.isCode = isCode; +const isName = (c) => exports.code.has(c); +exports.isName = isName; +// map types from key to human-friendly name +exports.name = new Map([ + ['0', 'File'], + // same as File + ['', 'OldFile'], + ['1', 'Link'], + ['2', 'SymbolicLink'], + // Devices and FIFOs aren't fully supported + // they are parsed, but skipped when unpacking + ['3', 'CharacterDevice'], + ['4', 'BlockDevice'], + ['5', 'Directory'], + ['6', 'FIFO'], + // same as File + ['7', 'ContiguousFile'], + // pax headers + ['g', 'GlobalExtendedHeader'], + ['x', 'ExtendedHeader'], + // vendor-specific stuff + // skip + ['A', 'SolarisACL'], + // like 5, but with data, which should be skipped + ['D', 'GNUDumpDir'], + // metadata only, skip + ['I', 'Inode'], + // data = link path of next file + ['K', 'NextFileHasLongLinkpath'], + // data = path of next file + ['L', 'NextFileHasLongPath'], + // skip + ['M', 'ContinuationFile'], + // like L + ['N', 'OldGnuLongPath'], + // skip + ['S', 'SparseFile'], + // skip + ['V', 'TapeVolumeHeader'], + // like x + ['X', 'OldExtendedHeader'], +]); +// map the other direction +exports.code = new Map(Array.from(exports.name).map(kv => [kv[1], kv[0]])); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/types.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/types.js.map new file mode 100644 index 0000000..34e269f --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAAO,MAAM,MAAM,GAAG,CAAC,CAAS,EAAsB,EAAE,CACtD,YAAI,CAAC,GAAG,CAAC,CAAkB,CAAC,CAAA;AADjB,QAAA,MAAM,UACW;AAEvB,MAAM,MAAM,GAAG,CAAC,CAAS,EAAsB,EAAE,CACtD,YAAI,CAAC,GAAG,CAAC,CAAkB,CAAC,CAAA;AADjB,QAAA,MAAM,UACW;AAiD9B,4CAA4C;AAC/B,QAAA,IAAI,GAAG,IAAI,GAAG,CAA+B;IACxD,CAAC,GAAG,EAAE,MAAM,CAAC;IACb,eAAe;IACf,CAAC,EAAE,EAAE,SAAS,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,cAAc,CAAC;IACrB,2CAA2C;IAC3C,8CAA8C;IAC9C,CAAC,GAAG,EAAE,iBAAiB,CAAC;IACxB,CAAC,GAAG,EAAE,aAAa,CAAC;IACpB,CAAC,GAAG,EAAE,WAAW,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,CAAC;IACb,eAAe;IACf,CAAC,GAAG,EAAE,gBAAgB,CAAC;IACvB,cAAc;IACd,CAAC,GAAG,EAAE,sBAAsB,CAAC;IAC7B,CAAC,GAAG,EAAE,gBAAgB,CAAC;IACvB,wBAAwB;IACxB,OAAO;IACP,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,iDAAiD;IACjD,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,sBAAsB;IACtB,CAAC,GAAG,EAAE,OAAO,CAAC;IACd,gCAAgC;IAChC,CAAC,GAAG,EAAE,yBAAyB,CAAC;IAChC,2BAA2B;IAC3B,CAAC,GAAG,EAAE,qBAAqB,CAAC;IAC5B,OAAO;IACP,CAAC,GAAG,EAAE,kBAAkB,CAAC;IACzB,SAAS;IACT,CAAC,GAAG,EAAE,gBAAgB,CAAC;IACvB,OAAO;IACP,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,OAAO;IACP,CAAC,GAAG,EAAE,kBAAkB,CAAC;IACzB,SAAS;IACT,CAAC,GAAG,EAAE,mBAAmB,CAAC;CAC3B,CAAC,CAAA;AAEF,0BAA0B;AACb,QAAA,IAAI,GAAG,IAAI,GAAG,CACzB,KAAK,CAAC,IAAI,CAAC,YAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAC3C,CAAA","sourcesContent":["export const isCode = (c: string): c is EntryTypeCode =>\n name.has(c as EntryTypeCode)\n\nexport const isName = (c: string): c is EntryTypeName =>\n code.has(c as EntryTypeName)\n\nexport type EntryTypeCode =\n | '0'\n | ''\n | '1'\n | '2'\n | '3'\n | '4'\n | '5'\n | '6'\n | '7'\n | 'g'\n | 'x'\n | 'A'\n | 'D'\n | 'I'\n | 'K'\n | 'L'\n | 'M'\n | 'N'\n | 'S'\n | 'V'\n | 'X'\n\nexport type EntryTypeName =\n | 'File'\n | 'OldFile'\n | 'Link'\n | 'SymbolicLink'\n | 'CharacterDevice'\n | 'BlockDevice'\n | 'Directory'\n | 'FIFO'\n | 'ContiguousFile'\n | 'GlobalExtendedHeader'\n | 'ExtendedHeader'\n | 'SolarisACL'\n | 'GNUDumpDir'\n | 'Inode'\n | 'NextFileHasLongLinkpath'\n | 'NextFileHasLongPath'\n | 'ContinuationFile'\n | 'OldGnuLongPath'\n | 'SparseFile'\n | 'TapeVolumeHeader'\n | 'OldExtendedHeader'\n | 'Unsupported'\n\n// map types from key to human-friendly name\nexport const name = new Map([\n ['0', 'File'],\n // same as File\n ['', 'OldFile'],\n ['1', 'Link'],\n ['2', 'SymbolicLink'],\n // Devices and FIFOs aren't fully supported\n // they are parsed, but skipped when unpacking\n ['3', 'CharacterDevice'],\n ['4', 'BlockDevice'],\n ['5', 'Directory'],\n ['6', 'FIFO'],\n // same as File\n ['7', 'ContiguousFile'],\n // pax headers\n ['g', 'GlobalExtendedHeader'],\n ['x', 'ExtendedHeader'],\n // vendor-specific stuff\n // skip\n ['A', 'SolarisACL'],\n // like 5, but with data, which should be skipped\n ['D', 'GNUDumpDir'],\n // metadata only, skip\n ['I', 'Inode'],\n // data = link path of next file\n ['K', 'NextFileHasLongLinkpath'],\n // data = path of next file\n ['L', 'NextFileHasLongPath'],\n // skip\n ['M', 'ContinuationFile'],\n // like L\n ['N', 'OldGnuLongPath'],\n // skip\n ['S', 'SparseFile'],\n // skip\n ['V', 'TapeVolumeHeader'],\n // like x\n ['X', 'OldExtendedHeader'],\n])\n\n// map the other direction\nexport const code = new Map(\n Array.from(name).map(kv => [kv[1], kv[0]]),\n)\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/unpack.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/unpack.d.ts new file mode 100644 index 0000000..924bdad --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/unpack.d.ts @@ -0,0 +1,101 @@ +import { type Stats } from 'node:fs'; +import { MkdirError } from './mkdir.js'; +import { Parser } from './parse.js'; +import { TarOptions } from './options.js'; +import { PathReservations } from './path-reservations.js'; +import { ReadEntry } from './read-entry.js'; +import { WarnData } from './warn-method.js'; +import { SymlinkError } from './symlink-error.js'; +declare const ONENTRY: unique symbol; +declare const CHECKFS: unique symbol; +declare const CHECKFS2: unique symbol; +declare const ISREUSABLE: unique symbol; +declare const MAKEFS: unique symbol; +declare const FILE: unique symbol; +declare const DIRECTORY: unique symbol; +declare const LINK: unique symbol; +declare const SYMLINK: unique symbol; +declare const HARDLINK: unique symbol; +declare const ENSURE_NO_SYMLINK: unique symbol; +declare const UNSUPPORTED: unique symbol; +declare const CHECKPATH: unique symbol; +declare const STRIPABSOLUTEPATH: unique symbol; +declare const MKDIR: unique symbol; +declare const ONERROR: unique symbol; +declare const PENDING: unique symbol; +declare const PEND: unique symbol; +declare const UNPEND: unique symbol; +declare const ENDED: unique symbol; +declare const MAYBECLOSE: unique symbol; +declare const SKIP: unique symbol; +declare const DOCHOWN: unique symbol; +declare const UID: unique symbol; +declare const GID: unique symbol; +declare const CHECKED_CWD: unique symbol; +export declare class Unpack extends Parser { + [ENDED]: boolean; + [CHECKED_CWD]: boolean; + [PENDING]: number; + reservations: PathReservations; + transform?: TarOptions['transform']; + writable: true; + readable: false; + uid?: number; + gid?: number; + setOwner: boolean; + preserveOwner: boolean; + processGid?: number; + processUid?: number; + maxDepth: number; + forceChown: boolean; + win32: boolean; + newer: boolean; + keep: boolean; + noMtime: boolean; + preservePaths: boolean; + unlink: boolean; + cwd: string; + strip: number; + processUmask: number; + umask: number; + dmode: number; + fmode: number; + chmod: boolean; + constructor(opt?: TarOptions); + warn(code: string, msg: string | Error, data?: WarnData): void; + [MAYBECLOSE](): void; + [STRIPABSOLUTEPATH](entry: ReadEntry, field: 'path' | 'linkpath'): boolean; + [CHECKPATH](entry: ReadEntry): boolean; + [ONENTRY](entry: ReadEntry): void; + [ONERROR](er: Error, entry: ReadEntry): void; + [MKDIR](dir: string, mode: number, cb: (er?: null | MkdirError, made?: string) => void): void; + [DOCHOWN](entry: ReadEntry): boolean; + [UID](entry: ReadEntry): number | undefined; + [GID](entry: ReadEntry): number | undefined; + [FILE](entry: ReadEntry, fullyDone: () => void): void; + [DIRECTORY](entry: ReadEntry, fullyDone: () => void): void; + [UNSUPPORTED](entry: ReadEntry): void; + [SYMLINK](entry: ReadEntry, done: () => void): void; + [HARDLINK](entry: ReadEntry, done: () => void): void; + [ENSURE_NO_SYMLINK](entry: ReadEntry, cwd: string, parts: string[], done: () => void, onError: (er: SymlinkError) => void): void; + [PEND](): void; + [UNPEND](): void; + [SKIP](entry: ReadEntry): void; + [ISREUSABLE](entry: ReadEntry, st: Stats): boolean; + [CHECKFS](entry: ReadEntry): void; + [CHECKFS2](entry: ReadEntry, fullyDone: (er?: Error) => void): void; + [MAKEFS](er: null | undefined | Error, entry: ReadEntry, done: () => void): void; + [LINK](entry: ReadEntry, linkpath: string, link: 'link' | 'symlink', done: () => void): void; +} +export declare class UnpackSync extends Unpack { + sync: true; + [MAKEFS](er: null | Error | undefined, entry: ReadEntry): void; + [CHECKFS](entry: ReadEntry): void; + [FILE](entry: ReadEntry, done: () => void): void; + [DIRECTORY](entry: ReadEntry, done: () => void): void; + [MKDIR](dir: string, mode: number): unknown; + [ENSURE_NO_SYMLINK](_entry: ReadEntry, cwd: string, parts: string[], done: () => void, onError: (er: SymlinkError) => void): void; + [LINK](entry: ReadEntry, linkpath: string, link: 'link' | 'symlink', done: () => void): void; +} +export {}; +//# sourceMappingURL=unpack.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/unpack.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/unpack.d.ts.map new file mode 100644 index 0000000..a16d116 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/unpack.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"unpack.d.ts","sourceRoot":"","sources":["../../src/unpack.ts"],"names":[],"mappings":"AASA,OAAW,EAAE,KAAK,KAAK,EAAE,MAAM,SAAS,CAAA;AAGxC,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AAI,EAAE,MAAM,GAAG,SAAS,EACxB,IAAI,EAAE,MAAM,IAAI;CAWnB"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/unpack.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/unpack.js new file mode 100644 index 0000000..dce4653 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/unpack.js @@ -0,0 +1,957 @@ +"use strict"; +// the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet. +// but the path reservations are required to avoid race conditions where +// parallelized unpack ops may mess with one another, due to dependencies +// (like a Link depending on its target) or destructive operations (like +// clobbering an fs object to create one of a different type.) +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.UnpackSync = exports.Unpack = void 0; +const fsm = __importStar(require("@isaacs/fs-minipass")); +const node_assert_1 = __importDefault(require("node:assert")); +const node_crypto_1 = require("node:crypto"); +const node_fs_1 = __importDefault(require("node:fs")); +const node_path_1 = __importDefault(require("node:path")); +const get_write_flag_js_1 = require("./get-write-flag.js"); +const mkdir_js_1 = require("./mkdir.js"); +const normalize_windows_path_js_1 = require("./normalize-windows-path.js"); +const parse_js_1 = require("./parse.js"); +const strip_absolute_path_js_1 = require("./strip-absolute-path.js"); +const wc = __importStar(require("./winchars.js")); +const path_reservations_js_1 = require("./path-reservations.js"); +const symlink_error_js_1 = require("./symlink-error.js"); +const process_umask_js_1 = require("./process-umask.js"); +const ONENTRY = Symbol('onEntry'); +const CHECKFS = Symbol('checkFs'); +const CHECKFS2 = Symbol('checkFs2'); +const ISREUSABLE = Symbol('isReusable'); +const MAKEFS = Symbol('makeFs'); +const FILE = Symbol('file'); +const DIRECTORY = Symbol('directory'); +const LINK = Symbol('link'); +const SYMLINK = Symbol('symlink'); +const HARDLINK = Symbol('hardlink'); +const ENSURE_NO_SYMLINK = Symbol('ensureNoSymlink'); +const UNSUPPORTED = Symbol('unsupported'); +const CHECKPATH = Symbol('checkPath'); +const STRIPABSOLUTEPATH = Symbol('stripAbsolutePath'); +const MKDIR = Symbol('mkdir'); +const ONERROR = Symbol('onError'); +const PENDING = Symbol('pending'); +const PEND = Symbol('pend'); +const UNPEND = Symbol('unpend'); +const ENDED = Symbol('ended'); +const MAYBECLOSE = Symbol('maybeClose'); +const SKIP = Symbol('skip'); +const DOCHOWN = Symbol('doChown'); +const UID = Symbol('uid'); +const GID = Symbol('gid'); +const CHECKED_CWD = Symbol('checkedCwd'); +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; +const isWindows = platform === 'win32'; +const DEFAULT_MAX_DEPTH = 1024; +// Unlinks on Windows are not atomic. +// +// This means that if you have a file entry, followed by another +// file entry with an identical name, and you cannot re-use the file +// (because it's a hardlink, or because unlink:true is set, or it's +// Windows, which does not have useful nlink values), then the unlink +// will be committed to the disk AFTER the new file has been written +// over the old one, deleting the new file. +// +// To work around this, on Windows systems, we rename the file and then +// delete the renamed file. It's a sloppy kludge, but frankly, I do not +// know of a better way to do this, given windows' non-atomic unlink +// semantics. +// +// See: https://github.com/npm/node-tar/issues/183 +/* c8 ignore start */ +const unlinkFile = (path, cb) => { + if (!isWindows) { + return node_fs_1.default.unlink(path, cb); + } + const name = path + '.DELETE.' + (0, node_crypto_1.randomBytes)(16).toString('hex'); + node_fs_1.default.rename(path, name, er => { + if (er) { + return cb(er); + } + node_fs_1.default.unlink(name, cb); + }); +}; +/* c8 ignore stop */ +/* c8 ignore start */ +const unlinkFileSync = (path) => { + if (!isWindows) { + return node_fs_1.default.unlinkSync(path); + } + const name = path + '.DELETE.' + (0, node_crypto_1.randomBytes)(16).toString('hex'); + node_fs_1.default.renameSync(path, name); + node_fs_1.default.unlinkSync(name); +}; +/* c8 ignore stop */ +// this.gid, entry.gid, this.processUid +const uint32 = (a, b, c) => a !== undefined && a === a >>> 0 ? a + : b !== undefined && b === b >>> 0 ? b + : c; +class Unpack extends parse_js_1.Parser { + [ENDED] = false; + [CHECKED_CWD] = false; + [PENDING] = 0; + reservations = new path_reservations_js_1.PathReservations(); + transform; + writable = true; + readable = false; + uid; + gid; + setOwner; + preserveOwner; + processGid; + processUid; + maxDepth; + forceChown; + win32; + newer; + keep; + noMtime; + preservePaths; + unlink; + cwd; + strip; + processUmask; + umask; + dmode; + fmode; + chmod; + constructor(opt = {}) { + opt.ondone = () => { + this[ENDED] = true; + this[MAYBECLOSE](); + }; + super(opt); + this.transform = opt.transform; + this.chmod = !!opt.chmod; + if (typeof opt.uid === 'number' || typeof opt.gid === 'number') { + // need both or neither + if (typeof opt.uid !== 'number' || + typeof opt.gid !== 'number') { + throw new TypeError('cannot set owner without number uid and gid'); + } + if (opt.preserveOwner) { + throw new TypeError('cannot preserve owner in archive and also set owner explicitly'); + } + this.uid = opt.uid; + this.gid = opt.gid; + this.setOwner = true; + } + else { + this.uid = undefined; + this.gid = undefined; + this.setOwner = false; + } + // default true for root + if (opt.preserveOwner === undefined && + typeof opt.uid !== 'number') { + this.preserveOwner = !!(process.getuid && process.getuid() === 0); + } + else { + this.preserveOwner = !!opt.preserveOwner; + } + this.processUid = + (this.preserveOwner || this.setOwner) && process.getuid ? + process.getuid() + : undefined; + this.processGid = + (this.preserveOwner || this.setOwner) && process.getgid ? + process.getgid() + : undefined; + // prevent excessively deep nesting of subfolders + // set to `Infinity` to remove this restriction + this.maxDepth = + typeof opt.maxDepth === 'number' ? + opt.maxDepth + : DEFAULT_MAX_DEPTH; + // mostly just for testing, but useful in some cases. + // Forcibly trigger a chown on every entry, no matter what + this.forceChown = opt.forceChown === true; + // turn > this[ONENTRY](entry)); + } + // a bad or damaged archive is a warning for Parser, but an error + // when extracting. Mark those errors as unrecoverable, because + // the Unpack contract cannot be met. + warn(code, msg, data = {}) { + if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') { + data.recoverable = false; + } + return super.warn(code, msg, data); + } + [MAYBECLOSE]() { + if (this[ENDED] && this[PENDING] === 0) { + this.emit('prefinish'); + this.emit('finish'); + this.emit('end'); + } + } + // return false if we need to skip this file + // return true if the field was successfully sanitized + [STRIPABSOLUTEPATH](entry, field) { + const p = entry[field]; + const { type } = entry; + if (!p || this.preservePaths) + return true; + const parts = p.split('/'); + if (parts.includes('..') || + /* c8 ignore next */ + (isWindows && /^[a-z]:\.\.$/i.test(parts[0] ?? ''))) { + // For linkpath, check if the resolved path escapes cwd rather than + // just rejecting any path with '..' - relative symlinks like + // '../sibling/file' are valid if they resolve within the cwd. + // For paths, they just simply may not ever use .. at all. + if (field === 'path' || type === 'Link') { + this.warn('TAR_ENTRY_ERROR', `${field} contains '..'`, { + entry, + [field]: p, + }); + // not ok! + return false; + } + else { + // Resolve linkpath relative to the entry's directory. + // `path.posix` is safe to use because we're operating on + // tar paths, not a filesystem. + const entryDir = node_path_1.default.posix.dirname(entry.path); + const resolved = node_path_1.default.posix.normalize(node_path_1.default.posix.join(entryDir, p)); + // If the resolved path escapes (starts with ..), reject it + if (resolved.startsWith('../') || resolved === '..') { + this.warn('TAR_ENTRY_ERROR', `${field} escapes extraction directory`, { + entry, + [field]: p, + }); + return false; + } + } + } + // strip off the root + const [root, stripped] = (0, strip_absolute_path_js_1.stripAbsolutePath)(p); + if (root) { + // ok, but triggers warning about stripping root + entry[field] = String(stripped); + this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute ${field}`, { + entry, + [field]: p, + }); + } + return true; + } + // no IO, just string checking for absolute indicators + [CHECKPATH](entry) { + const p = (0, normalize_windows_path_js_1.normalizeWindowsPath)(entry.path); + const parts = p.split('/'); + if (this.strip) { + if (parts.length < this.strip) { + return false; + } + if (entry.type === 'Link') { + const linkparts = (0, normalize_windows_path_js_1.normalizeWindowsPath)(String(entry.linkpath)).split('/'); + if (linkparts.length >= this.strip) { + entry.linkpath = linkparts.slice(this.strip).join('/'); + } + else { + return false; + } + } + parts.splice(0, this.strip); + entry.path = parts.join('/'); + } + if (isFinite(this.maxDepth) && parts.length > this.maxDepth) { + this.warn('TAR_ENTRY_ERROR', 'path excessively deep', { + entry, + path: p, + depth: parts.length, + maxDepth: this.maxDepth, + }); + return false; + } + if (!this[STRIPABSOLUTEPATH](entry, 'path') || + !this[STRIPABSOLUTEPATH](entry, 'linkpath')) { + return false; + } + if (node_path_1.default.isAbsolute(entry.path)) { + entry.absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(entry.path)); + } + else { + entry.absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(this.cwd, entry.path)); + } + // if we somehow ended up with a path that escapes the cwd, and we are + // not in preservePaths mode, then something is fishy! This should have + // been prevented above, so ignore this for coverage. + /* c8 ignore start - defense in depth */ + if (!this.preservePaths && + typeof entry.absolute === 'string' && + entry.absolute.indexOf(this.cwd + '/') !== 0 && + entry.absolute !== this.cwd) { + this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', { + entry, + path: (0, normalize_windows_path_js_1.normalizeWindowsPath)(entry.path), + resolvedPath: entry.absolute, + cwd: this.cwd, + }); + return false; + } + /* c8 ignore stop */ + // an archive can set properties on the extraction directory, but it + // may not replace the cwd with a different kind of thing entirely. + if (entry.absolute === this.cwd && + entry.type !== 'Directory' && + entry.type !== 'GNUDumpDir') { + return false; + } + // only encode : chars that aren't drive letter indicators + if (this.win32) { + const { root: aRoot } = node_path_1.default.win32.parse(String(entry.absolute)); + entry.absolute = + aRoot + wc.encode(String(entry.absolute).slice(aRoot.length)); + const { root: pRoot } = node_path_1.default.win32.parse(entry.path); + entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length)); + } + return true; + } + [ONENTRY](entry) { + if (!this[CHECKPATH](entry)) { + return entry.resume(); + } + node_assert_1.default.equal(typeof entry.absolute, 'string'); + switch (entry.type) { + case 'Directory': + case 'GNUDumpDir': + if (entry.mode) { + entry.mode = entry.mode | 0o700; + } + // eslint-disable-next-line no-fallthrough + case 'File': + case 'OldFile': + case 'ContiguousFile': + case 'Link': + case 'SymbolicLink': + return this[CHECKFS](entry); + case 'CharacterDevice': + case 'BlockDevice': + case 'FIFO': + default: + return this[UNSUPPORTED](entry); + } + } + [ONERROR](er, entry) { + // Cwd has to exist, or else nothing works. That's serious. + // Other errors are warnings, which raise the error in strict + // mode, but otherwise continue on. + if (er.name === 'CwdError') { + this.emit('error', er); + } + else { + this.warn('TAR_ENTRY_ERROR', er, { entry }); + this[UNPEND](); + entry.resume(); + } + } + [MKDIR](dir, mode, cb) { + (0, mkdir_js_1.mkdir)((0, normalize_windows_path_js_1.normalizeWindowsPath)(dir), { + uid: this.uid, + gid: this.gid, + processUid: this.processUid, + processGid: this.processGid, + umask: this.processUmask, + preserve: this.preservePaths, + unlink: this.unlink, + cwd: this.cwd, + mode: mode, + }, cb); + } + [DOCHOWN](entry) { + // in preserve owner mode, chown if the entry doesn't match process + // in set owner mode, chown if setting doesn't match process + return (this.forceChown || + (this.preserveOwner && + ((typeof entry.uid === 'number' && + entry.uid !== this.processUid) || + (typeof entry.gid === 'number' && + entry.gid !== this.processGid))) || + (typeof this.uid === 'number' && + this.uid !== this.processUid) || + (typeof this.gid === 'number' && this.gid !== this.processGid)); + } + [UID](entry) { + return uint32(this.uid, entry.uid, this.processUid); + } + [GID](entry) { + return uint32(this.gid, entry.gid, this.processGid); + } + [FILE](entry, fullyDone) { + const mode = typeof entry.mode === 'number' ? + entry.mode & 0o7777 + : this.fmode; + const stream = new fsm.WriteStream(String(entry.absolute), { + // slight lie, but it can be numeric flags + flags: (0, get_write_flag_js_1.getWriteFlag)(entry.size), + mode: mode, + autoClose: false, + }); + stream.on('error', (er) => { + if (stream.fd) { + node_fs_1.default.close(stream.fd, () => { }); + } + // flush all the data out so that we aren't left hanging + // if the error wasn't actually fatal. otherwise the parse + // is blocked, and we never proceed. + stream.write = () => true; + this[ONERROR](er, entry); + fullyDone(); + }); + let actions = 1; + const done = (er) => { + if (er) { + /* c8 ignore start - we should always have a fd by now */ + if (stream.fd) { + node_fs_1.default.close(stream.fd, () => { }); + } + /* c8 ignore stop */ + this[ONERROR](er, entry); + fullyDone(); + return; + } + if (--actions === 0) { + if (stream.fd !== undefined) { + node_fs_1.default.close(stream.fd, er => { + if (er) { + this[ONERROR](er, entry); + } + else { + this[UNPEND](); + } + fullyDone(); + }); + } + } + }; + stream.on('finish', () => { + // if futimes fails, try utimes + // if utimes fails, fail with the original error + // same for fchown/chown + const abs = String(entry.absolute); + const fd = stream.fd; + if (typeof fd === 'number' && entry.mtime && !this.noMtime) { + actions++; + const atime = entry.atime || new Date(); + const mtime = entry.mtime; + node_fs_1.default.futimes(fd, atime, mtime, er => er ? + node_fs_1.default.utimes(abs, atime, mtime, er2 => done(er2 && er)) + : done()); + } + if (typeof fd === 'number' && this[DOCHOWN](entry)) { + actions++; + const uid = this[UID](entry); + const gid = this[GID](entry); + if (typeof uid === 'number' && typeof gid === 'number') { + node_fs_1.default.fchown(fd, uid, gid, er => er ? + node_fs_1.default.chown(abs, uid, gid, er2 => done(er2 && er)) + : done()); + } + } + done(); + }); + const tx = this.transform ? this.transform(entry) || entry : entry; + if (tx !== entry) { + tx.on('error', (er) => { + this[ONERROR](er, entry); + fullyDone(); + }); + entry.pipe(tx); + } + tx.pipe(stream); + } + [DIRECTORY](entry, fullyDone) { + const mode = typeof entry.mode === 'number' ? + entry.mode & 0o7777 + : this.dmode; + this[MKDIR](String(entry.absolute), mode, er => { + if (er) { + this[ONERROR](er, entry); + fullyDone(); + return; + } + let actions = 1; + const done = () => { + if (--actions === 0) { + fullyDone(); + this[UNPEND](); + entry.resume(); + } + }; + if (entry.mtime && !this.noMtime) { + actions++; + node_fs_1.default.utimes(String(entry.absolute), entry.atime || new Date(), entry.mtime, done); + } + if (this[DOCHOWN](entry)) { + actions++; + node_fs_1.default.chown(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry)), done); + } + done(); + }); + } + [UNSUPPORTED](entry) { + entry.unsupported = true; + this.warn('TAR_ENTRY_UNSUPPORTED', `unsupported entry type: ${entry.type}`, { entry }); + entry.resume(); + } + [SYMLINK](entry, done) { + const parts = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.relative(this.cwd, node_path_1.default.resolve(node_path_1.default.dirname(String(entry.absolute)), String(entry.linkpath)))).split('/'); + this[ENSURE_NO_SYMLINK](entry, this.cwd, parts, () => this[LINK](entry, String(entry.linkpath), 'symlink', done), er => { + this[ONERROR](er, entry); + done(); + }); + } + [HARDLINK](entry, done) { + const linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(this.cwd, String(entry.linkpath))); + const parts = (0, normalize_windows_path_js_1.normalizeWindowsPath)(String(entry.linkpath)).split('/'); + this[ENSURE_NO_SYMLINK](entry, this.cwd, parts, () => this[LINK](entry, linkpath, 'link', done), er => { + this[ONERROR](er, entry); + done(); + }); + } + [ENSURE_NO_SYMLINK](entry, cwd, parts, done, onError) { + const p = parts.shift(); + if (this.preservePaths || p === undefined) + return done(); + const t = node_path_1.default.resolve(cwd, p); + node_fs_1.default.lstat(t, (er, st) => { + if (er) + return done(); + if (st?.isSymbolicLink()) { + return onError(new symlink_error_js_1.SymlinkError(t, node_path_1.default.resolve(t, parts.join('/')))); + } + this[ENSURE_NO_SYMLINK](entry, t, parts, done, onError); + }); + } + [PEND]() { + this[PENDING]++; + } + [UNPEND]() { + this[PENDING]--; + this[MAYBECLOSE](); + } + [SKIP](entry) { + this[UNPEND](); + entry.resume(); + } + // Check if we can reuse an existing filesystem entry safely and + // overwrite it, rather than unlinking and recreating + // Windows doesn't report a useful nlink, so we just never reuse entries + [ISREUSABLE](entry, st) { + return (entry.type === 'File' && + !this.unlink && + st.isFile() && + st.nlink <= 1 && + !isWindows); + } + // check if a thing is there, and if so, try to clobber it + [CHECKFS](entry) { + this[PEND](); + const paths = [entry.path]; + if (entry.linkpath) { + paths.push(entry.linkpath); + } + this.reservations.reserve(paths, done => this[CHECKFS2](entry, done)); + } + [CHECKFS2](entry, fullyDone) { + const done = (er) => { + fullyDone(er); + }; + const checkCwd = () => { + this[MKDIR](this.cwd, this.dmode, er => { + if (er) { + this[ONERROR](er, entry); + done(); + return; + } + this[CHECKED_CWD] = true; + start(); + }); + }; + const start = () => { + if (entry.absolute !== this.cwd) { + const parent = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.dirname(String(entry.absolute))); + if (parent !== this.cwd) { + return this[MKDIR](parent, this.dmode, er => { + if (er) { + this[ONERROR](er, entry); + done(); + return; + } + afterMakeParent(); + }); + } + } + afterMakeParent(); + }; + const afterMakeParent = () => { + node_fs_1.default.lstat(String(entry.absolute), (lstatEr, st) => { + if (st && + (this.keep || + /* c8 ignore next */ + (this.newer && st.mtime > (entry.mtime ?? st.mtime)))) { + this[SKIP](entry); + done(); + return; + } + if (lstatEr || this[ISREUSABLE](entry, st)) { + return this[MAKEFS](null, entry, done); + } + if (st.isDirectory()) { + if (entry.type === 'Directory') { + const needChmod = this.chmod && + entry.mode && + (st.mode & 0o7777) !== entry.mode; + const afterChmod = (er) => this[MAKEFS](er ?? null, entry, done); + if (!needChmod) { + return afterChmod(); + } + return node_fs_1.default.chmod(String(entry.absolute), Number(entry.mode), afterChmod); + } + // Not a dir entry, have to remove it. + // NB: the only way to end up with an entry that is the cwd + // itself, in such a way that == does not detect, is a + // tricky windows absolute path with UNC or 8.3 parts (and + // preservePaths:true, or else it will have been stripped). + // In that case, the user has opted out of path protections + // explicitly, so if they blow away the cwd, c'est la vie. + if (entry.absolute !== this.cwd) { + return node_fs_1.default.rmdir(String(entry.absolute), (er) => this[MAKEFS](er ?? null, entry, done)); + } + } + // not a dir, and not reusable + // don't remove if the cwd, we want that error + if (entry.absolute === this.cwd) { + return this[MAKEFS](null, entry, done); + } + unlinkFile(String(entry.absolute), er => this[MAKEFS](er ?? null, entry, done)); + }); + }; + if (this[CHECKED_CWD]) { + start(); + } + else { + checkCwd(); + } + } + [MAKEFS](er, entry, done) { + if (er) { + this[ONERROR](er, entry); + done(); + return; + } + switch (entry.type) { + case 'File': + case 'OldFile': + case 'ContiguousFile': + return this[FILE](entry, done); + case 'Link': + return this[HARDLINK](entry, done); + case 'SymbolicLink': + return this[SYMLINK](entry, done); + case 'Directory': + case 'GNUDumpDir': + return this[DIRECTORY](entry, done); + } + } + [LINK](entry, linkpath, link, done) { + node_fs_1.default[link](linkpath, String(entry.absolute), er => { + if (er) { + this[ONERROR](er, entry); + } + else { + this[UNPEND](); + entry.resume(); + } + done(); + }); + } +} +exports.Unpack = Unpack; +const callSync = (fn) => { + try { + return [null, fn()]; + } + catch (er) { + return [er, null]; + } +}; +class UnpackSync extends Unpack { + sync = true; + [MAKEFS](er, entry) { + return super[MAKEFS](er, entry, () => { }); + } + [CHECKFS](entry) { + if (!this[CHECKED_CWD]) { + const er = this[MKDIR](this.cwd, this.dmode); + if (er) { + return this[ONERROR](er, entry); + } + this[CHECKED_CWD] = true; + } + // don't bother to make the parent if the current entry is the cwd, + // we've already checked it. + if (entry.absolute !== this.cwd) { + const parent = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.dirname(String(entry.absolute))); + if (parent !== this.cwd) { + const mkParent = this[MKDIR](parent, this.dmode); + if (mkParent) { + return this[ONERROR](mkParent, entry); + } + } + } + const [lstatEr, st] = callSync(() => node_fs_1.default.lstatSync(String(entry.absolute))); + if (st && + (this.keep || + /* c8 ignore next */ + (this.newer && st.mtime > (entry.mtime ?? st.mtime)))) { + return this[SKIP](entry); + } + if (lstatEr || this[ISREUSABLE](entry, st)) { + return this[MAKEFS](null, entry); + } + if (st.isDirectory()) { + if (entry.type === 'Directory') { + const needChmod = this.chmod && + entry.mode && + (st.mode & 0o7777) !== entry.mode; + const [er] = needChmod ? + callSync(() => { + node_fs_1.default.chmodSync(String(entry.absolute), Number(entry.mode)); + }) + : []; + return this[MAKEFS](er, entry); + } + // not a dir entry, have to remove it + const [er] = callSync(() => node_fs_1.default.rmdirSync(String(entry.absolute))); + this[MAKEFS](er, entry); + } + // not a dir, and not reusable. + // don't remove if it's the cwd, since we want that error. + const [er] = entry.absolute === this.cwd ? + [] + : callSync(() => unlinkFileSync(String(entry.absolute))); + this[MAKEFS](er, entry); + } + [FILE](entry, done) { + const mode = typeof entry.mode === 'number' ? + entry.mode & 0o7777 + : this.fmode; + const oner = (er) => { + let closeError; + try { + node_fs_1.default.closeSync(fd); + } + catch (e) { + closeError = e; + } + if (er || closeError) { + this[ONERROR](er || closeError, entry); + } + done(); + }; + let fd; + try { + fd = node_fs_1.default.openSync(String(entry.absolute), (0, get_write_flag_js_1.getWriteFlag)(entry.size), mode); + /* c8 ignore start - This is only a problem if the file was successfully + * statted, BUT failed to open. Testing this is annoying, and we + * already have ample testint for other uses of oner() methods. + */ + } + catch (er) { + return oner(er); + } + /* c8 ignore stop */ + const tx = this.transform ? this.transform(entry) || entry : entry; + if (tx !== entry) { + tx.on('error', (er) => this[ONERROR](er, entry)); + entry.pipe(tx); + } + tx.on('data', (chunk) => { + try { + node_fs_1.default.writeSync(fd, chunk, 0, chunk.length); + } + catch (er) { + oner(er); + } + }); + tx.on('end', () => { + let er = null; + // try both, falling futimes back to utimes + // if either fails, handle the first error + if (entry.mtime && !this.noMtime) { + const atime = entry.atime || new Date(); + const mtime = entry.mtime; + try { + node_fs_1.default.futimesSync(fd, atime, mtime); + } + catch (futimeser) { + try { + node_fs_1.default.utimesSync(String(entry.absolute), atime, mtime); + } + catch (utimeser) { + er = futimeser; + } + } + } + if (this[DOCHOWN](entry)) { + const uid = this[UID](entry); + const gid = this[GID](entry); + try { + node_fs_1.default.fchownSync(fd, Number(uid), Number(gid)); + } + catch (fchowner) { + try { + node_fs_1.default.chownSync(String(entry.absolute), Number(uid), Number(gid)); + } + catch (chowner) { + er = er || fchowner; + } + } + } + oner(er); + }); + } + [DIRECTORY](entry, done) { + const mode = typeof entry.mode === 'number' ? + entry.mode & 0o7777 + : this.dmode; + const er = this[MKDIR](String(entry.absolute), mode); + if (er) { + this[ONERROR](er, entry); + done(); + return; + } + if (entry.mtime && !this.noMtime) { + try { + node_fs_1.default.utimesSync(String(entry.absolute), entry.atime || new Date(), entry.mtime); + /* c8 ignore next */ + } + catch (er) { } + } + if (this[DOCHOWN](entry)) { + try { + node_fs_1.default.chownSync(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry))); + } + catch (er) { } + } + done(); + entry.resume(); + } + [MKDIR](dir, mode) { + try { + return (0, mkdir_js_1.mkdirSync)((0, normalize_windows_path_js_1.normalizeWindowsPath)(dir), { + uid: this.uid, + gid: this.gid, + processUid: this.processUid, + processGid: this.processGid, + umask: this.processUmask, + preserve: this.preservePaths, + unlink: this.unlink, + cwd: this.cwd, + mode: mode, + }); + } + catch (er) { + return er; + } + } + [ENSURE_NO_SYMLINK](_entry, cwd, parts, done, onError) { + if (this.preservePaths || !parts.length) + return done(); + let t = cwd; + for (const p of parts) { + t = node_path_1.default.resolve(t, p); + const [er, st] = callSync(() => node_fs_1.default.lstatSync(t)); + if (er) + return done(); + if (st.isSymbolicLink()) { + return onError(new symlink_error_js_1.SymlinkError(t, node_path_1.default.resolve(cwd, parts.join('/')))); + } + } + done(); + } + [LINK](entry, linkpath, link, done) { + const linkSync = `${link}Sync`; + try { + node_fs_1.default[linkSync](linkpath, String(entry.absolute)); + done(); + entry.resume(); + } + catch (er) { + return this[ONERROR](er, entry); + } + } +} +exports.UnpackSync = UnpackSync; +//# sourceMappingURL=unpack.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/unpack.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/unpack.js.map new file mode 100644 index 0000000..f2ded83 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/unpack.js.map @@ -0,0 +1 @@ +{"version":3,"file":"unpack.js","sourceRoot":"","sources":["../../src/unpack.ts"],"names":[],"mappings":";AAAA,0EAA0E;AAC1E,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AACxE,8DAA8D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9D,yDAA0C;AAC1C,8DAAgC;AAChC,6CAAyC;AACzC,sDAAwC;AACxC,0DAA4B;AAC5B,2DAAkD;AAClD,yCAAyD;AACzD,2EAAkE;AAClE,yCAAmC;AACnC,qEAA4D;AAC5D,kDAAmC;AAGnC,iEAAyD;AAGzD,yDAAiD;AACjD,yDAA0C;AAE1C,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;AACjC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;AACjC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AACnC,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AACvC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;AAC3B,MAAM,SAAS,GAAG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AEhB,MAAM,QAAQ,GAAyB,GAAG,IAAI,MAAM,CAAA;QACpD,IAAI,CAAC;YACH,iBAAE,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;YAC9C,IAAI,EAAE,CAAA;YACN,KAAK,CAAC,MAAM,EAAE,CAAA;QAChB,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC;YACZ,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,EAAW,EAAE,KAAK,CAAC,CAAA;QAC1C,CAAC;IACH,CAAC;CACF;AA9PD,gCA8PC","sourcesContent":["// the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet.\n// but the path reservations are required to avoid race conditions where\n// parallelized unpack ops may mess with one another, due to dependencies\n// (like a Link depending on its target) or destructive operations (like\n// clobbering an fs object to create one of a different type.)\n\nimport * as fsm from '@isaacs/fs-minipass'\nimport assert from 'node:assert'\nimport { randomBytes } from 'node:crypto'\nimport fs, { type Stats } from 'node:fs'\nimport path from 'node:path'\nimport { getWriteFlag } from './get-write-flag.js'\nimport { mkdir, MkdirError, mkdirSync } from './mkdir.js'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport { Parser } from './parse.js'\nimport { stripAbsolutePath } from './strip-absolute-path.js'\nimport * as wc from './winchars.js'\n\nimport { TarOptions } from './options.js'\nimport { PathReservations } from './path-reservations.js'\nimport { ReadEntry } from './read-entry.js'\nimport { WarnData } from './warn-method.js'\nimport { SymlinkError } from './symlink-error.js'\nimport { umask } from './process-umask.js'\n\nconst ONENTRY = Symbol('onEntry')\nconst CHECKFS = Symbol('checkFs')\nconst CHECKFS2 = Symbol('checkFs2')\nconst ISREUSABLE = Symbol('isReusable')\nconst MAKEFS = Symbol('makeFs')\nconst FILE = Symbol('file')\nconst DIRECTORY = Symbol('directory')\nconst LINK = Symbol('link')\nconst SYMLINK = Symbol('symlink')\nconst HARDLINK = Symbol('hardlink')\nconst ENSURE_NO_SYMLINK = Symbol('ensureNoSymlink')\nconst UNSUPPORTED = Symbol('unsupported')\nconst CHECKPATH = Symbol('checkPath')\nconst STRIPABSOLUTEPATH = Symbol('stripAbsolutePath')\nconst MKDIR = Symbol('mkdir')\nconst ONERROR = Symbol('onError')\nconst PENDING = Symbol('pending')\nconst PEND = Symbol('pend')\nconst UNPEND = Symbol('unpend')\nconst ENDED = Symbol('ended')\nconst MAYBECLOSE = Symbol('maybeClose')\nconst SKIP = Symbol('skip')\nconst DOCHOWN = Symbol('doChown')\nconst UID = Symbol('uid')\nconst GID = Symbol('gid')\nconst CHECKED_CWD = Symbol('checkedCwd')\nconst platform =\n process.env.TESTING_TAR_FAKE_PLATFORM || process.platform\nconst isWindows = platform === 'win32'\nconst DEFAULT_MAX_DEPTH = 1024\n\n// Unlinks on Windows are not atomic.\n//\n// This means that if you have a file entry, followed by another\n// file entry with an identical name, and you cannot re-use the file\n// (because it's a hardlink, or because unlink:true is set, or it's\n// Windows, which does not have useful nlink values), then the unlink\n// will be committed to the disk AFTER the new file has been written\n// over the old one, deleting the new file.\n//\n// To work around this, on Windows systems, we rename the file and then\n// delete the renamed file. It's a sloppy kludge, but frankly, I do not\n// know of a better way to do this, given windows' non-atomic unlink\n// semantics.\n//\n// See: https://github.com/npm/node-tar/issues/183\n/* c8 ignore start */\nconst unlinkFile = (\n path: string,\n cb: (er?: Error | null) => void,\n) => {\n if (!isWindows) {\n return fs.unlink(path, cb)\n }\n\n const name = path + '.DELETE.' + randomBytes(16).toString('hex')\n fs.rename(path, name, er => {\n if (er) {\n return cb(er)\n }\n fs.unlink(name, cb)\n })\n}\n/* c8 ignore stop */\n\n/* c8 ignore start */\nconst unlinkFileSync = (path: string) => {\n if (!isWindows) {\n return fs.unlinkSync(path)\n }\n\n const name = path + '.DELETE.' + randomBytes(16).toString('hex')\n fs.renameSync(path, name)\n fs.unlinkSync(name)\n}\n/* c8 ignore stop */\n\n// this.gid, entry.gid, this.processUid\nconst uint32 = (\n a: number | undefined,\n b: number | undefined,\n c: number | undefined,\n) =>\n a !== undefined && a === a >>> 0 ? a\n : b !== undefined && b === b >>> 0 ? b\n : c\n\nexport class Unpack extends Parser {\n [ENDED]: boolean = false;\n [CHECKED_CWD]: boolean = false;\n [PENDING]: number = 0\n\n reservations: PathReservations = new PathReservations()\n transform?: TarOptions['transform']\n writable: true = true\n readable: false = false\n uid?: number\n gid?: number\n setOwner: boolean\n preserveOwner: boolean\n processGid?: number\n processUid?: number\n maxDepth: number\n forceChown: boolean\n win32: boolean\n newer: boolean\n keep: boolean\n noMtime: boolean\n preservePaths: boolean\n unlink: boolean\n cwd: string\n strip: number\n processUmask: number\n umask: number\n dmode: number\n fmode: number\n chmod: boolean\n\n constructor(opt: TarOptions = {}) {\n opt.ondone = () => {\n this[ENDED] = true\n this[MAYBECLOSE]()\n }\n\n super(opt)\n\n this.transform = opt.transform\n\n this.chmod = !!opt.chmod\n\n if (typeof opt.uid === 'number' || typeof opt.gid === 'number') {\n // need both or neither\n if (\n typeof opt.uid !== 'number' ||\n typeof opt.gid !== 'number'\n ) {\n throw new TypeError(\n 'cannot set owner without number uid and gid',\n )\n }\n if (opt.preserveOwner) {\n throw new TypeError(\n 'cannot preserve owner in archive and also set owner explicitly',\n )\n }\n this.uid = opt.uid\n this.gid = opt.gid\n this.setOwner = true\n } else {\n this.uid = undefined\n this.gid = undefined\n this.setOwner = false\n }\n\n // default true for root\n if (\n opt.preserveOwner === undefined &&\n typeof opt.uid !== 'number'\n ) {\n this.preserveOwner = !!(\n process.getuid && process.getuid() === 0\n )\n } else {\n this.preserveOwner = !!opt.preserveOwner\n }\n\n this.processUid =\n (this.preserveOwner || this.setOwner) && process.getuid ?\n process.getuid()\n : undefined\n this.processGid =\n (this.preserveOwner || this.setOwner) && process.getgid ?\n process.getgid()\n : undefined\n\n // prevent excessively deep nesting of subfolders\n // set to `Infinity` to remove this restriction\n this.maxDepth =\n typeof opt.maxDepth === 'number' ?\n opt.maxDepth\n : DEFAULT_MAX_DEPTH\n\n // mostly just for testing, but useful in some cases.\n // Forcibly trigger a chown on every entry, no matter what\n this.forceChown = opt.forceChown === true\n\n // turn > this[ONENTRY](entry))\n }\n\n // a bad or damaged archive is a warning for Parser, but an error\n // when extracting. Mark those errors as unrecoverable, because\n // the Unpack contract cannot be met.\n warn(code: string, msg: string | Error, data: WarnData = {}) {\n if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') {\n data.recoverable = false\n }\n return super.warn(code, msg, data)\n }\n\n [MAYBECLOSE]() {\n if (this[ENDED] && this[PENDING] === 0) {\n this.emit('prefinish')\n this.emit('finish')\n this.emit('end')\n }\n }\n\n // return false if we need to skip this file\n // return true if the field was successfully sanitized\n [STRIPABSOLUTEPATH](\n entry: ReadEntry,\n field: 'path' | 'linkpath',\n ): boolean {\n const p = entry[field]\n const { type } = entry\n if (!p || this.preservePaths) return true\n\n const parts = p.split('/')\n\n if (\n parts.includes('..') ||\n /* c8 ignore next */\n (isWindows && /^[a-z]:\\.\\.$/i.test(parts[0] ?? ''))\n ) {\n // For linkpath, check if the resolved path escapes cwd rather than\n // just rejecting any path with '..' - relative symlinks like\n // '../sibling/file' are valid if they resolve within the cwd.\n // For paths, they just simply may not ever use .. at all.\n if (field === 'path' || type === 'Link') {\n this.warn('TAR_ENTRY_ERROR', `${field} contains '..'`, {\n entry,\n [field]: p,\n })\n // not ok!\n return false\n } else {\n // Resolve linkpath relative to the entry's directory.\n // `path.posix` is safe to use because we're operating on\n // tar paths, not a filesystem.\n const entryDir = path.posix.dirname(entry.path)\n const resolved = path.posix.normalize(\n path.posix.join(entryDir, p),\n )\n // If the resolved path escapes (starts with ..), reject it\n if (resolved.startsWith('../') || resolved === '..') {\n this.warn(\n 'TAR_ENTRY_ERROR',\n `${field} escapes extraction directory`,\n {\n entry,\n [field]: p,\n },\n )\n return false\n }\n }\n }\n\n // strip off the root\n const [root, stripped] = stripAbsolutePath(p)\n if (root) {\n // ok, but triggers warning about stripping root\n entry[field] = String(stripped)\n this.warn(\n 'TAR_ENTRY_INFO',\n `stripping ${root} from absolute ${field}`,\n {\n entry,\n [field]: p,\n },\n )\n }\n return true\n }\n\n // no IO, just string checking for absolute indicators\n [CHECKPATH](entry: ReadEntry) {\n const p = normalizeWindowsPath(entry.path)\n const parts = p.split('/')\n\n if (this.strip) {\n if (parts.length < this.strip) {\n return false\n }\n if (entry.type === 'Link') {\n const linkparts = normalizeWindowsPath(\n String(entry.linkpath),\n ).split('/')\n if (linkparts.length >= this.strip) {\n entry.linkpath = linkparts.slice(this.strip).join('/')\n } else {\n return false\n }\n }\n parts.splice(0, this.strip)\n entry.path = parts.join('/')\n }\n\n if (isFinite(this.maxDepth) && parts.length > this.maxDepth) {\n this.warn('TAR_ENTRY_ERROR', 'path excessively deep', {\n entry,\n path: p,\n depth: parts.length,\n maxDepth: this.maxDepth,\n })\n return false\n }\n\n if (\n !this[STRIPABSOLUTEPATH](entry, 'path') ||\n !this[STRIPABSOLUTEPATH](entry, 'linkpath')\n ) {\n return false\n }\n\n if (path.isAbsolute(entry.path)) {\n entry.absolute = normalizeWindowsPath(path.resolve(entry.path))\n } else {\n entry.absolute = normalizeWindowsPath(\n path.resolve(this.cwd, entry.path),\n )\n }\n\n // if we somehow ended up with a path that escapes the cwd, and we are\n // not in preservePaths mode, then something is fishy! This should have\n // been prevented above, so ignore this for coverage.\n /* c8 ignore start - defense in depth */\n if (\n !this.preservePaths &&\n typeof entry.absolute === 'string' &&\n entry.absolute.indexOf(this.cwd + '/') !== 0 &&\n entry.absolute !== this.cwd\n ) {\n this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', {\n entry,\n path: normalizeWindowsPath(entry.path),\n resolvedPath: entry.absolute,\n cwd: this.cwd,\n })\n return false\n }\n /* c8 ignore stop */\n\n // an archive can set properties on the extraction directory, but it\n // may not replace the cwd with a different kind of thing entirely.\n if (\n entry.absolute === this.cwd &&\n entry.type !== 'Directory' &&\n entry.type !== 'GNUDumpDir'\n ) {\n return false\n }\n\n // only encode : chars that aren't drive letter indicators\n if (this.win32) {\n const { root: aRoot } = path.win32.parse(String(entry.absolute))\n entry.absolute =\n aRoot + wc.encode(String(entry.absolute).slice(aRoot.length))\n const { root: pRoot } = path.win32.parse(entry.path)\n entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length))\n }\n\n return true\n }\n\n [ONENTRY](entry: ReadEntry) {\n if (!this[CHECKPATH](entry)) {\n return entry.resume()\n }\n\n assert.equal(typeof entry.absolute, 'string')\n\n switch (entry.type) {\n case 'Directory':\n case 'GNUDumpDir':\n if (entry.mode) {\n entry.mode = entry.mode | 0o700\n }\n\n // eslint-disable-next-line no-fallthrough\n case 'File':\n case 'OldFile':\n case 'ContiguousFile':\n case 'Link':\n case 'SymbolicLink':\n return this[CHECKFS](entry)\n\n case 'CharacterDevice':\n case 'BlockDevice':\n case 'FIFO':\n default:\n return this[UNSUPPORTED](entry)\n }\n }\n\n [ONERROR](er: Error, entry: ReadEntry) {\n // Cwd has to exist, or else nothing works. That's serious.\n // Other errors are warnings, which raise the error in strict\n // mode, but otherwise continue on.\n if (er.name === 'CwdError') {\n this.emit('error', er)\n } else {\n this.warn('TAR_ENTRY_ERROR', er, { entry })\n this[UNPEND]()\n entry.resume()\n }\n }\n\n [MKDIR](\n dir: string,\n mode: number,\n cb: (er?: null | MkdirError, made?: string) => void,\n ) {\n mkdir(\n normalizeWindowsPath(dir),\n {\n uid: this.uid,\n gid: this.gid,\n processUid: this.processUid,\n processGid: this.processGid,\n umask: this.processUmask,\n preserve: this.preservePaths,\n unlink: this.unlink,\n cwd: this.cwd,\n mode: mode,\n },\n cb,\n )\n }\n\n [DOCHOWN](entry: ReadEntry) {\n // in preserve owner mode, chown if the entry doesn't match process\n // in set owner mode, chown if setting doesn't match process\n return (\n this.forceChown ||\n (this.preserveOwner &&\n ((typeof entry.uid === 'number' &&\n entry.uid !== this.processUid) ||\n (typeof entry.gid === 'number' &&\n entry.gid !== this.processGid))) ||\n (typeof this.uid === 'number' &&\n this.uid !== this.processUid) ||\n (typeof this.gid === 'number' && this.gid !== this.processGid)\n )\n }\n\n [UID](entry: ReadEntry) {\n return uint32(this.uid, entry.uid, this.processUid)\n }\n\n [GID](entry: ReadEntry) {\n return uint32(this.gid, entry.gid, this.processGid)\n }\n\n [FILE](entry: ReadEntry, fullyDone: () => void) {\n const mode =\n typeof entry.mode === 'number' ?\n entry.mode & 0o7777\n : this.fmode\n const stream = new fsm.WriteStream(String(entry.absolute), {\n // slight lie, but it can be numeric flags\n flags: getWriteFlag(entry.size) as string,\n mode: mode,\n autoClose: false,\n })\n stream.on('error', (er: Error) => {\n if (stream.fd) {\n fs.close(stream.fd, () => {})\n }\n\n // flush all the data out so that we aren't left hanging\n // if the error wasn't actually fatal. otherwise the parse\n // is blocked, and we never proceed.\n stream.write = () => true\n this[ONERROR](er, entry)\n fullyDone()\n })\n\n let actions = 1\n const done = (er?: null | Error) => {\n if (er) {\n /* c8 ignore start - we should always have a fd by now */\n if (stream.fd) {\n fs.close(stream.fd, () => {})\n }\n /* c8 ignore stop */\n\n this[ONERROR](er, entry)\n fullyDone()\n return\n }\n\n if (--actions === 0) {\n if (stream.fd !== undefined) {\n fs.close(stream.fd, er => {\n if (er) {\n this[ONERROR](er, entry)\n } else {\n this[UNPEND]()\n }\n fullyDone()\n })\n }\n }\n }\n\n stream.on('finish', () => {\n // if futimes fails, try utimes\n // if utimes fails, fail with the original error\n // same for fchown/chown\n const abs = String(entry.absolute)\n const fd = stream.fd\n\n if (typeof fd === 'number' && entry.mtime && !this.noMtime) {\n actions++\n const atime = entry.atime || new Date()\n const mtime = entry.mtime\n fs.futimes(fd, atime, mtime, er =>\n er ?\n fs.utimes(abs, atime, mtime, er2 => done(er2 && er))\n : done(),\n )\n }\n\n if (typeof fd === 'number' && this[DOCHOWN](entry)) {\n actions++\n const uid = this[UID](entry)\n const gid = this[GID](entry)\n if (typeof uid === 'number' && typeof gid === 'number') {\n fs.fchown(fd, uid, gid, er =>\n er ?\n fs.chown(abs, uid, gid, er2 => done(er2 && er))\n : done(),\n )\n }\n }\n\n done()\n })\n\n const tx = this.transform ? this.transform(entry) || entry : entry\n if (tx !== entry) {\n tx.on('error', (er: Error) => {\n this[ONERROR](er, entry)\n fullyDone()\n })\n entry.pipe(tx)\n }\n tx.pipe(stream)\n }\n\n [DIRECTORY](entry: ReadEntry, fullyDone: () => void) {\n const mode =\n typeof entry.mode === 'number' ?\n entry.mode & 0o7777\n : this.dmode\n this[MKDIR](String(entry.absolute), mode, er => {\n if (er) {\n this[ONERROR](er, entry)\n fullyDone()\n return\n }\n\n let actions = 1\n const done = () => {\n if (--actions === 0) {\n fullyDone()\n this[UNPEND]()\n entry.resume()\n }\n }\n\n if (entry.mtime && !this.noMtime) {\n actions++\n fs.utimes(\n String(entry.absolute),\n entry.atime || new Date(),\n entry.mtime,\n done,\n )\n }\n\n if (this[DOCHOWN](entry)) {\n actions++\n fs.chown(\n String(entry.absolute),\n Number(this[UID](entry)),\n Number(this[GID](entry)),\n done,\n )\n }\n\n done()\n })\n }\n\n [UNSUPPORTED](entry: ReadEntry) {\n entry.unsupported = true\n this.warn(\n 'TAR_ENTRY_UNSUPPORTED',\n `unsupported entry type: ${entry.type}`,\n { entry },\n )\n entry.resume()\n }\n\n [SYMLINK](entry: ReadEntry, done: () => void) {\n const parts = normalizeWindowsPath(\n path.relative(\n this.cwd,\n path.resolve(\n path.dirname(String(entry.absolute)),\n String(entry.linkpath),\n ),\n ),\n ).split('/')\n this[ENSURE_NO_SYMLINK](\n entry,\n this.cwd,\n parts,\n () =>\n this[LINK](entry, String(entry.linkpath), 'symlink', done),\n er => {\n this[ONERROR](er, entry)\n done()\n },\n )\n }\n\n [HARDLINK](entry: ReadEntry, done: () => void) {\n const linkpath = normalizeWindowsPath(\n path.resolve(this.cwd, String(entry.linkpath)),\n )\n const parts = normalizeWindowsPath(String(entry.linkpath)).split(\n '/',\n )\n this[ENSURE_NO_SYMLINK](\n entry,\n this.cwd,\n parts,\n () => this[LINK](entry, linkpath, 'link', done),\n er => {\n this[ONERROR](er, entry)\n done()\n },\n )\n }\n\n [ENSURE_NO_SYMLINK](\n entry: ReadEntry,\n cwd: string,\n parts: string[],\n done: () => void,\n onError: (er: SymlinkError) => void,\n ) {\n const p = parts.shift()\n if (this.preservePaths || p === undefined) return done()\n const t = path.resolve(cwd, p)\n fs.lstat(t, (er, st) => {\n if (er) return done()\n if (st?.isSymbolicLink()) {\n return onError(\n new SymlinkError(t, path.resolve(t, parts.join('/'))),\n )\n }\n this[ENSURE_NO_SYMLINK](entry, t, parts, done, onError)\n })\n }\n\n [PEND]() {\n this[PENDING]++\n }\n\n [UNPEND]() {\n this[PENDING]--\n this[MAYBECLOSE]()\n }\n\n [SKIP](entry: ReadEntry) {\n this[UNPEND]()\n entry.resume()\n }\n\n // Check if we can reuse an existing filesystem entry safely and\n // overwrite it, rather than unlinking and recreating\n // Windows doesn't report a useful nlink, so we just never reuse entries\n [ISREUSABLE](entry: ReadEntry, st: Stats) {\n return (\n entry.type === 'File' &&\n !this.unlink &&\n st.isFile() &&\n st.nlink <= 1 &&\n !isWindows\n )\n }\n\n // check if a thing is there, and if so, try to clobber it\n [CHECKFS](entry: ReadEntry) {\n this[PEND]()\n const paths = [entry.path]\n if (entry.linkpath) {\n paths.push(entry.linkpath)\n }\n this.reservations.reserve(paths, done =>\n this[CHECKFS2](entry, done),\n )\n }\n\n [CHECKFS2](entry: ReadEntry, fullyDone: (er?: Error) => void) {\n const done = (er?: Error) => {\n fullyDone(er)\n }\n\n const checkCwd = () => {\n this[MKDIR](this.cwd, this.dmode, er => {\n if (er) {\n this[ONERROR](er, entry)\n done()\n return\n }\n this[CHECKED_CWD] = true\n start()\n })\n }\n\n const start = () => {\n if (entry.absolute !== this.cwd) {\n const parent = normalizeWindowsPath(\n path.dirname(String(entry.absolute)),\n )\n if (parent !== this.cwd) {\n return this[MKDIR](parent, this.dmode, er => {\n if (er) {\n this[ONERROR](er, entry)\n done()\n return\n }\n afterMakeParent()\n })\n }\n }\n afterMakeParent()\n }\n\n const afterMakeParent = () => {\n fs.lstat(String(entry.absolute), (lstatEr, st) => {\n if (\n st &&\n (this.keep ||\n /* c8 ignore next */\n (this.newer && st.mtime > (entry.mtime ?? st.mtime)))\n ) {\n this[SKIP](entry)\n done()\n return\n }\n if (lstatEr || this[ISREUSABLE](entry, st)) {\n return this[MAKEFS](null, entry, done)\n }\n\n if (st.isDirectory()) {\n if (entry.type === 'Directory') {\n const needChmod =\n this.chmod &&\n entry.mode &&\n (st.mode & 0o7777) !== entry.mode\n const afterChmod = (er?: Error | null | undefined) =>\n this[MAKEFS](er ?? null, entry, done)\n if (!needChmod) {\n return afterChmod()\n }\n return fs.chmod(\n String(entry.absolute),\n Number(entry.mode),\n afterChmod,\n )\n }\n // Not a dir entry, have to remove it.\n // NB: the only way to end up with an entry that is the cwd\n // itself, in such a way that == does not detect, is a\n // tricky windows absolute path with UNC or 8.3 parts (and\n // preservePaths:true, or else it will have been stripped).\n // In that case, the user has opted out of path protections\n // explicitly, so if they blow away the cwd, c'est la vie.\n if (entry.absolute !== this.cwd) {\n return fs.rmdir(\n String(entry.absolute),\n (er?: null | Error) =>\n this[MAKEFS](er ?? null, entry, done),\n )\n }\n }\n\n // not a dir, and not reusable\n // don't remove if the cwd, we want that error\n if (entry.absolute === this.cwd) {\n return this[MAKEFS](null, entry, done)\n }\n\n unlinkFile(String(entry.absolute), er =>\n this[MAKEFS](er ?? null, entry, done),\n )\n })\n }\n\n if (this[CHECKED_CWD]) {\n start()\n } else {\n checkCwd()\n }\n }\n\n [MAKEFS](\n er: null | undefined | Error,\n entry: ReadEntry,\n done: () => void,\n ) {\n if (er) {\n this[ONERROR](er, entry)\n done()\n return\n }\n\n switch (entry.type) {\n case 'File':\n case 'OldFile':\n case 'ContiguousFile':\n return this[FILE](entry, done)\n\n case 'Link':\n return this[HARDLINK](entry, done)\n\n case 'SymbolicLink':\n return this[SYMLINK](entry, done)\n\n case 'Directory':\n case 'GNUDumpDir':\n return this[DIRECTORY](entry, done)\n }\n }\n\n [LINK](\n entry: ReadEntry,\n linkpath: string,\n link: 'link' | 'symlink',\n done: () => void,\n ) {\n fs[link](linkpath, String(entry.absolute), er => {\n if (er) {\n this[ONERROR](er, entry)\n } else {\n this[UNPEND]()\n entry.resume()\n }\n done()\n })\n }\n}\n\nconst callSync = (\n fn: () => T,\n): [null, T] | [NodeJS.ErrnoException, null] => {\n try {\n return [null, fn()]\n } catch (er) {\n return [er as NodeJS.ErrnoException, null]\n }\n}\n\nexport class UnpackSync extends Unpack {\n sync: true = true;\n\n [MAKEFS](er: null | Error | undefined, entry: ReadEntry) {\n return super[MAKEFS](er, entry, () => {})\n }\n\n [CHECKFS](entry: ReadEntry) {\n if (!this[CHECKED_CWD]) {\n const er = this[MKDIR](this.cwd, this.dmode)\n if (er) {\n return this[ONERROR](er as Error, entry)\n }\n this[CHECKED_CWD] = true\n }\n\n // don't bother to make the parent if the current entry is the cwd,\n // we've already checked it.\n if (entry.absolute !== this.cwd) {\n const parent = normalizeWindowsPath(\n path.dirname(String(entry.absolute)),\n )\n if (parent !== this.cwd) {\n const mkParent = this[MKDIR](parent, this.dmode)\n if (mkParent) {\n return this[ONERROR](mkParent as Error, entry)\n }\n }\n }\n\n const [lstatEr, st] = callSync(() =>\n fs.lstatSync(String(entry.absolute)),\n )\n if (\n st &&\n (this.keep ||\n /* c8 ignore next */\n (this.newer && st.mtime > (entry.mtime ?? st.mtime)))\n ) {\n return this[SKIP](entry)\n }\n\n if (lstatEr || this[ISREUSABLE](entry, st)) {\n return this[MAKEFS](null, entry)\n }\n\n if (st.isDirectory()) {\n if (entry.type === 'Directory') {\n const needChmod =\n this.chmod &&\n entry.mode &&\n (st.mode & 0o7777) !== entry.mode\n const [er] =\n needChmod ?\n callSync(() => {\n fs.chmodSync(String(entry.absolute), Number(entry.mode))\n })\n : []\n return this[MAKEFS](er, entry)\n }\n // not a dir entry, have to remove it\n const [er] = callSync(() =>\n fs.rmdirSync(String(entry.absolute)),\n )\n this[MAKEFS](er, entry)\n }\n\n // not a dir, and not reusable.\n // don't remove if it's the cwd, since we want that error.\n const [er] =\n entry.absolute === this.cwd ?\n []\n : callSync(() => unlinkFileSync(String(entry.absolute)))\n this[MAKEFS](er, entry)\n }\n\n [FILE](entry: ReadEntry, done: () => void) {\n const mode =\n typeof entry.mode === 'number' ?\n entry.mode & 0o7777\n : this.fmode\n\n const oner = (er?: null | Error | undefined) => {\n let closeError\n try {\n fs.closeSync(fd)\n } catch (e) {\n closeError = e\n }\n if (er || closeError) {\n this[ONERROR]((er as Error) || closeError, entry)\n }\n done()\n }\n\n let fd: number\n try {\n fd = fs.openSync(\n String(entry.absolute),\n getWriteFlag(entry.size),\n mode,\n )\n /* c8 ignore start - This is only a problem if the file was successfully\n * statted, BUT failed to open. Testing this is annoying, and we\n * already have ample testint for other uses of oner() methods.\n */\n } catch (er) {\n return oner(er as Error)\n }\n /* c8 ignore stop */\n const tx = this.transform ? this.transform(entry) || entry : entry\n if (tx !== entry) {\n tx.on('error', (er: Error) => this[ONERROR](er, entry))\n entry.pipe(tx)\n }\n\n tx.on('data', (chunk: Buffer) => {\n try {\n fs.writeSync(fd, chunk, 0, chunk.length)\n } catch (er) {\n oner(er as Error)\n }\n })\n\n tx.on('end', () => {\n let er = null\n // try both, falling futimes back to utimes\n // if either fails, handle the first error\n if (entry.mtime && !this.noMtime) {\n const atime = entry.atime || new Date()\n const mtime = entry.mtime\n try {\n fs.futimesSync(fd, atime, mtime)\n } catch (futimeser) {\n try {\n fs.utimesSync(String(entry.absolute), atime, mtime)\n } catch (utimeser) {\n er = futimeser\n }\n }\n }\n\n if (this[DOCHOWN](entry)) {\n const uid = this[UID](entry)\n const gid = this[GID](entry)\n\n try {\n fs.fchownSync(fd, Number(uid), Number(gid))\n } catch (fchowner) {\n try {\n fs.chownSync(\n String(entry.absolute),\n Number(uid),\n Number(gid),\n )\n } catch (chowner) {\n er = er || fchowner\n }\n }\n }\n\n oner(er as Error)\n })\n }\n\n [DIRECTORY](entry: ReadEntry, done: () => void) {\n const mode =\n typeof entry.mode === 'number' ?\n entry.mode & 0o7777\n : this.dmode\n const er = this[MKDIR](String(entry.absolute), mode)\n if (er) {\n this[ONERROR](er as Error, entry)\n done()\n return\n }\n if (entry.mtime && !this.noMtime) {\n try {\n fs.utimesSync(\n String(entry.absolute),\n entry.atime || new Date(),\n entry.mtime,\n )\n /* c8 ignore next */\n } catch (er) {}\n }\n if (this[DOCHOWN](entry)) {\n try {\n fs.chownSync(\n String(entry.absolute),\n Number(this[UID](entry)),\n Number(this[GID](entry)),\n )\n } catch (er) {}\n }\n done()\n entry.resume()\n }\n\n [MKDIR](dir: string, mode: number) {\n try {\n return mkdirSync(normalizeWindowsPath(dir), {\n uid: this.uid,\n gid: this.gid,\n processUid: this.processUid,\n processGid: this.processGid,\n umask: this.processUmask,\n preserve: this.preservePaths,\n unlink: this.unlink,\n cwd: this.cwd,\n mode: mode,\n })\n } catch (er) {\n return er\n }\n }\n\n [ENSURE_NO_SYMLINK](\n _entry: ReadEntry,\n cwd: string,\n parts: string[],\n done: () => void,\n onError: (er: SymlinkError) => void,\n ) {\n if (this.preservePaths || !parts.length) return done()\n let t = cwd\n for (const p of parts) {\n t = path.resolve(t, p)\n const [er, st] = callSync(() => fs.lstatSync(t))\n if (er) return done()\n if (st.isSymbolicLink()) {\n return onError(\n new SymlinkError(t, path.resolve(cwd, parts.join('/'))),\n )\n }\n }\n done()\n }\n\n [LINK](\n entry: ReadEntry,\n linkpath: string,\n link: 'link' | 'symlink',\n done: () => void,\n ) {\n const linkSync: `${typeof link}Sync` = `${link}Sync`\n try {\n fs[linkSync](linkpath, String(entry.absolute))\n done()\n entry.resume()\n } catch (er) {\n return this[ONERROR](er as Error, entry)\n }\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/update.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/update.d.ts new file mode 100644 index 0000000..45784eb --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/update.d.ts @@ -0,0 +1,2 @@ +export declare const update: import("./make-command.js").TarCommand; +//# sourceMappingURL=update.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/update.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/update.d.ts.map new file mode 100644 index 0000000..4f2ff18 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/update.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/update.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,MAAM,sDASlB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/update.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/update.js new file mode 100644 index 0000000..7687896 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/update.js @@ -0,0 +1,33 @@ +"use strict"; +// tar -u +Object.defineProperty(exports, "__esModule", { value: true }); +exports.update = void 0; +const make_command_js_1 = require("./make-command.js"); +const replace_js_1 = require("./replace.js"); +// just call tar.r with the filter and mtimeCache +exports.update = (0, make_command_js_1.makeCommand)(replace_js_1.replace.syncFile, replace_js_1.replace.asyncFile, replace_js_1.replace.syncNoFile, replace_js_1.replace.asyncNoFile, (opt, entries = []) => { + replace_js_1.replace.validate?.(opt, entries); + mtimeFilter(opt); +}); +const mtimeFilter = (opt) => { + const filter = opt.filter; + if (!opt.mtimeCache) { + opt.mtimeCache = new Map(); + } + opt.filter = + filter ? + (path, stat) => filter(path, stat) && + !( + /* c8 ignore start */ + ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) > + (stat.mtime ?? 0)) + /* c8 ignore stop */ + ) + : (path, stat) => !( + /* c8 ignore start */ + ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) > + (stat.mtime ?? 0)) + /* c8 ignore stop */ + ); +}; +//# sourceMappingURL=update.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/update.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/update.js.map new file mode 100644 index 0000000..a3053da --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/update.js.map @@ -0,0 +1 @@ +{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/update.ts"],"names":[],"mappings":";AAAA,SAAS;;;AAET,uDAA+C;AAG/C,6CAA2C;AAE3C,iDAAiD;AACpC,QAAA,MAAM,GAAG,IAAA,6BAAW,EAC/B,oBAAC,CAAC,QAAQ,EACV,oBAAC,CAAC,SAAS,EACX,oBAAC,CAAC,UAAU,EACZ,oBAAC,CAAC,WAAW,EACb,CAAC,GAAG,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE;IACpB,oBAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAC1B,WAAW,CAAC,GAAG,CAAC,CAAA;AAClB,CAAC,CACF,CAAA;AAED,MAAM,WAAW,GAAG,CAAC,GAA0B,EAAE,EAAE;IACjD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;IAEzB,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;QACpB,GAAG,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAAA;IAC5B,CAAC;IAED,GAAG,CAAC,MAAM;QACR,MAAM,CAAC,CAAC;YACN,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CACb,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC;gBAClB,CAAC;gBACC,qBAAqB;gBACrB,CACE,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;oBAC9C,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAClB;gBACD,oBAAoB;iBACrB;YACL,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CACb,CAAC;YACC,qBAAqB;YACrB,CACE,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;gBAC9C,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAClB;YACD,oBAAoB;aACrB,CAAA;AACT,CAAC,CAAA","sourcesContent":["// tar -u\n\nimport { makeCommand } from './make-command.js'\nimport { type TarOptionsWithAliases } from './options.js'\n\nimport { replace as r } from './replace.js'\n\n// just call tar.r with the filter and mtimeCache\nexport const update = makeCommand(\n r.syncFile,\n r.asyncFile,\n r.syncNoFile,\n r.asyncNoFile,\n (opt, entries = []) => {\n r.validate?.(opt, entries)\n mtimeFilter(opt)\n },\n)\n\nconst mtimeFilter = (opt: TarOptionsWithAliases) => {\n const filter = opt.filter\n\n if (!opt.mtimeCache) {\n opt.mtimeCache = new Map()\n }\n\n opt.filter =\n filter ?\n (path, stat) =>\n filter(path, stat) &&\n !(\n /* c8 ignore start */\n (\n (opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) >\n (stat.mtime ?? 0)\n )\n /* c8 ignore stop */\n )\n : (path, stat) =>\n !(\n /* c8 ignore start */\n (\n (opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) >\n (stat.mtime ?? 0)\n )\n /* c8 ignore stop */\n )\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/warn-method.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/warn-method.d.ts new file mode 100644 index 0000000..491d175 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/warn-method.d.ts @@ -0,0 +1,24 @@ +import { type Minipass } from 'minipass'; +/** has a warn method */ +export type Warner = { + warn(code: string, message: string | Error, data: any): void; + file?: string; + cwd?: string; + strict?: boolean; + emit(event: 'warn', code: string, message: string, data?: WarnData): void; + emit(event: 'error', error: TarError): void; +}; +export type WarnEvent = Minipass.Events & { + warn: [code: string, message: string, data: WarnData]; +}; +export type WarnData = { + file?: string; + cwd?: string; + code?: string; + tarCode?: string; + recoverable?: boolean; + [k: string]: any; +}; +export type TarError = Error & WarnData; +export declare const warnMethod: (self: Warner, code: string, message: string | Error, data?: WarnData) => void; +//# sourceMappingURL=warn-method.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/warn-method.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/warn-method.d.ts.map new file mode 100644 index 0000000..25d1c84 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/warn-method.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"warn-method.d.ts","sourceRoot":"","sources":["../../src/warn-method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,wBAAwB;AACxB,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI,CAAA;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB,IAAI,CACF,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,QAAQ,GACd,IAAI,CAAA;IACP,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAA;CAC5C,CAAA;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,GAAG,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG;IACvD,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;CACtD,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAA;AAEvC,eAAO,MAAM,UAAU,GACrB,MAAM,MAAM,EACZ,MAAM,MAAM,EACZ,SAAS,MAAM,GAAG,KAAK,EACvB,OAAM,QAAa,SA2BpB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/warn-method.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/warn-method.js new file mode 100644 index 0000000..f255027 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/warn-method.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.warnMethod = void 0; +const warnMethod = (self, code, message, data = {}) => { + if (self.file) { + data.file = self.file; + } + if (self.cwd) { + data.cwd = self.cwd; + } + data.code = + (message instanceof Error && + message.code) || + code; + data.tarCode = code; + if (!self.strict && data.recoverable !== false) { + if (message instanceof Error) { + data = Object.assign(message, data); + message = message.message; + } + self.emit('warn', code, message, data); + } + else if (message instanceof Error) { + self.emit('error', Object.assign(message, data)); + } + else { + self.emit('error', Object.assign(new Error(`${code}: ${message}`), data)); + } +}; +exports.warnMethod = warnMethod; +//# sourceMappingURL=warn-method.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/warn-method.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/warn-method.js.map new file mode 100644 index 0000000..c9bb26b --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/warn-method.js.map @@ -0,0 +1 @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,cA+BtB","sourcesContent":["import { type Minipass } from 'minipass'\n\n/** has a warn method */\nexport type Warner = {\n warn(code: string, message: string | Error, data: any): void\n file?: string\n cwd?: string\n strict?: boolean\n\n emit(\n event: 'warn',\n code: string,\n message: string,\n data?: WarnData,\n ): void\n emit(event: 'error', error: TarError): void\n}\n\nexport type WarnEvent = Minipass.Events & {\n warn: [code: string, message: string, data: WarnData]\n}\n\nexport type WarnData = {\n file?: string\n cwd?: string\n code?: string\n tarCode?: string\n recoverable?: boolean\n [k: string]: any\n}\n\nexport type TarError = Error & WarnData\n\nexport const warnMethod = (\n self: Warner,\n code: string,\n message: string | Error,\n data: WarnData = {},\n) => {\n if (self.file) {\n data.file = self.file\n }\n if (self.cwd) {\n data.cwd = self.cwd\n }\n data.code =\n (message instanceof Error &&\n (message as NodeJS.ErrnoException).code) ||\n code\n data.tarCode = code\n if (!self.strict && data.recoverable !== false) {\n if (message instanceof Error) {\n data = Object.assign(message, data)\n message = message.message\n }\n self.emit('warn', code, message, data)\n } else if (message instanceof Error) {\n self.emit('error', Object.assign(message, data))\n } else {\n self.emit(\n 'error',\n Object.assign(new Error(`${code}: ${message}`), data),\n )\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/winchars.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/winchars.d.ts new file mode 100644 index 0000000..6c24143 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/winchars.d.ts @@ -0,0 +1,3 @@ +export declare const encode: (s: string) => string; +export declare const decode: (s: string) => string; +//# sourceMappingURL=winchars.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/winchars.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/winchars.d.ts.map new file mode 100644 index 0000000..32895d1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/winchars.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"winchars.d.ts","sourceRoot":"","sources":["../../src/winchars.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,WACwB,CAAA;AACxD,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,WACwB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/winchars.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/winchars.js new file mode 100644 index 0000000..c0a4405 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/winchars.js @@ -0,0 +1,14 @@ +"use strict"; +// When writing files on Windows, translate the characters to their +// 0xf000 higher-encoded versions. +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decode = exports.encode = void 0; +const raw = ['|', '<', '>', '?', ':']; +const win = raw.map(char => String.fromCharCode(0xf000 + char.charCodeAt(0))); +const toWin = new Map(raw.map((char, i) => [char, win[i]])); +const toRaw = new Map(win.map((char, i) => [char, raw[i]])); +const encode = (s) => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s); +exports.encode = encode; +const decode = (s) => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s); +exports.decode = decode; +//# sourceMappingURL=winchars.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/winchars.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/winchars.js.map new file mode 100644 index 0000000..75fafd7 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/winchars.js.map @@ -0,0 +1 @@ +{"version":3,"file":"winchars.js","sourceRoot":"","sources":["../../src/winchars.ts"],"names":[],"mappings":";AAAA,mEAAmE;AACnE,kCAAkC;;;AAElC,MAAM,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAErC,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CACzB,MAAM,CAAC,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CACjD,CAAA;AAED,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAC3D,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAEpD,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,EAAE,CAClC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAD3C,QAAA,MAAM,UACqC;AACjD,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,EAAE,CAClC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAD3C,QAAA,MAAM,UACqC","sourcesContent":["// When writing files on Windows, translate the characters to their\n// 0xf000 higher-encoded versions.\n\nconst raw = ['|', '<', '>', '?', ':']\n\nconst win = raw.map(char =>\n String.fromCharCode(0xf000 + char.charCodeAt(0)),\n)\n\nconst toWin = new Map(raw.map((char, i) => [char, win[i]]))\nconst toRaw = new Map(win.map((char, i) => [char, raw[i]]))\n\nexport const encode = (s: string) =>\n raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s)\nexport const decode = (s: string) =>\n win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s)\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/write-entry.d.ts b/node_modules/cmake-js/node_modules/tar/dist/commonjs/write-entry.d.ts new file mode 100644 index 0000000..40d0aa7 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/write-entry.d.ts @@ -0,0 +1,129 @@ +import { type Stats } from 'fs'; +import { Minipass } from 'minipass'; +import { Header } from './header.js'; +import { TarOptions, TarOptionsWithAliases } from './options.js'; +import { ReadEntry } from './read-entry.js'; +import { EntryTypeName } from './types.js'; +import { WarnData, Warner, WarnEvent } from './warn-method.js'; +declare const PROCESS: unique symbol; +declare const FILE: unique symbol; +declare const DIRECTORY: unique symbol; +declare const SYMLINK: unique symbol; +declare const HARDLINK: unique symbol; +declare const HEADER: unique symbol; +declare const READ: unique symbol; +declare const LSTAT: unique symbol; +declare const ONLSTAT: unique symbol; +declare const ONREAD: unique symbol; +declare const ONREADLINK: unique symbol; +declare const OPENFILE: unique symbol; +declare const ONOPENFILE: unique symbol; +declare const CLOSE: unique symbol; +declare const MODE: unique symbol; +declare const AWAITDRAIN: unique symbol; +declare const ONDRAIN: unique symbol; +declare const PREFIX: unique symbol; +export declare class WriteEntry extends Minipass implements Warner { + #private; + path: string; + portable: boolean; + myuid: number; + myuser: string; + maxReadSize: number; + linkCache: Exclude; + statCache: Exclude; + preservePaths: boolean; + cwd: string; + strict: boolean; + mtime?: Date; + noPax: boolean; + noMtime: boolean; + prefix?: string; + fd?: number; + blockLen: number; + blockRemain: number; + buf?: Buffer; + pos: number; + remain: number; + length: number; + offset: number; + win32: boolean; + absolute: string; + header?: Header; + type?: EntryTypeName | 'Unsupported'; + linkpath?: string; + stat?: Stats; + onWriteEntry?: (entry: WriteEntry) => any; + constructor(p: string, opt_?: TarOptionsWithAliases); + warn(code: string, message: string | Error, data?: WarnData): void; + emit(ev: keyof WarnEvent, ...data: any[]): boolean; + [LSTAT](): void; + [ONLSTAT](stat: Stats): void; + [PROCESS](): void | this; + [MODE](mode: number): number; + [PREFIX](path: string): string; + [HEADER](): void; + [DIRECTORY](): void; + [SYMLINK](): void; + [ONREADLINK](linkpath: string): void; + [HARDLINK](linkpath: string): void; + [FILE](): void | this; + [OPENFILE](): void; + [ONOPENFILE](fd: number): void; + [READ](): void; + [CLOSE](cb?: (er?: null | Error | NodeJS.ErrnoException) => any): void; + [ONREAD](bytesRead: number): void; + [AWAITDRAIN](cb: () => any): void; + write(buffer: Buffer | string, cb?: () => void): boolean; + write(str: Buffer | string, encoding?: BufferEncoding | null, cb?: () => void): boolean; + [ONDRAIN](): void; +} +export declare class WriteEntrySync extends WriteEntry implements Warner { + sync: true; + [LSTAT](): void; + [SYMLINK](): void; + [OPENFILE](): void; + [READ](): void; + [AWAITDRAIN](cb: () => any): void; + [CLOSE](cb?: (er?: null | Error | NodeJS.ErrnoException) => any): void; +} +export declare class WriteEntryTar extends Minipass implements Warner { + blockLen: number; + blockRemain: number; + buf: number; + pos: number; + remain: number; + length: number; + preservePaths: boolean; + portable: boolean; + strict: boolean; + noPax: boolean; + noMtime: boolean; + readEntry: ReadEntry; + type: EntryTypeName; + prefix?: string; + path: string; + mode?: number; + uid?: number; + gid?: number; + uname?: string; + gname?: string; + header?: Header; + mtime?: Date; + atime?: Date; + ctime?: Date; + linkpath?: string; + size: number; + onWriteEntry?: (entry: WriteEntry) => any; + warn(code: string, message: string | Error, data?: WarnData): void; + constructor(readEntry: ReadEntry, opt_?: TarOptionsWithAliases); + [PREFIX](path: string): string; + [MODE](mode: number): number; + write(buffer: Buffer | string, cb?: () => void): boolean; + write(str: Buffer | string, encoding?: BufferEncoding | null, cb?: () => void): boolean; + end(cb?: () => void): this; + end(chunk: Buffer | string, cb?: () => void): this; + end(chunk: Buffer | string, encoding?: BufferEncoding, cb?: () => void): this; +} +export {}; +//# sourceMappingURL=write-entry.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/write-entry.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/write-entry.d.ts.map new file mode 100644 index 0000000..ea99532 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/write-entry.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"write-entry.d.ts","sourceRoot":"","sources":["../../src/write-entry.ts"],"names":[],"mappings":"AAAA,OAAW,EAAE,KAAK,KAAK,EAAE,MAAM,IAAI,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,OAAO,EAGL,UAAU,EACV,qBAAqB,EACtB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAG3C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EAEV,MAAM,kBAAkB,CAAA;AAazB,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,IAAI,eAAiB,CAAA;AAC3B,QAAA,MAAM,SAAS,eAAsB,CAAA;AACrC,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,IAAI,eAAiB,CAAA;AAC3B,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,IAAI,eAAiB,CAAA;AAC3B,QAAA,MAAM,UAAU,eAAuB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;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,GAAG,CAAA;IAEzC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,EAAE,IAAI,GAAE,QAAa;gBAK7D,SAAS,EAAE,SAAS,EACpB,IAAI,GAAE,qBAA0B;IAyHlC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,MAAM;IAIrB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,MAAM;IAInB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO;IACxD,KAAK,CACH,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,EAChC,EAAE,CAAC,EAAE,MAAM,IAAI,GACd,OAAO;IA0BV,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI;IAC1B,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI;IAClD,GAAG,CACD,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,QAAQ,CAAC,EAAE,cAAc,EACzB,EAAE,CAAC,EAAE,MAAM,IAAI,GACd,IAAI;CA2BR"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/write-entry.js b/node_modules/cmake-js/node_modules/tar/dist/commonjs/write-entry.js new file mode 100644 index 0000000..20e14a0 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/write-entry.js @@ -0,0 +1,699 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WriteEntryTar = exports.WriteEntrySync = exports.WriteEntry = void 0; +const fs_1 = __importDefault(require("fs")); +const minipass_1 = require("minipass"); +const path_1 = __importDefault(require("path")); +const header_js_1 = require("./header.js"); +const mode_fix_js_1 = require("./mode-fix.js"); +const normalize_windows_path_js_1 = require("./normalize-windows-path.js"); +const options_js_1 = require("./options.js"); +const pax_js_1 = require("./pax.js"); +const strip_absolute_path_js_1 = require("./strip-absolute-path.js"); +const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js"); +const warn_method_js_1 = require("./warn-method.js"); +const winchars = __importStar(require("./winchars.js")); +const prefixPath = (path, prefix) => { + if (!prefix) { + return (0, normalize_windows_path_js_1.normalizeWindowsPath)(path); + } + path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path).replace(/^\.(\/|$)/, ''); + return (0, strip_trailing_slashes_js_1.stripTrailingSlashes)(prefix) + '/' + path; +}; +const maxReadSize = 16 * 1024 * 1024; +const PROCESS = Symbol('process'); +const FILE = Symbol('file'); +const DIRECTORY = Symbol('directory'); +const SYMLINK = Symbol('symlink'); +const HARDLINK = Symbol('hardlink'); +const HEADER = Symbol('header'); +const READ = Symbol('read'); +const LSTAT = Symbol('lstat'); +const ONLSTAT = Symbol('onlstat'); +const ONREAD = Symbol('onread'); +const ONREADLINK = Symbol('onreadlink'); +const OPENFILE = Symbol('openfile'); +const ONOPENFILE = Symbol('onopenfile'); +const CLOSE = Symbol('close'); +const MODE = Symbol('mode'); +const AWAITDRAIN = Symbol('awaitDrain'); +const ONDRAIN = Symbol('ondrain'); +const PREFIX = Symbol('prefix'); +class WriteEntry extends minipass_1.Minipass { + path; + portable; + myuid = (process.getuid && process.getuid()) || 0; + // until node has builtin pwnam functions, this'll have to do + myuser = process.env.USER || ''; + maxReadSize; + linkCache; + statCache; + preservePaths; + cwd; + strict; + mtime; + noPax; + noMtime; + prefix; + fd; + blockLen = 0; + blockRemain = 0; + buf; + pos = 0; + remain = 0; + length = 0; + offset = 0; + win32; + absolute; + header; + type; + linkpath; + stat; + onWriteEntry; + #hadError = false; + constructor(p, opt_ = {}) { + const opt = (0, options_js_1.dealias)(opt_); + super(); + this.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(p); + // suppress atime, ctime, uid, gid, uname, gname + this.portable = !!opt.portable; + this.maxReadSize = opt.maxReadSize || maxReadSize; + this.linkCache = opt.linkCache || new Map(); + this.statCache = opt.statCache || new Map(); + this.preservePaths = !!opt.preservePaths; + this.cwd = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.cwd || process.cwd()); + this.strict = !!opt.strict; + this.noPax = !!opt.noPax; + this.noMtime = !!opt.noMtime; + this.mtime = opt.mtime; + this.prefix = + opt.prefix ? (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.prefix) : undefined; + this.onWriteEntry = opt.onWriteEntry; + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn); + } + let pathWarn = false; + if (!this.preservePaths) { + const [root, stripped] = (0, strip_absolute_path_js_1.stripAbsolutePath)(this.path); + if (root && typeof stripped === 'string') { + this.path = stripped; + pathWarn = root; + } + } + this.win32 = !!opt.win32 || process.platform === 'win32'; + if (this.win32) { + // force the \ to / normalization, since we might not *actually* + // be on windows, but want \ to be considered a path separator. + this.path = winchars.decode(this.path.replace(/\\/g, '/')); + p = p.replace(/\\/g, '/'); + } + this.absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.absolute || path_1.default.resolve(this.cwd, p)); + if (this.path === '') { + this.path = './'; + } + if (pathWarn) { + this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { + entry: this, + path: pathWarn + this.path, + }); + } + const cs = this.statCache.get(this.absolute); + if (cs) { + this[ONLSTAT](cs); + } + else { + this[LSTAT](); + } + } + warn(code, message, data = {}) { + return (0, warn_method_js_1.warnMethod)(this, code, message, data); + } + emit(ev, ...data) { + if (ev === 'error') { + this.#hadError = true; + } + return super.emit(ev, ...data); + } + [LSTAT]() { + fs_1.default.lstat(this.absolute, (er, stat) => { + if (er) { + return this.emit('error', er); + } + this[ONLSTAT](stat); + }); + } + [ONLSTAT](stat) { + this.statCache.set(this.absolute, stat); + this.stat = stat; + if (!stat.isFile()) { + stat.size = 0; + } + this.type = getType(stat); + this.emit('stat', stat); + this[PROCESS](); + } + [PROCESS]() { + switch (this.type) { + case 'File': + return this[FILE](); + case 'Directory': + return this[DIRECTORY](); + case 'SymbolicLink': + return this[SYMLINK](); + // unsupported types are ignored. + default: + return this.end(); + } + } + [MODE](mode) { + return (0, mode_fix_js_1.modeFix)(mode, this.type === 'Directory', this.portable); + } + [PREFIX](path) { + return prefixPath(path, this.prefix); + } + [HEADER]() { + /* c8 ignore start */ + if (!this.stat) { + throw new Error('cannot write header before stat'); + } + /* c8 ignore stop */ + if (this.type === 'Directory' && this.portable) { + this.noMtime = true; + } + this.onWriteEntry?.(this); + this.header = new header_js_1.Header({ + path: this[PREFIX](this.path), + // only apply the prefix to hard links. + linkpath: this.type === 'Link' && this.linkpath !== undefined ? + this[PREFIX](this.linkpath) + : this.linkpath, + // only the permissions and setuid/setgid/sticky bitflags + // not the higher-order bits that specify file type + mode: this[MODE](this.stat.mode), + uid: this.portable ? undefined : this.stat.uid, + gid: this.portable ? undefined : this.stat.gid, + size: this.stat.size, + mtime: this.noMtime ? undefined : this.mtime || this.stat.mtime, + /* c8 ignore next */ + type: this.type === 'Unsupported' ? undefined : this.type, + uname: this.portable ? undefined + : this.stat.uid === this.myuid ? this.myuser + : '', + atime: this.portable ? undefined : this.stat.atime, + ctime: this.portable ? undefined : this.stat.ctime, + }); + if (this.header.encode() && !this.noPax) { + super.write(new pax_js_1.Pax({ + atime: this.portable ? undefined : this.header.atime, + ctime: this.portable ? undefined : this.header.ctime, + gid: this.portable ? undefined : this.header.gid, + mtime: this.noMtime ? undefined : (this.mtime || this.header.mtime), + path: this[PREFIX](this.path), + linkpath: this.type === 'Link' && this.linkpath !== undefined ? + this[PREFIX](this.linkpath) + : this.linkpath, + size: this.header.size, + uid: this.portable ? undefined : this.header.uid, + uname: this.portable ? undefined : this.header.uname, + dev: this.portable ? undefined : this.stat.dev, + ino: this.portable ? undefined : this.stat.ino, + nlink: this.portable ? undefined : this.stat.nlink, + }).encode()); + } + const block = this.header?.block; + /* c8 ignore start */ + if (!block) { + throw new Error('failed to encode header'); + } + /* c8 ignore stop */ + super.write(block); + } + [DIRECTORY]() { + /* c8 ignore start */ + if (!this.stat) { + throw new Error('cannot create directory entry without stat'); + } + /* c8 ignore stop */ + if (this.path.slice(-1) !== '/') { + this.path += '/'; + } + this.stat.size = 0; + this[HEADER](); + this.end(); + } + [SYMLINK]() { + fs_1.default.readlink(this.absolute, (er, linkpath) => { + if (er) { + return this.emit('error', er); + } + this[ONREADLINK](linkpath); + }); + } + [ONREADLINK](linkpath) { + this.linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(linkpath); + this[HEADER](); + this.end(); + } + [HARDLINK](linkpath) { + /* c8 ignore start */ + if (!this.stat) { + throw new Error('cannot create link entry without stat'); + } + /* c8 ignore stop */ + this.type = 'Link'; + this.linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path_1.default.relative(this.cwd, linkpath)); + this.stat.size = 0; + this[HEADER](); + this.end(); + } + [FILE]() { + /* c8 ignore start */ + if (!this.stat) { + throw new Error('cannot create file entry without stat'); + } + /* c8 ignore stop */ + if (this.stat.nlink > 1) { + const linkKey = `${this.stat.dev}:${this.stat.ino}`; + const linkpath = this.linkCache.get(linkKey); + if (linkpath?.indexOf(this.cwd) === 0) { + return this[HARDLINK](linkpath); + } + this.linkCache.set(linkKey, this.absolute); + } + this[HEADER](); + if (this.stat.size === 0) { + return this.end(); + } + this[OPENFILE](); + } + [OPENFILE]() { + fs_1.default.open(this.absolute, 'r', (er, fd) => { + if (er) { + return this.emit('error', er); + } + this[ONOPENFILE](fd); + }); + } + [ONOPENFILE](fd) { + this.fd = fd; + if (this.#hadError) { + return this[CLOSE](); + } + /* c8 ignore start */ + if (!this.stat) { + throw new Error('should stat before calling onopenfile'); + } + /* c8 ignore start */ + this.blockLen = 512 * Math.ceil(this.stat.size / 512); + this.blockRemain = this.blockLen; + const bufLen = Math.min(this.blockLen, this.maxReadSize); + this.buf = Buffer.allocUnsafe(bufLen); + this.offset = 0; + this.pos = 0; + this.remain = this.stat.size; + this.length = this.buf.length; + this[READ](); + } + [READ]() { + const { fd, buf, offset, length, pos } = this; + if (fd === undefined || buf === undefined) { + throw new Error('cannot read file without first opening'); + } + fs_1.default.read(fd, buf, offset, length, pos, (er, bytesRead) => { + if (er) { + // ignoring the error from close(2) is a bad practice, but at + // this point we already have an error, don't need another one + return this[CLOSE](() => this.emit('error', er)); + } + this[ONREAD](bytesRead); + }); + } + /* c8 ignore start */ + [CLOSE](cb = () => { }) { + /* c8 ignore stop */ + if (this.fd !== undefined) + fs_1.default.close(this.fd, cb); + } + [ONREAD](bytesRead) { + if (bytesRead <= 0 && this.remain > 0) { + const er = Object.assign(new Error('encountered unexpected EOF'), { + path: this.absolute, + syscall: 'read', + code: 'EOF', + }); + return this[CLOSE](() => this.emit('error', er)); + } + if (bytesRead > this.remain) { + const er = Object.assign(new Error('did not encounter expected EOF'), { + path: this.absolute, + syscall: 'read', + code: 'EOF', + }); + return this[CLOSE](() => this.emit('error', er)); + } + /* c8 ignore start */ + if (!this.buf) { + throw new Error('should have created buffer prior to reading'); + } + /* c8 ignore stop */ + // null out the rest of the buffer, if we could fit the block padding + // at the end of this loop, we've incremented bytesRead and this.remain + // to be incremented up to the blockRemain level, as if we had expected + // to get a null-padded file, and read it until the end. then we will + // decrement both remain and blockRemain by bytesRead, and know that we + // reached the expected EOF, without any null buffer to append. + if (bytesRead === this.remain) { + for (let i = bytesRead; i < this.length && bytesRead < this.blockRemain; i++) { + this.buf[i + this.offset] = 0; + bytesRead++; + this.remain++; + } + } + const chunk = this.offset === 0 && bytesRead === this.buf.length ? + this.buf + : this.buf.subarray(this.offset, this.offset + bytesRead); + const flushed = this.write(chunk); + if (!flushed) { + this[AWAITDRAIN](() => this[ONDRAIN]()); + } + else { + this[ONDRAIN](); + } + } + [AWAITDRAIN](cb) { + this.once('drain', cb); + } + write(chunk, encoding, cb) { + /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8'); + } + /* c8 ignore stop */ + if (this.blockRemain < chunk.length) { + const er = Object.assign(new Error('writing more data than expected'), { + path: this.absolute, + }); + return this.emit('error', er); + } + this.remain -= chunk.length; + this.blockRemain -= chunk.length; + this.pos += chunk.length; + this.offset += chunk.length; + return super.write(chunk, null, cb); + } + [ONDRAIN]() { + if (!this.remain) { + if (this.blockRemain) { + super.write(Buffer.alloc(this.blockRemain)); + } + return this[CLOSE](er => er ? this.emit('error', er) : this.end()); + } + /* c8 ignore start */ + if (!this.buf) { + throw new Error('buffer lost somehow in ONDRAIN'); + } + /* c8 ignore stop */ + if (this.offset >= this.length) { + // if we only have a smaller bit left to read, alloc a smaller buffer + // otherwise, keep it the same length it was before. + this.buf = Buffer.allocUnsafe(Math.min(this.blockRemain, this.buf.length)); + this.offset = 0; + } + this.length = this.buf.length - this.offset; + this[READ](); + } +} +exports.WriteEntry = WriteEntry; +class WriteEntrySync extends WriteEntry { + sync = true; + [LSTAT]() { + this[ONLSTAT](fs_1.default.lstatSync(this.absolute)); + } + [SYMLINK]() { + this[ONREADLINK](fs_1.default.readlinkSync(this.absolute)); + } + [OPENFILE]() { + this[ONOPENFILE](fs_1.default.openSync(this.absolute, 'r')); + } + [READ]() { + let threw = true; + try { + const { fd, buf, offset, length, pos } = this; + /* c8 ignore start */ + if (fd === undefined || buf === undefined) { + throw new Error('fd and buf must be set in READ method'); + } + /* c8 ignore stop */ + const bytesRead = fs_1.default.readSync(fd, buf, offset, length, pos); + this[ONREAD](bytesRead); + threw = false; + } + finally { + // ignoring the error from close(2) is a bad practice, but at + // this point we already have an error, don't need another one + if (threw) { + try { + this[CLOSE](() => { }); + } + catch (er) { } + } + } + } + [AWAITDRAIN](cb) { + cb(); + } + /* c8 ignore start */ + [CLOSE](cb = () => { }) { + /* c8 ignore stop */ + if (this.fd !== undefined) + fs_1.default.closeSync(this.fd); + cb(); + } +} +exports.WriteEntrySync = WriteEntrySync; +class WriteEntryTar extends minipass_1.Minipass { + blockLen = 0; + blockRemain = 0; + buf = 0; + pos = 0; + remain = 0; + length = 0; + preservePaths; + portable; + strict; + noPax; + noMtime; + readEntry; + type; + prefix; + path; + mode; + uid; + gid; + uname; + gname; + header; + mtime; + atime; + ctime; + linkpath; + size; + onWriteEntry; + warn(code, message, data = {}) { + return (0, warn_method_js_1.warnMethod)(this, code, message, data); + } + constructor(readEntry, opt_ = {}) { + const opt = (0, options_js_1.dealias)(opt_); + super(); + this.preservePaths = !!opt.preservePaths; + this.portable = !!opt.portable; + this.strict = !!opt.strict; + this.noPax = !!opt.noPax; + this.noMtime = !!opt.noMtime; + this.onWriteEntry = opt.onWriteEntry; + this.readEntry = readEntry; + const { type } = readEntry; + /* c8 ignore start */ + if (type === 'Unsupported') { + throw new Error('writing entry that should be ignored'); + } + /* c8 ignore stop */ + this.type = type; + if (this.type === 'Directory' && this.portable) { + this.noMtime = true; + } + this.prefix = opt.prefix; + this.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(readEntry.path); + this.mode = + readEntry.mode !== undefined ? + this[MODE](readEntry.mode) + : undefined; + this.uid = this.portable ? undefined : readEntry.uid; + this.gid = this.portable ? undefined : readEntry.gid; + this.uname = this.portable ? undefined : readEntry.uname; + this.gname = this.portable ? undefined : readEntry.gname; + this.size = readEntry.size; + this.mtime = + this.noMtime ? undefined : opt.mtime || readEntry.mtime; + this.atime = this.portable ? undefined : readEntry.atime; + this.ctime = this.portable ? undefined : readEntry.ctime; + this.linkpath = + readEntry.linkpath !== undefined ? + (0, normalize_windows_path_js_1.normalizeWindowsPath)(readEntry.linkpath) + : undefined; + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn); + } + let pathWarn = false; + if (!this.preservePaths) { + const [root, stripped] = (0, strip_absolute_path_js_1.stripAbsolutePath)(this.path); + if (root && typeof stripped === 'string') { + this.path = stripped; + pathWarn = root; + } + } + this.remain = readEntry.size; + this.blockRemain = readEntry.startBlockSize; + this.onWriteEntry?.(this); + this.header = new header_js_1.Header({ + path: this[PREFIX](this.path), + linkpath: this.type === 'Link' && this.linkpath !== undefined ? + this[PREFIX](this.linkpath) + : this.linkpath, + // only the permissions and setuid/setgid/sticky bitflags + // not the higher-order bits that specify file type + mode: this.mode, + uid: this.portable ? undefined : this.uid, + gid: this.portable ? undefined : this.gid, + size: this.size, + mtime: this.noMtime ? undefined : this.mtime, + type: this.type, + uname: this.portable ? undefined : this.uname, + atime: this.portable ? undefined : this.atime, + ctime: this.portable ? undefined : this.ctime, + }); + if (pathWarn) { + this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { + entry: this, + path: pathWarn + this.path, + }); + } + if (this.header.encode() && !this.noPax) { + super.write(new pax_js_1.Pax({ + atime: this.portable ? undefined : this.atime, + ctime: this.portable ? undefined : this.ctime, + gid: this.portable ? undefined : this.gid, + mtime: this.noMtime ? undefined : this.mtime, + path: this[PREFIX](this.path), + linkpath: this.type === 'Link' && this.linkpath !== undefined ? + this[PREFIX](this.linkpath) + : this.linkpath, + size: this.size, + uid: this.portable ? undefined : this.uid, + uname: this.portable ? undefined : this.uname, + dev: this.portable ? undefined : this.readEntry.dev, + ino: this.portable ? undefined : this.readEntry.ino, + nlink: this.portable ? undefined : this.readEntry.nlink, + }).encode()); + } + const b = this.header?.block; + /* c8 ignore start */ + if (!b) + throw new Error('failed to encode header'); + /* c8 ignore stop */ + super.write(b); + readEntry.pipe(this); + } + [PREFIX](path) { + return prefixPath(path, this.prefix); + } + [MODE](mode) { + return (0, mode_fix_js_1.modeFix)(mode, this.type === 'Directory', this.portable); + } + write(chunk, encoding, cb) { + /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8'); + } + /* c8 ignore stop */ + const writeLen = chunk.length; + if (writeLen > this.blockRemain) { + throw new Error('writing more to entry than is appropriate'); + } + this.blockRemain -= writeLen; + return super.write(chunk, cb); + } + end(chunk, encoding, cb) { + if (this.blockRemain) { + super.write(Buffer.alloc(this.blockRemain)); + } + /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ + if (typeof chunk === 'function') { + cb = chunk; + encoding = undefined; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding ?? 'utf8'); + } + if (cb) + this.once('finish', cb); + chunk ? super.end(chunk, cb) : super.end(cb); + /* c8 ignore stop */ + return this; + } +} +exports.WriteEntryTar = WriteEntryTar; +const getType = (stat) => stat.isFile() ? 'File' + : stat.isDirectory() ? 'Directory' + : stat.isSymbolicLink() ? 'SymbolicLink' + : 'Unsupported'; +//# sourceMappingURL=write-entry.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/commonjs/write-entry.js.map b/node_modules/cmake-js/node_modules/tar/dist/commonjs/write-entry.js.map new file mode 100644 index 0000000..0e6d9e0 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/commonjs/write-entry.js.map @@ -0,0 +1 @@ +{"version":3,"file":"write-entry.js","sourceRoot":"","sources":["../../src/write-entry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAmC;AACnC,uCAAmC;AACnC,gDAAuB;AACvB,2CAAoC;AACpC,+CAAuC;AACvC,2EAAkE;AAClE,6CAKqB;AACrB,qCAA8B;AAE9B,qEAA4D;AAC5D,2EAAkE;AAElE,qDAKyB;AACzB,wDAAyC;AAEzC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,MAAe,EAAE,EAAE;IACnD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,IAAA,gDAAoB,EAAC,IAAI,CAAC,CAAA;IACnC,CAAC;IACD,IAAI,GAAG,IAAA,gDAAoB,EAAC,IAAI,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;IAC1D,OAAO,IAAA,gDAAoB,EAAC,MAAM,CAAC,GAAG,GAAG,GAAG,IAAI,CAAA;AAClD,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;AAEpC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;AACjC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;AAC3B,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;AACrC,MAAM,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AAE,CAC7D,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM;IACtB,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,WAAW;QAClC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,cAAc;YACxC,CAAC,CAAC,aAAa,CAAA","sourcesContent":["import fs, { type Stats } from 'fs'\nimport { Minipass } from 'minipass'\nimport path from 'path'\nimport { Header } from './header.js'\nimport { modeFix } from './mode-fix.js'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport {\n dealias,\n LinkCacheKey,\n TarOptions,\n TarOptionsWithAliases,\n} from './options.js'\nimport { Pax } from './pax.js'\nimport { ReadEntry } from './read-entry.js'\nimport { stripAbsolutePath } from './strip-absolute-path.js'\nimport { stripTrailingSlashes } from './strip-trailing-slashes.js'\nimport { EntryTypeName } from './types.js'\nimport {\n WarnData,\n Warner,\n WarnEvent,\n warnMethod,\n} from './warn-method.js'\nimport * as winchars from './winchars.js'\n\nconst prefixPath = (path: string, prefix?: string) => {\n if (!prefix) {\n return normalizeWindowsPath(path)\n }\n path = normalizeWindowsPath(path).replace(/^\\.(\\/|$)/, '')\n return stripTrailingSlashes(prefix) + '/' + path\n}\n\nconst maxReadSize = 16 * 1024 * 1024\n\nconst PROCESS = Symbol('process')\nconst FILE = Symbol('file')\nconst DIRECTORY = Symbol('directory')\nconst SYMLINK = Symbol('symlink')\nconst HARDLINK = Symbol('hardlink')\nconst HEADER = Symbol('header')\nconst READ = Symbol('read')\nconst LSTAT = Symbol('lstat')\nconst ONLSTAT = Symbol('onlstat')\nconst ONREAD = Symbol('onread')\nconst ONREADLINK = Symbol('onreadlink')\nconst OPENFILE = Symbol('openfile')\nconst ONOPENFILE = Symbol('onopenfile')\nconst CLOSE = Symbol('close')\nconst MODE = Symbol('mode')\nconst AWAITDRAIN = Symbol('awaitDrain')\nconst ONDRAIN = Symbol('ondrain')\nconst PREFIX = Symbol('prefix')\n\nexport class WriteEntry\n extends Minipass\n implements Warner\n{\n path: string\n portable: boolean\n myuid: number = (process.getuid && process.getuid()) || 0\n // until node has builtin pwnam functions, this'll have to do\n myuser: string = process.env.USER || ''\n maxReadSize: number\n linkCache: Exclude\n statCache: Exclude\n preservePaths: boolean\n cwd: string\n strict: boolean\n mtime?: Date\n noPax: boolean\n noMtime: boolean\n prefix?: string\n fd?: number\n\n blockLen: number = 0\n blockRemain: number = 0\n buf?: Buffer\n pos: number = 0\n remain: number = 0\n length: number = 0\n offset: number = 0\n\n win32: boolean\n absolute: string\n\n header?: Header\n type?: EntryTypeName | 'Unsupported'\n linkpath?: string\n stat?: Stats\n onWriteEntry?: (entry: WriteEntry) => any\n\n #hadError: boolean = false\n\n constructor(p: string, opt_: TarOptionsWithAliases = {}) {\n const opt = dealias(opt_)\n super()\n this.path = normalizeWindowsPath(p)\n // suppress atime, ctime, uid, gid, uname, gname\n this.portable = !!opt.portable\n this.maxReadSize = opt.maxReadSize || maxReadSize\n this.linkCache = opt.linkCache || new Map()\n this.statCache = opt.statCache || new Map()\n this.preservePaths = !!opt.preservePaths\n this.cwd = normalizeWindowsPath(opt.cwd || process.cwd())\n this.strict = !!opt.strict\n this.noPax = !!opt.noPax\n this.noMtime = !!opt.noMtime\n this.mtime = opt.mtime\n this.prefix =\n opt.prefix ? normalizeWindowsPath(opt.prefix) : undefined\n this.onWriteEntry = opt.onWriteEntry\n\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n\n let pathWarn: string | boolean = false\n if (!this.preservePaths) {\n const [root, stripped] = stripAbsolutePath(this.path)\n if (root && typeof stripped === 'string') {\n this.path = stripped\n pathWarn = root\n }\n }\n\n this.win32 = !!opt.win32 || process.platform === 'win32'\n if (this.win32) {\n // force the \\ to / normalization, since we might not *actually*\n // be on windows, but want \\ to be considered a path separator.\n this.path = winchars.decode(this.path.replace(/\\\\/g, '/'))\n p = p.replace(/\\\\/g, '/')\n }\n\n this.absolute = normalizeWindowsPath(\n opt.absolute || path.resolve(this.cwd, p),\n )\n\n if (this.path === '') {\n this.path = './'\n }\n\n if (pathWarn) {\n this.warn(\n 'TAR_ENTRY_INFO',\n `stripping ${pathWarn} from absolute path`,\n {\n entry: this,\n path: pathWarn + this.path,\n },\n )\n }\n\n const cs = this.statCache.get(this.absolute)\n if (cs) {\n this[ONLSTAT](cs)\n } else {\n this[LSTAT]()\n }\n }\n\n warn(code: string, message: string | Error, data: WarnData = {}) {\n return warnMethod(this, code, message, data)\n }\n\n emit(ev: keyof WarnEvent, ...data: any[]) {\n if (ev === 'error') {\n this.#hadError = true\n }\n return super.emit(ev, ...data)\n }\n\n [LSTAT]() {\n fs.lstat(this.absolute, (er, stat) => {\n if (er) {\n return this.emit('error', er)\n }\n this[ONLSTAT](stat)\n })\n }\n\n [ONLSTAT](stat: Stats) {\n this.statCache.set(this.absolute, stat)\n this.stat = stat\n if (!stat.isFile()) {\n stat.size = 0\n }\n this.type = getType(stat)\n this.emit('stat', stat)\n this[PROCESS]()\n }\n\n [PROCESS]() {\n switch (this.type) {\n case 'File':\n return this[FILE]()\n case 'Directory':\n return this[DIRECTORY]()\n case 'SymbolicLink':\n return this[SYMLINK]()\n // unsupported types are ignored.\n default:\n return this.end()\n }\n }\n\n [MODE](mode: number) {\n return modeFix(mode, this.type === 'Directory', this.portable)\n }\n\n [PREFIX](path: string) {\n return prefixPath(path, this.prefix)\n }\n\n [HEADER]() {\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('cannot write header before stat')\n }\n /* c8 ignore stop */\n\n if (this.type === 'Directory' && this.portable) {\n this.noMtime = true\n }\n\n this.onWriteEntry?.(this)\n this.header = new Header({\n path: this[PREFIX](this.path),\n // only apply the prefix to hard links.\n linkpath:\n this.type === 'Link' && this.linkpath !== undefined ?\n this[PREFIX](this.linkpath)\n : this.linkpath,\n // only the permissions and setuid/setgid/sticky bitflags\n // not the higher-order bits that specify file type\n mode: this[MODE](this.stat.mode),\n uid: this.portable ? undefined : this.stat.uid,\n gid: this.portable ? undefined : this.stat.gid,\n size: this.stat.size,\n mtime: this.noMtime ? undefined : this.mtime || this.stat.mtime,\n /* c8 ignore next */\n type: this.type === 'Unsupported' ? undefined : this.type,\n uname:\n this.portable ? undefined\n : this.stat.uid === this.myuid ? this.myuser\n : '',\n atime: this.portable ? undefined : this.stat.atime,\n ctime: this.portable ? undefined : this.stat.ctime,\n })\n\n if (this.header.encode() && !this.noPax) {\n super.write(\n new Pax({\n atime: this.portable ? undefined : this.header.atime,\n ctime: this.portable ? undefined : this.header.ctime,\n gid: this.portable ? undefined : this.header.gid,\n mtime:\n this.noMtime ? undefined : (\n this.mtime || this.header.mtime\n ),\n path: this[PREFIX](this.path),\n linkpath:\n this.type === 'Link' && this.linkpath !== undefined ?\n this[PREFIX](this.linkpath)\n : this.linkpath,\n size: this.header.size,\n uid: this.portable ? undefined : this.header.uid,\n uname: this.portable ? undefined : this.header.uname,\n dev: this.portable ? undefined : this.stat.dev,\n ino: this.portable ? undefined : this.stat.ino,\n nlink: this.portable ? undefined : this.stat.nlink,\n }).encode(),\n )\n }\n const block = this.header?.block\n /* c8 ignore start */\n if (!block) {\n throw new Error('failed to encode header')\n }\n /* c8 ignore stop */\n super.write(block)\n }\n\n [DIRECTORY]() {\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('cannot create directory entry without stat')\n }\n /* c8 ignore stop */\n if (this.path.slice(-1) !== '/') {\n this.path += '/'\n }\n this.stat.size = 0\n this[HEADER]()\n this.end()\n }\n\n [SYMLINK]() {\n fs.readlink(this.absolute, (er, linkpath) => {\n if (er) {\n return this.emit('error', er)\n }\n this[ONREADLINK](linkpath)\n })\n }\n\n [ONREADLINK](linkpath: string) {\n this.linkpath = normalizeWindowsPath(linkpath)\n this[HEADER]()\n this.end()\n }\n\n [HARDLINK](linkpath: string) {\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('cannot create link entry without stat')\n }\n /* c8 ignore stop */\n this.type = 'Link'\n this.linkpath = normalizeWindowsPath(\n path.relative(this.cwd, linkpath),\n )\n this.stat.size = 0\n this[HEADER]()\n this.end()\n }\n\n [FILE]() {\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('cannot create file entry without stat')\n }\n /* c8 ignore stop */\n if (this.stat.nlink > 1) {\n const linkKey =\n `${this.stat.dev}:${this.stat.ino}` as LinkCacheKey\n const linkpath = this.linkCache.get(linkKey)\n if (linkpath?.indexOf(this.cwd) === 0) {\n return this[HARDLINK](linkpath)\n }\n this.linkCache.set(linkKey, this.absolute)\n }\n\n this[HEADER]()\n if (this.stat.size === 0) {\n return this.end()\n }\n\n this[OPENFILE]()\n }\n\n [OPENFILE]() {\n fs.open(this.absolute, 'r', (er, fd) => {\n if (er) {\n return this.emit('error', er)\n }\n this[ONOPENFILE](fd)\n })\n }\n\n [ONOPENFILE](fd: number) {\n this.fd = fd\n if (this.#hadError) {\n return this[CLOSE]()\n }\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('should stat before calling onopenfile')\n }\n /* c8 ignore start */\n\n this.blockLen = 512 * Math.ceil(this.stat.size / 512)\n this.blockRemain = this.blockLen\n const bufLen = Math.min(this.blockLen, this.maxReadSize)\n this.buf = Buffer.allocUnsafe(bufLen)\n this.offset = 0\n this.pos = 0\n this.remain = this.stat.size\n this.length = this.buf.length\n this[READ]()\n }\n\n [READ]() {\n const { fd, buf, offset, length, pos } = this\n if (fd === undefined || buf === undefined) {\n throw new Error('cannot read file without first opening')\n }\n fs.read(fd, buf, offset, length, pos, (er, bytesRead) => {\n if (er) {\n // ignoring the error from close(2) is a bad practice, but at\n // this point we already have an error, don't need another one\n return this[CLOSE](() => this.emit('error', er))\n }\n this[ONREAD](bytesRead)\n })\n }\n\n /* c8 ignore start */\n [CLOSE](\n cb: (er?: null | Error | NodeJS.ErrnoException) => any = () => {},\n ) {\n /* c8 ignore stop */\n if (this.fd !== undefined) fs.close(this.fd, cb)\n }\n\n [ONREAD](bytesRead: number) {\n if (bytesRead <= 0 && this.remain > 0) {\n const er = Object.assign(\n new Error('encountered unexpected EOF'),\n {\n path: this.absolute,\n syscall: 'read',\n code: 'EOF',\n },\n )\n return this[CLOSE](() => this.emit('error', er))\n }\n\n if (bytesRead > this.remain) {\n const er = Object.assign(\n new Error('did not encounter expected EOF'),\n {\n path: this.absolute,\n syscall: 'read',\n code: 'EOF',\n },\n )\n return this[CLOSE](() => this.emit('error', er))\n }\n\n /* c8 ignore start */\n if (!this.buf) {\n throw new Error('should have created buffer prior to reading')\n }\n /* c8 ignore stop */\n\n // null out the rest of the buffer, if we could fit the block padding\n // at the end of this loop, we've incremented bytesRead and this.remain\n // to be incremented up to the blockRemain level, as if we had expected\n // to get a null-padded file, and read it until the end. then we will\n // decrement both remain and blockRemain by bytesRead, and know that we\n // reached the expected EOF, without any null buffer to append.\n if (bytesRead === this.remain) {\n for (\n let i = bytesRead;\n i < this.length && bytesRead < this.blockRemain;\n i++\n ) {\n this.buf[i + this.offset] = 0\n bytesRead++\n this.remain++\n }\n }\n\n const chunk =\n this.offset === 0 && bytesRead === this.buf.length ?\n this.buf\n : this.buf.subarray(this.offset, this.offset + bytesRead)\n\n const flushed = this.write(chunk)\n if (!flushed) {\n this[AWAITDRAIN](() => this[ONDRAIN]())\n } else {\n this[ONDRAIN]()\n }\n }\n\n [AWAITDRAIN](cb: () => any) {\n this.once('drain', cb)\n }\n\n write(buffer: Buffer | string, cb?: () => void): boolean\n write(\n str: Buffer | string,\n encoding?: BufferEncoding | null,\n cb?: () => void,\n ): boolean\n write(\n chunk: Buffer | string,\n encoding?: BufferEncoding | (() => any) | null,\n cb?: () => any,\n ): boolean {\n /* c8 ignore start - just junk to comply with NodeJS.WritableStream */\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(\n chunk,\n typeof encoding === 'string' ? encoding : 'utf8',\n )\n }\n /* c8 ignore stop */\n\n if (this.blockRemain < chunk.length) {\n const er = Object.assign(\n new Error('writing more data than expected'),\n {\n path: this.absolute,\n },\n )\n return this.emit('error', er)\n }\n this.remain -= chunk.length\n this.blockRemain -= chunk.length\n this.pos += chunk.length\n this.offset += chunk.length\n return super.write(chunk, null, cb)\n }\n\n [ONDRAIN]() {\n if (!this.remain) {\n if (this.blockRemain) {\n super.write(Buffer.alloc(this.blockRemain))\n }\n return this[CLOSE](er =>\n er ? this.emit('error', er) : this.end(),\n )\n }\n\n /* c8 ignore start */\n if (!this.buf) {\n throw new Error('buffer lost somehow in ONDRAIN')\n }\n /* c8 ignore stop */\n\n if (this.offset >= this.length) {\n // if we only have a smaller bit left to read, alloc a smaller buffer\n // otherwise, keep it the same length it was before.\n this.buf = Buffer.allocUnsafe(\n Math.min(this.blockRemain, this.buf.length),\n )\n this.offset = 0\n }\n this.length = this.buf.length - this.offset\n this[READ]()\n }\n}\n\nexport class WriteEntrySync extends WriteEntry implements Warner {\n sync: true = true;\n\n [LSTAT]() {\n this[ONLSTAT](fs.lstatSync(this.absolute))\n }\n\n [SYMLINK]() {\n this[ONREADLINK](fs.readlinkSync(this.absolute))\n }\n\n [OPENFILE]() {\n this[ONOPENFILE](fs.openSync(this.absolute, 'r'))\n }\n\n [READ]() {\n let threw = true\n try {\n const { fd, buf, offset, length, pos } = this\n /* c8 ignore start */\n if (fd === undefined || buf === undefined) {\n throw new Error('fd and buf must be set in READ method')\n }\n /* c8 ignore stop */\n const bytesRead = fs.readSync(fd, buf, offset, length, pos)\n this[ONREAD](bytesRead)\n threw = false\n } finally {\n // ignoring the error from close(2) is a bad practice, but at\n // this point we already have an error, don't need another one\n if (threw) {\n try {\n this[CLOSE](() => {})\n } catch (er) {}\n }\n }\n }\n\n [AWAITDRAIN](cb: () => any) {\n cb()\n }\n\n /* c8 ignore start */\n [CLOSE](\n cb: (er?: null | Error | NodeJS.ErrnoException) => any = () => {},\n ) {\n /* c8 ignore stop */\n if (this.fd !== undefined) fs.closeSync(this.fd)\n cb()\n }\n}\n\nexport class WriteEntryTar\n extends Minipass\n implements Warner\n{\n blockLen: number = 0\n blockRemain: number = 0\n buf: number = 0\n pos: number = 0\n remain: number = 0\n length: number = 0\n preservePaths: boolean\n portable: boolean\n strict: boolean\n noPax: boolean\n noMtime: boolean\n readEntry: ReadEntry\n type: EntryTypeName\n prefix?: string\n path: string\n mode?: number\n uid?: number\n gid?: number\n uname?: string\n gname?: string\n header?: Header\n mtime?: Date\n atime?: Date\n ctime?: Date\n linkpath?: string\n size: number\n onWriteEntry?: (entry: WriteEntry) => any\n\n warn(code: string, message: string | Error, data: WarnData = {}) {\n return warnMethod(this, code, message, data)\n }\n\n constructor(\n readEntry: ReadEntry,\n opt_: TarOptionsWithAliases = {},\n ) {\n const opt = dealias(opt_)\n super()\n this.preservePaths = !!opt.preservePaths\n this.portable = !!opt.portable\n this.strict = !!opt.strict\n this.noPax = !!opt.noPax\n this.noMtime = !!opt.noMtime\n this.onWriteEntry = opt.onWriteEntry\n\n this.readEntry = readEntry\n const { type } = readEntry\n /* c8 ignore start */\n if (type === 'Unsupported') {\n throw new Error('writing entry that should be ignored')\n }\n /* c8 ignore stop */\n this.type = type\n if (this.type === 'Directory' && this.portable) {\n this.noMtime = true\n }\n\n this.prefix = opt.prefix\n\n this.path = normalizeWindowsPath(readEntry.path)\n this.mode =\n readEntry.mode !== undefined ?\n this[MODE](readEntry.mode)\n : undefined\n this.uid = this.portable ? undefined : readEntry.uid\n this.gid = this.portable ? undefined : readEntry.gid\n this.uname = this.portable ? undefined : readEntry.uname\n this.gname = this.portable ? undefined : readEntry.gname\n this.size = readEntry.size\n this.mtime =\n this.noMtime ? undefined : opt.mtime || readEntry.mtime\n this.atime = this.portable ? undefined : readEntry.atime\n this.ctime = this.portable ? undefined : readEntry.ctime\n this.linkpath =\n readEntry.linkpath !== undefined ?\n normalizeWindowsPath(readEntry.linkpath)\n : undefined\n\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n\n let pathWarn: false | string = false\n if (!this.preservePaths) {\n const [root, stripped] = stripAbsolutePath(this.path)\n if (root && typeof stripped === 'string') {\n this.path = stripped\n pathWarn = root\n }\n }\n\n this.remain = readEntry.size\n this.blockRemain = readEntry.startBlockSize\n\n this.onWriteEntry?.(this as unknown as WriteEntry)\n this.header = new Header({\n path: this[PREFIX](this.path),\n linkpath:\n this.type === 'Link' && this.linkpath !== undefined ?\n this[PREFIX](this.linkpath)\n : this.linkpath,\n // only the permissions and setuid/setgid/sticky bitflags\n // not the higher-order bits that specify file type\n mode: this.mode,\n uid: this.portable ? undefined : this.uid,\n gid: this.portable ? undefined : this.gid,\n size: this.size,\n mtime: this.noMtime ? undefined : this.mtime,\n type: this.type,\n uname: this.portable ? undefined : this.uname,\n atime: this.portable ? undefined : this.atime,\n ctime: this.portable ? undefined : this.ctime,\n })\n\n if (pathWarn) {\n this.warn(\n 'TAR_ENTRY_INFO',\n `stripping ${pathWarn} from absolute path`,\n {\n entry: this,\n path: pathWarn + this.path,\n },\n )\n }\n\n if (this.header.encode() && !this.noPax) {\n super.write(\n new Pax({\n atime: this.portable ? undefined : this.atime,\n ctime: this.portable ? undefined : this.ctime,\n gid: this.portable ? undefined : this.gid,\n mtime: this.noMtime ? undefined : this.mtime,\n path: this[PREFIX](this.path),\n linkpath:\n this.type === 'Link' && this.linkpath !== undefined ?\n this[PREFIX](this.linkpath)\n : this.linkpath,\n size: this.size,\n uid: this.portable ? undefined : this.uid,\n uname: this.portable ? undefined : this.uname,\n dev: this.portable ? undefined : this.readEntry.dev,\n ino: this.portable ? undefined : this.readEntry.ino,\n nlink: this.portable ? undefined : this.readEntry.nlink,\n }).encode(),\n )\n }\n\n const b = this.header?.block\n /* c8 ignore start */\n if (!b) throw new Error('failed to encode header')\n /* c8 ignore stop */\n super.write(b)\n readEntry.pipe(this)\n }\n\n [PREFIX](path: string) {\n return prefixPath(path, this.prefix)\n }\n\n [MODE](mode: number) {\n return modeFix(mode, this.type === 'Directory', this.portable)\n }\n\n write(buffer: Buffer | string, cb?: () => void): boolean\n write(\n str: Buffer | string,\n encoding?: BufferEncoding | null,\n cb?: () => void,\n ): boolean\n write(\n chunk: Buffer | string,\n encoding?: BufferEncoding | (() => any) | null,\n cb?: () => any,\n ): boolean {\n /* c8 ignore start - just junk to comply with NodeJS.WritableStream */\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(\n chunk,\n typeof encoding === 'string' ? encoding : 'utf8',\n )\n }\n /* c8 ignore stop */\n const writeLen = chunk.length\n if (writeLen > this.blockRemain) {\n throw new Error('writing more to entry than is appropriate')\n }\n this.blockRemain -= writeLen\n return super.write(chunk, cb)\n }\n\n end(cb?: () => void): this\n end(chunk: Buffer | string, cb?: () => void): this\n end(\n chunk: Buffer | string,\n encoding?: BufferEncoding,\n cb?: () => void,\n ): this\n end(\n chunk?: Buffer | string | (() => void),\n encoding?: BufferEncoding | (() => void),\n cb?: () => void,\n ): this {\n if (this.blockRemain) {\n super.write(Buffer.alloc(this.blockRemain))\n }\n /* c8 ignore start - just junk to comply with NodeJS.WritableStream */\n if (typeof chunk === 'function') {\n cb = chunk\n encoding = undefined\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding ?? 'utf8')\n }\n if (cb) this.once('finish', cb)\n chunk ? super.end(chunk, cb) : super.end(cb)\n /* c8 ignore stop */\n return this\n }\n}\n\nconst getType = (stat: Stats): EntryTypeName | 'Unsupported' =>\n stat.isFile() ? 'File'\n : stat.isDirectory() ? 'Directory'\n : stat.isSymbolicLink() ? 'SymbolicLink'\n : 'Unsupported'\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/create.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/create.d.ts new file mode 100644 index 0000000..867c5e9 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/create.d.ts @@ -0,0 +1,3 @@ +import { Pack, PackSync } from './pack.js'; +export declare const create: import("./make-command.js").TarCommand; +//# sourceMappingURL=create.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/create.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/create.d.ts.map new file mode 100644 index 0000000..82be947 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/create.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/create.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AA8E1C,eAAO,MAAM,MAAM,wDAUlB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/create.js b/node_modules/cmake-js/node_modules/tar/dist/esm/create.js new file mode 100644 index 0000000..512a991 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/create.js @@ -0,0 +1,77 @@ +import { WriteStream, WriteStreamSync } from '@isaacs/fs-minipass'; +import path from 'node:path'; +import { list } from './list.js'; +import { makeCommand } from './make-command.js'; +import { Pack, PackSync } from './pack.js'; +const createFileSync = (opt, files) => { + const p = new PackSync(opt); + const stream = new WriteStreamSync(opt.file, { + mode: opt.mode || 0o666, + }); + p.pipe(stream); + addFilesSync(p, files); +}; +const createFile = (opt, files) => { + const p = new Pack(opt); + const stream = new WriteStream(opt.file, { + mode: opt.mode || 0o666, + }); + p.pipe(stream); + const promise = new Promise((res, rej) => { + stream.on('error', rej); + stream.on('close', res); + p.on('error', rej); + }); + addFilesAsync(p, files); + return promise; +}; +const addFilesSync = (p, files) => { + files.forEach(file => { + if (file.charAt(0) === '@') { + list({ + file: path.resolve(p.cwd, file.slice(1)), + sync: true, + noResume: true, + onReadEntry: entry => p.add(entry), + }); + } + else { + p.add(file); + } + }); + p.end(); +}; +const addFilesAsync = async (p, files) => { + for (let i = 0; i < files.length; i++) { + const file = String(files[i]); + if (file.charAt(0) === '@') { + await list({ + file: path.resolve(String(p.cwd), file.slice(1)), + noResume: true, + onReadEntry: entry => { + p.add(entry); + }, + }); + } + else { + p.add(file); + } + } + p.end(); +}; +const createSync = (opt, files) => { + const p = new PackSync(opt); + addFilesSync(p, files); + return p; +}; +const createAsync = (opt, files) => { + const p = new Pack(opt); + addFilesAsync(p, files); + return p; +}; +export const create = makeCommand(createFileSync, createFile, createSync, createAsync, (_opt, files) => { + if (!files?.length) { + throw new TypeError('no paths specified to add to archive'); + } +}); +//# sourceMappingURL=create.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/create.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/create.js.map new file mode 100644 index 0000000..9260f91 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/create.js.map @@ -0,0 +1 @@ +{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAElE,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAO/C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAE1C,MAAM,cAAc,GAAG,CAAC,GAAuB,EAAE,KAAe,EAAE,EAAE;IAClE,MAAM,CAAC,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAA;IAC3B,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE;QAC3C,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,KAAK;KACxB,CAAC,CAAA;IACF,CAAC,CAAC,IAAI,CAAC,MAAsC,CAAC,CAAA;IAC9C,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AACxB,CAAC,CAAA;AAED,MAAM,UAAU,GAAG,CAAC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WAAW,CAC/B,cAAc,EACd,UAAU,EACV,UAAU,EACV,WAAW,EACX,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;IACd,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;QACnB,MAAM,IAAI,SAAS,CAAC,sCAAsC,CAAC,CAAA;IAC7D,CAAC;AACH,CAAC,CACF,CAAA","sourcesContent":["import { WriteStream, WriteStreamSync } from '@isaacs/fs-minipass'\nimport { Minipass } from 'minipass'\nimport path from 'node:path'\nimport { list } from './list.js'\nimport { makeCommand } from './make-command.js'\nimport {\n TarOptions,\n TarOptionsFile,\n TarOptionsSync,\n TarOptionsSyncFile,\n} from './options.js'\nimport { Pack, PackSync } from './pack.js'\n\nconst createFileSync = (opt: TarOptionsSyncFile, files: string[]) => {\n const p = new PackSync(opt)\n const stream = new WriteStreamSync(opt.file, {\n mode: opt.mode || 0o666,\n })\n p.pipe(stream as unknown as Minipass.Writable)\n addFilesSync(p, files)\n}\n\nconst createFile = (opt: TarOptionsFile, files: string[]) => {\n const p = new Pack(opt)\n const stream = new WriteStream(opt.file, {\n mode: opt.mode || 0o666,\n })\n p.pipe(stream as unknown as Minipass.Writable)\n\n const promise = new Promise((res, rej) => {\n stream.on('error', rej)\n stream.on('close', res)\n p.on('error', rej)\n })\n\n addFilesAsync(p, files)\n\n return promise\n}\n\nconst addFilesSync = (p: PackSync, files: string[]) => {\n files.forEach(file => {\n if (file.charAt(0) === '@') {\n list({\n file: path.resolve(p.cwd, file.slice(1)),\n sync: true,\n noResume: true,\n onReadEntry: entry => p.add(entry),\n })\n } else {\n p.add(file)\n }\n })\n p.end()\n}\n\nconst addFilesAsync = async (\n p: Pack,\n files: string[],\n): Promise => {\n for (let i = 0; i < files.length; i++) {\n const file = String(files[i])\n if (file.charAt(0) === '@') {\n await list({\n file: path.resolve(String(p.cwd), file.slice(1)),\n noResume: true,\n onReadEntry: entry => {\n p.add(entry)\n },\n })\n } else {\n p.add(file)\n }\n }\n p.end()\n}\n\nconst createSync = (opt: TarOptionsSync, files: string[]) => {\n const p = new PackSync(opt)\n addFilesSync(p, files)\n return p\n}\n\nconst createAsync = (opt: TarOptions, files: string[]) => {\n const p = new Pack(opt)\n addFilesAsync(p, files)\n return p\n}\n\nexport const create = makeCommand(\n createFileSync,\n createFile,\n createSync,\n createAsync,\n (_opt, files) => {\n if (!files?.length) {\n throw new TypeError('no paths specified to add to archive')\n }\n },\n)\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/cwd-error.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/cwd-error.d.ts new file mode 100644 index 0000000..16c6460 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/cwd-error.d.ts @@ -0,0 +1,8 @@ +export declare class CwdError extends Error { + path: string; + code: string; + syscall: 'chdir'; + constructor(path: string, code: string); + get name(): string; +} +//# sourceMappingURL=cwd-error.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/cwd-error.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/cwd-error.d.ts.map new file mode 100644 index 0000000..6b9a1a2 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/cwd-error.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"cwd-error.d.ts","sourceRoot":"","sources":["../../src/cwd-error.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAS,SAAQ,KAAK;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAU;gBAEd,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAMtC,IAAI,IAAI,WAEP;CACF"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/cwd-error.js b/node_modules/cmake-js/node_modules/tar/dist/esm/cwd-error.js new file mode 100644 index 0000000..289a066 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/cwd-error.js @@ -0,0 +1,14 @@ +export class CwdError extends Error { + path; + code; + syscall = 'chdir'; + constructor(path, code) { + super(`${code}: Cannot cd into '${path}'`); + this.path = path; + this.code = code; + } + get name() { + return 'CwdError'; + } +} +//# sourceMappingURL=cwd-error.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/cwd-error.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/cwd-error.js.map new file mode 100644 index 0000000..6956f1a --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/cwd-error.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cwd-error.js","sourceRoot":"","sources":["../../src/cwd-error.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,IAAI,CAAQ;IACZ,IAAI,CAAQ;IACZ,OAAO,GAAY,OAAO,CAAA;IAE1B,YAAY,IAAY,EAAE,IAAY;QACpC,KAAK,CAAC,GAAG,IAAI,qBAAqB,IAAI,GAAG,CAAC,CAAA;QAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,UAAU,CAAA;IACnB,CAAC;CACF","sourcesContent":["export class CwdError extends Error {\n path: string\n code: string\n syscall: 'chdir' = 'chdir'\n\n constructor(path: string, code: string) {\n super(`${code}: Cannot cd into '${path}'`)\n this.path = path\n this.code = code\n }\n\n get name() {\n return 'CwdError'\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/extract.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/extract.d.ts new file mode 100644 index 0000000..9cbb18c --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/extract.d.ts @@ -0,0 +1,3 @@ +import { Unpack, UnpackSync } from './unpack.js'; +export declare const extract: import("./make-command.js").TarCommand; +//# sourceMappingURL=extract.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/extract.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/extract.d.ts.map new file mode 100644 index 0000000..31008e1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/extract.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/extract.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AA2ChD,eAAO,MAAM,OAAO,4DAQnB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/extract.js b/node_modules/cmake-js/node_modules/tar/dist/esm/extract.js new file mode 100644 index 0000000..2274fee --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/extract.js @@ -0,0 +1,49 @@ +// tar -x +import * as fsm from '@isaacs/fs-minipass'; +import fs from 'node:fs'; +import { filesFilter } from './list.js'; +import { makeCommand } from './make-command.js'; +import { Unpack, UnpackSync } from './unpack.js'; +const extractFileSync = (opt) => { + const u = new UnpackSync(opt); + const file = opt.file; + const stat = fs.statSync(file); + // This trades a zero-byte read() syscall for a stat + // However, it will usually result in less memory allocation + const readSize = opt.maxReadSize || 16 * 1024 * 1024; + const stream = new fsm.ReadStreamSync(file, { + readSize: readSize, + size: stat.size, + }); + stream.pipe(u); +}; +const extractFile = (opt, _) => { + const u = new Unpack(opt); + const readSize = opt.maxReadSize || 16 * 1024 * 1024; + const file = opt.file; + const p = new Promise((resolve, reject) => { + u.on('error', reject); + u.on('close', resolve); + // This trades a zero-byte read() syscall for a stat + // However, it will usually result in less memory allocation + fs.stat(file, (er, stat) => { + if (er) { + reject(er); + } + else { + const stream = new fsm.ReadStream(file, { + readSize: readSize, + size: stat.size, + }); + stream.on('error', reject); + stream.pipe(u); + } + }); + }); + return p; +}; +export const extract = makeCommand(extractFileSync, extractFile, opt => new UnpackSync(opt), opt => new Unpack(opt), (opt, files) => { + if (files?.length) + filesFilter(opt, files); +}); +//# sourceMappingURL=extract.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/extract.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/extract.js.map new file mode 100644 index 0000000..796a1cb --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/extract.js.map @@ -0,0 +1 @@ +{"version":3,"file":"extract.js","sourceRoot":"","sources":["../../src/extract.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAEhD,MAAM,eAAe,GAAG,CAAC,GAAuB,EAAE,EAAE;IAClD,MAAM,CAAC,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAA;IAC7B,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;IACrB,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC9B,oDAAoD;IACpD,4DAA4D;IAC5D,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;IACpD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE;QAC1C,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC,CAAA;IACF,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,CAAC,GAAmB,EAAE,CAAY,EAAE,EAAE;IACxD,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,CAAA;IACzB,MAAM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* as fsm from '@isaacs/fs-minipass'\nimport fs from 'node:fs'\nimport { filesFilter } from './list.js'\nimport { makeCommand } from './make-command.js'\nimport { TarOptionsFile, TarOptionsSyncFile } from './options.js'\nimport { Unpack, UnpackSync } from './unpack.js'\n\nconst extractFileSync = (opt: TarOptionsSyncFile) => {\n const u = new UnpackSync(opt)\n const file = opt.file\n const stat = fs.statSync(file)\n // This trades a zero-byte read() syscall for a stat\n // However, it will usually result in less memory allocation\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n const stream = new fsm.ReadStreamSync(file, {\n readSize: readSize,\n size: stat.size,\n })\n stream.pipe(u)\n}\n\nconst extractFile = (opt: TarOptionsFile, _?: string[]) => {\n const u = new Unpack(opt)\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n\n const file = opt.file\n const p = new Promise((resolve, reject) => {\n u.on('error', reject)\n u.on('close', resolve)\n\n // This trades a zero-byte read() syscall for a stat\n // However, it will usually result in less memory allocation\n fs.stat(file, (er, stat) => {\n if (er) {\n reject(er)\n } else {\n const stream = new fsm.ReadStream(file, {\n readSize: readSize,\n size: stat.size,\n })\n stream.on('error', reject)\n stream.pipe(u)\n }\n })\n })\n return p\n}\n\nexport const extract = makeCommand(\n extractFileSync,\n extractFile,\n opt => new UnpackSync(opt),\n opt => new Unpack(opt),\n (opt, files) => {\n if (files?.length) filesFilter(opt, files)\n },\n)\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/get-write-flag.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/get-write-flag.d.ts new file mode 100644 index 0000000..d35ec71 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/get-write-flag.d.ts @@ -0,0 +1,2 @@ +export declare const getWriteFlag: (() => string) | ((size: number) => number | "w"); +//# sourceMappingURL=get-write-flag.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/get-write-flag.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/get-write-flag.d.ts.map new file mode 100644 index 0000000..79af1e1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/get-write-flag.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"get-write-flag.d.ts","sourceRoot":"","sources":["../../src/get-write-flag.ts"],"names":[],"mappings":"AAwBA,eAAO,MAAM,YAAY,2BAGd,MAAM,kBAAwC,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/get-write-flag.js b/node_modules/cmake-js/node_modules/tar/dist/esm/get-write-flag.js new file mode 100644 index 0000000..2c7f3e8 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/get-write-flag.js @@ -0,0 +1,23 @@ +// Get the appropriate flag to use for creating files +// We use fmap on Windows platforms for files less than +// 512kb. This is a fairly low limit, but avoids making +// things slower in some cases. Since most of what this +// library is used for is extracting tarballs of many +// relatively small files in npm packages and the like, +// it can be a big boost on Windows platforms. +import fs from 'fs'; +const platform = process.env.__FAKE_PLATFORM__ || process.platform; +const isWindows = platform === 'win32'; +/* c8 ignore start */ +const { O_CREAT, O_TRUNC, O_WRONLY } = fs.constants; +const UV_FS_O_FILEMAP = Number(process.env.__FAKE_FS_O_FILENAME__) || + fs.constants.UV_FS_O_FILEMAP || + 0; +/* c8 ignore stop */ +const fMapEnabled = isWindows && !!UV_FS_O_FILEMAP; +const fMapLimit = 512 * 1024; +const fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY; +export const getWriteFlag = !fMapEnabled ? + () => 'w' + : (size) => (size < fMapLimit ? fMapFlag : 'w'); +//# sourceMappingURL=get-write-flag.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/get-write-flag.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/get-write-flag.js.map new file mode 100644 index 0000000..2d620c1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/get-write-flag.js.map @@ -0,0 +1 @@ +{"version":3,"file":"get-write-flag.js","sourceRoot":"","sources":["../../src/get-write-flag.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,uDAAuD;AACvD,wDAAwD;AACxD,wDAAwD;AACxD,qDAAqD;AACrD,uDAAuD;AACvD,8CAA8C;AAE9C,OAAO,EAAE,MAAM,IAAI,CAAA;AAEnB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,OAAO,CAAC,QAAQ,CAAA;AAClE,MAAM,SAAS,GAAG,QAAQ,KAAK,OAAO,CAAA;AAEtC,qBAAqB;AACrB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS,CAAA;AACnD,MAAM,eAAe,GACnB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;IAC1C,EAAE,CAAC,SAAS,CAAC,eAAe;IAC5B,CAAC,CAAA;AACH,oBAAoB;AAEpB,MAAM,WAAW,GAAG,SAAS,IAAI,CAAC,CAAC,eAAe,CAAA;AAClD,MAAM,SAAS,GAAG,GAAG,GAAG,IAAI,CAAA;AAC5B,MAAM,QAAQ,GAAG,eAAe,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAA;AAC/D,MAAM,CAAC,MAAM,YAAY,GACvB,CAAC,WAAW,CAAC,CAAC;IACZ,GAAG,EAAE,CAAC,GAAG;IACX,CAAC,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA","sourcesContent":["// Get the appropriate flag to use for creating files\n// We use fmap on Windows platforms for files less than\n// 512kb. This is a fairly low limit, but avoids making\n// things slower in some cases. Since most of what this\n// library is used for is extracting tarballs of many\n// relatively small files in npm packages and the like,\n// it can be a big boost on Windows platforms.\n\nimport fs from 'fs'\n\nconst platform = process.env.__FAKE_PLATFORM__ || process.platform\nconst isWindows = platform === 'win32'\n\n/* c8 ignore start */\nconst { O_CREAT, O_TRUNC, O_WRONLY } = fs.constants\nconst UV_FS_O_FILEMAP =\n Number(process.env.__FAKE_FS_O_FILENAME__) ||\n fs.constants.UV_FS_O_FILEMAP ||\n 0\n/* c8 ignore stop */\n\nconst fMapEnabled = isWindows && !!UV_FS_O_FILEMAP\nconst fMapLimit = 512 * 1024\nconst fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY\nexport const getWriteFlag =\n !fMapEnabled ?\n () => 'w'\n : (size: number) => (size < fMapLimit ? fMapFlag : 'w')\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/header.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/header.d.ts new file mode 100644 index 0000000..58f1b43 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/header.d.ts @@ -0,0 +1,53 @@ +import type { EntryTypeCode, EntryTypeName } from './types.js'; +export type HeaderData = { + path?: string; + mode?: number; + uid?: number; + gid?: number; + size?: number; + cksum?: number; + type?: EntryTypeName | 'Unsupported'; + linkpath?: string; + uname?: string; + gname?: string; + devmaj?: number; + devmin?: number; + atime?: Date; + ctime?: Date; + mtime?: Date; + charset?: string; + comment?: string; + dev?: number; + ino?: number; + nlink?: number; +}; +export declare class Header implements HeaderData { + #private; + cksumValid: boolean; + needPax: boolean; + nullBlock: boolean; + block?: Buffer; + path?: string; + mode?: number; + uid?: number; + gid?: number; + size?: number; + cksum?: number; + linkpath?: string; + uname?: string; + gname?: string; + devmaj: number; + devmin: number; + atime?: Date; + ctime?: Date; + mtime?: Date; + charset?: string; + comment?: string; + constructor(data?: Buffer | HeaderData, off?: number, ex?: HeaderData, gex?: HeaderData); + decode(buf: Buffer, off: number, ex?: HeaderData, gex?: HeaderData): void; + encode(buf?: Buffer, off?: number): boolean; + get type(): EntryTypeName; + get typeKey(): EntryTypeCode | 'Unsupported'; + set type(type: EntryTypeCode | EntryTypeName | 'Unsupported'); +} +//# sourceMappingURL=header.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/header.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/header.d.ts.map new file mode 100644 index 0000000..279dccf --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/header.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/header.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAG9D,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,aAAa,GAAG,aAAa,CAAA;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,KAAK,CAAC,EAAE,IAAI,CAAA;IAIZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,qBAAa,MAAO,YAAW,UAAU;;IACvC,UAAU,EAAE,OAAO,CAAQ;IAC3B,OAAO,EAAE,OAAO,CAAQ;IACxB,SAAS,EAAE,OAAO,CAAQ;IAE1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAI;IAClB,MAAM,EAAE,MAAM,CAAI;IAClB,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,KAAK,CAAC,EAAE,IAAI,CAAA;IAEZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;gBAGd,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,EAC1B,GAAG,GAAE,MAAU,EACf,EAAE,CAAC,EAAE,UAAU,EACf,GAAG,CAAC,EAAE,UAAU;IASlB,MAAM,CACJ,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,EAAE,CAAC,EAAE,UAAU,EACf,GAAG,CAAC,EAAE,UAAU;IA+GlB,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,GAAE,MAAU;IAwEpC,IAAI,IAAI,IAAI,aAAa,CAKxB;IAED,IAAI,OAAO,IAAI,aAAa,GAAG,aAAa,CAE3C;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,aAAa,GAAG,aAAa,GAAG,aAAa,EAS3D;CACF"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/header.js b/node_modules/cmake-js/node_modules/tar/dist/esm/header.js new file mode 100644 index 0000000..66db545 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/header.js @@ -0,0 +1,288 @@ +// parse a 512-byte header block to a data object, or vice-versa +// encode returns `true` if a pax extended header is needed, because +// the data could not be faithfully encoded in a simple header. +// (Also, check header.needPax to see if it needs a pax header.) +import { posix as pathModule } from 'node:path'; +import * as large from './large-numbers.js'; +import * as types from './types.js'; +export class Header { + cksumValid = false; + needPax = false; + nullBlock = false; + block; + path; + mode; + uid; + gid; + size; + cksum; + #type = 'Unsupported'; + linkpath; + uname; + gname; + devmaj = 0; + devmin = 0; + atime; + ctime; + mtime; + charset; + comment; + constructor(data, off = 0, ex, gex) { + if (Buffer.isBuffer(data)) { + this.decode(data, off || 0, ex, gex); + } + else if (data) { + this.#slurp(data); + } + } + decode(buf, off, ex, gex) { + if (!off) { + off = 0; + } + if (!buf || !(buf.length >= off + 512)) { + throw new Error('need 512 bytes for header'); + } + this.path = ex?.path ?? decString(buf, off, 100); + this.mode = ex?.mode ?? gex?.mode ?? decNumber(buf, off + 100, 8); + this.uid = ex?.uid ?? gex?.uid ?? decNumber(buf, off + 108, 8); + this.gid = ex?.gid ?? gex?.gid ?? decNumber(buf, off + 116, 8); + this.size = ex?.size ?? gex?.size ?? decNumber(buf, off + 124, 12); + this.mtime = + ex?.mtime ?? gex?.mtime ?? decDate(buf, off + 136, 12); + this.cksum = decNumber(buf, off + 148, 12); + // if we have extended or global extended headers, apply them now + // See https://github.com/npm/node-tar/pull/187 + // Apply global before local, so it overrides + if (gex) + this.#slurp(gex, true); + if (ex) + this.#slurp(ex); + // old tar versions marked dirs as a file with a trailing / + const t = decString(buf, off + 156, 1); + if (types.isCode(t)) { + this.#type = t || '0'; + } + if (this.#type === '0' && this.path.slice(-1) === '/') { + this.#type = '5'; + } + // tar implementations sometimes incorrectly put the stat(dir).size + // as the size in the tarball, even though Directory entries are + // not able to have any body at all. In the very rare chance that + // it actually DOES have a body, we weren't going to do anything with + // it anyway, and it'll just be a warning about an invalid header. + if (this.#type === '5') { + this.size = 0; + } + this.linkpath = decString(buf, off + 157, 100); + if (buf.subarray(off + 257, off + 265).toString() === + 'ustar\u000000') { + /* c8 ignore start */ + this.uname = + ex?.uname ?? gex?.uname ?? decString(buf, off + 265, 32); + this.gname = + ex?.gname ?? gex?.gname ?? decString(buf, off + 297, 32); + this.devmaj = + ex?.devmaj ?? gex?.devmaj ?? decNumber(buf, off + 329, 8) ?? 0; + this.devmin = + ex?.devmin ?? gex?.devmin ?? decNumber(buf, off + 337, 8) ?? 0; + /* c8 ignore stop */ + if (buf[off + 475] !== 0) { + // definitely a prefix, definitely >130 chars. + const prefix = decString(buf, off + 345, 155); + this.path = prefix + '/' + this.path; + } + else { + const prefix = decString(buf, off + 345, 130); + if (prefix) { + this.path = prefix + '/' + this.path; + } + /* c8 ignore start */ + this.atime = + ex?.atime ?? gex?.atime ?? decDate(buf, off + 476, 12); + this.ctime = + ex?.ctime ?? gex?.ctime ?? decDate(buf, off + 488, 12); + /* c8 ignore stop */ + } + } + let sum = 8 * 0x20; + for (let i = off; i < off + 148; i++) { + sum += buf[i]; + } + for (let i = off + 156; i < off + 512; i++) { + sum += buf[i]; + } + this.cksumValid = sum === this.cksum; + if (this.cksum === undefined && sum === 8 * 0x20) { + this.nullBlock = true; + } + } + #slurp(ex, gex = false) { + Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => { + // we slurp in everything except for the path attribute in + // a global extended header, because that's weird. Also, any + // null/undefined values are ignored. + return !(v === null || + v === undefined || + (k === 'path' && gex) || + (k === 'linkpath' && gex) || + k === 'global'); + }))); + } + encode(buf, off = 0) { + if (!buf) { + buf = this.block = Buffer.alloc(512); + } + if (this.#type === 'Unsupported') { + this.#type = '0'; + } + if (!(buf.length >= off + 512)) { + throw new Error('need 512 bytes for header'); + } + const prefixSize = this.ctime || this.atime ? 130 : 155; + const split = splitPrefix(this.path || '', prefixSize); + const path = split[0]; + const prefix = split[1]; + this.needPax = !!split[2]; + this.needPax = encString(buf, off, 100, path) || this.needPax; + this.needPax = + encNumber(buf, off + 100, 8, this.mode) || this.needPax; + this.needPax = + encNumber(buf, off + 108, 8, this.uid) || this.needPax; + this.needPax = + encNumber(buf, off + 116, 8, this.gid) || this.needPax; + this.needPax = + encNumber(buf, off + 124, 12, this.size) || this.needPax; + this.needPax = + encDate(buf, off + 136, 12, this.mtime) || this.needPax; + buf[off + 156] = this.#type.charCodeAt(0); + this.needPax = + encString(buf, off + 157, 100, this.linkpath) || this.needPax; + buf.write('ustar\u000000', off + 257, 8); + this.needPax = + encString(buf, off + 265, 32, this.uname) || this.needPax; + this.needPax = + encString(buf, off + 297, 32, this.gname) || this.needPax; + this.needPax = + encNumber(buf, off + 329, 8, this.devmaj) || this.needPax; + this.needPax = + encNumber(buf, off + 337, 8, this.devmin) || this.needPax; + this.needPax = + encString(buf, off + 345, prefixSize, prefix) || this.needPax; + if (buf[off + 475] !== 0) { + this.needPax = + encString(buf, off + 345, 155, prefix) || this.needPax; + } + else { + this.needPax = + encString(buf, off + 345, 130, prefix) || this.needPax; + this.needPax = + encDate(buf, off + 476, 12, this.atime) || this.needPax; + this.needPax = + encDate(buf, off + 488, 12, this.ctime) || this.needPax; + } + let sum = 8 * 0x20; + for (let i = off; i < off + 148; i++) { + sum += buf[i]; + } + for (let i = off + 156; i < off + 512; i++) { + sum += buf[i]; + } + this.cksum = sum; + encNumber(buf, off + 148, 8, this.cksum); + this.cksumValid = true; + return this.needPax; + } + get type() { + return (this.#type === 'Unsupported' ? + this.#type + : types.name.get(this.#type)); + } + get typeKey() { + return this.#type; + } + set type(type) { + const c = String(types.code.get(type)); + if (types.isCode(c) || c === 'Unsupported') { + this.#type = c; + } + else if (types.isCode(type)) { + this.#type = type; + } + else { + throw new TypeError('invalid entry type: ' + type); + } + } +} +const splitPrefix = (p, prefixSize) => { + const pathSize = 100; + let pp = p; + let prefix = ''; + let ret = undefined; + const root = pathModule.parse(p).root || '.'; + if (Buffer.byteLength(pp) < pathSize) { + ret = [pp, prefix, false]; + } + else { + // first set prefix to the dir, and path to the base + prefix = pathModule.dirname(pp); + pp = pathModule.basename(pp); + do { + if (Buffer.byteLength(pp) <= pathSize && + Buffer.byteLength(prefix) <= prefixSize) { + // both fit! + ret = [pp, prefix, false]; + } + else if (Buffer.byteLength(pp) > pathSize && + Buffer.byteLength(prefix) <= prefixSize) { + // prefix fits in prefix, but path doesn't fit in path + ret = [pp.slice(0, pathSize - 1), prefix, true]; + } + else { + // make path take a bit from prefix + pp = pathModule.join(pathModule.basename(prefix), pp); + prefix = pathModule.dirname(prefix); + } + } while (prefix !== root && ret === undefined); + // at this point, found no resolution, just truncate + if (!ret) { + ret = [p.slice(0, pathSize - 1), '', true]; + } + } + return ret; +}; +const decString = (buf, off, size) => buf + .subarray(off, off + size) + .toString('utf8') + .replace(/\0.*/, ''); +const decDate = (buf, off, size) => numToDate(decNumber(buf, off, size)); +const numToDate = (num) => num === undefined ? undefined : new Date(num * 1000); +const decNumber = (buf, off, size) => Number(buf[off]) & 0x80 ? + large.parse(buf.subarray(off, off + size)) + : decSmallNumber(buf, off, size); +const nanUndef = (value) => (isNaN(value) ? undefined : value); +const decSmallNumber = (buf, off, size) => nanUndef(parseInt(buf + .subarray(off, off + size) + .toString('utf8') + .replace(/\0.*$/, '') + .trim(), 8)); +// the maximum encodable as a null-terminated octal, by field size +const MAXNUM = { + 12: 0o77777777777, + 8: 0o7777777, +}; +const encNumber = (buf, off, size, num) => num === undefined ? false + : num > MAXNUM[size] || num < 0 ? + (large.encode(num, buf.subarray(off, off + size)), true) + : (encSmallNumber(buf, off, size, num), false); +const encSmallNumber = (buf, off, size, num) => buf.write(octalString(num, size), off, size, 'ascii'); +const octalString = (num, size) => padOctal(Math.floor(num).toString(8), size); +const padOctal = (str, size) => (str.length === size - 1 ? + str + : new Array(size - str.length - 1).join('0') + str + ' ') + '\0'; +const encDate = (buf, off, size, date) => date === undefined ? false : (encNumber(buf, off, size, date.getTime() / 1000)); +// enough to fill the longest string we've got +const NULLS = new Array(156).join('\0'); +// pad with nulls, return true if it's longer or non-ascii +const encString = (buf, off, size, str) => str === undefined ? false : ((buf.write(str + NULLS, off, size, 'utf8'), + str.length !== Buffer.byteLength(str) || str.length > size)); +//# sourceMappingURL=header.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/header.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/header.js.map new file mode 100644 index 0000000..8f90b3f --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/header.js.map @@ -0,0 +1 @@ +{"version":3,"file":"header.js","sourceRoot":"","sources":["../../src/header.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,oEAAoE;AACpE,+DAA+D;AAC/D,gEAAgE;AAEhE,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAE3C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AA4BnC,MAAM,OAAO,MAAM;IACjB,UAAU,GAAY,KAAK,CAAA;IAC3B,OAAO,GAAY,KAAK,CAAA;IACxB,SAAS,GAAY,KAAK,CAAA;IAE1B,KAAK,CAAS;IACd,IAAI,CAAS;IACb,IAAI,CAAS;IACb,GAAG,CAAS;IACZ,GAAG,CAAS;IACZ,IAAI,CAAS;IACb,KAAK,CAAS;IACd,KAAK,GAAkC,aAAa,CAAA;IACpD,QAAQ,CAAS;IACjB,KAAK,CAAS;IACd,KAAK,CAAS;IACd,MAAM,GAAW,CAAC,CAAA;IAClB,MAAM,GAAW,CAAC,CAAA;IAClB,KAAK,CAAO;IACZ,KAAK,CAAO;IACZ,KAAK,CAAO;IAEZ,OAAO,CAAS;IAChB,OAAO,CAAS;IAEhB,YACE,IAA0B,EAC1B,MAAc,CAAC,EACf,EAAe,EACf,GAAgB;QAEhB,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE,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Y,EAAE,EAAE,CAC7C,CAAC,GAAG,CAAC,MAAM,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC;IACxB,GAAG;IACL,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,CAAA;AAElE,MAAM,OAAO,GAAG,CACd,GAAW,EACX,GAAW,EACX,IAAY,EACZ,IAAW,EACX,EAAE,CACF,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAC3B,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CACjD,CAAA;AAEH,8CAA8C;AAC9C,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACvC,0DAA0D;AAC1D,MAAM,SAAS,GAAG,CAChB,GAAW,EACX,GAAW,EACX,IAAY,EACZ,GAAY,EACZ,EAAE,CACF,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAC1B,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC;IAC1C,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAC5D,CAAA","sourcesContent":["// parse a 512-byte header block to a data object, or vice-versa\n// encode returns `true` if a pax extended header is needed, because\n// the data could not be faithfully encoded in a simple header.\n// (Also, check header.needPax to see if it needs a pax header.)\n\nimport { posix as pathModule } from 'node:path'\nimport * as large from './large-numbers.js'\nimport type { EntryTypeCode, EntryTypeName } from './types.js'\nimport * as types from './types.js'\n\nexport type HeaderData = {\n path?: string\n mode?: number\n uid?: number\n gid?: number\n size?: number\n cksum?: number\n type?: EntryTypeName | 'Unsupported'\n linkpath?: string\n uname?: string\n gname?: string\n devmaj?: number\n devmin?: number\n atime?: Date\n ctime?: Date\n mtime?: Date\n\n // fields that are common in extended PAX headers, but not in the\n // \"standard\" tar header block\n charset?: string\n comment?: string\n dev?: number\n ino?: number\n nlink?: number\n}\n\nexport class Header implements HeaderData {\n cksumValid: boolean = false\n needPax: boolean = false\n nullBlock: boolean = false\n\n block?: Buffer\n path?: string\n mode?: number\n uid?: number\n gid?: number\n size?: number\n cksum?: number\n #type: EntryTypeCode | 'Unsupported' = 'Unsupported'\n linkpath?: string\n uname?: string\n gname?: string\n devmaj: number = 0\n devmin: number = 0\n atime?: Date\n ctime?: Date\n mtime?: Date\n\n charset?: string\n comment?: string\n\n constructor(\n data?: Buffer | HeaderData,\n off: number = 0,\n ex?: HeaderData,\n gex?: HeaderData,\n ) {\n if (Buffer.isBuffer(data)) {\n this.decode(data, off || 0, ex, gex)\n } else if (data) {\n this.#slurp(data)\n }\n }\n\n decode(\n buf: Buffer,\n off: number,\n ex?: HeaderData,\n gex?: HeaderData,\n ) {\n if (!off) {\n off = 0\n }\n\n if (!buf || !(buf.length >= off + 512)) {\n throw new Error('need 512 bytes for header')\n }\n\n this.path = ex?.path ?? decString(buf, off, 100)\n this.mode = ex?.mode ?? gex?.mode ?? decNumber(buf, off + 100, 8)\n this.uid = ex?.uid ?? gex?.uid ?? decNumber(buf, off + 108, 8)\n this.gid = ex?.gid ?? gex?.gid ?? decNumber(buf, off + 116, 8)\n this.size = ex?.size ?? gex?.size ?? decNumber(buf, off + 124, 12)\n this.mtime =\n ex?.mtime ?? gex?.mtime ?? decDate(buf, off + 136, 12)\n this.cksum = decNumber(buf, off + 148, 12)\n\n // if we have extended or global extended headers, apply them now\n // See https://github.com/npm/node-tar/pull/187\n // Apply global before local, so it overrides\n if (gex) this.#slurp(gex, true)\n if (ex) this.#slurp(ex)\n\n // old tar versions marked dirs as a file with a trailing /\n const t = decString(buf, off + 156, 1)\n if (types.isCode(t)) {\n this.#type = t || '0'\n }\n if (this.#type === '0' && this.path.slice(-1) === '/') {\n this.#type = '5'\n }\n\n // tar implementations sometimes incorrectly put the stat(dir).size\n // as the size in the tarball, even though Directory entries are\n // not able to have any body at all. In the very rare chance that\n // it actually DOES have a body, we weren't going to do anything with\n // it anyway, and it'll just be a warning about an invalid header.\n if (this.#type === '5') {\n this.size = 0\n }\n\n this.linkpath = decString(buf, off + 157, 100)\n if (\n buf.subarray(off + 257, off + 265).toString() ===\n 'ustar\\u000000'\n ) {\n /* c8 ignore start */\n this.uname =\n ex?.uname ?? gex?.uname ?? decString(buf, off + 265, 32)\n this.gname =\n ex?.gname ?? gex?.gname ?? decString(buf, off + 297, 32)\n this.devmaj =\n ex?.devmaj ?? gex?.devmaj ?? decNumber(buf, off + 329, 8) ?? 0\n this.devmin =\n ex?.devmin ?? gex?.devmin ?? decNumber(buf, off + 337, 8) ?? 0\n /* c8 ignore stop */\n if (buf[off + 475] !== 0) {\n // definitely a prefix, definitely >130 chars.\n const prefix = decString(buf, off + 345, 155)\n this.path = prefix + '/' + this.path\n } else {\n const prefix = decString(buf, off + 345, 130)\n if (prefix) {\n this.path = prefix + '/' + this.path\n }\n /* c8 ignore start */\n this.atime =\n ex?.atime ?? gex?.atime ?? decDate(buf, off + 476, 12)\n this.ctime =\n ex?.ctime ?? gex?.ctime ?? decDate(buf, off + 488, 12)\n /* c8 ignore stop */\n }\n }\n\n let sum = 8 * 0x20\n for (let i = off; i < off + 148; i++) {\n sum += buf[i] as number\n }\n\n for (let i = off + 156; i < off + 512; i++) {\n sum += buf[i] as number\n }\n\n this.cksumValid = sum === this.cksum\n if (this.cksum === undefined && sum === 8 * 0x20) {\n this.nullBlock = true\n }\n }\n\n #slurp(ex: HeaderData, gex: boolean = false) {\n Object.assign(\n this,\n Object.fromEntries(\n Object.entries(ex).filter(([k, v]) => {\n // we slurp in everything except for the path attribute in\n // a global extended header, because that's weird. Also, any\n // null/undefined values are ignored.\n return !(\n v === null ||\n v === undefined ||\n (k === 'path' && gex) ||\n (k === 'linkpath' && gex) ||\n k === 'global'\n )\n }),\n ),\n )\n }\n\n encode(buf?: Buffer, off: number = 0) {\n if (!buf) {\n buf = this.block = Buffer.alloc(512)\n }\n\n if (this.#type === 'Unsupported') {\n this.#type = '0'\n }\n\n if (!(buf.length >= off + 512)) {\n throw new Error('need 512 bytes for header')\n }\n\n const prefixSize = this.ctime || this.atime ? 130 : 155\n const split = splitPrefix(this.path || '', prefixSize)\n const path = split[0]\n const prefix = split[1]\n this.needPax = !!split[2]\n\n this.needPax = encString(buf, off, 100, path) || this.needPax\n this.needPax =\n encNumber(buf, off + 100, 8, this.mode) || this.needPax\n this.needPax =\n encNumber(buf, off + 108, 8, this.uid) || this.needPax\n this.needPax =\n encNumber(buf, off + 116, 8, this.gid) || this.needPax\n this.needPax =\n encNumber(buf, off + 124, 12, this.size) || this.needPax\n this.needPax =\n encDate(buf, off + 136, 12, this.mtime) || this.needPax\n buf[off + 156] = this.#type.charCodeAt(0)\n this.needPax =\n encString(buf, off + 157, 100, this.linkpath) || this.needPax\n buf.write('ustar\\u000000', off + 257, 8)\n this.needPax =\n encString(buf, off + 265, 32, this.uname) || this.needPax\n this.needPax =\n encString(buf, off + 297, 32, this.gname) || this.needPax\n this.needPax =\n encNumber(buf, off + 329, 8, this.devmaj) || this.needPax\n this.needPax =\n encNumber(buf, off + 337, 8, this.devmin) || this.needPax\n this.needPax =\n encString(buf, off + 345, prefixSize, prefix) || this.needPax\n if (buf[off + 475] !== 0) {\n this.needPax =\n encString(buf, off + 345, 155, prefix) || this.needPax\n } else {\n this.needPax =\n encString(buf, off + 345, 130, prefix) || this.needPax\n this.needPax =\n encDate(buf, off + 476, 12, this.atime) || this.needPax\n this.needPax =\n encDate(buf, off + 488, 12, this.ctime) || this.needPax\n }\n\n let sum = 8 * 0x20\n for (let i = off; i < off + 148; i++) {\n sum += buf[i] as number\n }\n\n for (let i = off + 156; i < off + 512; i++) {\n sum += buf[i] as number\n }\n\n this.cksum = sum\n encNumber(buf, off + 148, 8, this.cksum)\n this.cksumValid = true\n\n return this.needPax\n }\n\n get type(): EntryTypeName {\n return (\n this.#type === 'Unsupported' ?\n this.#type\n : types.name.get(this.#type)) as EntryTypeName\n }\n\n get typeKey(): EntryTypeCode | 'Unsupported' {\n return this.#type\n }\n\n set type(type: EntryTypeCode | EntryTypeName | 'Unsupported') {\n const c = String(types.code.get(type as EntryTypeName))\n if (types.isCode(c) || c === 'Unsupported') {\n this.#type = c\n } else if (types.isCode(type)) {\n this.#type = type\n } else {\n throw new TypeError('invalid entry type: ' + type)\n }\n }\n}\n\nconst splitPrefix = (\n p: string,\n prefixSize: number,\n): [string, string, boolean] => {\n const pathSize = 100\n let pp = p\n let prefix = ''\n let ret: undefined | [string, string, boolean] = undefined\n const root = pathModule.parse(p).root || '.'\n\n if (Buffer.byteLength(pp) < pathSize) {\n ret = [pp, prefix, false]\n } else {\n // first set prefix to the dir, and path to the base\n prefix = pathModule.dirname(pp)\n pp = pathModule.basename(pp)\n\n do {\n if (\n Buffer.byteLength(pp) <= pathSize &&\n Buffer.byteLength(prefix) <= prefixSize\n ) {\n // both fit!\n ret = [pp, prefix, false]\n } else if (\n Buffer.byteLength(pp) > pathSize &&\n Buffer.byteLength(prefix) <= prefixSize\n ) {\n // prefix fits in prefix, but path doesn't fit in path\n ret = [pp.slice(0, pathSize - 1), prefix, true]\n } else {\n // make path take a bit from prefix\n pp = pathModule.join(pathModule.basename(prefix), pp)\n prefix = pathModule.dirname(prefix)\n }\n } while (prefix !== root && ret === undefined)\n\n // at this point, found no resolution, just truncate\n if (!ret) {\n ret = [p.slice(0, pathSize - 1), '', true]\n }\n }\n return ret\n}\n\nconst decString = (buf: Buffer, off: number, size: number) =>\n buf\n .subarray(off, off + size)\n .toString('utf8')\n .replace(/\\0.*/, '')\n\nconst decDate = (buf: Buffer, off: number, size: number) =>\n numToDate(decNumber(buf, off, size))\n\nconst numToDate = (num?: number) =>\n num === undefined ? undefined : new Date(num * 1000)\n\nconst decNumber = (buf: Buffer, off: number, size: number) =>\n Number(buf[off]) & 0x80 ?\n large.parse(buf.subarray(off, off + size))\n : decSmallNumber(buf, off, size)\n\nconst nanUndef = (value: number) => (isNaN(value) ? undefined : value)\n\nconst decSmallNumber = (buf: Buffer, off: number, size: number) =>\n nanUndef(\n parseInt(\n buf\n .subarray(off, off + size)\n .toString('utf8')\n .replace(/\\0.*$/, '')\n .trim(),\n 8,\n ),\n )\n\n// the maximum encodable as a null-terminated octal, by field size\nconst MAXNUM = {\n 12: 0o77777777777,\n 8: 0o7777777,\n}\n\nconst encNumber = (\n buf: Buffer,\n off: number,\n size: 12 | 8,\n num?: number,\n) =>\n num === undefined ? false\n : num > MAXNUM[size] || num < 0 ?\n (large.encode(num, buf.subarray(off, off + size)), true)\n : (encSmallNumber(buf, off, size, num), false)\n\nconst encSmallNumber = (\n buf: Buffer,\n off: number,\n size: number,\n num: number,\n) => buf.write(octalString(num, size), off, size, 'ascii')\n\nconst octalString = (num: number, size: number) =>\n padOctal(Math.floor(num).toString(8), size)\n\nconst padOctal = (str: string, size: number) =>\n (str.length === size - 1 ?\n str\n : new Array(size - str.length - 1).join('0') + str + ' ') + '\\0'\n\nconst encDate = (\n buf: Buffer,\n off: number,\n size: 8 | 12,\n date?: Date,\n) =>\n date === undefined ? false : (\n encNumber(buf, off, size, date.getTime() / 1000)\n )\n\n// enough to fill the longest string we've got\nconst NULLS = new Array(156).join('\\0')\n// pad with nulls, return true if it's longer or non-ascii\nconst encString = (\n buf: Buffer,\n off: number,\n size: number,\n str?: string,\n) =>\n str === undefined ? false : (\n (buf.write(str + NULLS, off, size, 'utf8'),\n str.length !== Buffer.byteLength(str) || str.length > size)\n )\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/index.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/index.d.ts new file mode 100644 index 0000000..a582123 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/index.d.ts @@ -0,0 +1,20 @@ +export { type TarOptionsWithAliasesAsync, type TarOptionsWithAliasesAsyncFile, type TarOptionsWithAliasesAsyncNoFile, type TarOptionsWithAliasesSyncNoFile, type TarOptionsWithAliases, type TarOptionsWithAliasesFile, type TarOptionsWithAliasesSync, type TarOptionsWithAliasesSyncFile, } from './options.js'; +export * from './create.js'; +export { create as c } from './create.js'; +export * from './extract.js'; +export { extract as x } from './extract.js'; +export * from './header.js'; +export * from './list.js'; +export { list as t } from './list.js'; +export * from './pack.js'; +export * from './parse.js'; +export * from './pax.js'; +export * from './read-entry.js'; +export * from './replace.js'; +export { replace as r } from './replace.js'; +export * as types from './types.js'; +export * from './unpack.js'; +export * from './update.js'; +export { update as u } from './update.js'; +export * from './write-entry.js'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/index.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/index.d.ts.map new file mode 100644 index 0000000..71d3bed --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,8BAA8B,EACnC,KAAK,gCAAgC,EACrC,KAAK,+BAA+B,EACpC,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,GACnC,MAAM,cAAc,CAAA;AAErB,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,aAAa,CAAA;AACzC,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,cAAc,CAAA;AAC3C,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,WAAW,CAAA;AAErC,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,aAAa,CAAA;AACzC,cAAc,kBAAkB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/index.js b/node_modules/cmake-js/node_modules/tar/dist/esm/index.js new file mode 100644 index 0000000..1bac641 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/index.js @@ -0,0 +1,20 @@ +export * from './create.js'; +export { create as c } from './create.js'; +export * from './extract.js'; +export { extract as x } from './extract.js'; +export * from './header.js'; +export * from './list.js'; +export { list as t } from './list.js'; +// classes +export * from './pack.js'; +export * from './parse.js'; +export * from './pax.js'; +export * from './read-entry.js'; +export * from './replace.js'; +export { replace as r } from './replace.js'; +export * as types from './types.js'; +export * from './unpack.js'; +export * from './update.js'; +export { update as u } from './update.js'; +export * from './write-entry.js'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/index.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/index.js.map new file mode 100644 index 0000000..c9923d7 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAWA,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,aAAa,CAAA;AACzC,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,cAAc,CAAA;AAC3C,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,WAAW,CAAA;AACrC,UAAU;AACV,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,aAAa,CAAA;AACzC,cAAc,kBAAkB,CAAA","sourcesContent":["export {\n type TarOptionsWithAliasesAsync,\n type TarOptionsWithAliasesAsyncFile,\n type TarOptionsWithAliasesAsyncNoFile,\n type TarOptionsWithAliasesSyncNoFile,\n type TarOptionsWithAliases,\n type TarOptionsWithAliasesFile,\n type TarOptionsWithAliasesSync,\n type TarOptionsWithAliasesSyncFile,\n} from './options.js'\n\nexport * from './create.js'\nexport { create as c } from './create.js'\nexport * from './extract.js'\nexport { extract as x } from './extract.js'\nexport * from './header.js'\nexport * from './list.js'\nexport { list as t } from './list.js'\n// classes\nexport * from './pack.js'\nexport * from './parse.js'\nexport * from './pax.js'\nexport * from './read-entry.js'\nexport * from './replace.js'\nexport { replace as r } from './replace.js'\nexport * as types from './types.js'\nexport * from './unpack.js'\nexport * from './update.js'\nexport { update as u } from './update.js'\nexport * from './write-entry.js'\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/index.min.js b/node_modules/cmake-js/node_modules/tar/dist/esm/index.min.js new file mode 100644 index 0000000..4e06ce8 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/index.min.js @@ -0,0 +1,4 @@ +var Dr=Object.defineProperty;var Ar=(s,t)=>{for(var e in t)Dr(s,e,{get:t[e],enumerable:!0})};import Hr from"events";import I from"fs";import{EventEmitter as Oi}from"node:events";import Ds from"node:stream";import{StringDecoder as Ir}from"node:string_decoder";var Ts=typeof process=="object"&&process?process:{stdout:null,stderr:null},Cr=s=>!!s&&typeof s=="object"&&(s instanceof A||s instanceof Ds||Fr(s)||kr(s)),Fr=s=>!!s&&typeof s=="object"&&s instanceof Oi&&typeof s.pipe=="function"&&s.pipe!==Ds.Writable.prototype.pipe,kr=s=>!!s&&typeof s=="object"&&s instanceof Oi&&typeof s.write=="function"&&typeof s.end=="function",q=Symbol("EOF"),j=Symbol("maybeEmitEnd"),rt=Symbol("emittedEnd"),xe=Symbol("emittingEnd"),jt=Symbol("emittedError"),Le=Symbol("closed"),xs=Symbol("read"),Ne=Symbol("flush"),Ls=Symbol("flushChunk"),z=Symbol("encoding"),Mt=Symbol("decoder"),b=Symbol("flowing"),Qt=Symbol("paused"),Bt=Symbol("resume"),g=Symbol("buffer"),D=Symbol("pipes"),_=Symbol("bufferLength"),Si=Symbol("bufferPush"),De=Symbol("bufferShift"),L=Symbol("objectMode"),w=Symbol("destroyed"),yi=Symbol("error"),Ri=Symbol("emitData"),Ns=Symbol("emitEnd"),bi=Symbol("emitEnd2"),Z=Symbol("async"),gi=Symbol("abort"),Ae=Symbol("aborted"),Jt=Symbol("signal"),yt=Symbol("dataListeners"),C=Symbol("discarded"),te=s=>Promise.resolve().then(s),vr=s=>s(),Mr=s=>s==="end"||s==="finish"||s==="prefinish",Br=s=>s instanceof ArrayBuffer||!!s&&typeof s=="object"&&s.constructor&&s.constructor.name==="ArrayBuffer"&&s.byteLength>=0,Pr=s=>!Buffer.isBuffer(s)&&ArrayBuffer.isView(s),Ie=class{src;dest;opts;ondrain;constructor(t,e,i){this.src=t,this.dest=e,this.opts=i,this.ondrain=()=>t[Bt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},_i=class extends Ie{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,i){super(t,e,i),this.proxyErrors=r=>e.emit("error",r),t.on("error",this.proxyErrors)}},zr=s=>!!s.objectMode,Ur=s=>!s.objectMode&&!!s.encoding&&s.encoding!=="buffer",A=class extends Oi{[b]=!1;[Qt]=!1;[D]=[];[g]=[];[L];[z];[Z];[Mt];[q]=!1;[rt]=!1;[xe]=!1;[Le]=!1;[jt]=null;[_]=0;[w]=!1;[Jt];[Ae]=!1;[yt]=0;[C]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&typeof e.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");zr(e)?(this[L]=!0,this[z]=null):Ur(e)?(this[z]=e.encoding,this[L]=!1):(this[L]=!1,this[z]=null),this[Z]=!!e.async,this[Mt]=this[z]?new Ir(this[z]):null,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[g]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[D]});let{signal:i}=e;i&&(this[Jt]=i,i.aborted?this[gi]():i.addEventListener("abort",()=>this[gi]()))}get bufferLength(){return this[_]}get encoding(){return this[z]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[L]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Z]}set async(t){this[Z]=this[Z]||!!t}[gi](){this[Ae]=!0,this.emit("abort",this[Jt]?.reason),this.destroy(this[Jt]?.reason)}get aborted(){return this[Ae]}set aborted(t){}write(t,e,i){if(this[Ae])return!1;if(this[q])throw new Error("write after end");if(this[w])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof e=="function"&&(i=e,e="utf8"),e||(e="utf8");let r=this[Z]?te:vr;if(!this[L]&&!Buffer.isBuffer(t)){if(Pr(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(Br(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[L]?(this[b]&&this[_]!==0&&this[Ne](!0),this[b]?this.emit("data",t):this[Si](t),this[_]!==0&&this.emit("readable"),i&&r(i),this[b]):t.length?(typeof t=="string"&&!(e===this[z]&&!this[Mt]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[z]&&(t=this[Mt].write(t)),this[b]&&this[_]!==0&&this[Ne](!0),this[b]?this.emit("data",t):this[Si](t),this[_]!==0&&this.emit("readable"),i&&r(i),this[b]):(this[_]!==0&&this.emit("readable"),i&&r(i),this[b])}read(t){if(this[w])return null;if(this[C]=!1,this[_]===0||t===0||t&&t>this[_])return this[j](),null;this[L]&&(t=null),this[g].length>1&&!this[L]&&(this[g]=[this[z]?this[g].join(""):Buffer.concat(this[g],this[_])]);let e=this[xs](t||null,this[g][0]);return this[j](),e}[xs](t,e){if(this[L])this[De]();else{let i=e;t===i.length||t===null?this[De]():typeof i=="string"?(this[g][0]=i.slice(t),e=i.slice(0,t),this[_]-=t):(this[g][0]=i.subarray(t),e=i.subarray(0,t),this[_]-=t)}return this.emit("data",e),!this[g].length&&!this[q]&&this.emit("drain"),e}end(t,e,i){return typeof t=="function"&&(i=t,t=void 0),typeof e=="function"&&(i=e,e="utf8"),t!==void 0&&this.write(t,e),i&&this.once("end",i),this[q]=!0,this.writable=!1,(this[b]||!this[Qt])&&this[j](),this}[Bt](){this[w]||(!this[yt]&&!this[D].length&&(this[C]=!0),this[Qt]=!1,this[b]=!0,this.emit("resume"),this[g].length?this[Ne]():this[q]?this[j]():this.emit("drain"))}resume(){return this[Bt]()}pause(){this[b]=!1,this[Qt]=!0,this[C]=!1}get destroyed(){return this[w]}get flowing(){return this[b]}get paused(){return this[Qt]}[Si](t){this[L]?this[_]+=1:this[_]+=t.length,this[g].push(t)}[De](){return this[L]?this[_]-=1:this[_]-=this[g][0].length,this[g].shift()}[Ne](t=!1){do;while(this[Ls](this[De]())&&this[g].length);!t&&!this[g].length&&!this[q]&&this.emit("drain")}[Ls](t){return this.emit("data",t),this[b]}pipe(t,e){if(this[w])return t;this[C]=!1;let i=this[rt];return e=e||{},t===Ts.stdout||t===Ts.stderr?e.end=!1:e.end=e.end!==!1,e.proxyErrors=!!e.proxyErrors,i?e.end&&t.end():(this[D].push(e.proxyErrors?new _i(this,t,e):new Ie(this,t,e)),this[Z]?te(()=>this[Bt]()):this[Bt]()),t}unpipe(t){let e=this[D].find(i=>i.dest===t);e&&(this[D].length===1?(this[b]&&this[yt]===0&&(this[b]=!1),this[D]=[]):this[D].splice(this[D].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let i=super.on(t,e);if(t==="data")this[C]=!1,this[yt]++,!this[D].length&&!this[b]&&this[Bt]();else if(t==="readable"&&this[_]!==0)super.emit("readable");else if(Mr(t)&&this[rt])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[jt]){let r=e;this[Z]?te(()=>r.call(this,this[jt])):r.call(this,this[jt])}return i}removeListener(t,e){return this.off(t,e)}off(t,e){let i=super.off(t,e);return t==="data"&&(this[yt]=this.listeners("data").length,this[yt]===0&&!this[C]&&!this[D].length&&(this[b]=!1)),i}removeAllListeners(t){let e=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[yt]=0,!this[C]&&!this[D].length&&(this[b]=!1)),e}get emittedEnd(){return this[rt]}[j](){!this[xe]&&!this[rt]&&!this[w]&&this[g].length===0&&this[q]&&(this[xe]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Le]&&this.emit("close"),this[xe]=!1)}emit(t,...e){let i=e[0];if(t!=="error"&&t!=="close"&&t!==w&&this[w])return!1;if(t==="data")return!this[L]&&!i?!1:this[Z]?(te(()=>this[Ri](i)),!0):this[Ri](i);if(t==="end")return this[Ns]();if(t==="close"){if(this[Le]=!0,!this[rt]&&!this[w])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(t==="error"){this[jt]=i,super.emit(yi,i);let n=!this[Jt]||this.listeners("error").length?super.emit("error",i):!1;return this[j](),n}else if(t==="resume"){let n=super.emit("resume");return this[j](),n}else if(t==="finish"||t==="prefinish"){let n=super.emit(t);return this.removeAllListeners(t),n}let r=super.emit(t,...e);return this[j](),r}[Ri](t){for(let i of this[D])i.dest.write(t)===!1&&this.pause();let e=this[C]?!1:super.emit("data",t);return this[j](),e}[Ns](){return this[rt]?!1:(this[rt]=!0,this.readable=!1,this[Z]?(te(()=>this[bi]()),!0):this[bi]())}[bi](){if(this[Mt]){let e=this[Mt].end();if(e){for(let i of this[D])i.dest.write(e);this[C]||super.emit("data",e)}}for(let e of this[D])e.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[L]||(t.dataLength=0);let e=this.promise();return this.on("data",i=>{t.push(i),this[L]||(t.dataLength+=i.length)}),await e,t}async concat(){if(this[L])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[z]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(w,()=>e(new Error("stream destroyed"))),this.on("error",i=>e(i)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[C]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[q])return e();let n,o,h=d=>{this.off("data",a),this.off("end",l),this.off(w,c),e(),o(d)},a=d=>{this.off("error",h),this.off("end",l),this.off(w,c),this.pause(),n({value:d,done:!!this[q]})},l=()=>{this.off("error",h),this.off("data",a),this.off(w,c),e(),n({done:!0,value:void 0})},c=()=>h(new Error("stream destroyed"));return new Promise((d,S)=>{o=S,n=d,this.once(w,c),this.once("error",h),this.once("end",l),this.once("data",a)})},throw:e,return:e,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[C]=!1;let t=!1,e=()=>(this.pause(),this.off(yi,e),this.off(w,e),this.off("end",e),t=!0,{done:!0,value:void 0}),i=()=>{if(t)return e();let r=this.read();return r===null?e():{done:!1,value:r}};return this.once("end",e),this.once(yi,e),this.once(w,e),{next:i,throw:e,return:e,[Symbol.iterator](){return this}}}destroy(t){if(this[w])return t?this.emit("error",t):this.emit(w),this;this[w]=!0,this[C]=!0,this[g].length=0,this[_]=0;let e=this;return typeof e.close=="function"&&!this[Le]&&e.close(),t?this.emit("error",t):this.emit(w),this}static get isStream(){return Cr}};var Wr=I.writev,ot=Symbol("_autoClose"),H=Symbol("_close"),ee=Symbol("_ended"),m=Symbol("_fd"),Ti=Symbol("_finished"),J=Symbol("_flags"),xi=Symbol("_flush"),Ai=Symbol("_handleChunk"),Ii=Symbol("_makeBuf"),se=Symbol("_mode"),Ce=Symbol("_needDrain"),Ut=Symbol("_onerror"),Ht=Symbol("_onopen"),Li=Symbol("_onread"),Pt=Symbol("_onwrite"),ht=Symbol("_open"),U=Symbol("_path"),nt=Symbol("_pos"),Y=Symbol("_queue"),zt=Symbol("_read"),Ni=Symbol("_readSize"),Q=Symbol("_reading"),ie=Symbol("_remain"),Di=Symbol("_size"),Fe=Symbol("_write"),Rt=Symbol("_writing"),ke=Symbol("_defaultFlag"),bt=Symbol("_errored"),gt=class extends A{[bt]=!1;[m];[U];[Ni];[Q]=!1;[Di];[ie];[ot];constructor(t,e){if(e=e||{},super(e),this.readable=!0,this.writable=!1,typeof t!="string")throw new TypeError("path must be a string");this[bt]=!1,this[m]=typeof e.fd=="number"?e.fd:void 0,this[U]=t,this[Ni]=e.readSize||16*1024*1024,this[Q]=!1,this[Di]=typeof e.size=="number"?e.size:1/0,this[ie]=this[Di],this[ot]=typeof e.autoClose=="boolean"?e.autoClose:!0,typeof this[m]=="number"?this[zt]():this[ht]()}get fd(){return this[m]}get path(){return this[U]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[ht](){I.open(this[U],"r",(t,e)=>this[Ht](t,e))}[Ht](t,e){t?this[Ut](t):(this[m]=e,this.emit("open",e),this[zt]())}[Ii](){return Buffer.allocUnsafe(Math.min(this[Ni],this[ie]))}[zt](){if(!this[Q]){this[Q]=!0;let t=this[Ii]();if(t.length===0)return process.nextTick(()=>this[Li](null,0,t));I.read(this[m],t,0,t.length,null,(e,i,r)=>this[Li](e,i,r))}}[Li](t,e,i){this[Q]=!1,t?this[Ut](t):this[Ai](e,i)&&this[zt]()}[H](){if(this[ot]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,I.close(t,e=>e?this.emit("error",e):this.emit("close"))}}[Ut](t){this[Q]=!0,this[H](),this.emit("error",t)}[Ai](t,e){let i=!1;return this[ie]-=t,t>0&&(i=super.write(tthis[Ht](t,e))}[Ht](t,e){this[ke]&&this[J]==="r+"&&t&&t.code==="ENOENT"?(this[J]="w",this[ht]()):t?this[Ut](t):(this[m]=e,this.emit("open",e),this[Rt]||this[xi]())}end(t,e){return t&&this.write(t,e),this[ee]=!0,!this[Rt]&&!this[Y].length&&typeof this[m]=="number"&&this[Pt](null,0),this}write(t,e){return typeof t=="string"&&(t=Buffer.from(t,e)),this[ee]?(this.emit("error",new Error("write() after end()")),!1):this[m]===void 0||this[Rt]||this[Y].length?(this[Y].push(t),this[Ce]=!0,!1):(this[Rt]=!0,this[Fe](t),!0)}[Fe](t){I.write(this[m],t,0,t.length,this[nt],(e,i)=>this[Pt](e,i))}[Pt](t,e){t?this[Ut](t):(this[nt]!==void 0&&typeof e=="number"&&(this[nt]+=e),this[Y].length?this[xi]():(this[Rt]=!1,this[ee]&&!this[Ti]?(this[Ti]=!0,this[H](),this.emit("finish")):this[Ce]&&(this[Ce]=!1,this.emit("drain"))))}[xi](){if(this[Y].length===0)this[ee]&&this[Pt](null,0);else if(this[Y].length===1)this[Fe](this[Y].pop());else{let t=this[Y];this[Y]=[],Wr(this[m],t,this[nt],(e,i)=>this[Pt](e,i))}}[H](){if(this[ot]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,I.close(t,e=>e?this.emit("error",e):this.emit("close"))}}},Wt=class extends tt{[ht](){let t;if(this[ke]&&this[J]==="r+")try{t=I.openSync(this[U],this[J],this[se])}catch(e){if(e?.code==="ENOENT")return this[J]="w",this[ht]();throw e}else t=I.openSync(this[U],this[J],this[se]);this[Ht](null,t)}[H](){if(this[ot]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,I.closeSync(t),this.emit("close")}}[Fe](t){let e=!0;try{this[Pt](null,I.writeSync(this[m],t,0,t.length,this[nt])),e=!1}finally{if(e)try{this[H]()}catch{}}}};import or from"node:path";import Vt from"node:fs";import{dirname as bn,parse as gn}from"path";var Gr=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),As=s=>!!s.sync&&!!s.file,Is=s=>!s.sync&&!!s.file,Cs=s=>!!s.sync&&!s.file,Fs=s=>!s.sync&&!s.file;var ks=s=>!!s.file;var Zr=s=>{let t=Gr.get(s);return t||s},re=(s={})=>{if(!s)return{};let t={};for(let[e,i]of Object.entries(s)){let r=Zr(e);t[r]=i}return t.chmod===void 0&&t.noChmod===!1&&(t.chmod=!0),delete t.noChmod,t};var K=(s,t,e,i,r)=>Object.assign((n=[],o,h)=>{Array.isArray(n)&&(o=n,n={}),typeof o=="function"&&(h=o,o=void 0),o?o=Array.from(o):o=[];let a=re(n);if(r?.(a,o),As(a)){if(typeof h=="function")throw new TypeError("callback not supported for sync tar functions");return s(a,o)}else if(Is(a)){let l=t(a,o),c=h||void 0;return c?l.then(()=>c(),c):l}else if(Cs(a)){if(typeof h=="function")throw new TypeError("callback not supported for sync tar functions");return e(a,o)}else if(Fs(a)){if(typeof h=="function")throw new TypeError("callback only supported with file option");return i(a,o)}else throw new Error("impossible options??")},{syncFile:s,asyncFile:t,syncNoFile:e,asyncNoFile:i,validate:r});import{EventEmitter as wn}from"events";import vi from"assert";import{Buffer as _t}from"buffer";import*as vs from"zlib";import Yr from"zlib";var Kr=Yr.constants||{ZLIB_VERNUM:4736},M=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},Kr));var Vr=_t.concat,Ms=Object.getOwnPropertyDescriptor(_t,"concat"),$r=s=>s,Fi=Ms?.writable===!0||Ms?.set!==void 0?s=>{_t.concat=s?$r:Vr}:s=>{},Ot=Symbol("_superWrite"),Gt=class extends Error{code;errno;constructor(t,e){super("zlib: "+t.message,{cause:t}),this.code=t.code,this.errno=t.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+t.message,Error.captureStackTrace(this,e??this.constructor)}get name(){return"ZlibError"}},ki=Symbol("flushFlag"),ne=class extends A{#t=!1;#i=!1;#s;#n;#r;#e;#o;get sawError(){return this.#t}get handle(){return this.#e}get flushFlag(){return this.#s}constructor(t,e){if(!t||typeof t!="object")throw new TypeError("invalid options for ZlibBase constructor");if(super(t),this.#s=t.flush??0,this.#n=t.finishFlush??0,this.#r=t.fullFlushFlag??0,typeof vs[e]!="function")throw new TypeError("Compression method not supported: "+e);try{this.#e=new vs[e](t)}catch(i){throw new Gt(i,this.constructor)}this.#o=i=>{this.#t||(this.#t=!0,this.close(),this.emit("error",i))},this.#e?.on("error",i=>this.#o(new Gt(i))),this.once("end",()=>this.close)}close(){this.#e&&(this.#e.close(),this.#e=void 0,this.emit("close"))}reset(){if(!this.#t)return vi(this.#e,"zlib binding closed"),this.#e.reset?.()}flush(t){this.ended||(typeof t!="number"&&(t=this.#r),this.write(Object.assign(_t.alloc(0),{[ki]:t})))}end(t,e,i){return typeof t=="function"&&(i=t,e=void 0,t=void 0),typeof e=="function"&&(i=e,e=void 0),t&&(e?this.write(t,e):this.write(t)),this.flush(this.#n),this.#i=!0,super.end(i)}get ended(){return this.#i}[Ot](t){return super.write(t)}write(t,e,i){if(typeof e=="function"&&(i=e,e="utf8"),typeof t=="string"&&(t=_t.from(t,e)),this.#t)return;vi(this.#e,"zlib binding closed");let r=this.#e._handle,n=r.close;r.close=()=>{};let o=this.#e.close;this.#e.close=()=>{},Fi(!0);let h;try{let l=typeof t[ki]=="number"?t[ki]:this.#s;h=this.#e._processChunk(t,l),Fi(!1)}catch(l){Fi(!1),this.#o(new Gt(l,this.write))}finally{this.#e&&(this.#e._handle=r,r.close=n,this.#e.close=o,this.#e.removeAllListeners("error"))}this.#e&&this.#e.on("error",l=>this.#o(new Gt(l,this.write)));let a;if(h)if(Array.isArray(h)&&h.length>0){let l=h[0];a=this[Ot](_t.from(l));for(let c=1;c{typeof r=="function"&&(n=r,r=this.flushFlag),this.flush(r),n?.()};try{this.handle.params(t,e)}finally{this.handle.flush=i}this.handle&&(this.#t=t,this.#i=e)}}}};var Be=class extends Me{#t;constructor(t){super(t,"Gzip"),this.#t=t&&!!t.portable}[Ot](t){return this.#t?(this.#t=!1,t[9]=255,super[Ot](t)):super[Ot](t)}};var Pe=class extends Me{constructor(t){super(t,"Unzip")}},ze=class extends ne{constructor(t,e){t=t||{},t.flush=t.flush||M.BROTLI_OPERATION_PROCESS,t.finishFlush=t.finishFlush||M.BROTLI_OPERATION_FINISH,t.fullFlushFlag=M.BROTLI_OPERATION_FLUSH,super(t,e)}},Ue=class extends ze{constructor(t){super(t,"BrotliCompress")}},He=class extends ze{constructor(t){super(t,"BrotliDecompress")}},We=class extends ne{constructor(t,e){t=t||{},t.flush=t.flush||M.ZSTD_e_continue,t.finishFlush=t.finishFlush||M.ZSTD_e_end,t.fullFlushFlag=M.ZSTD_e_flush,super(t,e)}},Ge=class extends We{constructor(t){super(t,"ZstdCompress")}},Ze=class extends We{constructor(t){super(t,"ZstdDecompress")}};import{posix as Zt}from"node:path";var Bs=(s,t)=>{if(Number.isSafeInteger(s))s<0?jr(s,t):qr(s,t);else throw Error("cannot encode number outside of javascript safe integer range");return t},qr=(s,t)=>{t[0]=128;for(var e=t.length;e>1;e--)t[e-1]=s&255,s=Math.floor(s/256)},jr=(s,t)=>{t[0]=255;var e=!1;s=s*-1;for(var i=t.length;i>1;i--){var r=s&255;s=Math.floor(s/256),e?t[i-1]=zs(r):r===0?t[i-1]=0:(e=!0,t[i-1]=Us(r))}},Ps=s=>{let t=s[0],e=t===128?Jr(s.subarray(1,s.length)):t===255?Qr(s):null;if(e===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(e))throw Error("parsed number outside of javascript safe integer range");return e},Qr=s=>{for(var t=s.length,e=0,i=!1,r=t-1;r>-1;r--){var n=Number(s[r]),o;i?o=zs(n):n===0?o=n:(i=!0,o=Us(n)),o!==0&&(e-=o*Math.pow(256,t-r-1))}return e},Jr=s=>{for(var t=s.length,e=0,i=t-1;i>-1;i--){var r=Number(s[i]);r!==0&&(e+=r*Math.pow(256,t-i-1))}return e},zs=s=>(255^s)&255,Us=s=>(255^s)+1&255;var Mi={};Ar(Mi,{code:()=>Ye,isCode:()=>oe,isName:()=>en,name:()=>he});var oe=s=>he.has(s),en=s=>Ye.has(s),he=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Ye=new Map(Array.from(he).map(s=>[s[1],s[0]]));var F=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#t="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,e=0,i,r){Buffer.isBuffer(t)?this.decode(t,e||0,i,r):t&&this.#i(t)}decode(t,e,i,r){if(e||(e=0),!t||!(t.length>=e+512))throw new Error("need 512 bytes for header");this.path=i?.path??Tt(t,e,100),this.mode=i?.mode??r?.mode??at(t,e+100,8),this.uid=i?.uid??r?.uid??at(t,e+108,8),this.gid=i?.gid??r?.gid??at(t,e+116,8),this.size=i?.size??r?.size??at(t,e+124,12),this.mtime=i?.mtime??r?.mtime??Bi(t,e+136,12),this.cksum=at(t,e+148,12),r&&this.#i(r,!0),i&&this.#i(i);let n=Tt(t,e+156,1);if(oe(n)&&(this.#t=n||"0"),this.#t==="0"&&this.path.slice(-1)==="/"&&(this.#t="5"),this.#t==="5"&&(this.size=0),this.linkpath=Tt(t,e+157,100),t.subarray(e+257,e+265).toString()==="ustar\x0000")if(this.uname=i?.uname??r?.uname??Tt(t,e+265,32),this.gname=i?.gname??r?.gname??Tt(t,e+297,32),this.devmaj=i?.devmaj??r?.devmaj??at(t,e+329,8)??0,this.devmin=i?.devmin??r?.devmin??at(t,e+337,8)??0,t[e+475]!==0){let h=Tt(t,e+345,155);this.path=h+"/"+this.path}else{let h=Tt(t,e+345,130);h&&(this.path=h+"/"+this.path),this.atime=i?.atime??r?.atime??Bi(t,e+476,12),this.ctime=i?.ctime??r?.ctime??Bi(t,e+488,12)}let o=256;for(let h=e;h!(r==null||i==="path"&&e||i==="linkpath"&&e||i==="global"))))}encode(t,e=0){if(t||(t=this.block=Buffer.alloc(512)),this.#t==="Unsupported"&&(this.#t="0"),!(t.length>=e+512))throw new Error("need 512 bytes for header");let i=this.ctime||this.atime?130:155,r=sn(this.path||"",i),n=r[0],o=r[1];this.needPax=!!r[2],this.needPax=xt(t,e,100,n)||this.needPax,this.needPax=lt(t,e+100,8,this.mode)||this.needPax,this.needPax=lt(t,e+108,8,this.uid)||this.needPax,this.needPax=lt(t,e+116,8,this.gid)||this.needPax,this.needPax=lt(t,e+124,12,this.size)||this.needPax,this.needPax=Pi(t,e+136,12,this.mtime)||this.needPax,t[e+156]=this.#t.charCodeAt(0),this.needPax=xt(t,e+157,100,this.linkpath)||this.needPax,t.write("ustar\x0000",e+257,8),this.needPax=xt(t,e+265,32,this.uname)||this.needPax,this.needPax=xt(t,e+297,32,this.gname)||this.needPax,this.needPax=lt(t,e+329,8,this.devmaj)||this.needPax,this.needPax=lt(t,e+337,8,this.devmin)||this.needPax,this.needPax=xt(t,e+345,i,o)||this.needPax,t[e+475]!==0?this.needPax=xt(t,e+345,155,o)||this.needPax:(this.needPax=xt(t,e+345,130,o)||this.needPax,this.needPax=Pi(t,e+476,12,this.atime)||this.needPax,this.needPax=Pi(t,e+488,12,this.ctime)||this.needPax);let h=256;for(let a=e;a{let i=s,r="",n,o=Zt.parse(s).root||".";if(Buffer.byteLength(i)<100)n=[i,r,!1];else{r=Zt.dirname(i),i=Zt.basename(i);do Buffer.byteLength(i)<=100&&Buffer.byteLength(r)<=t?n=[i,r,!1]:Buffer.byteLength(i)>100&&Buffer.byteLength(r)<=t?n=[i.slice(0,99),r,!0]:(i=Zt.join(Zt.basename(r),i),r=Zt.dirname(r));while(r!==o&&n===void 0);n||(n=[s.slice(0,99),"",!0])}return n},Tt=(s,t,e)=>s.subarray(t,t+e).toString("utf8").replace(/\0.*/,""),Bi=(s,t,e)=>rn(at(s,t,e)),rn=s=>s===void 0?void 0:new Date(s*1e3),at=(s,t,e)=>Number(s[t])&128?Ps(s.subarray(t,t+e)):on(s,t,e),nn=s=>isNaN(s)?void 0:s,on=(s,t,e)=>nn(parseInt(s.subarray(t,t+e).toString("utf8").replace(/\0.*$/,"").trim(),8)),hn={12:8589934591,8:2097151},lt=(s,t,e,i)=>i===void 0?!1:i>hn[e]||i<0?(Bs(i,s.subarray(t,t+e)),!0):(an(s,t,e,i),!1),an=(s,t,e,i)=>s.write(ln(i,e),t,e,"ascii"),ln=(s,t)=>cn(Math.floor(s).toString(8),t),cn=(s,t)=>(s.length===t-1?s:new Array(t-s.length-1).join("0")+s+" ")+"\0",Pi=(s,t,e,i)=>i===void 0?!1:lt(s,t,e,i.getTime()/1e3),fn=new Array(156).join("\0"),xt=(s,t,e,i)=>i===void 0?!1:(s.write(i+fn,t,e,"utf8"),i.length!==Buffer.byteLength(i)||i.length>e);import{basename as dn}from"node:path";var ct=class s{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,e=!1){this.atime=t.atime,this.charset=t.charset,this.comment=t.comment,this.ctime=t.ctime,this.dev=t.dev,this.gid=t.gid,this.global=e,this.gname=t.gname,this.ino=t.ino,this.linkpath=t.linkpath,this.mtime=t.mtime,this.nlink=t.nlink,this.path=t.path,this.size=t.size,this.uid=t.uid,this.uname=t.uname}encode(){let t=this.encodeBody();if(t==="")return Buffer.allocUnsafe(0);let e=Buffer.byteLength(t),i=512*Math.ceil(1+e/512),r=Buffer.allocUnsafe(i);for(let n=0;n<512;n++)r[n]=0;new F({path:("PaxHeader/"+dn(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:e,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(r),r.write(t,512,e,"utf8");for(let n=e+512;n=Math.pow(10,o)&&(o+=1),o+n+r}static parse(t,e,i=!1){return new s(un(mn(t),e),i)}},un=(s,t)=>t?Object.assign({},t,s):s,mn=s=>s.replace(/\n$/,"").split(` +`).reduce(pn,Object.create(null)),pn=(s,t)=>{let e=parseInt(t,10);if(e!==Buffer.byteLength(t)+1)return s;t=t.slice((e+" ").length);let i=t.split("="),r=i.shift();if(!r)return s;let n=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),o=i.join("=");return s[n]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(n)?new Date(Number(o)*1e3):/^[0-9]+$/.test(o)?+o:o,s};var En=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,f=En!=="win32"?s=>s:s=>s&&s.replace(/\\/g,"/");var Yt=class extends A{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(t,e,i){switch(super({}),this.pause(),this.extended=e,this.globalExtended=i,this.header=t,this.remain=t.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=t.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!t.path)throw new Error("no path provided for tar.ReadEntry");this.path=f(t.path),this.mode=t.mode,this.mode&&(this.mode=this.mode&4095),this.uid=t.uid,this.gid=t.gid,this.uname=t.uname,this.gname=t.gname,this.size=this.remain,this.mtime=t.mtime,this.atime=t.atime,this.ctime=t.ctime,this.linkpath=t.linkpath?f(t.linkpath):void 0,this.uname=t.uname,this.gname=t.gname,e&&this.#t(e),i&&this.#t(i,!0)}write(t){let e=t.length;if(e>this.blockRemain)throw new Error("writing more to entry than is appropriate");let i=this.remain,r=this.blockRemain;return this.remain=Math.max(0,i-e),this.blockRemain=Math.max(0,r-e),this.ignore?!0:i>=e?super.write(t):super.write(t.subarray(0,i))}#t(t,e=!1){t.path&&(t.path=f(t.path)),t.linkpath&&(t.linkpath=f(t.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(t).filter(([i,r])=>!(r==null||i==="path"&&e))))}};var Lt=(s,t,e,i={})=>{s.file&&(i.file=s.file),s.cwd&&(i.cwd=s.cwd),i.code=e instanceof Error&&e.code||t,i.tarCode=t,!s.strict&&i.recoverable!==!1?(e instanceof Error&&(i=Object.assign(e,i),e=e.message),s.emit("warn",t,e,i)):e instanceof Error?s.emit("error",Object.assign(e,i)):s.emit("error",Object.assign(new Error(`${t}: ${e}`),i))};var Sn=1024*1024,Gi=Buffer.from([31,139]),Zi=Buffer.from([40,181,47,253]),yn=Math.max(Gi.length,Zi.length),B=Symbol("state"),Nt=Symbol("writeEntry"),et=Symbol("readEntry"),zi=Symbol("nextEntry"),Hs=Symbol("processEntry"),V=Symbol("extendedHeader"),ae=Symbol("globalExtendedHeader"),ft=Symbol("meta"),Ws=Symbol("emitMeta"),p=Symbol("buffer"),it=Symbol("queue"),dt=Symbol("ended"),Ui=Symbol("emittedEnd"),Dt=Symbol("emit"),y=Symbol("unzip"),Ke=Symbol("consumeChunk"),Ve=Symbol("consumeChunkSub"),Hi=Symbol("consumeBody"),Gs=Symbol("consumeMeta"),Zs=Symbol("consumeHeader"),le=Symbol("consuming"),Wi=Symbol("bufferConcat"),$e=Symbol("maybeEnd"),Kt=Symbol("writing"),ut=Symbol("aborted"),Xe=Symbol("onDone"),At=Symbol("sawValidEntry"),qe=Symbol("sawNullBlock"),je=Symbol("sawEOF"),Ys=Symbol("closeStream"),Rn=()=>!0,st=class extends wn{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[it]=[];[p];[et];[Nt];[B]="begin";[ft]="";[V];[ae];[dt]=!1;[y];[ut]=!1;[At];[qe]=!1;[je]=!1;[Kt]=!1;[le]=!1;[Ui]=!1;constructor(t={}){super(),this.file=t.file||"",this.on(Xe,()=>{(this[B]==="begin"||this[At]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),t.ondone?this.on(Xe,t.ondone):this.on(Xe,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!t.strict,this.maxMetaEntrySize=t.maxMetaEntrySize||Sn,this.filter=typeof t.filter=="function"?t.filter:Rn;let e=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=!(t.gzip||t.zstd)&&t.brotli!==void 0?t.brotli:e?void 0:!1;let i=t.file&&(t.file.endsWith(".tar.zst")||t.file.endsWith(".tzst"));this.zstd=!(t.gzip||t.brotli)&&t.zstd!==void 0?t.zstd:i?!0:void 0,this.on("end",()=>this[Ys]()),typeof t.onwarn=="function"&&this.on("warn",t.onwarn),typeof t.onReadEntry=="function"&&this.on("entry",t.onReadEntry)}warn(t,e,i={}){Lt(this,t,e,i)}[Zs](t,e){this[At]===void 0&&(this[At]=!1);let i;try{i=new F(t,e,this[V],this[ae])}catch(r){return this.warn("TAR_ENTRY_INVALID",r)}if(i.nullBlock)this[qe]?(this[je]=!0,this[B]==="begin"&&(this[B]="header"),this[Dt]("eof")):(this[qe]=!0,this[Dt]("nullBlock"));else if(this[qe]=!1,!i.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i});else if(!i.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else{let r=i.type;if(/^(Symbolic)?Link$/.test(r)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(!/^(Symbolic)?Link$/.test(r)&&!/^(Global)?ExtendedHeader$/.test(r)&&i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i});else{let n=this[Nt]=new Yt(i,this[V],this[ae]);if(!this[At])if(n.remain){let o=()=>{n.invalid||(this[At]=!0)};n.on("end",o)}else this[At]=!0;n.meta?n.size>this.maxMetaEntrySize?(n.ignore=!0,this[Dt]("ignoredEntry",n),this[B]="ignore",n.resume()):n.size>0&&(this[ft]="",n.on("data",o=>this[ft]+=o),this[B]="meta"):(this[V]=void 0,n.ignore=n.ignore||!this.filter(n.path,n),n.ignore?(this[Dt]("ignoredEntry",n),this[B]=n.remain?"ignore":"header",n.resume()):(n.remain?this[B]="body":(this[B]="header",n.end()),this[et]?this[it].push(n):(this[it].push(n),this[zi]())))}}}[Ys](){queueMicrotask(()=>this.emit("close"))}[Hs](t){let e=!0;if(!t)this[et]=void 0,e=!1;else if(Array.isArray(t)){let[i,...r]=t;this.emit(i,...r)}else this[et]=t,this.emit("entry",t),t.emittedEnd||(t.on("end",()=>this[zi]()),e=!1);return e}[zi](){do;while(this[Hs](this[it].shift()));if(!this[it].length){let t=this[et];!t||t.flowing||t.size===t.remain?this[Kt]||this.emit("drain"):t.once("drain",()=>this.emit("drain"))}}[Hi](t,e){let i=this[Nt];if(!i)throw new Error("attempt to consume body without entry??");let r=i.blockRemain??0,n=r>=t.length&&e===0?t:t.subarray(e,e+r);return i.write(n),i.blockRemain||(this[B]="header",this[Nt]=void 0,i.end()),n.length}[Gs](t,e){let i=this[Nt],r=this[Hi](t,e);return!this[Nt]&&i&&this[Ws](i),r}[Dt](t,e,i){!this[it].length&&!this[et]?this.emit(t,e,i):this[it].push([t,e,i])}[Ws](t){switch(this[Dt]("meta",this[ft]),t.type){case"ExtendedHeader":case"OldExtendedHeader":this[V]=ct.parse(this[ft],this[V],!1);break;case"GlobalExtendedHeader":this[ae]=ct.parse(this[ft],this[ae],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let e=this[V]??Object.create(null);this[V]=e,e.path=this[ft].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let e=this[V]||Object.create(null);this[V]=e,e.linkpath=this[ft].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+t.type)}}abort(t){this[ut]=!0,this.emit("abort",t),this.warn("TAR_ABORT",t,{recoverable:!1})}write(t,e,i){if(typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof e=="string"?e:"utf8")),this[ut])return i?.(),!1;if((this[y]===void 0||this.brotli===void 0&&this[y]===!1)&&t){if(this[p]&&(t=Buffer.concat([this[p],t]),this[p]=void 0),t.lengththis[Ke](c)),this[y].on("error",c=>this.abort(c)),this[y].on("end",()=>{this[dt]=!0,this[Ke]()}),this[Kt]=!0;let l=!!this[y][a?"end":"write"](t);return this[Kt]=!1,i?.(),l}}this[Kt]=!0,this[y]?this[y].write(t):this[Ke](t),this[Kt]=!1;let n=this[it].length?!1:this[et]?this[et].flowing:!0;return!n&&!this[it].length&&this[et]?.once("drain",()=>this.emit("drain")),i?.(),n}[Wi](t){t&&!this[ut]&&(this[p]=this[p]?Buffer.concat([this[p],t]):t)}[$e](){if(this[dt]&&!this[Ui]&&!this[ut]&&!this[le]){this[Ui]=!0;let t=this[Nt];if(t&&t.blockRemain){let e=this[p]?this[p].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${e} available)`,{entry:t}),this[p]&&t.write(this[p]),t.end()}this[Dt](Xe)}}[Ke](t){if(this[le]&&t)this[Wi](t);else if(!t&&!this[p])this[$e]();else if(t){if(this[le]=!0,this[p]){this[Wi](t);let e=this[p];this[p]=void 0,this[Ve](e)}else this[Ve](t);for(;this[p]&&this[p]?.length>=512&&!this[ut]&&!this[je];){let e=this[p];this[p]=void 0,this[Ve](e)}this[le]=!1}(!this[p]||this[dt])&&this[$e]()}[Ve](t){let e=0,i=t.length;for(;e+512<=i&&!this[ut]&&!this[je];)switch(this[B]){case"begin":case"header":this[Zs](t,e),e+=512;break;case"ignore":case"body":e+=this[Hi](t,e);break;case"meta":e+=this[Gs](t,e);break;default:throw new Error("invalid state: "+this[B])}e{let t=s.length-1,e=-1;for(;t>-1&&s.charAt(t)==="/";)e=t,t--;return e===-1?s:s.slice(0,e)};var _n=s=>{let t=s.onReadEntry;s.onReadEntry=t?e=>{t(e),e.resume()}:e=>e.resume()},Yi=(s,t)=>{let e=new Map(t.map(n=>[mt(n),!0])),i=s.filter,r=(n,o="")=>{let h=o||gn(n).root||".",a;if(n===h)a=!1;else{let l=e.get(n);l!==void 0?a=l:a=r(bn(n),h)}return e.set(n,a),a};s.filter=i?(n,o)=>i(n,o)&&r(mt(n)):n=>r(mt(n))},On=s=>{let t=new st(s),e=s.file,i;try{i=Vt.openSync(e,"r");let r=Vt.fstatSync(i),n=s.maxReadSize||16*1024*1024;if(r.size{let e=new st(s),i=s.maxReadSize||16*1024*1024,r=s.file;return new Promise((o,h)=>{e.on("error",h),e.on("end",o),Vt.stat(r,(a,l)=>{if(a)h(a);else{let c=new gt(r,{readSize:i,size:l.size});c.on("error",h),c.pipe(e)}})})},It=K(On,Tn,s=>new st(s),s=>new st(s),(s,t)=>{t?.length&&Yi(s,t),s.noResume||_n(s)});import ci from"fs";import $ from"fs";import Xs from"path";var Ki=(s,t,e)=>(s&=4095,e&&(s=(s|384)&-19),t&&(s&256&&(s|=64),s&32&&(s|=8),s&4&&(s|=1)),s);import{win32 as xn}from"node:path";var{isAbsolute:Ln,parse:Ks}=xn,ce=s=>{let t="",e=Ks(s);for(;Ln(s)||e.root;){let i=s.charAt(0)==="/"&&s.slice(0,4)!=="//?/"?"/":e.root;s=s.slice(i.length),t+=i,e=Ks(s)}return[t,s]};var Qe=["|","<",">","?",":"],Vi=Qe.map(s=>String.fromCharCode(61440+s.charCodeAt(0))),Nn=new Map(Qe.map((s,t)=>[s,Vi[t]])),Dn=new Map(Vi.map((s,t)=>[s,Qe[t]])),$i=s=>Qe.reduce((t,e)=>t.split(e).join(Nn.get(e)),s),Vs=s=>Vi.reduce((t,e)=>t.split(e).join(Dn.get(e)),s);var tr=(s,t)=>t?(s=f(s).replace(/^\.(\/|$)/,""),mt(t)+"/"+s):f(s),An=16*1024*1024,qs=Symbol("process"),js=Symbol("file"),Qs=Symbol("directory"),qi=Symbol("symlink"),Js=Symbol("hardlink"),fe=Symbol("header"),Je=Symbol("read"),ji=Symbol("lstat"),ti=Symbol("onlstat"),Qi=Symbol("onread"),Ji=Symbol("onreadlink"),ts=Symbol("openfile"),es=Symbol("onopenfile"),pt=Symbol("close"),ei=Symbol("mode"),is=Symbol("awaitDrain"),Xi=Symbol("ondrain"),X=Symbol("prefix"),de=class extends A{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#t=!1;constructor(t,e={}){let i=re(e);super(),this.path=f(t),this.portable=!!i.portable,this.maxReadSize=i.maxReadSize||An,this.linkCache=i.linkCache||new Map,this.statCache=i.statCache||new Map,this.preservePaths=!!i.preservePaths,this.cwd=f(i.cwd||process.cwd()),this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.mtime=i.mtime,this.prefix=i.prefix?f(i.prefix):void 0,this.onWriteEntry=i.onWriteEntry,typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let r=!1;if(!this.preservePaths){let[o,h]=ce(this.path);o&&typeof h=="string"&&(this.path=h,r=o)}this.win32=!!i.win32||process.platform==="win32",this.win32&&(this.path=Vs(this.path.replace(/\\/g,"/")),t=t.replace(/\\/g,"/")),this.absolute=f(i.absolute||Xs.resolve(this.cwd,t)),this.path===""&&(this.path="./"),r&&this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:this,path:r+this.path});let n=this.statCache.get(this.absolute);n?this[ti](n):this[ji]()}warn(t,e,i={}){return Lt(this,t,e,i)}emit(t,...e){return t==="error"&&(this.#t=!0),super.emit(t,...e)}[ji](){$.lstat(this.absolute,(t,e)=>{if(t)return this.emit("error",t);this[ti](e)})}[ti](t){this.statCache.set(this.absolute,t),this.stat=t,t.isFile()||(t.size=0),this.type=In(t),this.emit("stat",t),this[qs]()}[qs](){switch(this.type){case"File":return this[js]();case"Directory":return this[Qs]();case"SymbolicLink":return this[qi]();default:return this.end()}}[ei](t){return Ki(t,this.type==="Directory",this.portable)}[X](t){return tr(t,this.prefix)}[fe](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new F({path:this[X](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[X](this.linkpath):this.linkpath,mode:this[ei](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new ct({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[X](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[X](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let t=this.header?.block;if(!t)throw new Error("failed to encode header");super.write(t)}[Qs](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[fe](),this.end()}[qi](){$.readlink(this.absolute,(t,e)=>{if(t)return this.emit("error",t);this[Ji](e)})}[Ji](t){this.linkpath=f(t),this[fe](),this.end()}[Js](t){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=f(Xs.relative(this.cwd,t)),this.stat.size=0,this[fe](),this.end()}[js](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let t=`${this.stat.dev}:${this.stat.ino}`,e=this.linkCache.get(t);if(e?.indexOf(this.cwd)===0)return this[Js](e);this.linkCache.set(t,this.absolute)}if(this[fe](),this.stat.size===0)return this.end();this[ts]()}[ts](){$.open(this.absolute,"r",(t,e)=>{if(t)return this.emit("error",t);this[es](e)})}[es](t){if(this.fd=t,this.#t)return this[pt]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let e=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(e),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[Je]()}[Je](){let{fd:t,buf:e,offset:i,length:r,pos:n}=this;if(t===void 0||e===void 0)throw new Error("cannot read file without first opening");$.read(t,e,i,r,n,(o,h)=>{if(o)return this[pt](()=>this.emit("error",o));this[Qi](h)})}[pt](t=()=>{}){this.fd!==void 0&&$.close(this.fd,t)}[Qi](t){if(t<=0&&this.remain>0){let r=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[pt](()=>this.emit("error",r))}if(t>this.remain){let r=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[pt](()=>this.emit("error",r))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(t===this.remain)for(let r=t;rthis[Xi]())}[is](t){this.once("drain",t)}write(t,e,i){if(typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof e=="string"?e:"utf8")),this.blockRemaint?this.emit("error",t):this.end());if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[Je]()}},ii=class extends de{sync=!0;[ji](){this[ti]($.lstatSync(this.absolute))}[qi](){this[Ji]($.readlinkSync(this.absolute))}[ts](){this[es]($.openSync(this.absolute,"r"))}[Je](){let t=!0;try{let{fd:e,buf:i,offset:r,length:n,pos:o}=this;if(e===void 0||i===void 0)throw new Error("fd and buf must be set in READ method");let h=$.readSync(e,i,r,n,o);this[Qi](h),t=!1}finally{if(t)try{this[pt](()=>{})}catch{}}}[is](t){t()}[pt](t=()=>{}){this.fd!==void 0&&$.closeSync(this.fd),t()}},si=class extends A{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(t,e,i={}){return Lt(this,t,e,i)}constructor(t,e={}){let i=re(e);super(),this.preservePaths=!!i.preservePaths,this.portable=!!i.portable,this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.onWriteEntry=i.onWriteEntry,this.readEntry=t;let{type:r}=t;if(r==="Unsupported")throw new Error("writing entry that should be ignored");this.type=r,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=i.prefix,this.path=f(t.path),this.mode=t.mode!==void 0?this[ei](t.mode):void 0,this.uid=this.portable?void 0:t.uid,this.gid=this.portable?void 0:t.gid,this.uname=this.portable?void 0:t.uname,this.gname=this.portable?void 0:t.gname,this.size=t.size,this.mtime=this.noMtime?void 0:i.mtime||t.mtime,this.atime=this.portable?void 0:t.atime,this.ctime=this.portable?void 0:t.ctime,this.linkpath=t.linkpath!==void 0?f(t.linkpath):void 0,typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let n=!1;if(!this.preservePaths){let[h,a]=ce(this.path);h&&typeof a=="string"&&(this.path=a,n=h)}this.remain=t.size,this.blockRemain=t.startBlockSize,this.onWriteEntry?.(this),this.header=new F({path:this[X](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[X](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),n&&this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute path`,{entry:this,path:n+this.path}),this.header.encode()&&!this.noPax&&super.write(new ct({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[X](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[X](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let o=this.header?.block;if(!o)throw new Error("failed to encode header");super.write(o),t.pipe(this)}[X](t){return tr(t,this.prefix)}[ei](t){return Ki(t,this.type==="Directory",this.portable)}write(t,e,i){typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof e=="string"?e:"utf8"));let r=t.length;if(r>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=r,super.write(t,i)}end(t,e,i){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof t=="function"&&(i=t,e=void 0,t=void 0),typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,e??"utf8")),i&&this.once("finish",i),t?super.end(t,i):super.end(i),this}},In=s=>s.isFile()?"File":s.isDirectory()?"Directory":s.isSymbolicLink()?"SymbolicLink":"Unsupported";var ri=class s{tail;head;length=0;static create(t=[]){return new s(t)}constructor(t=[]){for(let e of t)this.push(e)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");let e=t.next,i=t.prev;return e&&(e.prev=i),i&&(i.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=i),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,e}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);let e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);let e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}push(...t){for(let e=0,i=t.length;e1)i=e;else if(this.head)r=this.head.next,i=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=0;r;n++)i=t(i,r.value,n),r=r.next;return i}reduceReverse(t,e){let i,r=this.tail;if(arguments.length>1)i=e;else if(this.tail)r=this.tail.prev,i=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let n=this.length-1;r;n--)i=t(i,r.value,n),r=r.prev;return i}toArray(){let t=new Array(this.length);for(let e=0,i=this.head;i;e++)t[e]=i.value,i=i.next;return t}toArrayReverse(){let t=new Array(this.length);for(let e=0,i=this.tail;i;e++)t[e]=i.value,i=i.prev;return t}slice(t=0,e=this.length){e<0&&(e+=this.length),t<0&&(t+=this.length);let i=new s;if(ethis.length&&(e=this.length);let r=this.head,n=0;for(n=0;r&&nthis.length&&(e=this.length);let r=this.length,n=this.tail;for(;n&&r>e;r--)n=n.prev;for(;n&&r>t;r--,n=n.prev)i.push(n.value);return i}splice(t,e=0,...i){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let r=this.head;for(let o=0;r&&o1)throw new TypeError("gzip, brotli, zstd are mutually exclusive");if(t.gzip&&(typeof t.gzip!="object"&&(t.gzip={}),this.portable&&(t.gzip.portable=!0),this.zip=new Be(t.gzip)),t.brotli&&(typeof t.brotli!="object"&&(t.brotli={}),this.zip=new Ue(t.brotli)),t.zstd&&(typeof t.zstd!="object"&&(t.zstd={}),this.zip=new Ge(t.zstd)),!this.zip)throw new Error("impossible");let e=this.zip;e.on("data",i=>super.write(i)),e.on("end",()=>super.end()),e.on("drain",()=>this[os]()),this.on("resume",()=>e.resume())}else this.on("drain",this[os]);this.noDirRecurse=!!t.noDirRecurse,this.follow=!!t.follow,this.noMtime=!!t.noMtime,t.mtime&&(this.mtime=t.mtime),this.filter=typeof t.filter=="function"?t.filter:()=>!0,this[W]=new ri,this[G]=0,this.jobs=Number(t.jobs)||4,this[pe]=!1,this[me]=!1}[nr](t){return super.write(t)}add(t){return this.write(t),this}end(t,e,i){return typeof t=="function"&&(i=t,t=void 0),typeof e=="function"&&(i=e,e=void 0),t&&this.add(t),this[me]=!0,this[Ft](),i&&i(),this}write(t){if(this[me])throw new Error("write after end");return t instanceof Yt?this[ir](t):this[oi](t),this.flowing}[ir](t){let e=f(rr.resolve(this.cwd,t.path));if(!this.filter(t.path,t))t.resume();else{let i=new fi(t.path,e);i.entry=new si(t,this[ns](i)),i.entry.on("end",()=>this[rs](i)),this[G]+=1,this[W].push(i)}this[Ft]()}[oi](t){let e=f(rr.resolve(this.cwd,t));this[W].push(new fi(t,e)),this[Ft]()}[hs](t){t.pending=!0,this[G]+=1;let e=this.follow?"stat":"lstat";ci[e](t.absolute,(i,r)=>{t.pending=!1,this[G]-=1,i?this.emit("error",i):this[ni](t,r)})}[ni](t,e){this.statCache.set(t.absolute,e),t.stat=e,this.filter(t.path,e)?e.isFile()&&e.nlink>1&&t===this[Ct]&&!this.linkCache.get(`${e.dev}:${e.ino}`)&&!this.sync&&this[ss](t):t.ignore=!0,this[Ft]()}[as](t){t.pending=!0,this[G]+=1,ci.readdir(t.absolute,(e,i)=>{if(t.pending=!1,this[G]-=1,e)return this.emit("error",e);this[hi](t,i)})}[hi](t,e){this.readdirCache.set(t.absolute,e),t.readdir=e,this[Ft]()}[Ft](){if(!this[pe]){this[pe]=!0;for(let t=this[W].head;t&&this[G]this.warn(e,i,r),noPax:this.noPax,cwd:this.cwd,absolute:t.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[sr](t){this[G]+=1;try{return new this[li](t.path,this[ns](t)).on("end",()=>this[rs](t)).on("error",i=>this.emit("error",i))}catch(e){this.emit("error",e)}}[os](){this[Ct]&&this[Ct].entry&&this[Ct].entry.resume()}[ai](t){t.piped=!0,t.readdir&&t.readdir.forEach(r=>{let n=t.path,o=n==="./"?"":n.replace(/\/*$/,"/");this[oi](o+r)});let e=t.entry,i=this.zip;if(!e)throw new Error("cannot pipe without source");i?e.on("data",r=>{i.write(r)||e.pause()}):e.on("data",r=>{super.write(r)||e.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(t,e,i={}){Lt(this,t,e,i)}},kt=class extends Et{sync=!0;constructor(t){super(t),this[li]=ii}pause(){}resume(){}[hs](t){let e=this.follow?"statSync":"lstatSync";this[ni](t,ci[e](t.absolute))}[as](t){this[hi](t,ci.readdirSync(t.absolute))}[ai](t){let e=t.entry,i=this.zip;if(t.readdir&&t.readdir.forEach(r=>{let n=t.path,o=n==="./"?"":n.replace(/\/*$/,"/");this[oi](o+r)}),!e)throw new Error("Cannot pipe without source");i?e.on("data",r=>{i.write(r)}):e.on("data",r=>{super[nr](r)})}};var vn=(s,t)=>{let e=new kt(s),i=new Wt(s.file,{mode:s.mode||438});e.pipe(i),hr(e,t)},Mn=(s,t)=>{let e=new Et(s),i=new tt(s.file,{mode:s.mode||438});e.pipe(i);let r=new Promise((n,o)=>{i.on("error",o),i.on("close",n),e.on("error",o)});return ar(e,t),r},hr=(s,t)=>{t.forEach(e=>{e.charAt(0)==="@"?It({file:or.resolve(s.cwd,e.slice(1)),sync:!0,noResume:!0,onReadEntry:i=>s.add(i)}):s.add(e)}),s.end()},ar=async(s,t)=>{for(let e=0;e{s.add(r)}}):s.add(i)}s.end()},Bn=(s,t)=>{let e=new kt(s);return hr(e,t),e},Pn=(s,t)=>{let e=new Et(s);return ar(e,t),e},zn=K(vn,Mn,Bn,Pn,(s,t)=>{if(!t?.length)throw new TypeError("no paths specified to add to archive")});import Lr from"node:fs";import io from"node:assert";import{randomBytes as xr}from"node:crypto";import u from"node:fs";import R from"node:path";import lr from"fs";var Un=process.env.__FAKE_PLATFORM__||process.platform,Hn=Un==="win32",{O_CREAT:Wn,O_TRUNC:Gn,O_WRONLY:Zn}=lr.constants,cr=Number(process.env.__FAKE_FS_O_FILENAME__)||lr.constants.UV_FS_O_FILEMAP||0,Yn=Hn&&!!cr,Kn=512*1024,Vn=cr|Gn|Wn|Zn,ls=Yn?s=>s"w";import ui from"node:fs";import Ee from"node:path";var cs=(s,t,e)=>{try{return ui.lchownSync(s,t,e)}catch(i){if(i?.code!=="ENOENT")throw i}},di=(s,t,e,i)=>{ui.lchown(s,t,e,r=>{i(r&&r?.code!=="ENOENT"?r:null)})},$n=(s,t,e,i,r)=>{if(t.isDirectory())fs(Ee.resolve(s,t.name),e,i,n=>{if(n)return r(n);let o=Ee.resolve(s,t.name);di(o,e,i,r)});else{let n=Ee.resolve(s,t.name);di(n,e,i,r)}},fs=(s,t,e,i)=>{ui.readdir(s,{withFileTypes:!0},(r,n)=>{if(r){if(r.code==="ENOENT")return i();if(r.code!=="ENOTDIR"&&r.code!=="ENOTSUP")return i(r)}if(r||!n.length)return di(s,t,e,i);let o=n.length,h=null,a=l=>{if(!h){if(l)return i(h=l);if(--o===0)return di(s,t,e,i)}};for(let l of n)$n(s,l,t,e,a)})},Xn=(s,t,e,i)=>{t.isDirectory()&&ds(Ee.resolve(s,t.name),e,i),cs(Ee.resolve(s,t.name),e,i)},ds=(s,t,e)=>{let i;try{i=ui.readdirSync(s,{withFileTypes:!0})}catch(r){let n=r;if(n?.code==="ENOENT")return;if(n?.code==="ENOTDIR"||n?.code==="ENOTSUP")return cs(s,t,e);throw n}for(let r of i)Xn(s,r,t,e);return cs(s,t,e)};import k from"node:fs";import qn from"node:fs/promises";import mi from"node:path";var we=class extends Error{path;code;syscall="chdir";constructor(t,e){super(`${e}: Cannot cd into '${t}'`),this.path=t,this.code=e}get name(){return"CwdError"}};var wt=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(t,e){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=t,this.path=e}get name(){return"SymlinkError"}};var jn=(s,t)=>{k.stat(s,(e,i)=>{(e||!i.isDirectory())&&(e=new we(s,e?.code||"ENOTDIR")),t(e)})},fr=(s,t,e)=>{s=f(s);let i=t.umask??18,r=t.mode|448,n=(r&i)!==0,o=t.uid,h=t.gid,a=typeof o=="number"&&typeof h=="number"&&(o!==t.processUid||h!==t.processGid),l=t.preserve,c=t.unlink,d=f(t.cwd),S=(E,x)=>{E?e(E):x&&a?fs(x,o,h,_s=>S(_s)):n?k.chmod(s,r,e):e()};if(s===d)return jn(s,S);if(l)return qn.mkdir(s,{mode:r,recursive:!0}).then(E=>S(null,E??void 0),S);let N=f(mi.relative(d,s)).split("/");us(d,N,r,c,d,void 0,S)},us=(s,t,e,i,r,n,o)=>{if(!t.length)return o(null,n);let h=t.shift(),a=f(mi.resolve(s+"/"+h));k.mkdir(a,e,dr(a,t,e,i,r,n,o))},dr=(s,t,e,i,r,n,o)=>h=>{h?k.lstat(s,(a,l)=>{if(a)a.path=a.path&&f(a.path),o(a);else if(l.isDirectory())us(s,t,e,i,r,n,o);else if(i)k.unlink(s,c=>{if(c)return o(c);k.mkdir(s,e,dr(s,t,e,i,r,n,o))});else{if(l.isSymbolicLink())return o(new wt(s,s+"/"+t.join("/")));o(h)}}):(n=n||s,us(s,t,e,i,r,n,o))},Qn=s=>{let t=!1,e;try{t=k.statSync(s).isDirectory()}catch(i){e=i?.code}finally{if(!t)throw new we(s,e??"ENOTDIR")}},ur=(s,t)=>{s=f(s);let e=t.umask??18,i=t.mode|448,r=(i&e)!==0,n=t.uid,o=t.gid,h=typeof n=="number"&&typeof o=="number"&&(n!==t.processUid||o!==t.processGid),a=t.preserve,l=t.unlink,c=f(t.cwd),d=E=>{E&&h&&ds(E,n,o),r&&k.chmodSync(s,i)};if(s===c)return Qn(c),d();if(a)return d(k.mkdirSync(s,{mode:i,recursive:!0})??void 0);let T=f(mi.relative(c,s)).split("/"),N;for(let E=T.shift(),x=c;E&&(x+="/"+E);E=T.shift()){x=f(mi.resolve(x));try{k.mkdirSync(x,i),N=N||x}catch{let Os=k.lstatSync(x);if(Os.isDirectory())continue;if(l){k.unlinkSync(x),k.mkdirSync(x,i),N=N||x;continue}else if(Os.isSymbolicLink())return new wt(x,x+"/"+T.join("/"))}}return d(N)};import{join as Er}from"node:path";var ms=Object.create(null),mr=1e4,$t=new Set,pr=s=>{$t.has(s)?$t.delete(s):ms[s]=s.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),$t.add(s);let t=ms[s],e=$t.size-mr;if(e>mr/10){for(let i of $t)if($t.delete(i),delete ms[i],--e<=0)break}return t};var Jn=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,to=Jn==="win32",eo=s=>s.split("/").slice(0,-1).reduce((e,i)=>{let r=e[e.length-1];return r!==void 0&&(i=Er(r,i)),e.push(i||"/"),e},[]),pi=class{#t=new Map;#i=new Map;#s=new Set;reserve(t,e){t=to?["win32 parallelization disabled"]:t.map(r=>mt(Er(pr(r))));let i=new Set(t.map(r=>eo(r)).reduce((r,n)=>r.concat(n)));this.#i.set(e,{dirs:i,paths:t});for(let r of t){let n=this.#t.get(r);n?n.push(e):this.#t.set(r,[e])}for(let r of i){let n=this.#t.get(r);if(!n)this.#t.set(r,[new Set([e])]);else{let o=n[n.length-1];o instanceof Set?o.add(e):n.push(new Set([e]))}}return this.#r(e)}#n(t){let e=this.#i.get(t);if(!e)throw new Error("function does not have any path reservations");return{paths:e.paths.map(i=>this.#t.get(i)),dirs:[...e.dirs].map(i=>this.#t.get(i))}}check(t){let{paths:e,dirs:i}=this.#n(t);return e.every(r=>r&&r[0]===t)&&i.every(r=>r&&r[0]instanceof Set&&r[0].has(t))}#r(t){return this.#s.has(t)||!this.check(t)?!1:(this.#s.add(t),t(()=>this.#e(t)),!0)}#e(t){if(!this.#s.has(t))return!1;let e=this.#i.get(t);if(!e)throw new Error("invalid reservation");let{paths:i,dirs:r}=e,n=new Set;for(let o of i){let h=this.#t.get(o);if(!h||h?.[0]!==t)continue;let a=h[1];if(!a){this.#t.delete(o);continue}if(h.shift(),typeof a=="function")n.add(a);else for(let l of a)n.add(l)}for(let o of r){let h=this.#t.get(o),a=h?.[0];if(!(!h||!(a instanceof Set)))if(a.size===1&&h.length===1){this.#t.delete(o);continue}else if(a.size===1){h.shift();let l=h[0];typeof l=="function"&&n.add(l)}else a.delete(t)}return this.#s.delete(t),n.forEach(o=>this.#r(o)),!0}};var wr=()=>process.umask();var Sr=Symbol("onEntry"),Ss=Symbol("checkFs"),yr=Symbol("checkFs2"),ys=Symbol("isReusable"),P=Symbol("makeFs"),Rs=Symbol("file"),bs=Symbol("directory"),wi=Symbol("link"),Rr=Symbol("symlink"),br=Symbol("hardlink"),ye=Symbol("ensureNoSymlink"),gr=Symbol("unsupported"),_r=Symbol("checkPath"),ps=Symbol("stripAbsolutePath"),St=Symbol("mkdir"),O=Symbol("onError"),Ei=Symbol("pending"),Or=Symbol("pend"),Xt=Symbol("unpend"),Es=Symbol("ended"),ws=Symbol("maybeClose"),gs=Symbol("skip"),Re=Symbol("doChown"),be=Symbol("uid"),ge=Symbol("gid"),_e=Symbol("checkedCwd"),so=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Oe=so==="win32",ro=1024,no=(s,t)=>{if(!Oe)return u.unlink(s,t);let e=s+".DELETE."+xr(16).toString("hex");u.rename(s,e,i=>{if(i)return t(i);u.unlink(e,t)})},oo=s=>{if(!Oe)return u.unlinkSync(s);let t=s+".DELETE."+xr(16).toString("hex");u.renameSync(s,t),u.unlinkSync(t)},Tr=(s,t,e)=>s!==void 0&&s===s>>>0?s:t!==void 0&&t===t>>>0?t:e,qt=class extends st{[Es]=!1;[_e]=!1;[Ei]=0;reservations=new pi;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(t={}){if(t.ondone=()=>{this[Es]=!0,this[ws]()},super(t),this.transform=t.transform,this.chmod=!!t.chmod,typeof t.uid=="number"||typeof t.gid=="number"){if(typeof t.uid!="number"||typeof t.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(t.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=t.uid,this.gid=t.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;t.preserveOwner===void 0&&typeof t.uid!="number"?this.preserveOwner=!!(process.getuid&&process.getuid()===0):this.preserveOwner=!!t.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:ro,this.forceChown=t.forceChown===!0,this.win32=!!t.win32||Oe,this.newer=!!t.newer,this.keep=!!t.keep,this.noMtime=!!t.noMtime,this.preservePaths=!!t.preservePaths,this.unlink=!!t.unlink,this.cwd=f(R.resolve(t.cwd||process.cwd())),this.strip=Number(t.strip)||0,this.processUmask=this.chmod?typeof t.processUmask=="number"?t.processUmask:wr():0,this.umask=typeof t.umask=="number"?t.umask:this.processUmask,this.dmode=t.dmode||511&~this.umask,this.fmode=t.fmode||438&~this.umask,this.on("entry",e=>this[Sr](e))}warn(t,e,i={}){return(t==="TAR_BAD_ARCHIVE"||t==="TAR_ABORT")&&(i.recoverable=!1),super.warn(t,e,i)}[ws](){this[Es]&&this[Ei]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[ps](t,e){let i=t[e],{type:r}=t;if(!i||this.preservePaths)return!0;let n=i.split("/");if(n.includes("..")||Oe&&/^[a-z]:\.\.$/i.test(n[0]??"")){if(e==="path"||r==="Link")return this.warn("TAR_ENTRY_ERROR",`${e} contains '..'`,{entry:t,[e]:i}),!1;{let a=R.posix.dirname(t.path),l=R.posix.normalize(R.posix.join(a,i));if(l.startsWith("../")||l==="..")return this.warn("TAR_ENTRY_ERROR",`${e} escapes extraction directory`,{entry:t,[e]:i}),!1}}let[o,h]=ce(i);return o&&(t[e]=String(h),this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute ${e}`,{entry:t,[e]:i})),!0}[_r](t){let e=f(t.path),i=e.split("/");if(this.strip){if(i.length=this.strip)t.linkpath=r.slice(this.strip).join("/");else return!1}i.splice(0,this.strip),t.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:t,path:e,depth:i.length,maxDepth:this.maxDepth}),!1;if(!this[ps](t,"path")||!this[ps](t,"linkpath"))return!1;if(R.isAbsolute(t.path)?t.absolute=f(R.resolve(t.path)):t.absolute=f(R.resolve(this.cwd,t.path)),!this.preservePaths&&typeof t.absolute=="string"&&t.absolute.indexOf(this.cwd+"/")!==0&&t.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:t,path:f(t.path),resolvedPath:t.absolute,cwd:this.cwd}),!1;if(t.absolute===this.cwd&&t.type!=="Directory"&&t.type!=="GNUDumpDir")return!1;if(this.win32){let{root:r}=R.win32.parse(String(t.absolute));t.absolute=r+$i(String(t.absolute).slice(r.length));let{root:n}=R.win32.parse(t.path);t.path=n+$i(t.path.slice(n.length))}return!0}[Sr](t){if(!this[_r](t))return t.resume();switch(io.equal(typeof t.absolute,"string"),t.type){case"Directory":case"GNUDumpDir":t.mode&&(t.mode=t.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[Ss](t);default:return this[gr](t)}}[O](t,e){t.name==="CwdError"?this.emit("error",t):(this.warn("TAR_ENTRY_ERROR",t,{entry:e}),this[Xt](),e.resume())}[St](t,e,i){fr(f(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:e},i)}[Re](t){return this.forceChown||this.preserveOwner&&(typeof t.uid=="number"&&t.uid!==this.processUid||typeof t.gid=="number"&&t.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[be](t){return Tr(this.uid,t.uid,this.processUid)}[ge](t){return Tr(this.gid,t.gid,this.processGid)}[Rs](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.fmode,r=new tt(String(t.absolute),{flags:ls(t.size),mode:i,autoClose:!1});r.on("error",a=>{r.fd&&u.close(r.fd,()=>{}),r.write=()=>!0,this[O](a,t),e()});let n=1,o=a=>{if(a){r.fd&&u.close(r.fd,()=>{}),this[O](a,t),e();return}--n===0&&r.fd!==void 0&&u.close(r.fd,l=>{l?this[O](l,t):this[Xt](),e()})};r.on("finish",()=>{let a=String(t.absolute),l=r.fd;if(typeof l=="number"&&t.mtime&&!this.noMtime){n++;let c=t.atime||new Date,d=t.mtime;u.futimes(l,c,d,S=>S?u.utimes(a,c,d,T=>o(T&&S)):o())}if(typeof l=="number"&&this[Re](t)){n++;let c=this[be](t),d=this[ge](t);typeof c=="number"&&typeof d=="number"&&u.fchown(l,c,d,S=>S?u.chown(a,c,d,T=>o(T&&S)):o())}o()});let h=this.transform&&this.transform(t)||t;h!==t&&(h.on("error",a=>{this[O](a,t),e()}),t.pipe(h)),h.pipe(r)}[bs](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.dmode;this[St](String(t.absolute),i,r=>{if(r){this[O](r,t),e();return}let n=1,o=()=>{--n===0&&(e(),this[Xt](),t.resume())};t.mtime&&!this.noMtime&&(n++,u.utimes(String(t.absolute),t.atime||new Date,t.mtime,o)),this[Re](t)&&(n++,u.chown(String(t.absolute),Number(this[be](t)),Number(this[ge](t)),o)),o()})}[gr](t){t.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${t.type}`,{entry:t}),t.resume()}[Rr](t,e){let i=f(R.relative(this.cwd,R.resolve(R.dirname(String(t.absolute)),String(t.linkpath)))).split("/");this[ye](t,this.cwd,i,()=>this[wi](t,String(t.linkpath),"symlink",e),r=>{this[O](r,t),e()})}[br](t,e){let i=f(R.resolve(this.cwd,String(t.linkpath))),r=f(String(t.linkpath)).split("/");this[ye](t,this.cwd,r,()=>this[wi](t,i,"link",e),n=>{this[O](n,t),e()})}[ye](t,e,i,r,n){let o=i.shift();if(this.preservePaths||o===void 0)return r();let h=R.resolve(e,o);u.lstat(h,(a,l)=>{if(a)return r();if(l?.isSymbolicLink())return n(new wt(h,R.resolve(h,i.join("/"))));this[ye](t,h,i,r,n)})}[Or](){this[Ei]++}[Xt](){this[Ei]--,this[ws]()}[gs](t){this[Xt](),t.resume()}[ys](t,e){return t.type==="File"&&!this.unlink&&e.isFile()&&e.nlink<=1&&!Oe}[Ss](t){this[Or]();let e=[t.path];t.linkpath&&e.push(t.linkpath),this.reservations.reserve(e,i=>this[yr](t,i))}[yr](t,e){let i=h=>{e(h)},r=()=>{this[St](this.cwd,this.dmode,h=>{if(h){this[O](h,t),i();return}this[_e]=!0,n()})},n=()=>{if(t.absolute!==this.cwd){let h=f(R.dirname(String(t.absolute)));if(h!==this.cwd)return this[St](h,this.dmode,a=>{if(a){this[O](a,t),i();return}o()})}o()},o=()=>{u.lstat(String(t.absolute),(h,a)=>{if(a&&(this.keep||this.newer&&a.mtime>(t.mtime??a.mtime))){this[gs](t),i();return}if(h||this[ys](t,a))return this[P](null,t,i);if(a.isDirectory()){if(t.type==="Directory"){let l=this.chmod&&t.mode&&(a.mode&4095)!==t.mode,c=d=>this[P](d??null,t,i);return l?u.chmod(String(t.absolute),Number(t.mode),c):c()}if(t.absolute!==this.cwd)return u.rmdir(String(t.absolute),l=>this[P](l??null,t,i))}if(t.absolute===this.cwd)return this[P](null,t,i);no(String(t.absolute),l=>this[P](l??null,t,i))})};this[_e]?n():r()}[P](t,e,i){if(t){this[O](t,e),i();return}switch(e.type){case"File":case"OldFile":case"ContiguousFile":return this[Rs](e,i);case"Link":return this[br](e,i);case"SymbolicLink":return this[Rr](e,i);case"Directory":case"GNUDumpDir":return this[bs](e,i)}}[wi](t,e,i,r){u[i](e,String(t.absolute),n=>{n?this[O](n,t):(this[Xt](),t.resume()),r()})}},Se=s=>{try{return[null,s()]}catch(t){return[t,null]}},Te=class extends qt{sync=!0;[P](t,e){return super[P](t,e,()=>{})}[Ss](t){if(!this[_e]){let n=this[St](this.cwd,this.dmode);if(n)return this[O](n,t);this[_e]=!0}if(t.absolute!==this.cwd){let n=f(R.dirname(String(t.absolute)));if(n!==this.cwd){let o=this[St](n,this.dmode);if(o)return this[O](o,t)}}let[e,i]=Se(()=>u.lstatSync(String(t.absolute)));if(i&&(this.keep||this.newer&&i.mtime>(t.mtime??i.mtime)))return this[gs](t);if(e||this[ys](t,i))return this[P](null,t);if(i.isDirectory()){if(t.type==="Directory"){let o=this.chmod&&t.mode&&(i.mode&4095)!==t.mode,[h]=o?Se(()=>{u.chmodSync(String(t.absolute),Number(t.mode))}):[];return this[P](h,t)}let[n]=Se(()=>u.rmdirSync(String(t.absolute)));this[P](n,t)}let[r]=t.absolute===this.cwd?[]:Se(()=>oo(String(t.absolute)));this[P](r,t)}[Rs](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.fmode,r=h=>{let a;try{u.closeSync(n)}catch(l){a=l}(h||a)&&this[O](h||a,t),e()},n;try{n=u.openSync(String(t.absolute),ls(t.size),i)}catch(h){return r(h)}let o=this.transform&&this.transform(t)||t;o!==t&&(o.on("error",h=>this[O](h,t)),t.pipe(o)),o.on("data",h=>{try{u.writeSync(n,h,0,h.length)}catch(a){r(a)}}),o.on("end",()=>{let h=null;if(t.mtime&&!this.noMtime){let a=t.atime||new Date,l=t.mtime;try{u.futimesSync(n,a,l)}catch(c){try{u.utimesSync(String(t.absolute),a,l)}catch{h=c}}}if(this[Re](t)){let a=this[be](t),l=this[ge](t);try{u.fchownSync(n,Number(a),Number(l))}catch(c){try{u.chownSync(String(t.absolute),Number(a),Number(l))}catch{h=h||c}}}r(h)})}[bs](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.dmode,r=this[St](String(t.absolute),i);if(r){this[O](r,t),e();return}if(t.mtime&&!this.noMtime)try{u.utimesSync(String(t.absolute),t.atime||new Date,t.mtime)}catch{}if(this[Re](t))try{u.chownSync(String(t.absolute),Number(this[be](t)),Number(this[ge](t)))}catch{}e(),t.resume()}[St](t,e){try{return ur(f(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:e})}catch(i){return i}}[ye](t,e,i,r,n){if(this.preservePaths||!i.length)return r();let o=e;for(let h of i){o=R.resolve(o,h);let[a,l]=Se(()=>u.lstatSync(o));if(a)return r();if(l.isSymbolicLink())return n(new wt(o,R.resolve(e,i.join("/"))))}r()}[wi](t,e,i,r){let n=`${i}Sync`;try{u[n](e,String(t.absolute)),r(),t.resume()}catch(o){return this[O](o,t)}}};var ho=s=>{let t=new Te(s),e=s.file,i=Lr.statSync(e),r=s.maxReadSize||16*1024*1024;new ve(e,{readSize:r,size:i.size}).pipe(t)},ao=(s,t)=>{let e=new qt(s),i=s.maxReadSize||16*1024*1024,r=s.file;return new Promise((o,h)=>{e.on("error",h),e.on("close",o),Lr.stat(r,(a,l)=>{if(a)h(a);else{let c=new gt(r,{readSize:i,size:l.size});c.on("error",h),c.pipe(e)}})})},lo=K(ho,ao,s=>new Te(s),s=>new qt(s),(s,t)=>{t?.length&&Yi(s,t)});import v from"node:fs";import Nr from"node:path";var co=(s,t)=>{let e=new kt(s),i=!0,r,n;try{try{r=v.openSync(s.file,"r+")}catch(a){if(a?.code==="ENOENT")r=v.openSync(s.file,"w+");else throw a}let o=v.fstatSync(r),h=Buffer.alloc(512);t:for(n=0;no.size)break;n+=l,s.mtimeCache&&a.mtime&&s.mtimeCache.set(String(a.path),a.mtime)}i=!1,fo(s,e,n,r,t)}finally{if(i)try{v.closeSync(r)}catch{}}},fo=(s,t,e,i,r)=>{let n=new Wt(s.file,{fd:i,start:e});t.pipe(n),mo(t,r)},uo=(s,t)=>{t=Array.from(t);let e=new Et(s),i=(n,o,h)=>{let a=(T,N)=>{T?v.close(n,E=>h(T)):h(null,N)},l=0;if(o===0)return a(null,0);let c=0,d=Buffer.alloc(512),S=(T,N)=>{if(T||typeof N>"u")return a(T);if(c+=N,c<512&&N)return v.read(n,d,c,d.length-c,l+c,S);if(l===0&&d[0]===31&&d[1]===139)return a(new Error("cannot append to compressed archives"));if(c<512)return a(null,l);let E=new F(d);if(!E.cksumValid)return a(null,l);let x=512*Math.ceil((E.size??0)/512);if(l+x+512>o||(l+=x+512,l>=o))return a(null,l);s.mtimeCache&&E.mtime&&s.mtimeCache.set(String(E.path),E.mtime),c=0,v.read(n,d,0,512,l,S)};v.read(n,d,0,512,l,S)};return new Promise((n,o)=>{e.on("error",o);let h="r+",a=(l,c)=>{if(l&&l.code==="ENOENT"&&h==="r+")return h="w+",v.open(s.file,h,a);if(l||!c)return o(l);v.fstat(c,(d,S)=>{if(d)return v.close(c,()=>o(d));i(c,S.size,(T,N)=>{if(T)return o(T);let E=new tt(s.file,{fd:c,start:N});e.pipe(E),E.on("error",o),E.on("close",n),po(e,t)})})};v.open(s.file,h,a)})},mo=(s,t)=>{t.forEach(e=>{e.charAt(0)==="@"?It({file:Nr.resolve(s.cwd,e.slice(1)),sync:!0,noResume:!0,onReadEntry:i=>s.add(i)}):s.add(e)}),s.end()},po=async(s,t)=>{for(let e=0;es.add(r)}):s.add(i)}s.end()},vt=K(co,uo,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(s,t)=>{if(!ks(s))throw new TypeError("file is required");if(s.gzip||s.brotli||s.zstd||s.file.endsWith(".br")||s.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!t?.length)throw new TypeError("no paths specified to add/replace")});var Eo=K(vt.syncFile,vt.asyncFile,vt.syncNoFile,vt.asyncNoFile,(s,t=[])=>{vt.validate?.(s,t),wo(s)}),wo=s=>{let t=s.filter;s.mtimeCache||(s.mtimeCache=new Map),s.filter=t?(e,i)=>t(e,i)&&!((s.mtimeCache?.get(e)??i.mtime??0)>(i.mtime??0)):(e,i)=>!((s.mtimeCache?.get(e)??i.mtime??0)>(i.mtime??0))};export{F as Header,Et as Pack,fi as PackJob,kt as PackSync,st as Parser,ct as Pax,Yt as ReadEntry,qt as Unpack,Te as UnpackSync,de as WriteEntry,ii as WriteEntrySync,si as WriteEntryTar,zn as c,zn as create,lo as extract,Yi as filesFilter,It as list,vt as r,vt as replace,It as t,Mi as types,Eo as u,Eo as update,lo as x}; +//# sourceMappingURL=index.min.js.map diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/index.min.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/index.min.js.map new file mode 100644 index 0000000..ea93a84 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/index.min.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../node_modules/@isaacs/fs-minipass/src/index.ts", "../../node_modules/minipass/src/index.ts", "../../src/create.ts", "../../src/list.ts", "../../src/options.ts", "../../src/make-command.ts", "../../src/parse.ts", "../../node_modules/minizlib/src/index.ts", "../../node_modules/minizlib/src/constants.ts", "../../src/header.ts", "../../src/large-numbers.ts", "../../src/types.ts", "../../src/pax.ts", "../../src/normalize-windows-path.ts", "../../src/read-entry.ts", "../../src/warn-method.ts", "../../src/strip-trailing-slashes.ts", "../../src/pack.ts", "../../src/write-entry.ts", "../../src/mode-fix.ts", "../../src/strip-absolute-path.ts", "../../src/winchars.ts", "../../node_modules/yallist/src/index.ts", "../../src/extract.ts", "../../src/unpack.ts", "../../src/get-write-flag.ts", "../../node_modules/chownr/src/index.ts", "../../src/mkdir.ts", "../../src/cwd-error.ts", "../../src/symlink-error.ts", "../../src/path-reservations.ts", "../../src/normalize-unicode.ts", "../../src/process-umask.ts", "../../src/replace.ts", "../../src/update.ts"], + "sourcesContent": ["import EE from 'events'\nimport fs from 'fs'\nimport { Minipass } from 'minipass'\n\nconst writev = fs.writev\n\nconst _autoClose = Symbol('_autoClose')\nconst _close = Symbol('_close')\nconst _ended = Symbol('_ended')\nconst _fd = Symbol('_fd')\nconst _finished = Symbol('_finished')\nconst _flags = Symbol('_flags')\nconst _flush = Symbol('_flush')\nconst _handleChunk = Symbol('_handleChunk')\nconst _makeBuf = Symbol('_makeBuf')\nconst _mode = Symbol('_mode')\nconst _needDrain = Symbol('_needDrain')\nconst _onerror = Symbol('_onerror')\nconst _onopen = Symbol('_onopen')\nconst _onread = Symbol('_onread')\nconst _onwrite = Symbol('_onwrite')\nconst _open = Symbol('_open')\nconst _path = Symbol('_path')\nconst _pos = Symbol('_pos')\nconst _queue = Symbol('_queue')\nconst _read = Symbol('_read')\nconst _readSize = Symbol('_readSize')\nconst _reading = Symbol('_reading')\nconst _remain = Symbol('_remain')\nconst _size = Symbol('_size')\nconst _write = Symbol('_write')\nconst _writing = Symbol('_writing')\nconst _defaultFlag = Symbol('_defaultFlag')\nconst _errored = Symbol('_errored')\n\nexport type ReadStreamOptions =\n Minipass.Options & {\n fd?: number\n readSize?: number\n size?: number\n autoClose?: boolean\n }\n\nexport type ReadStreamEvents = Minipass.Events & {\n open: [fd: number]\n}\n\nexport class ReadStream extends Minipass<\n Minipass.ContiguousData,\n Buffer,\n ReadStreamEvents\n> {\n [_errored]: boolean = false;\n [_fd]?: number;\n [_path]: string;\n [_readSize]: number;\n [_reading]: boolean = false;\n [_size]: number;\n [_remain]: number;\n [_autoClose]: boolean\n\n constructor(path: string, opt: ReadStreamOptions) {\n opt = opt || {}\n super(opt)\n\n this.readable = true\n this.writable = false\n\n if (typeof path !== 'string') {\n throw new TypeError('path must be a string')\n }\n\n this[_errored] = false\n this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined\n this[_path] = path\n this[_readSize] = opt.readSize || 16 * 1024 * 1024\n this[_reading] = false\n this[_size] = typeof opt.size === 'number' ? opt.size : Infinity\n this[_remain] = this[_size]\n this[_autoClose] =\n typeof opt.autoClose === 'boolean' ? opt.autoClose : true\n\n if (typeof this[_fd] === 'number') {\n this[_read]()\n } else {\n this[_open]()\n }\n }\n\n get fd() {\n return this[_fd]\n }\n\n get path() {\n return this[_path]\n }\n\n //@ts-ignore\n write() {\n throw new TypeError('this is a readable stream')\n }\n\n //@ts-ignore\n end() {\n throw new TypeError('this is a readable stream')\n }\n\n [_open]() {\n fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd))\n }\n\n [_onopen](er?: NodeJS.ErrnoException | null, fd?: number) {\n if (er) {\n this[_onerror](er)\n } else {\n this[_fd] = fd\n this.emit('open', fd as number)\n this[_read]()\n }\n }\n\n [_makeBuf]() {\n return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain]))\n }\n\n [_read]() {\n if (!this[_reading]) {\n this[_reading] = true\n const buf = this[_makeBuf]()\n /* c8 ignore start */\n if (buf.length === 0) {\n return process.nextTick(() => this[_onread](null, 0, buf))\n }\n /* c8 ignore stop */\n fs.read(this[_fd] as number, buf, 0, buf.length, null, (er, br, b) =>\n this[_onread](er, br, b),\n )\n }\n }\n\n [_onread](er?: NodeJS.ErrnoException | null, br?: number, buf?: Buffer) {\n this[_reading] = false\n if (er) {\n this[_onerror](er)\n } else if (this[_handleChunk](br as number, buf as Buffer)) {\n this[_read]()\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.close(fd, er =>\n er ? this.emit('error', er) : this.emit('close'),\n )\n }\n }\n\n [_onerror](er: NodeJS.ErrnoException) {\n this[_reading] = true\n this[_close]()\n this.emit('error', er)\n }\n\n [_handleChunk](br: number, buf: Buffer) {\n let ret = false\n // no effect if infinite\n this[_remain] -= br\n if (br > 0) {\n ret = super.write(br < buf.length ? buf.subarray(0, br) : buf)\n }\n\n if (br === 0 || this[_remain] <= 0) {\n ret = false\n this[_close]()\n super.end()\n }\n\n return ret\n }\n\n emit(\n ev: Event,\n ...args: ReadStreamEvents[Event]\n ): boolean {\n switch (ev) {\n case 'prefinish':\n case 'finish':\n return false\n\n case 'drain':\n if (typeof this[_fd] === 'number') {\n this[_read]()\n }\n return false\n\n case 'error':\n if (this[_errored]) {\n return false\n }\n this[_errored] = true\n return super.emit(ev, ...args)\n\n default:\n return super.emit(ev, ...args)\n }\n }\n}\n\nexport class ReadStreamSync extends ReadStream {\n [_open]() {\n let threw = true\n try {\n this[_onopen](null, fs.openSync(this[_path], 'r'))\n threw = false\n } finally {\n if (threw) {\n this[_close]()\n }\n }\n }\n\n [_read]() {\n let threw = true\n try {\n if (!this[_reading]) {\n this[_reading] = true\n do {\n const buf = this[_makeBuf]()\n /* c8 ignore start */\n const br =\n buf.length === 0\n ? 0\n : fs.readSync(this[_fd] as number, buf, 0, buf.length, null)\n /* c8 ignore stop */\n if (!this[_handleChunk](br, buf)) {\n break\n }\n } while (true)\n this[_reading] = false\n }\n threw = false\n } finally {\n if (threw) {\n this[_close]()\n }\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.closeSync(fd)\n this.emit('close')\n }\n }\n}\n\nexport type WriteStreamOptions = {\n fd?: number\n autoClose?: boolean\n mode?: number\n captureRejections?: boolean\n start?: number\n flags?: string\n}\n\nexport class WriteStream extends EE {\n readable: false = false\n writable: boolean = true;\n [_errored]: boolean = false;\n [_writing]: boolean = false;\n [_ended]: boolean = false;\n [_queue]: Buffer[] = [];\n [_needDrain]: boolean = false;\n [_path]: string;\n [_mode]: number;\n [_autoClose]: boolean;\n [_fd]?: number;\n [_defaultFlag]: boolean;\n [_flags]: string;\n [_finished]: boolean = false;\n [_pos]?: number\n\n constructor(path: string, opt: WriteStreamOptions) {\n opt = opt || {}\n super(opt)\n this[_path] = path\n this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined\n this[_mode] = opt.mode === undefined ? 0o666 : opt.mode\n this[_pos] = typeof opt.start === 'number' ? opt.start : undefined\n this[_autoClose] =\n typeof opt.autoClose === 'boolean' ? opt.autoClose : true\n\n // truncating makes no sense when writing into the middle\n const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w'\n this[_defaultFlag] = opt.flags === undefined\n this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags\n\n if (this[_fd] === undefined) {\n this[_open]()\n }\n }\n\n emit(ev: string, ...args: any[]) {\n if (ev === 'error') {\n if (this[_errored]) {\n return false\n }\n this[_errored] = true\n }\n return super.emit(ev, ...args)\n }\n\n get fd() {\n return this[_fd]\n }\n\n get path() {\n return this[_path]\n }\n\n [_onerror](er: NodeJS.ErrnoException) {\n this[_close]()\n this[_writing] = true\n this.emit('error', er)\n }\n\n [_open]() {\n fs.open(this[_path], this[_flags], this[_mode], (er, fd) =>\n this[_onopen](er, fd),\n )\n }\n\n [_onopen](er?: null | NodeJS.ErrnoException, fd?: number) {\n if (\n this[_defaultFlag] &&\n this[_flags] === 'r+' &&\n er &&\n er.code === 'ENOENT'\n ) {\n this[_flags] = 'w'\n this[_open]()\n } else if (er) {\n this[_onerror](er)\n } else {\n this[_fd] = fd\n this.emit('open', fd)\n if (!this[_writing]) {\n this[_flush]()\n }\n }\n }\n\n end(buf: string, enc?: BufferEncoding): this\n end(buf?: Buffer, enc?: undefined): this\n end(buf?: Buffer | string, enc?: BufferEncoding): this {\n if (buf) {\n //@ts-ignore\n this.write(buf, enc)\n }\n\n this[_ended] = true\n\n // synthetic after-write logic, where drain/finish live\n if (\n !this[_writing] &&\n !this[_queue].length &&\n typeof this[_fd] === 'number'\n ) {\n this[_onwrite](null, 0)\n }\n return this\n }\n\n write(buf: string, enc?: BufferEncoding): boolean\n write(buf: Buffer, enc?: undefined): boolean\n write(buf: Buffer | string, enc?: BufferEncoding): boolean {\n if (typeof buf === 'string') {\n buf = Buffer.from(buf, enc)\n }\n\n if (this[_ended]) {\n this.emit('error', new Error('write() after end()'))\n return false\n }\n\n if (this[_fd] === undefined || this[_writing] || this[_queue].length) {\n this[_queue].push(buf)\n this[_needDrain] = true\n return false\n }\n\n this[_writing] = true\n this[_write](buf)\n return true\n }\n\n [_write](buf: Buffer) {\n fs.write(\n this[_fd] as number,\n buf,\n 0,\n buf.length,\n this[_pos],\n (er, bw) => this[_onwrite](er, bw),\n )\n }\n\n [_onwrite](er?: null | NodeJS.ErrnoException, bw?: number) {\n if (er) {\n this[_onerror](er)\n } else {\n if (this[_pos] !== undefined && typeof bw === 'number') {\n this[_pos] += bw\n }\n if (this[_queue].length) {\n this[_flush]()\n } else {\n this[_writing] = false\n\n if (this[_ended] && !this[_finished]) {\n this[_finished] = true\n this[_close]()\n this.emit('finish')\n } else if (this[_needDrain]) {\n this[_needDrain] = false\n this.emit('drain')\n }\n }\n }\n }\n\n [_flush]() {\n if (this[_queue].length === 0) {\n if (this[_ended]) {\n this[_onwrite](null, 0)\n }\n } else if (this[_queue].length === 1) {\n this[_write](this[_queue].pop() as Buffer)\n } else {\n const iovec = this[_queue]\n this[_queue] = []\n writev(this[_fd] as number, iovec, this[_pos] as number, (er, bw) =>\n this[_onwrite](er, bw),\n )\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.close(fd, er =>\n er ? this.emit('error', er) : this.emit('close'),\n )\n }\n }\n}\n\nexport class WriteStreamSync extends WriteStream {\n [_open](): void {\n let fd\n // only wrap in a try{} block if we know we'll retry, to avoid\n // the rethrow obscuring the error's source frame in most cases.\n if (this[_defaultFlag] && this[_flags] === 'r+') {\n try {\n fd = fs.openSync(this[_path], this[_flags], this[_mode])\n } catch (er) {\n if ((er as NodeJS.ErrnoException)?.code === 'ENOENT') {\n this[_flags] = 'w'\n return this[_open]()\n } else {\n throw er\n }\n }\n } else {\n fd = fs.openSync(this[_path], this[_flags], this[_mode])\n }\n\n this[_onopen](null, fd)\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.closeSync(fd)\n this.emit('close')\n }\n }\n\n [_write](buf: Buffer) {\n // throw the original, but try to close if it fails\n let threw = true\n try {\n this[_onwrite](\n null,\n fs.writeSync(this[_fd] as number, buf, 0, buf.length, this[_pos]),\n )\n threw = false\n } finally {\n if (threw) {\n try {\n this[_close]()\n } catch {\n // ok error\n }\n }\n }\n }\n}\n", "const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe {\n src: Minipass\n dest: Minipass\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = er => dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable = Iterable & AsyncIterable\n\n type EventArguments = Record\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events = Minipass.Events\n >\n extends EventEmitter\n implements Minipass.DualIterable\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options]\n : [Minipass.Options])\n ) {\n const options: Minipass.Options = (args[0] ||\n {}) as Minipass.Options\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this as Minipass, dest, opts)\n : new PipeProxyErrors(this as Minipass, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n", "import { WriteStream, WriteStreamSync } from '@isaacs/fs-minipass'\nimport { Minipass } from 'minipass'\nimport path from 'node:path'\nimport { list } from './list.js'\nimport { makeCommand } from './make-command.js'\nimport {\n TarOptions,\n TarOptionsFile,\n TarOptionsSync,\n TarOptionsSyncFile,\n} from './options.js'\nimport { Pack, PackSync } from './pack.js'\n\nconst createFileSync = (opt: TarOptionsSyncFile, files: string[]) => {\n const p = new PackSync(opt)\n const stream = new WriteStreamSync(opt.file, {\n mode: opt.mode || 0o666,\n })\n p.pipe(stream as unknown as Minipass.Writable)\n addFilesSync(p, files)\n}\n\nconst createFile = (opt: TarOptionsFile, files: string[]) => {\n const p = new Pack(opt)\n const stream = new WriteStream(opt.file, {\n mode: opt.mode || 0o666,\n })\n p.pipe(stream as unknown as Minipass.Writable)\n\n const promise = new Promise((res, rej) => {\n stream.on('error', rej)\n stream.on('close', res)\n p.on('error', rej)\n })\n\n addFilesAsync(p, files)\n\n return promise\n}\n\nconst addFilesSync = (p: PackSync, files: string[]) => {\n files.forEach(file => {\n if (file.charAt(0) === '@') {\n list({\n file: path.resolve(p.cwd, file.slice(1)),\n sync: true,\n noResume: true,\n onReadEntry: entry => p.add(entry),\n })\n } else {\n p.add(file)\n }\n })\n p.end()\n}\n\nconst addFilesAsync = async (\n p: Pack,\n files: string[],\n): Promise => {\n for (let i = 0; i < files.length; i++) {\n const file = String(files[i])\n if (file.charAt(0) === '@') {\n await list({\n file: path.resolve(String(p.cwd), file.slice(1)),\n noResume: true,\n onReadEntry: entry => {\n p.add(entry)\n },\n })\n } else {\n p.add(file)\n }\n }\n p.end()\n}\n\nconst createSync = (opt: TarOptionsSync, files: string[]) => {\n const p = new PackSync(opt)\n addFilesSync(p, files)\n return p\n}\n\nconst createAsync = (opt: TarOptions, files: string[]) => {\n const p = new Pack(opt)\n addFilesAsync(p, files)\n return p\n}\n\nexport const create = makeCommand(\n createFileSync,\n createFile,\n createSync,\n createAsync,\n (_opt, files) => {\n if (!files?.length) {\n throw new TypeError('no paths specified to add to archive')\n }\n },\n)\n", "// tar -t\nimport * as fsm from '@isaacs/fs-minipass'\nimport fs from 'node:fs'\nimport { dirname, parse } from 'path'\nimport { makeCommand } from './make-command.js'\nimport {\n TarOptions,\n TarOptionsFile,\n TarOptionsSyncFile,\n} from './options.js'\nimport { Parser } from './parse.js'\nimport { stripTrailingSlashes } from './strip-trailing-slashes.js'\n\nconst onReadEntryFunction = (opt: TarOptions) => {\n const onReadEntry = opt.onReadEntry\n opt.onReadEntry =\n onReadEntry ?\n e => {\n onReadEntry(e)\n e.resume()\n }\n : e => e.resume()\n}\n\n// construct a filter that limits the file entries listed\n// include child entries if a dir is included\nexport const filesFilter = (opt: TarOptions, files: string[]) => {\n const map = new Map(\n files.map(f => [stripTrailingSlashes(f), true]),\n )\n const filter = opt.filter\n\n const mapHas = (file: string, r: string = ''): boolean => {\n const root = r || parse(file).root || '.'\n let ret: boolean\n if (file === root) ret = false\n else {\n const m = map.get(file)\n if (m !== undefined) {\n ret = m\n } else {\n ret = mapHas(dirname(file), root)\n }\n }\n\n map.set(file, ret)\n return ret\n }\n\n opt.filter =\n filter ?\n (file, entry) =>\n filter(file, entry) && mapHas(stripTrailingSlashes(file))\n : file => mapHas(stripTrailingSlashes(file))\n}\n\nconst listFileSync = (opt: TarOptionsSyncFile) => {\n const p = new Parser(opt)\n const file = opt.file\n let fd: number | undefined\n try {\n fd = fs.openSync(file, 'r')\n const stat: fs.Stats = fs.fstatSync(fd)\n const readSize: number = opt.maxReadSize || 16 * 1024 * 1024\n if (stat.size < readSize) {\n const buf = Buffer.allocUnsafe(stat.size)\n const read = fs.readSync(fd, buf, 0, stat.size, 0)\n p.end(read === buf.byteLength ? buf : buf.subarray(0, read))\n } else {\n let pos = 0\n const buf = Buffer.allocUnsafe(readSize)\n while (pos < stat.size) {\n const bytesRead = fs.readSync(fd, buf, 0, readSize, pos)\n if (bytesRead === 0) break\n pos += bytesRead\n p.write(buf.subarray(0, bytesRead))\n }\n p.end()\n }\n } finally {\n if (typeof fd === 'number') {\n try {\n fs.closeSync(fd)\n /* c8 ignore next */\n } catch (er) {}\n }\n }\n}\n\nconst listFile = (\n opt: TarOptionsFile,\n _files: string[],\n): Promise => {\n const parse = new Parser(opt)\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n\n const file = opt.file\n const p = new Promise((resolve, reject) => {\n parse.on('error', reject)\n parse.on('end', resolve)\n\n fs.stat(file, (er, stat) => {\n if (er) {\n reject(er)\n } else {\n const stream = new fsm.ReadStream(file, {\n readSize: readSize,\n size: stat.size,\n })\n stream.on('error', reject)\n stream.pipe(parse)\n }\n })\n })\n return p\n}\n\nexport const list = makeCommand(\n listFileSync,\n listFile,\n opt => new Parser(opt) as Parser & { sync: true },\n opt => new Parser(opt),\n (opt, files) => {\n if (files?.length) filesFilter(opt, files)\n if (!opt.noResume) onReadEntryFunction(opt)\n },\n)\n", "// turn tar(1) style args like `C` into the more verbose things like `cwd`\n\nimport { type GzipOptions, type ZlibOptions } from 'minizlib'\nimport { type Stats } from 'node:fs'\nimport { type ReadEntry } from './read-entry.js'\nimport { type WarnData } from './warn-method.js'\nimport { WriteEntry } from './write-entry.js'\n\nconst argmap = new Map(\n [\n ['C', 'cwd'],\n ['f', 'file'],\n ['z', 'gzip'],\n ['P', 'preservePaths'],\n ['U', 'unlink'],\n ['strip-components', 'strip'],\n ['stripComponents', 'strip'],\n ['keep-newer', 'newer'],\n ['keepNewer', 'newer'],\n ['keep-newer-files', 'newer'],\n ['keepNewerFiles', 'newer'],\n ['k', 'keep'],\n ['keep-existing', 'keep'],\n ['keepExisting', 'keep'],\n ['m', 'noMtime'],\n ['no-mtime', 'noMtime'],\n ['p', 'preserveOwner'],\n ['L', 'follow'],\n ['h', 'follow'],\n ['onentry', 'onReadEntry'],\n ],\n)\n\n/**\n * The options that can be provided to tar commands.\n *\n * Note that some of these are only relevant for certain commands, since\n * they are specific to reading or writing.\n *\n * Aliases are provided in the {@link TarOptionsWithAliases} type.\n */\nexport interface TarOptions {\n //////////////////////////\n // shared options\n\n /**\n * Perform all I/O operations synchronously. If the stream is ended\n * immediately, then it will be processed entirely synchronously.\n */\n sync?: boolean\n\n /**\n * The tar file to be read and/or written. When this is set, a stream\n * is not returned. Asynchronous commands will return a promise indicating\n * when the operation is completed, and synchronous commands will return\n * immediately.\n */\n file?: string\n\n /**\n * Treat warnings as crash-worthy errors. Defaults false.\n */\n strict?: boolean\n\n /**\n * The effective current working directory for this tar command\n */\n cwd?: string\n\n /**\n * When creating a tar archive, this can be used to compress it as well.\n * Set to `true` to use the default gzip options, or customize them as\n * needed.\n *\n * When reading, if this is unset, then the compression status will be\n * inferred from the archive data. This is generally best, unless you are\n * sure of the compression settings in use to create the archive, and want to\n * fail if the archive doesn't match expectations.\n */\n gzip?: boolean | GzipOptions\n\n /**\n * When creating archives, preserve absolute and `..` paths in the archive,\n * rather than sanitizing them under the cwd.\n *\n * When extracting, allow absolute paths, paths containing `..`, and\n * extracting through symbolic links. By default, the root `/` is stripped\n * from absolute paths (eg, turning `/x/y/z` into `x/y/z`), paths containing\n * `..` are not extracted, and any file whose location would be modified by a\n * symbolic link is not extracted.\n *\n * **WARNING** This is almost always unsafe, and must NEVER be used on\n * archives from untrusted sources, such as user input, and every entry must\n * be validated to ensure it is safe to write. Even if the input is not\n * malicious, mistakes can cause a lot of damage!\n */\n preservePaths?: boolean\n\n /**\n * When extracting, do not set the `mtime` value for extracted entries to\n * match the `mtime` in the archive.\n *\n * When creating archives, do not store the `mtime` value in the entry. Note\n * that this prevents properly using other mtime-based features (such as\n * `tar.update` or the `newer` option) with the resulting archive.\n */\n noMtime?: boolean\n\n /**\n * Set to `true` or an object with settings for `zlib.BrotliCompress()` to\n * create a brotli-compressed archive\n *\n * When extracting, this will cause the archive to be treated as a\n * brotli-compressed file if set to `true` or a ZlibOptions object.\n *\n * If set `false`, then brotli options will not be used.\n *\n * If this, the `gzip`, and `zstd` options are left `undefined`, then tar\n * will attempt to infer the brotli compression status, but can only do so\n * based on the filename. If the filename ends in `.tbr` or `.tar.br`, and\n * the first 512 bytes are not a valid tar header, then brotli decompression\n * will be attempted.\n */\n brotli?: boolean | ZlibOptions\n\n /**\n * Set to `true` or an object with settings for `zstd.compress()` to\n * create a zstd-compressed archive\n *\n * When extracting, this will cause the archive to be treated as a\n * zstd-compressed file if set to `true` or a ZlibOptions object.\n *\n * If set `false`, then zstd options will not be used.\n *\n * If this, the `gzip`, and `brotli` options are left `undefined`, then tar\n * will attempt to infer the zstd compression status, but can only do so\n * based on the filename. If the filename ends in `.tzst` or `.tar.zst`, and\n * the first 512 bytes are not a valid tar header, then zstd decompression\n * will be attempted.\n */\n zstd?: boolean | ZlibOptions\n\n /**\n * A function that is called with `(path, stat)` when creating an archive, or\n * `(path, entry)` when extracting. Return true to process the file/entry, or\n * false to exclude it.\n */\n filter?: (path: string, entry: Stats | ReadEntry) => boolean\n\n /**\n * A function that gets called for any warning encountered.\n *\n * Note: if `strict` is set, then the warning will throw, and this method\n * will not be called.\n */\n onwarn?: (code: string, message: string, data: WarnData) => any\n\n //////////////////////////\n // extraction options\n\n /**\n * When extracting, unlink files before creating them. Without this option,\n * tar overwrites existing files, which preserves existing hardlinks. With\n * this option, existing hardlinks will be broken, as will any symlink that\n * would affect the location of an extracted file.\n */\n unlink?: boolean\n\n /**\n * When extracting, strip the specified number of path portions from the\n * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be\n * extracted to `{cwd}/c/d`.\n *\n * Any entry whose entire path is stripped will be excluded.\n */\n strip?: number\n\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n newer?: boolean\n\n /**\n * When extracting, do not overwrite existing files at all.\n */\n keep?: boolean\n\n /**\n * When extracting, set the `uid` and `gid` of extracted entries to the `uid`\n * and `gid` fields in the archive. Defaults to true when run as root, and\n * false otherwise.\n *\n * If false, then files and directories will be set with the owner and group\n * of the user running the process. This is similar to `-p` in `tar(1)`, but\n * ACLs and other system-specific data is never unpacked in this\n * implementation, and modes are set by default already.\n */\n preserveOwner?: boolean\n\n /**\n * The maximum depth of subfolders to extract into. This defaults to 1024.\n * Anything deeper than the limit will raise a warning and skip the entry.\n * Set to `Infinity` to remove the limitation.\n */\n maxDepth?: number\n\n /**\n * When extracting, force all created files and directories, and all\n * implicitly created directories, to be owned by the specified user id,\n * regardless of the `uid` field in the archive.\n *\n * Cannot be used along with `preserveOwner`. Requires also setting the `gid`\n * option.\n */\n uid?: number\n\n /**\n * When extracting, force all created files and directories, and all\n * implicitly created directories, to be owned by the specified group id,\n * regardless of the `gid` field in the archive.\n *\n * Cannot be used along with `preserveOwner`. Requires also setting the `uid`\n * option.\n */\n gid?: number\n\n /**\n * When extracting, provide a function that takes an `entry` object, and\n * returns a stream, or any falsey value. If a stream is provided, then that\n * stream's data will be written instead of the contents of the archive\n * entry. If a falsey value is provided, then the entry is written to disk as\n * normal.\n *\n * To exclude items from extraction, use the `filter` option.\n *\n * Note that using an asynchronous stream type with the `transform` option\n * will cause undefined behavior in synchronous extractions.\n * [MiniPass](http://npm.im/minipass)-based streams are designed for this use\n * case.\n */\n transform?: (entry: ReadEntry) => any\n\n /**\n * Call `chmod()` to ensure that extracted files match the entry's mode\n * field. Without this field set, all mode fields in archive entries are a\n * best effort attempt only.\n *\n * Setting this necessitates a call to the deprecated `process.umask()`\n * method to determine the default umask value, unless a `processUmask`\n * config is provided as well.\n *\n * If not set, tar will attempt to create file system entries with whatever\n * mode is provided, and let the implicit process `umask` apply normally, but\n * if a file already exists to be written to, then its existing mode will not\n * be modified.\n *\n * When setting `chmod: true`, it is highly recommend to set the\n * {@link TarOptions#processUmask} option as well, to avoid the call to the\n * deprecated (and thread-unsafe) `process.umask()` method.\n */\n chmod?: boolean\n\n /**\n * When setting the {@link TarOptions#chmod} option to `true`, you may\n * provide a value here to avoid having to call the deprecated and\n * thread-unsafe `process.umask()` method.\n *\n * This has no effect with `chmod` is not set to true, as mode values are not\n * set explicitly anyway. If `chmod` is set to `true`, and a value is not\n * provided here, then `process.umask()` must be called, which will result in\n * deprecation warnings.\n *\n * The most common values for this are `0o22` (resulting in directories\n * created with mode `0o755` and files with `0o644` by default) and `0o2`\n * (resulting in directores created with mode `0o775` and files `0o664`, so\n * they are group-writable).\n */\n processUmask?: number\n\n //////////////////////////\n // archive creation options\n\n /**\n * When parsing/listing archives, `entry` streams are by default resumed\n * (set into \"flowing\" mode) immediately after the call to `onReadEntry()`.\n * Set `noResume: true` to suppress this behavior.\n *\n * Note that when this is set, the stream will never complete until the\n * data is consumed somehow.\n *\n * Set automatically in extract operations, since the entry is piped to\n * a file system entry right away. Only relevant when parsing.\n */\n noResume?: boolean\n\n /**\n * When creating, updating, or replacing within archives, this method will\n * be called with each WriteEntry that is created.\n */\n onWriteEntry?: (entry: WriteEntry) => any\n\n /**\n * When extracting or listing archives, this method will be called with\n * each entry that is not excluded by a `filter`.\n *\n * Important when listing archives synchronously from a file, because there\n * is otherwise no way to interact with the data!\n */\n onReadEntry?: (entry: ReadEntry) => any\n\n /**\n * Pack the targets of symbolic links rather than the link itself.\n */\n follow?: boolean\n\n /**\n * When creating archives, omit any metadata that is system-specific:\n * `ctime`, `atime`, `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and\n * `nlink`. Note that `mtime` is still included, because this is necessary\n * for other time-based operations such as `tar.update`. Additionally, `mode`\n * is set to a \"reasonable default\" for mose unix systems, based on an\n * effective `umask` of `0o22`.\n *\n * This also defaults the `portable` option in the gzip configs when creating\n * a compressed archive, in order to produce deterministic archives that are\n * not operating-system specific.\n */\n portable?: boolean\n\n /**\n * When creating archives, do not recursively archive the contents of\n * directories. By default, archiving a directory archives all of its\n * contents as well.\n */\n noDirRecurse?: boolean\n\n /**\n * Suppress Pax extended headers when creating archives. Note that this means\n * long paths and linkpaths will be truncated, and large or negative numeric\n * values may be interpreted incorrectly.\n */\n noPax?: boolean\n\n /**\n * Set to a `Date` object to force a specific `mtime` value for everything\n * written to an archive.\n *\n * This is useful when creating archives that are intended to be\n * deterministic based on their contents, irrespective of the file's last\n * modification time.\n *\n * Overridden by `noMtime`.\n */\n mtime?: Date\n\n /**\n * A path portion to prefix onto the entries added to an archive.\n */\n prefix?: string\n\n /**\n * The mode to set on any created file archive, defaults to 0o666\n * masked by the process umask, often resulting in 0o644.\n *\n * This does *not* affect the mode fields of individual entries, or the\n * mode status of extracted entries on the filesystem.\n */\n mode?: number\n\n //////////////////////////\n // internal options\n\n /**\n * A cache of mtime values, to avoid having to stat the same file repeatedly.\n *\n * @internal\n */\n mtimeCache?: Map\n\n /**\n * maximum buffer size for `fs.read()` operations.\n *\n * @internal\n */\n maxReadSize?: number\n\n /**\n * Filter modes of entries being unpacked, like `process.umask()`\n *\n * @internal\n */\n umask?: number\n\n /**\n * Default mode for directories. Used for all implicitly created directories,\n * and any directories in the archive that do not have a mode field.\n *\n * @internal\n */\n dmode?: number\n\n /**\n * default mode for files\n *\n * @internal\n */\n fmode?: number\n\n /**\n * Map that tracks which directories already exist, for extraction\n *\n * @internal\n */\n dirCache?: Map\n /**\n * maximum supported size of meta entries. Defaults to 1MB\n *\n * @internal\n */\n maxMetaEntrySize?: number\n\n /**\n * A Map object containing the device and inode value for any file whose\n * `nlink` value is greater than 1, to identify hard links when creating\n * archives.\n *\n * @internal\n */\n linkCache?: Map\n\n /**\n * A map object containing the results of `fs.readdir()` calls.\n *\n * @internal\n */\n readdirCache?: Map\n\n /**\n * A cache of all `lstat` results, for use in creating archives.\n *\n * @internal\n */\n statCache?: Map\n\n /**\n * Number of concurrent jobs to run when creating archives.\n *\n * Defaults to 4.\n *\n * @internal\n */\n jobs?: number\n\n /**\n * Automatically set to true on Windows systems.\n *\n * When extracting, causes behavior where filenames containing `<|>?:`\n * characters are converted to windows-compatible escape sequences in the\n * created filesystem entries.\n *\n * When packing, causes behavior where paths replace `\\` with `/`, and\n * filenames containing the windows-compatible escaped forms of `<|>?:` are\n * converted to actual `<|>?:` characters in the archive.\n *\n * @internal\n */\n win32?: boolean\n\n /**\n * For `WriteEntry` objects, the absolute path to the entry on the\n * filesystem. By default, this is `resolve(cwd, entry.path)`, but it can be\n * overridden explicitly.\n *\n * @internal\n */\n absolute?: string\n\n /**\n * Used with Parser stream interface, to attach and take over when the\n * stream is completely parsed. If this is set, then the prefinish,\n * finish, and end events will not fire, and are the responsibility of\n * the ondone method to emit properly.\n *\n * @internal\n */\n ondone?: () => void\n\n /**\n * Mostly for testing, but potentially useful in some cases.\n * Forcibly trigger a chown on every entry, no matter what.\n */\n forceChown?: boolean\n\n /**\n * ambiguous deprecated name for {@link onReadEntry}\n *\n * @deprecated\n */\n onentry?: (entry: ReadEntry) => any\n}\n\nexport type TarOptionsSync = TarOptions & { sync: true }\nexport type TarOptionsAsync = TarOptions & { sync?: false }\nexport type TarOptionsFile = TarOptions & { file: string }\nexport type TarOptionsNoFile = TarOptions & { file?: undefined }\nexport type TarOptionsSyncFile = TarOptionsSync & TarOptionsFile\nexport type TarOptionsAsyncFile = TarOptionsAsync & TarOptionsFile\nexport type TarOptionsSyncNoFile = TarOptionsSync & TarOptionsNoFile\nexport type TarOptionsAsyncNoFile = TarOptionsAsync & TarOptionsNoFile\n\nexport type LinkCacheKey = `${number}:${number}`\n\nexport interface TarOptionsWithAliases extends TarOptions {\n /**\n * The effective current working directory for this tar command\n */\n C?: TarOptions['cwd']\n /**\n * The tar file to be read and/or written. When this is set, a stream\n * is not returned. Asynchronous commands will return a promise indicating\n * when the operation is completed, and synchronous commands will return\n * immediately.\n */\n f?: TarOptions['file']\n /**\n * When creating a tar archive, this can be used to compress it as well.\n * Set to `true` to use the default gzip options, or customize them as\n * needed.\n *\n * When reading, if this is unset, then the compression status will be\n * inferred from the archive data. This is generally best, unless you are\n * sure of the compression settings in use to create the archive, and want to\n * fail if the archive doesn't match expectations.\n */\n z?: TarOptions['gzip']\n /**\n * When creating archives, preserve absolute and `..` paths in the archive,\n * rather than sanitizing them under the cwd.\n *\n * When extracting, allow absolute paths, paths containing `..`, and\n * extracting through symbolic links. By default, the root `/` is stripped\n * from absolute paths (eg, turning `/x/y/z` into `x/y/z`), paths containing\n * `..` are not extracted, and any file whose location would be modified by a\n * symbolic link is not extracted.\n *\n * **WARNING** This is almost always unsafe, and must NEVER be used on\n * archives from untrusted sources, such as user input, and every entry must\n * be validated to ensure it is safe to write. Even if the input is not\n * malicious, mistakes can cause a lot of damage!\n */\n P?: TarOptions['preservePaths']\n /**\n * When extracting, unlink files before creating them. Without this option,\n * tar overwrites existing files, which preserves existing hardlinks. With\n * this option, existing hardlinks will be broken, as will any symlink that\n * would affect the location of an extracted file.\n */\n U?: TarOptions['unlink']\n /**\n * When extracting, strip the specified number of path portions from the\n * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be\n * extracted to `{cwd}/c/d`.\n */\n 'strip-components'?: TarOptions['strip']\n /**\n * When extracting, strip the specified number of path portions from the\n * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be\n * extracted to `{cwd}/c/d`.\n */\n stripComponents?: TarOptions['strip']\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n 'keep-newer'?: TarOptions['newer']\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n keepNewer?: TarOptions['newer']\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n 'keep-newer-files'?: TarOptions['newer']\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n keepNewerFiles?: TarOptions['newer']\n /**\n * When extracting, do not overwrite existing files at all.\n */\n k?: TarOptions['keep']\n /**\n * When extracting, do not overwrite existing files at all.\n */\n 'keep-existing'?: TarOptions['keep']\n /**\n * When extracting, do not overwrite existing files at all.\n */\n keepExisting?: TarOptions['keep']\n /**\n * When extracting, do not set the `mtime` value for extracted entries to\n * match the `mtime` in the archive.\n *\n * When creating archives, do not store the `mtime` value in the entry. Note\n * that this prevents properly using other mtime-based features (such as\n * `tar.update` or the `newer` option) with the resulting archive.\n */\n m?: TarOptions['noMtime']\n /**\n * When extracting, do not set the `mtime` value for extracted entries to\n * match the `mtime` in the archive.\n *\n * When creating archives, do not store the `mtime` value in the entry. Note\n * that this prevents properly using other mtime-based features (such as\n * `tar.update` or the `newer` option) with the resulting archive.\n */\n 'no-mtime'?: TarOptions['noMtime']\n /**\n * When extracting, set the `uid` and `gid` of extracted entries to the `uid`\n * and `gid` fields in the archive. Defaults to true when run as root, and\n * false otherwise.\n *\n * If false, then files and directories will be set with the owner and group\n * of the user running the process. This is similar to `-p` in `tar(1)`, but\n * ACLs and other system-specific data is never unpacked in this\n * implementation, and modes are set by default already.\n */\n p?: TarOptions['preserveOwner']\n /**\n * Pack the targets of symbolic links rather than the link itself.\n */\n L?: TarOptions['follow']\n /**\n * Pack the targets of symbolic links rather than the link itself.\n */\n h?: TarOptions['follow']\n\n /**\n * Deprecated option. Set explicitly false to set `chmod: true`. Ignored\n * if {@link TarOptions#chmod} is set to any boolean value.\n *\n * @deprecated\n */\n noChmod?: boolean\n}\n\nexport type TarOptionsWithAliasesSync = TarOptionsWithAliases & {\n sync: true\n}\nexport type TarOptionsWithAliasesAsync = TarOptionsWithAliases & {\n sync?: false\n}\nexport type TarOptionsWithAliasesFile =\n | (TarOptionsWithAliases & {\n file: string\n })\n | (TarOptionsWithAliases & { f: string })\nexport type TarOptionsWithAliasesSyncFile =\n TarOptionsWithAliasesSync & TarOptionsWithAliasesFile\nexport type TarOptionsWithAliasesAsyncFile =\n TarOptionsWithAliasesAsync & TarOptionsWithAliasesFile\n\nexport type TarOptionsWithAliasesNoFile = TarOptionsWithAliases & {\n f?: undefined\n file?: undefined\n}\n\nexport type TarOptionsWithAliasesSyncNoFile =\n TarOptionsWithAliasesSync & TarOptionsWithAliasesNoFile\nexport type TarOptionsWithAliasesAsyncNoFile =\n TarOptionsWithAliasesAsync & TarOptionsWithAliasesNoFile\n\nexport const isSyncFile = (\n o: O,\n): o is O & TarOptionsSyncFile => !!o.sync && !!o.file\nexport const isAsyncFile = (\n o: O,\n): o is O & TarOptionsAsyncFile => !o.sync && !!o.file\nexport const isSyncNoFile = (\n o: O,\n): o is O & TarOptionsSyncNoFile => !!o.sync && !o.file\nexport const isAsyncNoFile = (\n o: O,\n): o is O & TarOptionsAsyncNoFile => !o.sync && !o.file\nexport const isSync = (\n o: O,\n): o is O & TarOptionsSync => !!o.sync\nexport const isAsync = (\n o: O,\n): o is O & TarOptionsAsync => !o.sync\nexport const isFile = (\n o: O,\n): o is O & TarOptionsFile => !!o.file\nexport const isNoFile = (\n o: O,\n): o is O & TarOptionsNoFile => !o.file\n\nconst dealiasKey = (\n k: keyof TarOptionsWithAliases,\n): keyof TarOptions => {\n const d = argmap.get(k)\n if (d) return d\n return k as keyof TarOptions\n}\n\nexport const dealias = (\n opt: TarOptionsWithAliases = {},\n): TarOptions => {\n if (!opt) return {}\n const result: Record = {}\n for (const [key, v] of Object.entries(opt) as [\n keyof TarOptionsWithAliases,\n any,\n ][]) {\n // TS doesn't know that aliases are going to always be the same type\n const k = dealiasKey(key)\n result[k] = v\n }\n // affordance for deprecated noChmod -> chmod\n if (result.chmod === undefined && result.noChmod === false) {\n result.chmod = true\n }\n delete result.noChmod\n return result as TarOptions\n}\n", "import {\n dealias,\n isAsyncFile,\n isAsyncNoFile,\n isSyncFile,\n isSyncNoFile,\n TarOptions,\n TarOptionsAsyncFile,\n TarOptionsAsyncNoFile,\n TarOptionsSyncFile,\n TarOptionsSyncNoFile,\n TarOptionsWithAliases,\n TarOptionsWithAliasesAsync,\n TarOptionsWithAliasesAsyncFile,\n TarOptionsWithAliasesAsyncNoFile,\n TarOptionsWithAliasesFile,\n TarOptionsWithAliasesNoFile,\n TarOptionsWithAliasesSync,\n TarOptionsWithAliasesSyncFile,\n TarOptionsWithAliasesSyncNoFile,\n} from './options.js'\n\nexport type CB = (er?: Error) => any\n\nexport type TarCommand<\n AsyncClass,\n SyncClass extends { sync: true },\n> = {\n // async and no file specified\n (): AsyncClass\n (opt: TarOptionsWithAliasesAsyncNoFile): AsyncClass\n (entries: string[]): AsyncClass\n (\n opt: TarOptionsWithAliasesAsyncNoFile,\n entries: string[],\n ): AsyncClass\n} & {\n // sync and no file\n (opt: TarOptionsWithAliasesSyncNoFile): SyncClass\n (opt: TarOptionsWithAliasesSyncNoFile, entries: string[]): SyncClass\n} & {\n // async and file\n (opt: TarOptionsWithAliasesAsyncFile): Promise\n (\n opt: TarOptionsWithAliasesAsyncFile,\n entries: string[],\n ): Promise\n (opt: TarOptionsWithAliasesAsyncFile, cb: CB): Promise\n (\n opt: TarOptionsWithAliasesAsyncFile,\n entries: string[],\n cb: CB,\n ): Promise\n} & {\n // sync and file\n (opt: TarOptionsWithAliasesSyncFile): void\n (opt: TarOptionsWithAliasesSyncFile, entries: string[]): void\n} & {\n // sync, maybe file\n (opt: TarOptionsWithAliasesSync): typeof opt extends (\n TarOptionsWithAliasesFile\n ) ?\n void\n : typeof opt extends TarOptionsWithAliasesNoFile ? SyncClass\n : void | SyncClass\n (\n opt: TarOptionsWithAliasesSync,\n entries: string[],\n ): typeof opt extends TarOptionsWithAliasesFile ? void\n : typeof opt extends TarOptionsWithAliasesNoFile ? SyncClass\n : void | SyncClass\n} & {\n // async, maybe file\n (opt: TarOptionsWithAliasesAsync): typeof opt extends (\n TarOptionsWithAliasesFile\n ) ?\n Promise\n : typeof opt extends TarOptionsWithAliasesNoFile ? AsyncClass\n : Promise | AsyncClass\n (\n opt: TarOptionsWithAliasesAsync,\n entries: string[],\n ): typeof opt extends TarOptionsWithAliasesFile ? Promise\n : typeof opt extends TarOptionsWithAliasesNoFile ? AsyncClass\n : Promise | AsyncClass\n (opt: TarOptionsWithAliasesAsync, cb: CB): Promise\n (\n opt: TarOptionsWithAliasesAsync,\n entries: string[],\n cb: CB,\n ): typeof opt extends TarOptionsWithAliasesFile ? Promise\n : typeof opt extends TarOptionsWithAliasesNoFile ? never\n : Promise\n} & {\n // maybe sync, file\n (opt: TarOptionsWithAliasesFile): Promise | void\n (\n opt: TarOptionsWithAliasesFile,\n entries: string[],\n ): typeof opt extends TarOptionsWithAliasesSync ? void\n : typeof opt extends TarOptionsWithAliasesAsync ? Promise\n : Promise | void\n (opt: TarOptionsWithAliasesFile, cb: CB): Promise\n (\n opt: TarOptionsWithAliasesFile,\n entries: string[],\n cb: CB,\n ): typeof opt extends TarOptionsWithAliasesSync ? never\n : typeof opt extends TarOptionsWithAliasesAsync ? Promise\n : Promise\n} & {\n // maybe sync, no file\n (opt: TarOptionsWithAliasesNoFile): typeof opt extends (\n TarOptionsWithAliasesSync\n ) ?\n SyncClass\n : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass\n : SyncClass | AsyncClass\n (\n opt: TarOptionsWithAliasesNoFile,\n entries: string[],\n ): typeof opt extends TarOptionsWithAliasesSync ? SyncClass\n : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass\n : SyncClass | AsyncClass\n} & {\n // maybe sync, maybe file\n (opt: TarOptionsWithAliases): typeof opt extends (\n TarOptionsWithAliasesFile\n ) ?\n typeof opt extends TarOptionsWithAliasesSync ? void\n : typeof opt extends TarOptionsWithAliasesAsync ? Promise\n : void | Promise\n : typeof opt extends TarOptionsWithAliasesNoFile ?\n typeof opt extends TarOptionsWithAliasesSync ? SyncClass\n : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass\n : SyncClass | AsyncClass\n : typeof opt extends TarOptionsWithAliasesSync ? SyncClass | void\n : typeof opt extends TarOptionsWithAliasesAsync ?\n AsyncClass | Promise\n : SyncClass | void | AsyncClass | Promise\n} & {\n // extras\n syncFile: (opt: TarOptionsSyncFile, entries: string[]) => void\n asyncFile: (\n opt: TarOptionsAsyncFile,\n entries: string[],\n cb?: CB,\n ) => Promise\n syncNoFile: (\n opt: TarOptionsSyncNoFile,\n entries: string[],\n ) => SyncClass\n asyncNoFile: (\n opt: TarOptionsAsyncNoFile,\n entries: string[],\n ) => AsyncClass\n validate?: (opt: TarOptions, entries?: string[]) => void\n}\n\nexport const makeCommand = <\n AsyncClass,\n SyncClass extends { sync: true },\n>(\n syncFile: (opt: TarOptionsSyncFile, entries: string[]) => void,\n asyncFile: (\n opt: TarOptionsAsyncFile,\n entries: string[],\n cb?: CB,\n ) => Promise,\n syncNoFile: (\n opt: TarOptionsSyncNoFile,\n entries: string[],\n ) => SyncClass,\n asyncNoFile: (\n opt: TarOptionsAsyncNoFile,\n entries: string[],\n ) => AsyncClass,\n validate?: (opt: TarOptions, entries?: string[]) => void,\n): TarCommand => {\n return Object.assign(\n (\n opt_: TarOptionsWithAliases | string[] = [],\n entries?: string[] | CB,\n cb?: CB,\n ) => {\n if (Array.isArray(opt_)) {\n entries = opt_\n opt_ = {}\n }\n\n if (typeof entries === 'function') {\n cb = entries\n entries = undefined\n }\n\n if (!entries) {\n entries = []\n } else {\n entries = Array.from(entries)\n }\n\n const opt = dealias(opt_)\n\n validate?.(opt, entries)\n\n if (isSyncFile(opt)) {\n if (typeof cb === 'function') {\n throw new TypeError(\n 'callback not supported for sync tar functions',\n )\n }\n return syncFile(opt, entries)\n } else if (isAsyncFile(opt)) {\n const p = asyncFile(opt, entries)\n // weirdness to make TS happy\n const c = cb ? cb : undefined\n return c ? p.then(() => c(), c) : p\n } else if (isSyncNoFile(opt)) {\n if (typeof cb === 'function') {\n throw new TypeError(\n 'callback not supported for sync tar functions',\n )\n }\n return syncNoFile(opt, entries)\n } else if (isAsyncNoFile(opt)) {\n if (typeof cb === 'function') {\n throw new TypeError(\n 'callback only supported with file option',\n )\n }\n return asyncNoFile(opt, entries)\n /* c8 ignore start */\n } else {\n throw new Error('impossible options??')\n }\n /* c8 ignore stop */\n },\n {\n syncFile,\n asyncFile,\n syncNoFile,\n asyncNoFile,\n validate,\n },\n ) as TarCommand\n}\n", "// this[BUFFER] is the remainder of a chunk if we're waiting for\n// the full 512 bytes of a header to come in. We will Buffer.concat()\n// it to the next write(), which is a mem copy, but a small one.\n//\n// this[QUEUE] is a list of entries that haven't been emitted\n// yet this can only get filled up if the user keeps write()ing after\n// a write() returns false, or does a write() with more than one entry\n//\n// We don't buffer chunks, we always parse them and either create an\n// entry, or push it into the active entry. The ReadEntry class knows\n// to throw data away if .ignore=true\n//\n// Shift entry off the buffer when it emits 'end', and emit 'entry' for\n// the next one in the list.\n//\n// At any time, we're pushing body chunks into the entry at WRITEENTRY,\n// and waiting for 'end' on the entry at READENTRY\n//\n// ignored entries get .resume() called on them straight away\n\nimport { EventEmitter as EE } from 'events'\nimport { BrotliDecompress, Unzip, ZstdDecompress } from 'minizlib'\nimport { Header } from './header.js'\nimport { TarOptions } from './options.js'\nimport { Pax } from './pax.js'\nimport { ReadEntry } from './read-entry.js'\nimport {\n warnMethod,\n type WarnData,\n type Warner,\n} from './warn-method.js'\n\nconst maxMetaEntrySize = 1024 * 1024\nconst gzipHeader = Buffer.from([0x1f, 0x8b])\nconst zstdHeader = Buffer.from([0x28, 0xb5, 0x2f, 0xfd])\nconst ZIP_HEADER_LEN = Math.max(gzipHeader.length, zstdHeader.length)\n\nconst STATE = Symbol('state')\nconst WRITEENTRY = Symbol('writeEntry')\nconst READENTRY = Symbol('readEntry')\nconst NEXTENTRY = Symbol('nextEntry')\nconst PROCESSENTRY = Symbol('processEntry')\nconst EX = Symbol('extendedHeader')\nconst GEX = Symbol('globalExtendedHeader')\nconst META = Symbol('meta')\nconst EMITMETA = Symbol('emitMeta')\nconst BUFFER = Symbol('buffer')\nconst QUEUE = Symbol('queue')\nconst ENDED = Symbol('ended')\nconst EMITTEDEND = Symbol('emittedEnd')\nconst EMIT = Symbol('emit')\nconst UNZIP = Symbol('unzip')\nconst CONSUMECHUNK = Symbol('consumeChunk')\nconst CONSUMECHUNKSUB = Symbol('consumeChunkSub')\nconst CONSUMEBODY = Symbol('consumeBody')\nconst CONSUMEMETA = Symbol('consumeMeta')\nconst CONSUMEHEADER = Symbol('consumeHeader')\nconst CONSUMING = Symbol('consuming')\nconst BUFFERCONCAT = Symbol('bufferConcat')\nconst MAYBEEND = Symbol('maybeEnd')\nconst WRITING = Symbol('writing')\nconst ABORTED = Symbol('aborted')\nconst DONE = Symbol('onDone')\nconst SAW_VALID_ENTRY = Symbol('sawValidEntry')\nconst SAW_NULL_BLOCK = Symbol('sawNullBlock')\nconst SAW_EOF = Symbol('sawEOF')\nconst CLOSESTREAM = Symbol('closeStream')\n\nconst noop = () => true\n\nexport type State = 'begin' | 'header' | 'ignore' | 'meta' | 'body'\n\nexport class Parser extends EE implements Warner {\n file: string\n strict: boolean\n maxMetaEntrySize: number\n filter: Exclude\n brotli?: TarOptions['brotli']\n zstd?: TarOptions['zstd']\n\n writable: true = true\n readable: false = false;\n\n [QUEUE]: (ReadEntry | [string | symbol, any, any])[] = [];\n [BUFFER]?: Buffer;\n [READENTRY]?: ReadEntry;\n [WRITEENTRY]?: ReadEntry;\n [STATE]: State = 'begin';\n [META]: string = '';\n [EX]?: Pax;\n [GEX]?: Pax;\n [ENDED]: boolean = false;\n [UNZIP]?: false | Unzip | BrotliDecompress | ZstdDecompress;\n [ABORTED]: boolean = false;\n [SAW_VALID_ENTRY]?: boolean;\n [SAW_NULL_BLOCK]: boolean = false;\n [SAW_EOF]: boolean = false;\n [WRITING]: boolean = false;\n [CONSUMING]: boolean = false;\n [EMITTEDEND]: boolean = false\n\n constructor(opt: TarOptions = {}) {\n super()\n\n this.file = opt.file || ''\n\n // these BADARCHIVE errors can't be detected early. listen on DONE.\n this.on(DONE, () => {\n if (\n this[STATE] === 'begin' ||\n this[SAW_VALID_ENTRY] === false\n ) {\n // either less than 1 block of data, or all entries were invalid.\n // Either way, probably not even a tarball.\n this.warn('TAR_BAD_ARCHIVE', 'Unrecognized archive format')\n }\n })\n\n if (opt.ondone) {\n this.on(DONE, opt.ondone)\n } else {\n this.on(DONE, () => {\n this.emit('prefinish')\n this.emit('finish')\n this.emit('end')\n })\n }\n\n this.strict = !!opt.strict\n this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize\n this.filter = typeof opt.filter === 'function' ? opt.filter : noop\n // Unlike gzip, brotli doesn't have any magic bytes to identify it\n // Users need to explicitly tell us they're extracting a brotli file\n // Or we infer from the file extension\n const isTBR =\n opt.file &&\n (opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr'))\n // if it's a tbr file it MIGHT be brotli, but we don't know until\n // we look at it and verify it's not a valid tar file.\n this.brotli =\n !(opt.gzip || opt.zstd) && opt.brotli !== undefined ? opt.brotli\n : isTBR ? undefined\n : false\n\n // zstd has magic bytes to identify it, but we also support explicit options\n // and file extension detection\n const isTZST =\n opt.file &&\n (opt.file.endsWith('.tar.zst') || opt.file.endsWith('.tzst'))\n this.zstd =\n !(opt.gzip || opt.brotli) && opt.zstd !== undefined ? opt.zstd\n : isTZST ? true\n : undefined\n\n // have to set this so that streams are ok piping into it\n this.on('end', () => this[CLOSESTREAM]())\n\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n if (typeof opt.onReadEntry === 'function') {\n this.on('entry', opt.onReadEntry)\n }\n }\n\n warn(\n code: string,\n message: string | Error,\n data: WarnData = {},\n ): void {\n warnMethod(this, code, message, data)\n }\n\n [CONSUMEHEADER](chunk: Buffer, position: number) {\n if (this[SAW_VALID_ENTRY] === undefined) {\n this[SAW_VALID_ENTRY] = false\n }\n let header\n try {\n header = new Header(chunk, position, this[EX], this[GEX])\n } catch (er) {\n return this.warn('TAR_ENTRY_INVALID', er as Error)\n }\n\n if (header.nullBlock) {\n if (this[SAW_NULL_BLOCK]) {\n this[SAW_EOF] = true\n // ending an archive with no entries. pointless, but legal.\n if (this[STATE] === 'begin') {\n this[STATE] = 'header'\n }\n this[EMIT]('eof')\n } else {\n this[SAW_NULL_BLOCK] = true\n this[EMIT]('nullBlock')\n }\n } else {\n this[SAW_NULL_BLOCK] = false\n if (!header.cksumValid) {\n this.warn('TAR_ENTRY_INVALID', 'checksum failure', { header })\n } else if (!header.path) {\n this.warn('TAR_ENTRY_INVALID', 'path is required', { header })\n } else {\n const type = header.type\n if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) {\n this.warn('TAR_ENTRY_INVALID', 'linkpath required', {\n header,\n })\n } else if (\n !/^(Symbolic)?Link$/.test(type) &&\n !/^(Global)?ExtendedHeader$/.test(type) &&\n header.linkpath\n ) {\n this.warn('TAR_ENTRY_INVALID', 'linkpath forbidden', {\n header,\n })\n } else {\n const entry = (this[WRITEENTRY] = new ReadEntry(\n header,\n this[EX],\n this[GEX],\n ))\n\n // we do this for meta & ignored entries as well, because they\n // are still valid tar, or else we wouldn't know to ignore them\n if (!this[SAW_VALID_ENTRY]) {\n if (entry.remain) {\n // this might be the one!\n const onend = () => {\n if (!entry.invalid) {\n this[SAW_VALID_ENTRY] = true\n }\n }\n entry.on('end', onend)\n } else {\n this[SAW_VALID_ENTRY] = true\n }\n }\n\n if (entry.meta) {\n if (entry.size > this.maxMetaEntrySize) {\n entry.ignore = true\n this[EMIT]('ignoredEntry', entry)\n this[STATE] = 'ignore'\n entry.resume()\n } else if (entry.size > 0) {\n this[META] = ''\n entry.on('data', c => (this[META] += c))\n this[STATE] = 'meta'\n }\n } else {\n this[EX] = undefined\n entry.ignore =\n entry.ignore || !this.filter(entry.path, entry)\n\n if (entry.ignore) {\n // probably valid, just not something we care about\n this[EMIT]('ignoredEntry', entry)\n this[STATE] = entry.remain ? 'ignore' : 'header'\n entry.resume()\n } else {\n if (entry.remain) {\n this[STATE] = 'body'\n } else {\n this[STATE] = 'header'\n entry.end()\n }\n\n if (!this[READENTRY]) {\n this[QUEUE].push(entry)\n this[NEXTENTRY]()\n } else {\n this[QUEUE].push(entry)\n }\n }\n }\n }\n }\n }\n }\n\n [CLOSESTREAM]() {\n queueMicrotask(() => this.emit('close'))\n }\n\n [PROCESSENTRY](entry?: ReadEntry | [string | symbol, any, any]) {\n let go = true\n\n if (!entry) {\n this[READENTRY] = undefined\n go = false\n } else if (Array.isArray(entry)) {\n const [ev, ...args]: [string | symbol, any, any] = entry\n this.emit(ev, ...args)\n } else {\n this[READENTRY] = entry\n this.emit('entry', entry)\n if (!entry.emittedEnd) {\n entry.on('end', () => this[NEXTENTRY]())\n go = false\n }\n }\n\n return go\n }\n\n [NEXTENTRY]() {\n do {} while (this[PROCESSENTRY](this[QUEUE].shift()))\n\n if (!this[QUEUE].length) {\n // At this point, there's nothing in the queue, but we may have an\n // entry which is being consumed (readEntry).\n // If we don't, then we definitely can handle more data.\n // If we do, and either it's flowing, or it has never had any data\n // written to it, then it needs more.\n // The only other possibility is that it has returned false from a\n // write() call, so we wait for the next drain to continue.\n const re = this[READENTRY]\n const drainNow = !re || re.flowing || re.size === re.remain\n if (drainNow) {\n if (!this[WRITING]) {\n this.emit('drain')\n }\n } else {\n re.once('drain', () => this.emit('drain'))\n }\n }\n }\n\n [CONSUMEBODY](chunk: Buffer, position: number) {\n // write up to but no more than writeEntry.blockRemain\n const entry = this[WRITEENTRY]\n /* c8 ignore start */\n if (!entry) {\n throw new Error('attempt to consume body without entry??')\n }\n const br = entry.blockRemain ?? 0\n /* c8 ignore stop */\n const c =\n br >= chunk.length && position === 0 ?\n chunk\n : chunk.subarray(position, position + br)\n\n entry.write(c)\n\n if (!entry.blockRemain) {\n this[STATE] = 'header'\n this[WRITEENTRY] = undefined\n entry.end()\n }\n\n return c.length\n }\n\n [CONSUMEMETA](chunk: Buffer, position: number) {\n const entry = this[WRITEENTRY]\n const ret = this[CONSUMEBODY](chunk, position)\n\n // if we finished, then the entry is reset\n if (!this[WRITEENTRY] && entry) {\n this[EMITMETA](entry)\n }\n\n return ret\n }\n\n [EMIT](ev: string | symbol, data?: any, extra?: any) {\n if (!this[QUEUE].length && !this[READENTRY]) {\n this.emit(ev, data, extra)\n } else {\n this[QUEUE].push([ev, data, extra])\n }\n }\n\n [EMITMETA](entry: ReadEntry) {\n this[EMIT]('meta', this[META])\n switch (entry.type) {\n case 'ExtendedHeader':\n case 'OldExtendedHeader':\n this[EX] = Pax.parse(this[META], this[EX], false)\n break\n\n case 'GlobalExtendedHeader':\n this[GEX] = Pax.parse(this[META], this[GEX], true)\n break\n\n case 'NextFileHasLongPath':\n case 'OldGnuLongPath': {\n const ex = this[EX] ?? Object.create(null)\n this[EX] = ex\n ex.path = this[META].replace(/\\0.*/, '')\n break\n }\n\n case 'NextFileHasLongLinkpath': {\n const ex = this[EX] || Object.create(null)\n this[EX] = ex\n ex.linkpath = this[META].replace(/\\0.*/, '')\n break\n }\n\n /* c8 ignore start */\n default:\n throw new Error('unknown meta: ' + entry.type)\n /* c8 ignore stop */\n }\n }\n\n abort(error: Error) {\n this[ABORTED] = true\n this.emit('abort', error)\n // always throws, even in non-strict mode\n this.warn('TAR_ABORT', error, { recoverable: false })\n }\n\n write(\n buffer: Uint8Array | string,\n cb?: (err?: Error | null) => void,\n ): boolean\n write(\n str: string,\n encoding?: BufferEncoding,\n cb?: (err?: Error | null) => void,\n ): boolean\n write(\n chunk: Buffer | string,\n encoding?: BufferEncoding | (() => any),\n cb?: () => any,\n ): boolean {\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(\n chunk,\n /* c8 ignore next */\n typeof encoding === 'string' ? encoding : 'utf8',\n )\n }\n if (this[ABORTED]) {\n /* c8 ignore next */\n cb?.()\n return false\n }\n\n // first write, might be gzipped, zstd, or brotli compressed\n const needSniff =\n this[UNZIP] === undefined ||\n (this.brotli === undefined && this[UNZIP] === false)\n if (needSniff && chunk) {\n if (this[BUFFER]) {\n chunk = Buffer.concat([this[BUFFER], chunk])\n this[BUFFER] = undefined\n }\n if (chunk.length < ZIP_HEADER_LEN) {\n this[BUFFER] = chunk\n /* c8 ignore next */\n cb?.()\n return true\n }\n\n // look for gzip header\n for (\n let i = 0;\n this[UNZIP] === undefined && i < gzipHeader.length;\n i++\n ) {\n if (chunk[i] !== gzipHeader[i]) {\n this[UNZIP] = false\n }\n }\n\n // look for zstd header if gzip header not found\n let isZstd = false\n if (this[UNZIP] === false && this.zstd !== false) {\n isZstd = true\n for (let i = 0; i < zstdHeader.length; i++) {\n if (chunk[i] !== zstdHeader[i]) {\n isZstd = false\n break\n }\n }\n }\n\n const maybeBrotli = this.brotli === undefined && !isZstd\n if (this[UNZIP] === false && maybeBrotli) {\n // read the first header to see if it's a valid tar file. If so,\n // we can safely assume that it's not actually brotli, despite the\n // .tbr or .tar.br file extension.\n // if we ended before getting a full chunk, yes, def brotli\n if (chunk.length < 512) {\n if (this[ENDED]) {\n this.brotli = true\n } else {\n this[BUFFER] = chunk\n /* c8 ignore next */\n cb?.()\n return true\n }\n } else {\n // if it's tar, it's pretty reliably not brotli, chances of\n // that happening are astronomical.\n try {\n new Header(chunk.subarray(0, 512))\n this.brotli = false\n } catch (_) {\n this.brotli = true\n }\n }\n }\n\n if (\n this[UNZIP] === undefined ||\n (this[UNZIP] === false && (this.brotli || isZstd))\n ) {\n const ended = this[ENDED]\n this[ENDED] = false\n this[UNZIP] =\n this[UNZIP] === undefined ? new Unzip({})\n : isZstd ? new ZstdDecompress({})\n : new BrotliDecompress({})\n this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk))\n this[UNZIP].on('error', er => this.abort(er as Error))\n this[UNZIP].on('end', () => {\n this[ENDED] = true\n this[CONSUMECHUNK]()\n })\n this[WRITING] = true\n const ret = !!this[UNZIP][ended ? 'end' : 'write'](chunk)\n this[WRITING] = false\n cb?.()\n return ret\n }\n }\n\n this[WRITING] = true\n if (this[UNZIP]) {\n this[UNZIP].write(chunk)\n } else {\n this[CONSUMECHUNK](chunk)\n }\n this[WRITING] = false\n\n // return false if there's a queue, or if the current entry isn't flowing\n const ret =\n this[QUEUE].length ? false\n : this[READENTRY] ? this[READENTRY].flowing\n : true\n\n // if we have no queue, then that means a clogged READENTRY\n if (!ret && !this[QUEUE].length) {\n this[READENTRY]?.once('drain', () => this.emit('drain'))\n }\n\n /* c8 ignore next */\n cb?.()\n return ret\n }\n\n [BUFFERCONCAT](c: Buffer) {\n if (c && !this[ABORTED]) {\n this[BUFFER] =\n this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c\n }\n }\n\n [MAYBEEND]() {\n if (\n this[ENDED] &&\n !this[EMITTEDEND] &&\n !this[ABORTED] &&\n !this[CONSUMING]\n ) {\n this[EMITTEDEND] = true\n const entry = this[WRITEENTRY]\n if (entry && entry.blockRemain) {\n // truncated, likely a damaged file\n const have = this[BUFFER] ? this[BUFFER].length : 0\n this.warn(\n 'TAR_BAD_ARCHIVE',\n `Truncated input (needed ${entry.blockRemain} more bytes, only ${have} available)`,\n { entry },\n )\n if (this[BUFFER]) {\n entry.write(this[BUFFER])\n }\n entry.end()\n }\n this[EMIT](DONE)\n }\n }\n\n [CONSUMECHUNK](chunk?: Buffer) {\n if (this[CONSUMING] && chunk) {\n this[BUFFERCONCAT](chunk)\n } else if (!chunk && !this[BUFFER]) {\n this[MAYBEEND]()\n } else if (chunk) {\n this[CONSUMING] = true\n if (this[BUFFER]) {\n this[BUFFERCONCAT](chunk)\n const c = this[BUFFER]\n this[BUFFER] = undefined\n this[CONSUMECHUNKSUB](c)\n } else {\n this[CONSUMECHUNKSUB](chunk)\n }\n\n while (\n this[BUFFER] &&\n (this[BUFFER] as Buffer)?.length >= 512 &&\n !this[ABORTED] &&\n !this[SAW_EOF]\n ) {\n const c = this[BUFFER]\n this[BUFFER] = undefined\n this[CONSUMECHUNKSUB](c)\n }\n this[CONSUMING] = false\n }\n\n if (!this[BUFFER] || this[ENDED]) {\n this[MAYBEEND]()\n }\n }\n\n [CONSUMECHUNKSUB](chunk: Buffer) {\n // we know that we are in CONSUMING mode, so anything written goes into\n // the buffer. Advance the position and put any remainder in the buffer.\n let position = 0\n const length = chunk.length\n while (\n position + 512 <= length &&\n !this[ABORTED] &&\n !this[SAW_EOF]\n ) {\n switch (this[STATE]) {\n case 'begin':\n case 'header':\n this[CONSUMEHEADER](chunk, position)\n position += 512\n break\n\n case 'ignore':\n case 'body':\n position += this[CONSUMEBODY](chunk, position)\n break\n\n case 'meta':\n position += this[CONSUMEMETA](chunk, position)\n break\n\n /* c8 ignore start */\n default:\n throw new Error('invalid state: ' + this[STATE])\n /* c8 ignore stop */\n }\n }\n\n if (position < length) {\n if (this[BUFFER]) {\n this[BUFFER] = Buffer.concat([\n chunk.subarray(position),\n this[BUFFER],\n ])\n } else {\n this[BUFFER] = chunk.subarray(position)\n }\n }\n }\n\n end(cb?: () => void): this\n end(data: string | Buffer, cb?: () => void): this\n end(str: string, encoding?: BufferEncoding, cb?: () => void): this\n end(\n chunk?: string | Buffer | (() => void),\n encoding?: BufferEncoding | (() => void),\n cb?: () => void,\n ) {\n if (typeof chunk === 'function') {\n cb = chunk\n encoding = undefined\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding)\n }\n if (cb) this.once('finish', cb)\n if (!this[ABORTED]) {\n if (this[UNZIP]) {\n /* c8 ignore start */\n if (chunk) this[UNZIP].write(chunk)\n /* c8 ignore stop */\n this[UNZIP].end()\n } else {\n this[ENDED] = true\n if (this.brotli === undefined || this.zstd === undefined)\n chunk = chunk || Buffer.alloc(0)\n if (chunk) this.write(chunk)\n this[MAYBEEND]()\n }\n }\n return this\n }\n}\n", "import assert from 'assert'\nimport { Buffer } from 'buffer'\nimport { Minipass } from 'minipass'\nimport * as realZlib from 'zlib'\nimport { constants } from './constants.js'\nexport { constants } from './constants.js'\n\nconst OriginalBufferConcat = Buffer.concat\nconst desc = Object.getOwnPropertyDescriptor(Buffer, 'concat')\nconst noop = (args: Buffer[]) => args as unknown as Buffer\nconst passthroughBufferConcat =\n desc?.writable === true || desc?.set !== undefined\n ? (makeNoOp: boolean) => {\n Buffer.concat = makeNoOp ? noop : OriginalBufferConcat\n }\n : (_: boolean) => {}\n\nconst _superWrite = Symbol('_superWrite')\n\nexport class ZlibError extends Error {\n code?: string\n errno?: number\n constructor(err: NodeJS.ErrnoException | Error, origin?: Function) {\n super('zlib: ' + err.message, { cause: err })\n this.code = (err as NodeJS.ErrnoException).code\n this.errno = (err as NodeJS.ErrnoException).errno\n /* c8 ignore next */\n if (!this.code) this.code = 'ZLIB_ERROR'\n\n this.message = 'zlib: ' + err.message\n Error.captureStackTrace(this, origin ?? this.constructor)\n }\n\n get name() {\n return 'ZlibError'\n }\n}\n\n// the Zlib class they all inherit from\n// This thing manages the queue of requests, and returns\n// true or false if there is anything in the queue when\n// you call the .write() method.\nconst _flushFlag = Symbol('flushFlag')\n\nexport type ChunkWithFlushFlag = Minipass.ContiguousData & {\n [_flushFlag]?: number\n}\n\nexport type ZlibBaseOptions = Minipass.Options & {\n flush?: number\n finishFlush?: number\n fullFlushFlag?: number\n}\n\nexport type ZlibHandle =\n | realZlib.Gzip\n | realZlib.Gunzip\n | realZlib.Deflate\n | realZlib.Inflate\n | realZlib.DeflateRaw\n | realZlib.InflateRaw\n | realZlib.BrotliCompress\n | realZlib.BrotliDecompress\n | realZlib.ZstdCompress\n | realZlib.ZstdDecompress\nexport type ZlibMode =\n | 'Gzip'\n | 'Gunzip'\n | 'Deflate'\n | 'Inflate'\n | 'DeflateRaw'\n | 'InflateRaw'\n | 'Unzip'\nexport type BrotliMode = 'BrotliCompress' | 'BrotliDecompress'\nexport type ZstdMode = 'ZstdCompress' | 'ZstdDecompress'\n\nabstract class ZlibBase extends Minipass {\n #sawError: boolean = false\n #ended: boolean = false\n #flushFlag: number\n #finishFlushFlag: number\n #fullFlushFlag: number\n #handle?: ZlibHandle\n #onError: (err: ZlibError) => any\n\n get sawError() {\n return this.#sawError\n }\n get handle() {\n return this.#handle\n }\n /* c8 ignore start */\n get flushFlag() {\n return this.#flushFlag\n }\n /* c8 ignore stop */\n\n constructor(opts: ZlibBaseOptions, mode: ZlibMode | BrotliMode | ZstdMode) {\n if (!opts || typeof opts !== 'object')\n throw new TypeError('invalid options for ZlibBase constructor')\n\n //@ts-ignore\n super(opts)\n\n /* c8 ignore start */\n this.#flushFlag = opts.flush ?? 0\n this.#finishFlushFlag = opts.finishFlush ?? 0\n this.#fullFlushFlag = opts.fullFlushFlag ?? 0\n /* c8 ignore stop */\n\n //@ts-ignore\n if (typeof realZlib[mode] !== 'function') {\n throw new TypeError('Compression method not supported: ' + mode)\n }\n\n // this will throw if any options are invalid for the class selected\n try {\n // @types/node doesn't know that it exports the classes, but they're there\n //@ts-ignore\n this.#handle = new realZlib[mode](opts)\n } catch (er) {\n // make sure that all errors get decorated properly\n throw new ZlibError(er as NodeJS.ErrnoException, this.constructor)\n }\n\n this.#onError = err => {\n // no sense raising multiple errors, since we abort on the first one.\n if (this.#sawError) return\n\n this.#sawError = true\n\n // there is no way to cleanly recover.\n // continuing only obscures problems.\n this.close()\n this.emit('error', err)\n }\n\n this.#handle?.on('error', er => this.#onError(new ZlibError(er)))\n this.once('end', () => this.close)\n }\n\n close() {\n if (this.#handle) {\n this.#handle.close()\n this.#handle = undefined\n this.emit('close')\n }\n }\n\n reset() {\n if (!this.#sawError) {\n assert(this.#handle, 'zlib binding closed')\n //@ts-ignore\n return this.#handle.reset?.()\n }\n }\n\n flush(flushFlag?: number) {\n if (this.ended) return\n\n if (typeof flushFlag !== 'number') flushFlag = this.#fullFlushFlag\n\n this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag }))\n }\n\n end(cb?: () => void): this\n end(chunk: ChunkWithFlushFlag, cb?: () => void): this\n end(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding,\n cb?: () => void,\n ): this\n end(\n chunk?: ChunkWithFlushFlag | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void,\n ) {\n /* c8 ignore start */\n if (typeof chunk === 'function') {\n cb = chunk\n encoding = undefined\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n /* c8 ignore stop */\n if (chunk) {\n if (encoding) this.write(chunk, encoding)\n else this.write(chunk)\n }\n this.flush(this.#finishFlushFlag)\n this.#ended = true\n return super.end(cb)\n }\n\n get ended() {\n return this.#ended\n }\n\n // overridden in the gzip classes to do portable writes\n [_superWrite](data: Buffer & { [_flushFlag]?: number }) {\n return super.write(data)\n }\n\n write(chunk: ChunkWithFlushFlag, cb?: () => void): boolean\n write(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding,\n cb?: () => void,\n ): boolean\n write(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void,\n ) {\n // process the chunk using the sync process\n // then super.write() all the outputted chunks\n if (typeof encoding === 'function')\n (cb = encoding), (encoding = 'utf8')\n\n if (typeof chunk === 'string')\n chunk = Buffer.from(chunk as string, encoding as BufferEncoding)\n\n if (this.#sawError) return\n assert(this.#handle, 'zlib binding closed')\n\n // _processChunk tries to .close() the native handle after it's done, so we\n // intercept that by temporarily making it a no-op.\n // diving into the node:zlib internals a bit here\n const nativeHandle = (this.#handle as unknown as { _handle: any })\n ._handle\n const originalNativeClose = nativeHandle.close\n nativeHandle.close = () => {}\n const originalClose = this.#handle.close\n this.#handle.close = () => {}\n // It also calls `Buffer.concat()` at the end, which may be convenient\n // for some, but which we are not interested in as it slows us down.\n passthroughBufferConcat(true)\n let result: undefined | Buffer | Buffer[] = undefined\n try {\n const flushFlag =\n typeof chunk[_flushFlag] === 'number'\n ? chunk[_flushFlag]\n : this.#flushFlag\n result = (\n this.#handle as unknown as {\n _processChunk: (chunk: Buffer, flushFlag: number) => Buffer[]\n }\n )._processChunk(chunk as Buffer, flushFlag)\n // if we don't throw, reset it back how it was\n passthroughBufferConcat(false)\n } catch (err) {\n // or if we do, put Buffer.concat() back before we emit error\n // Error events call into user code, which may call Buffer.concat()\n passthroughBufferConcat(false)\n this.#onError(new ZlibError(err as NodeJS.ErrnoException, this.write))\n } finally {\n if (this.#handle) {\n // Core zlib resets `_handle` to null after attempting to close the\n // native handle. Our no-op handler prevented actual closure, but we\n // need to restore the `._handle` property.\n ;(this.#handle as unknown as { _handle: any })._handle =\n nativeHandle\n nativeHandle.close = originalNativeClose\n this.#handle.close = originalClose\n // `_processChunk()` adds an 'error' listener. If we don't remove it\n // after each call, these handlers start piling up.\n this.#handle.removeAllListeners('error')\n // make sure OUR error listener is still attached tho\n }\n }\n\n if (this.#handle)\n this.#handle.on('error', er => this.#onError(new ZlibError(er, this.write)))\n\n let writeReturn\n if (result) {\n if (Array.isArray(result) && result.length > 0) {\n const r = result[0]\n // The first buffer is always `handle._outBuffer`, which would be\n // re-used for later invocations; so, we always have to copy that one.\n writeReturn = this[_superWrite](Buffer.from(r as Buffer))\n for (let i = 1; i < result.length; i++) {\n writeReturn = this[_superWrite](result[i] as Buffer)\n }\n } else {\n // either a single Buffer or an empty array\n writeReturn = this[_superWrite](Buffer.from(result as Buffer | []))\n }\n }\n\n if (cb) cb()\n return writeReturn\n }\n}\n\nexport type ZlibOptions = ZlibBaseOptions & {\n level?: number\n strategy?: number\n}\n\nexport class Zlib extends ZlibBase {\n #level?: number\n #strategy?: number\n\n constructor(opts: ZlibOptions, mode: ZlibMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.Z_NO_FLUSH\n opts.finishFlush = opts.finishFlush || constants.Z_FINISH\n opts.fullFlushFlag = constants.Z_FULL_FLUSH\n super(opts, mode)\n\n this.#level = opts.level\n this.#strategy = opts.strategy\n }\n\n params(level: number, strategy: number) {\n if (this.sawError) return\n\n if (!this.handle)\n throw new Error('cannot switch params when binding is closed')\n\n // no way to test this without also not supporting params at all\n /* c8 ignore start */\n if (!(this.handle as { params?: any }).params)\n throw new Error('not supported in this implementation')\n /* c8 ignore stop */\n\n if (this.#level !== level || this.#strategy !== strategy) {\n this.flush(constants.Z_SYNC_FLUSH)\n assert(this.handle, 'zlib binding closed')\n // .params() calls .flush(), but the latter is always async in the\n // core zlib. We override .flush() temporarily to intercept that and\n // flush synchronously.\n const origFlush = this.handle.flush\n this.handle.flush = (\n flushFlag?: (() => void) | number,\n cb?: () => void,\n ) => {\n /* c8 ignore start */\n if (typeof flushFlag === 'function') {\n cb = flushFlag\n flushFlag = this.flushFlag\n }\n /* c8 ignore stop */\n this.flush(flushFlag)\n cb?.()\n }\n try {\n ;(\n this.handle as unknown as {\n params: (level?: number, strategy?: number) => void\n }\n ).params(level, strategy)\n } finally {\n this.handle.flush = origFlush\n }\n /* c8 ignore start */\n if (this.handle) {\n this.#level = level\n this.#strategy = strategy\n }\n /* c8 ignore stop */\n }\n }\n}\n\n// minimal 2-byte header\nexport class Deflate extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Deflate')\n }\n}\n\nexport class Inflate extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Inflate')\n }\n}\n\n// gzip - bigger header, same deflate compression\nexport type GzipOptions = ZlibOptions & { portable?: boolean }\nexport class Gzip extends Zlib {\n #portable: boolean\n constructor(opts: GzipOptions) {\n super(opts, 'Gzip')\n this.#portable = opts && !!opts.portable\n }\n\n [_superWrite](data: Buffer & { [_flushFlag]?: number }) {\n if (!this.#portable) return super[_superWrite](data)\n\n // we'll always get the header emitted in one first chunk\n // overwrite the OS indicator byte with 0xFF\n this.#portable = false\n data[9] = 255\n return super[_superWrite](data)\n }\n}\n\nexport class Gunzip extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Gunzip')\n }\n}\n\n// raw - no header\nexport class DeflateRaw extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'DeflateRaw')\n }\n}\n\nexport class InflateRaw extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'InflateRaw')\n }\n}\n\n// auto-detect header.\nexport class Unzip extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Unzip')\n }\n}\n\nclass Brotli extends ZlibBase {\n constructor(opts: ZlibOptions, mode: BrotliMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS\n opts.finishFlush =\n opts.finishFlush || constants.BROTLI_OPERATION_FINISH\n opts.fullFlushFlag = constants.BROTLI_OPERATION_FLUSH\n super(opts, mode)\n }\n}\n\nexport class BrotliCompress extends Brotli {\n constructor(opts: ZlibOptions) {\n super(opts, 'BrotliCompress')\n }\n}\n\nexport class BrotliDecompress extends Brotli {\n constructor(opts: ZlibOptions) {\n super(opts, 'BrotliDecompress')\n }\n}\n\nclass Zstd extends ZlibBase {\n constructor(opts: ZlibOptions, mode: ZstdMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.ZSTD_e_continue\n opts.finishFlush = opts.finishFlush || constants.ZSTD_e_end\n opts.fullFlushFlag = constants.ZSTD_e_flush\n super(opts, mode)\n }\n}\n\nexport class ZstdCompress extends Zstd {\n constructor(opts: ZlibOptions) {\n super(opts, 'ZstdCompress')\n }\n}\n\nexport class ZstdDecompress extends Zstd {\n constructor(opts: ZlibOptions) {\n super(opts, 'ZstdDecompress')\n }\n}\n", "// Update with any zlib constants that are added or changed in the future.\n// Node v6 didn't export this, so we just hard code the version and rely\n// on all the other hard-coded values from zlib v4736. When node v6\n// support drops, we can just export the realZlibConstants object.\nimport realZlib from 'zlib'\n/* c8 ignore start */\nconst realZlibConstants = realZlib.constants || { ZLIB_VERNUM: 4736 }\n/* c8 ignore stop */\n\nexport const constants = Object.freeze(\n Object.assign(\n Object.create(null),\n {\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n Z_VERSION_ERROR: -6,\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n DEFLATE: 1,\n INFLATE: 2,\n GZIP: 3,\n GUNZIP: 4,\n DEFLATERAW: 5,\n INFLATERAW: 6,\n UNZIP: 7,\n BROTLI_DECODE: 8,\n BROTLI_ENCODE: 9,\n Z_MIN_WINDOWBITS: 8,\n Z_MAX_WINDOWBITS: 15,\n Z_DEFAULT_WINDOWBITS: 15,\n Z_MIN_CHUNK: 64,\n Z_MAX_CHUNK: Infinity,\n Z_DEFAULT_CHUNK: 16384,\n Z_MIN_MEMLEVEL: 1,\n Z_MAX_MEMLEVEL: 9,\n Z_DEFAULT_MEMLEVEL: 8,\n Z_MIN_LEVEL: -1,\n Z_MAX_LEVEL: 9,\n Z_DEFAULT_LEVEL: -1,\n BROTLI_OPERATION_PROCESS: 0,\n BROTLI_OPERATION_FLUSH: 1,\n BROTLI_OPERATION_FINISH: 2,\n BROTLI_OPERATION_EMIT_METADATA: 3,\n BROTLI_MODE_GENERIC: 0,\n BROTLI_MODE_TEXT: 1,\n BROTLI_MODE_FONT: 2,\n BROTLI_DEFAULT_MODE: 0,\n BROTLI_MIN_QUALITY: 0,\n BROTLI_MAX_QUALITY: 11,\n BROTLI_DEFAULT_QUALITY: 11,\n BROTLI_MIN_WINDOW_BITS: 10,\n BROTLI_MAX_WINDOW_BITS: 24,\n BROTLI_LARGE_MAX_WINDOW_BITS: 30,\n BROTLI_DEFAULT_WINDOW: 22,\n BROTLI_MIN_INPUT_BLOCK_BITS: 16,\n BROTLI_MAX_INPUT_BLOCK_BITS: 24,\n BROTLI_PARAM_MODE: 0,\n BROTLI_PARAM_QUALITY: 1,\n BROTLI_PARAM_LGWIN: 2,\n BROTLI_PARAM_LGBLOCK: 3,\n BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,\n BROTLI_PARAM_SIZE_HINT: 5,\n BROTLI_PARAM_LARGE_WINDOW: 6,\n BROTLI_PARAM_NPOSTFIX: 7,\n BROTLI_PARAM_NDIRECT: 8,\n BROTLI_DECODER_RESULT_ERROR: 0,\n BROTLI_DECODER_RESULT_SUCCESS: 1,\n BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,\n BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,\n BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,\n BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,\n BROTLI_DECODER_NO_ERROR: 0,\n BROTLI_DECODER_SUCCESS: 1,\n BROTLI_DECODER_NEEDS_MORE_INPUT: 2,\n BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,\n BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,\n BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,\n BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,\n BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,\n BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,\n BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,\n BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,\n BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,\n BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,\n BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,\n BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,\n BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,\n BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,\n BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,\n BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,\n BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,\n BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,\n BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,\n BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,\n BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,\n BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,\n BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,\n BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,\n BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,\n BROTLI_DECODER_ERROR_UNREACHABLE: -31,\n },\n realZlibConstants,\n ),\n)\n", "// parse a 512-byte header block to a data object, or vice-versa\n// encode returns `true` if a pax extended header is needed, because\n// the data could not be faithfully encoded in a simple header.\n// (Also, check header.needPax to see if it needs a pax header.)\n\nimport { posix as pathModule } from 'node:path'\nimport * as large from './large-numbers.js'\nimport type { EntryTypeCode, EntryTypeName } from './types.js'\nimport * as types from './types.js'\n\nexport type HeaderData = {\n path?: string\n mode?: number\n uid?: number\n gid?: number\n size?: number\n cksum?: number\n type?: EntryTypeName | 'Unsupported'\n linkpath?: string\n uname?: string\n gname?: string\n devmaj?: number\n devmin?: number\n atime?: Date\n ctime?: Date\n mtime?: Date\n\n // fields that are common in extended PAX headers, but not in the\n // \"standard\" tar header block\n charset?: string\n comment?: string\n dev?: number\n ino?: number\n nlink?: number\n}\n\nexport class Header implements HeaderData {\n cksumValid: boolean = false\n needPax: boolean = false\n nullBlock: boolean = false\n\n block?: Buffer\n path?: string\n mode?: number\n uid?: number\n gid?: number\n size?: number\n cksum?: number\n #type: EntryTypeCode | 'Unsupported' = 'Unsupported'\n linkpath?: string\n uname?: string\n gname?: string\n devmaj: number = 0\n devmin: number = 0\n atime?: Date\n ctime?: Date\n mtime?: Date\n\n charset?: string\n comment?: string\n\n constructor(\n data?: Buffer | HeaderData,\n off: number = 0,\n ex?: HeaderData,\n gex?: HeaderData,\n ) {\n if (Buffer.isBuffer(data)) {\n this.decode(data, off || 0, ex, gex)\n } else if (data) {\n this.#slurp(data)\n }\n }\n\n decode(\n buf: Buffer,\n off: number,\n ex?: HeaderData,\n gex?: HeaderData,\n ) {\n if (!off) {\n off = 0\n }\n\n if (!buf || !(buf.length >= off + 512)) {\n throw new Error('need 512 bytes for header')\n }\n\n this.path = ex?.path ?? decString(buf, off, 100)\n this.mode = ex?.mode ?? gex?.mode ?? decNumber(buf, off + 100, 8)\n this.uid = ex?.uid ?? gex?.uid ?? decNumber(buf, off + 108, 8)\n this.gid = ex?.gid ?? gex?.gid ?? decNumber(buf, off + 116, 8)\n this.size = ex?.size ?? gex?.size ?? decNumber(buf, off + 124, 12)\n this.mtime =\n ex?.mtime ?? gex?.mtime ?? decDate(buf, off + 136, 12)\n this.cksum = decNumber(buf, off + 148, 12)\n\n // if we have extended or global extended headers, apply them now\n // See https://github.com/npm/node-tar/pull/187\n // Apply global before local, so it overrides\n if (gex) this.#slurp(gex, true)\n if (ex) this.#slurp(ex)\n\n // old tar versions marked dirs as a file with a trailing /\n const t = decString(buf, off + 156, 1)\n if (types.isCode(t)) {\n this.#type = t || '0'\n }\n if (this.#type === '0' && this.path.slice(-1) === '/') {\n this.#type = '5'\n }\n\n // tar implementations sometimes incorrectly put the stat(dir).size\n // as the size in the tarball, even though Directory entries are\n // not able to have any body at all. In the very rare chance that\n // it actually DOES have a body, we weren't going to do anything with\n // it anyway, and it'll just be a warning about an invalid header.\n if (this.#type === '5') {\n this.size = 0\n }\n\n this.linkpath = decString(buf, off + 157, 100)\n if (\n buf.subarray(off + 257, off + 265).toString() ===\n 'ustar\\u000000'\n ) {\n /* c8 ignore start */\n this.uname =\n ex?.uname ?? gex?.uname ?? decString(buf, off + 265, 32)\n this.gname =\n ex?.gname ?? gex?.gname ?? decString(buf, off + 297, 32)\n this.devmaj =\n ex?.devmaj ?? gex?.devmaj ?? decNumber(buf, off + 329, 8) ?? 0\n this.devmin =\n ex?.devmin ?? gex?.devmin ?? decNumber(buf, off + 337, 8) ?? 0\n /* c8 ignore stop */\n if (buf[off + 475] !== 0) {\n // definitely a prefix, definitely >130 chars.\n const prefix = decString(buf, off + 345, 155)\n this.path = prefix + '/' + this.path\n } else {\n const prefix = decString(buf, off + 345, 130)\n if (prefix) {\n this.path = prefix + '/' + this.path\n }\n /* c8 ignore start */\n this.atime =\n ex?.atime ?? gex?.atime ?? decDate(buf, off + 476, 12)\n this.ctime =\n ex?.ctime ?? gex?.ctime ?? decDate(buf, off + 488, 12)\n /* c8 ignore stop */\n }\n }\n\n let sum = 8 * 0x20\n for (let i = off; i < off + 148; i++) {\n sum += buf[i] as number\n }\n\n for (let i = off + 156; i < off + 512; i++) {\n sum += buf[i] as number\n }\n\n this.cksumValid = sum === this.cksum\n if (this.cksum === undefined && sum === 8 * 0x20) {\n this.nullBlock = true\n }\n }\n\n #slurp(ex: HeaderData, gex: boolean = false) {\n Object.assign(\n this,\n Object.fromEntries(\n Object.entries(ex).filter(([k, v]) => {\n // we slurp in everything except for the path attribute in\n // a global extended header, because that's weird. Also, any\n // null/undefined values are ignored.\n return !(\n v === null ||\n v === undefined ||\n (k === 'path' && gex) ||\n (k === 'linkpath' && gex) ||\n k === 'global'\n )\n }),\n ),\n )\n }\n\n encode(buf?: Buffer, off: number = 0) {\n if (!buf) {\n buf = this.block = Buffer.alloc(512)\n }\n\n if (this.#type === 'Unsupported') {\n this.#type = '0'\n }\n\n if (!(buf.length >= off + 512)) {\n throw new Error('need 512 bytes for header')\n }\n\n const prefixSize = this.ctime || this.atime ? 130 : 155\n const split = splitPrefix(this.path || '', prefixSize)\n const path = split[0]\n const prefix = split[1]\n this.needPax = !!split[2]\n\n this.needPax = encString(buf, off, 100, path) || this.needPax\n this.needPax =\n encNumber(buf, off + 100, 8, this.mode) || this.needPax\n this.needPax =\n encNumber(buf, off + 108, 8, this.uid) || this.needPax\n this.needPax =\n encNumber(buf, off + 116, 8, this.gid) || this.needPax\n this.needPax =\n encNumber(buf, off + 124, 12, this.size) || this.needPax\n this.needPax =\n encDate(buf, off + 136, 12, this.mtime) || this.needPax\n buf[off + 156] = this.#type.charCodeAt(0)\n this.needPax =\n encString(buf, off + 157, 100, this.linkpath) || this.needPax\n buf.write('ustar\\u000000', off + 257, 8)\n this.needPax =\n encString(buf, off + 265, 32, this.uname) || this.needPax\n this.needPax =\n encString(buf, off + 297, 32, this.gname) || this.needPax\n this.needPax =\n encNumber(buf, off + 329, 8, this.devmaj) || this.needPax\n this.needPax =\n encNumber(buf, off + 337, 8, this.devmin) || this.needPax\n this.needPax =\n encString(buf, off + 345, prefixSize, prefix) || this.needPax\n if (buf[off + 475] !== 0) {\n this.needPax =\n encString(buf, off + 345, 155, prefix) || this.needPax\n } else {\n this.needPax =\n encString(buf, off + 345, 130, prefix) || this.needPax\n this.needPax =\n encDate(buf, off + 476, 12, this.atime) || this.needPax\n this.needPax =\n encDate(buf, off + 488, 12, this.ctime) || this.needPax\n }\n\n let sum = 8 * 0x20\n for (let i = off; i < off + 148; i++) {\n sum += buf[i] as number\n }\n\n for (let i = off + 156; i < off + 512; i++) {\n sum += buf[i] as number\n }\n\n this.cksum = sum\n encNumber(buf, off + 148, 8, this.cksum)\n this.cksumValid = true\n\n return this.needPax\n }\n\n get type(): EntryTypeName {\n return (\n this.#type === 'Unsupported' ?\n this.#type\n : types.name.get(this.#type)) as EntryTypeName\n }\n\n get typeKey(): EntryTypeCode | 'Unsupported' {\n return this.#type\n }\n\n set type(type: EntryTypeCode | EntryTypeName | 'Unsupported') {\n const c = String(types.code.get(type as EntryTypeName))\n if (types.isCode(c) || c === 'Unsupported') {\n this.#type = c\n } else if (types.isCode(type)) {\n this.#type = type\n } else {\n throw new TypeError('invalid entry type: ' + type)\n }\n }\n}\n\nconst splitPrefix = (\n p: string,\n prefixSize: number,\n): [string, string, boolean] => {\n const pathSize = 100\n let pp = p\n let prefix = ''\n let ret: undefined | [string, string, boolean] = undefined\n const root = pathModule.parse(p).root || '.'\n\n if (Buffer.byteLength(pp) < pathSize) {\n ret = [pp, prefix, false]\n } else {\n // first set prefix to the dir, and path to the base\n prefix = pathModule.dirname(pp)\n pp = pathModule.basename(pp)\n\n do {\n if (\n Buffer.byteLength(pp) <= pathSize &&\n Buffer.byteLength(prefix) <= prefixSize\n ) {\n // both fit!\n ret = [pp, prefix, false]\n } else if (\n Buffer.byteLength(pp) > pathSize &&\n Buffer.byteLength(prefix) <= prefixSize\n ) {\n // prefix fits in prefix, but path doesn't fit in path\n ret = [pp.slice(0, pathSize - 1), prefix, true]\n } else {\n // make path take a bit from prefix\n pp = pathModule.join(pathModule.basename(prefix), pp)\n prefix = pathModule.dirname(prefix)\n }\n } while (prefix !== root && ret === undefined)\n\n // at this point, found no resolution, just truncate\n if (!ret) {\n ret = [p.slice(0, pathSize - 1), '', true]\n }\n }\n return ret\n}\n\nconst decString = (buf: Buffer, off: number, size: number) =>\n buf\n .subarray(off, off + size)\n .toString('utf8')\n .replace(/\\0.*/, '')\n\nconst decDate = (buf: Buffer, off: number, size: number) =>\n numToDate(decNumber(buf, off, size))\n\nconst numToDate = (num?: number) =>\n num === undefined ? undefined : new Date(num * 1000)\n\nconst decNumber = (buf: Buffer, off: number, size: number) =>\n Number(buf[off]) & 0x80 ?\n large.parse(buf.subarray(off, off + size))\n : decSmallNumber(buf, off, size)\n\nconst nanUndef = (value: number) => (isNaN(value) ? undefined : value)\n\nconst decSmallNumber = (buf: Buffer, off: number, size: number) =>\n nanUndef(\n parseInt(\n buf\n .subarray(off, off + size)\n .toString('utf8')\n .replace(/\\0.*$/, '')\n .trim(),\n 8,\n ),\n )\n\n// the maximum encodable as a null-terminated octal, by field size\nconst MAXNUM = {\n 12: 0o77777777777,\n 8: 0o7777777,\n}\n\nconst encNumber = (\n buf: Buffer,\n off: number,\n size: 12 | 8,\n num?: number,\n) =>\n num === undefined ? false\n : num > MAXNUM[size] || num < 0 ?\n (large.encode(num, buf.subarray(off, off + size)), true)\n : (encSmallNumber(buf, off, size, num), false)\n\nconst encSmallNumber = (\n buf: Buffer,\n off: number,\n size: number,\n num: number,\n) => buf.write(octalString(num, size), off, size, 'ascii')\n\nconst octalString = (num: number, size: number) =>\n padOctal(Math.floor(num).toString(8), size)\n\nconst padOctal = (str: string, size: number) =>\n (str.length === size - 1 ?\n str\n : new Array(size - str.length - 1).join('0') + str + ' ') + '\\0'\n\nconst encDate = (\n buf: Buffer,\n off: number,\n size: 8 | 12,\n date?: Date,\n) =>\n date === undefined ? false : (\n encNumber(buf, off, size, date.getTime() / 1000)\n )\n\n// enough to fill the longest string we've got\nconst NULLS = new Array(156).join('\\0')\n// pad with nulls, return true if it's longer or non-ascii\nconst encString = (\n buf: Buffer,\n off: number,\n size: number,\n str?: string,\n) =>\n str === undefined ? false : (\n (buf.write(str + NULLS, off, size, 'utf8'),\n str.length !== Buffer.byteLength(str) || str.length > size)\n )\n", "// Tar can encode large and negative numbers using a leading byte of\n// 0xff for negative, and 0x80 for positive.\n\nexport const encode = (num: number, buf: Buffer) => {\n if (!Number.isSafeInteger(num)) {\n // The number is so large that javascript cannot represent it with integer\n // precision.\n throw Error(\n 'cannot encode number outside of javascript safe integer range',\n )\n } else if (num < 0) {\n encodeNegative(num, buf)\n } else {\n encodePositive(num, buf)\n }\n return buf\n}\n\nconst encodePositive = (num: number, buf: Buffer) => {\n buf[0] = 0x80\n\n for (var i = buf.length; i > 1; i--) {\n buf[i - 1] = num & 0xff\n num = Math.floor(num / 0x100)\n }\n}\n\nconst encodeNegative = (num: number, buf: Buffer) => {\n buf[0] = 0xff\n var flipped = false\n num = num * -1\n for (var i = buf.length; i > 1; i--) {\n var byte = num & 0xff\n num = Math.floor(num / 0x100)\n if (flipped) {\n buf[i - 1] = onesComp(byte)\n } else if (byte === 0) {\n buf[i - 1] = 0\n } else {\n flipped = true\n buf[i - 1] = twosComp(byte)\n }\n }\n}\n\nexport const parse = (buf: Buffer) => {\n const pre = buf[0]\n const value =\n pre === 0x80 ? pos(buf.subarray(1, buf.length))\n : pre === 0xff ? twos(buf)\n : null\n if (value === null) {\n throw Error('invalid base256 encoding')\n }\n\n if (!Number.isSafeInteger(value)) {\n // The number is so large that javascript cannot represent it with integer\n // precision.\n throw Error(\n 'parsed number outside of javascript safe integer range',\n )\n }\n\n return value\n}\n\nconst twos = (buf: Buffer) => {\n var len = buf.length\n var sum = 0\n var flipped = false\n for (var i = len - 1; i > -1; i--) {\n var byte = Number(buf[i])\n var f\n if (flipped) {\n f = onesComp(byte)\n } else if (byte === 0) {\n f = byte\n } else {\n flipped = true\n f = twosComp(byte)\n }\n if (f !== 0) {\n sum -= f * Math.pow(256, len - i - 1)\n }\n }\n return sum\n}\n\nconst pos = (buf: Buffer) => {\n var len = buf.length\n var sum = 0\n for (var i = len - 1; i > -1; i--) {\n var byte = Number(buf[i])\n if (byte !== 0) {\n sum += byte * Math.pow(256, len - i - 1)\n }\n }\n return sum\n}\n\nconst onesComp = (byte: number) => (0xff ^ byte) & 0xff\n\nconst twosComp = (byte: number) => ((0xff ^ byte) + 1) & 0xff\n", "export const isCode = (c: string): c is EntryTypeCode =>\n name.has(c as EntryTypeCode)\n\nexport const isName = (c: string): c is EntryTypeName =>\n code.has(c as EntryTypeName)\n\nexport type EntryTypeCode =\n | '0'\n | ''\n | '1'\n | '2'\n | '3'\n | '4'\n | '5'\n | '6'\n | '7'\n | 'g'\n | 'x'\n | 'A'\n | 'D'\n | 'I'\n | 'K'\n | 'L'\n | 'M'\n | 'N'\n | 'S'\n | 'V'\n | 'X'\n\nexport type EntryTypeName =\n | 'File'\n | 'OldFile'\n | 'Link'\n | 'SymbolicLink'\n | 'CharacterDevice'\n | 'BlockDevice'\n | 'Directory'\n | 'FIFO'\n | 'ContiguousFile'\n | 'GlobalExtendedHeader'\n | 'ExtendedHeader'\n | 'SolarisACL'\n | 'GNUDumpDir'\n | 'Inode'\n | 'NextFileHasLongLinkpath'\n | 'NextFileHasLongPath'\n | 'ContinuationFile'\n | 'OldGnuLongPath'\n | 'SparseFile'\n | 'TapeVolumeHeader'\n | 'OldExtendedHeader'\n | 'Unsupported'\n\n// map types from key to human-friendly name\nexport const name = new Map([\n ['0', 'File'],\n // same as File\n ['', 'OldFile'],\n ['1', 'Link'],\n ['2', 'SymbolicLink'],\n // Devices and FIFOs aren't fully supported\n // they are parsed, but skipped when unpacking\n ['3', 'CharacterDevice'],\n ['4', 'BlockDevice'],\n ['5', 'Directory'],\n ['6', 'FIFO'],\n // same as File\n ['7', 'ContiguousFile'],\n // pax headers\n ['g', 'GlobalExtendedHeader'],\n ['x', 'ExtendedHeader'],\n // vendor-specific stuff\n // skip\n ['A', 'SolarisACL'],\n // like 5, but with data, which should be skipped\n ['D', 'GNUDumpDir'],\n // metadata only, skip\n ['I', 'Inode'],\n // data = link path of next file\n ['K', 'NextFileHasLongLinkpath'],\n // data = path of next file\n ['L', 'NextFileHasLongPath'],\n // skip\n ['M', 'ContinuationFile'],\n // like L\n ['N', 'OldGnuLongPath'],\n // skip\n ['S', 'SparseFile'],\n // skip\n ['V', 'TapeVolumeHeader'],\n // like x\n ['X', 'OldExtendedHeader'],\n])\n\n// map the other direction\nexport const code = new Map(\n Array.from(name).map(kv => [kv[1], kv[0]]),\n)\n", "import { basename } from 'node:path'\nimport { Header, HeaderData } from './header.js'\n\nexport class Pax implements HeaderData {\n atime?: Date\n mtime?: Date\n ctime?: Date\n\n charset?: string\n comment?: string\n\n gid?: number\n uid?: number\n\n gname?: string\n uname?: string\n linkpath?: string\n dev?: number\n ino?: number\n nlink?: number\n path?: string\n size?: number\n mode?: number\n\n global: boolean\n\n constructor(obj: HeaderData, global: boolean = false) {\n this.atime = obj.atime\n this.charset = obj.charset\n this.comment = obj.comment\n this.ctime = obj.ctime\n this.dev = obj.dev\n this.gid = obj.gid\n this.global = global\n this.gname = obj.gname\n this.ino = obj.ino\n this.linkpath = obj.linkpath\n this.mtime = obj.mtime\n this.nlink = obj.nlink\n this.path = obj.path\n this.size = obj.size\n this.uid = obj.uid\n this.uname = obj.uname\n }\n\n encode() {\n const body = this.encodeBody()\n if (body === '') {\n return Buffer.allocUnsafe(0)\n }\n\n const bodyLen = Buffer.byteLength(body)\n // round up to 512 bytes\n // add 512 for header\n const bufLen = 512 * Math.ceil(1 + bodyLen / 512)\n const buf = Buffer.allocUnsafe(bufLen)\n\n // 0-fill the header section, it might not hit every field\n for (let i = 0; i < 512; i++) {\n buf[i] = 0\n }\n\n new Header({\n // XXX split the path\n // then the path should be PaxHeader + basename, but less than 99,\n // prepend with the dirname\n /* c8 ignore start */\n path: ('PaxHeader/' + basename(this.path ?? '')).slice(0, 99),\n /* c8 ignore stop */\n mode: this.mode || 0o644,\n uid: this.uid,\n gid: this.gid,\n size: bodyLen,\n mtime: this.mtime,\n type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader',\n linkpath: '',\n uname: this.uname || '',\n gname: this.gname || '',\n devmaj: 0,\n devmin: 0,\n atime: this.atime,\n ctime: this.ctime,\n }).encode(buf)\n\n buf.write(body, 512, bodyLen, 'utf8')\n\n // null pad after the body\n for (let i = bodyLen + 512; i < buf.length; i++) {\n buf[i] = 0\n }\n\n return buf\n }\n\n encodeBody() {\n return (\n this.encodeField('path') +\n this.encodeField('ctime') +\n this.encodeField('atime') +\n this.encodeField('dev') +\n this.encodeField('ino') +\n this.encodeField('nlink') +\n this.encodeField('charset') +\n this.encodeField('comment') +\n this.encodeField('gid') +\n this.encodeField('gname') +\n this.encodeField('linkpath') +\n this.encodeField('mtime') +\n this.encodeField('size') +\n this.encodeField('uid') +\n this.encodeField('uname')\n )\n }\n\n encodeField(field: keyof Pax): string {\n if (this[field] === undefined) {\n return ''\n }\n const r = this[field]\n const v = r instanceof Date ? r.getTime() / 1000 : r\n const s =\n ' ' +\n (field === 'dev' || field === 'ino' || field === 'nlink' ?\n 'SCHILY.'\n : '') +\n field +\n '=' +\n v +\n '\\n'\n const byteLen = Buffer.byteLength(s)\n // the digits includes the length of the digits in ascii base-10\n // so if it's 9 characters, then adding 1 for the 9 makes it 10\n // which makes it 11 chars.\n let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1\n if (byteLen + digits >= Math.pow(10, digits)) {\n digits += 1\n }\n const len = digits + byteLen\n return len + s\n }\n\n static parse(str: string, ex?: HeaderData, g: boolean = false) {\n return new Pax(merge(parseKV(str), ex), g)\n }\n}\n\nconst merge = (a: HeaderData, b?: HeaderData) =>\n b ? Object.assign({}, b, a) : a\n\nconst parseKV = (str: string) =>\n str\n .replace(/\\n$/, '')\n .split('\\n')\n .reduce(parseKVLine, Object.create(null))\n\nconst parseKVLine = (set: Record, line: string) => {\n const n = parseInt(line, 10)\n\n // XXX Values with \\n in them will fail this.\n // Refactor to not be a naive line-by-line parse.\n if (n !== Buffer.byteLength(line) + 1) {\n return set\n }\n\n line = line.slice((n + ' ').length)\n const kv = line.split('=')\n const r = kv.shift()\n\n if (!r) {\n return set\n }\n\n const k = r.replace(/^SCHILY\\.(dev|ino|nlink)/, '$1')\n\n const v = kv.join('=')\n set[k] =\n /^([A-Z]+\\.)?([mac]|birth|creation)time$/.test(k) ?\n new Date(Number(v) * 1000)\n : /^[0-9]+$/.test(v) ? +v\n : v\n return set\n}\n", "// on windows, either \\ or / are valid directory separators.\n// on unix, \\ is a valid character in filenames.\n// so, on windows, and only on windows, we replace all \\ chars with /,\n// so that we can use / as our one and only directory separator char.\n\nconst platform =\n process.env.TESTING_TAR_FAKE_PLATFORM || process.platform\n\nexport const normalizeWindowsPath =\n platform !== 'win32' ?\n (p: string) => p\n : (p: string) => p && p.replace(/\\\\/g, '/')\n", "import { Minipass } from 'minipass'\nimport { Header } from './header.js'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport { Pax } from './pax.js'\nimport { EntryTypeName } from './types.js'\n\nexport class ReadEntry extends Minipass {\n extended?: Pax\n globalExtended?: Pax\n header: Header\n startBlockSize: number\n blockRemain: number\n remain: number\n type: EntryTypeName\n meta: boolean = false\n ignore: boolean = false\n path: string\n mode?: number\n uid?: number\n gid?: number\n uname?: string\n gname?: string\n size: number = 0\n mtime?: Date\n atime?: Date\n ctime?: Date\n linkpath?: string\n\n dev?: number\n ino?: number\n nlink?: number\n invalid: boolean = false\n absolute?: string\n unsupported: boolean = false\n\n constructor(header: Header, ex?: Pax, gex?: Pax) {\n super({})\n // read entries always start life paused. this is to avoid the\n // situation where Minipass's auto-ending empty streams results\n // in an entry ending before we're ready for it.\n this.pause()\n this.extended = ex\n this.globalExtended = gex\n this.header = header\n /* c8 ignore start */\n this.remain = header.size ?? 0\n /* c8 ignore stop */\n this.startBlockSize = 512 * Math.ceil(this.remain / 512)\n this.blockRemain = this.startBlockSize\n this.type = header.type\n switch (this.type) {\n case 'File':\n case 'OldFile':\n case 'Link':\n case 'SymbolicLink':\n case 'CharacterDevice':\n case 'BlockDevice':\n case 'Directory':\n case 'FIFO':\n case 'ContiguousFile':\n case 'GNUDumpDir':\n break\n\n case 'NextFileHasLongLinkpath':\n case 'NextFileHasLongPath':\n case 'OldGnuLongPath':\n case 'GlobalExtendedHeader':\n case 'ExtendedHeader':\n case 'OldExtendedHeader':\n this.meta = true\n break\n\n // NOTE: gnutar and bsdtar treat unrecognized types as 'File'\n // it may be worth doing the same, but with a warning.\n default:\n this.ignore = true\n }\n\n /* c8 ignore start */\n if (!header.path) {\n throw new Error('no path provided for tar.ReadEntry')\n }\n /* c8 ignore stop */\n\n this.path = normalizeWindowsPath(header.path) as string\n this.mode = header.mode\n if (this.mode) {\n this.mode = this.mode & 0o7777\n }\n this.uid = header.uid\n this.gid = header.gid\n this.uname = header.uname\n this.gname = header.gname\n this.size = this.remain\n this.mtime = header.mtime\n this.atime = header.atime\n this.ctime = header.ctime\n /* c8 ignore start */\n this.linkpath =\n header.linkpath ?\n normalizeWindowsPath(header.linkpath)\n : undefined\n /* c8 ignore stop */\n this.uname = header.uname\n this.gname = header.gname\n\n if (ex) {\n this.#slurp(ex)\n }\n if (gex) {\n this.#slurp(gex, true)\n }\n }\n\n write(data: Buffer) {\n const writeLen = data.length\n if (writeLen > this.blockRemain) {\n throw new Error('writing more to entry than is appropriate')\n }\n\n const r = this.remain\n const br = this.blockRemain\n this.remain = Math.max(0, r - writeLen)\n this.blockRemain = Math.max(0, br - writeLen)\n if (this.ignore) {\n return true\n }\n\n if (r >= writeLen) {\n return super.write(data)\n }\n\n // r < writeLen\n return super.write(data.subarray(0, r))\n }\n\n #slurp(ex: Pax, gex: boolean = false) {\n if (ex.path) ex.path = normalizeWindowsPath(ex.path)\n if (ex.linkpath) ex.linkpath = normalizeWindowsPath(ex.linkpath)\n Object.assign(\n this,\n Object.fromEntries(\n Object.entries(ex).filter(([k, v]) => {\n // we slurp in everything except for the path attribute in\n // a global extended header, because that's weird. Also, any\n // null/undefined values are ignored.\n return !(\n v === null ||\n v === undefined ||\n (k === 'path' && gex)\n )\n }),\n ),\n )\n }\n}\n", "import { type Minipass } from 'minipass'\n\n/** has a warn method */\nexport type Warner = {\n warn(code: string, message: string | Error, data: any): void\n file?: string\n cwd?: string\n strict?: boolean\n\n emit(\n event: 'warn',\n code: string,\n message: string,\n data?: WarnData,\n ): void\n emit(event: 'error', error: TarError): void\n}\n\nexport type WarnEvent = Minipass.Events & {\n warn: [code: string, message: string, data: WarnData]\n}\n\nexport type WarnData = {\n file?: string\n cwd?: string\n code?: string\n tarCode?: string\n recoverable?: boolean\n [k: string]: any\n}\n\nexport type TarError = Error & WarnData\n\nexport const warnMethod = (\n self: Warner,\n code: string,\n message: string | Error,\n data: WarnData = {},\n) => {\n if (self.file) {\n data.file = self.file\n }\n if (self.cwd) {\n data.cwd = self.cwd\n }\n data.code =\n (message instanceof Error &&\n (message as NodeJS.ErrnoException).code) ||\n code\n data.tarCode = code\n if (!self.strict && data.recoverable !== false) {\n if (message instanceof Error) {\n data = Object.assign(message, data)\n message = message.message\n }\n self.emit('warn', code, message, data)\n } else if (message instanceof Error) {\n self.emit('error', Object.assign(message, data))\n } else {\n self.emit(\n 'error',\n Object.assign(new Error(`${code}: ${message}`), data),\n )\n }\n}\n", "// warning: extremely hot code path.\n// This has been meticulously optimized for use\n// within npm install on large package trees.\n// Do not edit without careful benchmarking.\nexport const stripTrailingSlashes = (str: string) => {\n let i = str.length - 1\n let slashesStart = -1\n while (i > -1 && str.charAt(i) === '/') {\n slashesStart = i\n i--\n }\n return slashesStart === -1 ? str : str.slice(0, slashesStart)\n}\n", "// A readable tar stream creator\n// Technically, this is a transform stream that you write paths into,\n// and tar format comes out of.\n// The `add()` method is like `write()` but returns this,\n// and end() return `this` as well, so you can\n// do `new Pack(opt).add('files').add('dir').end().pipe(output)\n// You could also do something like:\n// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar'))\n\nimport fs, { type Stats } from 'fs'\nimport {\n WriteEntry,\n WriteEntrySync,\n WriteEntryTar,\n} from './write-entry.js'\n\nexport class PackJob {\n path: string\n absolute: string\n entry?: WriteEntry | WriteEntryTar\n stat?: Stats\n readdir?: string[]\n pending: boolean = false\n ignore: boolean = false\n piped: boolean = false\n constructor(path: string, absolute: string) {\n this.path = path || './'\n this.absolute = absolute\n }\n}\n\nimport { Minipass } from 'minipass'\nimport * as zlib from 'minizlib'\nimport { Yallist } from 'yallist'\nimport { ReadEntry } from './read-entry.js'\nimport {\n WarnEvent,\n warnMethod,\n type WarnData,\n type Warner,\n} from './warn-method.js'\n\nconst EOF = Buffer.alloc(1024)\nconst ONSTAT = Symbol('onStat')\nconst ENDED = Symbol('ended')\nconst QUEUE = Symbol('queue')\nconst CURRENT = Symbol('current')\nconst PROCESS = Symbol('process')\nconst PROCESSING = Symbol('processing')\nconst PROCESSJOB = Symbol('processJob')\nconst JOBS = Symbol('jobs')\nconst JOBDONE = Symbol('jobDone')\nconst ADDFSENTRY = Symbol('addFSEntry')\nconst ADDTARENTRY = Symbol('addTarEntry')\nconst STAT = Symbol('stat')\nconst READDIR = Symbol('readdir')\nconst ONREADDIR = Symbol('onreaddir')\nconst PIPE = Symbol('pipe')\nconst ENTRY = Symbol('entry')\nconst ENTRYOPT = Symbol('entryOpt')\nconst WRITEENTRYCLASS = Symbol('writeEntryClass')\nconst WRITE = Symbol('write')\nconst ONDRAIN = Symbol('ondrain')\n\nimport path from 'path'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport { TarOptions } from './options.js'\n\nexport class Pack\n extends Minipass>\n implements Warner\n{\n sync: boolean = false\n opt: TarOptions\n cwd: string\n maxReadSize?: number\n preservePaths: boolean\n strict: boolean\n noPax: boolean\n prefix: string\n linkCache: Exclude\n statCache: Exclude\n file: string\n portable: boolean\n zip?: zlib.BrotliCompress | zlib.Gzip | zlib.ZstdCompress\n readdirCache: Exclude\n noDirRecurse: boolean\n follow: boolean\n noMtime: boolean\n mtime?: Date\n filter: Exclude\n jobs: number;\n\n [WRITEENTRYCLASS]: typeof WriteEntry | typeof WriteEntrySync\n onWriteEntry?: (entry: WriteEntry) => void;\n // Note: we actually DO need a linked list here, because we\n // shift() to update the head of the list where we start, but still\n // while that happens, need to know what the next item in the queue\n // will be. Since we do multiple jobs in parallel, it's not as simple\n // as just an Array.shift(), since that would lose the information about\n // the next job in the list. We could add a .next field on the PackJob\n // class, but then we'd have to be tracking the tail of the queue the\n // whole time, and Yallist just does that for us anyway.\n [QUEUE]: Yallist;\n [JOBS]: number = 0;\n [PROCESSING]: boolean = false;\n [ENDED]: boolean = false\n\n constructor(opt: TarOptions = {}) {\n //@ts-ignore\n super()\n this.opt = opt\n this.file = opt.file || ''\n this.cwd = opt.cwd || process.cwd()\n this.maxReadSize = opt.maxReadSize\n this.preservePaths = !!opt.preservePaths\n this.strict = !!opt.strict\n this.noPax = !!opt.noPax\n this.prefix = normalizeWindowsPath(opt.prefix || '')\n this.linkCache = opt.linkCache || new Map()\n this.statCache = opt.statCache || new Map()\n this.readdirCache = opt.readdirCache || new Map()\n this.onWriteEntry = opt.onWriteEntry\n\n this[WRITEENTRYCLASS] = WriteEntry\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n\n this.portable = !!opt.portable\n\n if (opt.gzip || opt.brotli || opt.zstd) {\n if (\n (opt.gzip ? 1 : 0) +\n (opt.brotli ? 1 : 0) +\n (opt.zstd ? 1 : 0) >\n 1\n ) {\n throw new TypeError(\n 'gzip, brotli, zstd are mutually exclusive',\n )\n }\n if (opt.gzip) {\n if (typeof opt.gzip !== 'object') {\n opt.gzip = {}\n }\n if (this.portable) {\n opt.gzip.portable = true\n }\n this.zip = new zlib.Gzip(opt.gzip)\n }\n if (opt.brotli) {\n if (typeof opt.brotli !== 'object') {\n opt.brotli = {}\n }\n this.zip = new zlib.BrotliCompress(opt.brotli)\n }\n if (opt.zstd) {\n if (typeof opt.zstd !== 'object') {\n opt.zstd = {}\n }\n this.zip = new zlib.ZstdCompress(opt.zstd)\n }\n /* c8 ignore next */\n if (!this.zip) throw new Error('impossible')\n const zip = this.zip\n zip.on('data', chunk => super.write(chunk as unknown as string))\n zip.on('end', () => super.end())\n zip.on('drain', () => this[ONDRAIN]())\n this.on('resume', () => zip.resume())\n } else {\n this.on('drain', this[ONDRAIN])\n }\n\n this.noDirRecurse = !!opt.noDirRecurse\n this.follow = !!opt.follow\n this.noMtime = !!opt.noMtime\n if (opt.mtime) this.mtime = opt.mtime\n\n this.filter =\n typeof opt.filter === 'function' ? opt.filter : () => true\n\n this[QUEUE] = new Yallist()\n this[JOBS] = 0\n this.jobs = Number(opt.jobs) || 4\n this[PROCESSING] = false\n this[ENDED] = false\n }\n\n [WRITE](chunk: Buffer) {\n return super.write(chunk as unknown as string)\n }\n\n add(path: string | ReadEntry) {\n this.write(path)\n return this\n }\n\n end(cb?: () => void): this\n end(path: string | ReadEntry, cb?: () => void): this\n end(\n path: string | ReadEntry,\n encoding?: Minipass.Encoding,\n cb?: () => void,\n ): this\n end(\n path?: string | ReadEntry | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void,\n ) {\n /* c8 ignore start */\n if (typeof path === 'function') {\n cb = path\n path = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n /* c8 ignore stop */\n if (path) {\n this.add(path)\n }\n this[ENDED] = true\n this[PROCESS]()\n /* c8 ignore next */\n if (cb) cb()\n return this\n }\n\n write(path: string | ReadEntry) {\n if (this[ENDED]) {\n throw new Error('write after end')\n }\n\n if (path instanceof ReadEntry) {\n this[ADDTARENTRY](path)\n } else {\n this[ADDFSENTRY](path)\n }\n return this.flowing\n }\n\n [ADDTARENTRY](p: ReadEntry) {\n const absolute = normalizeWindowsPath(\n path.resolve(this.cwd, p.path),\n )\n // in this case, we don't have to wait for the stat\n if (!this.filter(p.path, p)) {\n p.resume()\n } else {\n const job = new PackJob(p.path, absolute)\n job.entry = new WriteEntryTar(p, this[ENTRYOPT](job))\n job.entry.on('end', () => this[JOBDONE](job))\n this[JOBS] += 1\n this[QUEUE].push(job)\n }\n\n this[PROCESS]()\n }\n\n [ADDFSENTRY](p: string) {\n const absolute = normalizeWindowsPath(path.resolve(this.cwd, p))\n this[QUEUE].push(new PackJob(p, absolute))\n this[PROCESS]()\n }\n\n [STAT](job: PackJob) {\n job.pending = true\n this[JOBS] += 1\n const stat = this.follow ? 'stat' : 'lstat'\n fs[stat](job.absolute, (er, stat) => {\n job.pending = false\n this[JOBS] -= 1\n if (er) {\n this.emit('error', er)\n } else {\n this[ONSTAT](job, stat)\n }\n })\n }\n\n [ONSTAT](job: PackJob, stat: Stats) {\n this.statCache.set(job.absolute, stat)\n job.stat = stat\n\n // now we have the stat, we can filter it.\n if (!this.filter(job.path, stat)) {\n job.ignore = true\n } else if (\n stat.isFile() &&\n stat.nlink > 1 &&\n job === this[CURRENT] &&\n !this.linkCache.get(`${stat.dev}:${stat.ino}`) &&\n !this.sync\n ) {\n // if it's not filtered, and it's a new File entry,\n // jump the queue in case any pending Link entries are about\n // to try to link to it. This prevents a hardlink from coming ahead\n // of its target in the archive.\n this[PROCESSJOB](job)\n }\n\n this[PROCESS]()\n }\n\n [READDIR](job: PackJob) {\n job.pending = true\n this[JOBS] += 1\n fs.readdir(job.absolute, (er, entries) => {\n job.pending = false\n this[JOBS] -= 1\n if (er) {\n return this.emit('error', er)\n }\n this[ONREADDIR](job, entries)\n })\n }\n\n [ONREADDIR](job: PackJob, entries: string[]) {\n this.readdirCache.set(job.absolute, entries)\n job.readdir = entries\n this[PROCESS]()\n }\n\n [PROCESS]() {\n if (this[PROCESSING]) {\n return\n }\n\n this[PROCESSING] = true\n for (\n let w = this[QUEUE].head;\n !!w && this[JOBS] < this.jobs;\n w = w.next\n ) {\n this[PROCESSJOB](w.value)\n if (w.value.ignore) {\n const p = w.next\n this[QUEUE].removeNode(w)\n w.next = p\n }\n }\n\n this[PROCESSING] = false\n\n if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) {\n if (this.zip) {\n this.zip.end(EOF)\n } else {\n super.write(EOF as unknown as string)\n super.end()\n }\n }\n }\n\n get [CURRENT]() {\n return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value\n }\n\n [JOBDONE](_job: PackJob) {\n this[QUEUE].shift()\n this[JOBS] -= 1\n this[PROCESS]()\n }\n\n [PROCESSJOB](job: PackJob) {\n if (job.pending) {\n return\n }\n\n if (job.entry) {\n if (job === this[CURRENT] && !job.piped) {\n this[PIPE](job)\n }\n return\n }\n\n if (!job.stat) {\n const sc = this.statCache.get(job.absolute)\n if (sc) {\n this[ONSTAT](job, sc)\n } else {\n this[STAT](job)\n }\n }\n if (!job.stat) {\n return\n }\n\n // filtered out!\n if (job.ignore) {\n return\n }\n\n if (\n !this.noDirRecurse &&\n job.stat.isDirectory() &&\n !job.readdir\n ) {\n const rc = this.readdirCache.get(job.absolute)\n if (rc) {\n this[ONREADDIR](job, rc)\n } else {\n this[READDIR](job)\n }\n if (!job.readdir) {\n return\n }\n }\n\n // we know it doesn't have an entry, because that got checked above\n job.entry = this[ENTRY](job)\n if (!job.entry) {\n job.ignore = true\n return\n }\n\n if (job === this[CURRENT] && !job.piped) {\n this[PIPE](job)\n }\n }\n\n [ENTRYOPT](job: PackJob): TarOptions {\n return {\n onwarn: (code, msg, data) => this.warn(code, msg, data),\n noPax: this.noPax,\n cwd: this.cwd,\n absolute: job.absolute,\n preservePaths: this.preservePaths,\n maxReadSize: this.maxReadSize,\n strict: this.strict,\n portable: this.portable,\n linkCache: this.linkCache,\n statCache: this.statCache,\n noMtime: this.noMtime,\n mtime: this.mtime,\n prefix: this.prefix,\n onWriteEntry: this.onWriteEntry,\n }\n }\n\n [ENTRY](job: PackJob) {\n this[JOBS] += 1\n try {\n const e = new this[WRITEENTRYCLASS](\n job.path,\n this[ENTRYOPT](job),\n )\n return e\n .on('end', () => this[JOBDONE](job))\n .on('error', er => this.emit('error', er))\n } catch (er) {\n this.emit('error', er)\n }\n }\n\n [ONDRAIN]() {\n if (this[CURRENT] && this[CURRENT].entry) {\n this[CURRENT].entry.resume()\n }\n }\n\n // like .pipe() but using super, because our write() is special\n [PIPE](job: PackJob) {\n job.piped = true\n\n if (job.readdir) {\n job.readdir.forEach(entry => {\n const p = job.path\n const base = p === './' ? '' : p.replace(/\\/*$/, '/')\n this[ADDFSENTRY](base + entry)\n })\n }\n\n const source = job.entry\n const zip = this.zip\n /* c8 ignore start */\n if (!source) throw new Error('cannot pipe without source')\n /* c8 ignore stop */\n\n if (zip) {\n source.on('data', chunk => {\n if (!zip.write(chunk)) {\n source.pause()\n }\n })\n } else {\n source.on('data', chunk => {\n if (!super.write(chunk as unknown as string)) {\n source.pause()\n }\n })\n }\n }\n\n pause() {\n if (this.zip) {\n this.zip.pause()\n }\n return super.pause()\n }\n warn(\n code: string,\n message: string | Error,\n data: WarnData = {},\n ): void {\n warnMethod(this, code, message, data)\n }\n}\n\nexport class PackSync extends Pack {\n sync: true = true\n constructor(opt: TarOptions) {\n super(opt)\n this[WRITEENTRYCLASS] = WriteEntrySync\n }\n\n // pause/resume are no-ops in sync streams.\n pause() {}\n resume() {}\n\n [STAT](job: PackJob) {\n const stat = this.follow ? 'statSync' : 'lstatSync'\n this[ONSTAT](job, fs[stat](job.absolute))\n }\n\n [READDIR](job: PackJob) {\n this[ONREADDIR](job, fs.readdirSync(job.absolute))\n }\n\n // gotta get it all in this tick\n [PIPE](job: PackJob) {\n const source = job.entry\n const zip = this.zip\n\n if (job.readdir) {\n job.readdir.forEach(entry => {\n const p = job.path\n const base = p === './' ? '' : p.replace(/\\/*$/, '/')\n this[ADDFSENTRY](base + entry)\n })\n }\n\n /* c8 ignore start */\n if (!source) throw new Error('Cannot pipe without source')\n /* c8 ignore stop */\n\n if (zip) {\n source.on('data', chunk => {\n zip.write(chunk)\n })\n } else {\n source.on('data', chunk => {\n super[WRITE](chunk)\n })\n }\n }\n}\n", "import fs, { type Stats } from 'fs'\nimport { Minipass } from 'minipass'\nimport path from 'path'\nimport { Header } from './header.js'\nimport { modeFix } from './mode-fix.js'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport {\n dealias,\n LinkCacheKey,\n TarOptions,\n TarOptionsWithAliases,\n} from './options.js'\nimport { Pax } from './pax.js'\nimport { ReadEntry } from './read-entry.js'\nimport { stripAbsolutePath } from './strip-absolute-path.js'\nimport { stripTrailingSlashes } from './strip-trailing-slashes.js'\nimport { EntryTypeName } from './types.js'\nimport {\n WarnData,\n Warner,\n WarnEvent,\n warnMethod,\n} from './warn-method.js'\nimport * as winchars from './winchars.js'\n\nconst prefixPath = (path: string, prefix?: string) => {\n if (!prefix) {\n return normalizeWindowsPath(path)\n }\n path = normalizeWindowsPath(path).replace(/^\\.(\\/|$)/, '')\n return stripTrailingSlashes(prefix) + '/' + path\n}\n\nconst maxReadSize = 16 * 1024 * 1024\n\nconst PROCESS = Symbol('process')\nconst FILE = Symbol('file')\nconst DIRECTORY = Symbol('directory')\nconst SYMLINK = Symbol('symlink')\nconst HARDLINK = Symbol('hardlink')\nconst HEADER = Symbol('header')\nconst READ = Symbol('read')\nconst LSTAT = Symbol('lstat')\nconst ONLSTAT = Symbol('onlstat')\nconst ONREAD = Symbol('onread')\nconst ONREADLINK = Symbol('onreadlink')\nconst OPENFILE = Symbol('openfile')\nconst ONOPENFILE = Symbol('onopenfile')\nconst CLOSE = Symbol('close')\nconst MODE = Symbol('mode')\nconst AWAITDRAIN = Symbol('awaitDrain')\nconst ONDRAIN = Symbol('ondrain')\nconst PREFIX = Symbol('prefix')\n\nexport class WriteEntry\n extends Minipass\n implements Warner\n{\n path: string\n portable: boolean\n myuid: number = (process.getuid && process.getuid()) || 0\n // until node has builtin pwnam functions, this'll have to do\n myuser: string = process.env.USER || ''\n maxReadSize: number\n linkCache: Exclude\n statCache: Exclude\n preservePaths: boolean\n cwd: string\n strict: boolean\n mtime?: Date\n noPax: boolean\n noMtime: boolean\n prefix?: string\n fd?: number\n\n blockLen: number = 0\n blockRemain: number = 0\n buf?: Buffer\n pos: number = 0\n remain: number = 0\n length: number = 0\n offset: number = 0\n\n win32: boolean\n absolute: string\n\n header?: Header\n type?: EntryTypeName | 'Unsupported'\n linkpath?: string\n stat?: Stats\n onWriteEntry?: (entry: WriteEntry) => any\n\n #hadError: boolean = false\n\n constructor(p: string, opt_: TarOptionsWithAliases = {}) {\n const opt = dealias(opt_)\n super()\n this.path = normalizeWindowsPath(p)\n // suppress atime, ctime, uid, gid, uname, gname\n this.portable = !!opt.portable\n this.maxReadSize = opt.maxReadSize || maxReadSize\n this.linkCache = opt.linkCache || new Map()\n this.statCache = opt.statCache || new Map()\n this.preservePaths = !!opt.preservePaths\n this.cwd = normalizeWindowsPath(opt.cwd || process.cwd())\n this.strict = !!opt.strict\n this.noPax = !!opt.noPax\n this.noMtime = !!opt.noMtime\n this.mtime = opt.mtime\n this.prefix =\n opt.prefix ? normalizeWindowsPath(opt.prefix) : undefined\n this.onWriteEntry = opt.onWriteEntry\n\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n\n let pathWarn: string | boolean = false\n if (!this.preservePaths) {\n const [root, stripped] = stripAbsolutePath(this.path)\n if (root && typeof stripped === 'string') {\n this.path = stripped\n pathWarn = root\n }\n }\n\n this.win32 = !!opt.win32 || process.platform === 'win32'\n if (this.win32) {\n // force the \\ to / normalization, since we might not *actually*\n // be on windows, but want \\ to be considered a path separator.\n this.path = winchars.decode(this.path.replace(/\\\\/g, '/'))\n p = p.replace(/\\\\/g, '/')\n }\n\n this.absolute = normalizeWindowsPath(\n opt.absolute || path.resolve(this.cwd, p),\n )\n\n if (this.path === '') {\n this.path = './'\n }\n\n if (pathWarn) {\n this.warn(\n 'TAR_ENTRY_INFO',\n `stripping ${pathWarn} from absolute path`,\n {\n entry: this,\n path: pathWarn + this.path,\n },\n )\n }\n\n const cs = this.statCache.get(this.absolute)\n if (cs) {\n this[ONLSTAT](cs)\n } else {\n this[LSTAT]()\n }\n }\n\n warn(code: string, message: string | Error, data: WarnData = {}) {\n return warnMethod(this, code, message, data)\n }\n\n emit(ev: keyof WarnEvent, ...data: any[]) {\n if (ev === 'error') {\n this.#hadError = true\n }\n return super.emit(ev, ...data)\n }\n\n [LSTAT]() {\n fs.lstat(this.absolute, (er, stat) => {\n if (er) {\n return this.emit('error', er)\n }\n this[ONLSTAT](stat)\n })\n }\n\n [ONLSTAT](stat: Stats) {\n this.statCache.set(this.absolute, stat)\n this.stat = stat\n if (!stat.isFile()) {\n stat.size = 0\n }\n this.type = getType(stat)\n this.emit('stat', stat)\n this[PROCESS]()\n }\n\n [PROCESS]() {\n switch (this.type) {\n case 'File':\n return this[FILE]()\n case 'Directory':\n return this[DIRECTORY]()\n case 'SymbolicLink':\n return this[SYMLINK]()\n // unsupported types are ignored.\n default:\n return this.end()\n }\n }\n\n [MODE](mode: number) {\n return modeFix(mode, this.type === 'Directory', this.portable)\n }\n\n [PREFIX](path: string) {\n return prefixPath(path, this.prefix)\n }\n\n [HEADER]() {\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('cannot write header before stat')\n }\n /* c8 ignore stop */\n\n if (this.type === 'Directory' && this.portable) {\n this.noMtime = true\n }\n\n this.onWriteEntry?.(this)\n this.header = new Header({\n path: this[PREFIX](this.path),\n // only apply the prefix to hard links.\n linkpath:\n this.type === 'Link' && this.linkpath !== undefined ?\n this[PREFIX](this.linkpath)\n : this.linkpath,\n // only the permissions and setuid/setgid/sticky bitflags\n // not the higher-order bits that specify file type\n mode: this[MODE](this.stat.mode),\n uid: this.portable ? undefined : this.stat.uid,\n gid: this.portable ? undefined : this.stat.gid,\n size: this.stat.size,\n mtime: this.noMtime ? undefined : this.mtime || this.stat.mtime,\n /* c8 ignore next */\n type: this.type === 'Unsupported' ? undefined : this.type,\n uname:\n this.portable ? undefined\n : this.stat.uid === this.myuid ? this.myuser\n : '',\n atime: this.portable ? undefined : this.stat.atime,\n ctime: this.portable ? undefined : this.stat.ctime,\n })\n\n if (this.header.encode() && !this.noPax) {\n super.write(\n new Pax({\n atime: this.portable ? undefined : this.header.atime,\n ctime: this.portable ? undefined : this.header.ctime,\n gid: this.portable ? undefined : this.header.gid,\n mtime:\n this.noMtime ? undefined : (\n this.mtime || this.header.mtime\n ),\n path: this[PREFIX](this.path),\n linkpath:\n this.type === 'Link' && this.linkpath !== undefined ?\n this[PREFIX](this.linkpath)\n : this.linkpath,\n size: this.header.size,\n uid: this.portable ? undefined : this.header.uid,\n uname: this.portable ? undefined : this.header.uname,\n dev: this.portable ? undefined : this.stat.dev,\n ino: this.portable ? undefined : this.stat.ino,\n nlink: this.portable ? undefined : this.stat.nlink,\n }).encode(),\n )\n }\n const block = this.header?.block\n /* c8 ignore start */\n if (!block) {\n throw new Error('failed to encode header')\n }\n /* c8 ignore stop */\n super.write(block)\n }\n\n [DIRECTORY]() {\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('cannot create directory entry without stat')\n }\n /* c8 ignore stop */\n if (this.path.slice(-1) !== '/') {\n this.path += '/'\n }\n this.stat.size = 0\n this[HEADER]()\n this.end()\n }\n\n [SYMLINK]() {\n fs.readlink(this.absolute, (er, linkpath) => {\n if (er) {\n return this.emit('error', er)\n }\n this[ONREADLINK](linkpath)\n })\n }\n\n [ONREADLINK](linkpath: string) {\n this.linkpath = normalizeWindowsPath(linkpath)\n this[HEADER]()\n this.end()\n }\n\n [HARDLINK](linkpath: string) {\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('cannot create link entry without stat')\n }\n /* c8 ignore stop */\n this.type = 'Link'\n this.linkpath = normalizeWindowsPath(\n path.relative(this.cwd, linkpath),\n )\n this.stat.size = 0\n this[HEADER]()\n this.end()\n }\n\n [FILE]() {\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('cannot create file entry without stat')\n }\n /* c8 ignore stop */\n if (this.stat.nlink > 1) {\n const linkKey =\n `${this.stat.dev}:${this.stat.ino}` as LinkCacheKey\n const linkpath = this.linkCache.get(linkKey)\n if (linkpath?.indexOf(this.cwd) === 0) {\n return this[HARDLINK](linkpath)\n }\n this.linkCache.set(linkKey, this.absolute)\n }\n\n this[HEADER]()\n if (this.stat.size === 0) {\n return this.end()\n }\n\n this[OPENFILE]()\n }\n\n [OPENFILE]() {\n fs.open(this.absolute, 'r', (er, fd) => {\n if (er) {\n return this.emit('error', er)\n }\n this[ONOPENFILE](fd)\n })\n }\n\n [ONOPENFILE](fd: number) {\n this.fd = fd\n if (this.#hadError) {\n return this[CLOSE]()\n }\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('should stat before calling onopenfile')\n }\n /* c8 ignore start */\n\n this.blockLen = 512 * Math.ceil(this.stat.size / 512)\n this.blockRemain = this.blockLen\n const bufLen = Math.min(this.blockLen, this.maxReadSize)\n this.buf = Buffer.allocUnsafe(bufLen)\n this.offset = 0\n this.pos = 0\n this.remain = this.stat.size\n this.length = this.buf.length\n this[READ]()\n }\n\n [READ]() {\n const { fd, buf, offset, length, pos } = this\n if (fd === undefined || buf === undefined) {\n throw new Error('cannot read file without first opening')\n }\n fs.read(fd, buf, offset, length, pos, (er, bytesRead) => {\n if (er) {\n // ignoring the error from close(2) is a bad practice, but at\n // this point we already have an error, don't need another one\n return this[CLOSE](() => this.emit('error', er))\n }\n this[ONREAD](bytesRead)\n })\n }\n\n /* c8 ignore start */\n [CLOSE](\n cb: (er?: null | Error | NodeJS.ErrnoException) => any = () => {},\n ) {\n /* c8 ignore stop */\n if (this.fd !== undefined) fs.close(this.fd, cb)\n }\n\n [ONREAD](bytesRead: number) {\n if (bytesRead <= 0 && this.remain > 0) {\n const er = Object.assign(\n new Error('encountered unexpected EOF'),\n {\n path: this.absolute,\n syscall: 'read',\n code: 'EOF',\n },\n )\n return this[CLOSE](() => this.emit('error', er))\n }\n\n if (bytesRead > this.remain) {\n const er = Object.assign(\n new Error('did not encounter expected EOF'),\n {\n path: this.absolute,\n syscall: 'read',\n code: 'EOF',\n },\n )\n return this[CLOSE](() => this.emit('error', er))\n }\n\n /* c8 ignore start */\n if (!this.buf) {\n throw new Error('should have created buffer prior to reading')\n }\n /* c8 ignore stop */\n\n // null out the rest of the buffer, if we could fit the block padding\n // at the end of this loop, we've incremented bytesRead and this.remain\n // to be incremented up to the blockRemain level, as if we had expected\n // to get a null-padded file, and read it until the end. then we will\n // decrement both remain and blockRemain by bytesRead, and know that we\n // reached the expected EOF, without any null buffer to append.\n if (bytesRead === this.remain) {\n for (\n let i = bytesRead;\n i < this.length && bytesRead < this.blockRemain;\n i++\n ) {\n this.buf[i + this.offset] = 0\n bytesRead++\n this.remain++\n }\n }\n\n const chunk =\n this.offset === 0 && bytesRead === this.buf.length ?\n this.buf\n : this.buf.subarray(this.offset, this.offset + bytesRead)\n\n const flushed = this.write(chunk)\n if (!flushed) {\n this[AWAITDRAIN](() => this[ONDRAIN]())\n } else {\n this[ONDRAIN]()\n }\n }\n\n [AWAITDRAIN](cb: () => any) {\n this.once('drain', cb)\n }\n\n write(buffer: Buffer | string, cb?: () => void): boolean\n write(\n str: Buffer | string,\n encoding?: BufferEncoding | null,\n cb?: () => void,\n ): boolean\n write(\n chunk: Buffer | string,\n encoding?: BufferEncoding | (() => any) | null,\n cb?: () => any,\n ): boolean {\n /* c8 ignore start - just junk to comply with NodeJS.WritableStream */\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(\n chunk,\n typeof encoding === 'string' ? encoding : 'utf8',\n )\n }\n /* c8 ignore stop */\n\n if (this.blockRemain < chunk.length) {\n const er = Object.assign(\n new Error('writing more data than expected'),\n {\n path: this.absolute,\n },\n )\n return this.emit('error', er)\n }\n this.remain -= chunk.length\n this.blockRemain -= chunk.length\n this.pos += chunk.length\n this.offset += chunk.length\n return super.write(chunk, null, cb)\n }\n\n [ONDRAIN]() {\n if (!this.remain) {\n if (this.blockRemain) {\n super.write(Buffer.alloc(this.blockRemain))\n }\n return this[CLOSE](er =>\n er ? this.emit('error', er) : this.end(),\n )\n }\n\n /* c8 ignore start */\n if (!this.buf) {\n throw new Error('buffer lost somehow in ONDRAIN')\n }\n /* c8 ignore stop */\n\n if (this.offset >= this.length) {\n // if we only have a smaller bit left to read, alloc a smaller buffer\n // otherwise, keep it the same length it was before.\n this.buf = Buffer.allocUnsafe(\n Math.min(this.blockRemain, this.buf.length),\n )\n this.offset = 0\n }\n this.length = this.buf.length - this.offset\n this[READ]()\n }\n}\n\nexport class WriteEntrySync extends WriteEntry implements Warner {\n sync: true = true;\n\n [LSTAT]() {\n this[ONLSTAT](fs.lstatSync(this.absolute))\n }\n\n [SYMLINK]() {\n this[ONREADLINK](fs.readlinkSync(this.absolute))\n }\n\n [OPENFILE]() {\n this[ONOPENFILE](fs.openSync(this.absolute, 'r'))\n }\n\n [READ]() {\n let threw = true\n try {\n const { fd, buf, offset, length, pos } = this\n /* c8 ignore start */\n if (fd === undefined || buf === undefined) {\n throw new Error('fd and buf must be set in READ method')\n }\n /* c8 ignore stop */\n const bytesRead = fs.readSync(fd, buf, offset, length, pos)\n this[ONREAD](bytesRead)\n threw = false\n } finally {\n // ignoring the error from close(2) is a bad practice, but at\n // this point we already have an error, don't need another one\n if (threw) {\n try {\n this[CLOSE](() => {})\n } catch (er) {}\n }\n }\n }\n\n [AWAITDRAIN](cb: () => any) {\n cb()\n }\n\n /* c8 ignore start */\n [CLOSE](\n cb: (er?: null | Error | NodeJS.ErrnoException) => any = () => {},\n ) {\n /* c8 ignore stop */\n if (this.fd !== undefined) fs.closeSync(this.fd)\n cb()\n }\n}\n\nexport class WriteEntryTar\n extends Minipass\n implements Warner\n{\n blockLen: number = 0\n blockRemain: number = 0\n buf: number = 0\n pos: number = 0\n remain: number = 0\n length: number = 0\n preservePaths: boolean\n portable: boolean\n strict: boolean\n noPax: boolean\n noMtime: boolean\n readEntry: ReadEntry\n type: EntryTypeName\n prefix?: string\n path: string\n mode?: number\n uid?: number\n gid?: number\n uname?: string\n gname?: string\n header?: Header\n mtime?: Date\n atime?: Date\n ctime?: Date\n linkpath?: string\n size: number\n onWriteEntry?: (entry: WriteEntry) => any\n\n warn(code: string, message: string | Error, data: WarnData = {}) {\n return warnMethod(this, code, message, data)\n }\n\n constructor(\n readEntry: ReadEntry,\n opt_: TarOptionsWithAliases = {},\n ) {\n const opt = dealias(opt_)\n super()\n this.preservePaths = !!opt.preservePaths\n this.portable = !!opt.portable\n this.strict = !!opt.strict\n this.noPax = !!opt.noPax\n this.noMtime = !!opt.noMtime\n this.onWriteEntry = opt.onWriteEntry\n\n this.readEntry = readEntry\n const { type } = readEntry\n /* c8 ignore start */\n if (type === 'Unsupported') {\n throw new Error('writing entry that should be ignored')\n }\n /* c8 ignore stop */\n this.type = type\n if (this.type === 'Directory' && this.portable) {\n this.noMtime = true\n }\n\n this.prefix = opt.prefix\n\n this.path = normalizeWindowsPath(readEntry.path)\n this.mode =\n readEntry.mode !== undefined ?\n this[MODE](readEntry.mode)\n : undefined\n this.uid = this.portable ? undefined : readEntry.uid\n this.gid = this.portable ? undefined : readEntry.gid\n this.uname = this.portable ? undefined : readEntry.uname\n this.gname = this.portable ? undefined : readEntry.gname\n this.size = readEntry.size\n this.mtime =\n this.noMtime ? undefined : opt.mtime || readEntry.mtime\n this.atime = this.portable ? undefined : readEntry.atime\n this.ctime = this.portable ? undefined : readEntry.ctime\n this.linkpath =\n readEntry.linkpath !== undefined ?\n normalizeWindowsPath(readEntry.linkpath)\n : undefined\n\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n\n let pathWarn: false | string = false\n if (!this.preservePaths) {\n const [root, stripped] = stripAbsolutePath(this.path)\n if (root && typeof stripped === 'string') {\n this.path = stripped\n pathWarn = root\n }\n }\n\n this.remain = readEntry.size\n this.blockRemain = readEntry.startBlockSize\n\n this.onWriteEntry?.(this as unknown as WriteEntry)\n this.header = new Header({\n path: this[PREFIX](this.path),\n linkpath:\n this.type === 'Link' && this.linkpath !== undefined ?\n this[PREFIX](this.linkpath)\n : this.linkpath,\n // only the permissions and setuid/setgid/sticky bitflags\n // not the higher-order bits that specify file type\n mode: this.mode,\n uid: this.portable ? undefined : this.uid,\n gid: this.portable ? undefined : this.gid,\n size: this.size,\n mtime: this.noMtime ? undefined : this.mtime,\n type: this.type,\n uname: this.portable ? undefined : this.uname,\n atime: this.portable ? undefined : this.atime,\n ctime: this.portable ? undefined : this.ctime,\n })\n\n if (pathWarn) {\n this.warn(\n 'TAR_ENTRY_INFO',\n `stripping ${pathWarn} from absolute path`,\n {\n entry: this,\n path: pathWarn + this.path,\n },\n )\n }\n\n if (this.header.encode() && !this.noPax) {\n super.write(\n new Pax({\n atime: this.portable ? undefined : this.atime,\n ctime: this.portable ? undefined : this.ctime,\n gid: this.portable ? undefined : this.gid,\n mtime: this.noMtime ? undefined : this.mtime,\n path: this[PREFIX](this.path),\n linkpath:\n this.type === 'Link' && this.linkpath !== undefined ?\n this[PREFIX](this.linkpath)\n : this.linkpath,\n size: this.size,\n uid: this.portable ? undefined : this.uid,\n uname: this.portable ? undefined : this.uname,\n dev: this.portable ? undefined : this.readEntry.dev,\n ino: this.portable ? undefined : this.readEntry.ino,\n nlink: this.portable ? undefined : this.readEntry.nlink,\n }).encode(),\n )\n }\n\n const b = this.header?.block\n /* c8 ignore start */\n if (!b) throw new Error('failed to encode header')\n /* c8 ignore stop */\n super.write(b)\n readEntry.pipe(this)\n }\n\n [PREFIX](path: string) {\n return prefixPath(path, this.prefix)\n }\n\n [MODE](mode: number) {\n return modeFix(mode, this.type === 'Directory', this.portable)\n }\n\n write(buffer: Buffer | string, cb?: () => void): boolean\n write(\n str: Buffer | string,\n encoding?: BufferEncoding | null,\n cb?: () => void,\n ): boolean\n write(\n chunk: Buffer | string,\n encoding?: BufferEncoding | (() => any) | null,\n cb?: () => any,\n ): boolean {\n /* c8 ignore start - just junk to comply with NodeJS.WritableStream */\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(\n chunk,\n typeof encoding === 'string' ? encoding : 'utf8',\n )\n }\n /* c8 ignore stop */\n const writeLen = chunk.length\n if (writeLen > this.blockRemain) {\n throw new Error('writing more to entry than is appropriate')\n }\n this.blockRemain -= writeLen\n return super.write(chunk, cb)\n }\n\n end(cb?: () => void): this\n end(chunk: Buffer | string, cb?: () => void): this\n end(\n chunk: Buffer | string,\n encoding?: BufferEncoding,\n cb?: () => void,\n ): this\n end(\n chunk?: Buffer | string | (() => void),\n encoding?: BufferEncoding | (() => void),\n cb?: () => void,\n ): this {\n if (this.blockRemain) {\n super.write(Buffer.alloc(this.blockRemain))\n }\n /* c8 ignore start - just junk to comply with NodeJS.WritableStream */\n if (typeof chunk === 'function') {\n cb = chunk\n encoding = undefined\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding ?? 'utf8')\n }\n if (cb) this.once('finish', cb)\n chunk ? super.end(chunk, cb) : super.end(cb)\n /* c8 ignore stop */\n return this\n }\n}\n\nconst getType = (stat: Stats): EntryTypeName | 'Unsupported' =>\n stat.isFile() ? 'File'\n : stat.isDirectory() ? 'Directory'\n : stat.isSymbolicLink() ? 'SymbolicLink'\n : 'Unsupported'\n", "export const modeFix = (\n mode: number,\n isDir: boolean,\n portable: boolean,\n) => {\n mode &= 0o7777\n\n // in portable mode, use the minimum reasonable umask\n // if this system creates files with 0o664 by default\n // (as some linux distros do), then we'll write the\n // archive with 0o644 instead. Also, don't ever create\n // a file that is not readable/writable by the owner.\n if (portable) {\n mode = (mode | 0o600) & ~0o22\n }\n\n // if dirs are readable, then they should be listable\n if (isDir) {\n if (mode & 0o400) {\n mode |= 0o100\n }\n if (mode & 0o40) {\n mode |= 0o10\n }\n if (mode & 0o4) {\n mode |= 0o1\n }\n }\n return mode\n}\n", "// unix absolute paths are also absolute on win32, so we use this for both\nimport { win32 } from 'node:path'\nconst { isAbsolute, parse } = win32\n\n// returns [root, stripped]\n// Note that windows will think that //x/y/z/a has a \"root\" of //x/y, and in\n// those cases, we want to sanitize it to x/y/z/a, not z/a, so we strip /\n// explicitly if it's the first character.\n// drive-specific relative paths on Windows get their root stripped off even\n// though they are not absolute, so `c:../foo` becomes ['c:', '../foo']\nexport const stripAbsolutePath = (path: string) => {\n let r = ''\n\n let parsed = parse(path)\n while (isAbsolute(path) || parsed.root) {\n // windows will think that //x/y/z has a \"root\" of //x/y/\n // but strip the //?/C:/ off of //?/C:/path\n const root =\n path.charAt(0) === '/' && path.slice(0, 4) !== '//?/' ?\n '/'\n : parsed.root\n path = path.slice(root.length)\n r += root\n parsed = parse(path)\n }\n return [r, path]\n}\n", "// When writing files on Windows, translate the characters to their\n// 0xf000 higher-encoded versions.\n\nconst raw = ['|', '<', '>', '?', ':']\n\nconst win = raw.map(char =>\n String.fromCharCode(0xf000 + char.charCodeAt(0)),\n)\n\nconst toWin = new Map(raw.map((char, i) => [char, win[i]]))\nconst toRaw = new Map(win.map((char, i) => [char, raw[i]]))\n\nexport const encode = (s: string) =>\n raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s)\nexport const decode = (s: string) =>\n win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s)\n", "export class Yallist {\n tail?: Node\n head?: Node\n length: number = 0\n\n static create(list: Iterable = []) {\n return new Yallist(list)\n }\n\n constructor(list: Iterable = []) {\n for (const item of list) {\n this.push(item)\n }\n }\n\n *[Symbol.iterator]() {\n for (let walker = this.head; walker; walker = walker.next) {\n yield walker.value\n }\n }\n\n removeNode(node: Node) {\n if (node.list !== this) {\n throw new Error(\n 'removing node which does not belong to this list',\n )\n }\n\n const next = node.next\n const prev = node.prev\n\n if (next) {\n next.prev = prev\n }\n\n if (prev) {\n prev.next = next\n }\n\n if (node === this.head) {\n this.head = next\n }\n if (node === this.tail) {\n this.tail = prev\n }\n\n this.length--\n node.next = undefined\n node.prev = undefined\n node.list = undefined\n\n return next\n }\n\n unshiftNode(node: Node) {\n if (node === this.head) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n const head = this.head\n node.list = this\n node.next = head\n if (head) {\n head.prev = node\n }\n\n this.head = node\n if (!this.tail) {\n this.tail = node\n }\n this.length++\n }\n\n pushNode(node: Node) {\n if (node === this.tail) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n const tail = this.tail\n node.list = this\n node.prev = tail\n if (tail) {\n tail.next = node\n }\n\n this.tail = node\n if (!this.head) {\n this.head = node\n }\n this.length++\n }\n\n push(...args: T[]) {\n for (let i = 0, l = args.length; i < l; i++) {\n push(this, args[i])\n }\n return this.length\n }\n\n unshift(...args: T[]) {\n for (var i = 0, l = args.length; i < l; i++) {\n unshift(this, args[i])\n }\n return this.length\n }\n\n pop() {\n if (!this.tail) {\n return undefined\n }\n\n const res = this.tail.value\n const t = this.tail\n this.tail = this.tail.prev\n if (this.tail) {\n this.tail.next = undefined\n } else {\n this.head = undefined\n }\n t.list = undefined\n this.length--\n return res\n }\n\n shift() {\n if (!this.head) {\n return undefined\n }\n\n const res = this.head.value\n const h = this.head\n this.head = this.head.next\n if (this.head) {\n this.head.prev = undefined\n } else {\n this.tail = undefined\n }\n h.list = undefined\n this.length--\n return res\n }\n\n forEach(\n fn: (value: T, i: number, list: Yallist) => any,\n thisp?: any,\n ) {\n thisp = thisp || this\n for (let walker = this.head, i = 0; !!walker; i++) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.next\n }\n }\n\n forEachReverse(\n fn: (value: T, i: number, list: Yallist) => any,\n thisp?: any,\n ) {\n thisp = thisp || this\n for (let walker = this.tail, i = this.length - 1; !!walker; i--) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.prev\n }\n }\n\n get(n: number) {\n let i = 0\n let walker = this.head\n for (; !!walker && i < n; i++) {\n walker = walker.next\n }\n if (i === n && !!walker) {\n return walker.value\n }\n }\n\n getReverse(n: number) {\n let i = 0\n let walker = this.tail\n for (; !!walker && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.prev\n }\n if (i === n && !!walker) {\n return walker.value\n }\n }\n\n map(\n fn: (value: T, list: Yallist) => R,\n thisp?: any,\n ): Yallist {\n thisp = thisp || this\n const res = new Yallist()\n for (let walker = this.head; !!walker; ) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.next\n }\n return res\n }\n\n mapReverse(\n fn: (value: T, list: Yallist) => R,\n thisp?: any,\n ): Yallist {\n thisp = thisp || this\n var res = new Yallist()\n for (let walker = this.tail; !!walker; ) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.prev\n }\n return res\n }\n\n reduce(fn: (left: T, right: T, i: number) => T): T\n reduce(\n fn: (acc: R, next: T, i: number) => R,\n initial: R,\n ): R\n reduce(\n fn: (acc: R, next: T, i: number) => R,\n initial?: R,\n ): R {\n let acc: R | T\n let walker = this.head\n if (arguments.length > 1) {\n acc = initial as R\n } else if (this.head) {\n walker = this.head.next\n acc = this.head.value\n } else {\n throw new TypeError(\n 'Reduce of empty list with no initial value',\n )\n }\n\n for (var i = 0; !!walker; i++) {\n acc = fn(acc as R, walker.value, i)\n walker = walker.next\n }\n\n return acc as R\n }\n\n reduceReverse(fn: (left: T, right: T, i: number) => T): T\n reduceReverse(\n fn: (acc: R, next: T, i: number) => R,\n initial: R,\n ): R\n reduceReverse(\n fn: (acc: R, next: T, i: number) => R,\n initial?: R,\n ): R {\n let acc: R | T\n let walker = this.tail\n if (arguments.length > 1) {\n acc = initial as R\n } else if (this.tail) {\n walker = this.tail.prev\n acc = this.tail.value\n } else {\n throw new TypeError(\n 'Reduce of empty list with no initial value',\n )\n }\n\n for (let i = this.length - 1; !!walker; i--) {\n acc = fn(acc as R, walker.value, i)\n walker = walker.prev\n }\n\n return acc as R\n }\n\n toArray() {\n const arr = new Array(this.length)\n for (let i = 0, walker = this.head; !!walker; i++) {\n arr[i] = walker.value\n walker = walker.next\n }\n return arr\n }\n\n toArrayReverse() {\n const arr = new Array(this.length)\n for (let i = 0, walker = this.tail; !!walker; i++) {\n arr[i] = walker.value\n walker = walker.prev\n }\n return arr\n }\n\n slice(from: number = 0, to: number = this.length) {\n if (to < 0) {\n to += this.length\n }\n if (from < 0) {\n from += this.length\n }\n const ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n let walker = this.head\n let i = 0\n for (i = 0; !!walker && i < from; i++) {\n walker = walker.next\n }\n for (; !!walker && i < to; i++, walker = walker.next) {\n ret.push(walker.value)\n }\n return ret\n }\n\n sliceReverse(from: number = 0, to: number = this.length) {\n if (to < 0) {\n to += this.length\n }\n if (from < 0) {\n from += this.length\n }\n const ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n let i = this.length\n let walker = this.tail\n for (; !!walker && i > to; i--) {\n walker = walker.prev\n }\n for (; !!walker && i > from; i--, walker = walker.prev) {\n ret.push(walker.value)\n }\n return ret\n }\n\n splice(start: number, deleteCount: number = 0, ...nodes: T[]) {\n if (start > this.length) {\n start = this.length - 1\n }\n if (start < 0) {\n start = this.length + start\n }\n\n let walker = this.head\n\n for (let i = 0; !!walker && i < start; i++) {\n walker = walker.next\n }\n\n const ret: T[] = []\n for (let i = 0; !!walker && i < deleteCount; i++) {\n ret.push(walker.value)\n walker = this.removeNode(walker)\n }\n if (!walker) {\n walker = this.tail\n } else if (walker !== this.tail) {\n walker = walker.prev\n }\n\n for (const v of nodes) {\n walker = insertAfter(this, walker, v)\n }\n\n return ret\n }\n\n reverse() {\n const head = this.head\n const tail = this.tail\n for (let walker = head; !!walker; walker = walker.prev) {\n const p = walker.prev\n walker.prev = walker.next\n walker.next = p\n }\n this.head = tail\n this.tail = head\n return this\n }\n}\n\n// insertAfter undefined means \"make the node the new head of list\"\nfunction insertAfter(\n self: Yallist,\n node: Node | undefined,\n value: T,\n) {\n const prev = node\n const next = node ? node.next : self.head\n const inserted = new Node(value, prev, next, self)\n\n if (inserted.next === undefined) {\n self.tail = inserted\n }\n if (inserted.prev === undefined) {\n self.head = inserted\n }\n\n self.length++\n\n return inserted\n}\n\nfunction push(self: Yallist, item: T) {\n self.tail = new Node(item, self.tail, undefined, self)\n if (!self.head) {\n self.head = self.tail\n }\n self.length++\n}\n\nfunction unshift(self: Yallist, item: T) {\n self.head = new Node(item, undefined, self.head, self)\n if (!self.tail) {\n self.tail = self.head\n }\n self.length++\n}\n\nexport class Node {\n list?: Yallist\n next?: Node\n prev?: Node\n value: T\n\n constructor(\n value: T,\n prev?: Node | undefined,\n next?: Node | undefined,\n list?: Yallist | undefined,\n ) {\n this.list = list\n this.value = value\n\n if (prev) {\n prev.next = this\n this.prev = prev\n } else {\n this.prev = undefined\n }\n\n if (next) {\n next.prev = this\n this.next = next\n } else {\n this.next = undefined\n }\n }\n}\n", "// tar -x\nimport * as fsm from '@isaacs/fs-minipass'\nimport fs from 'node:fs'\nimport { filesFilter } from './list.js'\nimport { makeCommand } from './make-command.js'\nimport { TarOptionsFile, TarOptionsSyncFile } from './options.js'\nimport { Unpack, UnpackSync } from './unpack.js'\n\nconst extractFileSync = (opt: TarOptionsSyncFile) => {\n const u = new UnpackSync(opt)\n const file = opt.file\n const stat = fs.statSync(file)\n // This trades a zero-byte read() syscall for a stat\n // However, it will usually result in less memory allocation\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n const stream = new fsm.ReadStreamSync(file, {\n readSize: readSize,\n size: stat.size,\n })\n stream.pipe(u)\n}\n\nconst extractFile = (opt: TarOptionsFile, _?: string[]) => {\n const u = new Unpack(opt)\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n\n const file = opt.file\n const p = new Promise((resolve, reject) => {\n u.on('error', reject)\n u.on('close', resolve)\n\n // This trades a zero-byte read() syscall for a stat\n // However, it will usually result in less memory allocation\n fs.stat(file, (er, stat) => {\n if (er) {\n reject(er)\n } else {\n const stream = new fsm.ReadStream(file, {\n readSize: readSize,\n size: stat.size,\n })\n stream.on('error', reject)\n stream.pipe(u)\n }\n })\n })\n return p\n}\n\nexport const extract = makeCommand(\n extractFileSync,\n extractFile,\n opt => new UnpackSync(opt),\n opt => new Unpack(opt),\n (opt, files) => {\n if (files?.length) filesFilter(opt, files)\n },\n)\n", "// the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet.\n// but the path reservations are required to avoid race conditions where\n// parallelized unpack ops may mess with one another, due to dependencies\n// (like a Link depending on its target) or destructive operations (like\n// clobbering an fs object to create one of a different type.)\n\nimport * as fsm from '@isaacs/fs-minipass'\nimport assert from 'node:assert'\nimport { randomBytes } from 'node:crypto'\nimport fs, { type Stats } from 'node:fs'\nimport path from 'node:path'\nimport { getWriteFlag } from './get-write-flag.js'\nimport { mkdir, MkdirError, mkdirSync } from './mkdir.js'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport { Parser } from './parse.js'\nimport { stripAbsolutePath } from './strip-absolute-path.js'\nimport * as wc from './winchars.js'\n\nimport { TarOptions } from './options.js'\nimport { PathReservations } from './path-reservations.js'\nimport { ReadEntry } from './read-entry.js'\nimport { WarnData } from './warn-method.js'\nimport { SymlinkError } from './symlink-error.js'\nimport { umask } from './process-umask.js'\n\nconst ONENTRY = Symbol('onEntry')\nconst CHECKFS = Symbol('checkFs')\nconst CHECKFS2 = Symbol('checkFs2')\nconst ISREUSABLE = Symbol('isReusable')\nconst MAKEFS = Symbol('makeFs')\nconst FILE = Symbol('file')\nconst DIRECTORY = Symbol('directory')\nconst LINK = Symbol('link')\nconst SYMLINK = Symbol('symlink')\nconst HARDLINK = Symbol('hardlink')\nconst ENSURE_NO_SYMLINK = Symbol('ensureNoSymlink')\nconst UNSUPPORTED = Symbol('unsupported')\nconst CHECKPATH = Symbol('checkPath')\nconst STRIPABSOLUTEPATH = Symbol('stripAbsolutePath')\nconst MKDIR = Symbol('mkdir')\nconst ONERROR = Symbol('onError')\nconst PENDING = Symbol('pending')\nconst PEND = Symbol('pend')\nconst UNPEND = Symbol('unpend')\nconst ENDED = Symbol('ended')\nconst MAYBECLOSE = Symbol('maybeClose')\nconst SKIP = Symbol('skip')\nconst DOCHOWN = Symbol('doChown')\nconst UID = Symbol('uid')\nconst GID = Symbol('gid')\nconst CHECKED_CWD = Symbol('checkedCwd')\nconst platform =\n process.env.TESTING_TAR_FAKE_PLATFORM || process.platform\nconst isWindows = platform === 'win32'\nconst DEFAULT_MAX_DEPTH = 1024\n\n// Unlinks on Windows are not atomic.\n//\n// This means that if you have a file entry, followed by another\n// file entry with an identical name, and you cannot re-use the file\n// (because it's a hardlink, or because unlink:true is set, or it's\n// Windows, which does not have useful nlink values), then the unlink\n// will be committed to the disk AFTER the new file has been written\n// over the old one, deleting the new file.\n//\n// To work around this, on Windows systems, we rename the file and then\n// delete the renamed file. It's a sloppy kludge, but frankly, I do not\n// know of a better way to do this, given windows' non-atomic unlink\n// semantics.\n//\n// See: https://github.com/npm/node-tar/issues/183\n/* c8 ignore start */\nconst unlinkFile = (\n path: string,\n cb: (er?: Error | null) => void,\n) => {\n if (!isWindows) {\n return fs.unlink(path, cb)\n }\n\n const name = path + '.DELETE.' + randomBytes(16).toString('hex')\n fs.rename(path, name, er => {\n if (er) {\n return cb(er)\n }\n fs.unlink(name, cb)\n })\n}\n/* c8 ignore stop */\n\n/* c8 ignore start */\nconst unlinkFileSync = (path: string) => {\n if (!isWindows) {\n return fs.unlinkSync(path)\n }\n\n const name = path + '.DELETE.' + randomBytes(16).toString('hex')\n fs.renameSync(path, name)\n fs.unlinkSync(name)\n}\n/* c8 ignore stop */\n\n// this.gid, entry.gid, this.processUid\nconst uint32 = (\n a: number | undefined,\n b: number | undefined,\n c: number | undefined,\n) =>\n a !== undefined && a === a >>> 0 ? a\n : b !== undefined && b === b >>> 0 ? b\n : c\n\nexport class Unpack extends Parser {\n [ENDED]: boolean = false;\n [CHECKED_CWD]: boolean = false;\n [PENDING]: number = 0\n\n reservations: PathReservations = new PathReservations()\n transform?: TarOptions['transform']\n writable: true = true\n readable: false = false\n uid?: number\n gid?: number\n setOwner: boolean\n preserveOwner: boolean\n processGid?: number\n processUid?: number\n maxDepth: number\n forceChown: boolean\n win32: boolean\n newer: boolean\n keep: boolean\n noMtime: boolean\n preservePaths: boolean\n unlink: boolean\n cwd: string\n strip: number\n processUmask: number\n umask: number\n dmode: number\n fmode: number\n chmod: boolean\n\n constructor(opt: TarOptions = {}) {\n opt.ondone = () => {\n this[ENDED] = true\n this[MAYBECLOSE]()\n }\n\n super(opt)\n\n this.transform = opt.transform\n\n this.chmod = !!opt.chmod\n\n if (typeof opt.uid === 'number' || typeof opt.gid === 'number') {\n // need both or neither\n if (\n typeof opt.uid !== 'number' ||\n typeof opt.gid !== 'number'\n ) {\n throw new TypeError(\n 'cannot set owner without number uid and gid',\n )\n }\n if (opt.preserveOwner) {\n throw new TypeError(\n 'cannot preserve owner in archive and also set owner explicitly',\n )\n }\n this.uid = opt.uid\n this.gid = opt.gid\n this.setOwner = true\n } else {\n this.uid = undefined\n this.gid = undefined\n this.setOwner = false\n }\n\n // default true for root\n if (\n opt.preserveOwner === undefined &&\n typeof opt.uid !== 'number'\n ) {\n this.preserveOwner = !!(\n process.getuid && process.getuid() === 0\n )\n } else {\n this.preserveOwner = !!opt.preserveOwner\n }\n\n this.processUid =\n (this.preserveOwner || this.setOwner) && process.getuid ?\n process.getuid()\n : undefined\n this.processGid =\n (this.preserveOwner || this.setOwner) && process.getgid ?\n process.getgid()\n : undefined\n\n // prevent excessively deep nesting of subfolders\n // set to `Infinity` to remove this restriction\n this.maxDepth =\n typeof opt.maxDepth === 'number' ?\n opt.maxDepth\n : DEFAULT_MAX_DEPTH\n\n // mostly just for testing, but useful in some cases.\n // Forcibly trigger a chown on every entry, no matter what\n this.forceChown = opt.forceChown === true\n\n // turn > this[ONENTRY](entry))\n }\n\n // a bad or damaged archive is a warning for Parser, but an error\n // when extracting. Mark those errors as unrecoverable, because\n // the Unpack contract cannot be met.\n warn(code: string, msg: string | Error, data: WarnData = {}) {\n if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') {\n data.recoverable = false\n }\n return super.warn(code, msg, data)\n }\n\n [MAYBECLOSE]() {\n if (this[ENDED] && this[PENDING] === 0) {\n this.emit('prefinish')\n this.emit('finish')\n this.emit('end')\n }\n }\n\n // return false if we need to skip this file\n // return true if the field was successfully sanitized\n [STRIPABSOLUTEPATH](\n entry: ReadEntry,\n field: 'path' | 'linkpath',\n ): boolean {\n const p = entry[field]\n const { type } = entry\n if (!p || this.preservePaths) return true\n\n const parts = p.split('/')\n\n if (\n parts.includes('..') ||\n /* c8 ignore next */\n (isWindows && /^[a-z]:\\.\\.$/i.test(parts[0] ?? ''))\n ) {\n // For linkpath, check if the resolved path escapes cwd rather than\n // just rejecting any path with '..' - relative symlinks like\n // '../sibling/file' are valid if they resolve within the cwd.\n // For paths, they just simply may not ever use .. at all.\n if (field === 'path' || type === 'Link') {\n this.warn('TAR_ENTRY_ERROR', `${field} contains '..'`, {\n entry,\n [field]: p,\n })\n // not ok!\n return false\n } else {\n // Resolve linkpath relative to the entry's directory.\n // `path.posix` is safe to use because we're operating on\n // tar paths, not a filesystem.\n const entryDir = path.posix.dirname(entry.path)\n const resolved = path.posix.normalize(\n path.posix.join(entryDir, p),\n )\n // If the resolved path escapes (starts with ..), reject it\n if (resolved.startsWith('../') || resolved === '..') {\n this.warn(\n 'TAR_ENTRY_ERROR',\n `${field} escapes extraction directory`,\n {\n entry,\n [field]: p,\n },\n )\n return false\n }\n }\n }\n\n // strip off the root\n const [root, stripped] = stripAbsolutePath(p)\n if (root) {\n // ok, but triggers warning about stripping root\n entry[field] = String(stripped)\n this.warn(\n 'TAR_ENTRY_INFO',\n `stripping ${root} from absolute ${field}`,\n {\n entry,\n [field]: p,\n },\n )\n }\n return true\n }\n\n // no IO, just string checking for absolute indicators\n [CHECKPATH](entry: ReadEntry) {\n const p = normalizeWindowsPath(entry.path)\n const parts = p.split('/')\n\n if (this.strip) {\n if (parts.length < this.strip) {\n return false\n }\n if (entry.type === 'Link') {\n const linkparts = normalizeWindowsPath(\n String(entry.linkpath),\n ).split('/')\n if (linkparts.length >= this.strip) {\n entry.linkpath = linkparts.slice(this.strip).join('/')\n } else {\n return false\n }\n }\n parts.splice(0, this.strip)\n entry.path = parts.join('/')\n }\n\n if (isFinite(this.maxDepth) && parts.length > this.maxDepth) {\n this.warn('TAR_ENTRY_ERROR', 'path excessively deep', {\n entry,\n path: p,\n depth: parts.length,\n maxDepth: this.maxDepth,\n })\n return false\n }\n\n if (\n !this[STRIPABSOLUTEPATH](entry, 'path') ||\n !this[STRIPABSOLUTEPATH](entry, 'linkpath')\n ) {\n return false\n }\n\n if (path.isAbsolute(entry.path)) {\n entry.absolute = normalizeWindowsPath(path.resolve(entry.path))\n } else {\n entry.absolute = normalizeWindowsPath(\n path.resolve(this.cwd, entry.path),\n )\n }\n\n // if we somehow ended up with a path that escapes the cwd, and we are\n // not in preservePaths mode, then something is fishy! This should have\n // been prevented above, so ignore this for coverage.\n /* c8 ignore start - defense in depth */\n if (\n !this.preservePaths &&\n typeof entry.absolute === 'string' &&\n entry.absolute.indexOf(this.cwd + '/') !== 0 &&\n entry.absolute !== this.cwd\n ) {\n this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', {\n entry,\n path: normalizeWindowsPath(entry.path),\n resolvedPath: entry.absolute,\n cwd: this.cwd,\n })\n return false\n }\n /* c8 ignore stop */\n\n // an archive can set properties on the extraction directory, but it\n // may not replace the cwd with a different kind of thing entirely.\n if (\n entry.absolute === this.cwd &&\n entry.type !== 'Directory' &&\n entry.type !== 'GNUDumpDir'\n ) {\n return false\n }\n\n // only encode : chars that aren't drive letter indicators\n if (this.win32) {\n const { root: aRoot } = path.win32.parse(String(entry.absolute))\n entry.absolute =\n aRoot + wc.encode(String(entry.absolute).slice(aRoot.length))\n const { root: pRoot } = path.win32.parse(entry.path)\n entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length))\n }\n\n return true\n }\n\n [ONENTRY](entry: ReadEntry) {\n if (!this[CHECKPATH](entry)) {\n return entry.resume()\n }\n\n assert.equal(typeof entry.absolute, 'string')\n\n switch (entry.type) {\n case 'Directory':\n case 'GNUDumpDir':\n if (entry.mode) {\n entry.mode = entry.mode | 0o700\n }\n\n // eslint-disable-next-line no-fallthrough\n case 'File':\n case 'OldFile':\n case 'ContiguousFile':\n case 'Link':\n case 'SymbolicLink':\n return this[CHECKFS](entry)\n\n case 'CharacterDevice':\n case 'BlockDevice':\n case 'FIFO':\n default:\n return this[UNSUPPORTED](entry)\n }\n }\n\n [ONERROR](er: Error, entry: ReadEntry) {\n // Cwd has to exist, or else nothing works. That's serious.\n // Other errors are warnings, which raise the error in strict\n // mode, but otherwise continue on.\n if (er.name === 'CwdError') {\n this.emit('error', er)\n } else {\n this.warn('TAR_ENTRY_ERROR', er, { entry })\n this[UNPEND]()\n entry.resume()\n }\n }\n\n [MKDIR](\n dir: string,\n mode: number,\n cb: (er?: null | MkdirError, made?: string) => void,\n ) {\n mkdir(\n normalizeWindowsPath(dir),\n {\n uid: this.uid,\n gid: this.gid,\n processUid: this.processUid,\n processGid: this.processGid,\n umask: this.processUmask,\n preserve: this.preservePaths,\n unlink: this.unlink,\n cwd: this.cwd,\n mode: mode,\n },\n cb,\n )\n }\n\n [DOCHOWN](entry: ReadEntry) {\n // in preserve owner mode, chown if the entry doesn't match process\n // in set owner mode, chown if setting doesn't match process\n return (\n this.forceChown ||\n (this.preserveOwner &&\n ((typeof entry.uid === 'number' &&\n entry.uid !== this.processUid) ||\n (typeof entry.gid === 'number' &&\n entry.gid !== this.processGid))) ||\n (typeof this.uid === 'number' &&\n this.uid !== this.processUid) ||\n (typeof this.gid === 'number' && this.gid !== this.processGid)\n )\n }\n\n [UID](entry: ReadEntry) {\n return uint32(this.uid, entry.uid, this.processUid)\n }\n\n [GID](entry: ReadEntry) {\n return uint32(this.gid, entry.gid, this.processGid)\n }\n\n [FILE](entry: ReadEntry, fullyDone: () => void) {\n const mode =\n typeof entry.mode === 'number' ?\n entry.mode & 0o7777\n : this.fmode\n const stream = new fsm.WriteStream(String(entry.absolute), {\n // slight lie, but it can be numeric flags\n flags: getWriteFlag(entry.size) as string,\n mode: mode,\n autoClose: false,\n })\n stream.on('error', (er: Error) => {\n if (stream.fd) {\n fs.close(stream.fd, () => {})\n }\n\n // flush all the data out so that we aren't left hanging\n // if the error wasn't actually fatal. otherwise the parse\n // is blocked, and we never proceed.\n stream.write = () => true\n this[ONERROR](er, entry)\n fullyDone()\n })\n\n let actions = 1\n const done = (er?: null | Error) => {\n if (er) {\n /* c8 ignore start - we should always have a fd by now */\n if (stream.fd) {\n fs.close(stream.fd, () => {})\n }\n /* c8 ignore stop */\n\n this[ONERROR](er, entry)\n fullyDone()\n return\n }\n\n if (--actions === 0) {\n if (stream.fd !== undefined) {\n fs.close(stream.fd, er => {\n if (er) {\n this[ONERROR](er, entry)\n } else {\n this[UNPEND]()\n }\n fullyDone()\n })\n }\n }\n }\n\n stream.on('finish', () => {\n // if futimes fails, try utimes\n // if utimes fails, fail with the original error\n // same for fchown/chown\n const abs = String(entry.absolute)\n const fd = stream.fd\n\n if (typeof fd === 'number' && entry.mtime && !this.noMtime) {\n actions++\n const atime = entry.atime || new Date()\n const mtime = entry.mtime\n fs.futimes(fd, atime, mtime, er =>\n er ?\n fs.utimes(abs, atime, mtime, er2 => done(er2 && er))\n : done(),\n )\n }\n\n if (typeof fd === 'number' && this[DOCHOWN](entry)) {\n actions++\n const uid = this[UID](entry)\n const gid = this[GID](entry)\n if (typeof uid === 'number' && typeof gid === 'number') {\n fs.fchown(fd, uid, gid, er =>\n er ?\n fs.chown(abs, uid, gid, er2 => done(er2 && er))\n : done(),\n )\n }\n }\n\n done()\n })\n\n const tx = this.transform ? this.transform(entry) || entry : entry\n if (tx !== entry) {\n tx.on('error', (er: Error) => {\n this[ONERROR](er, entry)\n fullyDone()\n })\n entry.pipe(tx)\n }\n tx.pipe(stream)\n }\n\n [DIRECTORY](entry: ReadEntry, fullyDone: () => void) {\n const mode =\n typeof entry.mode === 'number' ?\n entry.mode & 0o7777\n : this.dmode\n this[MKDIR](String(entry.absolute), mode, er => {\n if (er) {\n this[ONERROR](er, entry)\n fullyDone()\n return\n }\n\n let actions = 1\n const done = () => {\n if (--actions === 0) {\n fullyDone()\n this[UNPEND]()\n entry.resume()\n }\n }\n\n if (entry.mtime && !this.noMtime) {\n actions++\n fs.utimes(\n String(entry.absolute),\n entry.atime || new Date(),\n entry.mtime,\n done,\n )\n }\n\n if (this[DOCHOWN](entry)) {\n actions++\n fs.chown(\n String(entry.absolute),\n Number(this[UID](entry)),\n Number(this[GID](entry)),\n done,\n )\n }\n\n done()\n })\n }\n\n [UNSUPPORTED](entry: ReadEntry) {\n entry.unsupported = true\n this.warn(\n 'TAR_ENTRY_UNSUPPORTED',\n `unsupported entry type: ${entry.type}`,\n { entry },\n )\n entry.resume()\n }\n\n [SYMLINK](entry: ReadEntry, done: () => void) {\n const parts = normalizeWindowsPath(\n path.relative(\n this.cwd,\n path.resolve(\n path.dirname(String(entry.absolute)),\n String(entry.linkpath),\n ),\n ),\n ).split('/')\n this[ENSURE_NO_SYMLINK](\n entry,\n this.cwd,\n parts,\n () =>\n this[LINK](entry, String(entry.linkpath), 'symlink', done),\n er => {\n this[ONERROR](er, entry)\n done()\n },\n )\n }\n\n [HARDLINK](entry: ReadEntry, done: () => void) {\n const linkpath = normalizeWindowsPath(\n path.resolve(this.cwd, String(entry.linkpath)),\n )\n const parts = normalizeWindowsPath(String(entry.linkpath)).split(\n '/',\n )\n this[ENSURE_NO_SYMLINK](\n entry,\n this.cwd,\n parts,\n () => this[LINK](entry, linkpath, 'link', done),\n er => {\n this[ONERROR](er, entry)\n done()\n },\n )\n }\n\n [ENSURE_NO_SYMLINK](\n entry: ReadEntry,\n cwd: string,\n parts: string[],\n done: () => void,\n onError: (er: SymlinkError) => void,\n ) {\n const p = parts.shift()\n if (this.preservePaths || p === undefined) return done()\n const t = path.resolve(cwd, p)\n fs.lstat(t, (er, st) => {\n if (er) return done()\n if (st?.isSymbolicLink()) {\n return onError(\n new SymlinkError(t, path.resolve(t, parts.join('/'))),\n )\n }\n this[ENSURE_NO_SYMLINK](entry, t, parts, done, onError)\n })\n }\n\n [PEND]() {\n this[PENDING]++\n }\n\n [UNPEND]() {\n this[PENDING]--\n this[MAYBECLOSE]()\n }\n\n [SKIP](entry: ReadEntry) {\n this[UNPEND]()\n entry.resume()\n }\n\n // Check if we can reuse an existing filesystem entry safely and\n // overwrite it, rather than unlinking and recreating\n // Windows doesn't report a useful nlink, so we just never reuse entries\n [ISREUSABLE](entry: ReadEntry, st: Stats) {\n return (\n entry.type === 'File' &&\n !this.unlink &&\n st.isFile() &&\n st.nlink <= 1 &&\n !isWindows\n )\n }\n\n // check if a thing is there, and if so, try to clobber it\n [CHECKFS](entry: ReadEntry) {\n this[PEND]()\n const paths = [entry.path]\n if (entry.linkpath) {\n paths.push(entry.linkpath)\n }\n this.reservations.reserve(paths, done =>\n this[CHECKFS2](entry, done),\n )\n }\n\n [CHECKFS2](entry: ReadEntry, fullyDone: (er?: Error) => void) {\n const done = (er?: Error) => {\n fullyDone(er)\n }\n\n const checkCwd = () => {\n this[MKDIR](this.cwd, this.dmode, er => {\n if (er) {\n this[ONERROR](er, entry)\n done()\n return\n }\n this[CHECKED_CWD] = true\n start()\n })\n }\n\n const start = () => {\n if (entry.absolute !== this.cwd) {\n const parent = normalizeWindowsPath(\n path.dirname(String(entry.absolute)),\n )\n if (parent !== this.cwd) {\n return this[MKDIR](parent, this.dmode, er => {\n if (er) {\n this[ONERROR](er, entry)\n done()\n return\n }\n afterMakeParent()\n })\n }\n }\n afterMakeParent()\n }\n\n const afterMakeParent = () => {\n fs.lstat(String(entry.absolute), (lstatEr, st) => {\n if (\n st &&\n (this.keep ||\n /* c8 ignore next */\n (this.newer && st.mtime > (entry.mtime ?? st.mtime)))\n ) {\n this[SKIP](entry)\n done()\n return\n }\n if (lstatEr || this[ISREUSABLE](entry, st)) {\n return this[MAKEFS](null, entry, done)\n }\n\n if (st.isDirectory()) {\n if (entry.type === 'Directory') {\n const needChmod =\n this.chmod &&\n entry.mode &&\n (st.mode & 0o7777) !== entry.mode\n const afterChmod = (er?: Error | null | undefined) =>\n this[MAKEFS](er ?? null, entry, done)\n if (!needChmod) {\n return afterChmod()\n }\n return fs.chmod(\n String(entry.absolute),\n Number(entry.mode),\n afterChmod,\n )\n }\n // Not a dir entry, have to remove it.\n // NB: the only way to end up with an entry that is the cwd\n // itself, in such a way that == does not detect, is a\n // tricky windows absolute path with UNC or 8.3 parts (and\n // preservePaths:true, or else it will have been stripped).\n // In that case, the user has opted out of path protections\n // explicitly, so if they blow away the cwd, c'est la vie.\n if (entry.absolute !== this.cwd) {\n return fs.rmdir(\n String(entry.absolute),\n (er?: null | Error) =>\n this[MAKEFS](er ?? null, entry, done),\n )\n }\n }\n\n // not a dir, and not reusable\n // don't remove if the cwd, we want that error\n if (entry.absolute === this.cwd) {\n return this[MAKEFS](null, entry, done)\n }\n\n unlinkFile(String(entry.absolute), er =>\n this[MAKEFS](er ?? null, entry, done),\n )\n })\n }\n\n if (this[CHECKED_CWD]) {\n start()\n } else {\n checkCwd()\n }\n }\n\n [MAKEFS](\n er: null | undefined | Error,\n entry: ReadEntry,\n done: () => void,\n ) {\n if (er) {\n this[ONERROR](er, entry)\n done()\n return\n }\n\n switch (entry.type) {\n case 'File':\n case 'OldFile':\n case 'ContiguousFile':\n return this[FILE](entry, done)\n\n case 'Link':\n return this[HARDLINK](entry, done)\n\n case 'SymbolicLink':\n return this[SYMLINK](entry, done)\n\n case 'Directory':\n case 'GNUDumpDir':\n return this[DIRECTORY](entry, done)\n }\n }\n\n [LINK](\n entry: ReadEntry,\n linkpath: string,\n link: 'link' | 'symlink',\n done: () => void,\n ) {\n fs[link](linkpath, String(entry.absolute), er => {\n if (er) {\n this[ONERROR](er, entry)\n } else {\n this[UNPEND]()\n entry.resume()\n }\n done()\n })\n }\n}\n\nconst callSync = (\n fn: () => T,\n): [null, T] | [NodeJS.ErrnoException, null] => {\n try {\n return [null, fn()]\n } catch (er) {\n return [er as NodeJS.ErrnoException, null]\n }\n}\n\nexport class UnpackSync extends Unpack {\n sync: true = true;\n\n [MAKEFS](er: null | Error | undefined, entry: ReadEntry) {\n return super[MAKEFS](er, entry, () => {})\n }\n\n [CHECKFS](entry: ReadEntry) {\n if (!this[CHECKED_CWD]) {\n const er = this[MKDIR](this.cwd, this.dmode)\n if (er) {\n return this[ONERROR](er as Error, entry)\n }\n this[CHECKED_CWD] = true\n }\n\n // don't bother to make the parent if the current entry is the cwd,\n // we've already checked it.\n if (entry.absolute !== this.cwd) {\n const parent = normalizeWindowsPath(\n path.dirname(String(entry.absolute)),\n )\n if (parent !== this.cwd) {\n const mkParent = this[MKDIR](parent, this.dmode)\n if (mkParent) {\n return this[ONERROR](mkParent as Error, entry)\n }\n }\n }\n\n const [lstatEr, st] = callSync(() =>\n fs.lstatSync(String(entry.absolute)),\n )\n if (\n st &&\n (this.keep ||\n /* c8 ignore next */\n (this.newer && st.mtime > (entry.mtime ?? st.mtime)))\n ) {\n return this[SKIP](entry)\n }\n\n if (lstatEr || this[ISREUSABLE](entry, st)) {\n return this[MAKEFS](null, entry)\n }\n\n if (st.isDirectory()) {\n if (entry.type === 'Directory') {\n const needChmod =\n this.chmod &&\n entry.mode &&\n (st.mode & 0o7777) !== entry.mode\n const [er] =\n needChmod ?\n callSync(() => {\n fs.chmodSync(String(entry.absolute), Number(entry.mode))\n })\n : []\n return this[MAKEFS](er, entry)\n }\n // not a dir entry, have to remove it\n const [er] = callSync(() =>\n fs.rmdirSync(String(entry.absolute)),\n )\n this[MAKEFS](er, entry)\n }\n\n // not a dir, and not reusable.\n // don't remove if it's the cwd, since we want that error.\n const [er] =\n entry.absolute === this.cwd ?\n []\n : callSync(() => unlinkFileSync(String(entry.absolute)))\n this[MAKEFS](er, entry)\n }\n\n [FILE](entry: ReadEntry, done: () => void) {\n const mode =\n typeof entry.mode === 'number' ?\n entry.mode & 0o7777\n : this.fmode\n\n const oner = (er?: null | Error | undefined) => {\n let closeError\n try {\n fs.closeSync(fd)\n } catch (e) {\n closeError = e\n }\n if (er || closeError) {\n this[ONERROR]((er as Error) || closeError, entry)\n }\n done()\n }\n\n let fd: number\n try {\n fd = fs.openSync(\n String(entry.absolute),\n getWriteFlag(entry.size),\n mode,\n )\n /* c8 ignore start - This is only a problem if the file was successfully\n * statted, BUT failed to open. Testing this is annoying, and we\n * already have ample testint for other uses of oner() methods.\n */\n } catch (er) {\n return oner(er as Error)\n }\n /* c8 ignore stop */\n const tx = this.transform ? this.transform(entry) || entry : entry\n if (tx !== entry) {\n tx.on('error', (er: Error) => this[ONERROR](er, entry))\n entry.pipe(tx)\n }\n\n tx.on('data', (chunk: Buffer) => {\n try {\n fs.writeSync(fd, chunk, 0, chunk.length)\n } catch (er) {\n oner(er as Error)\n }\n })\n\n tx.on('end', () => {\n let er = null\n // try both, falling futimes back to utimes\n // if either fails, handle the first error\n if (entry.mtime && !this.noMtime) {\n const atime = entry.atime || new Date()\n const mtime = entry.mtime\n try {\n fs.futimesSync(fd, atime, mtime)\n } catch (futimeser) {\n try {\n fs.utimesSync(String(entry.absolute), atime, mtime)\n } catch (utimeser) {\n er = futimeser\n }\n }\n }\n\n if (this[DOCHOWN](entry)) {\n const uid = this[UID](entry)\n const gid = this[GID](entry)\n\n try {\n fs.fchownSync(fd, Number(uid), Number(gid))\n } catch (fchowner) {\n try {\n fs.chownSync(\n String(entry.absolute),\n Number(uid),\n Number(gid),\n )\n } catch (chowner) {\n er = er || fchowner\n }\n }\n }\n\n oner(er as Error)\n })\n }\n\n [DIRECTORY](entry: ReadEntry, done: () => void) {\n const mode =\n typeof entry.mode === 'number' ?\n entry.mode & 0o7777\n : this.dmode\n const er = this[MKDIR](String(entry.absolute), mode)\n if (er) {\n this[ONERROR](er as Error, entry)\n done()\n return\n }\n if (entry.mtime && !this.noMtime) {\n try {\n fs.utimesSync(\n String(entry.absolute),\n entry.atime || new Date(),\n entry.mtime,\n )\n /* c8 ignore next */\n } catch (er) {}\n }\n if (this[DOCHOWN](entry)) {\n try {\n fs.chownSync(\n String(entry.absolute),\n Number(this[UID](entry)),\n Number(this[GID](entry)),\n )\n } catch (er) {}\n }\n done()\n entry.resume()\n }\n\n [MKDIR](dir: string, mode: number) {\n try {\n return mkdirSync(normalizeWindowsPath(dir), {\n uid: this.uid,\n gid: this.gid,\n processUid: this.processUid,\n processGid: this.processGid,\n umask: this.processUmask,\n preserve: this.preservePaths,\n unlink: this.unlink,\n cwd: this.cwd,\n mode: mode,\n })\n } catch (er) {\n return er\n }\n }\n\n [ENSURE_NO_SYMLINK](\n _entry: ReadEntry,\n cwd: string,\n parts: string[],\n done: () => void,\n onError: (er: SymlinkError) => void,\n ) {\n if (this.preservePaths || !parts.length) return done()\n let t = cwd\n for (const p of parts) {\n t = path.resolve(t, p)\n const [er, st] = callSync(() => fs.lstatSync(t))\n if (er) return done()\n if (st.isSymbolicLink()) {\n return onError(\n new SymlinkError(t, path.resolve(cwd, parts.join('/'))),\n )\n }\n }\n done()\n }\n\n [LINK](\n entry: ReadEntry,\n linkpath: string,\n link: 'link' | 'symlink',\n done: () => void,\n ) {\n const linkSync: `${typeof link}Sync` = `${link}Sync`\n try {\n fs[linkSync](linkpath, String(entry.absolute))\n done()\n entry.resume()\n } catch (er) {\n return this[ONERROR](er as Error, entry)\n }\n }\n}\n", "// Get the appropriate flag to use for creating files\n// We use fmap on Windows platforms for files less than\n// 512kb. This is a fairly low limit, but avoids making\n// things slower in some cases. Since most of what this\n// library is used for is extracting tarballs of many\n// relatively small files in npm packages and the like,\n// it can be a big boost on Windows platforms.\n\nimport fs from 'fs'\n\nconst platform = process.env.__FAKE_PLATFORM__ || process.platform\nconst isWindows = platform === 'win32'\n\n/* c8 ignore start */\nconst { O_CREAT, O_TRUNC, O_WRONLY } = fs.constants\nconst UV_FS_O_FILEMAP =\n Number(process.env.__FAKE_FS_O_FILENAME__) ||\n fs.constants.UV_FS_O_FILEMAP ||\n 0\n/* c8 ignore stop */\n\nconst fMapEnabled = isWindows && !!UV_FS_O_FILEMAP\nconst fMapLimit = 512 * 1024\nconst fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY\nexport const getWriteFlag =\n !fMapEnabled ?\n () => 'w'\n : (size: number) => (size < fMapLimit ? fMapFlag : 'w')\n", "import fs, { type Dirent } from 'node:fs'\nimport path from 'node:path'\n\nconst lchownSync = (path: string, uid: number, gid: number) => {\n try {\n return fs.lchownSync(path, uid, gid)\n } catch (er) {\n if ((er as NodeJS.ErrnoException)?.code !== 'ENOENT') throw er\n }\n}\n\nconst chown = (\n cpath: string,\n uid: number,\n gid: number,\n cb: (er?: unknown) => any,\n) => {\n fs.lchown(cpath, uid, gid, er => {\n // Skip ENOENT error\n cb(er && (er as NodeJS.ErrnoException)?.code !== 'ENOENT' ? er : null)\n })\n}\n\nconst chownrKid = (\n p: string,\n child: Dirent,\n uid: number,\n gid: number,\n cb: (er?: unknown) => any,\n) => {\n if (child.isDirectory()) {\n chownr(path.resolve(p, child.name), uid, gid, (er: unknown) => {\n if (er) return cb(er)\n const cpath = path.resolve(p, child.name)\n chown(cpath, uid, gid, cb)\n })\n } else {\n const cpath = path.resolve(p, child.name)\n chown(cpath, uid, gid, cb)\n }\n}\n\nexport const chownr = (\n p: string,\n uid: number,\n gid: number,\n cb: (er?: unknown) => any,\n) => {\n fs.readdir(p, { withFileTypes: true }, (er, children) => {\n // any error other than ENOTDIR or ENOTSUP means it's not readable,\n // or doesn't exist. give up.\n if (er) {\n if (er.code === 'ENOENT') return cb()\n else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP')\n return cb(er)\n }\n if (er || !children.length) return chown(p, uid, gid, cb)\n\n let len = children.length\n let errState: null | NodeJS.ErrnoException = null\n const then = (er?: unknown) => {\n /* c8 ignore start */\n if (errState) return\n /* c8 ignore stop */\n if (er) return cb((errState = er as NodeJS.ErrnoException))\n if (--len === 0) return chown(p, uid, gid, cb)\n }\n\n for (const child of children) {\n chownrKid(p, child, uid, gid, then)\n }\n })\n}\n\nconst chownrKidSync = (\n p: string,\n child: Dirent,\n uid: number,\n gid: number,\n) => {\n if (child.isDirectory())\n chownrSync(path.resolve(p, child.name), uid, gid)\n\n lchownSync(path.resolve(p, child.name), uid, gid)\n}\n\nexport const chownrSync = (p: string, uid: number, gid: number) => {\n let children: Dirent[]\n try {\n children = fs.readdirSync(p, { withFileTypes: true })\n } catch (er) {\n const e = er as NodeJS.ErrnoException\n if (e?.code === 'ENOENT') return\n else if (e?.code === 'ENOTDIR' || e?.code === 'ENOTSUP')\n return lchownSync(p, uid, gid)\n else throw e\n }\n\n for (const child of children) {\n chownrKidSync(p, child, uid, gid)\n }\n\n return lchownSync(p, uid, gid)\n}\n", "import { chownr, chownrSync } from 'chownr'\nimport fs from 'node:fs'\nimport fsp from 'node:fs/promises'\nimport path from 'node:path'\nimport { CwdError } from './cwd-error.js'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport { SymlinkError } from './symlink-error.js'\n\nexport type MkdirOptions = {\n uid?: number\n gid?: number\n processUid?: number\n processGid?: number\n umask?: number\n preserve: boolean\n unlink: boolean\n cwd: string\n mode: number\n}\n\nexport type MkdirError =\n | NodeJS.ErrnoException\n | CwdError\n | SymlinkError\n\nconst checkCwd = (\n dir: string,\n cb: (er?: null | MkdirError) => any,\n) => {\n fs.stat(dir, (er, st) => {\n if (er || !st.isDirectory()) {\n er = new CwdError(\n dir,\n (er as NodeJS.ErrnoException)?.code || 'ENOTDIR',\n )\n }\n cb(er)\n })\n}\n\n/**\n * Wrapper around fs/promises.mkdir for tar's needs.\n *\n * The main purpose is to avoid creating directories if we know that\n * they already exist (and track which ones exist for this purpose),\n * and prevent entries from being extracted into symlinked folders,\n * if `preservePaths` is not set.\n */\nexport const mkdir = (\n dir: string,\n opt: MkdirOptions,\n cb: (er?: null | MkdirError, made?: string) => void,\n) => {\n dir = normalizeWindowsPath(dir)\n\n // if there's any overlap between mask and mode,\n // then we'll need an explicit chmod\n /* c8 ignore next */\n const umask = opt.umask ?? 0o22\n const mode = opt.mode | 0o0700\n const needChmod = (mode & umask) !== 0\n\n const uid = opt.uid\n const gid = opt.gid\n const doChown =\n typeof uid === 'number' &&\n typeof gid === 'number' &&\n (uid !== opt.processUid || gid !== opt.processGid)\n\n const preserve = opt.preserve\n const unlink = opt.unlink\n const cwd = normalizeWindowsPath(opt.cwd)\n\n const done = (er?: null | MkdirError, created?: string) => {\n if (er) {\n cb(er)\n } else {\n if (created && doChown) {\n chownr(created, uid, gid, er =>\n done(er as NodeJS.ErrnoException),\n )\n } else if (needChmod) {\n fs.chmod(dir, mode, cb)\n } else {\n cb()\n }\n }\n }\n\n if (dir === cwd) {\n return checkCwd(dir, done)\n }\n\n if (preserve) {\n return fsp.mkdir(dir, { mode, recursive: true }).then(\n made => done(null, made ?? undefined), // oh, ts\n done,\n )\n }\n\n const sub = normalizeWindowsPath(path.relative(cwd, dir))\n const parts = sub.split('/')\n mkdir_(cwd, parts, mode, unlink, cwd, undefined, done)\n}\n\nconst mkdir_ = (\n base: string,\n parts: string[],\n mode: number,\n unlink: boolean,\n cwd: string,\n created: string | undefined,\n cb: (er?: null | MkdirError, made?: string) => void,\n): void => {\n if (!parts.length) {\n return cb(null, created)\n }\n const p = parts.shift()\n const part = normalizeWindowsPath(path.resolve(base + '/' + p))\n fs.mkdir(\n part,\n mode,\n onmkdir(part, parts, mode, unlink, cwd, created, cb),\n )\n}\n\nconst onmkdir =\n (\n part: string,\n parts: string[],\n mode: number,\n unlink: boolean,\n cwd: string,\n created: string | undefined,\n cb: (er?: null | MkdirError, made?: string) => void,\n ) =>\n (er?: null | NodeJS.ErrnoException) => {\n if (er) {\n fs.lstat(part, (statEr, st) => {\n if (statEr) {\n statEr.path =\n statEr.path && normalizeWindowsPath(statEr.path)\n cb(statEr)\n } else if (st.isDirectory()) {\n mkdir_(part, parts, mode, unlink, cwd, created, cb)\n } else if (unlink) {\n fs.unlink(part, er => {\n if (er) {\n return cb(er)\n }\n fs.mkdir(\n part,\n mode,\n onmkdir(part, parts, mode, unlink, cwd, created, cb),\n )\n })\n } else if (st.isSymbolicLink()) {\n return cb(\n new SymlinkError(part, part + '/' + parts.join('/')),\n )\n } else {\n cb(er)\n }\n })\n } else {\n created = created || part\n mkdir_(part, parts, mode, unlink, cwd, created, cb)\n }\n }\n\nconst checkCwdSync = (dir: string) => {\n let ok = false\n let code: string | undefined = undefined\n try {\n ok = fs.statSync(dir).isDirectory()\n } catch (er) {\n code = (er as NodeJS.ErrnoException)?.code\n } finally {\n if (!ok) {\n throw new CwdError(dir, code ?? 'ENOTDIR')\n }\n }\n}\n\nexport const mkdirSync = (dir: string, opt: MkdirOptions) => {\n dir = normalizeWindowsPath(dir)\n // if there's any overlap between mask and mode,\n // then we'll need an explicit chmod\n /* c8 ignore next */\n const umask = opt.umask ?? 0o22\n const mode = opt.mode | 0o700\n const needChmod = (mode & umask) !== 0\n\n const uid = opt.uid\n const gid = opt.gid\n const doChown =\n typeof uid === 'number' &&\n typeof gid === 'number' &&\n (uid !== opt.processUid || gid !== opt.processGid)\n\n const preserve = opt.preserve\n const unlink = opt.unlink\n const cwd = normalizeWindowsPath(opt.cwd)\n\n const done = (created?: string | undefined) => {\n if (created && doChown) {\n chownrSync(created, uid, gid)\n }\n if (needChmod) {\n fs.chmodSync(dir, mode)\n }\n }\n\n if (dir === cwd) {\n checkCwdSync(cwd)\n return done()\n }\n\n if (preserve) {\n return done(\n fs.mkdirSync(dir, { mode, recursive: true }) ?? undefined,\n )\n }\n\n const sub = normalizeWindowsPath(path.relative(cwd, dir))\n const parts = sub.split('/')\n let created: string | undefined = undefined\n for (\n let p = parts.shift(), part = cwd;\n p && (part += '/' + p);\n p = parts.shift()\n ) {\n part = normalizeWindowsPath(path.resolve(part))\n\n try {\n fs.mkdirSync(part, mode)\n created = created || part\n } catch (er) {\n const st = fs.lstatSync(part)\n if (st.isDirectory()) {\n continue\n } else if (unlink) {\n fs.unlinkSync(part)\n fs.mkdirSync(part, mode)\n created = created || part\n continue\n } else if (st.isSymbolicLink()) {\n return new SymlinkError(part, part + '/' + parts.join('/'))\n }\n }\n }\n\n return done(created)\n}\n", "export class CwdError extends Error {\n path: string\n code: string\n syscall: 'chdir' = 'chdir'\n\n constructor(path: string, code: string) {\n super(`${code}: Cannot cd into '${path}'`)\n this.path = path\n this.code = code\n }\n\n get name() {\n return 'CwdError'\n }\n}\n", "export class SymlinkError extends Error {\n path: string\n symlink: string\n syscall: 'symlink' = 'symlink'\n code: 'TAR_SYMLINK_ERROR' = 'TAR_SYMLINK_ERROR'\n constructor(symlink: string, path: string) {\n super('TAR_SYMLINK_ERROR: Cannot extract through symbolic link')\n this.symlink = symlink\n this.path = path\n }\n get name() {\n return 'SymlinkError'\n }\n}\n", "// A path exclusive reservation system\n// reserve([list, of, paths], fn)\n// When the fn is first in line for all its paths, it\n// is called with a cb that clears the reservation.\n//\n// Used by async unpack to avoid clobbering paths in use,\n// while still allowing maximal safe parallelization.\n\nimport { join } from 'node:path'\nimport { normalizeUnicode } from './normalize-unicode.js'\nimport { stripTrailingSlashes } from './strip-trailing-slashes.js'\n\nconst platform =\n process.env.TESTING_TAR_FAKE_PLATFORM || process.platform\nconst isWindows = platform === 'win32'\n\nexport type Reservation = {\n paths: string[]\n dirs: Set\n}\n\nexport type Handler = (clear: () => void) => void\n\n// return a set of parent dirs for a given path\n// '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d']\nconst getDirs = (path: string) => {\n const dirs = path\n .split('/')\n .slice(0, -1)\n .reduce((set: string[], path) => {\n const s = set[set.length - 1]\n if (s !== undefined) {\n path = join(s, path)\n }\n set.push(path || '/')\n return set\n }, [])\n return dirs\n}\n\nexport class PathReservations {\n // path => [function or Set]\n // A Set object means a directory reservation\n // A fn is a direct reservation on that path\n #queues = new Map)[]>()\n\n // fn => {paths:[path,...], dirs:[path, ...]}\n #reservations = new Map()\n\n // functions currently running\n #running = new Set()\n\n reserve(paths: string[], fn: Handler) {\n paths =\n isWindows ?\n ['win32 parallelization disabled']\n : paths.map(p => {\n // don't need normPath, because we skip this entirely for windows\n return stripTrailingSlashes(join(normalizeUnicode(p)))\n })\n\n const dirs = new Set(\n paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b)),\n )\n this.#reservations.set(fn, { dirs, paths })\n for (const p of paths) {\n const q = this.#queues.get(p)\n if (!q) {\n this.#queues.set(p, [fn])\n } else {\n q.push(fn)\n }\n }\n for (const dir of dirs) {\n const q = this.#queues.get(dir)\n if (!q) {\n this.#queues.set(dir, [new Set([fn])])\n } else {\n const l = q[q.length - 1]\n if (l instanceof Set) {\n l.add(fn)\n } else {\n q.push(new Set([fn]))\n }\n }\n }\n return this.#run(fn)\n }\n\n // return the queues for each path the function cares about\n // fn => {paths, dirs}\n #getQueues(fn: Handler): {\n paths: Handler[][]\n dirs: (Handler | Set)[][]\n } {\n const res = this.#reservations.get(fn)\n /* c8 ignore start */\n if (!res) {\n throw new Error('function does not have any path reservations')\n }\n /* c8 ignore stop */\n return {\n paths: res.paths.map((path: string) =>\n this.#queues.get(path),\n ) as Handler[][],\n dirs: [...res.dirs].map(path => this.#queues.get(path)) as (\n | Handler\n | Set\n )[][],\n }\n }\n\n // check if fn is first in line for all its paths, and is\n // included in the first set for all its dir queues\n check(fn: Handler) {\n const { paths, dirs } = this.#getQueues(fn)\n return (\n paths.every(q => q && q[0] === fn) &&\n dirs.every(q => q && q[0] instanceof Set && q[0].has(fn))\n )\n }\n\n // run the function if it's first in line and not already running\n #run(fn: Handler) {\n if (this.#running.has(fn) || !this.check(fn)) {\n return false\n }\n this.#running.add(fn)\n fn(() => this.#clear(fn))\n return true\n }\n\n #clear(fn: Handler) {\n if (!this.#running.has(fn)) {\n return false\n }\n const res = this.#reservations.get(fn)\n /* c8 ignore start */\n if (!res) {\n throw new Error('invalid reservation')\n }\n /* c8 ignore stop */\n const { paths, dirs } = res\n\n const next = new Set()\n for (const path of paths) {\n const q = this.#queues.get(path)\n /* c8 ignore start */\n if (!q || q?.[0] !== fn) {\n continue\n }\n /* c8 ignore stop */\n const q0 = q[1]\n if (!q0) {\n this.#queues.delete(path)\n continue\n }\n q.shift()\n if (typeof q0 === 'function') {\n next.add(q0)\n } else {\n for (const f of q0) {\n next.add(f)\n }\n }\n }\n\n for (const dir of dirs) {\n const q = this.#queues.get(dir)\n const q0 = q?.[0]\n /* c8 ignore next - type safety only */\n if (!q || !(q0 instanceof Set)) continue\n if (q0.size === 1 && q.length === 1) {\n this.#queues.delete(dir)\n continue\n } else if (q0.size === 1) {\n q.shift()\n // next one must be a function,\n // or else the Set would've been reused\n const n = q[0]\n if (typeof n === 'function') {\n next.add(n)\n }\n } else {\n q0.delete(fn)\n }\n }\n\n this.#running.delete(fn)\n next.forEach(fn => this.#run(fn))\n return true\n }\n}\n", "// warning: extremely hot code path.\n// This has been meticulously optimized for use\n// within npm install on large package trees.\n// Do not edit without careful benchmarking.\nconst normalizeCache: Record = Object.create(null)\n\n// Limit the size of this. Very low-sophistication LRU cache\nconst MAX = 10000\nconst cache = new Set()\nexport const normalizeUnicode = (s: string): string => {\n if (!cache.has(s)) {\n // shake out identical accents and ligatures\n normalizeCache[s] = s\n .normalize('NFD')\n .toLocaleLowerCase('en')\n .toLocaleUpperCase('en')\n } else {\n cache.delete(s)\n }\n cache.add(s)\n\n const ret = normalizeCache[s] as string\n\n let i = cache.size - MAX\n // only prune when we're 10% over the max\n if (i > MAX / 10) {\n for (const s of cache) {\n cache.delete(s)\n delete normalizeCache[s]\n if (--i <= 0) break\n }\n }\n\n return ret\n}\n", "// separate file so I stop getting nagged in vim about deprecated API.\nexport const umask = () => process.umask()\n", "// tar -r\nimport { WriteStream, WriteStreamSync } from '@isaacs/fs-minipass'\nimport { Minipass } from 'minipass'\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { Header } from './header.js'\nimport { list } from './list.js'\nimport { makeCommand } from './make-command.js'\nimport {\n isFile,\n TarOptionsFile,\n TarOptionsSyncFile,\n} from './options.js'\nimport { Pack, PackSync } from './pack.js'\n\n// starting at the head of the file, read a Header\n// If the checksum is invalid, that's our position to start writing\n// If it is, jump forward by the specified size (round up to 512)\n// and try again.\n// Write the new Pack stream starting there.\n\nconst replaceSync = (opt: TarOptionsSyncFile, files: string[]) => {\n const p = new PackSync(opt)\n\n let threw = true\n let fd\n let position\n\n try {\n try {\n fd = fs.openSync(opt.file, 'r+')\n } catch (er) {\n if ((er as NodeJS.ErrnoException)?.code === 'ENOENT') {\n fd = fs.openSync(opt.file, 'w+')\n } else {\n throw er\n }\n }\n\n const st = fs.fstatSync(fd)\n const headBuf = Buffer.alloc(512)\n\n POSITION: for (\n position = 0;\n position < st.size;\n position += 512\n ) {\n for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) {\n bytes = fs.readSync(\n fd,\n headBuf,\n bufPos,\n headBuf.length - bufPos,\n position + bufPos,\n )\n\n if (\n position === 0 &&\n headBuf[0] === 0x1f &&\n headBuf[1] === 0x8b\n ) {\n throw new Error('cannot append to compressed archives')\n }\n\n if (!bytes) {\n break POSITION\n }\n }\n\n const h = new Header(headBuf)\n if (!h.cksumValid) {\n break\n }\n const entryBlockSize = 512 * Math.ceil((h.size || 0) / 512)\n if (position + entryBlockSize + 512 > st.size) {\n break\n }\n // the 512 for the header we just parsed will be added as well\n // also jump ahead all the blocks for the body\n position += entryBlockSize\n if (opt.mtimeCache && h.mtime) {\n opt.mtimeCache.set(String(h.path), h.mtime)\n }\n }\n threw = false\n\n streamSync(opt, p, position, fd, files)\n } finally {\n if (threw) {\n try {\n fs.closeSync(fd as number)\n } catch (er) {}\n }\n }\n}\n\nconst streamSync = (\n opt: TarOptionsSyncFile,\n p: Pack,\n position: number,\n fd: number,\n files: string[],\n) => {\n const stream = new WriteStreamSync(opt.file, {\n fd: fd,\n start: position,\n })\n p.pipe(stream as unknown as Minipass.Writable)\n addFilesSync(p, files)\n}\n\nconst replaceAsync = (\n opt: TarOptionsFile,\n files: string[],\n): Promise => {\n files = Array.from(files)\n const p = new Pack(opt)\n\n const getPos = (\n fd: number,\n size: number,\n cb_: (er?: null | Error, pos?: number) => void,\n ) => {\n const cb = (er?: Error | null, pos?: number) => {\n if (er) {\n fs.close(fd, _ => cb_(er))\n } else {\n cb_(null, pos)\n }\n }\n\n let position = 0\n if (size === 0) {\n return cb(null, 0)\n }\n\n let bufPos = 0\n const headBuf = Buffer.alloc(512)\n const onread = (er?: null | Error, bytes?: number): void => {\n if (er || typeof bytes === 'undefined') {\n return cb(er)\n }\n bufPos += bytes\n if (bufPos < 512 && bytes) {\n return fs.read(\n fd,\n headBuf,\n bufPos,\n headBuf.length - bufPos,\n position + bufPos,\n onread,\n )\n }\n\n if (\n position === 0 &&\n headBuf[0] === 0x1f &&\n headBuf[1] === 0x8b\n ) {\n return cb(new Error('cannot append to compressed archives'))\n }\n\n // truncated header\n if (bufPos < 512) {\n return cb(null, position)\n }\n\n const h = new Header(headBuf)\n if (!h.cksumValid) {\n return cb(null, position)\n }\n\n /* c8 ignore next */\n const entryBlockSize = 512 * Math.ceil((h.size ?? 0) / 512)\n if (position + entryBlockSize + 512 > size) {\n return cb(null, position)\n }\n\n position += entryBlockSize + 512\n if (position >= size) {\n return cb(null, position)\n }\n\n if (opt.mtimeCache && h.mtime) {\n opt.mtimeCache.set(String(h.path), h.mtime)\n }\n bufPos = 0\n fs.read(fd, headBuf, 0, 512, position, onread)\n }\n fs.read(fd, headBuf, 0, 512, position, onread)\n }\n\n const promise = new Promise((resolve, reject) => {\n p.on('error', reject)\n let flag = 'r+'\n const onopen = (\n er?: NodeJS.ErrnoException | null,\n fd?: number,\n ) => {\n if (er && er.code === 'ENOENT' && flag === 'r+') {\n flag = 'w+'\n return fs.open(opt.file, flag, onopen)\n }\n\n if (er || !fd) {\n return reject(er)\n }\n\n fs.fstat(fd, (er, st) => {\n if (er) {\n return fs.close(fd, () => reject(er))\n }\n\n getPos(fd, st.size, (er, position) => {\n if (er) {\n return reject(er)\n }\n const stream = new WriteStream(opt.file, {\n fd: fd,\n start: position,\n })\n p.pipe(stream as unknown as Minipass.Writable)\n stream.on('error', reject)\n stream.on('close', resolve)\n addFilesAsync(p, files)\n })\n })\n }\n fs.open(opt.file, flag, onopen)\n })\n\n return promise\n}\n\nconst addFilesSync = (p: Pack, files: string[]) => {\n files.forEach(file => {\n if (file.charAt(0) === '@') {\n list({\n file: path.resolve(p.cwd, file.slice(1)),\n sync: true,\n noResume: true,\n onReadEntry: entry => p.add(entry),\n })\n } else {\n p.add(file)\n }\n })\n p.end()\n}\n\nconst addFilesAsync = async (\n p: Pack,\n files: string[],\n): Promise => {\n for (let i = 0; i < files.length; i++) {\n const file = String(files[i])\n if (file.charAt(0) === '@') {\n await list({\n file: path.resolve(String(p.cwd), file.slice(1)),\n noResume: true,\n onReadEntry: entry => p.add(entry),\n })\n } else {\n p.add(file)\n }\n }\n p.end()\n}\n\nexport const replace = makeCommand(\n replaceSync,\n replaceAsync,\n /* c8 ignore start */\n (): never => {\n throw new TypeError('file is required')\n },\n (): never => {\n throw new TypeError('file is required')\n },\n /* c8 ignore stop */\n (opt, entries) => {\n if (!isFile(opt)) {\n throw new TypeError('file is required')\n }\n\n if (\n opt.gzip ||\n opt.brotli ||\n opt.zstd ||\n opt.file.endsWith('.br') ||\n opt.file.endsWith('.tbr')\n ) {\n throw new TypeError('cannot append to compressed archives')\n }\n\n if (!entries?.length) {\n throw new TypeError('no paths specified to add/replace')\n }\n },\n)\n", "// tar -u\n\nimport { makeCommand } from './make-command.js'\nimport { type TarOptionsWithAliases } from './options.js'\n\nimport { replace as r } from './replace.js'\n\n// just call tar.r with the filter and mtimeCache\nexport const update = makeCommand(\n r.syncFile,\n r.asyncFile,\n r.syncNoFile,\n r.asyncNoFile,\n (opt, entries = []) => {\n r.validate?.(opt, entries)\n mtimeFilter(opt)\n },\n)\n\nconst mtimeFilter = (opt: TarOptionsWithAliases) => {\n const filter = opt.filter\n\n if (!opt.mtimeCache) {\n opt.mtimeCache = new Map()\n }\n\n opt.filter =\n filter ?\n (path, stat) =>\n filter(path, stat) &&\n !(\n /* c8 ignore start */\n (\n (opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) >\n (stat.mtime ?? 0)\n )\n /* c8 ignore stop */\n )\n : (path, stat) =>\n !(\n /* c8 ignore start */\n (\n (opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) >\n (stat.mtime ?? 0)\n )\n /* c8 ignore stop */\n )\n}\n"], + "mappings": "6FAAA,OAAOA,OAAQ,SACf,OAAOC,MAAQ,KCMf,OAAS,gBAAAC,OAAoB,cAC7B,OAAOC,OAAY,cACnB,OAAS,iBAAAC,OAAqB,sBAT9B,IAAMC,GACJ,OAAO,SAAY,UAAY,QAC3B,QACA,CACE,OAAQ,KACR,OAAQ,MAiBHC,GACX,GAEA,CAAC,CAAC,GACF,OAAO,GAAM,WACZ,aAAaC,GACZ,aAAaJ,IACbK,GAAW,CAAC,GACZC,GAAW,CAAC,GAKHD,GAAc,GACzB,CAAC,CAAC,GACF,OAAO,GAAM,UACb,aAAaN,IACb,OAAQ,EAAwB,MAAS,YAExC,EAAwB,OAASC,GAAO,SAAS,UAAU,KAKjDM,GAAc,GACzB,CAAC,CAAC,GACF,OAAO,GAAM,UACb,aAAaP,IACb,OAAQ,EAAwB,OAAU,YAC1C,OAAQ,EAAwB,KAAQ,WAEpCQ,EAAM,OAAO,KAAK,EAClBC,EAAiB,OAAO,cAAc,EACtCC,GAAc,OAAO,YAAY,EACjCC,GAAe,OAAO,aAAa,EACnCC,GAAgB,OAAO,cAAc,EACrCC,GAAS,OAAO,QAAQ,EACxBC,GAAO,OAAO,MAAM,EACpBC,GAAQ,OAAO,OAAO,EACtBC,GAAa,OAAO,YAAY,EAChCC,EAAW,OAAO,UAAU,EAC5BC,GAAU,OAAO,SAAS,EAC1BC,EAAU,OAAO,SAAS,EAC1BC,GAAS,OAAO,QAAQ,EACxBC,GAAS,OAAO,QAAQ,EACxBC,EAAS,OAAO,QAAQ,EACxBC,EAAQ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U,sCAAsC,EAG5D,GAAI,CAAC2C,GAAS,OACZ,MAAM,IAAI,UAAU,mCAAmC,CAE3D,CAAC,EClSI,IAAME,GAASC,EACpBC,GAAE,SACFA,GAAE,UACFA,GAAE,WACFA,GAAE,YACF,CAACC,EAAKC,EAAU,CAAA,IAAM,CACpBF,GAAE,WAAWC,EAAKC,CAAO,EACzBC,GAAYF,CAAG,CACjB,CAAC,EAGGE,GAAeF,GAA8B,CACjD,IAAMG,EAASH,EAAI,OAEdA,EAAI,aACPA,EAAI,WAAa,IAAI,KAGvBA,EAAI,OACFG,EACE,CAACC,EAAMC,IACLF,EAAOC,EAAMC,CAAI,GACjB,GAGKL,EAAI,YAAY,IAAII,CAAI,GAAKC,EAAK,OAAS,IAC3CA,EAAK,OAAS,IAIrB,CAACD,EAAMC,IACL,GAGKL,EAAI,YAAY,IAAII,CAAI,GAAKC,EAAK,OAAS,IAC3CA,EAAK,OAAS,GAI3B", + "names": ["EE", "fs", "EventEmitter", "Stream", "StringDecoder", "proc", "isStream", "Minipass", "isReadable", "isWritable", "EOF", "MAYBE_EMIT_END", "EMITTED_END", "EMITTING_END", "EMITTED_ERROR", "CLOSED", "READ", "FLUSH", "FLUSHCHUNK", "ENCODING", "DECODER", "FLOWING", "PAUSED", "RESUME", "BUFFER", "PIPES", "BUFFERLENGTH", "BUFFERPUSH", "BUFFERSHIFT", "OBJECTMODE", "DESTROYED", "ERROR", "EMITDATA", "EMITEND", "EMITEND2", "ASYNC", "ABORT", "ABORTED", "SIGNAL", "DATALISTENERS", "DISCARDED", "defer", "fn", "nodefer", "isEndish", "ev", "isArrayBufferLike", "b", "isArrayBufferView", "Pipe", "src", "dest", "opts", "_er", "PipeProxyErrors", "er", "isObjectModeOptions", "o", "isEncodingOptions", "args", "options", "signal", "_enc", "_om", "a", "_", "chunk", "encoding", "cb", "n", "ret", "c", "noDrain", "ended", "p", "handler", "h", "data", "buf", "resolve", "reject", "stopped", "stop", "res", "onerr", "ondata", "onend", "ondestroy", "value", "rej", "next", "wc", "writev", "fs", "_autoClose", "_close", "_ended", "_fd", "_finished", "_flags", "_flush", "_handleChunk", "_makeBuf", "_mode", "_needDrain", "_onerror", "_onopen", "_onread", "_onwrite", "_open", "_path", "_pos", "_queue", "_read", "_readSize", "_reading", "_remain", "_size", "_write", "_writing", "_defaultFlag", "_errored", "ReadStream", "Minipass", "path", "opt", "er", "fd", "buf", "br", "b", "ret", "ev", "args", "ReadStreamSync", "threw", "WriteStream", "EE", "defaultFlag", "enc", "bw", "iovec", "WriteStreamSync", "path", "fs", "dirname", "parse", "argmap", "isSyncFile", "o", "isAsyncFile", "isSyncNoFile", "isAsyncNoFile", "isFile", "o", "dealiasKey", "k", "d", "argmap", "dealias", "opt", "result", "key", "v", "makeCommand", "syncFile", "asyncFile", "syncNoFile", "asyncNoFile", "validate", "opt_", "entries", "cb", "opt", "dealias", "isSyncFile", "isAsyncFile", "p", "isSyncNoFile", "isAsyncNoFile", "EE", "assert", "Buffer", "realZlib", "realZlib", "realZlibConstants", "constants", "OriginalBufferConcat", "Buffer", "desc", "noop", "args", "passthroughBufferConcat", "makeNoOp", "_", "_superWrite", "ZlibError", "err", "origin", "_flushFlag", "ZlibBase", "Minipass", "#sawError", "#ended", "#flushFlag", "#finishFlushFlag", "#fullFlushFlag", "#handle", "#onError", "opts", "mode", "realZlib", "er", "assert", "flushFlag", "chunk", "encoding", "cb", "data", "nativeHandle", "originalNativeClose", "originalClose", "result", "writeReturn", "r", "i", "Zlib", "#level", "#strategy", "constants", "level", "strategy", "origFlush", "Gzip", "Zlib", "#portable", "opts", "_superWrite", "data", "Unzip", "Zlib", "opts", "Brotli", "ZlibBase", "mode", "constants", "BrotliCompress", "BrotliDecompress", "Zstd", "ZstdCompress", "ZstdDecompress", "pathModule", "encode", "num", "buf", "encodeNegative", "encodePositive", "i", "flipped", "byte", "onesComp", "twosComp", "parse", "pre", "value", "pos", "twos", "len", "sum", "f", "types_exports", "__export", "code", "isCode", "isName", "name", "c", "kv", "Header", "#type", "data", "off", "ex", "gex", "#slurp", "buf", "decString", "decNumber", "decDate", "t", "isCode", "prefix", "sum", "i", "k", "v", "prefixSize", "split", "splitPrefix", "path", "encString", "encNumber", "encDate", "name", "type", "c", "code", "p", "pp", "ret", "root", "pathModule", "size", "numToDate", "num", "parse", "decSmallNumber", "nanUndef", "value", "MAXNUM", "encode", "encSmallNumber", "octalString", "padOctal", "str", "date", "NULLS", "basename", "Pax", "_Pax", "obj", "global", "body", "bodyLen", "bufLen", "buf", "i", "Header", "basename", "field", "r", "v", "s", "byteLen", "digits", "str", "ex", "g", "merge", "parseKV", "a", "b", "parseKVLine", "set", "line", "n", "kv", "k", "platform", "normalizeWindowsPath", "p", "ReadEntry", "Minipass", "header", "ex", "gex", "normalizeWindowsPath", "#slurp", "data", "writeLen", "r", "br", "k", "v", "warnMethod", "self", "code", "message", "data", "maxMetaEntrySize", "gzipHeader", "zstdHeader", "ZIP_HEADER_LEN", "STATE", "WRITEENTRY", "READENTRY", "NEXTENTRY", "PROCESSENTRY", "EX", "GEX", "META", "EMITMETA", "BUFFER", "QUEUE", "ENDED", "EMITTEDEND", "EMIT", "UNZIP", "CONSUMECHUNK", "CONSUMECHUNKSUB", "CONSUMEBODY", "CONSUMEMETA", "CONSUMEHEADER", "CONSUMING", "BUFFERCONCAT", "MAYBEEND", "WRITING", "ABORTED", "DONE", "SAW_VALID_ENTRY", "SAW_NULL_BLOCK", "SAW_EOF", "CLOSESTREAM", "noop", "Parser", "EE", "opt", "isTBR", "isTZST", "code", "message", "data", "warnMethod", "chunk", "position", "header", "Header", "er", "type", "entry", "ReadEntry", "onend", "c", "go", "ev", "args", "re", "br", "ret", "extra", "Pax", "ex", "error", "encoding", "cb", "i", "isZstd", "maybeBrotli", "ended", "Unzip", "ZstdDecompress", "BrotliDecompress", "have", "length", "stripTrailingSlashes", "str", "i", "slashesStart", "onReadEntryFunction", "opt", "onReadEntry", "filesFilter", "files", "map", "f", "stripTrailingSlashes", "filter", "mapHas", "file", "r", "root", "parse", "ret", "m", "dirname", "entry", "listFileSync", "p", "Parser", "fd", "fs", "stat", "readSize", "buf", "read", "pos", "bytesRead", "listFile", "_files", "resolve", "reject", "er", "stream", "ReadStream", "list", "makeCommand", "fs", "fs", "path", "modeFix", "mode", "isDir", "portable", "win32", "isAbsolute", "parse", "stripAbsolutePath", "path", "r", "parsed", "root", "raw", "win", "char", "toWin", "i", "toRaw", "encode", "s", "c", "decode", "prefixPath", "path", "prefix", "normalizeWindowsPath", "stripTrailingSlashes", "maxReadSize", "PROCESS", "FILE", "DIRECTORY", "SYMLINK", "HARDLINK", "HEADER", "READ", "LSTAT", "ONLSTAT", "ONREAD", "ONREADLINK", "OPENFILE", "ONOPENFILE", "CLOSE", "MODE", "AWAITDRAIN", "ONDRAIN", "PREFIX", "WriteEntry", "Minipass", "#hadError", "p", "opt_", "opt", "dealias", "pathWarn", "root", "stripped", "stripAbsolutePath", "decode", "cs", "code", "message", "data", "warnMethod", "ev", "fs", "er", "stat", "getType", "mode", "modeFix", "Header", "Pax", "block", "linkpath", "linkKey", "fd", "bufLen", "buf", "offset", "length", "pos", "bytesRead", "cb", "i", "chunk", "encoding", "WriteEntrySync", "threw", "WriteEntryTar", "readEntry", "type", "b", "writeLen", "Yallist", "_Yallist", "list", "item", "walker", "node", "next", "prev", "head", "tail", "args", "i", "l", "push", "unshift", "res", "t", "h", "fn", "thisp", "n", "initial", "acc", "arr", "from", "to", "ret", "start", "deleteCount", "nodes", "v", "insertAfter", "p", "self", "value", "inserted", "Node", "path", "PackJob", "path", "absolute", "EOF", "ONSTAT", "ENDED", "QUEUE", "CURRENT", "PROCESS", "PROCESSING", "PROCESSJOB", "JOBS", "JOBDONE", "ADDFSENTRY", "ADDTARENTRY", "STAT", "READDIR", "ONREADDIR", "PIPE", "ENTRY", "ENTRYOPT", "WRITEENTRYCLASS", "WRITE", "ONDRAIN", "Pack", "Minipass", "opt", "normalizeWindowsPath", "WriteEntry", "Gzip", "BrotliCompress", "ZstdCompress", "zip", "chunk", "Yallist", "encoding", "cb", "ReadEntry", "p", "job", "WriteEntryTar", "stat", "fs", "er", "entries", "w", "_job", "sc", "rc", "code", "msg", "data", "entry", "base", "source", "message", "warnMethod", "PackSync", "WriteEntrySync", "createFileSync", "opt", "files", "p", "PackSync", "stream", "WriteStreamSync", "addFilesSync", "createFile", "Pack", "WriteStream", "promise", "res", "rej", "addFilesAsync", "file", "list", "path", "entry", "i", "createSync", "createAsync", "create", "makeCommand", "_opt", "fs", "assert", "randomBytes", "fs", "path", "fs", "platform", "isWindows", "O_CREAT", "O_TRUNC", "O_WRONLY", "UV_FS_O_FILEMAP", "fMapEnabled", "fMapLimit", "fMapFlag", "getWriteFlag", "size", "fs", "path", "lchownSync", "uid", "gid", "er", "chown", "cpath", "cb", "chownrKid", "p", "child", "chownr", "children", "len", "errState", "then", "chownrKidSync", "chownrSync", "e", "fs", "fsp", "path", "CwdError", "path", "code", "SymlinkError", "symlink", "path", "checkCwd", "dir", "cb", "fs", "er", "st", "CwdError", "mkdir", "opt", "normalizeWindowsPath", "umask", "mode", "needChmod", "uid", "gid", "doChown", "preserve", "unlink", "cwd", "done", "created", "chownr", "fsp", "made", "parts", "path", "mkdir_", "base", "p", "part", "onmkdir", "statEr", "SymlinkError", "checkCwdSync", "ok", "code", "mkdirSync", "chownrSync", "join", "normalizeCache", "MAX", "cache", "normalizeUnicode", "ret", "i", "s", "platform", "isWindows", "getDirs", "path", "set", "s", "join", "PathReservations", "#queues", "#reservations", "#running", "paths", "fn", "p", "stripTrailingSlashes", "normalizeUnicode", "dirs", "a", "b", "q", "dir", "l", "#run", "#getQueues", "res", "#clear", "next", "q0", "f", "n", "umask", "ONENTRY", "CHECKFS", "CHECKFS2", "ISREUSABLE", "MAKEFS", "FILE", "DIRECTORY", "LINK", "SYMLINK", "HARDLINK", "ENSURE_NO_SYMLINK", "UNSUPPORTED", "CHECKPATH", "STRIPABSOLUTEPATH", "MKDIR", "ONERROR", "PENDING", "PEND", "UNPEND", "ENDED", "MAYBECLOSE", "SKIP", "DOCHOWN", "UID", "GID", "CHECKED_CWD", "platform", "isWindows", "DEFAULT_MAX_DEPTH", "unlinkFile", "path", "cb", "fs", "name", "randomBytes", "er", "unlinkFileSync", "uint32", "a", "b", "c", "Unpack", "Parser", "PathReservations", "opt", "normalizeWindowsPath", "umask", "entry", "code", "msg", "data", "field", "p", "type", "parts", "entryDir", "resolved", "root", "stripped", "stripAbsolutePath", "linkparts", "aRoot", "encode", "pRoot", "assert", "dir", "mode", "mkdir", "fullyDone", "stream", "WriteStream", "getWriteFlag", "actions", "done", "abs", "fd", "atime", "mtime", "er2", "uid", "gid", "tx", "linkpath", "cwd", "onError", "t", "st", "SymlinkError", "paths", "checkCwd", "start", "parent", "afterMakeParent", "lstatEr", "needChmod", "afterChmod", "link", "callSync", "fn", "UnpackSync", "mkParent", "oner", "closeError", "e", "chunk", "futimeser", "fchowner", "mkdirSync", "_entry", "linkSync", "extractFileSync", "opt", "u", "UnpackSync", "file", "stat", "fs", "readSize", "ReadStreamSync", "extractFile", "_", "Unpack", "resolve", "reject", "er", "stream", "ReadStream", "extract", "makeCommand", "files", "filesFilter", "fs", "path", "replaceSync", "opt", "files", "p", "PackSync", "threw", "fd", "position", "fs", "er", "st", "headBuf", "POSITION", "bufPos", "bytes", "h", "Header", "entryBlockSize", "streamSync", "stream", "WriteStreamSync", "addFilesSync", "replaceAsync", "Pack", "getPos", "size", "cb_", "cb", "pos", "_", "onread", "resolve", "reject", "flag", "onopen", "WriteStream", "addFilesAsync", "file", "list", "path", "entry", "i", "replace", "makeCommand", "entries", "isFile", "update", "makeCommand", "replace", "opt", "entries", "mtimeFilter", "filter", "path", "stat"] +} diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/large-numbers.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/large-numbers.d.ts new file mode 100644 index 0000000..a1ec25e --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/large-numbers.d.ts @@ -0,0 +1,3 @@ +export declare const encode: (num: number, buf: Buffer) => Buffer; +export declare const parse: (buf: Buffer) => number; +//# sourceMappingURL=large-numbers.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/large-numbers.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/large-numbers.d.ts.map new file mode 100644 index 0000000..2c6b7b2 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/large-numbers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"large-numbers.d.ts","sourceRoot":"","sources":["../../src/large-numbers.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM,EAAE,KAAK,MAAM,4BAa9C,CAAA;AA6BD,eAAO,MAAM,KAAK,GAAI,KAAK,MAAM,WAmBhC,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/large-numbers.js b/node_modules/cmake-js/node_modules/tar/dist/esm/large-numbers.js new file mode 100644 index 0000000..4f2f7e5 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/large-numbers.js @@ -0,0 +1,94 @@ +// Tar can encode large and negative numbers using a leading byte of +// 0xff for negative, and 0x80 for positive. +export const encode = (num, buf) => { + if (!Number.isSafeInteger(num)) { + // The number is so large that javascript cannot represent it with integer + // precision. + throw Error('cannot encode number outside of javascript safe integer range'); + } + else if (num < 0) { + encodeNegative(num, buf); + } + else { + encodePositive(num, buf); + } + return buf; +}; +const encodePositive = (num, buf) => { + buf[0] = 0x80; + for (var i = buf.length; i > 1; i--) { + buf[i - 1] = num & 0xff; + num = Math.floor(num / 0x100); + } +}; +const encodeNegative = (num, buf) => { + buf[0] = 0xff; + var flipped = false; + num = num * -1; + for (var i = buf.length; i > 1; i--) { + var byte = num & 0xff; + num = Math.floor(num / 0x100); + if (flipped) { + buf[i - 1] = onesComp(byte); + } + else if (byte === 0) { + buf[i - 1] = 0; + } + else { + flipped = true; + buf[i - 1] = twosComp(byte); + } + } +}; +export const parse = (buf) => { + const pre = buf[0]; + const value = pre === 0x80 ? pos(buf.subarray(1, buf.length)) + : pre === 0xff ? twos(buf) + : null; + if (value === null) { + throw Error('invalid base256 encoding'); + } + if (!Number.isSafeInteger(value)) { + // The number is so large that javascript cannot represent it with integer + // precision. + throw Error('parsed number outside of javascript safe integer range'); + } + return value; +}; +const twos = (buf) => { + var len = buf.length; + var sum = 0; + var flipped = false; + for (var i = len - 1; i > -1; i--) { + var byte = Number(buf[i]); + var f; + if (flipped) { + f = onesComp(byte); + } + else if (byte === 0) { + f = byte; + } + else { + flipped = true; + f = twosComp(byte); + } + if (f !== 0) { + sum -= f * Math.pow(256, len - i - 1); + } + } + return sum; +}; +const pos = (buf) => { + var len = buf.length; + var sum = 0; + for (var i = len - 1; i > -1; i--) { + var byte = Number(buf[i]); + if (byte !== 0) { + sum += byte * Math.pow(256, len - i - 1); + } + } + return sum; +}; +const onesComp = (byte) => (0xff ^ byte) & 0xff; +const twosComp = (byte) => ((0xff ^ byte) + 1) & 0xff; +//# sourceMappingURL=large-numbers.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/large-numbers.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/large-numbers.js.map new file mode 100644 index 0000000..86bb941 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/large-numbers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"large-numbers.js","sourceRoot":"","sources":["../../src/large-numbers.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,4CAA4C;AAE5C,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,EAAE;IACjD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,0EAA0E;QAC1E,aAAa;QACb,MAAM,KAAK,CACT,+DAA+D,CAChE,CAAA;IACH,CAAC;SAAM,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;Q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pB,CAAC;aAAM,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;YACtB,CAAC,GAAG,IAAI,CAAA;QACV,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,IAAI,CAAA;YACd,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;QACpB,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACZ,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;QACvC,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,GAAG,GAAG,CAAC,GAAW,EAAE,EAAE;IAC1B,IAAI,GAAG,GAAG,GAAG,CAAC,MAAM,CAAA;IACpB,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,KAAK,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,IAAI,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QACzB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;YACf,GAAG,IAAI,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;QAC1C,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,IAAI,CAAA;AAEvD,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAA","sourcesContent":["// Tar can encode large and negative numbers using a leading byte of\n// 0xff for negative, and 0x80 for positive.\n\nexport const encode = (num: number, buf: Buffer) => {\n if (!Number.isSafeInteger(num)) {\n // The number is so large that javascript cannot represent it with integer\n // precision.\n throw Error(\n 'cannot encode number outside of javascript safe integer range',\n )\n } else if (num < 0) {\n encodeNegative(num, buf)\n } else {\n encodePositive(num, buf)\n }\n return buf\n}\n\nconst encodePositive = (num: number, buf: Buffer) => {\n buf[0] = 0x80\n\n for (var i = buf.length; i > 1; i--) {\n buf[i - 1] = num & 0xff\n num = Math.floor(num / 0x100)\n }\n}\n\nconst encodeNegative = (num: number, buf: Buffer) => {\n buf[0] = 0xff\n var flipped = false\n num = num * -1\n for (var i = buf.length; i > 1; i--) {\n var byte = num & 0xff\n num = Math.floor(num / 0x100)\n if (flipped) {\n buf[i - 1] = onesComp(byte)\n } else if (byte === 0) {\n buf[i - 1] = 0\n } else {\n flipped = true\n buf[i - 1] = twosComp(byte)\n }\n }\n}\n\nexport const parse = (buf: Buffer) => {\n const pre = buf[0]\n const value =\n pre === 0x80 ? pos(buf.subarray(1, buf.length))\n : pre === 0xff ? twos(buf)\n : null\n if (value === null) {\n throw Error('invalid base256 encoding')\n }\n\n if (!Number.isSafeInteger(value)) {\n // The number is so large that javascript cannot represent it with integer\n // precision.\n throw Error(\n 'parsed number outside of javascript safe integer range',\n )\n }\n\n return value\n}\n\nconst twos = (buf: Buffer) => {\n var len = buf.length\n var sum = 0\n var flipped = false\n for (var i = len - 1; i > -1; i--) {\n var byte = Number(buf[i])\n var f\n if (flipped) {\n f = onesComp(byte)\n } else if (byte === 0) {\n f = byte\n } else {\n flipped = true\n f = twosComp(byte)\n }\n if (f !== 0) {\n sum -= f * Math.pow(256, len - i - 1)\n }\n }\n return sum\n}\n\nconst pos = (buf: Buffer) => {\n var len = buf.length\n var sum = 0\n for (var i = len - 1; i > -1; i--) {\n var byte = Number(buf[i])\n if (byte !== 0) {\n sum += byte * Math.pow(256, len - i - 1)\n }\n }\n return sum\n}\n\nconst onesComp = (byte: number) => (0xff ^ byte) & 0xff\n\nconst twosComp = (byte: number) => ((0xff ^ byte) + 1) & 0xff\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/list.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/list.d.ts new file mode 100644 index 0000000..890a11b --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/list.d.ts @@ -0,0 +1,7 @@ +import { TarOptions } from './options.js'; +import { Parser } from './parse.js'; +export declare const filesFilter: (opt: TarOptions, files: string[]) => void; +export declare const list: import("./make-command.js").TarCommand; +//# sourceMappingURL=list.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/list.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/list.d.ts.map new file mode 100644 index 0000000..2612f9e --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/list.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/list.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,UAAU,EAGX,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAgBnC,eAAO,MAAM,WAAW,GAAI,KAAK,UAAU,EAAE,OAAO,MAAM,EAAE,SA4B3D,CAAA;AA+DD,eAAO,MAAM,IAAI;UAG4B,IAAI;EAMhD,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/list.js b/node_modules/cmake-js/node_modules/tar/dist/esm/list.js new file mode 100644 index 0000000..a63a884 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/list.js @@ -0,0 +1,110 @@ +// tar -t +import * as fsm from '@isaacs/fs-minipass'; +import fs from 'node:fs'; +import { dirname, parse } from 'path'; +import { makeCommand } from './make-command.js'; +import { Parser } from './parse.js'; +import { stripTrailingSlashes } from './strip-trailing-slashes.js'; +const onReadEntryFunction = (opt) => { + const onReadEntry = opt.onReadEntry; + opt.onReadEntry = + onReadEntry ? + e => { + onReadEntry(e); + e.resume(); + } + : e => e.resume(); +}; +// construct a filter that limits the file entries listed +// include child entries if a dir is included +export const filesFilter = (opt, files) => { + const map = new Map(files.map(f => [stripTrailingSlashes(f), true])); + const filter = opt.filter; + const mapHas = (file, r = '') => { + const root = r || parse(file).root || '.'; + let ret; + if (file === root) + ret = false; + else { + const m = map.get(file); + if (m !== undefined) { + ret = m; + } + else { + ret = mapHas(dirname(file), root); + } + } + map.set(file, ret); + return ret; + }; + opt.filter = + filter ? + (file, entry) => filter(file, entry) && mapHas(stripTrailingSlashes(file)) + : file => mapHas(stripTrailingSlashes(file)); +}; +const listFileSync = (opt) => { + const p = new Parser(opt); + const file = opt.file; + let fd; + try { + fd = fs.openSync(file, 'r'); + const stat = fs.fstatSync(fd); + const readSize = opt.maxReadSize || 16 * 1024 * 1024; + if (stat.size < readSize) { + const buf = Buffer.allocUnsafe(stat.size); + const read = fs.readSync(fd, buf, 0, stat.size, 0); + p.end(read === buf.byteLength ? buf : buf.subarray(0, read)); + } + else { + let pos = 0; + const buf = Buffer.allocUnsafe(readSize); + while (pos < stat.size) { + const bytesRead = fs.readSync(fd, buf, 0, readSize, pos); + if (bytesRead === 0) + break; + pos += bytesRead; + p.write(buf.subarray(0, bytesRead)); + } + p.end(); + } + } + finally { + if (typeof fd === 'number') { + try { + fs.closeSync(fd); + /* c8 ignore next */ + } + catch (er) { } + } + } +}; +const listFile = (opt, _files) => { + const parse = new Parser(opt); + const readSize = opt.maxReadSize || 16 * 1024 * 1024; + const file = opt.file; + const p = new Promise((resolve, reject) => { + parse.on('error', reject); + parse.on('end', resolve); + fs.stat(file, (er, stat) => { + if (er) { + reject(er); + } + else { + const stream = new fsm.ReadStream(file, { + readSize: readSize, + size: stat.size, + }); + stream.on('error', reject); + stream.pipe(parse); + } + }); + }); + return p; +}; +export const list = makeCommand(listFileSync, listFile, opt => new Parser(opt), opt => new Parser(opt), (opt, files) => { + if (files?.length) + filesFilter(opt, files); + if (!opt.noResume) + onReadEntryFunction(opt); +}); +//# sourceMappingURL=list.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/list.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/list.js.map new file mode 100644 index 0000000..b7d53f0 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/list.js.map @@ -0,0 +1 @@ +{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/list.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAM/C,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAElE,MAAM,mBAAmB,GAAG,CAAC,GAAe,EAAE,EAAE;IAC9C,MAAM,WAAW,GAAG,GAAG,CAAC,WAAW,CAAA;IACnC,GAAG,CAAC,WAAW;QACb,WAAW,CAAC,CAAC;YACX,CAAC,CAAC,EAAE;gBACF,WAAW,CAAC,CAAC,CAAC,CAAA;gBACd,CAAC,CAAC,MAAM,EAAE,CAAA;YACZ,CAAC;YACH,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAA;AACrB,CAAC,CAAA;AAED,yDAAyD;AACzD,6CAA6C;AAC7C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAe,EAAE,KAAe,EAAE,EAAE;IAC9D,MAAM,GAAG,GAAG,IAAI,GAAG,CACjB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAChD,CAAA;IACD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,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,CAAC,GAAG,CAAC,EACtB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;IACb,IAAI,KAAK,EAAE,MAAM;QAAE,WAAW,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IAC1C,IAAI,CAAC,GAAG,CAAC,QAAQ;QAAE,mBAAmB,CAAC,GAAG,CAAC,CAAA;AAC7C,CAAC,CACF,CAAA","sourcesContent":["// tar -t\nimport * as fsm from '@isaacs/fs-minipass'\nimport fs from 'node:fs'\nimport { dirname, parse } from 'path'\nimport { makeCommand } from './make-command.js'\nimport {\n TarOptions,\n TarOptionsFile,\n TarOptionsSyncFile,\n} from './options.js'\nimport { Parser } from './parse.js'\nimport { stripTrailingSlashes } from './strip-trailing-slashes.js'\n\nconst onReadEntryFunction = (opt: TarOptions) => {\n const onReadEntry = opt.onReadEntry\n opt.onReadEntry =\n onReadEntry ?\n e => {\n onReadEntry(e)\n e.resume()\n }\n : e => e.resume()\n}\n\n// construct a filter that limits the file entries listed\n// include child entries if a dir is included\nexport const filesFilter = (opt: TarOptions, files: string[]) => {\n const map = new Map(\n files.map(f => [stripTrailingSlashes(f), true]),\n )\n const filter = opt.filter\n\n const mapHas = (file: string, r: string = ''): boolean => {\n const root = r || parse(file).root || '.'\n let ret: boolean\n if (file === root) ret = false\n else {\n const m = map.get(file)\n if (m !== undefined) {\n ret = m\n } else {\n ret = mapHas(dirname(file), root)\n }\n }\n\n map.set(file, ret)\n return ret\n }\n\n opt.filter =\n filter ?\n (file, entry) =>\n filter(file, entry) && mapHas(stripTrailingSlashes(file))\n : file => mapHas(stripTrailingSlashes(file))\n}\n\nconst listFileSync = (opt: TarOptionsSyncFile) => {\n const p = new Parser(opt)\n const file = opt.file\n let fd: number | undefined\n try {\n fd = fs.openSync(file, 'r')\n const stat: fs.Stats = fs.fstatSync(fd)\n const readSize: number = opt.maxReadSize || 16 * 1024 * 1024\n if (stat.size < readSize) {\n const buf = Buffer.allocUnsafe(stat.size)\n const read = fs.readSync(fd, buf, 0, stat.size, 0)\n p.end(read === buf.byteLength ? buf : buf.subarray(0, read))\n } else {\n let pos = 0\n const buf = Buffer.allocUnsafe(readSize)\n while (pos < stat.size) {\n const bytesRead = fs.readSync(fd, buf, 0, readSize, pos)\n if (bytesRead === 0) break\n pos += bytesRead\n p.write(buf.subarray(0, bytesRead))\n }\n p.end()\n }\n } finally {\n if (typeof fd === 'number') {\n try {\n fs.closeSync(fd)\n /* c8 ignore next */\n } catch (er) {}\n }\n }\n}\n\nconst listFile = (\n opt: TarOptionsFile,\n _files: string[],\n): Promise => {\n const parse = new Parser(opt)\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n\n const file = opt.file\n const p = new Promise((resolve, reject) => {\n parse.on('error', reject)\n parse.on('end', resolve)\n\n fs.stat(file, (er, stat) => {\n if (er) {\n reject(er)\n } else {\n const stream = new fsm.ReadStream(file, {\n readSize: readSize,\n size: stat.size,\n })\n stream.on('error', reject)\n stream.pipe(parse)\n }\n })\n })\n return p\n}\n\nexport const list = makeCommand(\n listFileSync,\n listFile,\n opt => new Parser(opt) as Parser & { sync: true },\n opt => new Parser(opt),\n (opt, files) => {\n if (files?.length) filesFilter(opt, files)\n if (!opt.noResume) onReadEntryFunction(opt)\n },\n)\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/make-command.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/make-command.d.ts new file mode 100644 index 0000000..cd88929 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/make-command.d.ts @@ -0,0 +1,49 @@ +import { TarOptions, TarOptionsAsyncFile, TarOptionsAsyncNoFile, TarOptionsSyncFile, TarOptionsSyncNoFile, TarOptionsWithAliases, TarOptionsWithAliasesAsync, TarOptionsWithAliasesAsyncFile, TarOptionsWithAliasesAsyncNoFile, TarOptionsWithAliasesFile, TarOptionsWithAliasesNoFile, TarOptionsWithAliasesSync, TarOptionsWithAliasesSyncFile, TarOptionsWithAliasesSyncNoFile } from './options.js'; +export type CB = (er?: Error) => any; +export type TarCommand = { + (): AsyncClass; + (opt: TarOptionsWithAliasesAsyncNoFile): AsyncClass; + (entries: string[]): AsyncClass; + (opt: TarOptionsWithAliasesAsyncNoFile, entries: string[]): AsyncClass; +} & { + (opt: TarOptionsWithAliasesSyncNoFile): SyncClass; + (opt: TarOptionsWithAliasesSyncNoFile, entries: string[]): SyncClass; +} & { + (opt: TarOptionsWithAliasesAsyncFile): Promise; + (opt: TarOptionsWithAliasesAsyncFile, entries: string[]): Promise; + (opt: TarOptionsWithAliasesAsyncFile, cb: CB): Promise; + (opt: TarOptionsWithAliasesAsyncFile, entries: string[], cb: CB): Promise; +} & { + (opt: TarOptionsWithAliasesSyncFile): void; + (opt: TarOptionsWithAliasesSyncFile, entries: string[]): void; +} & { + (opt: TarOptionsWithAliasesSync): typeof opt extends (TarOptionsWithAliasesFile) ? void : typeof opt extends TarOptionsWithAliasesNoFile ? SyncClass : void | SyncClass; + (opt: TarOptionsWithAliasesSync, entries: string[]): typeof opt extends TarOptionsWithAliasesFile ? void : typeof opt extends TarOptionsWithAliasesNoFile ? SyncClass : void | SyncClass; +} & { + (opt: TarOptionsWithAliasesAsync): typeof opt extends (TarOptionsWithAliasesFile) ? Promise : typeof opt extends TarOptionsWithAliasesNoFile ? AsyncClass : Promise | AsyncClass; + (opt: TarOptionsWithAliasesAsync, entries: string[]): typeof opt extends TarOptionsWithAliasesFile ? Promise : typeof opt extends TarOptionsWithAliasesNoFile ? AsyncClass : Promise | AsyncClass; + (opt: TarOptionsWithAliasesAsync, cb: CB): Promise; + (opt: TarOptionsWithAliasesAsync, entries: string[], cb: CB): typeof opt extends TarOptionsWithAliasesFile ? Promise : typeof opt extends TarOptionsWithAliasesNoFile ? never : Promise; +} & { + (opt: TarOptionsWithAliasesFile): Promise | void; + (opt: TarOptionsWithAliasesFile, entries: string[]): typeof opt extends TarOptionsWithAliasesSync ? void : typeof opt extends TarOptionsWithAliasesAsync ? Promise : Promise | void; + (opt: TarOptionsWithAliasesFile, cb: CB): Promise; + (opt: TarOptionsWithAliasesFile, entries: string[], cb: CB): typeof opt extends TarOptionsWithAliasesSync ? never : typeof opt extends TarOptionsWithAliasesAsync ? Promise : Promise; +} & { + (opt: TarOptionsWithAliasesNoFile): typeof opt extends (TarOptionsWithAliasesSync) ? SyncClass : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass : SyncClass | AsyncClass; + (opt: TarOptionsWithAliasesNoFile, entries: string[]): typeof opt extends TarOptionsWithAliasesSync ? SyncClass : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass : SyncClass | AsyncClass; +} & { + (opt: TarOptionsWithAliases): typeof opt extends (TarOptionsWithAliasesFile) ? typeof opt extends TarOptionsWithAliasesSync ? void : typeof opt extends TarOptionsWithAliasesAsync ? Promise : void | Promise : typeof opt extends TarOptionsWithAliasesNoFile ? typeof opt extends TarOptionsWithAliasesSync ? SyncClass : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass : SyncClass | AsyncClass : typeof opt extends TarOptionsWithAliasesSync ? SyncClass | void : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass | Promise : SyncClass | void | AsyncClass | Promise; +} & { + syncFile: (opt: TarOptionsSyncFile, entries: string[]) => void; + asyncFile: (opt: TarOptionsAsyncFile, entries: string[], cb?: CB) => Promise; + syncNoFile: (opt: TarOptionsSyncNoFile, entries: string[]) => SyncClass; + asyncNoFile: (opt: TarOptionsAsyncNoFile, entries: string[]) => AsyncClass; + validate?: (opt: TarOptions, entries?: string[]) => void; +}; +export declare const makeCommand: (syncFile: (opt: TarOptionsSyncFile, entries: string[]) => void, asyncFile: (opt: TarOptionsAsyncFile, entries: string[], cb?: CB) => Promise, syncNoFile: (opt: TarOptionsSyncNoFile, entries: string[]) => SyncClass, asyncNoFile: (opt: TarOptionsAsyncNoFile, entries: string[]) => AsyncClass, validate?: (opt: TarOptions, entries?: string[]) => void) => TarCommand; +//# sourceMappingURL=make-command.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/make-command.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/make-command.d.ts.map new file mode 100644 index 0000000..f587cbf --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/make-command.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"make-command.d.ts","sourceRoot":"","sources":["../../src/make-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,UAAU,EACV,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,EAC1B,8BAA8B,EAC9B,gCAAgC,EAChC,yBAAyB,EACzB,2BAA2B,EAC3B,yBAAyB,EACzB,6BAA6B,EAC7B,+BAA+B,EAChC,MAAM,cAAc,CAAA;AAErB,MAAM,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,KAAK,GAAG,CAAA;AAEpC,MAAM,MAAM,UAAU,CACpB,UAAU,EACV,SAAS,SAAS;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,IAC9B;IAEF,IAAI,UAAU,CAAA;IACd,CAAC,GAAG,EAAE,gCAAgC,GAAG,UAAU,CAAA;IACnD,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,UAAU,CAAA;IAC/B,CACE,GAAG,EAAE,gCAAgC,EACrC,OAAO,EAAE,MAAM,EAAE,GAChB,UAAU,CAAA;CACd,GAAG;IAEF,CAAC,GAAG,EAAE,+BAA+B,GAAG,SAAS,CAAA;IACjD,CAAC,GAAG,EAAE,+BAA+B,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;CACrE,GAAG;IAEF,CAAC,GAAG,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACpD,CACE,GAAG,EAAE,8BAA8B,EACnC,OAAO,EAAE,MAAM,EAAE,GAChB,OAAO,CAAC,IAAI,CAAC,CAAA;IAChB,CAAC,GAAG,EAAE,8BAA8B,EAAE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AAE,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,EAC9D,WAAW,CACT,GAAG,EAAE,mBAAmB,EACxB,OAAO,EAAE,MAAM,EAAE,EACjB,EAAE,CAAC,EAAE,EAAE,KACJ,OAAO,CAAC,IAAI,CAAC,EAClB,YAAY,CACV,GAAG,EAAE,oBAAoB,EACzB,OAAO,EAAE,MAAM,EAAE,KACd,SAAS,EACd,aAAa,CACX,GAAG,EAAE,qBAAqB,EAC1B,OAAO,EAAE,MAAM,EAAE,KACd,UAAU,EACf,WAAW,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,IAAI,KACvD,UAAU,CAAC,UAAU,EAAE,SAAS,CAmElC,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/make-command.js b/node_modules/cmake-js/node_modules/tar/dist/esm/make-command.js new file mode 100644 index 0000000..f2f737b --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/make-command.js @@ -0,0 +1,57 @@ +import { dealias, isAsyncFile, isAsyncNoFile, isSyncFile, isSyncNoFile, } from './options.js'; +export const makeCommand = (syncFile, asyncFile, syncNoFile, asyncNoFile, validate) => { + return Object.assign((opt_ = [], entries, cb) => { + if (Array.isArray(opt_)) { + entries = opt_; + opt_ = {}; + } + if (typeof entries === 'function') { + cb = entries; + entries = undefined; + } + if (!entries) { + entries = []; + } + else { + entries = Array.from(entries); + } + const opt = dealias(opt_); + validate?.(opt, entries); + if (isSyncFile(opt)) { + if (typeof cb === 'function') { + throw new TypeError('callback not supported for sync tar functions'); + } + return syncFile(opt, entries); + } + else if (isAsyncFile(opt)) { + const p = asyncFile(opt, entries); + // weirdness to make TS happy + const c = cb ? cb : undefined; + return c ? p.then(() => c(), c) : p; + } + else if (isSyncNoFile(opt)) { + if (typeof cb === 'function') { + throw new TypeError('callback not supported for sync tar functions'); + } + return syncNoFile(opt, entries); + } + else if (isAsyncNoFile(opt)) { + if (typeof cb === 'function') { + throw new TypeError('callback only supported with file option'); + } + return asyncNoFile(opt, entries); + /* c8 ignore start */ + } + else { + throw new Error('impossible options??'); + } + /* c8 ignore stop */ + }, { + syncFile, + asyncFile, + syncNoFile, + asyncNoFile, + validate, + }); +}; +//# sourceMappingURL=make-command.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/make-command.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/make-command.js.map new file mode 100644 index 0000000..de11ae4 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/make-command.js.map @@ -0,0 +1 @@ +{"version":3,"file":"make-command.js","sourceRoot":"","sources":["../../src/make-command.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,WAAW,EACX,aAAa,EACb,UAAU,EACV,YAAY,GAeb,MAAM,cAAc,CAAA;AA2IrB,MAAM,CAAC,MAAM,WAAW,GAAG,CAIzB,QAA8D,EAC9D,SAIkB,EAClB,UAGc,EACd,WAGe,EACf,QAAwD,EACrB,EAAE;IACrC,OAAO,MAAM,CAAC,MAAM,CAClB,CACE,OAAyC,EAAE,EAC3C,OAAuB,EACvB,EAAO,EACP,EAAE;QACF,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,GAAG,IAAI,CAAA;YACd,IAAI,GAAG,EAAE,CAAA;QACX,CAAC;QAED,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;YAClC,EAAE,GAAG,OAAO,CAAA;YACZ,OAAO,GAAG,SAAS,CAAA;QACrB,CAAC;QAED,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,GAAG,EAAE,CAAA;QACd,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,CAAC;QAED,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;QAEzB,QAAQ,EAAE,CAAC,GAAG,EAAE,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,QAAQ;KACT,CACmC,CAAA;AACxC,CAAC,CAAA","sourcesContent":["import {\n dealias,\n isAsyncFile,\n isAsyncNoFile,\n isSyncFile,\n isSyncNoFile,\n TarOptions,\n TarOptionsAsyncFile,\n TarOptionsAsyncNoFile,\n TarOptionsSyncFile,\n TarOptionsSyncNoFile,\n TarOptionsWithAliases,\n TarOptionsWithAliasesAsync,\n TarOptionsWithAliasesAsyncFile,\n TarOptionsWithAliasesAsyncNoFile,\n TarOptionsWithAliasesFile,\n TarOptionsWithAliasesNoFile,\n TarOptionsWithAliasesSync,\n TarOptionsWithAliasesSyncFile,\n TarOptionsWithAliasesSyncNoFile,\n} from './options.js'\n\nexport type CB = (er?: Error) => any\n\nexport type TarCommand<\n AsyncClass,\n SyncClass extends { sync: true },\n> = {\n // async and no file specified\n (): AsyncClass\n (opt: TarOptionsWithAliasesAsyncNoFile): AsyncClass\n (entries: string[]): AsyncClass\n (\n opt: TarOptionsWithAliasesAsyncNoFile,\n entries: string[],\n ): AsyncClass\n} & {\n // sync and no file\n (opt: TarOptionsWithAliasesSyncNoFile): SyncClass\n (opt: TarOptionsWithAliasesSyncNoFile, entries: string[]): SyncClass\n} & {\n // async and file\n (opt: TarOptionsWithAliasesAsyncFile): Promise\n (\n opt: TarOptionsWithAliasesAsyncFile,\n entries: string[],\n ): Promise\n (opt: TarOptionsWithAliasesAsyncFile, cb: CB): Promise\n (\n opt: TarOptionsWithAliasesAsyncFile,\n entries: string[],\n cb: CB,\n ): Promise\n} & {\n // sync and file\n (opt: TarOptionsWithAliasesSyncFile): void\n (opt: TarOptionsWithAliasesSyncFile, entries: string[]): void\n} & {\n // sync, maybe file\n (opt: TarOptionsWithAliasesSync): typeof opt extends (\n TarOptionsWithAliasesFile\n ) ?\n void\n : typeof opt extends TarOptionsWithAliasesNoFile ? SyncClass\n : void | SyncClass\n (\n opt: TarOptionsWithAliasesSync,\n entries: string[],\n ): typeof opt extends TarOptionsWithAliasesFile ? void\n : typeof opt extends TarOptionsWithAliasesNoFile ? SyncClass\n : void | SyncClass\n} & {\n // async, maybe file\n (opt: TarOptionsWithAliasesAsync): typeof opt extends (\n TarOptionsWithAliasesFile\n ) ?\n Promise\n : typeof opt extends TarOptionsWithAliasesNoFile ? AsyncClass\n : Promise | AsyncClass\n (\n opt: TarOptionsWithAliasesAsync,\n entries: string[],\n ): typeof opt extends TarOptionsWithAliasesFile ? Promise\n : typeof opt extends TarOptionsWithAliasesNoFile ? AsyncClass\n : Promise | AsyncClass\n (opt: TarOptionsWithAliasesAsync, cb: CB): Promise\n (\n opt: TarOptionsWithAliasesAsync,\n entries: string[],\n cb: CB,\n ): typeof opt extends TarOptionsWithAliasesFile ? Promise\n : typeof opt extends TarOptionsWithAliasesNoFile ? never\n : Promise\n} & {\n // maybe sync, file\n (opt: TarOptionsWithAliasesFile): Promise | void\n (\n opt: TarOptionsWithAliasesFile,\n entries: string[],\n ): typeof opt extends TarOptionsWithAliasesSync ? void\n : typeof opt extends TarOptionsWithAliasesAsync ? Promise\n : Promise | void\n (opt: TarOptionsWithAliasesFile, cb: CB): Promise\n (\n opt: TarOptionsWithAliasesFile,\n entries: string[],\n cb: CB,\n ): typeof opt extends TarOptionsWithAliasesSync ? never\n : typeof opt extends TarOptionsWithAliasesAsync ? Promise\n : Promise\n} & {\n // maybe sync, no file\n (opt: TarOptionsWithAliasesNoFile): typeof opt extends (\n TarOptionsWithAliasesSync\n ) ?\n SyncClass\n : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass\n : SyncClass | AsyncClass\n (\n opt: TarOptionsWithAliasesNoFile,\n entries: string[],\n ): typeof opt extends TarOptionsWithAliasesSync ? SyncClass\n : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass\n : SyncClass | AsyncClass\n} & {\n // maybe sync, maybe file\n (opt: TarOptionsWithAliases): typeof opt extends (\n TarOptionsWithAliasesFile\n ) ?\n typeof opt extends TarOptionsWithAliasesSync ? void\n : typeof opt extends TarOptionsWithAliasesAsync ? Promise\n : void | Promise\n : typeof opt extends TarOptionsWithAliasesNoFile ?\n typeof opt extends TarOptionsWithAliasesSync ? SyncClass\n : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass\n : SyncClass | AsyncClass\n : typeof opt extends TarOptionsWithAliasesSync ? SyncClass | void\n : typeof opt extends TarOptionsWithAliasesAsync ?\n AsyncClass | Promise\n : SyncClass | void | AsyncClass | Promise\n} & {\n // extras\n syncFile: (opt: TarOptionsSyncFile, entries: string[]) => void\n asyncFile: (\n opt: TarOptionsAsyncFile,\n entries: string[],\n cb?: CB,\n ) => Promise\n syncNoFile: (\n opt: TarOptionsSyncNoFile,\n entries: string[],\n ) => SyncClass\n asyncNoFile: (\n opt: TarOptionsAsyncNoFile,\n entries: string[],\n ) => AsyncClass\n validate?: (opt: TarOptions, entries?: string[]) => void\n}\n\nexport const makeCommand = <\n AsyncClass,\n SyncClass extends { sync: true },\n>(\n syncFile: (opt: TarOptionsSyncFile, entries: string[]) => void,\n asyncFile: (\n opt: TarOptionsAsyncFile,\n entries: string[],\n cb?: CB,\n ) => Promise,\n syncNoFile: (\n opt: TarOptionsSyncNoFile,\n entries: string[],\n ) => SyncClass,\n asyncNoFile: (\n opt: TarOptionsAsyncNoFile,\n entries: string[],\n ) => AsyncClass,\n validate?: (opt: TarOptions, entries?: string[]) => void,\n): TarCommand => {\n return Object.assign(\n (\n opt_: TarOptionsWithAliases | string[] = [],\n entries?: string[] | CB,\n cb?: CB,\n ) => {\n if (Array.isArray(opt_)) {\n entries = opt_\n opt_ = {}\n }\n\n if (typeof entries === 'function') {\n cb = entries\n entries = undefined\n }\n\n if (!entries) {\n entries = []\n } else {\n entries = Array.from(entries)\n }\n\n const opt = dealias(opt_)\n\n validate?.(opt, entries)\n\n if (isSyncFile(opt)) {\n if (typeof cb === 'function') {\n throw new TypeError(\n 'callback not supported for sync tar functions',\n )\n }\n return syncFile(opt, entries)\n } else if (isAsyncFile(opt)) {\n const p = asyncFile(opt, entries)\n // weirdness to make TS happy\n const c = cb ? cb : undefined\n return c ? p.then(() => c(), c) : p\n } else if (isSyncNoFile(opt)) {\n if (typeof cb === 'function') {\n throw new TypeError(\n 'callback not supported for sync tar functions',\n )\n }\n return syncNoFile(opt, entries)\n } else if (isAsyncNoFile(opt)) {\n if (typeof cb === 'function') {\n throw new TypeError(\n 'callback only supported with file option',\n )\n }\n return asyncNoFile(opt, entries)\n /* c8 ignore start */\n } else {\n throw new Error('impossible options??')\n }\n /* c8 ignore stop */\n },\n {\n syncFile,\n asyncFile,\n syncNoFile,\n asyncNoFile,\n validate,\n },\n ) as TarCommand\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/mkdir.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/mkdir.d.ts new file mode 100644 index 0000000..dcbea5c --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/mkdir.d.ts @@ -0,0 +1,25 @@ +import { CwdError } from './cwd-error.js'; +import { SymlinkError } from './symlink-error.js'; +export type MkdirOptions = { + uid?: number; + gid?: number; + processUid?: number; + processGid?: number; + umask?: number; + preserve: boolean; + unlink: boolean; + cwd: string; + mode: number; +}; +export type MkdirError = NodeJS.ErrnoException | CwdError | SymlinkError; +/** + * Wrapper around fs/promises.mkdir for tar's needs. + * + * The main purpose is to avoid creating directories if we know that + * they already exist (and track which ones exist for this purpose), + * and prevent entries from being extracted into symlinked folders, + * if `preservePaths` is not set. + */ +export declare const mkdir: (dir: string, opt: MkdirOptions, cb: (er?: null | MkdirError, made?: string) => void) => void | Promise; +export declare const mkdirSync: (dir: string, opt: MkdirOptions) => void | SymlinkError; +//# sourceMappingURL=mkdir.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/mkdir.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/mkdir.d.ts.map new file mode 100644 index 0000000..3d6b446 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/mkdir.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mkdir.d.ts","sourceRoot":"","sources":["../../src/mkdir.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,OAAO,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,UAAU,GAClB,MAAM,CAAC,cAAc,GACrB,QAAQ,GACR,YAAY,CAAA;AAiBhB;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,GAChB,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,GAAG,UAAU,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,yBAoDpD,CAAA;AAiFD,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,EAAE,KAAK,YAAY,wBAqEvD,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/mkdir.js b/node_modules/cmake-js/node_modules/tar/dist/esm/mkdir.js new file mode 100644 index 0000000..9dba701 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/mkdir.js @@ -0,0 +1,180 @@ +import { chownr, chownrSync } from 'chownr'; +import fs from 'node:fs'; +import fsp from 'node:fs/promises'; +import path from 'node:path'; +import { CwdError } from './cwd-error.js'; +import { normalizeWindowsPath } from './normalize-windows-path.js'; +import { SymlinkError } from './symlink-error.js'; +const checkCwd = (dir, cb) => { + fs.stat(dir, (er, st) => { + if (er || !st.isDirectory()) { + er = new CwdError(dir, er?.code || 'ENOTDIR'); + } + cb(er); + }); +}; +/** + * Wrapper around fs/promises.mkdir for tar's needs. + * + * The main purpose is to avoid creating directories if we know that + * they already exist (and track which ones exist for this purpose), + * and prevent entries from being extracted into symlinked folders, + * if `preservePaths` is not set. + */ +export const mkdir = (dir, opt, cb) => { + dir = normalizeWindowsPath(dir); + // if there's any overlap between mask and mode, + // then we'll need an explicit chmod + /* c8 ignore next */ + const umask = opt.umask ?? 0o22; + const mode = opt.mode | 0o0700; + const needChmod = (mode & umask) !== 0; + const uid = opt.uid; + const gid = opt.gid; + const doChown = typeof uid === 'number' && + typeof gid === 'number' && + (uid !== opt.processUid || gid !== opt.processGid); + const preserve = opt.preserve; + const unlink = opt.unlink; + const cwd = normalizeWindowsPath(opt.cwd); + const done = (er, created) => { + if (er) { + cb(er); + } + else { + if (created && doChown) { + chownr(created, uid, gid, er => done(er)); + } + else if (needChmod) { + fs.chmod(dir, mode, cb); + } + else { + cb(); + } + } + }; + if (dir === cwd) { + return checkCwd(dir, done); + } + if (preserve) { + return fsp.mkdir(dir, { mode, recursive: true }).then(made => done(null, made ?? undefined), // oh, ts + done); + } + const sub = normalizeWindowsPath(path.relative(cwd, dir)); + const parts = sub.split('/'); + mkdir_(cwd, parts, mode, unlink, cwd, undefined, done); +}; +const mkdir_ = (base, parts, mode, unlink, cwd, created, cb) => { + if (!parts.length) { + return cb(null, created); + } + const p = parts.shift(); + const part = normalizeWindowsPath(path.resolve(base + '/' + p)); + fs.mkdir(part, mode, onmkdir(part, parts, mode, unlink, cwd, created, cb)); +}; +const onmkdir = (part, parts, mode, unlink, cwd, created, cb) => (er) => { + if (er) { + fs.lstat(part, (statEr, st) => { + if (statEr) { + statEr.path = + statEr.path && normalizeWindowsPath(statEr.path); + cb(statEr); + } + else if (st.isDirectory()) { + mkdir_(part, parts, mode, unlink, cwd, created, cb); + } + else if (unlink) { + fs.unlink(part, er => { + if (er) { + return cb(er); + } + fs.mkdir(part, mode, onmkdir(part, parts, mode, unlink, cwd, created, cb)); + }); + } + else if (st.isSymbolicLink()) { + return cb(new SymlinkError(part, part + '/' + parts.join('/'))); + } + else { + cb(er); + } + }); + } + else { + created = created || part; + mkdir_(part, parts, mode, unlink, cwd, created, cb); + } +}; +const checkCwdSync = (dir) => { + let ok = false; + let code = undefined; + try { + ok = fs.statSync(dir).isDirectory(); + } + catch (er) { + code = er?.code; + } + finally { + if (!ok) { + throw new CwdError(dir, code ?? 'ENOTDIR'); + } + } +}; +export const mkdirSync = (dir, opt) => { + dir = normalizeWindowsPath(dir); + // if there's any overlap between mask and mode, + // then we'll need an explicit chmod + /* c8 ignore next */ + const umask = opt.umask ?? 0o22; + const mode = opt.mode | 0o700; + const needChmod = (mode & umask) !== 0; + const uid = opt.uid; + const gid = opt.gid; + const doChown = typeof uid === 'number' && + typeof gid === 'number' && + (uid !== opt.processUid || gid !== opt.processGid); + const preserve = opt.preserve; + const unlink = opt.unlink; + const cwd = normalizeWindowsPath(opt.cwd); + const done = (created) => { + if (created && doChown) { + chownrSync(created, uid, gid); + } + if (needChmod) { + fs.chmodSync(dir, mode); + } + }; + if (dir === cwd) { + checkCwdSync(cwd); + return done(); + } + if (preserve) { + return done(fs.mkdirSync(dir, { mode, recursive: true }) ?? undefined); + } + const sub = normalizeWindowsPath(path.relative(cwd, dir)); + const parts = sub.split('/'); + let created = undefined; + for (let p = parts.shift(), part = cwd; p && (part += '/' + p); p = parts.shift()) { + part = normalizeWindowsPath(path.resolve(part)); + try { + fs.mkdirSync(part, mode); + created = created || part; + } + catch (er) { + const st = fs.lstatSync(part); + if (st.isDirectory()) { + continue; + } + else if (unlink) { + fs.unlinkSync(part); + fs.mkdirSync(part, mode); + created = created || part; + continue; + } + else if (st.isSymbolicLink()) { + return new SymlinkError(part, part + '/' + parts.join('/')); + } + } + } + return done(created); +}; +//# sourceMappingURL=mkdir.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/mkdir.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/mkdir.js.map new file mode 100644 index 0000000..d76df93 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/mkdir.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mkdir.js","sourceRoot":"","sources":["../../src/mkdir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,GAAG,MAAM,kBAAkB,CAAA;AAClC,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAmBjD,MAAM,QAAQ,GAAG,CACf,GAAW,EACX,EAAmC,EACnC,EAAE;IACF,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;QACtB,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;YAC5B,EAAE,GAAG,IAAI,QAAQ,CACf,GAAG,EACF,EAA4B,EAAE,IAAI,IAAI,SAAS,CACjD,CAAA;QACH,CAAC;QACD,EAAE,CAAC,EAAE,CAAC,CAAA;IACR,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,GAAW,EACX,GAAiB,EACjB,EAAmD,EACnD,EAAE;IACF,GAAG,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAA;IAE/B,gDAAgD;IAChD,oCAAoC;IACpC,oBAAoB;IACpB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,IAAI,IAAI,CAAA;IAC/B,MAAM,IAAI,GAAG,GAA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ACxB,OAAO,GAAG,OAAO,IAAI,IAAI,CAAA;QAC3B,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC;YACZ,MAAM,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;YAC7B,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;gBACrB,SAAQ;YACV,CAAC;iBAAM,IAAI,MAAM,EAAE,CAAC;gBAClB,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;gBACnB,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;gBACxB,OAAO,GAAG,OAAO,IAAI,IAAI,CAAA;gBACzB,SAAQ;YACV,CAAC;iBAAM,IAAI,EAAE,CAAC,cAAc,EAAE,EAAE,CAAC;gBAC/B,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YAC7D,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC,OAAO,CAAC,CAAA;AACtB,CAAC,CAAA","sourcesContent":["import { chownr, chownrSync } from 'chownr'\nimport fs from 'node:fs'\nimport fsp from 'node:fs/promises'\nimport path from 'node:path'\nimport { CwdError } from './cwd-error.js'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport { SymlinkError } from './symlink-error.js'\n\nexport type MkdirOptions = {\n uid?: number\n gid?: number\n processUid?: number\n processGid?: number\n umask?: number\n preserve: boolean\n unlink: boolean\n cwd: string\n mode: number\n}\n\nexport type MkdirError =\n | NodeJS.ErrnoException\n | CwdError\n | SymlinkError\n\nconst checkCwd = (\n dir: string,\n cb: (er?: null | MkdirError) => any,\n) => {\n fs.stat(dir, (er, st) => {\n if (er || !st.isDirectory()) {\n er = new CwdError(\n dir,\n (er as NodeJS.ErrnoException)?.code || 'ENOTDIR',\n )\n }\n cb(er)\n })\n}\n\n/**\n * Wrapper around fs/promises.mkdir for tar's needs.\n *\n * The main purpose is to avoid creating directories if we know that\n * they already exist (and track which ones exist for this purpose),\n * and prevent entries from being extracted into symlinked folders,\n * if `preservePaths` is not set.\n */\nexport const mkdir = (\n dir: string,\n opt: MkdirOptions,\n cb: (er?: null | MkdirError, made?: string) => void,\n) => {\n dir = normalizeWindowsPath(dir)\n\n // if there's any overlap between mask and mode,\n // then we'll need an explicit chmod\n /* c8 ignore next */\n const umask = opt.umask ?? 0o22\n const mode = opt.mode | 0o0700\n const needChmod = (mode & umask) !== 0\n\n const uid = opt.uid\n const gid = opt.gid\n const doChown =\n typeof uid === 'number' &&\n typeof gid === 'number' &&\n (uid !== opt.processUid || gid !== opt.processGid)\n\n const preserve = opt.preserve\n const unlink = opt.unlink\n const cwd = normalizeWindowsPath(opt.cwd)\n\n const done = (er?: null | MkdirError, created?: string) => {\n if (er) {\n cb(er)\n } else {\n if (created && doChown) {\n chownr(created, uid, gid, er =>\n done(er as NodeJS.ErrnoException),\n )\n } else if (needChmod) {\n fs.chmod(dir, mode, cb)\n } else {\n cb()\n }\n }\n }\n\n if (dir === cwd) {\n return checkCwd(dir, done)\n }\n\n if (preserve) {\n return fsp.mkdir(dir, { mode, recursive: true }).then(\n made => done(null, made ?? undefined), // oh, ts\n done,\n )\n }\n\n const sub = normalizeWindowsPath(path.relative(cwd, dir))\n const parts = sub.split('/')\n mkdir_(cwd, parts, mode, unlink, cwd, undefined, done)\n}\n\nconst mkdir_ = (\n base: string,\n parts: string[],\n mode: number,\n unlink: boolean,\n cwd: string,\n created: string | undefined,\n cb: (er?: null | MkdirError, made?: string) => void,\n): void => {\n if (!parts.length) {\n return cb(null, created)\n }\n const p = parts.shift()\n const part = normalizeWindowsPath(path.resolve(base + '/' + p))\n fs.mkdir(\n part,\n mode,\n onmkdir(part, parts, mode, unlink, cwd, created, cb),\n )\n}\n\nconst onmkdir =\n (\n part: string,\n parts: string[],\n mode: number,\n unlink: boolean,\n cwd: string,\n created: string | undefined,\n cb: (er?: null | MkdirError, made?: string) => void,\n ) =>\n (er?: null | NodeJS.ErrnoException) => {\n if (er) {\n fs.lstat(part, (statEr, st) => {\n if (statEr) {\n statEr.path =\n statEr.path && normalizeWindowsPath(statEr.path)\n cb(statEr)\n } else if (st.isDirectory()) {\n mkdir_(part, parts, mode, unlink, cwd, created, cb)\n } else if (unlink) {\n fs.unlink(part, er => {\n if (er) {\n return cb(er)\n }\n fs.mkdir(\n part,\n mode,\n onmkdir(part, parts, mode, unlink, cwd, created, cb),\n )\n })\n } else if (st.isSymbolicLink()) {\n return cb(\n new SymlinkError(part, part + '/' + parts.join('/')),\n )\n } else {\n cb(er)\n }\n })\n } else {\n created = created || part\n mkdir_(part, parts, mode, unlink, cwd, created, cb)\n }\n }\n\nconst checkCwdSync = (dir: string) => {\n let ok = false\n let code: string | undefined = undefined\n try {\n ok = fs.statSync(dir).isDirectory()\n } catch (er) {\n code = (er as NodeJS.ErrnoException)?.code\n } finally {\n if (!ok) {\n throw new CwdError(dir, code ?? 'ENOTDIR')\n }\n }\n}\n\nexport const mkdirSync = (dir: string, opt: MkdirOptions) => {\n dir = normalizeWindowsPath(dir)\n // if there's any overlap between mask and mode,\n // then we'll need an explicit chmod\n /* c8 ignore next */\n const umask = opt.umask ?? 0o22\n const mode = opt.mode | 0o700\n const needChmod = (mode & umask) !== 0\n\n const uid = opt.uid\n const gid = opt.gid\n const doChown =\n typeof uid === 'number' &&\n typeof gid === 'number' &&\n (uid !== opt.processUid || gid !== opt.processGid)\n\n const preserve = opt.preserve\n const unlink = opt.unlink\n const cwd = normalizeWindowsPath(opt.cwd)\n\n const done = (created?: string | undefined) => {\n if (created && doChown) {\n chownrSync(created, uid, gid)\n }\n if (needChmod) {\n fs.chmodSync(dir, mode)\n }\n }\n\n if (dir === cwd) {\n checkCwdSync(cwd)\n return done()\n }\n\n if (preserve) {\n return done(\n fs.mkdirSync(dir, { mode, recursive: true }) ?? undefined,\n )\n }\n\n const sub = normalizeWindowsPath(path.relative(cwd, dir))\n const parts = sub.split('/')\n let created: string | undefined = undefined\n for (\n let p = parts.shift(), part = cwd;\n p && (part += '/' + p);\n p = parts.shift()\n ) {\n part = normalizeWindowsPath(path.resolve(part))\n\n try {\n fs.mkdirSync(part, mode)\n created = created || part\n } catch (er) {\n const st = fs.lstatSync(part)\n if (st.isDirectory()) {\n continue\n } else if (unlink) {\n fs.unlinkSync(part)\n fs.mkdirSync(part, mode)\n created = created || part\n continue\n } else if (st.isSymbolicLink()) {\n return new SymlinkError(part, part + '/' + parts.join('/'))\n }\n }\n }\n\n return done(created)\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/mode-fix.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/mode-fix.d.ts new file mode 100644 index 0000000..38f3d93 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/mode-fix.d.ts @@ -0,0 +1,2 @@ +export declare const modeFix: (mode: number, isDir: boolean, portable: boolean) => number; +//# sourceMappingURL=mode-fix.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/mode-fix.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/mode-fix.d.ts.map new file mode 100644 index 0000000..d51aa06 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/mode-fix.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-fix.d.ts","sourceRoot":"","sources":["../../src/mode-fix.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,GAClB,MAAM,MAAM,EACZ,OAAO,OAAO,EACd,UAAU,OAAO,WA0BlB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/mode-fix.js b/node_modules/cmake-js/node_modules/tar/dist/esm/mode-fix.js new file mode 100644 index 0000000..5fd3bb8 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/mode-fix.js @@ -0,0 +1,25 @@ +export const modeFix = (mode, isDir, portable) => { + mode &= 0o7777; + // in portable mode, use the minimum reasonable umask + // if this system creates files with 0o664 by default + // (as some linux distros do), then we'll write the + // archive with 0o644 instead. Also, don't ever create + // a file that is not readable/writable by the owner. + if (portable) { + mode = (mode | 0o600) & ~0o22; + } + // if dirs are readable, then they should be listable + if (isDir) { + if (mode & 0o400) { + mode |= 0o100; + } + if (mode & 0o40) { + mode |= 0o10; + } + if (mode & 0o4) { + mode |= 0o1; + } + } + return mode; +}; +//# sourceMappingURL=mode-fix.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/mode-fix.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/mode-fix.js.map new file mode 100644 index 0000000..84efa64 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/mode-fix.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-fix.js","sourceRoot":"","sources":["../../src/mode-fix.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,IAAY,EACZ,KAAc,EACd,QAAiB,EACjB,EAAE;IACF,IAAI,IAAI,MAAM,CAAA;IAEd,qDAAqD;IACrD,qDAAqD;IACrD,mDAAmD;IACnD,uDAAuD;IACvD,qDAAqD;IACrD,IAAI,QAAQ,EAAE,CAAC;QACb,IAAI,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAA;IAC/B,CAAC;IAED,qDAAqD;IACrD,IAAI,KAAK,EAAE,CAAC;QACV,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;YACjB,IAAI,IAAI,KAAK,CAAA;QACf,CAAC;QACD,IAAI,IAAI,GAAG,IAAI,EAAE,CAAC;YAChB,IAAI,IAAI,IAAI,CAAA;QACd,CAAC;QACD,IAAI,IAAI,GAAG,GAAG,EAAE,CAAC;YACf,IAAI,IAAI,GAAG,CAAA;QACb,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA","sourcesContent":["export const modeFix = (\n mode: number,\n isDir: boolean,\n portable: boolean,\n) => {\n mode &= 0o7777\n\n // in portable mode, use the minimum reasonable umask\n // if this system creates files with 0o664 by default\n // (as some linux distros do), then we'll write the\n // archive with 0o644 instead. Also, don't ever create\n // a file that is not readable/writable by the owner.\n if (portable) {\n mode = (mode | 0o600) & ~0o22\n }\n\n // if dirs are readable, then they should be listable\n if (isDir) {\n if (mode & 0o400) {\n mode |= 0o100\n }\n if (mode & 0o40) {\n mode |= 0o10\n }\n if (mode & 0o4) {\n mode |= 0o1\n }\n }\n return mode\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-unicode.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-unicode.d.ts new file mode 100644 index 0000000..71df092 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-unicode.d.ts @@ -0,0 +1,2 @@ +export declare const normalizeUnicode: (s: string) => string; +//# sourceMappingURL=normalize-unicode.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-unicode.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-unicode.d.ts.map new file mode 100644 index 0000000..459f68f --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-unicode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"normalize-unicode.d.ts","sourceRoot":"","sources":["../../src/normalize-unicode.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,gBAAgB,GAAI,GAAG,MAAM,KAAG,MAyB5C,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-unicode.js b/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-unicode.js new file mode 100644 index 0000000..8fa17f5 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-unicode.js @@ -0,0 +1,34 @@ +// warning: extremely hot code path. +// This has been meticulously optimized for use +// within npm install on large package trees. +// Do not edit without careful benchmarking. +const normalizeCache = Object.create(null); +// Limit the size of this. Very low-sophistication LRU cache +const MAX = 10000; +const cache = new Set(); +export const normalizeUnicode = (s) => { + if (!cache.has(s)) { + // shake out identical accents and ligatures + normalizeCache[s] = s + .normalize('NFD') + .toLocaleLowerCase('en') + .toLocaleUpperCase('en'); + } + else { + cache.delete(s); + } + cache.add(s); + const ret = normalizeCache[s]; + let i = cache.size - MAX; + // only prune when we're 10% over the max + if (i > MAX / 10) { + for (const s of cache) { + cache.delete(s); + delete normalizeCache[s]; + if (--i <= 0) + break; + } + } + return ret; +}; +//# sourceMappingURL=normalize-unicode.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-unicode.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-unicode.js.map new file mode 100644 index 0000000..fd85924 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-unicode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalize-unicode.js","sourceRoot":"","sources":["../../src/normalize-unicode.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,+CAA+C;AAC/C,6CAA6C;AAC7C,4CAA4C;AAC5C,MAAM,cAAc,GAA2B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AAElE,4DAA4D;AAC5D,MAAM,GAAG,GAAG,KAAK,CAAA;AACjB,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;AAC/B,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAS,EAAU,EAAE;IACpD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAClB,4CAA4C;QAC5C,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC;aAClB,SAAS,CAAC,KAAK,CAAC;aAChB,iBAAiB,CAAC,IAAI,CAAC;aACvB,iBAAiB,CAAC,IAAI,CAAC,CAAA;IAC5B,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IAEZ,MAAM,GAAG,GAAG,cAAc,CAAC,CAAC,CAAW,CAAA;IAEvC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG,GAAG,CAAA;IACxB,yCAAyC;IACzC,IAAI,CAAC,GAAG,GAAG,GAAG,EAAE,EAAE,CAAC;QACjB,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;YACf,OAAO,cAAc,CAAC,CAAC,CAAC,CAAA;YACxB,IAAI,EAAE,CAAC,IAAI,CAAC;gBAAE,MAAK;QACrB,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA","sourcesContent":["// warning: extremely hot code path.\n// This has been meticulously optimized for use\n// within npm install on large package trees.\n// Do not edit without careful benchmarking.\nconst normalizeCache: Record = Object.create(null)\n\n// Limit the size of this. Very low-sophistication LRU cache\nconst MAX = 10000\nconst cache = new Set()\nexport const normalizeUnicode = (s: string): string => {\n if (!cache.has(s)) {\n // shake out identical accents and ligatures\n normalizeCache[s] = s\n .normalize('NFD')\n .toLocaleLowerCase('en')\n .toLocaleUpperCase('en')\n } else {\n cache.delete(s)\n }\n cache.add(s)\n\n const ret = normalizeCache[s] as string\n\n let i = cache.size - MAX\n // only prune when we're 10% over the max\n if (i > MAX / 10) {\n for (const s of cache) {\n cache.delete(s)\n delete normalizeCache[s]\n if (--i <= 0) break\n }\n }\n\n return ret\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-windows-path.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-windows-path.d.ts new file mode 100644 index 0000000..8581105 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-windows-path.d.ts @@ -0,0 +1,2 @@ +export declare const normalizeWindowsPath: (p: string) => string; +//# sourceMappingURL=normalize-windows-path.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-windows-path.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-windows-path.d.ts.map new file mode 100644 index 0000000..25de3c0 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-windows-path.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"normalize-windows-path.d.ts","sourceRoot":"","sources":["../../src/normalize-windows-path.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,oBAAoB,MAEzB,MAAM,WAC+B,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-windows-path.js b/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-windows-path.js new file mode 100644 index 0000000..2d97d2b --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-windows-path.js @@ -0,0 +1,9 @@ +// on windows, either \ or / are valid directory separators. +// on unix, \ is a valid character in filenames. +// so, on windows, and only on windows, we replace all \ chars with /, +// so that we can use / as our one and only directory separator char. +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; +export const normalizeWindowsPath = platform !== 'win32' ? + (p) => p + : (p) => p && p.replace(/\\/g, '/'); +//# sourceMappingURL=normalize-windows-path.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-windows-path.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-windows-path.js.map new file mode 100644 index 0000000..03be019 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/normalize-windows-path.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalize-windows-path.js","sourceRoot":"","sources":["../../src/normalize-windows-path.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,gDAAgD;AAChD,sEAAsE;AACtE,qEAAqE;AAErE,MAAM,QAAQ,GACZ,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,OAAO,CAAC,QAAQ,CAAA;AAE3D,MAAM,CAAC,MAAM,oBAAoB,GAC/B,QAAQ,KAAK,OAAO,CAAC,CAAC;IACpB,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA","sourcesContent":["// on windows, either \\ or / are valid directory separators.\n// on unix, \\ is a valid character in filenames.\n// so, on windows, and only on windows, we replace all \\ chars with /,\n// so that we can use / as our one and only directory separator char.\n\nconst platform =\n process.env.TESTING_TAR_FAKE_PLATFORM || process.platform\n\nexport const normalizeWindowsPath =\n platform !== 'win32' ?\n (p: string) => p\n : (p: string) => p && p.replace(/\\\\/g, '/')\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/options.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/options.d.ts new file mode 100644 index 0000000..f6ccc8f --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/options.d.ts @@ -0,0 +1,596 @@ +import { type GzipOptions, type ZlibOptions } from 'minizlib'; +import { type Stats } from 'node:fs'; +import { type ReadEntry } from './read-entry.js'; +import { type WarnData } from './warn-method.js'; +import { WriteEntry } from './write-entry.js'; +/** + * The options that can be provided to tar commands. + * + * Note that some of these are only relevant for certain commands, since + * they are specific to reading or writing. + * + * Aliases are provided in the {@link TarOptionsWithAliases} type. + */ +export interface TarOptions { + /** + * Perform all I/O operations synchronously. If the stream is ended + * immediately, then it will be processed entirely synchronously. + */ + sync?: boolean; + /** + * The tar file to be read and/or written. When this is set, a stream + * is not returned. Asynchronous commands will return a promise indicating + * when the operation is completed, and synchronous commands will return + * immediately. + */ + file?: string; + /** + * Treat warnings as crash-worthy errors. Defaults false. + */ + strict?: boolean; + /** + * The effective current working directory for this tar command + */ + cwd?: string; + /** + * When creating a tar archive, this can be used to compress it as well. + * Set to `true` to use the default gzip options, or customize them as + * needed. + * + * When reading, if this is unset, then the compression status will be + * inferred from the archive data. This is generally best, unless you are + * sure of the compression settings in use to create the archive, and want to + * fail if the archive doesn't match expectations. + */ + gzip?: boolean | GzipOptions; + /** + * When creating archives, preserve absolute and `..` paths in the archive, + * rather than sanitizing them under the cwd. + * + * When extracting, allow absolute paths, paths containing `..`, and + * extracting through symbolic links. By default, the root `/` is stripped + * from absolute paths (eg, turning `/x/y/z` into `x/y/z`), paths containing + * `..` are not extracted, and any file whose location would be modified by a + * symbolic link is not extracted. + * + * **WARNING** This is almost always unsafe, and must NEVER be used on + * archives from untrusted sources, such as user input, and every entry must + * be validated to ensure it is safe to write. Even if the input is not + * malicious, mistakes can cause a lot of damage! + */ + preservePaths?: boolean; + /** + * When extracting, do not set the `mtime` value for extracted entries to + * match the `mtime` in the archive. + * + * When creating archives, do not store the `mtime` value in the entry. Note + * that this prevents properly using other mtime-based features (such as + * `tar.update` or the `newer` option) with the resulting archive. + */ + noMtime?: boolean; + /** + * Set to `true` or an object with settings for `zlib.BrotliCompress()` to + * create a brotli-compressed archive + * + * When extracting, this will cause the archive to be treated as a + * brotli-compressed file if set to `true` or a ZlibOptions object. + * + * If set `false`, then brotli options will not be used. + * + * If this, the `gzip`, and `zstd` options are left `undefined`, then tar + * will attempt to infer the brotli compression status, but can only do so + * based on the filename. If the filename ends in `.tbr` or `.tar.br`, and + * the first 512 bytes are not a valid tar header, then brotli decompression + * will be attempted. + */ + brotli?: boolean | ZlibOptions; + /** + * Set to `true` or an object with settings for `zstd.compress()` to + * create a zstd-compressed archive + * + * When extracting, this will cause the archive to be treated as a + * zstd-compressed file if set to `true` or a ZlibOptions object. + * + * If set `false`, then zstd options will not be used. + * + * If this, the `gzip`, and `brotli` options are left `undefined`, then tar + * will attempt to infer the zstd compression status, but can only do so + * based on the filename. If the filename ends in `.tzst` or `.tar.zst`, and + * the first 512 bytes are not a valid tar header, then zstd decompression + * will be attempted. + */ + zstd?: boolean | ZlibOptions; + /** + * A function that is called with `(path, stat)` when creating an archive, or + * `(path, entry)` when extracting. Return true to process the file/entry, or + * false to exclude it. + */ + filter?: (path: string, entry: Stats | ReadEntry) => boolean; + /** + * A function that gets called for any warning encountered. + * + * Note: if `strict` is set, then the warning will throw, and this method + * will not be called. + */ + onwarn?: (code: string, message: string, data: WarnData) => any; + /** + * When extracting, unlink files before creating them. Without this option, + * tar overwrites existing files, which preserves existing hardlinks. With + * this option, existing hardlinks will be broken, as will any symlink that + * would affect the location of an extracted file. + */ + unlink?: boolean; + /** + * When extracting, strip the specified number of path portions from the + * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be + * extracted to `{cwd}/c/d`. + * + * Any entry whose entire path is stripped will be excluded. + */ + strip?: number; + /** + * When extracting, keep the existing file on disk if it's newer than the + * file in the archive. + */ + newer?: boolean; + /** + * When extracting, do not overwrite existing files at all. + */ + keep?: boolean; + /** + * When extracting, set the `uid` and `gid` of extracted entries to the `uid` + * and `gid` fields in the archive. Defaults to true when run as root, and + * false otherwise. + * + * If false, then files and directories will be set with the owner and group + * of the user running the process. This is similar to `-p` in `tar(1)`, but + * ACLs and other system-specific data is never unpacked in this + * implementation, and modes are set by default already. + */ + preserveOwner?: boolean; + /** + * The maximum depth of subfolders to extract into. This defaults to 1024. + * Anything deeper than the limit will raise a warning and skip the entry. + * Set to `Infinity` to remove the limitation. + */ + maxDepth?: number; + /** + * When extracting, force all created files and directories, and all + * implicitly created directories, to be owned by the specified user id, + * regardless of the `uid` field in the archive. + * + * Cannot be used along with `preserveOwner`. Requires also setting the `gid` + * option. + */ + uid?: number; + /** + * When extracting, force all created files and directories, and all + * implicitly created directories, to be owned by the specified group id, + * regardless of the `gid` field in the archive. + * + * Cannot be used along with `preserveOwner`. Requires also setting the `uid` + * option. + */ + gid?: number; + /** + * When extracting, provide a function that takes an `entry` object, and + * returns a stream, or any falsey value. If a stream is provided, then that + * stream's data will be written instead of the contents of the archive + * entry. If a falsey value is provided, then the entry is written to disk as + * normal. + * + * To exclude items from extraction, use the `filter` option. + * + * Note that using an asynchronous stream type with the `transform` option + * will cause undefined behavior in synchronous extractions. + * [MiniPass](http://npm.im/minipass)-based streams are designed for this use + * case. + */ + transform?: (entry: ReadEntry) => any; + /** + * Call `chmod()` to ensure that extracted files match the entry's mode + * field. Without this field set, all mode fields in archive entries are a + * best effort attempt only. + * + * Setting this necessitates a call to the deprecated `process.umask()` + * method to determine the default umask value, unless a `processUmask` + * config is provided as well. + * + * If not set, tar will attempt to create file system entries with whatever + * mode is provided, and let the implicit process `umask` apply normally, but + * if a file already exists to be written to, then its existing mode will not + * be modified. + * + * When setting `chmod: true`, it is highly recommend to set the + * {@link TarOptions#processUmask} option as well, to avoid the call to the + * deprecated (and thread-unsafe) `process.umask()` method. + */ + chmod?: boolean; + /** + * When setting the {@link TarOptions#chmod} option to `true`, you may + * provide a value here to avoid having to call the deprecated and + * thread-unsafe `process.umask()` method. + * + * This has no effect with `chmod` is not set to true, as mode values are not + * set explicitly anyway. If `chmod` is set to `true`, and a value is not + * provided here, then `process.umask()` must be called, which will result in + * deprecation warnings. + * + * The most common values for this are `0o22` (resulting in directories + * created with mode `0o755` and files with `0o644` by default) and `0o2` + * (resulting in directores created with mode `0o775` and files `0o664`, so + * they are group-writable). + */ + processUmask?: number; + /** + * When parsing/listing archives, `entry` streams are by default resumed + * (set into "flowing" mode) immediately after the call to `onReadEntry()`. + * Set `noResume: true` to suppress this behavior. + * + * Note that when this is set, the stream will never complete until the + * data is consumed somehow. + * + * Set automatically in extract operations, since the entry is piped to + * a file system entry right away. Only relevant when parsing. + */ + noResume?: boolean; + /** + * When creating, updating, or replacing within archives, this method will + * be called with each WriteEntry that is created. + */ + onWriteEntry?: (entry: WriteEntry) => any; + /** + * When extracting or listing archives, this method will be called with + * each entry that is not excluded by a `filter`. + * + * Important when listing archives synchronously from a file, because there + * is otherwise no way to interact with the data! + */ + onReadEntry?: (entry: ReadEntry) => any; + /** + * Pack the targets of symbolic links rather than the link itself. + */ + follow?: boolean; + /** + * When creating archives, omit any metadata that is system-specific: + * `ctime`, `atime`, `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and + * `nlink`. Note that `mtime` is still included, because this is necessary + * for other time-based operations such as `tar.update`. Additionally, `mode` + * is set to a "reasonable default" for mose unix systems, based on an + * effective `umask` of `0o22`. + * + * This also defaults the `portable` option in the gzip configs when creating + * a compressed archive, in order to produce deterministic archives that are + * not operating-system specific. + */ + portable?: boolean; + /** + * When creating archives, do not recursively archive the contents of + * directories. By default, archiving a directory archives all of its + * contents as well. + */ + noDirRecurse?: boolean; + /** + * Suppress Pax extended headers when creating archives. Note that this means + * long paths and linkpaths will be truncated, and large or negative numeric + * values may be interpreted incorrectly. + */ + noPax?: boolean; + /** + * Set to a `Date` object to force a specific `mtime` value for everything + * written to an archive. + * + * This is useful when creating archives that are intended to be + * deterministic based on their contents, irrespective of the file's last + * modification time. + * + * Overridden by `noMtime`. + */ + mtime?: Date; + /** + * A path portion to prefix onto the entries added to an archive. + */ + prefix?: string; + /** + * The mode to set on any created file archive, defaults to 0o666 + * masked by the process umask, often resulting in 0o644. + * + * This does *not* affect the mode fields of individual entries, or the + * mode status of extracted entries on the filesystem. + */ + mode?: number; + /** + * A cache of mtime values, to avoid having to stat the same file repeatedly. + * + * @internal + */ + mtimeCache?: Map; + /** + * maximum buffer size for `fs.read()` operations. + * + * @internal + */ + maxReadSize?: number; + /** + * Filter modes of entries being unpacked, like `process.umask()` + * + * @internal + */ + umask?: number; + /** + * Default mode for directories. Used for all implicitly created directories, + * and any directories in the archive that do not have a mode field. + * + * @internal + */ + dmode?: number; + /** + * default mode for files + * + * @internal + */ + fmode?: number; + /** + * Map that tracks which directories already exist, for extraction + * + * @internal + */ + dirCache?: Map; + /** + * maximum supported size of meta entries. Defaults to 1MB + * + * @internal + */ + maxMetaEntrySize?: number; + /** + * A Map object containing the device and inode value for any file whose + * `nlink` value is greater than 1, to identify hard links when creating + * archives. + * + * @internal + */ + linkCache?: Map; + /** + * A map object containing the results of `fs.readdir()` calls. + * + * @internal + */ + readdirCache?: Map; + /** + * A cache of all `lstat` results, for use in creating archives. + * + * @internal + */ + statCache?: Map; + /** + * Number of concurrent jobs to run when creating archives. + * + * Defaults to 4. + * + * @internal + */ + jobs?: number; + /** + * Automatically set to true on Windows systems. + * + * When extracting, causes behavior where filenames containing `<|>?:` + * characters are converted to windows-compatible escape sequences in the + * created filesystem entries. + * + * When packing, causes behavior where paths replace `\` with `/`, and + * filenames containing the windows-compatible escaped forms of `<|>?:` are + * converted to actual `<|>?:` characters in the archive. + * + * @internal + */ + win32?: boolean; + /** + * For `WriteEntry` objects, the absolute path to the entry on the + * filesystem. By default, this is `resolve(cwd, entry.path)`, but it can be + * overridden explicitly. + * + * @internal + */ + absolute?: string; + /** + * Used with Parser stream interface, to attach and take over when the + * stream is completely parsed. If this is set, then the prefinish, + * finish, and end events will not fire, and are the responsibility of + * the ondone method to emit properly. + * + * @internal + */ + ondone?: () => void; + /** + * Mostly for testing, but potentially useful in some cases. + * Forcibly trigger a chown on every entry, no matter what. + */ + forceChown?: boolean; + /** + * ambiguous deprecated name for {@link onReadEntry} + * + * @deprecated + */ + onentry?: (entry: ReadEntry) => any; +} +export type TarOptionsSync = TarOptions & { + sync: true; +}; +export type TarOptionsAsync = TarOptions & { + sync?: false; +}; +export type TarOptionsFile = TarOptions & { + file: string; +}; +export type TarOptionsNoFile = TarOptions & { + file?: undefined; +}; +export type TarOptionsSyncFile = TarOptionsSync & TarOptionsFile; +export type TarOptionsAsyncFile = TarOptionsAsync & TarOptionsFile; +export type TarOptionsSyncNoFile = TarOptionsSync & TarOptionsNoFile; +export type TarOptionsAsyncNoFile = TarOptionsAsync & TarOptionsNoFile; +export type LinkCacheKey = `${number}:${number}`; +export interface TarOptionsWithAliases extends TarOptions { + /** + * The effective current working directory for this tar command + */ + C?: TarOptions['cwd']; + /** + * The tar file to be read and/or written. When this is set, a stream + * is not returned. Asynchronous commands will return a promise indicating + * when the operation is completed, and synchronous commands will return + * immediately. + */ + f?: TarOptions['file']; + /** + * When creating a tar archive, this can be used to compress it as well. + * Set to `true` to use the default gzip options, or customize them as + * needed. + * + * When reading, if this is unset, then the compression status will be + * inferred from the archive data. This is generally best, unless you are + * sure of the compression settings in use to create the archive, and want to + * fail if the archive doesn't match expectations. + */ + z?: TarOptions['gzip']; + /** + * When creating archives, preserve absolute and `..` paths in the archive, + * rather than sanitizing them under the cwd. + * + * When extracting, allow absolute paths, paths containing `..`, and + * extracting through symbolic links. By default, the root `/` is stripped + * from absolute paths (eg, turning `/x/y/z` into `x/y/z`), paths containing + * `..` are not extracted, and any file whose location would be modified by a + * symbolic link is not extracted. + * + * **WARNING** This is almost always unsafe, and must NEVER be used on + * archives from untrusted sources, such as user input, and every entry must + * be validated to ensure it is safe to write. Even if the input is not + * malicious, mistakes can cause a lot of damage! + */ + P?: TarOptions['preservePaths']; + /** + * When extracting, unlink files before creating them. Without this option, + * tar overwrites existing files, which preserves existing hardlinks. With + * this option, existing hardlinks will be broken, as will any symlink that + * would affect the location of an extracted file. + */ + U?: TarOptions['unlink']; + /** + * When extracting, strip the specified number of path portions from the + * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be + * extracted to `{cwd}/c/d`. + */ + 'strip-components'?: TarOptions['strip']; + /** + * When extracting, strip the specified number of path portions from the + * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be + * extracted to `{cwd}/c/d`. + */ + stripComponents?: TarOptions['strip']; + /** + * When extracting, keep the existing file on disk if it's newer than the + * file in the archive. + */ + 'keep-newer'?: TarOptions['newer']; + /** + * When extracting, keep the existing file on disk if it's newer than the + * file in the archive. + */ + keepNewer?: TarOptions['newer']; + /** + * When extracting, keep the existing file on disk if it's newer than the + * file in the archive. + */ + 'keep-newer-files'?: TarOptions['newer']; + /** + * When extracting, keep the existing file on disk if it's newer than the + * file in the archive. + */ + keepNewerFiles?: TarOptions['newer']; + /** + * When extracting, do not overwrite existing files at all. + */ + k?: TarOptions['keep']; + /** + * When extracting, do not overwrite existing files at all. + */ + 'keep-existing'?: TarOptions['keep']; + /** + * When extracting, do not overwrite existing files at all. + */ + keepExisting?: TarOptions['keep']; + /** + * When extracting, do not set the `mtime` value for extracted entries to + * match the `mtime` in the archive. + * + * When creating archives, do not store the `mtime` value in the entry. Note + * that this prevents properly using other mtime-based features (such as + * `tar.update` or the `newer` option) with the resulting archive. + */ + m?: TarOptions['noMtime']; + /** + * When extracting, do not set the `mtime` value for extracted entries to + * match the `mtime` in the archive. + * + * When creating archives, do not store the `mtime` value in the entry. Note + * that this prevents properly using other mtime-based features (such as + * `tar.update` or the `newer` option) with the resulting archive. + */ + 'no-mtime'?: TarOptions['noMtime']; + /** + * When extracting, set the `uid` and `gid` of extracted entries to the `uid` + * and `gid` fields in the archive. Defaults to true when run as root, and + * false otherwise. + * + * If false, then files and directories will be set with the owner and group + * of the user running the process. This is similar to `-p` in `tar(1)`, but + * ACLs and other system-specific data is never unpacked in this + * implementation, and modes are set by default already. + */ + p?: TarOptions['preserveOwner']; + /** + * Pack the targets of symbolic links rather than the link itself. + */ + L?: TarOptions['follow']; + /** + * Pack the targets of symbolic links rather than the link itself. + */ + h?: TarOptions['follow']; + /** + * Deprecated option. Set explicitly false to set `chmod: true`. Ignored + * if {@link TarOptions#chmod} is set to any boolean value. + * + * @deprecated + */ + noChmod?: boolean; +} +export type TarOptionsWithAliasesSync = TarOptionsWithAliases & { + sync: true; +}; +export type TarOptionsWithAliasesAsync = TarOptionsWithAliases & { + sync?: false; +}; +export type TarOptionsWithAliasesFile = (TarOptionsWithAliases & { + file: string; +}) | (TarOptionsWithAliases & { + f: string; +}); +export type TarOptionsWithAliasesSyncFile = TarOptionsWithAliasesSync & TarOptionsWithAliasesFile; +export type TarOptionsWithAliasesAsyncFile = TarOptionsWithAliasesAsync & TarOptionsWithAliasesFile; +export type TarOptionsWithAliasesNoFile = TarOptionsWithAliases & { + f?: undefined; + file?: undefined; +}; +export type TarOptionsWithAliasesSyncNoFile = TarOptionsWithAliasesSync & TarOptionsWithAliasesNoFile; +export type TarOptionsWithAliasesAsyncNoFile = TarOptionsWithAliasesAsync & TarOptionsWithAliasesNoFile; +export declare const isSyncFile: (o: O) => o is O & TarOptionsSyncFile; +export declare const isAsyncFile: (o: O) => o is O & TarOptionsAsyncFile; +export declare const isSyncNoFile: (o: O) => o is O & TarOptionsSyncNoFile; +export declare const isAsyncNoFile: (o: O) => o is O & TarOptionsAsyncNoFile; +export declare const isSync: (o: O) => o is O & TarOptionsSync; +export declare const isAsync: (o: O) => o is O & TarOptionsAsync; +export declare const isFile: (o: O) => o is O & TarOptionsFile; +export declare const isNoFile: (o: O) => o is O & TarOptionsNoFile; +export declare const dealias: (opt?: TarOptionsWithAliases) => TarOptions; +//# sourceMappingURL=options.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/options.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/options.d.ts.map new file mode 100644 index 0000000..1171ea7 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/options.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AA2B7C;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IAIzB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IAEd;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEh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;AACvD,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,UAAU,EACzC,GAAG,CAAC,KACH,CAAC,IAAI,CAAC,GAAG,cAA0B,CAAA;AACtC,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,UAAU,EAC1C,GAAG,CAAC,KACH,CAAC,IAAI,CAAC,GAAG,eAA0B,CAAA;AACtC,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,UAAU,EACzC,GAAG,CAAC,KACH,CAAC,IAAI,CAAC,GAAG,cAA0B,CAAA;AACtC,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,UAAU,EAC3C,GAAG,CAAC,KACH,CAAC,IAAI,CAAC,GAAG,gBAA2B,CAAA;AAUvC,eAAO,MAAM,OAAO,GAClB,MAAK,qBAA0B,KAC9B,UAiBF,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/options.js b/node_modules/cmake-js/node_modules/tar/dist/esm/options.js new file mode 100644 index 0000000..a006d36 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/options.js @@ -0,0 +1,54 @@ +// turn tar(1) style args like `C` into the more verbose things like `cwd` +const argmap = new Map([ + ['C', 'cwd'], + ['f', 'file'], + ['z', 'gzip'], + ['P', 'preservePaths'], + ['U', 'unlink'], + ['strip-components', 'strip'], + ['stripComponents', 'strip'], + ['keep-newer', 'newer'], + ['keepNewer', 'newer'], + ['keep-newer-files', 'newer'], + ['keepNewerFiles', 'newer'], + ['k', 'keep'], + ['keep-existing', 'keep'], + ['keepExisting', 'keep'], + ['m', 'noMtime'], + ['no-mtime', 'noMtime'], + ['p', 'preserveOwner'], + ['L', 'follow'], + ['h', 'follow'], + ['onentry', 'onReadEntry'], +]); +export const isSyncFile = (o) => !!o.sync && !!o.file; +export const isAsyncFile = (o) => !o.sync && !!o.file; +export const isSyncNoFile = (o) => !!o.sync && !o.file; +export const isAsyncNoFile = (o) => !o.sync && !o.file; +export const isSync = (o) => !!o.sync; +export const isAsync = (o) => !o.sync; +export const isFile = (o) => !!o.file; +export const isNoFile = (o) => !o.file; +const dealiasKey = (k) => { + const d = argmap.get(k); + if (d) + return d; + return k; +}; +export const dealias = (opt = {}) => { + if (!opt) + return {}; + const result = {}; + for (const [key, v] of Object.entries(opt)) { + // TS doesn't know that aliases are going to always be the same type + const k = dealiasKey(key); + result[k] = v; + } + // affordance for deprecated noChmod -> chmod + if (result.chmod === undefined && result.noChmod === false) { + result.chmod = true; + } + delete result.noChmod; + return result; +}; +//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/options.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/options.js.map new file mode 100644 index 0000000..ac78a6b --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/options.js.map @@ -0,0 +1 @@ +{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAQ1E,MAAM,MAAM,GAAG,IAAI,GAAG,CACpB;IACE,CAAC,GAAG,EAAE,KAAK,CAAC;IACZ,CAAC,GAAG,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,eAAe,CAAC;IACtB,CAAC,GAAG,EAAE,QAAQ,CAAC;IACf,CAAC,kBAAkB,EAAE,OAAO,CAAC;IAC7B,CAAC,iBAAiB,EAAE,OAAO,CAAC;IAC5B,CAAC,YAAY,EAAE,OAAO,CAAC;IACvB,CAAC,WAAW,EAAE,OAAO,CAAC;IACtB,CAAC,kBAAkB,EAAE,OAAO,CAAC;IAC7B,CAAC,gBAAgB,EAAE,OAAO,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,CAAC;IACb,CAAC,eAAe,EAAE,MAAM,CAAC;IACzB,CAAC,cAAc,EAAE,MAAM,CAAC;IACxB,CAAC,GAAG,EAAE,SAAS,CAAC;IAChB,CAAC,UAAU,EAAE,SAAS,CAAC;IACvB,CAAC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O,CAAC,CAAA;IACf,OAAO,CAAqB,CAAA;AAC9B,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,MAA6B,EAAE,EACnB,EAAE;IACd,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAA;IACnB,MAAM,MAAM,GAAwB,EAAE,CAAA;IACtC,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAGtC,EAAE,CAAC;QACJ,oEAAoE;QACpE,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;QACzB,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;IACf,CAAC;IACD,6CAA6C;IAC7C,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;QAC3D,MAAM,CAAC,KAAK,GAAG,IAAI,CAAA;IACrB,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAA;IACrB,OAAO,MAAoB,CAAA;AAC7B,CAAC,CAAA","sourcesContent":["// turn tar(1) style args like `C` into the more verbose things like `cwd`\n\nimport { type GzipOptions, type ZlibOptions } from 'minizlib'\nimport { type Stats } from 'node:fs'\nimport { type ReadEntry } from './read-entry.js'\nimport { type WarnData } from './warn-method.js'\nimport { WriteEntry } from './write-entry.js'\n\nconst argmap = new Map(\n [\n ['C', 'cwd'],\n ['f', 'file'],\n ['z', 'gzip'],\n ['P', 'preservePaths'],\n ['U', 'unlink'],\n ['strip-components', 'strip'],\n ['stripComponents', 'strip'],\n ['keep-newer', 'newer'],\n ['keepNewer', 'newer'],\n ['keep-newer-files', 'newer'],\n ['keepNewerFiles', 'newer'],\n ['k', 'keep'],\n ['keep-existing', 'keep'],\n ['keepExisting', 'keep'],\n ['m', 'noMtime'],\n ['no-mtime', 'noMtime'],\n ['p', 'preserveOwner'],\n ['L', 'follow'],\n ['h', 'follow'],\n ['onentry', 'onReadEntry'],\n ],\n)\n\n/**\n * The options that can be provided to tar commands.\n *\n * Note that some of these are only relevant for certain commands, since\n * they are specific to reading or writing.\n *\n * Aliases are provided in the {@link TarOptionsWithAliases} type.\n */\nexport interface TarOptions {\n //////////////////////////\n // shared options\n\n /**\n * Perform all I/O operations synchronously. If the stream is ended\n * immediately, then it will be processed entirely synchronously.\n */\n sync?: boolean\n\n /**\n * The tar file to be read and/or written. When this is set, a stream\n * is not returned. Asynchronous commands will return a promise indicating\n * when the operation is completed, and synchronous commands will return\n * immediately.\n */\n file?: string\n\n /**\n * Treat warnings as crash-worthy errors. Defaults false.\n */\n strict?: boolean\n\n /**\n * The effective current working directory for this tar command\n */\n cwd?: string\n\n /**\n * When creating a tar archive, this can be used to compress it as well.\n * Set to `true` to use the default gzip options, or customize them as\n * needed.\n *\n * When reading, if this is unset, then the compression status will be\n * inferred from the archive data. This is generally best, unless you are\n * sure of the compression settings in use to create the archive, and want to\n * fail if the archive doesn't match expectations.\n */\n gzip?: boolean | GzipOptions\n\n /**\n * When creating archives, preserve absolute and `..` paths in the archive,\n * rather than sanitizing them under the cwd.\n *\n * When extracting, allow absolute paths, paths containing `..`, and\n * extracting through symbolic links. By default, the root `/` is stripped\n * from absolute paths (eg, turning `/x/y/z` into `x/y/z`), paths containing\n * `..` are not extracted, and any file whose location would be modified by a\n * symbolic link is not extracted.\n *\n * **WARNING** This is almost always unsafe, and must NEVER be used on\n * archives from untrusted sources, such as user input, and every entry must\n * be validated to ensure it is safe to write. Even if the input is not\n * malicious, mistakes can cause a lot of damage!\n */\n preservePaths?: boolean\n\n /**\n * When extracting, do not set the `mtime` value for extracted entries to\n * match the `mtime` in the archive.\n *\n * When creating archives, do not store the `mtime` value in the entry. Note\n * that this prevents properly using other mtime-based features (such as\n * `tar.update` or the `newer` option) with the resulting archive.\n */\n noMtime?: boolean\n\n /**\n * Set to `true` or an object with settings for `zlib.BrotliCompress()` to\n * create a brotli-compressed archive\n *\n * When extracting, this will cause the archive to be treated as a\n * brotli-compressed file if set to `true` or a ZlibOptions object.\n *\n * If set `false`, then brotli options will not be used.\n *\n * If this, the `gzip`, and `zstd` options are left `undefined`, then tar\n * will attempt to infer the brotli compression status, but can only do so\n * based on the filename. If the filename ends in `.tbr` or `.tar.br`, and\n * the first 512 bytes are not a valid tar header, then brotli decompression\n * will be attempted.\n */\n brotli?: boolean | ZlibOptions\n\n /**\n * Set to `true` or an object with settings for `zstd.compress()` to\n * create a zstd-compressed archive\n *\n * When extracting, this will cause the archive to be treated as a\n * zstd-compressed file if set to `true` or a ZlibOptions object.\n *\n * If set `false`, then zstd options will not be used.\n *\n * If this, the `gzip`, and `brotli` options are left `undefined`, then tar\n * will attempt to infer the zstd compression status, but can only do so\n * based on the filename. If the filename ends in `.tzst` or `.tar.zst`, and\n * the first 512 bytes are not a valid tar header, then zstd decompression\n * will be attempted.\n */\n zstd?: boolean | ZlibOptions\n\n /**\n * A function that is called with `(path, stat)` when creating an archive, or\n * `(path, entry)` when extracting. Return true to process the file/entry, or\n * false to exclude it.\n */\n filter?: (path: string, entry: Stats | ReadEntry) => boolean\n\n /**\n * A function that gets called for any warning encountered.\n *\n * Note: if `strict` is set, then the warning will throw, and this method\n * will not be called.\n */\n onwarn?: (code: string, message: string, data: WarnData) => any\n\n //////////////////////////\n // extraction options\n\n /**\n * When extracting, unlink files before creating them. Without this option,\n * tar overwrites existing files, which preserves existing hardlinks. With\n * this option, existing hardlinks will be broken, as will any symlink that\n * would affect the location of an extracted file.\n */\n unlink?: boolean\n\n /**\n * When extracting, strip the specified number of path portions from the\n * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be\n * extracted to `{cwd}/c/d`.\n *\n * Any entry whose entire path is stripped will be excluded.\n */\n strip?: number\n\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n newer?: boolean\n\n /**\n * When extracting, do not overwrite existing files at all.\n */\n keep?: boolean\n\n /**\n * When extracting, set the `uid` and `gid` of extracted entries to the `uid`\n * and `gid` fields in the archive. Defaults to true when run as root, and\n * false otherwise.\n *\n * If false, then files and directories will be set with the owner and group\n * of the user running the process. This is similar to `-p` in `tar(1)`, but\n * ACLs and other system-specific data is never unpacked in this\n * implementation, and modes are set by default already.\n */\n preserveOwner?: boolean\n\n /**\n * The maximum depth of subfolders to extract into. This defaults to 1024.\n * Anything deeper than the limit will raise a warning and skip the entry.\n * Set to `Infinity` to remove the limitation.\n */\n maxDepth?: number\n\n /**\n * When extracting, force all created files and directories, and all\n * implicitly created directories, to be owned by the specified user id,\n * regardless of the `uid` field in the archive.\n *\n * Cannot be used along with `preserveOwner`. Requires also setting the `gid`\n * option.\n */\n uid?: number\n\n /**\n * When extracting, force all created files and directories, and all\n * implicitly created directories, to be owned by the specified group id,\n * regardless of the `gid` field in the archive.\n *\n * Cannot be used along with `preserveOwner`. Requires also setting the `uid`\n * option.\n */\n gid?: number\n\n /**\n * When extracting, provide a function that takes an `entry` object, and\n * returns a stream, or any falsey value. If a stream is provided, then that\n * stream's data will be written instead of the contents of the archive\n * entry. If a falsey value is provided, then the entry is written to disk as\n * normal.\n *\n * To exclude items from extraction, use the `filter` option.\n *\n * Note that using an asynchronous stream type with the `transform` option\n * will cause undefined behavior in synchronous extractions.\n * [MiniPass](http://npm.im/minipass)-based streams are designed for this use\n * case.\n */\n transform?: (entry: ReadEntry) => any\n\n /**\n * Call `chmod()` to ensure that extracted files match the entry's mode\n * field. Without this field set, all mode fields in archive entries are a\n * best effort attempt only.\n *\n * Setting this necessitates a call to the deprecated `process.umask()`\n * method to determine the default umask value, unless a `processUmask`\n * config is provided as well.\n *\n * If not set, tar will attempt to create file system entries with whatever\n * mode is provided, and let the implicit process `umask` apply normally, but\n * if a file already exists to be written to, then its existing mode will not\n * be modified.\n *\n * When setting `chmod: true`, it is highly recommend to set the\n * {@link TarOptions#processUmask} option as well, to avoid the call to the\n * deprecated (and thread-unsafe) `process.umask()` method.\n */\n chmod?: boolean\n\n /**\n * When setting the {@link TarOptions#chmod} option to `true`, you may\n * provide a value here to avoid having to call the deprecated and\n * thread-unsafe `process.umask()` method.\n *\n * This has no effect with `chmod` is not set to true, as mode values are not\n * set explicitly anyway. If `chmod` is set to `true`, and a value is not\n * provided here, then `process.umask()` must be called, which will result in\n * deprecation warnings.\n *\n * The most common values for this are `0o22` (resulting in directories\n * created with mode `0o755` and files with `0o644` by default) and `0o2`\n * (resulting in directores created with mode `0o775` and files `0o664`, so\n * they are group-writable).\n */\n processUmask?: number\n\n //////////////////////////\n // archive creation options\n\n /**\n * When parsing/listing archives, `entry` streams are by default resumed\n * (set into \"flowing\" mode) immediately after the call to `onReadEntry()`.\n * Set `noResume: true` to suppress this behavior.\n *\n * Note that when this is set, the stream will never complete until the\n * data is consumed somehow.\n *\n * Set automatically in extract operations, since the entry is piped to\n * a file system entry right away. Only relevant when parsing.\n */\n noResume?: boolean\n\n /**\n * When creating, updating, or replacing within archives, this method will\n * be called with each WriteEntry that is created.\n */\n onWriteEntry?: (entry: WriteEntry) => any\n\n /**\n * When extracting or listing archives, this method will be called with\n * each entry that is not excluded by a `filter`.\n *\n * Important when listing archives synchronously from a file, because there\n * is otherwise no way to interact with the data!\n */\n onReadEntry?: (entry: ReadEntry) => any\n\n /**\n * Pack the targets of symbolic links rather than the link itself.\n */\n follow?: boolean\n\n /**\n * When creating archives, omit any metadata that is system-specific:\n * `ctime`, `atime`, `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and\n * `nlink`. Note that `mtime` is still included, because this is necessary\n * for other time-based operations such as `tar.update`. Additionally, `mode`\n * is set to a \"reasonable default\" for mose unix systems, based on an\n * effective `umask` of `0o22`.\n *\n * This also defaults the `portable` option in the gzip configs when creating\n * a compressed archive, in order to produce deterministic archives that are\n * not operating-system specific.\n */\n portable?: boolean\n\n /**\n * When creating archives, do not recursively archive the contents of\n * directories. By default, archiving a directory archives all of its\n * contents as well.\n */\n noDirRecurse?: boolean\n\n /**\n * Suppress Pax extended headers when creating archives. Note that this means\n * long paths and linkpaths will be truncated, and large or negative numeric\n * values may be interpreted incorrectly.\n */\n noPax?: boolean\n\n /**\n * Set to a `Date` object to force a specific `mtime` value for everything\n * written to an archive.\n *\n * This is useful when creating archives that are intended to be\n * deterministic based on their contents, irrespective of the file's last\n * modification time.\n *\n * Overridden by `noMtime`.\n */\n mtime?: Date\n\n /**\n * A path portion to prefix onto the entries added to an archive.\n */\n prefix?: string\n\n /**\n * The mode to set on any created file archive, defaults to 0o666\n * masked by the process umask, often resulting in 0o644.\n *\n * This does *not* affect the mode fields of individual entries, or the\n * mode status of extracted entries on the filesystem.\n */\n mode?: number\n\n //////////////////////////\n // internal options\n\n /**\n * A cache of mtime values, to avoid having to stat the same file repeatedly.\n *\n * @internal\n */\n mtimeCache?: Map\n\n /**\n * maximum buffer size for `fs.read()` operations.\n *\n * @internal\n */\n maxReadSize?: number\n\n /**\n * Filter modes of entries being unpacked, like `process.umask()`\n *\n * @internal\n */\n umask?: number\n\n /**\n * Default mode for directories. Used for all implicitly created directories,\n * and any directories in the archive that do not have a mode field.\n *\n * @internal\n */\n dmode?: number\n\n /**\n * default mode for files\n *\n * @internal\n */\n fmode?: number\n\n /**\n * Map that tracks which directories already exist, for extraction\n *\n * @internal\n */\n dirCache?: Map\n /**\n * maximum supported size of meta entries. Defaults to 1MB\n *\n * @internal\n */\n maxMetaEntrySize?: number\n\n /**\n * A Map object containing the device and inode value for any file whose\n * `nlink` value is greater than 1, to identify hard links when creating\n * archives.\n *\n * @internal\n */\n linkCache?: Map\n\n /**\n * A map object containing the results of `fs.readdir()` calls.\n *\n * @internal\n */\n readdirCache?: Map\n\n /**\n * A cache of all `lstat` results, for use in creating archives.\n *\n * @internal\n */\n statCache?: Map\n\n /**\n * Number of concurrent jobs to run when creating archives.\n *\n * Defaults to 4.\n *\n * @internal\n */\n jobs?: number\n\n /**\n * Automatically set to true on Windows systems.\n *\n * When extracting, causes behavior where filenames containing `<|>?:`\n * characters are converted to windows-compatible escape sequences in the\n * created filesystem entries.\n *\n * When packing, causes behavior where paths replace `\\` with `/`, and\n * filenames containing the windows-compatible escaped forms of `<|>?:` are\n * converted to actual `<|>?:` characters in the archive.\n *\n * @internal\n */\n win32?: boolean\n\n /**\n * For `WriteEntry` objects, the absolute path to the entry on the\n * filesystem. By default, this is `resolve(cwd, entry.path)`, but it can be\n * overridden explicitly.\n *\n * @internal\n */\n absolute?: string\n\n /**\n * Used with Parser stream interface, to attach and take over when the\n * stream is completely parsed. If this is set, then the prefinish,\n * finish, and end events will not fire, and are the responsibility of\n * the ondone method to emit properly.\n *\n * @internal\n */\n ondone?: () => void\n\n /**\n * Mostly for testing, but potentially useful in some cases.\n * Forcibly trigger a chown on every entry, no matter what.\n */\n forceChown?: boolean\n\n /**\n * ambiguous deprecated name for {@link onReadEntry}\n *\n * @deprecated\n */\n onentry?: (entry: ReadEntry) => any\n}\n\nexport type TarOptionsSync = TarOptions & { sync: true }\nexport type TarOptionsAsync = TarOptions & { sync?: false }\nexport type TarOptionsFile = TarOptions & { file: string }\nexport type TarOptionsNoFile = TarOptions & { file?: undefined }\nexport type TarOptionsSyncFile = TarOptionsSync & TarOptionsFile\nexport type TarOptionsAsyncFile = TarOptionsAsync & TarOptionsFile\nexport type TarOptionsSyncNoFile = TarOptionsSync & TarOptionsNoFile\nexport type TarOptionsAsyncNoFile = TarOptionsAsync & TarOptionsNoFile\n\nexport type LinkCacheKey = `${number}:${number}`\n\nexport interface TarOptionsWithAliases extends TarOptions {\n /**\n * The effective current working directory for this tar command\n */\n C?: TarOptions['cwd']\n /**\n * The tar file to be read and/or written. When this is set, a stream\n * is not returned. Asynchronous commands will return a promise indicating\n * when the operation is completed, and synchronous commands will return\n * immediately.\n */\n f?: TarOptions['file']\n /**\n * When creating a tar archive, this can be used to compress it as well.\n * Set to `true` to use the default gzip options, or customize them as\n * needed.\n *\n * When reading, if this is unset, then the compression status will be\n * inferred from the archive data. This is generally best, unless you are\n * sure of the compression settings in use to create the archive, and want to\n * fail if the archive doesn't match expectations.\n */\n z?: TarOptions['gzip']\n /**\n * When creating archives, preserve absolute and `..` paths in the archive,\n * rather than sanitizing them under the cwd.\n *\n * When extracting, allow absolute paths, paths containing `..`, and\n * extracting through symbolic links. By default, the root `/` is stripped\n * from absolute paths (eg, turning `/x/y/z` into `x/y/z`), paths containing\n * `..` are not extracted, and any file whose location would be modified by a\n * symbolic link is not extracted.\n *\n * **WARNING** This is almost always unsafe, and must NEVER be used on\n * archives from untrusted sources, such as user input, and every entry must\n * be validated to ensure it is safe to write. Even if the input is not\n * malicious, mistakes can cause a lot of damage!\n */\n P?: TarOptions['preservePaths']\n /**\n * When extracting, unlink files before creating them. Without this option,\n * tar overwrites existing files, which preserves existing hardlinks. With\n * this option, existing hardlinks will be broken, as will any symlink that\n * would affect the location of an extracted file.\n */\n U?: TarOptions['unlink']\n /**\n * When extracting, strip the specified number of path portions from the\n * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be\n * extracted to `{cwd}/c/d`.\n */\n 'strip-components'?: TarOptions['strip']\n /**\n * When extracting, strip the specified number of path portions from the\n * entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be\n * extracted to `{cwd}/c/d`.\n */\n stripComponents?: TarOptions['strip']\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n 'keep-newer'?: TarOptions['newer']\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n keepNewer?: TarOptions['newer']\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n 'keep-newer-files'?: TarOptions['newer']\n /**\n * When extracting, keep the existing file on disk if it's newer than the\n * file in the archive.\n */\n keepNewerFiles?: TarOptions['newer']\n /**\n * When extracting, do not overwrite existing files at all.\n */\n k?: TarOptions['keep']\n /**\n * When extracting, do not overwrite existing files at all.\n */\n 'keep-existing'?: TarOptions['keep']\n /**\n * When extracting, do not overwrite existing files at all.\n */\n keepExisting?: TarOptions['keep']\n /**\n * When extracting, do not set the `mtime` value for extracted entries to\n * match the `mtime` in the archive.\n *\n * When creating archives, do not store the `mtime` value in the entry. Note\n * that this prevents properly using other mtime-based features (such as\n * `tar.update` or the `newer` option) with the resulting archive.\n */\n m?: TarOptions['noMtime']\n /**\n * When extracting, do not set the `mtime` value for extracted entries to\n * match the `mtime` in the archive.\n *\n * When creating archives, do not store the `mtime` value in the entry. Note\n * that this prevents properly using other mtime-based features (such as\n * `tar.update` or the `newer` option) with the resulting archive.\n */\n 'no-mtime'?: TarOptions['noMtime']\n /**\n * When extracting, set the `uid` and `gid` of extracted entries to the `uid`\n * and `gid` fields in the archive. Defaults to true when run as root, and\n * false otherwise.\n *\n * If false, then files and directories will be set with the owner and group\n * of the user running the process. This is similar to `-p` in `tar(1)`, but\n * ACLs and other system-specific data is never unpacked in this\n * implementation, and modes are set by default already.\n */\n p?: TarOptions['preserveOwner']\n /**\n * Pack the targets of symbolic links rather than the link itself.\n */\n L?: TarOptions['follow']\n /**\n * Pack the targets of symbolic links rather than the link itself.\n */\n h?: TarOptions['follow']\n\n /**\n * Deprecated option. Set explicitly false to set `chmod: true`. Ignored\n * if {@link TarOptions#chmod} is set to any boolean value.\n *\n * @deprecated\n */\n noChmod?: boolean\n}\n\nexport type TarOptionsWithAliasesSync = TarOptionsWithAliases & {\n sync: true\n}\nexport type TarOptionsWithAliasesAsync = TarOptionsWithAliases & {\n sync?: false\n}\nexport type TarOptionsWithAliasesFile =\n | (TarOptionsWithAliases & {\n file: string\n })\n | (TarOptionsWithAliases & { f: string })\nexport type TarOptionsWithAliasesSyncFile =\n TarOptionsWithAliasesSync & TarOptionsWithAliasesFile\nexport type TarOptionsWithAliasesAsyncFile =\n TarOptionsWithAliasesAsync & TarOptionsWithAliasesFile\n\nexport type TarOptionsWithAliasesNoFile = TarOptionsWithAliases & {\n f?: undefined\n file?: undefined\n}\n\nexport type TarOptionsWithAliasesSyncNoFile =\n TarOptionsWithAliasesSync & TarOptionsWithAliasesNoFile\nexport type TarOptionsWithAliasesAsyncNoFile =\n TarOptionsWithAliasesAsync & TarOptionsWithAliasesNoFile\n\nexport const isSyncFile = (\n o: O,\n): o is O & TarOptionsSyncFile => !!o.sync && !!o.file\nexport const isAsyncFile = (\n o: O,\n): o is O & TarOptionsAsyncFile => !o.sync && !!o.file\nexport const isSyncNoFile = (\n o: O,\n): o is O & TarOptionsSyncNoFile => !!o.sync && !o.file\nexport const isAsyncNoFile = (\n o: O,\n): o is O & TarOptionsAsyncNoFile => !o.sync && !o.file\nexport const isSync = (\n o: O,\n): o is O & TarOptionsSync => !!o.sync\nexport const isAsync = (\n o: O,\n): o is O & TarOptionsAsync => !o.sync\nexport const isFile = (\n o: O,\n): o is O & TarOptionsFile => !!o.file\nexport const isNoFile = (\n o: O,\n): o is O & TarOptionsNoFile => !o.file\n\nconst dealiasKey = (\n k: keyof TarOptionsWithAliases,\n): keyof TarOptions => {\n const d = argmap.get(k)\n if (d) return d\n return k as keyof TarOptions\n}\n\nexport const dealias = (\n opt: TarOptionsWithAliases = {},\n): TarOptions => {\n if (!opt) return {}\n const result: Record = {}\n for (const [key, v] of Object.entries(opt) as [\n keyof TarOptionsWithAliases,\n any,\n ][]) {\n // TS doesn't know that aliases are going to always be the same type\n const k = dealiasKey(key)\n result[k] = v\n }\n // affordance for deprecated noChmod -> chmod\n if (result.chmod === undefined && result.noChmod === false) {\n result.chmod = true\n }\n delete result.noChmod\n return result as TarOptions\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/pack.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/pack.d.ts new file mode 100644 index 0000000..14ce0c1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/pack.d.ts @@ -0,0 +1,101 @@ +import { type Stats } from 'fs'; +import { WriteEntry, WriteEntrySync, WriteEntryTar } from './write-entry.js'; +export declare class PackJob { + path: string; + absolute: string; + entry?: WriteEntry | WriteEntryTar; + stat?: Stats; + readdir?: string[]; + pending: boolean; + ignore: boolean; + piped: boolean; + constructor(path: string, absolute: string); +} +import { Minipass } from 'minipass'; +import * as zlib from 'minizlib'; +import { Yallist } from 'yallist'; +import { ReadEntry } from './read-entry.js'; +import { WarnEvent, type WarnData, type Warner } from './warn-method.js'; +declare const ONSTAT: unique symbol; +declare const ENDED: unique symbol; +declare const QUEUE: unique symbol; +declare const CURRENT: unique symbol; +declare const PROCESS: unique symbol; +declare const PROCESSING: unique symbol; +declare const PROCESSJOB: unique symbol; +declare const JOBS: unique symbol; +declare const JOBDONE: unique symbol; +declare const ADDFSENTRY: unique symbol; +declare const ADDTARENTRY: unique symbol; +declare const STAT: unique symbol; +declare const READDIR: unique symbol; +declare const ONREADDIR: unique symbol; +declare const PIPE: unique symbol; +declare const ENTRY: unique symbol; +declare const ENTRYOPT: unique symbol; +declare const WRITEENTRYCLASS: unique symbol; +declare const WRITE: unique symbol; +declare const ONDRAIN: unique symbol; +import { TarOptions } from './options.js'; +export declare class Pack extends Minipass> implements Warner { + sync: boolean; + opt: TarOptions; + cwd: string; + maxReadSize?: number; + preservePaths: boolean; + strict: boolean; + noPax: boolean; + prefix: string; + linkCache: Exclude; + statCache: Exclude; + file: string; + portable: boolean; + zip?: zlib.BrotliCompress | zlib.Gzip | zlib.ZstdCompress; + readdirCache: Exclude; + noDirRecurse: boolean; + follow: boolean; + noMtime: boolean; + mtime?: Date; + filter: Exclude; + jobs: number; + [WRITEENTRYCLASS]: typeof WriteEntry | typeof WriteEntrySync; + onWriteEntry?: (entry: WriteEntry) => void; + [QUEUE]: Yallist; + [JOBS]: number; + [PROCESSING]: boolean; + [ENDED]: boolean; + constructor(opt?: TarOptions); + [WRITE](chunk: Buffer): boolean; + add(path: string | ReadEntry): this; + end(cb?: () => void): this; + end(path: string | ReadEntry, cb?: () => void): this; + end(path: string | ReadEntry, encoding?: Minipass.Encoding, cb?: () => void): this; + write(path: string | ReadEntry): boolean; + [ADDTARENTRY](p: ReadEntry): void; + [ADDFSENTRY](p: string): void; + [STAT](job: PackJob): void; + [ONSTAT](job: PackJob, stat: Stats): void; + [READDIR](job: PackJob): void; + [ONREADDIR](job: PackJob, entries: string[]): void; + [PROCESS](): void; + get [CURRENT](): PackJob | undefined; + [JOBDONE](_job: PackJob): void; + [PROCESSJOB](job: PackJob): void; + [ENTRYOPT](job: PackJob): TarOptions; + [ENTRY](job: PackJob): WriteEntry | undefined; + [ONDRAIN](): void; + [PIPE](job: PackJob): void; + pause(): void; + warn(code: string, message: string | Error, data?: WarnData): void; +} +export declare class PackSync extends Pack { + sync: true; + constructor(opt: TarOptions); + pause(): void; + resume(): void; + [STAT](job: PackJob): void; + [READDIR](job: PackJob): void; + [PIPE](job: PackJob): void; +} +export {}; +//# sourceMappingURL=pack.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/pack.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/pack.d.ts.map new file mode 100644 index 0000000..05086e5 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/pack.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../../src/pack.ts"],"names":[],"mappings":"AASA,OAAW,EAAE,KAAK,KAAK,EAAE,MAAM,IAAI,CAAA;AACnC,OAAO,EACL,UAAU,EACV,cAAc,EACd,aAAa,EACd,MAAM,kBAAkB,CAAA;AAEzB,qBAAa,OAAO;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,UAAU,GAAG,aAAa,CAAA;IAClC,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,EAAE,OAAO,CAAQ;IACxB,MAAM,EAAE,OAAO,CAAQ;IACvB,KAAK,EAAE,OAAO,CAAQ;gBACV,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAI3C;AAED,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OA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AAO;gBACL,GAAG,EAAE,UAAU;IAM3B,KAAK;IACL,MAAM;IAEN,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,OAAO;IAKnB,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,OAAO;IAKtB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,OAAO;CA0BpB"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/pack.js b/node_modules/cmake-js/node_modules/tar/dist/esm/pack.js new file mode 100644 index 0000000..95d9342 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/pack.js @@ -0,0 +1,474 @@ +// A readable tar stream creator +// Technically, this is a transform stream that you write paths into, +// and tar format comes out of. +// The `add()` method is like `write()` but returns this, +// and end() return `this` as well, so you can +// do `new Pack(opt).add('files').add('dir').end().pipe(output) +// You could also do something like: +// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar')) +import fs from 'fs'; +import { WriteEntry, WriteEntrySync, WriteEntryTar, } from './write-entry.js'; +export class PackJob { + path; + absolute; + entry; + stat; + readdir; + pending = false; + ignore = false; + piped = false; + constructor(path, absolute) { + this.path = path || './'; + this.absolute = absolute; + } +} +import { Minipass } from 'minipass'; +import * as zlib from 'minizlib'; +import { Yallist } from 'yallist'; +import { ReadEntry } from './read-entry.js'; +import { warnMethod, } from './warn-method.js'; +const EOF = Buffer.alloc(1024); +const ONSTAT = Symbol('onStat'); +const ENDED = Symbol('ended'); +const QUEUE = Symbol('queue'); +const CURRENT = Symbol('current'); +const PROCESS = Symbol('process'); +const PROCESSING = Symbol('processing'); +const PROCESSJOB = Symbol('processJob'); +const JOBS = Symbol('jobs'); +const JOBDONE = Symbol('jobDone'); +const ADDFSENTRY = Symbol('addFSEntry'); +const ADDTARENTRY = Symbol('addTarEntry'); +const STAT = Symbol('stat'); +const READDIR = Symbol('readdir'); +const ONREADDIR = Symbol('onreaddir'); +const PIPE = Symbol('pipe'); +const ENTRY = Symbol('entry'); +const ENTRYOPT = Symbol('entryOpt'); +const WRITEENTRYCLASS = Symbol('writeEntryClass'); +const WRITE = Symbol('write'); +const ONDRAIN = Symbol('ondrain'); +import path from 'path'; +import { normalizeWindowsPath } from './normalize-windows-path.js'; +export class Pack extends Minipass { + sync = false; + opt; + cwd; + maxReadSize; + preservePaths; + strict; + noPax; + prefix; + linkCache; + statCache; + file; + portable; + zip; + readdirCache; + noDirRecurse; + follow; + noMtime; + mtime; + filter; + jobs; + [WRITEENTRYCLASS]; + onWriteEntry; + // Note: we actually DO need a linked list here, because we + // shift() to update the head of the list where we start, but still + // while that happens, need to know what the next item in the queue + // will be. Since we do multiple jobs in parallel, it's not as simple + // as just an Array.shift(), since that would lose the information about + // the next job in the list. We could add a .next field on the PackJob + // class, but then we'd have to be tracking the tail of the queue the + // whole time, and Yallist just does that for us anyway. + [QUEUE]; + [JOBS] = 0; + [PROCESSING] = false; + [ENDED] = false; + constructor(opt = {}) { + //@ts-ignore + super(); + this.opt = opt; + this.file = opt.file || ''; + this.cwd = opt.cwd || process.cwd(); + this.maxReadSize = opt.maxReadSize; + this.preservePaths = !!opt.preservePaths; + this.strict = !!opt.strict; + this.noPax = !!opt.noPax; + this.prefix = normalizeWindowsPath(opt.prefix || ''); + this.linkCache = opt.linkCache || new Map(); + this.statCache = opt.statCache || new Map(); + this.readdirCache = opt.readdirCache || new Map(); + this.onWriteEntry = opt.onWriteEntry; + this[WRITEENTRYCLASS] = WriteEntry; + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn); + } + this.portable = !!opt.portable; + if (opt.gzip || opt.brotli || opt.zstd) { + if ((opt.gzip ? 1 : 0) + + (opt.brotli ? 1 : 0) + + (opt.zstd ? 1 : 0) > + 1) { + throw new TypeError('gzip, brotli, zstd are mutually exclusive'); + } + if (opt.gzip) { + if (typeof opt.gzip !== 'object') { + opt.gzip = {}; + } + if (this.portable) { + opt.gzip.portable = true; + } + this.zip = new zlib.Gzip(opt.gzip); + } + if (opt.brotli) { + if (typeof opt.brotli !== 'object') { + opt.brotli = {}; + } + this.zip = new zlib.BrotliCompress(opt.brotli); + } + if (opt.zstd) { + if (typeof opt.zstd !== 'object') { + opt.zstd = {}; + } + this.zip = new zlib.ZstdCompress(opt.zstd); + } + /* c8 ignore next */ + if (!this.zip) + throw new Error('impossible'); + const zip = this.zip; + zip.on('data', chunk => super.write(chunk)); + zip.on('end', () => super.end()); + zip.on('drain', () => this[ONDRAIN]()); + this.on('resume', () => zip.resume()); + } + else { + this.on('drain', this[ONDRAIN]); + } + this.noDirRecurse = !!opt.noDirRecurse; + this.follow = !!opt.follow; + this.noMtime = !!opt.noMtime; + if (opt.mtime) + this.mtime = opt.mtime; + this.filter = + typeof opt.filter === 'function' ? opt.filter : () => true; + this[QUEUE] = new Yallist(); + this[JOBS] = 0; + this.jobs = Number(opt.jobs) || 4; + this[PROCESSING] = false; + this[ENDED] = false; + } + [WRITE](chunk) { + return super.write(chunk); + } + add(path) { + this.write(path); + return this; + } + end(path, encoding, cb) { + /* c8 ignore start */ + if (typeof path === 'function') { + cb = path; + path = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + /* c8 ignore stop */ + if (path) { + this.add(path); + } + this[ENDED] = true; + this[PROCESS](); + /* c8 ignore next */ + if (cb) + cb(); + return this; + } + write(path) { + if (this[ENDED]) { + throw new Error('write after end'); + } + if (path instanceof ReadEntry) { + this[ADDTARENTRY](path); + } + else { + this[ADDFSENTRY](path); + } + return this.flowing; + } + [ADDTARENTRY](p) { + const absolute = normalizeWindowsPath(path.resolve(this.cwd, p.path)); + // in this case, we don't have to wait for the stat + if (!this.filter(p.path, p)) { + p.resume(); + } + else { + const job = new PackJob(p.path, absolute); + job.entry = new WriteEntryTar(p, this[ENTRYOPT](job)); + job.entry.on('end', () => this[JOBDONE](job)); + this[JOBS] += 1; + this[QUEUE].push(job); + } + this[PROCESS](); + } + [ADDFSENTRY](p) { + const absolute = normalizeWindowsPath(path.resolve(this.cwd, p)); + this[QUEUE].push(new PackJob(p, absolute)); + this[PROCESS](); + } + [STAT](job) { + job.pending = true; + this[JOBS] += 1; + const stat = this.follow ? 'stat' : 'lstat'; + fs[stat](job.absolute, (er, stat) => { + job.pending = false; + this[JOBS] -= 1; + if (er) { + this.emit('error', er); + } + else { + this[ONSTAT](job, stat); + } + }); + } + [ONSTAT](job, stat) { + this.statCache.set(job.absolute, stat); + job.stat = stat; + // now we have the stat, we can filter it. + if (!this.filter(job.path, stat)) { + job.ignore = true; + } + else if (stat.isFile() && + stat.nlink > 1 && + job === this[CURRENT] && + !this.linkCache.get(`${stat.dev}:${stat.ino}`) && + !this.sync) { + // if it's not filtered, and it's a new File entry, + // jump the queue in case any pending Link entries are about + // to try to link to it. This prevents a hardlink from coming ahead + // of its target in the archive. + this[PROCESSJOB](job); + } + this[PROCESS](); + } + [READDIR](job) { + job.pending = true; + this[JOBS] += 1; + fs.readdir(job.absolute, (er, entries) => { + job.pending = false; + this[JOBS] -= 1; + if (er) { + return this.emit('error', er); + } + this[ONREADDIR](job, entries); + }); + } + [ONREADDIR](job, entries) { + this.readdirCache.set(job.absolute, entries); + job.readdir = entries; + this[PROCESS](); + } + [PROCESS]() { + if (this[PROCESSING]) { + return; + } + this[PROCESSING] = true; + for (let w = this[QUEUE].head; !!w && this[JOBS] < this.jobs; w = w.next) { + this[PROCESSJOB](w.value); + if (w.value.ignore) { + const p = w.next; + this[QUEUE].removeNode(w); + w.next = p; + } + } + this[PROCESSING] = false; + if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) { + if (this.zip) { + this.zip.end(EOF); + } + else { + super.write(EOF); + super.end(); + } + } + } + get [CURRENT]() { + return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value; + } + [JOBDONE](_job) { + this[QUEUE].shift(); + this[JOBS] -= 1; + this[PROCESS](); + } + [PROCESSJOB](job) { + if (job.pending) { + return; + } + if (job.entry) { + if (job === this[CURRENT] && !job.piped) { + this[PIPE](job); + } + return; + } + if (!job.stat) { + const sc = this.statCache.get(job.absolute); + if (sc) { + this[ONSTAT](job, sc); + } + else { + this[STAT](job); + } + } + if (!job.stat) { + return; + } + // filtered out! + if (job.ignore) { + return; + } + if (!this.noDirRecurse && + job.stat.isDirectory() && + !job.readdir) { + const rc = this.readdirCache.get(job.absolute); + if (rc) { + this[ONREADDIR](job, rc); + } + else { + this[READDIR](job); + } + if (!job.readdir) { + return; + } + } + // we know it doesn't have an entry, because that got checked above + job.entry = this[ENTRY](job); + if (!job.entry) { + job.ignore = true; + return; + } + if (job === this[CURRENT] && !job.piped) { + this[PIPE](job); + } + } + [ENTRYOPT](job) { + return { + onwarn: (code, msg, data) => this.warn(code, msg, data), + noPax: this.noPax, + cwd: this.cwd, + absolute: job.absolute, + preservePaths: this.preservePaths, + maxReadSize: this.maxReadSize, + strict: this.strict, + portable: this.portable, + linkCache: this.linkCache, + statCache: this.statCache, + noMtime: this.noMtime, + mtime: this.mtime, + prefix: this.prefix, + onWriteEntry: this.onWriteEntry, + }; + } + [ENTRY](job) { + this[JOBS] += 1; + try { + const e = new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job)); + return e + .on('end', () => this[JOBDONE](job)) + .on('error', er => this.emit('error', er)); + } + catch (er) { + this.emit('error', er); + } + } + [ONDRAIN]() { + if (this[CURRENT] && this[CURRENT].entry) { + this[CURRENT].entry.resume(); + } + } + // like .pipe() but using super, because our write() is special + [PIPE](job) { + job.piped = true; + if (job.readdir) { + job.readdir.forEach(entry => { + const p = job.path; + const base = p === './' ? '' : p.replace(/\/*$/, '/'); + this[ADDFSENTRY](base + entry); + }); + } + const source = job.entry; + const zip = this.zip; + /* c8 ignore start */ + if (!source) + throw new Error('cannot pipe without source'); + /* c8 ignore stop */ + if (zip) { + source.on('data', chunk => { + if (!zip.write(chunk)) { + source.pause(); + } + }); + } + else { + source.on('data', chunk => { + if (!super.write(chunk)) { + source.pause(); + } + }); + } + } + pause() { + if (this.zip) { + this.zip.pause(); + } + return super.pause(); + } + warn(code, message, data = {}) { + warnMethod(this, code, message, data); + } +} +export class PackSync extends Pack { + sync = true; + constructor(opt) { + super(opt); + this[WRITEENTRYCLASS] = WriteEntrySync; + } + // pause/resume are no-ops in sync streams. + pause() { } + resume() { } + [STAT](job) { + const stat = this.follow ? 'statSync' : 'lstatSync'; + this[ONSTAT](job, fs[stat](job.absolute)); + } + [READDIR](job) { + this[ONREADDIR](job, fs.readdirSync(job.absolute)); + } + // gotta get it all in this tick + [PIPE](job) { + const source = job.entry; + const zip = this.zip; + if (job.readdir) { + job.readdir.forEach(entry => { + const p = job.path; + const base = p === './' ? '' : p.replace(/\/*$/, '/'); + this[ADDFSENTRY](base + entry); + }); + } + /* c8 ignore start */ + if (!source) + throw new Error('Cannot pipe without source'); + /* c8 ignore stop */ + if (zip) { + source.on('data', chunk => { + zip.write(chunk); + }); + } + else { + source.on('data', chunk => { + super[WRITE](chunk); + }); + } + } +} +//# sourceMappingURL=pack.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/pack.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/pack.js.map new file mode 100644 index 0000000..efbe6e7 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/pack.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pack.js","sourceRoot":"","sources":["../../src/pack.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,qEAAqE;AACrE,+BAA+B;AAC/B,yDAAyD;AACzD,8CAA8C;AAC9C,+DAA+D;AAC/D,oCAAoC;AACpC,uEAAuE;AAEvE,OAAO,EAAkB,MAAM,IAAI,CAAA;AACnC,OAAO,EACL,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,kBAAkB,CAAA;AAEzB,MAAM,OAAO,OAAO;IAClB,IAAI,CAAQ;IACZ,QAAQ,CAAQ;IAChB,KAAK,CAA6B;IAClC,IAAI,CAAQ;IACZ,OAAO,CAAW;IAClB,OAAO,GAAY,KAAK,CAAA;IACxB,MAAM,GAAY,KAAK,CA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stream creator\n// Technically, this is a transform stream that you write paths into,\n// and tar format comes out of.\n// The `add()` method is like `write()` but returns this,\n// and end() return `this` as well, so you can\n// do `new Pack(opt).add('files').add('dir').end().pipe(output)\n// You could also do something like:\n// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar'))\n\nimport fs, { type Stats } from 'fs'\nimport {\n WriteEntry,\n WriteEntrySync,\n WriteEntryTar,\n} from './write-entry.js'\n\nexport class PackJob {\n path: string\n absolute: string\n entry?: WriteEntry | WriteEntryTar\n stat?: Stats\n readdir?: string[]\n pending: boolean = false\n ignore: boolean = false\n piped: boolean = false\n constructor(path: string, absolute: string) {\n this.path = path || './'\n this.absolute = absolute\n }\n}\n\nimport { Minipass } from 'minipass'\nimport * as zlib from 'minizlib'\nimport { Yallist } from 'yallist'\nimport { ReadEntry } from './read-entry.js'\nimport {\n WarnEvent,\n warnMethod,\n type WarnData,\n type Warner,\n} from './warn-method.js'\n\nconst EOF = Buffer.alloc(1024)\nconst ONSTAT = Symbol('onStat')\nconst ENDED = Symbol('ended')\nconst QUEUE = Symbol('queue')\nconst CURRENT = Symbol('current')\nconst PROCESS = Symbol('process')\nconst PROCESSING = Symbol('processing')\nconst PROCESSJOB = Symbol('processJob')\nconst JOBS = Symbol('jobs')\nconst JOBDONE = Symbol('jobDone')\nconst ADDFSENTRY = Symbol('addFSEntry')\nconst ADDTARENTRY = Symbol('addTarEntry')\nconst STAT = Symbol('stat')\nconst READDIR = Symbol('readdir')\nconst ONREADDIR = Symbol('onreaddir')\nconst PIPE = Symbol('pipe')\nconst ENTRY = Symbol('entry')\nconst ENTRYOPT = Symbol('entryOpt')\nconst WRITEENTRYCLASS = Symbol('writeEntryClass')\nconst WRITE = Symbol('write')\nconst ONDRAIN = Symbol('ondrain')\n\nimport path from 'path'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport { TarOptions } from './options.js'\n\nexport class Pack\n extends Minipass>\n implements Warner\n{\n sync: boolean = false\n opt: TarOptions\n cwd: string\n maxReadSize?: number\n preservePaths: boolean\n strict: boolean\n noPax: boolean\n prefix: string\n linkCache: Exclude\n statCache: Exclude\n file: string\n portable: boolean\n zip?: zlib.BrotliCompress | zlib.Gzip | zlib.ZstdCompress\n readdirCache: Exclude\n noDirRecurse: boolean\n follow: boolean\n noMtime: boolean\n mtime?: Date\n filter: Exclude\n jobs: number;\n\n [WRITEENTRYCLASS]: typeof WriteEntry | typeof WriteEntrySync\n onWriteEntry?: (entry: WriteEntry) => void;\n // Note: we actually DO need a linked list here, because we\n // shift() to update the head of the list where we start, but still\n // while that happens, need to know what the next item in the queue\n // will be. Since we do multiple jobs in parallel, it's not as simple\n // as just an Array.shift(), since that would lose the information about\n // the next job in the list. We could add a .next field on the PackJob\n // class, but then we'd have to be tracking the tail of the queue the\n // whole time, and Yallist just does that for us anyway.\n [QUEUE]: Yallist;\n [JOBS]: number = 0;\n [PROCESSING]: boolean = false;\n [ENDED]: boolean = false\n\n constructor(opt: TarOptions = {}) {\n //@ts-ignore\n super()\n this.opt = opt\n this.file = opt.file || ''\n this.cwd = opt.cwd || process.cwd()\n this.maxReadSize = opt.maxReadSize\n this.preservePaths = !!opt.preservePaths\n this.strict = !!opt.strict\n this.noPax = !!opt.noPax\n this.prefix = normalizeWindowsPath(opt.prefix || '')\n this.linkCache = opt.linkCache || new Map()\n this.statCache = opt.statCache || new Map()\n this.readdirCache = opt.readdirCache || new Map()\n this.onWriteEntry = opt.onWriteEntry\n\n this[WRITEENTRYCLASS] = WriteEntry\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n\n this.portable = !!opt.portable\n\n if (opt.gzip || opt.brotli || opt.zstd) {\n if (\n (opt.gzip ? 1 : 0) +\n (opt.brotli ? 1 : 0) +\n (opt.zstd ? 1 : 0) >\n 1\n ) {\n throw new TypeError(\n 'gzip, brotli, zstd are mutually exclusive',\n )\n }\n if (opt.gzip) {\n if (typeof opt.gzip !== 'object') {\n opt.gzip = {}\n }\n if (this.portable) {\n opt.gzip.portable = true\n }\n this.zip = new zlib.Gzip(opt.gzip)\n }\n if (opt.brotli) {\n if (typeof opt.brotli !== 'object') {\n opt.brotli = {}\n }\n this.zip = new zlib.BrotliCompress(opt.brotli)\n }\n if (opt.zstd) {\n if (typeof opt.zstd !== 'object') {\n opt.zstd = {}\n }\n this.zip = new zlib.ZstdCompress(opt.zstd)\n }\n /* c8 ignore next */\n if (!this.zip) throw new Error('impossible')\n const zip = this.zip\n zip.on('data', chunk => super.write(chunk as unknown as string))\n zip.on('end', () => super.end())\n zip.on('drain', () => this[ONDRAIN]())\n this.on('resume', () => zip.resume())\n } else {\n this.on('drain', this[ONDRAIN])\n }\n\n this.noDirRecurse = !!opt.noDirRecurse\n this.follow = !!opt.follow\n this.noMtime = !!opt.noMtime\n if (opt.mtime) this.mtime = opt.mtime\n\n this.filter =\n typeof opt.filter === 'function' ? opt.filter : () => true\n\n this[QUEUE] = new Yallist()\n this[JOBS] = 0\n this.jobs = Number(opt.jobs) || 4\n this[PROCESSING] = false\n this[ENDED] = false\n }\n\n [WRITE](chunk: Buffer) {\n return super.write(chunk as unknown as string)\n }\n\n add(path: string | ReadEntry) {\n this.write(path)\n return this\n }\n\n end(cb?: () => void): this\n end(path: string | ReadEntry, cb?: () => void): this\n end(\n path: string | ReadEntry,\n encoding?: Minipass.Encoding,\n cb?: () => void,\n ): this\n end(\n path?: string | ReadEntry | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void,\n ) {\n /* c8 ignore start */\n if (typeof path === 'function') {\n cb = path\n path = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n /* c8 ignore stop */\n if (path) {\n this.add(path)\n }\n this[ENDED] = true\n this[PROCESS]()\n /* c8 ignore next */\n if (cb) cb()\n return this\n }\n\n write(path: string | ReadEntry) {\n if (this[ENDED]) {\n throw new Error('write after end')\n }\n\n if (path instanceof ReadEntry) {\n this[ADDTARENTRY](path)\n } else {\n this[ADDFSENTRY](path)\n }\n return this.flowing\n }\n\n [ADDTARENTRY](p: ReadEntry) {\n const absolute = normalizeWindowsPath(\n path.resolve(this.cwd, p.path),\n )\n // in this case, we don't have to wait for the stat\n if (!this.filter(p.path, p)) {\n p.resume()\n } else {\n const job = new PackJob(p.path, absolute)\n job.entry = new WriteEntryTar(p, this[ENTRYOPT](job))\n job.entry.on('end', () => this[JOBDONE](job))\n this[JOBS] += 1\n this[QUEUE].push(job)\n }\n\n this[PROCESS]()\n }\n\n [ADDFSENTRY](p: string) {\n const absolute = normalizeWindowsPath(path.resolve(this.cwd, p))\n this[QUEUE].push(new PackJob(p, absolute))\n this[PROCESS]()\n }\n\n [STAT](job: PackJob) {\n job.pending = true\n this[JOBS] += 1\n const stat = this.follow ? 'stat' : 'lstat'\n fs[stat](job.absolute, (er, stat) => {\n job.pending = false\n this[JOBS] -= 1\n if (er) {\n this.emit('error', er)\n } else {\n this[ONSTAT](job, stat)\n }\n })\n }\n\n [ONSTAT](job: PackJob, stat: Stats) {\n this.statCache.set(job.absolute, stat)\n job.stat = stat\n\n // now we have the stat, we can filter it.\n if (!this.filter(job.path, stat)) {\n job.ignore = true\n } else if (\n stat.isFile() &&\n stat.nlink > 1 &&\n job === this[CURRENT] &&\n !this.linkCache.get(`${stat.dev}:${stat.ino}`) &&\n !this.sync\n ) {\n // if it's not filtered, and it's a new File entry,\n // jump the queue in case any pending Link entries are about\n // to try to link to it. This prevents a hardlink from coming ahead\n // of its target in the archive.\n this[PROCESSJOB](job)\n }\n\n this[PROCESS]()\n }\n\n [READDIR](job: PackJob) {\n job.pending = true\n this[JOBS] += 1\n fs.readdir(job.absolute, (er, entries) => {\n job.pending = false\n this[JOBS] -= 1\n if (er) {\n return this.emit('error', er)\n }\n this[ONREADDIR](job, entries)\n })\n }\n\n [ONREADDIR](job: PackJob, entries: string[]) {\n this.readdirCache.set(job.absolute, entries)\n job.readdir = entries\n this[PROCESS]()\n }\n\n [PROCESS]() {\n if (this[PROCESSING]) {\n return\n }\n\n this[PROCESSING] = true\n for (\n let w = this[QUEUE].head;\n !!w && this[JOBS] < this.jobs;\n w = w.next\n ) {\n this[PROCESSJOB](w.value)\n if (w.value.ignore) {\n const p = w.next\n this[QUEUE].removeNode(w)\n w.next = p\n }\n }\n\n this[PROCESSING] = false\n\n if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) {\n if (this.zip) {\n this.zip.end(EOF)\n } else {\n super.write(EOF as unknown as string)\n super.end()\n }\n }\n }\n\n get [CURRENT]() {\n return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value\n }\n\n [JOBDONE](_job: PackJob) {\n this[QUEUE].shift()\n this[JOBS] -= 1\n this[PROCESS]()\n }\n\n [PROCESSJOB](job: PackJob) {\n if (job.pending) {\n return\n }\n\n if (job.entry) {\n if (job === this[CURRENT] && !job.piped) {\n this[PIPE](job)\n }\n return\n }\n\n if (!job.stat) {\n const sc = this.statCache.get(job.absolute)\n if (sc) {\n this[ONSTAT](job, sc)\n } else {\n this[STAT](job)\n }\n }\n if (!job.stat) {\n return\n }\n\n // filtered out!\n if (job.ignore) {\n return\n }\n\n if (\n !this.noDirRecurse &&\n job.stat.isDirectory() &&\n !job.readdir\n ) {\n const rc = this.readdirCache.get(job.absolute)\n if (rc) {\n this[ONREADDIR](job, rc)\n } else {\n this[READDIR](job)\n }\n if (!job.readdir) {\n return\n }\n }\n\n // we know it doesn't have an entry, because that got checked above\n job.entry = this[ENTRY](job)\n if (!job.entry) {\n job.ignore = true\n return\n }\n\n if (job === this[CURRENT] && !job.piped) {\n this[PIPE](job)\n }\n }\n\n [ENTRYOPT](job: PackJob): TarOptions {\n return {\n onwarn: (code, msg, data) => this.warn(code, msg, data),\n noPax: this.noPax,\n cwd: this.cwd,\n absolute: job.absolute,\n preservePaths: this.preservePaths,\n maxReadSize: this.maxReadSize,\n strict: this.strict,\n portable: this.portable,\n linkCache: this.linkCache,\n statCache: this.statCache,\n noMtime: this.noMtime,\n mtime: this.mtime,\n prefix: this.prefix,\n onWriteEntry: this.onWriteEntry,\n }\n }\n\n [ENTRY](job: PackJob) {\n this[JOBS] += 1\n try {\n const e = new this[WRITEENTRYCLASS](\n job.path,\n this[ENTRYOPT](job),\n )\n return e\n .on('end', () => this[JOBDONE](job))\n .on('error', er => this.emit('error', er))\n } catch (er) {\n this.emit('error', er)\n }\n }\n\n [ONDRAIN]() {\n if (this[CURRENT] && this[CURRENT].entry) {\n this[CURRENT].entry.resume()\n }\n }\n\n // like .pipe() but using super, because our write() is special\n [PIPE](job: PackJob) {\n job.piped = true\n\n if (job.readdir) {\n job.readdir.forEach(entry => {\n const p = job.path\n const base = p === './' ? '' : p.replace(/\\/*$/, '/')\n this[ADDFSENTRY](base + entry)\n })\n }\n\n const source = job.entry\n const zip = this.zip\n /* c8 ignore start */\n if (!source) throw new Error('cannot pipe without source')\n /* c8 ignore stop */\n\n if (zip) {\n source.on('data', chunk => {\n if (!zip.write(chunk)) {\n source.pause()\n }\n })\n } else {\n source.on('data', chunk => {\n if (!super.write(chunk as unknown as string)) {\n source.pause()\n }\n })\n }\n }\n\n pause() {\n if (this.zip) {\n this.zip.pause()\n }\n return super.pause()\n }\n warn(\n code: string,\n message: string | Error,\n data: WarnData = {},\n ): void {\n warnMethod(this, code, message, data)\n }\n}\n\nexport class PackSync extends Pack {\n sync: true = true\n constructor(opt: TarOptions) {\n super(opt)\n this[WRITEENTRYCLASS] = WriteEntrySync\n }\n\n // pause/resume are no-ops in sync streams.\n pause() {}\n resume() {}\n\n [STAT](job: PackJob) {\n const stat = this.follow ? 'statSync' : 'lstatSync'\n this[ONSTAT](job, fs[stat](job.absolute))\n }\n\n [READDIR](job: PackJob) {\n this[ONREADDIR](job, fs.readdirSync(job.absolute))\n }\n\n // gotta get it all in this tick\n [PIPE](job: PackJob) {\n const source = job.entry\n const zip = this.zip\n\n if (job.readdir) {\n job.readdir.forEach(entry => {\n const p = job.path\n const base = p === './' ? '' : p.replace(/\\/*$/, '/')\n this[ADDFSENTRY](base + entry)\n })\n }\n\n /* c8 ignore start */\n if (!source) throw new Error('Cannot pipe without source')\n /* c8 ignore stop */\n\n if (zip) {\n source.on('data', chunk => {\n zip.write(chunk)\n })\n } else {\n source.on('data', chunk => {\n super[WRITE](chunk)\n })\n }\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/package.json b/node_modules/cmake-js/node_modules/tar/dist/esm/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/parse.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/parse.d.ts new file mode 100644 index 0000000..6aba1f6 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/parse.d.ts @@ -0,0 +1,85 @@ +import { EventEmitter as EE } from 'events'; +import { BrotliDecompress, Unzip, ZstdDecompress } from 'minizlib'; +import { TarOptions } from './options.js'; +import { Pax } from './pax.js'; +import { ReadEntry } from './read-entry.js'; +import { type WarnData, type Warner } from './warn-method.js'; +declare const STATE: unique symbol; +declare const WRITEENTRY: unique symbol; +declare const READENTRY: unique symbol; +declare const NEXTENTRY: unique symbol; +declare const PROCESSENTRY: unique symbol; +declare const EX: unique symbol; +declare const GEX: unique symbol; +declare const META: unique symbol; +declare const EMITMETA: unique symbol; +declare const BUFFER: unique symbol; +declare const QUEUE: unique symbol; +declare const ENDED: unique symbol; +declare const EMITTEDEND: unique symbol; +declare const EMIT: unique symbol; +declare const UNZIP: unique symbol; +declare const CONSUMECHUNK: unique symbol; +declare const CONSUMECHUNKSUB: unique symbol; +declare const CONSUMEBODY: unique symbol; +declare const CONSUMEMETA: unique symbol; +declare const CONSUMEHEADER: unique symbol; +declare const CONSUMING: unique symbol; +declare const BUFFERCONCAT: unique symbol; +declare const MAYBEEND: unique symbol; +declare const WRITING: unique symbol; +declare const ABORTED: unique symbol; +declare const SAW_VALID_ENTRY: unique symbol; +declare const SAW_NULL_BLOCK: unique symbol; +declare const SAW_EOF: unique symbol; +declare const CLOSESTREAM: unique symbol; +export type State = 'begin' | 'header' | 'ignore' | 'meta' | 'body'; +export declare class Parser extends EE implements Warner { + file: string; + strict: boolean; + maxMetaEntrySize: number; + filter: Exclude; + brotli?: TarOptions['brotli']; + zstd?: TarOptions['zstd']; + writable: true; + readable: false; + [QUEUE]: (ReadEntry | [string | symbol, any, any])[]; + [BUFFER]?: Buffer; + [READENTRY]?: ReadEntry; + [WRITEENTRY]?: ReadEntry; + [STATE]: State; + [META]: string; + [EX]?: Pax; + [GEX]?: Pax; + [ENDED]: boolean; + [UNZIP]?: false | Unzip | BrotliDecompress | ZstdDecompress; + [ABORTED]: boolean; + [SAW_VALID_ENTRY]?: boolean; + [SAW_NULL_BLOCK]: boolean; + [SAW_EOF]: boolean; + [WRITING]: boolean; + [CONSUMING]: boolean; + [EMITTEDEND]: boolean; + constructor(opt?: TarOptions); + warn(code: string, message: string | Error, data?: WarnData): void; + [CONSUMEHEADER](chunk: Buffer, position: number): void; + [CLOSESTREAM](): void; + [PROCESSENTRY](entry?: ReadEntry | [string | symbol, any, any]): boolean; + [NEXTENTRY](): void; + [CONSUMEBODY](chunk: Buffer, position: number): number; + [CONSUMEMETA](chunk: Buffer, position: number): number; + [EMIT](ev: string | symbol, data?: any, extra?: any): void; + [EMITMETA](entry: ReadEntry): void; + abort(error: Error): void; + write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean; + write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean; + [BUFFERCONCAT](c: Buffer): void; + [MAYBEEND](): void; + [CONSUMECHUNK](chunk?: Buffer): void; + [CONSUMECHUNKSUB](chunk: Buffer): void; + end(cb?: () => void): this; + end(data: string | Buffer, cb?: () => void): this; + end(str: string, encoding?: BufferEncoding, cb?: () => void): this; +} +export {}; +//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/parse.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/parse.d.ts.map new file mode 100644 index 0000000..80aa723 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/parse.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/parse.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,YAAY,IAAI,EAAE,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAElE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,MAAM,EACZ,MAAM,kBAAkB,CAAA;AAOzB,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,SAAS,eAAsB,CAAA;AACrC,QAAA,MAAM,SAAS,eAAsB,CAAA;AACrC,QAAA,MAAM,YAAY,eAAyB,CAAA;AAC3C,QAAA,MAAM,EAAE,eAA2B,CAAA;AACnC,QAAA,MAAM,GAAG,eAAiC,CAAA;AAC1C,QAAA,MAAM,IAAI,eAAiB,CAAA;AAC3B,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,IAAI,eAAiB,CAAA;AAC3B,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,YAAY,eAAyB,CAAA;AAC3C,QAAA,MAAM,eAAe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AAK,CAAC,EAAE,GAAG;IAQnD,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,SAAS;IAkC3B,KAAK,CAAC,KAAK,EAAE,KAAK;IAOlB,KAAK,CACH,MAAM,EAAE,UAAU,GAAG,MAAM,EAC3B,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,GAChC,OAAO;IACV,KAAK,CACH,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,cAAc,EACzB,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,GAChC,OAAO;IAyIV,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,MAAM;IAOxB,CAAC,QAAQ,CAAC;IA0BV,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,EAAE,MAAM;IAkC7B,CAAC,eAAe,CAAC,CAAC,KAAK,EAAE,MAAM;IA6C/B,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI;IAC1B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI;IACjD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc,EAAE,EAAE,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI;CAmCnE"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/parse.js b/node_modules/cmake-js/node_modules/tar/dist/esm/parse.js new file mode 100644 index 0000000..50592a1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/parse.js @@ -0,0 +1,616 @@ +// this[BUFFER] is the remainder of a chunk if we're waiting for +// the full 512 bytes of a header to come in. We will Buffer.concat() +// it to the next write(), which is a mem copy, but a small one. +// +// this[QUEUE] is a list of entries that haven't been emitted +// yet this can only get filled up if the user keeps write()ing after +// a write() returns false, or does a write() with more than one entry +// +// We don't buffer chunks, we always parse them and either create an +// entry, or push it into the active entry. The ReadEntry class knows +// to throw data away if .ignore=true +// +// Shift entry off the buffer when it emits 'end', and emit 'entry' for +// the next one in the list. +// +// At any time, we're pushing body chunks into the entry at WRITEENTRY, +// and waiting for 'end' on the entry at READENTRY +// +// ignored entries get .resume() called on them straight away +import { EventEmitter as EE } from 'events'; +import { BrotliDecompress, Unzip, ZstdDecompress } from 'minizlib'; +import { Header } from './header.js'; +import { Pax } from './pax.js'; +import { ReadEntry } from './read-entry.js'; +import { warnMethod, } from './warn-method.js'; +const maxMetaEntrySize = 1024 * 1024; +const gzipHeader = Buffer.from([0x1f, 0x8b]); +const zstdHeader = Buffer.from([0x28, 0xb5, 0x2f, 0xfd]); +const ZIP_HEADER_LEN = Math.max(gzipHeader.length, zstdHeader.length); +const STATE = Symbol('state'); +const WRITEENTRY = Symbol('writeEntry'); +const READENTRY = Symbol('readEntry'); +const NEXTENTRY = Symbol('nextEntry'); +const PROCESSENTRY = Symbol('processEntry'); +const EX = Symbol('extendedHeader'); +const GEX = Symbol('globalExtendedHeader'); +const META = Symbol('meta'); +const EMITMETA = Symbol('emitMeta'); +const BUFFER = Symbol('buffer'); +const QUEUE = Symbol('queue'); +const ENDED = Symbol('ended'); +const EMITTEDEND = Symbol('emittedEnd'); +const EMIT = Symbol('emit'); +const UNZIP = Symbol('unzip'); +const CONSUMECHUNK = Symbol('consumeChunk'); +const CONSUMECHUNKSUB = Symbol('consumeChunkSub'); +const CONSUMEBODY = Symbol('consumeBody'); +const CONSUMEMETA = Symbol('consumeMeta'); +const CONSUMEHEADER = Symbol('consumeHeader'); +const CONSUMING = Symbol('consuming'); +const BUFFERCONCAT = Symbol('bufferConcat'); +const MAYBEEND = Symbol('maybeEnd'); +const WRITING = Symbol('writing'); +const ABORTED = Symbol('aborted'); +const DONE = Symbol('onDone'); +const SAW_VALID_ENTRY = Symbol('sawValidEntry'); +const SAW_NULL_BLOCK = Symbol('sawNullBlock'); +const SAW_EOF = Symbol('sawEOF'); +const CLOSESTREAM = Symbol('closeStream'); +const noop = () => true; +export class Parser extends EE { + file; + strict; + maxMetaEntrySize; + filter; + brotli; + zstd; + writable = true; + readable = false; + [QUEUE] = []; + [BUFFER]; + [READENTRY]; + [WRITEENTRY]; + [STATE] = 'begin'; + [META] = ''; + [EX]; + [GEX]; + [ENDED] = false; + [UNZIP]; + [ABORTED] = false; + [SAW_VALID_ENTRY]; + [SAW_NULL_BLOCK] = false; + [SAW_EOF] = false; + [WRITING] = false; + [CONSUMING] = false; + [EMITTEDEND] = false; + constructor(opt = {}) { + super(); + this.file = opt.file || ''; + // these BADARCHIVE errors can't be detected early. listen on DONE. + this.on(DONE, () => { + if (this[STATE] === 'begin' || + this[SAW_VALID_ENTRY] === false) { + // either less than 1 block of data, or all entries were invalid. + // Either way, probably not even a tarball. + this.warn('TAR_BAD_ARCHIVE', 'Unrecognized archive format'); + } + }); + if (opt.ondone) { + this.on(DONE, opt.ondone); + } + else { + this.on(DONE, () => { + this.emit('prefinish'); + this.emit('finish'); + this.emit('end'); + }); + } + this.strict = !!opt.strict; + this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize; + this.filter = typeof opt.filter === 'function' ? opt.filter : noop; + // Unlike gzip, brotli doesn't have any magic bytes to identify it + // Users need to explicitly tell us they're extracting a brotli file + // Or we infer from the file extension + const isTBR = opt.file && + (opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr')); + // if it's a tbr file it MIGHT be brotli, but we don't know until + // we look at it and verify it's not a valid tar file. + this.brotli = + !(opt.gzip || opt.zstd) && opt.brotli !== undefined ? opt.brotli + : isTBR ? undefined + : false; + // zstd has magic bytes to identify it, but we also support explicit options + // and file extension detection + const isTZST = opt.file && + (opt.file.endsWith('.tar.zst') || opt.file.endsWith('.tzst')); + this.zstd = + !(opt.gzip || opt.brotli) && opt.zstd !== undefined ? opt.zstd + : isTZST ? true + : undefined; + // have to set this so that streams are ok piping into it + this.on('end', () => this[CLOSESTREAM]()); + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn); + } + if (typeof opt.onReadEntry === 'function') { + this.on('entry', opt.onReadEntry); + } + } + warn(code, message, data = {}) { + warnMethod(this, code, message, data); + } + [CONSUMEHEADER](chunk, position) { + if (this[SAW_VALID_ENTRY] === undefined) { + this[SAW_VALID_ENTRY] = false; + } + let header; + try { + header = new Header(chunk, position, this[EX], this[GEX]); + } + catch (er) { + return this.warn('TAR_ENTRY_INVALID', er); + } + if (header.nullBlock) { + if (this[SAW_NULL_BLOCK]) { + this[SAW_EOF] = true; + // ending an archive with no entries. pointless, but legal. + if (this[STATE] === 'begin') { + this[STATE] = 'header'; + } + this[EMIT]('eof'); + } + else { + this[SAW_NULL_BLOCK] = true; + this[EMIT]('nullBlock'); + } + } + else { + this[SAW_NULL_BLOCK] = false; + if (!header.cksumValid) { + this.warn('TAR_ENTRY_INVALID', 'checksum failure', { header }); + } + else if (!header.path) { + this.warn('TAR_ENTRY_INVALID', 'path is required', { header }); + } + else { + const type = header.type; + if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) { + this.warn('TAR_ENTRY_INVALID', 'linkpath required', { + header, + }); + } + else if (!/^(Symbolic)?Link$/.test(type) && + !/^(Global)?ExtendedHeader$/.test(type) && + header.linkpath) { + this.warn('TAR_ENTRY_INVALID', 'linkpath forbidden', { + header, + }); + } + else { + const entry = (this[WRITEENTRY] = new ReadEntry(header, this[EX], this[GEX])); + // we do this for meta & ignored entries as well, because they + // are still valid tar, or else we wouldn't know to ignore them + if (!this[SAW_VALID_ENTRY]) { + if (entry.remain) { + // this might be the one! + const onend = () => { + if (!entry.invalid) { + this[SAW_VALID_ENTRY] = true; + } + }; + entry.on('end', onend); + } + else { + this[SAW_VALID_ENTRY] = true; + } + } + if (entry.meta) { + if (entry.size > this.maxMetaEntrySize) { + entry.ignore = true; + this[EMIT]('ignoredEntry', entry); + this[STATE] = 'ignore'; + entry.resume(); + } + else if (entry.size > 0) { + this[META] = ''; + entry.on('data', c => (this[META] += c)); + this[STATE] = 'meta'; + } + } + else { + this[EX] = undefined; + entry.ignore = + entry.ignore || !this.filter(entry.path, entry); + if (entry.ignore) { + // probably valid, just not something we care about + this[EMIT]('ignoredEntry', entry); + this[STATE] = entry.remain ? 'ignore' : 'header'; + entry.resume(); + } + else { + if (entry.remain) { + this[STATE] = 'body'; + } + else { + this[STATE] = 'header'; + entry.end(); + } + if (!this[READENTRY]) { + this[QUEUE].push(entry); + this[NEXTENTRY](); + } + else { + this[QUEUE].push(entry); + } + } + } + } + } + } + } + [CLOSESTREAM]() { + queueMicrotask(() => this.emit('close')); + } + [PROCESSENTRY](entry) { + let go = true; + if (!entry) { + this[READENTRY] = undefined; + go = false; + } + else if (Array.isArray(entry)) { + const [ev, ...args] = entry; + this.emit(ev, ...args); + } + else { + this[READENTRY] = entry; + this.emit('entry', entry); + if (!entry.emittedEnd) { + entry.on('end', () => this[NEXTENTRY]()); + go = false; + } + } + return go; + } + [NEXTENTRY]() { + do { } while (this[PROCESSENTRY](this[QUEUE].shift())); + if (!this[QUEUE].length) { + // At this point, there's nothing in the queue, but we may have an + // entry which is being consumed (readEntry). + // If we don't, then we definitely can handle more data. + // If we do, and either it's flowing, or it has never had any data + // written to it, then it needs more. + // The only other possibility is that it has returned false from a + // write() call, so we wait for the next drain to continue. + const re = this[READENTRY]; + const drainNow = !re || re.flowing || re.size === re.remain; + if (drainNow) { + if (!this[WRITING]) { + this.emit('drain'); + } + } + else { + re.once('drain', () => this.emit('drain')); + } + } + } + [CONSUMEBODY](chunk, position) { + // write up to but no more than writeEntry.blockRemain + const entry = this[WRITEENTRY]; + /* c8 ignore start */ + if (!entry) { + throw new Error('attempt to consume body without entry??'); + } + const br = entry.blockRemain ?? 0; + /* c8 ignore stop */ + const c = br >= chunk.length && position === 0 ? + chunk + : chunk.subarray(position, position + br); + entry.write(c); + if (!entry.blockRemain) { + this[STATE] = 'header'; + this[WRITEENTRY] = undefined; + entry.end(); + } + return c.length; + } + [CONSUMEMETA](chunk, position) { + const entry = this[WRITEENTRY]; + const ret = this[CONSUMEBODY](chunk, position); + // if we finished, then the entry is reset + if (!this[WRITEENTRY] && entry) { + this[EMITMETA](entry); + } + return ret; + } + [EMIT](ev, data, extra) { + if (!this[QUEUE].length && !this[READENTRY]) { + this.emit(ev, data, extra); + } + else { + this[QUEUE].push([ev, data, extra]); + } + } + [EMITMETA](entry) { + this[EMIT]('meta', this[META]); + switch (entry.type) { + case 'ExtendedHeader': + case 'OldExtendedHeader': + this[EX] = Pax.parse(this[META], this[EX], false); + break; + case 'GlobalExtendedHeader': + this[GEX] = Pax.parse(this[META], this[GEX], true); + break; + case 'NextFileHasLongPath': + case 'OldGnuLongPath': { + const ex = this[EX] ?? Object.create(null); + this[EX] = ex; + ex.path = this[META].replace(/\0.*/, ''); + break; + } + case 'NextFileHasLongLinkpath': { + const ex = this[EX] || Object.create(null); + this[EX] = ex; + ex.linkpath = this[META].replace(/\0.*/, ''); + break; + } + /* c8 ignore start */ + default: + throw new Error('unknown meta: ' + entry.type); + /* c8 ignore stop */ + } + } + abort(error) { + this[ABORTED] = true; + this.emit('abort', error); + // always throws, even in non-strict mode + this.warn('TAR_ABORT', error, { recoverable: false }); + } + write(chunk, encoding, cb) { + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, + /* c8 ignore next */ + typeof encoding === 'string' ? encoding : 'utf8'); + } + if (this[ABORTED]) { + /* c8 ignore next */ + cb?.(); + return false; + } + // first write, might be gzipped, zstd, or brotli compressed + const needSniff = this[UNZIP] === undefined || + (this.brotli === undefined && this[UNZIP] === false); + if (needSniff && chunk) { + if (this[BUFFER]) { + chunk = Buffer.concat([this[BUFFER], chunk]); + this[BUFFER] = undefined; + } + if (chunk.length < ZIP_HEADER_LEN) { + this[BUFFER] = chunk; + /* c8 ignore next */ + cb?.(); + return true; + } + // look for gzip header + for (let i = 0; this[UNZIP] === undefined && i < gzipHeader.length; i++) { + if (chunk[i] !== gzipHeader[i]) { + this[UNZIP] = false; + } + } + // look for zstd header if gzip header not found + let isZstd = false; + if (this[UNZIP] === false && this.zstd !== false) { + isZstd = true; + for (let i = 0; i < zstdHeader.length; i++) { + if (chunk[i] !== zstdHeader[i]) { + isZstd = false; + break; + } + } + } + const maybeBrotli = this.brotli === undefined && !isZstd; + if (this[UNZIP] === false && maybeBrotli) { + // read the first header to see if it's a valid tar file. If so, + // we can safely assume that it's not actually brotli, despite the + // .tbr or .tar.br file extension. + // if we ended before getting a full chunk, yes, def brotli + if (chunk.length < 512) { + if (this[ENDED]) { + this.brotli = true; + } + else { + this[BUFFER] = chunk; + /* c8 ignore next */ + cb?.(); + return true; + } + } + else { + // if it's tar, it's pretty reliably not brotli, chances of + // that happening are astronomical. + try { + new Header(chunk.subarray(0, 512)); + this.brotli = false; + } + catch (_) { + this.brotli = true; + } + } + } + if (this[UNZIP] === undefined || + (this[UNZIP] === false && (this.brotli || isZstd))) { + const ended = this[ENDED]; + this[ENDED] = false; + this[UNZIP] = + this[UNZIP] === undefined ? new Unzip({}) + : isZstd ? new ZstdDecompress({}) + : new BrotliDecompress({}); + this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk)); + this[UNZIP].on('error', er => this.abort(er)); + this[UNZIP].on('end', () => { + this[ENDED] = true; + this[CONSUMECHUNK](); + }); + this[WRITING] = true; + const ret = !!this[UNZIP][ended ? 'end' : 'write'](chunk); + this[WRITING] = false; + cb?.(); + return ret; + } + } + this[WRITING] = true; + if (this[UNZIP]) { + this[UNZIP].write(chunk); + } + else { + this[CONSUMECHUNK](chunk); + } + this[WRITING] = false; + // return false if there's a queue, or if the current entry isn't flowing + const ret = this[QUEUE].length ? false + : this[READENTRY] ? this[READENTRY].flowing + : true; + // if we have no queue, then that means a clogged READENTRY + if (!ret && !this[QUEUE].length) { + this[READENTRY]?.once('drain', () => this.emit('drain')); + } + /* c8 ignore next */ + cb?.(); + return ret; + } + [BUFFERCONCAT](c) { + if (c && !this[ABORTED]) { + this[BUFFER] = + this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c; + } + } + [MAYBEEND]() { + if (this[ENDED] && + !this[EMITTEDEND] && + !this[ABORTED] && + !this[CONSUMING]) { + this[EMITTEDEND] = true; + const entry = this[WRITEENTRY]; + if (entry && entry.blockRemain) { + // truncated, likely a damaged file + const have = this[BUFFER] ? this[BUFFER].length : 0; + this.warn('TAR_BAD_ARCHIVE', `Truncated input (needed ${entry.blockRemain} more bytes, only ${have} available)`, { entry }); + if (this[BUFFER]) { + entry.write(this[BUFFER]); + } + entry.end(); + } + this[EMIT](DONE); + } + } + [CONSUMECHUNK](chunk) { + if (this[CONSUMING] && chunk) { + this[BUFFERCONCAT](chunk); + } + else if (!chunk && !this[BUFFER]) { + this[MAYBEEND](); + } + else if (chunk) { + this[CONSUMING] = true; + if (this[BUFFER]) { + this[BUFFERCONCAT](chunk); + const c = this[BUFFER]; + this[BUFFER] = undefined; + this[CONSUMECHUNKSUB](c); + } + else { + this[CONSUMECHUNKSUB](chunk); + } + while (this[BUFFER] && + this[BUFFER]?.length >= 512 && + !this[ABORTED] && + !this[SAW_EOF]) { + const c = this[BUFFER]; + this[BUFFER] = undefined; + this[CONSUMECHUNKSUB](c); + } + this[CONSUMING] = false; + } + if (!this[BUFFER] || this[ENDED]) { + this[MAYBEEND](); + } + } + [CONSUMECHUNKSUB](chunk) { + // we know that we are in CONSUMING mode, so anything written goes into + // the buffer. Advance the position and put any remainder in the buffer. + let position = 0; + const length = chunk.length; + while (position + 512 <= length && + !this[ABORTED] && + !this[SAW_EOF]) { + switch (this[STATE]) { + case 'begin': + case 'header': + this[CONSUMEHEADER](chunk, position); + position += 512; + break; + case 'ignore': + case 'body': + position += this[CONSUMEBODY](chunk, position); + break; + case 'meta': + position += this[CONSUMEMETA](chunk, position); + break; + /* c8 ignore start */ + default: + throw new Error('invalid state: ' + this[STATE]); + /* c8 ignore stop */ + } + } + if (position < length) { + if (this[BUFFER]) { + this[BUFFER] = Buffer.concat([ + chunk.subarray(position), + this[BUFFER], + ]); + } + else { + this[BUFFER] = chunk.subarray(position); + } + } + } + end(chunk, encoding, cb) { + if (typeof chunk === 'function') { + cb = chunk; + encoding = undefined; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + if (cb) + this.once('finish', cb); + if (!this[ABORTED]) { + if (this[UNZIP]) { + /* c8 ignore start */ + if (chunk) + this[UNZIP].write(chunk); + /* c8 ignore stop */ + this[UNZIP].end(); + } + else { + this[ENDED] = true; + if (this.brotli === undefined || this.zstd === undefined) + chunk = chunk || Buffer.alloc(0); + if (chunk) + this.write(chunk); + this[MAYBEEND](); + } + } + return this; + } +} +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/parse.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/parse.js.map new file mode 100644 index 0000000..a040335 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/parse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/parse.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,sEAAsE;AACtE,gEAAgE;AAChE,EAAE;AACF,6DAA6D;AAC7D,qEAAqE;AACrE,sEAAsE;AACtE,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,qCAAqC;AACrC,EAAE;AACF,uEAAuE;AACvE,4BAA4B;AAC5B,EAAE;AACF,uEAAuE;AACvE,kDAAkD;AAClD,EAAE;AACF,6DAA6D;AAE7D,OAAO,EAAE,YAAY,IAAI,EAAE,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,GAAG,EAAE,MAAM,U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GAAG,QAAQ,CAAA;YACb,QAAQ,GAAG,SAAS,CAAA;QACtB,CAAC;QACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;QACtC,CAAC;QACD,IAAI,EAAE;YAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;QAC/B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACnB,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChB,qBAAqB;gBACrB,IAAI,KAAK;oBAAE,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;gBACnC,oBAAoB;gBACpB,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAA;YACnB,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;gBAClB,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;oBACtD,KAAK,GAAG,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;gBAClC,IAAI,KAAK;oBAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;gBAC5B,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAA;YAClB,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF","sourcesContent":["// this[BUFFER] is the remainder of a chunk if we're waiting for\n// the full 512 bytes of a header to come in. We will Buffer.concat()\n// it to the next write(), which is a mem copy, but a small one.\n//\n// this[QUEUE] is a list of entries that haven't been emitted\n// yet this can only get filled up if the user keeps write()ing after\n// a write() returns false, or does a write() with more than one entry\n//\n// We don't buffer chunks, we always parse them and either create an\n// entry, or push it into the active entry. The ReadEntry class knows\n// to throw data away if .ignore=true\n//\n// Shift entry off the buffer when it emits 'end', and emit 'entry' for\n// the next one in the list.\n//\n// At any time, we're pushing body chunks into the entry at WRITEENTRY,\n// and waiting for 'end' on the entry at READENTRY\n//\n// ignored entries get .resume() called on them straight away\n\nimport { EventEmitter as EE } from 'events'\nimport { BrotliDecompress, Unzip, ZstdDecompress } from 'minizlib'\nimport { Header } from './header.js'\nimport { TarOptions } from './options.js'\nimport { Pax } from './pax.js'\nimport { ReadEntry } from './read-entry.js'\nimport {\n warnMethod,\n type WarnData,\n type Warner,\n} from './warn-method.js'\n\nconst maxMetaEntrySize = 1024 * 1024\nconst gzipHeader = Buffer.from([0x1f, 0x8b])\nconst zstdHeader = Buffer.from([0x28, 0xb5, 0x2f, 0xfd])\nconst ZIP_HEADER_LEN = Math.max(gzipHeader.length, zstdHeader.length)\n\nconst STATE = Symbol('state')\nconst WRITEENTRY = Symbol('writeEntry')\nconst READENTRY = Symbol('readEntry')\nconst NEXTENTRY = Symbol('nextEntry')\nconst PROCESSENTRY = Symbol('processEntry')\nconst EX = Symbol('extendedHeader')\nconst GEX = Symbol('globalExtendedHeader')\nconst META = Symbol('meta')\nconst EMITMETA = Symbol('emitMeta')\nconst BUFFER = Symbol('buffer')\nconst QUEUE = Symbol('queue')\nconst ENDED = Symbol('ended')\nconst EMITTEDEND = Symbol('emittedEnd')\nconst EMIT = Symbol('emit')\nconst UNZIP = Symbol('unzip')\nconst CONSUMECHUNK = Symbol('consumeChunk')\nconst CONSUMECHUNKSUB = Symbol('consumeChunkSub')\nconst CONSUMEBODY = Symbol('consumeBody')\nconst CONSUMEMETA = Symbol('consumeMeta')\nconst CONSUMEHEADER = Symbol('consumeHeader')\nconst CONSUMING = Symbol('consuming')\nconst BUFFERCONCAT = Symbol('bufferConcat')\nconst MAYBEEND = Symbol('maybeEnd')\nconst WRITING = Symbol('writing')\nconst ABORTED = Symbol('aborted')\nconst DONE = Symbol('onDone')\nconst SAW_VALID_ENTRY = Symbol('sawValidEntry')\nconst SAW_NULL_BLOCK = Symbol('sawNullBlock')\nconst SAW_EOF = Symbol('sawEOF')\nconst CLOSESTREAM = Symbol('closeStream')\n\nconst noop = () => true\n\nexport type State = 'begin' | 'header' | 'ignore' | 'meta' | 'body'\n\nexport class Parser extends EE implements Warner {\n file: string\n strict: boolean\n maxMetaEntrySize: number\n filter: Exclude\n brotli?: TarOptions['brotli']\n zstd?: TarOptions['zstd']\n\n writable: true = true\n readable: false = false;\n\n [QUEUE]: (ReadEntry | [string | symbol, any, any])[] = [];\n [BUFFER]?: Buffer;\n [READENTRY]?: ReadEntry;\n [WRITEENTRY]?: ReadEntry;\n [STATE]: State = 'begin';\n [META]: string = '';\n [EX]?: Pax;\n [GEX]?: Pax;\n [ENDED]: boolean = false;\n [UNZIP]?: false | Unzip | BrotliDecompress | ZstdDecompress;\n [ABORTED]: boolean = false;\n [SAW_VALID_ENTRY]?: boolean;\n [SAW_NULL_BLOCK]: boolean = false;\n [SAW_EOF]: boolean = false;\n [WRITING]: boolean = false;\n [CONSUMING]: boolean = false;\n [EMITTEDEND]: boolean = false\n\n constructor(opt: TarOptions = {}) {\n super()\n\n this.file = opt.file || ''\n\n // these BADARCHIVE errors can't be detected early. listen on DONE.\n this.on(DONE, () => {\n if (\n this[STATE] === 'begin' ||\n this[SAW_VALID_ENTRY] === false\n ) {\n // either less than 1 block of data, or all entries were invalid.\n // Either way, probably not even a tarball.\n this.warn('TAR_BAD_ARCHIVE', 'Unrecognized archive format')\n }\n })\n\n if (opt.ondone) {\n this.on(DONE, opt.ondone)\n } else {\n this.on(DONE, () => {\n this.emit('prefinish')\n this.emit('finish')\n this.emit('end')\n })\n }\n\n this.strict = !!opt.strict\n this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize\n this.filter = typeof opt.filter === 'function' ? opt.filter : noop\n // Unlike gzip, brotli doesn't have any magic bytes to identify it\n // Users need to explicitly tell us they're extracting a brotli file\n // Or we infer from the file extension\n const isTBR =\n opt.file &&\n (opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr'))\n // if it's a tbr file it MIGHT be brotli, but we don't know until\n // we look at it and verify it's not a valid tar file.\n this.brotli =\n !(opt.gzip || opt.zstd) && opt.brotli !== undefined ? opt.brotli\n : isTBR ? undefined\n : false\n\n // zstd has magic bytes to identify it, but we also support explicit options\n // and file extension detection\n const isTZST =\n opt.file &&\n (opt.file.endsWith('.tar.zst') || opt.file.endsWith('.tzst'))\n this.zstd =\n !(opt.gzip || opt.brotli) && opt.zstd !== undefined ? opt.zstd\n : isTZST ? true\n : undefined\n\n // have to set this so that streams are ok piping into it\n this.on('end', () => this[CLOSESTREAM]())\n\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n if (typeof opt.onReadEntry === 'function') {\n this.on('entry', opt.onReadEntry)\n }\n }\n\n warn(\n code: string,\n message: string | Error,\n data: WarnData = {},\n ): void {\n warnMethod(this, code, message, data)\n }\n\n [CONSUMEHEADER](chunk: Buffer, position: number) {\n if (this[SAW_VALID_ENTRY] === undefined) {\n this[SAW_VALID_ENTRY] = false\n }\n let header\n try {\n header = new Header(chunk, position, this[EX], this[GEX])\n } catch (er) {\n return this.warn('TAR_ENTRY_INVALID', er as Error)\n }\n\n if (header.nullBlock) {\n if (this[SAW_NULL_BLOCK]) {\n this[SAW_EOF] = true\n // ending an archive with no entries. pointless, but legal.\n if (this[STATE] === 'begin') {\n this[STATE] = 'header'\n }\n this[EMIT]('eof')\n } else {\n this[SAW_NULL_BLOCK] = true\n this[EMIT]('nullBlock')\n }\n } else {\n this[SAW_NULL_BLOCK] = false\n if (!header.cksumValid) {\n this.warn('TAR_ENTRY_INVALID', 'checksum failure', { header })\n } else if (!header.path) {\n this.warn('TAR_ENTRY_INVALID', 'path is required', { header })\n } else {\n const type = header.type\n if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) {\n this.warn('TAR_ENTRY_INVALID', 'linkpath required', {\n header,\n })\n } else if (\n !/^(Symbolic)?Link$/.test(type) &&\n !/^(Global)?ExtendedHeader$/.test(type) &&\n header.linkpath\n ) {\n this.warn('TAR_ENTRY_INVALID', 'linkpath forbidden', {\n header,\n })\n } else {\n const entry = (this[WRITEENTRY] = new ReadEntry(\n header,\n this[EX],\n this[GEX],\n ))\n\n // we do this for meta & ignored entries as well, because they\n // are still valid tar, or else we wouldn't know to ignore them\n if (!this[SAW_VALID_ENTRY]) {\n if (entry.remain) {\n // this might be the one!\n const onend = () => {\n if (!entry.invalid) {\n this[SAW_VALID_ENTRY] = true\n }\n }\n entry.on('end', onend)\n } else {\n this[SAW_VALID_ENTRY] = true\n }\n }\n\n if (entry.meta) {\n if (entry.size > this.maxMetaEntrySize) {\n entry.ignore = true\n this[EMIT]('ignoredEntry', entry)\n this[STATE] = 'ignore'\n entry.resume()\n } else if (entry.size > 0) {\n this[META] = ''\n entry.on('data', c => (this[META] += c))\n this[STATE] = 'meta'\n }\n } else {\n this[EX] = undefined\n entry.ignore =\n entry.ignore || !this.filter(entry.path, entry)\n\n if (entry.ignore) {\n // probably valid, just not something we care about\n this[EMIT]('ignoredEntry', entry)\n this[STATE] = entry.remain ? 'ignore' : 'header'\n entry.resume()\n } else {\n if (entry.remain) {\n this[STATE] = 'body'\n } else {\n this[STATE] = 'header'\n entry.end()\n }\n\n if (!this[READENTRY]) {\n this[QUEUE].push(entry)\n this[NEXTENTRY]()\n } else {\n this[QUEUE].push(entry)\n }\n }\n }\n }\n }\n }\n }\n\n [CLOSESTREAM]() {\n queueMicrotask(() => this.emit('close'))\n }\n\n [PROCESSENTRY](entry?: ReadEntry | [string | symbol, any, any]) {\n let go = true\n\n if (!entry) {\n this[READENTRY] = undefined\n go = false\n } else if (Array.isArray(entry)) {\n const [ev, ...args]: [string | symbol, any, any] = entry\n this.emit(ev, ...args)\n } else {\n this[READENTRY] = entry\n this.emit('entry', entry)\n if (!entry.emittedEnd) {\n entry.on('end', () => this[NEXTENTRY]())\n go = false\n }\n }\n\n return go\n }\n\n [NEXTENTRY]() {\n do {} while (this[PROCESSENTRY](this[QUEUE].shift()))\n\n if (!this[QUEUE].length) {\n // At this point, there's nothing in the queue, but we may have an\n // entry which is being consumed (readEntry).\n // If we don't, then we definitely can handle more data.\n // If we do, and either it's flowing, or it has never had any data\n // written to it, then it needs more.\n // The only other possibility is that it has returned false from a\n // write() call, so we wait for the next drain to continue.\n const re = this[READENTRY]\n const drainNow = !re || re.flowing || re.size === re.remain\n if (drainNow) {\n if (!this[WRITING]) {\n this.emit('drain')\n }\n } else {\n re.once('drain', () => this.emit('drain'))\n }\n }\n }\n\n [CONSUMEBODY](chunk: Buffer, position: number) {\n // write up to but no more than writeEntry.blockRemain\n const entry = this[WRITEENTRY]\n /* c8 ignore start */\n if (!entry) {\n throw new Error('attempt to consume body without entry??')\n }\n const br = entry.blockRemain ?? 0\n /* c8 ignore stop */\n const c =\n br >= chunk.length && position === 0 ?\n chunk\n : chunk.subarray(position, position + br)\n\n entry.write(c)\n\n if (!entry.blockRemain) {\n this[STATE] = 'header'\n this[WRITEENTRY] = undefined\n entry.end()\n }\n\n return c.length\n }\n\n [CONSUMEMETA](chunk: Buffer, position: number) {\n const entry = this[WRITEENTRY]\n const ret = this[CONSUMEBODY](chunk, position)\n\n // if we finished, then the entry is reset\n if (!this[WRITEENTRY] && entry) {\n this[EMITMETA](entry)\n }\n\n return ret\n }\n\n [EMIT](ev: string | symbol, data?: any, extra?: any) {\n if (!this[QUEUE].length && !this[READENTRY]) {\n this.emit(ev, data, extra)\n } else {\n this[QUEUE].push([ev, data, extra])\n }\n }\n\n [EMITMETA](entry: ReadEntry) {\n this[EMIT]('meta', this[META])\n switch (entry.type) {\n case 'ExtendedHeader':\n case 'OldExtendedHeader':\n this[EX] = Pax.parse(this[META], this[EX], false)\n break\n\n case 'GlobalExtendedHeader':\n this[GEX] = Pax.parse(this[META], this[GEX], true)\n break\n\n case 'NextFileHasLongPath':\n case 'OldGnuLongPath': {\n const ex = this[EX] ?? Object.create(null)\n this[EX] = ex\n ex.path = this[META].replace(/\\0.*/, '')\n break\n }\n\n case 'NextFileHasLongLinkpath': {\n const ex = this[EX] || Object.create(null)\n this[EX] = ex\n ex.linkpath = this[META].replace(/\\0.*/, '')\n break\n }\n\n /* c8 ignore start */\n default:\n throw new Error('unknown meta: ' + entry.type)\n /* c8 ignore stop */\n }\n }\n\n abort(error: Error) {\n this[ABORTED] = true\n this.emit('abort', error)\n // always throws, even in non-strict mode\n this.warn('TAR_ABORT', error, { recoverable: false })\n }\n\n write(\n buffer: Uint8Array | string,\n cb?: (err?: Error | null) => void,\n ): boolean\n write(\n str: string,\n encoding?: BufferEncoding,\n cb?: (err?: Error | null) => void,\n ): boolean\n write(\n chunk: Buffer | string,\n encoding?: BufferEncoding | (() => any),\n cb?: () => any,\n ): boolean {\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(\n chunk,\n /* c8 ignore next */\n typeof encoding === 'string' ? encoding : 'utf8',\n )\n }\n if (this[ABORTED]) {\n /* c8 ignore next */\n cb?.()\n return false\n }\n\n // first write, might be gzipped, zstd, or brotli compressed\n const needSniff =\n this[UNZIP] === undefined ||\n (this.brotli === undefined && this[UNZIP] === false)\n if (needSniff && chunk) {\n if (this[BUFFER]) {\n chunk = Buffer.concat([this[BUFFER], chunk])\n this[BUFFER] = undefined\n }\n if (chunk.length < ZIP_HEADER_LEN) {\n this[BUFFER] = chunk\n /* c8 ignore next */\n cb?.()\n return true\n }\n\n // look for gzip header\n for (\n let i = 0;\n this[UNZIP] === undefined && i < gzipHeader.length;\n i++\n ) {\n if (chunk[i] !== gzipHeader[i]) {\n this[UNZIP] = false\n }\n }\n\n // look for zstd header if gzip header not found\n let isZstd = false\n if (this[UNZIP] === false && this.zstd !== false) {\n isZstd = true\n for (let i = 0; i < zstdHeader.length; i++) {\n if (chunk[i] !== zstdHeader[i]) {\n isZstd = false\n break\n }\n }\n }\n\n const maybeBrotli = this.brotli === undefined && !isZstd\n if (this[UNZIP] === false && maybeBrotli) {\n // read the first header to see if it's a valid tar file. If so,\n // we can safely assume that it's not actually brotli, despite the\n // .tbr or .tar.br file extension.\n // if we ended before getting a full chunk, yes, def brotli\n if (chunk.length < 512) {\n if (this[ENDED]) {\n this.brotli = true\n } else {\n this[BUFFER] = chunk\n /* c8 ignore next */\n cb?.()\n return true\n }\n } else {\n // if it's tar, it's pretty reliably not brotli, chances of\n // that happening are astronomical.\n try {\n new Header(chunk.subarray(0, 512))\n this.brotli = false\n } catch (_) {\n this.brotli = true\n }\n }\n }\n\n if (\n this[UNZIP] === undefined ||\n (this[UNZIP] === false && (this.brotli || isZstd))\n ) {\n const ended = this[ENDED]\n this[ENDED] = false\n this[UNZIP] =\n this[UNZIP] === undefined ? new Unzip({})\n : isZstd ? new ZstdDecompress({})\n : new BrotliDecompress({})\n this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk))\n this[UNZIP].on('error', er => this.abort(er as Error))\n this[UNZIP].on('end', () => {\n this[ENDED] = true\n this[CONSUMECHUNK]()\n })\n this[WRITING] = true\n const ret = !!this[UNZIP][ended ? 'end' : 'write'](chunk)\n this[WRITING] = false\n cb?.()\n return ret\n }\n }\n\n this[WRITING] = true\n if (this[UNZIP]) {\n this[UNZIP].write(chunk)\n } else {\n this[CONSUMECHUNK](chunk)\n }\n this[WRITING] = false\n\n // return false if there's a queue, or if the current entry isn't flowing\n const ret =\n this[QUEUE].length ? false\n : this[READENTRY] ? this[READENTRY].flowing\n : true\n\n // if we have no queue, then that means a clogged READENTRY\n if (!ret && !this[QUEUE].length) {\n this[READENTRY]?.once('drain', () => this.emit('drain'))\n }\n\n /* c8 ignore next */\n cb?.()\n return ret\n }\n\n [BUFFERCONCAT](c: Buffer) {\n if (c && !this[ABORTED]) {\n this[BUFFER] =\n this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c\n }\n }\n\n [MAYBEEND]() {\n if (\n this[ENDED] &&\n !this[EMITTEDEND] &&\n !this[ABORTED] &&\n !this[CONSUMING]\n ) {\n this[EMITTEDEND] = true\n const entry = this[WRITEENTRY]\n if (entry && entry.blockRemain) {\n // truncated, likely a damaged file\n const have = this[BUFFER] ? this[BUFFER].length : 0\n this.warn(\n 'TAR_BAD_ARCHIVE',\n `Truncated input (needed ${entry.blockRemain} more bytes, only ${have} available)`,\n { entry },\n )\n if (this[BUFFER]) {\n entry.write(this[BUFFER])\n }\n entry.end()\n }\n this[EMIT](DONE)\n }\n }\n\n [CONSUMECHUNK](chunk?: Buffer) {\n if (this[CONSUMING] && chunk) {\n this[BUFFERCONCAT](chunk)\n } else if (!chunk && !this[BUFFER]) {\n this[MAYBEEND]()\n } else if (chunk) {\n this[CONSUMING] = true\n if (this[BUFFER]) {\n this[BUFFERCONCAT](chunk)\n const c = this[BUFFER]\n this[BUFFER] = undefined\n this[CONSUMECHUNKSUB](c)\n } else {\n this[CONSUMECHUNKSUB](chunk)\n }\n\n while (\n this[BUFFER] &&\n (this[BUFFER] as Buffer)?.length >= 512 &&\n !this[ABORTED] &&\n !this[SAW_EOF]\n ) {\n const c = this[BUFFER]\n this[BUFFER] = undefined\n this[CONSUMECHUNKSUB](c)\n }\n this[CONSUMING] = false\n }\n\n if (!this[BUFFER] || this[ENDED]) {\n this[MAYBEEND]()\n }\n }\n\n [CONSUMECHUNKSUB](chunk: Buffer) {\n // we know that we are in CONSUMING mode, so anything written goes into\n // the buffer. Advance the position and put any remainder in the buffer.\n let position = 0\n const length = chunk.length\n while (\n position + 512 <= length &&\n !this[ABORTED] &&\n !this[SAW_EOF]\n ) {\n switch (this[STATE]) {\n case 'begin':\n case 'header':\n this[CONSUMEHEADER](chunk, position)\n position += 512\n break\n\n case 'ignore':\n case 'body':\n position += this[CONSUMEBODY](chunk, position)\n break\n\n case 'meta':\n position += this[CONSUMEMETA](chunk, position)\n break\n\n /* c8 ignore start */\n default:\n throw new Error('invalid state: ' + this[STATE])\n /* c8 ignore stop */\n }\n }\n\n if (position < length) {\n if (this[BUFFER]) {\n this[BUFFER] = Buffer.concat([\n chunk.subarray(position),\n this[BUFFER],\n ])\n } else {\n this[BUFFER] = chunk.subarray(position)\n }\n }\n }\n\n end(cb?: () => void): this\n end(data: string | Buffer, cb?: () => void): this\n end(str: string, encoding?: BufferEncoding, cb?: () => void): this\n end(\n chunk?: string | Buffer | (() => void),\n encoding?: BufferEncoding | (() => void),\n cb?: () => void,\n ) {\n if (typeof chunk === 'function') {\n cb = chunk\n encoding = undefined\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding)\n }\n if (cb) this.once('finish', cb)\n if (!this[ABORTED]) {\n if (this[UNZIP]) {\n /* c8 ignore start */\n if (chunk) this[UNZIP].write(chunk)\n /* c8 ignore stop */\n this[UNZIP].end()\n } else {\n this[ENDED] = true\n if (this.brotli === undefined || this.zstd === undefined)\n chunk = chunk || Buffer.alloc(0)\n if (chunk) this.write(chunk)\n this[MAYBEEND]()\n }\n }\n return this\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/path-reservations.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/path-reservations.d.ts new file mode 100644 index 0000000..44f0482 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/path-reservations.d.ts @@ -0,0 +1,11 @@ +export type Reservation = { + paths: string[]; + dirs: Set; +}; +export type Handler = (clear: () => void) => void; +export declare class PathReservations { + #private; + reserve(paths: string[], fn: Handler): boolean; + check(fn: Handler): boolean; +} +//# sourceMappingURL=path-reservations.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/path-reservations.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/path-reservations.d.ts.map new file mode 100644 index 0000000..8ea77e5 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/path-reservations.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"path-reservations.d.ts","sourceRoot":"","sources":["../../src/path-reservations.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;AAmBjD,qBAAa,gBAAgB;;IAY3B,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO;IA8DpC,KAAK,CAAC,EAAE,EAAE,OAAO;CA8ElB"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/path-reservations.js b/node_modules/cmake-js/node_modules/tar/dist/esm/path-reservations.js new file mode 100644 index 0000000..f7535c1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/path-reservations.js @@ -0,0 +1,166 @@ +// A path exclusive reservation system +// reserve([list, of, paths], fn) +// When the fn is first in line for all its paths, it +// is called with a cb that clears the reservation. +// +// Used by async unpack to avoid clobbering paths in use, +// while still allowing maximal safe parallelization. +import { join } from 'node:path'; +import { normalizeUnicode } from './normalize-unicode.js'; +import { stripTrailingSlashes } from './strip-trailing-slashes.js'; +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; +const isWindows = platform === 'win32'; +// return a set of parent dirs for a given path +// '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d'] +const getDirs = (path) => { + const dirs = path + .split('/') + .slice(0, -1) + .reduce((set, path) => { + const s = set[set.length - 1]; + if (s !== undefined) { + path = join(s, path); + } + set.push(path || '/'); + return set; + }, []); + return dirs; +}; +export class PathReservations { + // path => [function or Set] + // A Set object means a directory reservation + // A fn is a direct reservation on that path + #queues = new Map(); + // fn => {paths:[path,...], dirs:[path, ...]} + #reservations = new Map(); + // functions currently running + #running = new Set(); + reserve(paths, fn) { + paths = + isWindows ? + ['win32 parallelization disabled'] + : paths.map(p => { + // don't need normPath, because we skip this entirely for windows + return stripTrailingSlashes(join(normalizeUnicode(p))); + }); + const dirs = new Set(paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b))); + this.#reservations.set(fn, { dirs, paths }); + for (const p of paths) { + const q = this.#queues.get(p); + if (!q) { + this.#queues.set(p, [fn]); + } + else { + q.push(fn); + } + } + for (const dir of dirs) { + const q = this.#queues.get(dir); + if (!q) { + this.#queues.set(dir, [new Set([fn])]); + } + else { + const l = q[q.length - 1]; + if (l instanceof Set) { + l.add(fn); + } + else { + q.push(new Set([fn])); + } + } + } + return this.#run(fn); + } + // return the queues for each path the function cares about + // fn => {paths, dirs} + #getQueues(fn) { + const res = this.#reservations.get(fn); + /* c8 ignore start */ + if (!res) { + throw new Error('function does not have any path reservations'); + } + /* c8 ignore stop */ + return { + paths: res.paths.map((path) => this.#queues.get(path)), + dirs: [...res.dirs].map(path => this.#queues.get(path)), + }; + } + // check if fn is first in line for all its paths, and is + // included in the first set for all its dir queues + check(fn) { + const { paths, dirs } = this.#getQueues(fn); + return (paths.every(q => q && q[0] === fn) && + dirs.every(q => q && q[0] instanceof Set && q[0].has(fn))); + } + // run the function if it's first in line and not already running + #run(fn) { + if (this.#running.has(fn) || !this.check(fn)) { + return false; + } + this.#running.add(fn); + fn(() => this.#clear(fn)); + return true; + } + #clear(fn) { + if (!this.#running.has(fn)) { + return false; + } + const res = this.#reservations.get(fn); + /* c8 ignore start */ + if (!res) { + throw new Error('invalid reservation'); + } + /* c8 ignore stop */ + const { paths, dirs } = res; + const next = new Set(); + for (const path of paths) { + const q = this.#queues.get(path); + /* c8 ignore start */ + if (!q || q?.[0] !== fn) { + continue; + } + /* c8 ignore stop */ + const q0 = q[1]; + if (!q0) { + this.#queues.delete(path); + continue; + } + q.shift(); + if (typeof q0 === 'function') { + next.add(q0); + } + else { + for (const f of q0) { + next.add(f); + } + } + } + for (const dir of dirs) { + const q = this.#queues.get(dir); + const q0 = q?.[0]; + /* c8 ignore next - type safety only */ + if (!q || !(q0 instanceof Set)) + continue; + if (q0.size === 1 && q.length === 1) { + this.#queues.delete(dir); + continue; + } + else if (q0.size === 1) { + q.shift(); + // next one must be a function, + // or else the Set would've been reused + const n = q[0]; + if (typeof n === 'function') { + next.add(n); + } + } + else { + q0.delete(fn); + } + } + this.#running.delete(fn); + next.forEach(fn => this.#run(fn)); + return true; + } +} +//# sourceMappingURL=path-reservations.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/path-reservations.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/path-reservations.js.map new file mode 100644 index 0000000..ad6df1f --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/path-reservations.js.map @@ -0,0 +1 @@ +{"version":3,"file":"path-reservations.js","sourceRoot":"","sources":["../../src/path-reservations.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AACjC,qDAAqD;AACrD,mDAAmD;AACnD,EAAE;AACF,yDAAyD;AACzD,qDAAqD;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAElE,MAAM,QAAQ,GACZ,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,OAAO,CAAC,QAAQ,CAAA;AAC3D,MAAM,SAAS,GAAG,QAAQ,KAAK,OAAO,CAAA;AAStC,+CAA+C;AAC/C,0DAA0D;AAC1D,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,EAAE;IAC/B,MAAM,IAAI,GAAG,IAAI;SACd,KAAK,CAAC,GAAG,CAAC;SACV,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACZ,MAAM,CAAC,CAAC,GAAa,EAAE,IAAI,EAAE,EAAE;QAC9B,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;QAC7B,IA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CAAuC;YACvC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,YAAY,GAAG,CAAC;gBAAE,SAAQ;YACxC,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACpC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;gBACxB,SAAQ;YACV,CAAC;iBAAM,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;gBACzB,CAAC,CAAC,KAAK,EAAE,CAAA;gBACT,+BAA+B;gBAC/B,uCAAuC;gBACvC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;gBACd,IAAI,OAAO,CAAC,KAAK,UAAU,EAAE,CAAC;oBAC5B,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;gBACb,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;YACf,CAAC;QACH,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QACxB,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;QACjC,OAAO,IAAI,CAAA;IACb,CAAC;CACF","sourcesContent":["// A path exclusive reservation system\n// reserve([list, of, paths], fn)\n// When the fn is first in line for all its paths, it\n// is called with a cb that clears the reservation.\n//\n// Used by async unpack to avoid clobbering paths in use,\n// while still allowing maximal safe parallelization.\n\nimport { join } from 'node:path'\nimport { normalizeUnicode } from './normalize-unicode.js'\nimport { stripTrailingSlashes } from './strip-trailing-slashes.js'\n\nconst platform =\n process.env.TESTING_TAR_FAKE_PLATFORM || process.platform\nconst isWindows = platform === 'win32'\n\nexport type Reservation = {\n paths: string[]\n dirs: Set\n}\n\nexport type Handler = (clear: () => void) => void\n\n// return a set of parent dirs for a given path\n// '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d']\nconst getDirs = (path: string) => {\n const dirs = path\n .split('/')\n .slice(0, -1)\n .reduce((set: string[], path) => {\n const s = set[set.length - 1]\n if (s !== undefined) {\n path = join(s, path)\n }\n set.push(path || '/')\n return set\n }, [])\n return dirs\n}\n\nexport class PathReservations {\n // path => [function or Set]\n // A Set object means a directory reservation\n // A fn is a direct reservation on that path\n #queues = new Map)[]>()\n\n // fn => {paths:[path,...], dirs:[path, ...]}\n #reservations = new Map()\n\n // functions currently running\n #running = new Set()\n\n reserve(paths: string[], fn: Handler) {\n paths =\n isWindows ?\n ['win32 parallelization disabled']\n : paths.map(p => {\n // don't need normPath, because we skip this entirely for windows\n return stripTrailingSlashes(join(normalizeUnicode(p)))\n })\n\n const dirs = new Set(\n paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b)),\n )\n this.#reservations.set(fn, { dirs, paths })\n for (const p of paths) {\n const q = this.#queues.get(p)\n if (!q) {\n this.#queues.set(p, [fn])\n } else {\n q.push(fn)\n }\n }\n for (const dir of dirs) {\n const q = this.#queues.get(dir)\n if (!q) {\n this.#queues.set(dir, [new Set([fn])])\n } else {\n const l = q[q.length - 1]\n if (l instanceof Set) {\n l.add(fn)\n } else {\n q.push(new Set([fn]))\n }\n }\n }\n return this.#run(fn)\n }\n\n // return the queues for each path the function cares about\n // fn => {paths, dirs}\n #getQueues(fn: Handler): {\n paths: Handler[][]\n dirs: (Handler | Set)[][]\n } {\n const res = this.#reservations.get(fn)\n /* c8 ignore start */\n if (!res) {\n throw new Error('function does not have any path reservations')\n }\n /* c8 ignore stop */\n return {\n paths: res.paths.map((path: string) =>\n this.#queues.get(path),\n ) as Handler[][],\n dirs: [...res.dirs].map(path => this.#queues.get(path)) as (\n | Handler\n | Set\n )[][],\n }\n }\n\n // check if fn is first in line for all its paths, and is\n // included in the first set for all its dir queues\n check(fn: Handler) {\n const { paths, dirs } = this.#getQueues(fn)\n return (\n paths.every(q => q && q[0] === fn) &&\n dirs.every(q => q && q[0] instanceof Set && q[0].has(fn))\n )\n }\n\n // run the function if it's first in line and not already running\n #run(fn: Handler) {\n if (this.#running.has(fn) || !this.check(fn)) {\n return false\n }\n this.#running.add(fn)\n fn(() => this.#clear(fn))\n return true\n }\n\n #clear(fn: Handler) {\n if (!this.#running.has(fn)) {\n return false\n }\n const res = this.#reservations.get(fn)\n /* c8 ignore start */\n if (!res) {\n throw new Error('invalid reservation')\n }\n /* c8 ignore stop */\n const { paths, dirs } = res\n\n const next = new Set()\n for (const path of paths) {\n const q = this.#queues.get(path)\n /* c8 ignore start */\n if (!q || q?.[0] !== fn) {\n continue\n }\n /* c8 ignore stop */\n const q0 = q[1]\n if (!q0) {\n this.#queues.delete(path)\n continue\n }\n q.shift()\n if (typeof q0 === 'function') {\n next.add(q0)\n } else {\n for (const f of q0) {\n next.add(f)\n }\n }\n }\n\n for (const dir of dirs) {\n const q = this.#queues.get(dir)\n const q0 = q?.[0]\n /* c8 ignore next - type safety only */\n if (!q || !(q0 instanceof Set)) continue\n if (q0.size === 1 && q.length === 1) {\n this.#queues.delete(dir)\n continue\n } else if (q0.size === 1) {\n q.shift()\n // next one must be a function,\n // or else the Set would've been reused\n const n = q[0]\n if (typeof n === 'function') {\n next.add(n)\n }\n } else {\n q0.delete(fn)\n }\n }\n\n this.#running.delete(fn)\n next.forEach(fn => this.#run(fn))\n return true\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/pax.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/pax.d.ts new file mode 100644 index 0000000..d932279 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/pax.d.ts @@ -0,0 +1,26 @@ +import { HeaderData } from './header.js'; +export declare class Pax implements HeaderData { + atime?: Date; + mtime?: Date; + ctime?: Date; + charset?: string; + comment?: string; + gid?: number; + uid?: number; + gname?: string; + uname?: string; + linkpath?: string; + dev?: number; + ino?: number; + nlink?: number; + path?: string; + size?: number; + mode?: number; + global: boolean; + constructor(obj: HeaderData, global?: boolean); + encode(): Buffer; + encodeBody(): string; + encodeField(field: keyof Pax): string; + static parse(str: string, ex?: HeaderData, g?: boolean): Pax; +} +//# sourceMappingURL=pax.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/pax.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/pax.d.ts.map new file mode 100644 index 0000000..da78f0a --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/pax.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pax.d.ts","sourceRoot":"","sources":["../../src/pax.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,UAAU,EAAE,MAAM,aAAa,CAAA;AAEhD,qBAAa,GAAI,YAAW,UAAU;IACpC,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,KAAK,CAAC,EAAE,IAAI,CAAA;IAEZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,MAAM,EAAE,OAAO,CAAA;gBAEH,GAAG,EAAE,UAAU,EAAE,MAAM,GAAE,OAAe;IAmBpD,MAAM;IAiDN,UAAU;IAoBV,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,MAAM;IA2BrC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,GAAE,OAAe;CAG9D"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/pax.js b/node_modules/cmake-js/node_modules/tar/dist/esm/pax.js new file mode 100644 index 0000000..832808f --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/pax.js @@ -0,0 +1,154 @@ +import { basename } from 'node:path'; +import { Header } from './header.js'; +export class Pax { + atime; + mtime; + ctime; + charset; + comment; + gid; + uid; + gname; + uname; + linkpath; + dev; + ino; + nlink; + path; + size; + mode; + global; + constructor(obj, global = false) { + this.atime = obj.atime; + this.charset = obj.charset; + this.comment = obj.comment; + this.ctime = obj.ctime; + this.dev = obj.dev; + this.gid = obj.gid; + this.global = global; + this.gname = obj.gname; + this.ino = obj.ino; + this.linkpath = obj.linkpath; + this.mtime = obj.mtime; + this.nlink = obj.nlink; + this.path = obj.path; + this.size = obj.size; + this.uid = obj.uid; + this.uname = obj.uname; + } + encode() { + const body = this.encodeBody(); + if (body === '') { + return Buffer.allocUnsafe(0); + } + const bodyLen = Buffer.byteLength(body); + // round up to 512 bytes + // add 512 for header + const bufLen = 512 * Math.ceil(1 + bodyLen / 512); + const buf = Buffer.allocUnsafe(bufLen); + // 0-fill the header section, it might not hit every field + for (let i = 0; i < 512; i++) { + buf[i] = 0; + } + new Header({ + // XXX split the path + // then the path should be PaxHeader + basename, but less than 99, + // prepend with the dirname + /* c8 ignore start */ + path: ('PaxHeader/' + basename(this.path ?? '')).slice(0, 99), + /* c8 ignore stop */ + mode: this.mode || 0o644, + uid: this.uid, + gid: this.gid, + size: bodyLen, + mtime: this.mtime, + type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader', + linkpath: '', + uname: this.uname || '', + gname: this.gname || '', + devmaj: 0, + devmin: 0, + atime: this.atime, + ctime: this.ctime, + }).encode(buf); + buf.write(body, 512, bodyLen, 'utf8'); + // null pad after the body + for (let i = bodyLen + 512; i < buf.length; i++) { + buf[i] = 0; + } + return buf; + } + encodeBody() { + return (this.encodeField('path') + + this.encodeField('ctime') + + this.encodeField('atime') + + this.encodeField('dev') + + this.encodeField('ino') + + this.encodeField('nlink') + + this.encodeField('charset') + + this.encodeField('comment') + + this.encodeField('gid') + + this.encodeField('gname') + + this.encodeField('linkpath') + + this.encodeField('mtime') + + this.encodeField('size') + + this.encodeField('uid') + + this.encodeField('uname')); + } + encodeField(field) { + if (this[field] === undefined) { + return ''; + } + const r = this[field]; + const v = r instanceof Date ? r.getTime() / 1000 : r; + const s = ' ' + + (field === 'dev' || field === 'ino' || field === 'nlink' ? + 'SCHILY.' + : '') + + field + + '=' + + v + + '\n'; + const byteLen = Buffer.byteLength(s); + // the digits includes the length of the digits in ascii base-10 + // so if it's 9 characters, then adding 1 for the 9 makes it 10 + // which makes it 11 chars. + let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1; + if (byteLen + digits >= Math.pow(10, digits)) { + digits += 1; + } + const len = digits + byteLen; + return len + s; + } + static parse(str, ex, g = false) { + return new Pax(merge(parseKV(str), ex), g); + } +} +const merge = (a, b) => b ? Object.assign({}, b, a) : a; +const parseKV = (str) => str + .replace(/\n$/, '') + .split('\n') + .reduce(parseKVLine, Object.create(null)); +const parseKVLine = (set, line) => { + const n = parseInt(line, 10); + // XXX Values with \n in them will fail this. + // Refactor to not be a naive line-by-line parse. + if (n !== Buffer.byteLength(line) + 1) { + return set; + } + line = line.slice((n + ' ').length); + const kv = line.split('='); + const r = kv.shift(); + if (!r) { + return set; + } + const k = r.replace(/^SCHILY\.(dev|ino|nlink)/, '$1'); + const v = kv.join('='); + set[k] = + /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k) ? + new Date(Number(v) * 1000) + : /^[0-9]+$/.test(v) ? +v + : v; + return set; +}; +//# sourceMappingURL=pax.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/pax.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/pax.js.map new file mode 100644 index 0000000..ae71361 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/pax.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pax.js","sourceRoot":"","sources":["../../src/pax.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,MAAM,EAAc,MAAM,aAAa,CAAA;AAEhD,MAAM,OAAO,GAAG;IACd,KAAK,CAAO;IACZ,KAAK,CAAO;IACZ,KAAK,CAAO;IAEZ,OAAO,CAAS;IAChB,OAAO,CAAS;IAEhB,GAAG,CAAS;IACZ,GAAG,CAAS;IAEZ,KAAK,CAAS;IACd,KAAK,CAAS;IACd,QAAQ,CAAS;IACjB,GAAG,CAAS;IACZ,GAAG,CAAS;IACZ,KAAK,CAAS;IACd,IAAI,CAAS;IACb,IAAI,CAAS;IACb,IAAI,CAAS;IAEb,MAAM,CAAS;IAEf,YAAY,GAAe,EAAE,SAAkB,KAAK;QAClD,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAA;QAC1B,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAA;QAC1B,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAA;QACtB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAA;QAClB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAA;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAA;QACtB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAA;QAClB,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAA;QAC5B,IAAI,CAA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AI,CAAC,CAAA;IAErD,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACtB,GAAG,CAAC,CAAC,CAAC;QACJ,yCAAyC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACjD,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;YAC5B,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACzB,CAAC,CAAC,CAAC,CAAA;IACL,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA","sourcesContent":["import { basename } from 'node:path'\nimport { Header, HeaderData } from './header.js'\n\nexport class Pax implements HeaderData {\n atime?: Date\n mtime?: Date\n ctime?: Date\n\n charset?: string\n comment?: string\n\n gid?: number\n uid?: number\n\n gname?: string\n uname?: string\n linkpath?: string\n dev?: number\n ino?: number\n nlink?: number\n path?: string\n size?: number\n mode?: number\n\n global: boolean\n\n constructor(obj: HeaderData, global: boolean = false) {\n this.atime = obj.atime\n this.charset = obj.charset\n this.comment = obj.comment\n this.ctime = obj.ctime\n this.dev = obj.dev\n this.gid = obj.gid\n this.global = global\n this.gname = obj.gname\n this.ino = obj.ino\n this.linkpath = obj.linkpath\n this.mtime = obj.mtime\n this.nlink = obj.nlink\n this.path = obj.path\n this.size = obj.size\n this.uid = obj.uid\n this.uname = obj.uname\n }\n\n encode() {\n const body = this.encodeBody()\n if (body === '') {\n return Buffer.allocUnsafe(0)\n }\n\n const bodyLen = Buffer.byteLength(body)\n // round up to 512 bytes\n // add 512 for header\n const bufLen = 512 * Math.ceil(1 + bodyLen / 512)\n const buf = Buffer.allocUnsafe(bufLen)\n\n // 0-fill the header section, it might not hit every field\n for (let i = 0; i < 512; i++) {\n buf[i] = 0\n }\n\n new Header({\n // XXX split the path\n // then the path should be PaxHeader + basename, but less than 99,\n // prepend with the dirname\n /* c8 ignore start */\n path: ('PaxHeader/' + basename(this.path ?? '')).slice(0, 99),\n /* c8 ignore stop */\n mode: this.mode || 0o644,\n uid: this.uid,\n gid: this.gid,\n size: bodyLen,\n mtime: this.mtime,\n type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader',\n linkpath: '',\n uname: this.uname || '',\n gname: this.gname || '',\n devmaj: 0,\n devmin: 0,\n atime: this.atime,\n ctime: this.ctime,\n }).encode(buf)\n\n buf.write(body, 512, bodyLen, 'utf8')\n\n // null pad after the body\n for (let i = bodyLen + 512; i < buf.length; i++) {\n buf[i] = 0\n }\n\n return buf\n }\n\n encodeBody() {\n return (\n this.encodeField('path') +\n this.encodeField('ctime') +\n this.encodeField('atime') +\n this.encodeField('dev') +\n this.encodeField('ino') +\n this.encodeField('nlink') +\n this.encodeField('charset') +\n this.encodeField('comment') +\n this.encodeField('gid') +\n this.encodeField('gname') +\n this.encodeField('linkpath') +\n this.encodeField('mtime') +\n this.encodeField('size') +\n this.encodeField('uid') +\n this.encodeField('uname')\n )\n }\n\n encodeField(field: keyof Pax): string {\n if (this[field] === undefined) {\n return ''\n }\n const r = this[field]\n const v = r instanceof Date ? r.getTime() / 1000 : r\n const s =\n ' ' +\n (field === 'dev' || field === 'ino' || field === 'nlink' ?\n 'SCHILY.'\n : '') +\n field +\n '=' +\n v +\n '\\n'\n const byteLen = Buffer.byteLength(s)\n // the digits includes the length of the digits in ascii base-10\n // so if it's 9 characters, then adding 1 for the 9 makes it 10\n // which makes it 11 chars.\n let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1\n if (byteLen + digits >= Math.pow(10, digits)) {\n digits += 1\n }\n const len = digits + byteLen\n return len + s\n }\n\n static parse(str: string, ex?: HeaderData, g: boolean = false) {\n return new Pax(merge(parseKV(str), ex), g)\n }\n}\n\nconst merge = (a: HeaderData, b?: HeaderData) =>\n b ? Object.assign({}, b, a) : a\n\nconst parseKV = (str: string) =>\n str\n .replace(/\\n$/, '')\n .split('\\n')\n .reduce(parseKVLine, Object.create(null))\n\nconst parseKVLine = (set: Record, line: string) => {\n const n = parseInt(line, 10)\n\n // XXX Values with \\n in them will fail this.\n // Refactor to not be a naive line-by-line parse.\n if (n !== Buffer.byteLength(line) + 1) {\n return set\n }\n\n line = line.slice((n + ' ').length)\n const kv = line.split('=')\n const r = kv.shift()\n\n if (!r) {\n return set\n }\n\n const k = r.replace(/^SCHILY\\.(dev|ino|nlink)/, '$1')\n\n const v = kv.join('=')\n set[k] =\n /^([A-Z]+\\.)?([mac]|birth|creation)time$/.test(k) ?\n new Date(Number(v) * 1000)\n : /^[0-9]+$/.test(v) ? +v\n : v\n return set\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/process-umask.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/process-umask.d.ts new file mode 100644 index 0000000..abde1b6 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/process-umask.d.ts @@ -0,0 +1,2 @@ +export declare const umask: () => number; +//# sourceMappingURL=process-umask.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/process-umask.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/process-umask.d.ts.map new file mode 100644 index 0000000..96a5385 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/process-umask.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"process-umask.d.ts","sourceRoot":"","sources":["../../src/process-umask.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,KAAK,cAAwB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/process-umask.js b/node_modules/cmake-js/node_modules/tar/dist/esm/process-umask.js new file mode 100644 index 0000000..c6748e2 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/process-umask.js @@ -0,0 +1,3 @@ +// separate file so I stop getting nagged in vim about deprecated API. +export const umask = () => process.umask(); +//# sourceMappingURL=process-umask.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/process-umask.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/process-umask.js.map new file mode 100644 index 0000000..1bde0d8 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/process-umask.js.map @@ -0,0 +1 @@ +{"version":3,"file":"process-umask.js","sourceRoot":"","sources":["../../src/process-umask.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA","sourcesContent":["// separate file so I stop getting nagged in vim about deprecated API.\nexport const umask = () => process.umask()\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/read-entry.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/read-entry.d.ts new file mode 100644 index 0000000..11b882b --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/read-entry.d.ts @@ -0,0 +1,36 @@ +import { Minipass } from 'minipass'; +import { Header } from './header.js'; +import { Pax } from './pax.js'; +import { EntryTypeName } from './types.js'; +export declare class ReadEntry extends Minipass { + #private; + extended?: Pax; + globalExtended?: Pax; + header: Header; + startBlockSize: number; + blockRemain: number; + remain: number; + type: EntryTypeName; + meta: boolean; + ignore: boolean; + path: string; + mode?: number; + uid?: number; + gid?: number; + uname?: string; + gname?: string; + size: number; + mtime?: Date; + atime?: Date; + ctime?: Date; + linkpath?: string; + dev?: number; + ino?: number; + nlink?: number; + invalid: boolean; + absolute?: string; + unsupported: boolean; + constructor(header: Header, ex?: Pax, gex?: Pax); + write(data: Buffer): boolean; +} +//# sourceMappingURL=read-entry.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/read-entry.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/read-entry.d.ts.map new file mode 100644 index 0000000..4f16a84 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/read-entry.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"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AAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG;IA+E/C,KAAK,CAAC,IAAI,EAAE,MAAM;CAyCnB"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/read-entry.js b/node_modules/cmake-js/node_modules/tar/dist/esm/read-entry.js new file mode 100644 index 0000000..23cc673 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/read-entry.js @@ -0,0 +1,136 @@ +import { Minipass } from 'minipass'; +import { normalizeWindowsPath } from './normalize-windows-path.js'; +export class ReadEntry extends Minipass { + extended; + globalExtended; + header; + startBlockSize; + blockRemain; + remain; + type; + meta = false; + ignore = false; + path; + mode; + uid; + gid; + uname; + gname; + size = 0; + mtime; + atime; + ctime; + linkpath; + dev; + ino; + nlink; + invalid = false; + absolute; + unsupported = false; + constructor(header, ex, gex) { + super({}); + // read entries always start life paused. this is to avoid the + // situation where Minipass's auto-ending empty streams results + // in an entry ending before we're ready for it. + this.pause(); + this.extended = ex; + this.globalExtended = gex; + this.header = header; + /* c8 ignore start */ + this.remain = header.size ?? 0; + /* c8 ignore stop */ + this.startBlockSize = 512 * Math.ceil(this.remain / 512); + this.blockRemain = this.startBlockSize; + this.type = header.type; + switch (this.type) { + case 'File': + case 'OldFile': + case 'Link': + case 'SymbolicLink': + case 'CharacterDevice': + case 'BlockDevice': + case 'Directory': + case 'FIFO': + case 'ContiguousFile': + case 'GNUDumpDir': + break; + case 'NextFileHasLongLinkpath': + case 'NextFileHasLongPath': + case 'OldGnuLongPath': + case 'GlobalExtendedHeader': + case 'ExtendedHeader': + case 'OldExtendedHeader': + this.meta = true; + break; + // NOTE: gnutar and bsdtar treat unrecognized types as 'File' + // it may be worth doing the same, but with a warning. + default: + this.ignore = true; + } + /* c8 ignore start */ + if (!header.path) { + throw new Error('no path provided for tar.ReadEntry'); + } + /* c8 ignore stop */ + this.path = normalizeWindowsPath(header.path); + this.mode = header.mode; + if (this.mode) { + this.mode = this.mode & 0o7777; + } + this.uid = header.uid; + this.gid = header.gid; + this.uname = header.uname; + this.gname = header.gname; + this.size = this.remain; + this.mtime = header.mtime; + this.atime = header.atime; + this.ctime = header.ctime; + /* c8 ignore start */ + this.linkpath = + header.linkpath ? + normalizeWindowsPath(header.linkpath) + : undefined; + /* c8 ignore stop */ + this.uname = header.uname; + this.gname = header.gname; + if (ex) { + this.#slurp(ex); + } + if (gex) { + this.#slurp(gex, true); + } + } + write(data) { + const writeLen = data.length; + if (writeLen > this.blockRemain) { + throw new Error('writing more to entry than is appropriate'); + } + const r = this.remain; + const br = this.blockRemain; + this.remain = Math.max(0, r - writeLen); + this.blockRemain = Math.max(0, br - writeLen); + if (this.ignore) { + return true; + } + if (r >= writeLen) { + return super.write(data); + } + // r < writeLen + return super.write(data.subarray(0, r)); + } + #slurp(ex, gex = false) { + if (ex.path) + ex.path = normalizeWindowsPath(ex.path); + if (ex.linkpath) + ex.linkpath = normalizeWindowsPath(ex.linkpath); + Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => { + // we slurp in everything except for the path attribute in + // a global extended header, because that's weird. Also, any + // null/undefined values are ignored. + return !(v === null || + v === undefined || + (k === 'path' && gex)); + }))); + } +} +//# sourceMappingURL=read-entry.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/read-entry.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/read-entry.js.map new file mode 100644 index 0000000..f704154 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/read-entry.js.map @@ -0,0 +1 @@ +{"version":3,"file":"read-entry.js","sourceRoot":"","sources":["../../src/read-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAIlE,MAAM,OAAO,SAAU,SAAQ,QAAwB;IACrD,QAAQ,CAAM;IACd,cAAc,CAAM;IACpB,MAAM,CAAQ;IACd,cAAc,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AAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IACzC,CAAC;IAED,MAAM,CAAC,EAAO,EAAE,MAAe,KAAK;QAClC,IAAI,EAAE,CAAC,IAAI;YAAE,EAAE,CAAC,IAAI,GAAG,oBAAoB,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;QACpD,IAAI,EAAE,CAAC,QAAQ;YAAE,EAAE,CAAC,QAAQ,GAAG,oBAAoB,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAA;QAChE,MAAM,CAAC,MAAM,CACX,IAAI,EACJ,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE;YACnC,0DAA0D;YAC1D,4DAA4D;YAC5D,qCAAqC;YACrC,OAAO,CAAC,CACN,CAAC,KAAK,IAAI;gBACV,CAAC,KAAK,SAAS;gBACf,CAAC,CAAC,KAAK,MAAM,IAAI,GAAG,CAAC,CACtB,CAAA;QACH,CAAC,CAAC,CACH,CACF,CAAA;IACH,CAAC;CACF","sourcesContent":["import { Minipass } from 'minipass'\nimport { Header } from './header.js'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport { Pax } from './pax.js'\nimport { EntryTypeName } from './types.js'\n\nexport class ReadEntry extends Minipass {\n extended?: Pax\n globalExtended?: Pax\n header: Header\n startBlockSize: number\n blockRemain: number\n remain: number\n type: EntryTypeName\n meta: boolean = false\n ignore: boolean = false\n path: string\n mode?: number\n uid?: number\n gid?: number\n uname?: string\n gname?: string\n size: number = 0\n mtime?: Date\n atime?: Date\n ctime?: Date\n linkpath?: string\n\n dev?: number\n ino?: number\n nlink?: number\n invalid: boolean = false\n absolute?: string\n unsupported: boolean = false\n\n constructor(header: Header, ex?: Pax, gex?: Pax) {\n super({})\n // read entries always start life paused. this is to avoid the\n // situation where Minipass's auto-ending empty streams results\n // in an entry ending before we're ready for it.\n this.pause()\n this.extended = ex\n this.globalExtended = gex\n this.header = header\n /* c8 ignore start */\n this.remain = header.size ?? 0\n /* c8 ignore stop */\n this.startBlockSize = 512 * Math.ceil(this.remain / 512)\n this.blockRemain = this.startBlockSize\n this.type = header.type\n switch (this.type) {\n case 'File':\n case 'OldFile':\n case 'Link':\n case 'SymbolicLink':\n case 'CharacterDevice':\n case 'BlockDevice':\n case 'Directory':\n case 'FIFO':\n case 'ContiguousFile':\n case 'GNUDumpDir':\n break\n\n case 'NextFileHasLongLinkpath':\n case 'NextFileHasLongPath':\n case 'OldGnuLongPath':\n case 'GlobalExtendedHeader':\n case 'ExtendedHeader':\n case 'OldExtendedHeader':\n this.meta = true\n break\n\n // NOTE: gnutar and bsdtar treat unrecognized types as 'File'\n // it may be worth doing the same, but with a warning.\n default:\n this.ignore = true\n }\n\n /* c8 ignore start */\n if (!header.path) {\n throw new Error('no path provided for tar.ReadEntry')\n }\n /* c8 ignore stop */\n\n this.path = normalizeWindowsPath(header.path) as string\n this.mode = header.mode\n if (this.mode) {\n this.mode = this.mode & 0o7777\n }\n this.uid = header.uid\n this.gid = header.gid\n this.uname = header.uname\n this.gname = header.gname\n this.size = this.remain\n this.mtime = header.mtime\n this.atime = header.atime\n this.ctime = header.ctime\n /* c8 ignore start */\n this.linkpath =\n header.linkpath ?\n normalizeWindowsPath(header.linkpath)\n : undefined\n /* c8 ignore stop */\n this.uname = header.uname\n this.gname = header.gname\n\n if (ex) {\n this.#slurp(ex)\n }\n if (gex) {\n this.#slurp(gex, true)\n }\n }\n\n write(data: Buffer) {\n const writeLen = data.length\n if (writeLen > this.blockRemain) {\n throw new Error('writing more to entry than is appropriate')\n }\n\n const r = this.remain\n const br = this.blockRemain\n this.remain = Math.max(0, r - writeLen)\n this.blockRemain = Math.max(0, br - writeLen)\n if (this.ignore) {\n return true\n }\n\n if (r >= writeLen) {\n return super.write(data)\n }\n\n // r < writeLen\n return super.write(data.subarray(0, r))\n }\n\n #slurp(ex: Pax, gex: boolean = false) {\n if (ex.path) ex.path = normalizeWindowsPath(ex.path)\n if (ex.linkpath) ex.linkpath = normalizeWindowsPath(ex.linkpath)\n Object.assign(\n this,\n Object.fromEntries(\n Object.entries(ex).filter(([k, v]) => {\n // we slurp in everything except for the path attribute in\n // a global extended header, because that's weird. Also, any\n // null/undefined values are ignored.\n return !(\n v === null ||\n v === undefined ||\n (k === 'path' && gex)\n )\n }),\n ),\n )\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/replace.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/replace.d.ts new file mode 100644 index 0000000..8ae4035 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/replace.d.ts @@ -0,0 +1,2 @@ +export declare const replace: import("./make-command.js").TarCommand; +//# sourceMappingURL=replace.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/replace.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/replace.d.ts.map new file mode 100644 index 0000000..24d29cd --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/replace.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"replace.d.ts","sourceRoot":"","sources":["../../src/replace.ts"],"names":[],"mappings":"AA6QA,eAAO,MAAM,OAAO,sDA8BnB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/replace.js b/node_modules/cmake-js/node_modules/tar/dist/esm/replace.js new file mode 100644 index 0000000..214aa92 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/replace.js @@ -0,0 +1,226 @@ +// tar -r +import { WriteStream, WriteStreamSync } from '@isaacs/fs-minipass'; +import fs from 'node:fs'; +import path from 'node:path'; +import { Header } from './header.js'; +import { list } from './list.js'; +import { makeCommand } from './make-command.js'; +import { isFile, } from './options.js'; +import { Pack, PackSync } from './pack.js'; +// starting at the head of the file, read a Header +// If the checksum is invalid, that's our position to start writing +// If it is, jump forward by the specified size (round up to 512) +// and try again. +// Write the new Pack stream starting there. +const replaceSync = (opt, files) => { + const p = new PackSync(opt); + let threw = true; + let fd; + let position; + try { + try { + fd = fs.openSync(opt.file, 'r+'); + } + catch (er) { + if (er?.code === 'ENOENT') { + fd = fs.openSync(opt.file, 'w+'); + } + else { + throw er; + } + } + const st = fs.fstatSync(fd); + const headBuf = Buffer.alloc(512); + POSITION: for (position = 0; position < st.size; position += 512) { + for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) { + bytes = fs.readSync(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos); + if (position === 0 && + headBuf[0] === 0x1f && + headBuf[1] === 0x8b) { + throw new Error('cannot append to compressed archives'); + } + if (!bytes) { + break POSITION; + } + } + const h = new Header(headBuf); + if (!h.cksumValid) { + break; + } + const entryBlockSize = 512 * Math.ceil((h.size || 0) / 512); + if (position + entryBlockSize + 512 > st.size) { + break; + } + // the 512 for the header we just parsed will be added as well + // also jump ahead all the blocks for the body + position += entryBlockSize; + if (opt.mtimeCache && h.mtime) { + opt.mtimeCache.set(String(h.path), h.mtime); + } + } + threw = false; + streamSync(opt, p, position, fd, files); + } + finally { + if (threw) { + try { + fs.closeSync(fd); + } + catch (er) { } + } + } +}; +const streamSync = (opt, p, position, fd, files) => { + const stream = new WriteStreamSync(opt.file, { + fd: fd, + start: position, + }); + p.pipe(stream); + addFilesSync(p, files); +}; +const replaceAsync = (opt, files) => { + files = Array.from(files); + const p = new Pack(opt); + const getPos = (fd, size, cb_) => { + const cb = (er, pos) => { + if (er) { + fs.close(fd, _ => cb_(er)); + } + else { + cb_(null, pos); + } + }; + let position = 0; + if (size === 0) { + return cb(null, 0); + } + let bufPos = 0; + const headBuf = Buffer.alloc(512); + const onread = (er, bytes) => { + if (er || typeof bytes === 'undefined') { + return cb(er); + } + bufPos += bytes; + if (bufPos < 512 && bytes) { + return fs.read(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos, onread); + } + if (position === 0 && + headBuf[0] === 0x1f && + headBuf[1] === 0x8b) { + return cb(new Error('cannot append to compressed archives')); + } + // truncated header + if (bufPos < 512) { + return cb(null, position); + } + const h = new Header(headBuf); + if (!h.cksumValid) { + return cb(null, position); + } + /* c8 ignore next */ + const entryBlockSize = 512 * Math.ceil((h.size ?? 0) / 512); + if (position + entryBlockSize + 512 > size) { + return cb(null, position); + } + position += entryBlockSize + 512; + if (position >= size) { + return cb(null, position); + } + if (opt.mtimeCache && h.mtime) { + opt.mtimeCache.set(String(h.path), h.mtime); + } + bufPos = 0; + fs.read(fd, headBuf, 0, 512, position, onread); + }; + fs.read(fd, headBuf, 0, 512, position, onread); + }; + const promise = new Promise((resolve, reject) => { + p.on('error', reject); + let flag = 'r+'; + const onopen = (er, fd) => { + if (er && er.code === 'ENOENT' && flag === 'r+') { + flag = 'w+'; + return fs.open(opt.file, flag, onopen); + } + if (er || !fd) { + return reject(er); + } + fs.fstat(fd, (er, st) => { + if (er) { + return fs.close(fd, () => reject(er)); + } + getPos(fd, st.size, (er, position) => { + if (er) { + return reject(er); + } + const stream = new WriteStream(opt.file, { + fd: fd, + start: position, + }); + p.pipe(stream); + stream.on('error', reject); + stream.on('close', resolve); + addFilesAsync(p, files); + }); + }); + }; + fs.open(opt.file, flag, onopen); + }); + return promise; +}; +const addFilesSync = (p, files) => { + files.forEach(file => { + if (file.charAt(0) === '@') { + list({ + file: path.resolve(p.cwd, file.slice(1)), + sync: true, + noResume: true, + onReadEntry: entry => p.add(entry), + }); + } + else { + p.add(file); + } + }); + p.end(); +}; +const addFilesAsync = async (p, files) => { + for (let i = 0; i < files.length; i++) { + const file = String(files[i]); + if (file.charAt(0) === '@') { + await list({ + file: path.resolve(String(p.cwd), file.slice(1)), + noResume: true, + onReadEntry: entry => p.add(entry), + }); + } + else { + p.add(file); + } + } + p.end(); +}; +export const replace = makeCommand(replaceSync, replaceAsync, +/* c8 ignore start */ +() => { + throw new TypeError('file is required'); +}, () => { + throw new TypeError('file is required'); +}, +/* c8 ignore stop */ +(opt, entries) => { + if (!isFile(opt)) { + throw new TypeError('file is required'); + } + if (opt.gzip || + opt.brotli || + opt.zstd || + opt.file.endsWith('.br') || + opt.file.endsWith('.tbr')) { + throw new TypeError('cannot append to compressed archives'); + } + if (!entries?.length) { + throw new TypeError('no paths specified to add/replace'); + } +}); +//# sourceMappingURL=replace.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/replace.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/replace.js.map new file mode 100644 index 0000000..bf81535 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/replace.js.map @@ -0,0 +1 @@ +{"version":3,"file":"replace.js","sourceRoot":"","sources":["../../src/replace.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAElE,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EACL,MAAM,GAGP,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAE1C,kDAAkD;AAClD,mEAAmE;AACnE,iEAAiE;AACjE,iBAAiB;AACjB,4CAA4C;AAE5C,MAAM,WAAW,GAAG,CAAC,GAAuB,EAAE,KAAe,EAAE,EAAE;IAC/D,MAAM,CAAC,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAA;IAE3B,IAAI,KAAK,GAAG,IAAI,CAAA;IAChB,IAAI,EAAE,CAAA;IACN,IAAI,QAAQ,CAAA;IAEZ,IAAI,CAAC;QACH,IAAI,CAAC;YACH,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,CAA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,CAAC,mCAAmC,CAAC,CAAA;IAC1D,CAAC;AACH,CAAC,CACF,CAAA","sourcesContent":["// tar -r\nimport { WriteStream, WriteStreamSync } from '@isaacs/fs-minipass'\nimport { Minipass } from 'minipass'\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { Header } from './header.js'\nimport { list } from './list.js'\nimport { makeCommand } from './make-command.js'\nimport {\n isFile,\n TarOptionsFile,\n TarOptionsSyncFile,\n} from './options.js'\nimport { Pack, PackSync } from './pack.js'\n\n// starting at the head of the file, read a Header\n// If the checksum is invalid, that's our position to start writing\n// If it is, jump forward by the specified size (round up to 512)\n// and try again.\n// Write the new Pack stream starting there.\n\nconst replaceSync = (opt: TarOptionsSyncFile, files: string[]) => {\n const p = new PackSync(opt)\n\n let threw = true\n let fd\n let position\n\n try {\n try {\n fd = fs.openSync(opt.file, 'r+')\n } catch (er) {\n if ((er as NodeJS.ErrnoException)?.code === 'ENOENT') {\n fd = fs.openSync(opt.file, 'w+')\n } else {\n throw er\n }\n }\n\n const st = fs.fstatSync(fd)\n const headBuf = Buffer.alloc(512)\n\n POSITION: for (\n position = 0;\n position < st.size;\n position += 512\n ) {\n for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) {\n bytes = fs.readSync(\n fd,\n headBuf,\n bufPos,\n headBuf.length - bufPos,\n position + bufPos,\n )\n\n if (\n position === 0 &&\n headBuf[0] === 0x1f &&\n headBuf[1] === 0x8b\n ) {\n throw new Error('cannot append to compressed archives')\n }\n\n if (!bytes) {\n break POSITION\n }\n }\n\n const h = new Header(headBuf)\n if (!h.cksumValid) {\n break\n }\n const entryBlockSize = 512 * Math.ceil((h.size || 0) / 512)\n if (position + entryBlockSize + 512 > st.size) {\n break\n }\n // the 512 for the header we just parsed will be added as well\n // also jump ahead all the blocks for the body\n position += entryBlockSize\n if (opt.mtimeCache && h.mtime) {\n opt.mtimeCache.set(String(h.path), h.mtime)\n }\n }\n threw = false\n\n streamSync(opt, p, position, fd, files)\n } finally {\n if (threw) {\n try {\n fs.closeSync(fd as number)\n } catch (er) {}\n }\n }\n}\n\nconst streamSync = (\n opt: TarOptionsSyncFile,\n p: Pack,\n position: number,\n fd: number,\n files: string[],\n) => {\n const stream = new WriteStreamSync(opt.file, {\n fd: fd,\n start: position,\n })\n p.pipe(stream as unknown as Minipass.Writable)\n addFilesSync(p, files)\n}\n\nconst replaceAsync = (\n opt: TarOptionsFile,\n files: string[],\n): Promise => {\n files = Array.from(files)\n const p = new Pack(opt)\n\n const getPos = (\n fd: number,\n size: number,\n cb_: (er?: null | Error, pos?: number) => void,\n ) => {\n const cb = (er?: Error | null, pos?: number) => {\n if (er) {\n fs.close(fd, _ => cb_(er))\n } else {\n cb_(null, pos)\n }\n }\n\n let position = 0\n if (size === 0) {\n return cb(null, 0)\n }\n\n let bufPos = 0\n const headBuf = Buffer.alloc(512)\n const onread = (er?: null | Error, bytes?: number): void => {\n if (er || typeof bytes === 'undefined') {\n return cb(er)\n }\n bufPos += bytes\n if (bufPos < 512 && bytes) {\n return fs.read(\n fd,\n headBuf,\n bufPos,\n headBuf.length - bufPos,\n position + bufPos,\n onread,\n )\n }\n\n if (\n position === 0 &&\n headBuf[0] === 0x1f &&\n headBuf[1] === 0x8b\n ) {\n return cb(new Error('cannot append to compressed archives'))\n }\n\n // truncated header\n if (bufPos < 512) {\n return cb(null, position)\n }\n\n const h = new Header(headBuf)\n if (!h.cksumValid) {\n return cb(null, position)\n }\n\n /* c8 ignore next */\n const entryBlockSize = 512 * Math.ceil((h.size ?? 0) / 512)\n if (position + entryBlockSize + 512 > size) {\n return cb(null, position)\n }\n\n position += entryBlockSize + 512\n if (position >= size) {\n return cb(null, position)\n }\n\n if (opt.mtimeCache && h.mtime) {\n opt.mtimeCache.set(String(h.path), h.mtime)\n }\n bufPos = 0\n fs.read(fd, headBuf, 0, 512, position, onread)\n }\n fs.read(fd, headBuf, 0, 512, position, onread)\n }\n\n const promise = new Promise((resolve, reject) => {\n p.on('error', reject)\n let flag = 'r+'\n const onopen = (\n er?: NodeJS.ErrnoException | null,\n fd?: number,\n ) => {\n if (er && er.code === 'ENOENT' && flag === 'r+') {\n flag = 'w+'\n return fs.open(opt.file, flag, onopen)\n }\n\n if (er || !fd) {\n return reject(er)\n }\n\n fs.fstat(fd, (er, st) => {\n if (er) {\n return fs.close(fd, () => reject(er))\n }\n\n getPos(fd, st.size, (er, position) => {\n if (er) {\n return reject(er)\n }\n const stream = new WriteStream(opt.file, {\n fd: fd,\n start: position,\n })\n p.pipe(stream as unknown as Minipass.Writable)\n stream.on('error', reject)\n stream.on('close', resolve)\n addFilesAsync(p, files)\n })\n })\n }\n fs.open(opt.file, flag, onopen)\n })\n\n return promise\n}\n\nconst addFilesSync = (p: Pack, files: string[]) => {\n files.forEach(file => {\n if (file.charAt(0) === '@') {\n list({\n file: path.resolve(p.cwd, file.slice(1)),\n sync: true,\n noResume: true,\n onReadEntry: entry => p.add(entry),\n })\n } else {\n p.add(file)\n }\n })\n p.end()\n}\n\nconst addFilesAsync = async (\n p: Pack,\n files: string[],\n): Promise => {\n for (let i = 0; i < files.length; i++) {\n const file = String(files[i])\n if (file.charAt(0) === '@') {\n await list({\n file: path.resolve(String(p.cwd), file.slice(1)),\n noResume: true,\n onReadEntry: entry => p.add(entry),\n })\n } else {\n p.add(file)\n }\n }\n p.end()\n}\n\nexport const replace = makeCommand(\n replaceSync,\n replaceAsync,\n /* c8 ignore start */\n (): never => {\n throw new TypeError('file is required')\n },\n (): never => {\n throw new TypeError('file is required')\n },\n /* c8 ignore stop */\n (opt, entries) => {\n if (!isFile(opt)) {\n throw new TypeError('file is required')\n }\n\n if (\n opt.gzip ||\n opt.brotli ||\n opt.zstd ||\n opt.file.endsWith('.br') ||\n opt.file.endsWith('.tbr')\n ) {\n throw new TypeError('cannot append to compressed archives')\n }\n\n if (!entries?.length) {\n throw new TypeError('no paths specified to add/replace')\n }\n },\n)\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/strip-absolute-path.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/strip-absolute-path.d.ts new file mode 100644 index 0000000..170ce2c --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/strip-absolute-path.d.ts @@ -0,0 +1,2 @@ +export declare const stripAbsolutePath: (path: string) => string[]; +//# sourceMappingURL=strip-absolute-path.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/strip-absolute-path.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/strip-absolute-path.d.ts.map new file mode 100644 index 0000000..7e5b3c2 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/strip-absolute-path.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"strip-absolute-path.d.ts","sourceRoot":"","sources":["../../src/strip-absolute-path.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,aAgB7C,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/strip-absolute-path.js b/node_modules/cmake-js/node_modules/tar/dist/esm/strip-absolute-path.js new file mode 100644 index 0000000..cce5ff8 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/strip-absolute-path.js @@ -0,0 +1,25 @@ +// unix absolute paths are also absolute on win32, so we use this for both +import { win32 } from 'node:path'; +const { isAbsolute, parse } = win32; +// returns [root, stripped] +// Note that windows will think that //x/y/z/a has a "root" of //x/y, and in +// those cases, we want to sanitize it to x/y/z/a, not z/a, so we strip / +// explicitly if it's the first character. +// drive-specific relative paths on Windows get their root stripped off even +// though they are not absolute, so `c:../foo` becomes ['c:', '../foo'] +export const stripAbsolutePath = (path) => { + let r = ''; + let parsed = parse(path); + while (isAbsolute(path) || parsed.root) { + // windows will think that //x/y/z has a "root" of //x/y/ + // but strip the //?/C:/ off of //?/C:/path + const root = path.charAt(0) === '/' && path.slice(0, 4) !== '//?/' ? + '/' + : parsed.root; + path = path.slice(root.length); + r += root; + parsed = parse(path); + } + return [r, path]; +}; +//# sourceMappingURL=strip-absolute-path.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/strip-absolute-path.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/strip-absolute-path.js.map new file mode 100644 index 0000000..4f84fa6 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/strip-absolute-path.js.map @@ -0,0 +1 @@ +{"version":3,"file":"strip-absolute-path.js","sourceRoot":"","sources":["../../src/strip-absolute-path.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AACjC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,KAAK,CAAA;AAEnC,2BAA2B;AAC3B,4EAA4E;AAC5E,yEAAyE;AACzE,0CAA0C;AAC1C,4EAA4E;AAC5E,uEAAuE;AACvE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,EAAE;IAChD,IAAI,CAAC,GAAG,EAAE,CAAA;IAEV,IAAI,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;IACxB,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QACvC,yDAAyD;QACzD,2CAA2C;QAC3C,MAAM,IAAI,GACR,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC;YACrD,GAAG;YACL,CAAC,CAAC,MAAM,CAAC,IAAI,CAAA;QACf,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC9B,CAAC,IAAI,IAAI,CAAA;QACT,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;IACtB,CAAC;IACD,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;AAClB,CAAC,CAAA","sourcesContent":["// unix absolute paths are also absolute on win32, so we use this for both\nimport { win32 } from 'node:path'\nconst { isAbsolute, parse } = win32\n\n// returns [root, stripped]\n// Note that windows will think that //x/y/z/a has a \"root\" of //x/y, and in\n// those cases, we want to sanitize it to x/y/z/a, not z/a, so we strip /\n// explicitly if it's the first character.\n// drive-specific relative paths on Windows get their root stripped off even\n// though they are not absolute, so `c:../foo` becomes ['c:', '../foo']\nexport const stripAbsolutePath = (path: string) => {\n let r = ''\n\n let parsed = parse(path)\n while (isAbsolute(path) || parsed.root) {\n // windows will think that //x/y/z has a \"root\" of //x/y/\n // but strip the //?/C:/ off of //?/C:/path\n const root =\n path.charAt(0) === '/' && path.slice(0, 4) !== '//?/' ?\n '/'\n : parsed.root\n path = path.slice(root.length)\n r += root\n parsed = parse(path)\n }\n return [r, path]\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts new file mode 100644 index 0000000..dcc4637 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts @@ -0,0 +1,2 @@ +export declare const stripTrailingSlashes: (str: string) => string; +//# sourceMappingURL=strip-trailing-slashes.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts.map new file mode 100644 index 0000000..88ff178 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"strip-trailing-slashes.d.ts","sourceRoot":"","sources":["../../src/strip-trailing-slashes.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,GAAI,KAAK,MAAM,WAQ/C,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/strip-trailing-slashes.js b/node_modules/cmake-js/node_modules/tar/dist/esm/strip-trailing-slashes.js new file mode 100644 index 0000000..ace4218 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/strip-trailing-slashes.js @@ -0,0 +1,14 @@ +// warning: extremely hot code path. +// This has been meticulously optimized for use +// within npm install on large package trees. +// Do not edit without careful benchmarking. +export const stripTrailingSlashes = (str) => { + let i = str.length - 1; + let slashesStart = -1; + while (i > -1 && str.charAt(i) === '/') { + slashesStart = i; + i--; + } + return slashesStart === -1 ? str : str.slice(0, slashesStart); +}; +//# sourceMappingURL=strip-trailing-slashes.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/strip-trailing-slashes.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/strip-trailing-slashes.js.map new file mode 100644 index 0000000..dc4d01b --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/strip-trailing-slashes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"strip-trailing-slashes.js","sourceRoot":"","sources":["../../src/strip-trailing-slashes.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,+CAA+C;AAC/C,6CAA6C;AAC7C,4CAA4C;AAC5C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAW,EAAE,EAAE;IAClD,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAA;IACtB,IAAI,YAAY,GAAG,CAAC,CAAC,CAAA;IACrB,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;QACvC,YAAY,GAAG,CAAC,CAAA;QAChB,CAAC,EAAE,CAAA;IACL,CAAC;IACD,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,CAAA;AAC/D,CAAC,CAAA","sourcesContent":["// warning: extremely hot code path.\n// This has been meticulously optimized for use\n// within npm install on large package trees.\n// Do not edit without careful benchmarking.\nexport const stripTrailingSlashes = (str: string) => {\n let i = str.length - 1\n let slashesStart = -1\n while (i > -1 && str.charAt(i) === '/') {\n slashesStart = i\n i--\n }\n return slashesStart === -1 ? str : str.slice(0, slashesStart)\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/symlink-error.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/symlink-error.d.ts new file mode 100644 index 0000000..61b400f --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/symlink-error.d.ts @@ -0,0 +1,9 @@ +export declare class SymlinkError extends Error { + path: string; + symlink: string; + syscall: 'symlink'; + code: 'TAR_SYMLINK_ERROR'; + constructor(symlink: string, path: string); + get name(): string; +} +//# sourceMappingURL=symlink-error.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/symlink-error.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/symlink-error.d.ts.map new file mode 100644 index 0000000..5716e8e --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/symlink-error.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"symlink-error.d.ts","sourceRoot":"","sources":["../../src/symlink-error.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,SAAS,CAAY;IAC9B,IAAI,EAAE,mBAAmB,CAAsB;gBACnC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAKzC,IAAI,IAAI,WAEP;CACF"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/symlink-error.js b/node_modules/cmake-js/node_modules/tar/dist/esm/symlink-error.js new file mode 100644 index 0000000..d31766e --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/symlink-error.js @@ -0,0 +1,15 @@ +export class SymlinkError extends Error { + path; + symlink; + syscall = 'symlink'; + code = 'TAR_SYMLINK_ERROR'; + constructor(symlink, path) { + super('TAR_SYMLINK_ERROR: Cannot extract through symbolic link'); + this.symlink = symlink; + this.path = path; + } + get name() { + return 'SymlinkError'; + } +} +//# sourceMappingURL=symlink-error.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/symlink-error.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/symlink-error.js.map new file mode 100644 index 0000000..98ae1a2 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/symlink-error.js.map @@ -0,0 +1 @@ +{"version":3,"file":"symlink-error.js","sourceRoot":"","sources":["../../src/symlink-error.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,IAAI,CAAQ;IACZ,OAAO,CAAQ;IACf,OAAO,GAAc,SAAS,CAAA;IAC9B,IAAI,GAAwB,mBAAmB,CAAA;IAC/C,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAAC,yDAAyD,CAAC,CAAA;QAChE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IACD,IAAI,IAAI;QACN,OAAO,cAAc,CAAA;IACvB,CAAC;CACF","sourcesContent":["export class SymlinkError extends Error {\n path: string\n symlink: string\n syscall: 'symlink' = 'symlink'\n code: 'TAR_SYMLINK_ERROR' = 'TAR_SYMLINK_ERROR'\n constructor(symlink: string, path: string) {\n super('TAR_SYMLINK_ERROR: Cannot extract through symbolic link')\n this.symlink = symlink\n this.path = path\n }\n get name() {\n return 'SymlinkError'\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/types.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/types.d.ts new file mode 100644 index 0000000..a39f054 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/types.d.ts @@ -0,0 +1,7 @@ +export declare const isCode: (c: string) => c is EntryTypeCode; +export declare const isName: (c: string) => c is EntryTypeName; +export type EntryTypeCode = '0' | '' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | 'g' | 'x' | 'A' | 'D' | 'I' | 'K' | 'L' | 'M' | 'N' | 'S' | 'V' | 'X'; +export type EntryTypeName = 'File' | 'OldFile' | 'Link' | 'SymbolicLink' | 'CharacterDevice' | 'BlockDevice' | 'Directory' | 'FIFO' | 'ContiguousFile' | 'GlobalExtendedHeader' | 'ExtendedHeader' | 'SolarisACL' | 'GNUDumpDir' | 'Inode' | 'NextFileHasLongLinkpath' | 'NextFileHasLongPath' | 'ContinuationFile' | 'OldGnuLongPath' | 'SparseFile' | 'TapeVolumeHeader' | 'OldExtendedHeader' | 'Unsupported'; +export declare const name: Map; +export declare const code: Map; +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/types.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/types.d.ts.map new file mode 100644 index 0000000..5de4248 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,KAAG,CAAC,IAAI,aACV,CAAA;AAE9B,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,KAAG,CAAC,IAAI,aACV,CAAA;AAE9B,MAAM,MAAM,aAAa,GACrB,GAAG,GACH,EAAE,GACF,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,CAAA;AAEP,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,SAAS,GACT,MAAM,GACN,cAAc,GACd,iBAAiB,GACjB,aAAa,GACb,WAAW,GACX,MAAM,GACN,gBAAgB,GAChB,sBAAsB,GACtB,gBAAgB,GAChB,YAAY,GACZ,YAAY,GACZ,OAAO,GACP,yBAAyB,GACzB,qBAAqB,GACrB,kBAAkB,GAClB,gBAAgB,GAChB,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,aAAa,CAAA;AAGjB,eAAO,MAAM,IAAI,mCAsCf,CAAA;AAGF,eAAO,MAAM,IAAI,mCAEhB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/types.js b/node_modules/cmake-js/node_modules/tar/dist/esm/types.js new file mode 100644 index 0000000..27b982a --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/types.js @@ -0,0 +1,45 @@ +export const isCode = (c) => name.has(c); +export const isName = (c) => code.has(c); +// map types from key to human-friendly name +export const name = new Map([ + ['0', 'File'], + // same as File + ['', 'OldFile'], + ['1', 'Link'], + ['2', 'SymbolicLink'], + // Devices and FIFOs aren't fully supported + // they are parsed, but skipped when unpacking + ['3', 'CharacterDevice'], + ['4', 'BlockDevice'], + ['5', 'Directory'], + ['6', 'FIFO'], + // same as File + ['7', 'ContiguousFile'], + // pax headers + ['g', 'GlobalExtendedHeader'], + ['x', 'ExtendedHeader'], + // vendor-specific stuff + // skip + ['A', 'SolarisACL'], + // like 5, but with data, which should be skipped + ['D', 'GNUDumpDir'], + // metadata only, skip + ['I', 'Inode'], + // data = link path of next file + ['K', 'NextFileHasLongLinkpath'], + // data = path of next file + ['L', 'NextFileHasLongPath'], + // skip + ['M', 'ContinuationFile'], + // like L + ['N', 'OldGnuLongPath'], + // skip + ['S', 'SparseFile'], + // skip + ['V', 'TapeVolumeHeader'], + // like x + ['X', 'OldExtendedHeader'], +]); +// map the other direction +export const code = new Map(Array.from(name).map(kv => [kv[1], kv[0]])); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/types.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/types.js.map new file mode 100644 index 0000000..f7e8ec7 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAS,EAAsB,EAAE,CACtD,IAAI,CAAC,GAAG,CAAC,CAAkB,CAAC,CAAA;AAE9B,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAS,EAAsB,EAAE,CACtD,IAAI,CAAC,GAAG,CAAC,CAAkB,CAAC,CAAA;AAiD9B,4CAA4C;AAC5C,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,GAAG,CAA+B;IACxD,CAAC,GAAG,EAAE,MAAM,CAAC;IACb,eAAe;IACf,CAAC,EAAE,EAAE,SAAS,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,cAAc,CAAC;IACrB,2CAA2C;IAC3C,8CAA8C;IAC9C,CAAC,GAAG,EAAE,iBAAiB,CAAC;IACxB,CAAC,GAAG,EAAE,aAAa,CAAC;IACpB,CAAC,GAAG,EAAE,WAAW,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,CAAC;IACb,eAAe;IACf,CAAC,GAAG,EAAE,gBAAgB,CAAC;IACvB,cAAc;IACd,CAAC,GAAG,EAAE,sBAAsB,CAAC;IAC7B,CAAC,GAAG,EAAE,gBAAgB,CAAC;IACvB,wBAAwB;IACxB,OAAO;IACP,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,iDAAiD;IACjD,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,sBAAsB;IACtB,CAAC,GAAG,EAAE,OAAO,CAAC;IACd,gCAAgC;IAChC,CAAC,GAAG,EAAE,yBAAyB,CAAC;IAChC,2BAA2B;IAC3B,CAAC,GAAG,EAAE,qBAAqB,CAAC;IAC5B,OAAO;IACP,CAAC,GAAG,EAAE,kBAAkB,CAAC;IACzB,SAAS;IACT,CAAC,GAAG,EAAE,gBAAgB,CAAC;IACvB,OAAO;IACP,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,OAAO;IACP,CAAC,GAAG,EAAE,kBAAkB,CAAC;IACzB,SAAS;IACT,CAAC,GAAG,EAAE,mBAAmB,CAAC;CAC3B,CAAC,CAAA;AAEF,0BAA0B;AAC1B,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,GAAG,CACzB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAC3C,CAAA","sourcesContent":["export const isCode = (c: string): c is EntryTypeCode =>\n name.has(c as EntryTypeCode)\n\nexport const isName = (c: string): c is EntryTypeName =>\n code.has(c as EntryTypeName)\n\nexport type EntryTypeCode =\n | '0'\n | ''\n | '1'\n | '2'\n | '3'\n | '4'\n | '5'\n | '6'\n | '7'\n | 'g'\n | 'x'\n | 'A'\n | 'D'\n | 'I'\n | 'K'\n | 'L'\n | 'M'\n | 'N'\n | 'S'\n | 'V'\n | 'X'\n\nexport type EntryTypeName =\n | 'File'\n | 'OldFile'\n | 'Link'\n | 'SymbolicLink'\n | 'CharacterDevice'\n | 'BlockDevice'\n | 'Directory'\n | 'FIFO'\n | 'ContiguousFile'\n | 'GlobalExtendedHeader'\n | 'ExtendedHeader'\n | 'SolarisACL'\n | 'GNUDumpDir'\n | 'Inode'\n | 'NextFileHasLongLinkpath'\n | 'NextFileHasLongPath'\n | 'ContinuationFile'\n | 'OldGnuLongPath'\n | 'SparseFile'\n | 'TapeVolumeHeader'\n | 'OldExtendedHeader'\n | 'Unsupported'\n\n// map types from key to human-friendly name\nexport const name = new Map([\n ['0', 'File'],\n // same as File\n ['', 'OldFile'],\n ['1', 'Link'],\n ['2', 'SymbolicLink'],\n // Devices and FIFOs aren't fully supported\n // they are parsed, but skipped when unpacking\n ['3', 'CharacterDevice'],\n ['4', 'BlockDevice'],\n ['5', 'Directory'],\n ['6', 'FIFO'],\n // same as File\n ['7', 'ContiguousFile'],\n // pax headers\n ['g', 'GlobalExtendedHeader'],\n ['x', 'ExtendedHeader'],\n // vendor-specific stuff\n // skip\n ['A', 'SolarisACL'],\n // like 5, but with data, which should be skipped\n ['D', 'GNUDumpDir'],\n // metadata only, skip\n ['I', 'Inode'],\n // data = link path of next file\n ['K', 'NextFileHasLongLinkpath'],\n // data = path of next file\n ['L', 'NextFileHasLongPath'],\n // skip\n ['M', 'ContinuationFile'],\n // like L\n ['N', 'OldGnuLongPath'],\n // skip\n ['S', 'SparseFile'],\n // skip\n ['V', 'TapeVolumeHeader'],\n // like x\n ['X', 'OldExtendedHeader'],\n])\n\n// map the other direction\nexport const code = new Map(\n Array.from(name).map(kv => [kv[1], kv[0]]),\n)\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/unpack.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/unpack.d.ts new file mode 100644 index 0000000..924bdad --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/unpack.d.ts @@ -0,0 +1,101 @@ +import { type Stats } from 'node:fs'; +import { MkdirError } from './mkdir.js'; +import { Parser } from './parse.js'; +import { TarOptions } from './options.js'; +import { PathReservations } from './path-reservations.js'; +import { ReadEntry } from './read-entry.js'; +import { WarnData } from './warn-method.js'; +import { SymlinkError } from './symlink-error.js'; +declare const ONENTRY: unique symbol; +declare const CHECKFS: unique symbol; +declare const CHECKFS2: unique symbol; +declare const ISREUSABLE: unique symbol; +declare const MAKEFS: unique symbol; +declare const FILE: unique symbol; +declare const DIRECTORY: unique symbol; +declare const LINK: unique symbol; +declare const SYMLINK: unique symbol; +declare const HARDLINK: unique symbol; +declare const ENSURE_NO_SYMLINK: unique symbol; +declare const UNSUPPORTED: unique symbol; +declare const CHECKPATH: unique symbol; +declare const STRIPABSOLUTEPATH: unique symbol; +declare const MKDIR: unique symbol; +declare const ONERROR: unique symbol; +declare const PENDING: unique symbol; +declare const PEND: unique symbol; +declare const UNPEND: unique symbol; +declare const ENDED: unique symbol; +declare const MAYBECLOSE: unique symbol; +declare const SKIP: unique symbol; +declare const DOCHOWN: unique symbol; +declare const UID: unique symbol; +declare const GID: unique symbol; +declare const CHECKED_CWD: unique symbol; +export declare class Unpack extends Parser { + [ENDED]: boolean; + [CHECKED_CWD]: boolean; + [PENDING]: number; + reservations: PathReservations; + transform?: TarOptions['transform']; + writable: true; + readable: false; + uid?: number; + gid?: number; + setOwner: boolean; + preserveOwner: boolean; + processGid?: number; + processUid?: number; + maxDepth: number; + forceChown: boolean; + win32: boolean; + newer: boolean; + keep: boolean; + noMtime: boolean; + preservePaths: boolean; + unlink: boolean; + cwd: string; + strip: number; + processUmask: number; + umask: number; + dmode: number; + fmode: number; + chmod: boolean; + constructor(opt?: TarOptions); + warn(code: string, msg: string | Error, data?: WarnData): void; + [MAYBECLOSE](): void; + [STRIPABSOLUTEPATH](entry: ReadEntry, field: 'path' | 'linkpath'): boolean; + [CHECKPATH](entry: ReadEntry): boolean; + [ONENTRY](entry: ReadEntry): void; + [ONERROR](er: Error, entry: ReadEntry): void; + [MKDIR](dir: string, mode: number, cb: (er?: null | MkdirError, made?: string) => void): void; + [DOCHOWN](entry: ReadEntry): boolean; + [UID](entry: ReadEntry): number | undefined; + [GID](entry: ReadEntry): number | undefined; + [FILE](entry: ReadEntry, fullyDone: () => void): void; + [DIRECTORY](entry: ReadEntry, fullyDone: () => void): void; + [UNSUPPORTED](entry: ReadEntry): void; + [SYMLINK](entry: ReadEntry, done: () => void): void; + [HARDLINK](entry: ReadEntry, done: () => void): void; + [ENSURE_NO_SYMLINK](entry: ReadEntry, cwd: string, parts: string[], done: () => void, onError: (er: SymlinkError) => void): void; + [PEND](): void; + [UNPEND](): void; + [SKIP](entry: ReadEntry): void; + [ISREUSABLE](entry: ReadEntry, st: Stats): boolean; + [CHECKFS](entry: ReadEntry): void; + [CHECKFS2](entry: ReadEntry, fullyDone: (er?: Error) => void): void; + [MAKEFS](er: null | undefined | Error, entry: ReadEntry, done: () => void): void; + [LINK](entry: ReadEntry, linkpath: string, link: 'link' | 'symlink', done: () => void): void; +} +export declare class UnpackSync extends Unpack { + sync: true; + [MAKEFS](er: null | Error | undefined, entry: ReadEntry): void; + [CHECKFS](entry: ReadEntry): void; + [FILE](entry: ReadEntry, done: () => void): void; + [DIRECTORY](entry: ReadEntry, done: () => void): void; + [MKDIR](dir: string, mode: number): unknown; + [ENSURE_NO_SYMLINK](_entry: ReadEntry, cwd: string, parts: string[], done: () => void, onError: (er: SymlinkError) => void): void; + [LINK](entry: ReadEntry, linkpath: string, link: 'link' | 'symlink', done: () => void): void; +} +export {}; +//# sourceMappingURL=unpack.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/unpack.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/unpack.d.ts.map new file mode 100644 index 0000000..a16d116 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/unpack.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"unpack.d.ts","sourceRoot":"","sources":["../../src/unpack.ts"],"names":[],"mappings":"AASA,OAAW,EAAE,KAAK,KAAK,EAAE,MAAM,SAAS,CAAA;AAGxC,OAAO,EAAS,UAAU,EAAa,MAAM,YAAY,CAAA;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAInC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,QAAQ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EAAE,EAAE,IAAI,GAAG,SAAS,GAAG,KAAK,EAC5B,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,MAAM,IAAI;IA0BlB,CAAC,IAAI,CAAC,CACJ,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,IAAI,EAAE,MAAM,IAAI;CAYnB;AAYD,qBAAa,UAAW,SAAQ,MAAM;IACpC,IAAI,EAAE,IAAI,CAAQ;IAElB,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,IAAI,GAAG,KAAK,GAAG,SAAS,EAAE,KAAK,EAAE,SAAS;IAIvD,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,SAAS;IAqE1B,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,IAAI;IAyFzC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,IAAI;IAkC9C,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAkBjC,CAAC,iBAAiB,CAAC,CACjB,MAAM,EAAE,SAAS,EACjB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,MAAM,IAAI,EAChB,OAAO,EAAE,CAAC,EAAE,EAAE,YAAY,KAAK,IAAI;IAiBrC,CAAC,IAAI,CAAC,CACJ,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,IAAI,EAAE,MAAM,IAAI;CAWnB"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/unpack.js b/node_modules/cmake-js/node_modules/tar/dist/esm/unpack.js new file mode 100644 index 0000000..1d0b53d --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/unpack.js @@ -0,0 +1,916 @@ +// the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet. +// but the path reservations are required to avoid race conditions where +// parallelized unpack ops may mess with one another, due to dependencies +// (like a Link depending on its target) or destructive operations (like +// clobbering an fs object to create one of a different type.) +import * as fsm from '@isaacs/fs-minipass'; +import assert from 'node:assert'; +import { randomBytes } from 'node:crypto'; +import fs from 'node:fs'; +import path from 'node:path'; +import { getWriteFlag } from './get-write-flag.js'; +import { mkdir, mkdirSync } from './mkdir.js'; +import { normalizeWindowsPath } from './normalize-windows-path.js'; +import { Parser } from './parse.js'; +import { stripAbsolutePath } from './strip-absolute-path.js'; +import * as wc from './winchars.js'; +import { PathReservations } from './path-reservations.js'; +import { SymlinkError } from './symlink-error.js'; +import { umask } from './process-umask.js'; +const ONENTRY = Symbol('onEntry'); +const CHECKFS = Symbol('checkFs'); +const CHECKFS2 = Symbol('checkFs2'); +const ISREUSABLE = Symbol('isReusable'); +const MAKEFS = Symbol('makeFs'); +const FILE = Symbol('file'); +const DIRECTORY = Symbol('directory'); +const LINK = Symbol('link'); +const SYMLINK = Symbol('symlink'); +const HARDLINK = Symbol('hardlink'); +const ENSURE_NO_SYMLINK = Symbol('ensureNoSymlink'); +const UNSUPPORTED = Symbol('unsupported'); +const CHECKPATH = Symbol('checkPath'); +const STRIPABSOLUTEPATH = Symbol('stripAbsolutePath'); +const MKDIR = Symbol('mkdir'); +const ONERROR = Symbol('onError'); +const PENDING = Symbol('pending'); +const PEND = Symbol('pend'); +const UNPEND = Symbol('unpend'); +const ENDED = Symbol('ended'); +const MAYBECLOSE = Symbol('maybeClose'); +const SKIP = Symbol('skip'); +const DOCHOWN = Symbol('doChown'); +const UID = Symbol('uid'); +const GID = Symbol('gid'); +const CHECKED_CWD = Symbol('checkedCwd'); +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; +const isWindows = platform === 'win32'; +const DEFAULT_MAX_DEPTH = 1024; +// Unlinks on Windows are not atomic. +// +// This means that if you have a file entry, followed by another +// file entry with an identical name, and you cannot re-use the file +// (because it's a hardlink, or because unlink:true is set, or it's +// Windows, which does not have useful nlink values), then the unlink +// will be committed to the disk AFTER the new file has been written +// over the old one, deleting the new file. +// +// To work around this, on Windows systems, we rename the file and then +// delete the renamed file. It's a sloppy kludge, but frankly, I do not +// know of a better way to do this, given windows' non-atomic unlink +// semantics. +// +// See: https://github.com/npm/node-tar/issues/183 +/* c8 ignore start */ +const unlinkFile = (path, cb) => { + if (!isWindows) { + return fs.unlink(path, cb); + } + const name = path + '.DELETE.' + randomBytes(16).toString('hex'); + fs.rename(path, name, er => { + if (er) { + return cb(er); + } + fs.unlink(name, cb); + }); +}; +/* c8 ignore stop */ +/* c8 ignore start */ +const unlinkFileSync = (path) => { + if (!isWindows) { + return fs.unlinkSync(path); + } + const name = path + '.DELETE.' + randomBytes(16).toString('hex'); + fs.renameSync(path, name); + fs.unlinkSync(name); +}; +/* c8 ignore stop */ +// this.gid, entry.gid, this.processUid +const uint32 = (a, b, c) => a !== undefined && a === a >>> 0 ? a + : b !== undefined && b === b >>> 0 ? b + : c; +export class Unpack extends Parser { + [ENDED] = false; + [CHECKED_CWD] = false; + [PENDING] = 0; + reservations = new PathReservations(); + transform; + writable = true; + readable = false; + uid; + gid; + setOwner; + preserveOwner; + processGid; + processUid; + maxDepth; + forceChown; + win32; + newer; + keep; + noMtime; + preservePaths; + unlink; + cwd; + strip; + processUmask; + umask; + dmode; + fmode; + chmod; + constructor(opt = {}) { + opt.ondone = () => { + this[ENDED] = true; + this[MAYBECLOSE](); + }; + super(opt); + this.transform = opt.transform; + this.chmod = !!opt.chmod; + if (typeof opt.uid === 'number' || typeof opt.gid === 'number') { + // need both or neither + if (typeof opt.uid !== 'number' || + typeof opt.gid !== 'number') { + throw new TypeError('cannot set owner without number uid and gid'); + } + if (opt.preserveOwner) { + throw new TypeError('cannot preserve owner in archive and also set owner explicitly'); + } + this.uid = opt.uid; + this.gid = opt.gid; + this.setOwner = true; + } + else { + this.uid = undefined; + this.gid = undefined; + this.setOwner = false; + } + // default true for root + if (opt.preserveOwner === undefined && + typeof opt.uid !== 'number') { + this.preserveOwner = !!(process.getuid && process.getuid() === 0); + } + else { + this.preserveOwner = !!opt.preserveOwner; + } + this.processUid = + (this.preserveOwner || this.setOwner) && process.getuid ? + process.getuid() + : undefined; + this.processGid = + (this.preserveOwner || this.setOwner) && process.getgid ? + process.getgid() + : undefined; + // prevent excessively deep nesting of subfolders + // set to `Infinity` to remove this restriction + this.maxDepth = + typeof opt.maxDepth === 'number' ? + opt.maxDepth + : DEFAULT_MAX_DEPTH; + // mostly just for testing, but useful in some cases. + // Forcibly trigger a chown on every entry, no matter what + this.forceChown = opt.forceChown === true; + // turn > this[ONENTRY](entry)); + } + // a bad or damaged archive is a warning for Parser, but an error + // when extracting. Mark those errors as unrecoverable, because + // the Unpack contract cannot be met. + warn(code, msg, data = {}) { + if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') { + data.recoverable = false; + } + return super.warn(code, msg, data); + } + [MAYBECLOSE]() { + if (this[ENDED] && this[PENDING] === 0) { + this.emit('prefinish'); + this.emit('finish'); + this.emit('end'); + } + } + // return false if we need to skip this file + // return true if the field was successfully sanitized + [STRIPABSOLUTEPATH](entry, field) { + const p = entry[field]; + const { type } = entry; + if (!p || this.preservePaths) + return true; + const parts = p.split('/'); + if (parts.includes('..') || + /* c8 ignore next */ + (isWindows && /^[a-z]:\.\.$/i.test(parts[0] ?? ''))) { + // For linkpath, check if the resolved path escapes cwd rather than + // just rejecting any path with '..' - relative symlinks like + // '../sibling/file' are valid if they resolve within the cwd. + // For paths, they just simply may not ever use .. at all. + if (field === 'path' || type === 'Link') { + this.warn('TAR_ENTRY_ERROR', `${field} contains '..'`, { + entry, + [field]: p, + }); + // not ok! + return false; + } + else { + // Resolve linkpath relative to the entry's directory. + // `path.posix` is safe to use because we're operating on + // tar paths, not a filesystem. + const entryDir = path.posix.dirname(entry.path); + const resolved = path.posix.normalize(path.posix.join(entryDir, p)); + // If the resolved path escapes (starts with ..), reject it + if (resolved.startsWith('../') || resolved === '..') { + this.warn('TAR_ENTRY_ERROR', `${field} escapes extraction directory`, { + entry, + [field]: p, + }); + return false; + } + } + } + // strip off the root + const [root, stripped] = stripAbsolutePath(p); + if (root) { + // ok, but triggers warning about stripping root + entry[field] = String(stripped); + this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute ${field}`, { + entry, + [field]: p, + }); + } + return true; + } + // no IO, just string checking for absolute indicators + [CHECKPATH](entry) { + const p = normalizeWindowsPath(entry.path); + const parts = p.split('/'); + if (this.strip) { + if (parts.length < this.strip) { + return false; + } + if (entry.type === 'Link') { + const linkparts = normalizeWindowsPath(String(entry.linkpath)).split('/'); + if (linkparts.length >= this.strip) { + entry.linkpath = linkparts.slice(this.strip).join('/'); + } + else { + return false; + } + } + parts.splice(0, this.strip); + entry.path = parts.join('/'); + } + if (isFinite(this.maxDepth) && parts.length > this.maxDepth) { + this.warn('TAR_ENTRY_ERROR', 'path excessively deep', { + entry, + path: p, + depth: parts.length, + maxDepth: this.maxDepth, + }); + return false; + } + if (!this[STRIPABSOLUTEPATH](entry, 'path') || + !this[STRIPABSOLUTEPATH](entry, 'linkpath')) { + return false; + } + if (path.isAbsolute(entry.path)) { + entry.absolute = normalizeWindowsPath(path.resolve(entry.path)); + } + else { + entry.absolute = normalizeWindowsPath(path.resolve(this.cwd, entry.path)); + } + // if we somehow ended up with a path that escapes the cwd, and we are + // not in preservePaths mode, then something is fishy! This should have + // been prevented above, so ignore this for coverage. + /* c8 ignore start - defense in depth */ + if (!this.preservePaths && + typeof entry.absolute === 'string' && + entry.absolute.indexOf(this.cwd + '/') !== 0 && + entry.absolute !== this.cwd) { + this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', { + entry, + path: normalizeWindowsPath(entry.path), + resolvedPath: entry.absolute, + cwd: this.cwd, + }); + return false; + } + /* c8 ignore stop */ + // an archive can set properties on the extraction directory, but it + // may not replace the cwd with a different kind of thing entirely. + if (entry.absolute === this.cwd && + entry.type !== 'Directory' && + entry.type !== 'GNUDumpDir') { + return false; + } + // only encode : chars that aren't drive letter indicators + if (this.win32) { + const { root: aRoot } = path.win32.parse(String(entry.absolute)); + entry.absolute = + aRoot + wc.encode(String(entry.absolute).slice(aRoot.length)); + const { root: pRoot } = path.win32.parse(entry.path); + entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length)); + } + return true; + } + [ONENTRY](entry) { + if (!this[CHECKPATH](entry)) { + return entry.resume(); + } + assert.equal(typeof entry.absolute, 'string'); + switch (entry.type) { + case 'Directory': + case 'GNUDumpDir': + if (entry.mode) { + entry.mode = entry.mode | 0o700; + } + // eslint-disable-next-line no-fallthrough + case 'File': + case 'OldFile': + case 'ContiguousFile': + case 'Link': + case 'SymbolicLink': + return this[CHECKFS](entry); + case 'CharacterDevice': + case 'BlockDevice': + case 'FIFO': + default: + return this[UNSUPPORTED](entry); + } + } + [ONERROR](er, entry) { + // Cwd has to exist, or else nothing works. That's serious. + // Other errors are warnings, which raise the error in strict + // mode, but otherwise continue on. + if (er.name === 'CwdError') { + this.emit('error', er); + } + else { + this.warn('TAR_ENTRY_ERROR', er, { entry }); + this[UNPEND](); + entry.resume(); + } + } + [MKDIR](dir, mode, cb) { + mkdir(normalizeWindowsPath(dir), { + uid: this.uid, + gid: this.gid, + processUid: this.processUid, + processGid: this.processGid, + umask: this.processUmask, + preserve: this.preservePaths, + unlink: this.unlink, + cwd: this.cwd, + mode: mode, + }, cb); + } + [DOCHOWN](entry) { + // in preserve owner mode, chown if the entry doesn't match process + // in set owner mode, chown if setting doesn't match process + return (this.forceChown || + (this.preserveOwner && + ((typeof entry.uid === 'number' && + entry.uid !== this.processUid) || + (typeof entry.gid === 'number' && + entry.gid !== this.processGid))) || + (typeof this.uid === 'number' && + this.uid !== this.processUid) || + (typeof this.gid === 'number' && this.gid !== this.processGid)); + } + [UID](entry) { + return uint32(this.uid, entry.uid, this.processUid); + } + [GID](entry) { + return uint32(this.gid, entry.gid, this.processGid); + } + [FILE](entry, fullyDone) { + const mode = typeof entry.mode === 'number' ? + entry.mode & 0o7777 + : this.fmode; + const stream = new fsm.WriteStream(String(entry.absolute), { + // slight lie, but it can be numeric flags + flags: getWriteFlag(entry.size), + mode: mode, + autoClose: false, + }); + stream.on('error', (er) => { + if (stream.fd) { + fs.close(stream.fd, () => { }); + } + // flush all the data out so that we aren't left hanging + // if the error wasn't actually fatal. otherwise the parse + // is blocked, and we never proceed. + stream.write = () => true; + this[ONERROR](er, entry); + fullyDone(); + }); + let actions = 1; + const done = (er) => { + if (er) { + /* c8 ignore start - we should always have a fd by now */ + if (stream.fd) { + fs.close(stream.fd, () => { }); + } + /* c8 ignore stop */ + this[ONERROR](er, entry); + fullyDone(); + return; + } + if (--actions === 0) { + if (stream.fd !== undefined) { + fs.close(stream.fd, er => { + if (er) { + this[ONERROR](er, entry); + } + else { + this[UNPEND](); + } + fullyDone(); + }); + } + } + }; + stream.on('finish', () => { + // if futimes fails, try utimes + // if utimes fails, fail with the original error + // same for fchown/chown + const abs = String(entry.absolute); + const fd = stream.fd; + if (typeof fd === 'number' && entry.mtime && !this.noMtime) { + actions++; + const atime = entry.atime || new Date(); + const mtime = entry.mtime; + fs.futimes(fd, atime, mtime, er => er ? + fs.utimes(abs, atime, mtime, er2 => done(er2 && er)) + : done()); + } + if (typeof fd === 'number' && this[DOCHOWN](entry)) { + actions++; + const uid = this[UID](entry); + const gid = this[GID](entry); + if (typeof uid === 'number' && typeof gid === 'number') { + fs.fchown(fd, uid, gid, er => er ? + fs.chown(abs, uid, gid, er2 => done(er2 && er)) + : done()); + } + } + done(); + }); + const tx = this.transform ? this.transform(entry) || entry : entry; + if (tx !== entry) { + tx.on('error', (er) => { + this[ONERROR](er, entry); + fullyDone(); + }); + entry.pipe(tx); + } + tx.pipe(stream); + } + [DIRECTORY](entry, fullyDone) { + const mode = typeof entry.mode === 'number' ? + entry.mode & 0o7777 + : this.dmode; + this[MKDIR](String(entry.absolute), mode, er => { + if (er) { + this[ONERROR](er, entry); + fullyDone(); + return; + } + let actions = 1; + const done = () => { + if (--actions === 0) { + fullyDone(); + this[UNPEND](); + entry.resume(); + } + }; + if (entry.mtime && !this.noMtime) { + actions++; + fs.utimes(String(entry.absolute), entry.atime || new Date(), entry.mtime, done); + } + if (this[DOCHOWN](entry)) { + actions++; + fs.chown(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry)), done); + } + done(); + }); + } + [UNSUPPORTED](entry) { + entry.unsupported = true; + this.warn('TAR_ENTRY_UNSUPPORTED', `unsupported entry type: ${entry.type}`, { entry }); + entry.resume(); + } + [SYMLINK](entry, done) { + const parts = normalizeWindowsPath(path.relative(this.cwd, path.resolve(path.dirname(String(entry.absolute)), String(entry.linkpath)))).split('/'); + this[ENSURE_NO_SYMLINK](entry, this.cwd, parts, () => this[LINK](entry, String(entry.linkpath), 'symlink', done), er => { + this[ONERROR](er, entry); + done(); + }); + } + [HARDLINK](entry, done) { + const linkpath = normalizeWindowsPath(path.resolve(this.cwd, String(entry.linkpath))); + const parts = normalizeWindowsPath(String(entry.linkpath)).split('/'); + this[ENSURE_NO_SYMLINK](entry, this.cwd, parts, () => this[LINK](entry, linkpath, 'link', done), er => { + this[ONERROR](er, entry); + done(); + }); + } + [ENSURE_NO_SYMLINK](entry, cwd, parts, done, onError) { + const p = parts.shift(); + if (this.preservePaths || p === undefined) + return done(); + const t = path.resolve(cwd, p); + fs.lstat(t, (er, st) => { + if (er) + return done(); + if (st?.isSymbolicLink()) { + return onError(new SymlinkError(t, path.resolve(t, parts.join('/')))); + } + this[ENSURE_NO_SYMLINK](entry, t, parts, done, onError); + }); + } + [PEND]() { + this[PENDING]++; + } + [UNPEND]() { + this[PENDING]--; + this[MAYBECLOSE](); + } + [SKIP](entry) { + this[UNPEND](); + entry.resume(); + } + // Check if we can reuse an existing filesystem entry safely and + // overwrite it, rather than unlinking and recreating + // Windows doesn't report a useful nlink, so we just never reuse entries + [ISREUSABLE](entry, st) { + return (entry.type === 'File' && + !this.unlink && + st.isFile() && + st.nlink <= 1 && + !isWindows); + } + // check if a thing is there, and if so, try to clobber it + [CHECKFS](entry) { + this[PEND](); + const paths = [entry.path]; + if (entry.linkpath) { + paths.push(entry.linkpath); + } + this.reservations.reserve(paths, done => this[CHECKFS2](entry, done)); + } + [CHECKFS2](entry, fullyDone) { + const done = (er) => { + fullyDone(er); + }; + const checkCwd = () => { + this[MKDIR](this.cwd, this.dmode, er => { + if (er) { + this[ONERROR](er, entry); + done(); + return; + } + this[CHECKED_CWD] = true; + start(); + }); + }; + const start = () => { + if (entry.absolute !== this.cwd) { + const parent = normalizeWindowsPath(path.dirname(String(entry.absolute))); + if (parent !== this.cwd) { + return this[MKDIR](parent, this.dmode, er => { + if (er) { + this[ONERROR](er, entry); + done(); + return; + } + afterMakeParent(); + }); + } + } + afterMakeParent(); + }; + const afterMakeParent = () => { + fs.lstat(String(entry.absolute), (lstatEr, st) => { + if (st && + (this.keep || + /* c8 ignore next */ + (this.newer && st.mtime > (entry.mtime ?? st.mtime)))) { + this[SKIP](entry); + done(); + return; + } + if (lstatEr || this[ISREUSABLE](entry, st)) { + return this[MAKEFS](null, entry, done); + } + if (st.isDirectory()) { + if (entry.type === 'Directory') { + const needChmod = this.chmod && + entry.mode && + (st.mode & 0o7777) !== entry.mode; + const afterChmod = (er) => this[MAKEFS](er ?? null, entry, done); + if (!needChmod) { + return afterChmod(); + } + return fs.chmod(String(entry.absolute), Number(entry.mode), afterChmod); + } + // Not a dir entry, have to remove it. + // NB: the only way to end up with an entry that is the cwd + // itself, in such a way that == does not detect, is a + // tricky windows absolute path with UNC or 8.3 parts (and + // preservePaths:true, or else it will have been stripped). + // In that case, the user has opted out of path protections + // explicitly, so if they blow away the cwd, c'est la vie. + if (entry.absolute !== this.cwd) { + return fs.rmdir(String(entry.absolute), (er) => this[MAKEFS](er ?? null, entry, done)); + } + } + // not a dir, and not reusable + // don't remove if the cwd, we want that error + if (entry.absolute === this.cwd) { + return this[MAKEFS](null, entry, done); + } + unlinkFile(String(entry.absolute), er => this[MAKEFS](er ?? null, entry, done)); + }); + }; + if (this[CHECKED_CWD]) { + start(); + } + else { + checkCwd(); + } + } + [MAKEFS](er, entry, done) { + if (er) { + this[ONERROR](er, entry); + done(); + return; + } + switch (entry.type) { + case 'File': + case 'OldFile': + case 'ContiguousFile': + return this[FILE](entry, done); + case 'Link': + return this[HARDLINK](entry, done); + case 'SymbolicLink': + return this[SYMLINK](entry, done); + case 'Directory': + case 'GNUDumpDir': + return this[DIRECTORY](entry, done); + } + } + [LINK](entry, linkpath, link, done) { + fs[link](linkpath, String(entry.absolute), er => { + if (er) { + this[ONERROR](er, entry); + } + else { + this[UNPEND](); + entry.resume(); + } + done(); + }); + } +} +const callSync = (fn) => { + try { + return [null, fn()]; + } + catch (er) { + return [er, null]; + } +}; +export class UnpackSync extends Unpack { + sync = true; + [MAKEFS](er, entry) { + return super[MAKEFS](er, entry, () => { }); + } + [CHECKFS](entry) { + if (!this[CHECKED_CWD]) { + const er = this[MKDIR](this.cwd, this.dmode); + if (er) { + return this[ONERROR](er, entry); + } + this[CHECKED_CWD] = true; + } + // don't bother to make the parent if the current entry is the cwd, + // we've already checked it. + if (entry.absolute !== this.cwd) { + const parent = normalizeWindowsPath(path.dirname(String(entry.absolute))); + if (parent !== this.cwd) { + const mkParent = this[MKDIR](parent, this.dmode); + if (mkParent) { + return this[ONERROR](mkParent, entry); + } + } + } + const [lstatEr, st] = callSync(() => fs.lstatSync(String(entry.absolute))); + if (st && + (this.keep || + /* c8 ignore next */ + (this.newer && st.mtime > (entry.mtime ?? st.mtime)))) { + return this[SKIP](entry); + } + if (lstatEr || this[ISREUSABLE](entry, st)) { + return this[MAKEFS](null, entry); + } + if (st.isDirectory()) { + if (entry.type === 'Directory') { + const needChmod = this.chmod && + entry.mode && + (st.mode & 0o7777) !== entry.mode; + const [er] = needChmod ? + callSync(() => { + fs.chmodSync(String(entry.absolute), Number(entry.mode)); + }) + : []; + return this[MAKEFS](er, entry); + } + // not a dir entry, have to remove it + const [er] = callSync(() => fs.rmdirSync(String(entry.absolute))); + this[MAKEFS](er, entry); + } + // not a dir, and not reusable. + // don't remove if it's the cwd, since we want that error. + const [er] = entry.absolute === this.cwd ? + [] + : callSync(() => unlinkFileSync(String(entry.absolute))); + this[MAKEFS](er, entry); + } + [FILE](entry, done) { + const mode = typeof entry.mode === 'number' ? + entry.mode & 0o7777 + : this.fmode; + const oner = (er) => { + let closeError; + try { + fs.closeSync(fd); + } + catch (e) { + closeError = e; + } + if (er || closeError) { + this[ONERROR](er || closeError, entry); + } + done(); + }; + let fd; + try { + fd = fs.openSync(String(entry.absolute), getWriteFlag(entry.size), mode); + /* c8 ignore start - This is only a problem if the file was successfully + * statted, BUT failed to open. Testing this is annoying, and we + * already have ample testint for other uses of oner() methods. + */ + } + catch (er) { + return oner(er); + } + /* c8 ignore stop */ + const tx = this.transform ? this.transform(entry) || entry : entry; + if (tx !== entry) { + tx.on('error', (er) => this[ONERROR](er, entry)); + entry.pipe(tx); + } + tx.on('data', (chunk) => { + try { + fs.writeSync(fd, chunk, 0, chunk.length); + } + catch (er) { + oner(er); + } + }); + tx.on('end', () => { + let er = null; + // try both, falling futimes back to utimes + // if either fails, handle the first error + if (entry.mtime && !this.noMtime) { + const atime = entry.atime || new Date(); + const mtime = entry.mtime; + try { + fs.futimesSync(fd, atime, mtime); + } + catch (futimeser) { + try { + fs.utimesSync(String(entry.absolute), atime, mtime); + } + catch (utimeser) { + er = futimeser; + } + } + } + if (this[DOCHOWN](entry)) { + const uid = this[UID](entry); + const gid = this[GID](entry); + try { + fs.fchownSync(fd, Number(uid), Number(gid)); + } + catch (fchowner) { + try { + fs.chownSync(String(entry.absolute), Number(uid), Number(gid)); + } + catch (chowner) { + er = er || fchowner; + } + } + } + oner(er); + }); + } + [DIRECTORY](entry, done) { + const mode = typeof entry.mode === 'number' ? + entry.mode & 0o7777 + : this.dmode; + const er = this[MKDIR](String(entry.absolute), mode); + if (er) { + this[ONERROR](er, entry); + done(); + return; + } + if (entry.mtime && !this.noMtime) { + try { + fs.utimesSync(String(entry.absolute), entry.atime || new Date(), entry.mtime); + /* c8 ignore next */ + } + catch (er) { } + } + if (this[DOCHOWN](entry)) { + try { + fs.chownSync(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry))); + } + catch (er) { } + } + done(); + entry.resume(); + } + [MKDIR](dir, mode) { + try { + return mkdirSync(normalizeWindowsPath(dir), { + uid: this.uid, + gid: this.gid, + processUid: this.processUid, + processGid: this.processGid, + umask: this.processUmask, + preserve: this.preservePaths, + unlink: this.unlink, + cwd: this.cwd, + mode: mode, + }); + } + catch (er) { + return er; + } + } + [ENSURE_NO_SYMLINK](_entry, cwd, parts, done, onError) { + if (this.preservePaths || !parts.length) + return done(); + let t = cwd; + for (const p of parts) { + t = path.resolve(t, p); + const [er, st] = callSync(() => fs.lstatSync(t)); + if (er) + return done(); + if (st.isSymbolicLink()) { + return onError(new SymlinkError(t, path.resolve(cwd, parts.join('/')))); + } + } + done(); + } + [LINK](entry, linkpath, link, done) { + const linkSync = `${link}Sync`; + try { + fs[linkSync](linkpath, String(entry.absolute)); + done(); + entry.resume(); + } + catch (er) { + return this[ONERROR](er, entry); + } + } +} +//# sourceMappingURL=unpack.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/unpack.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/unpack.js.map new file mode 100644 index 0000000..62505f3 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/unpack.js.map @@ -0,0 +1 @@ +{"version":3,"file":"unpack.js","sourceRoot":"","sources":["../../src/unpack.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AACxE,8DAA8D;AAE9D,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAA;AAC1C,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAkB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A;QACtD,IAAI,CAAC,GAAG,GAAG,CAAA;QACX,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;YACtB,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;YAChD,IAAI,EAAE;gBAAE,OAAO,IAAI,EAAE,CAAA;YACrB,IAAI,EAAE,CAAC,cAAc,EAAE,EAAE,CAAC;gBACxB,OAAO,OAAO,CACZ,IAAI,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CACxD,CAAA;YACH,CAAC;QACH,CAAC;QACD,IAAI,EAAE,CAAA;IACR,CAAC;IAED,CAAC,IAAI,CAAC,CACJ,KAAgB,EAChB,QAAgB,EAChB,IAAwB,EACxB,IAAgB;QAEhB,MAAM,QAAQ,GAAyB,GAAG,IAAI,MAAM,CAAA;QACpD,IAAI,CAAC;YACH,EAAE,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;YAC9C,IAAI,EAAE,CAAA;YACN,KAAK,CAAC,MAAM,EAAE,CAAA;QAChB,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC;YACZ,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,EAAW,EAAE,KAAK,CAAC,CAAA;QAC1C,CAAC;IACH,CAAC;CACF","sourcesContent":["// the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet.\n// but the path reservations are required to avoid race conditions where\n// parallelized unpack ops may mess with one another, due to dependencies\n// (like a Link depending on its target) or destructive operations (like\n// clobbering an fs object to create one of a different type.)\n\nimport * as fsm from '@isaacs/fs-minipass'\nimport assert from 'node:assert'\nimport { randomBytes } from 'node:crypto'\nimport fs, { type Stats } from 'node:fs'\nimport path from 'node:path'\nimport { getWriteFlag } from './get-write-flag.js'\nimport { mkdir, MkdirError, mkdirSync } from './mkdir.js'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport { Parser } from './parse.js'\nimport { stripAbsolutePath } from './strip-absolute-path.js'\nimport * as wc from './winchars.js'\n\nimport { TarOptions } from './options.js'\nimport { PathReservations } from './path-reservations.js'\nimport { ReadEntry } from './read-entry.js'\nimport { WarnData } from './warn-method.js'\nimport { SymlinkError } from './symlink-error.js'\nimport { umask } from './process-umask.js'\n\nconst ONENTRY = Symbol('onEntry')\nconst CHECKFS = Symbol('checkFs')\nconst CHECKFS2 = Symbol('checkFs2')\nconst ISREUSABLE = Symbol('isReusable')\nconst MAKEFS = Symbol('makeFs')\nconst FILE = Symbol('file')\nconst DIRECTORY = Symbol('directory')\nconst LINK = Symbol('link')\nconst SYMLINK = Symbol('symlink')\nconst HARDLINK = Symbol('hardlink')\nconst ENSURE_NO_SYMLINK = Symbol('ensureNoSymlink')\nconst UNSUPPORTED = Symbol('unsupported')\nconst CHECKPATH = Symbol('checkPath')\nconst STRIPABSOLUTEPATH = Symbol('stripAbsolutePath')\nconst MKDIR = Symbol('mkdir')\nconst ONERROR = Symbol('onError')\nconst PENDING = Symbol('pending')\nconst PEND = Symbol('pend')\nconst UNPEND = Symbol('unpend')\nconst ENDED = Symbol('ended')\nconst MAYBECLOSE = Symbol('maybeClose')\nconst SKIP = Symbol('skip')\nconst DOCHOWN = Symbol('doChown')\nconst UID = Symbol('uid')\nconst GID = Symbol('gid')\nconst CHECKED_CWD = Symbol('checkedCwd')\nconst platform =\n process.env.TESTING_TAR_FAKE_PLATFORM || process.platform\nconst isWindows = platform === 'win32'\nconst DEFAULT_MAX_DEPTH = 1024\n\n// Unlinks on Windows are not atomic.\n//\n// This means that if you have a file entry, followed by another\n// file entry with an identical name, and you cannot re-use the file\n// (because it's a hardlink, or because unlink:true is set, or it's\n// Windows, which does not have useful nlink values), then the unlink\n// will be committed to the disk AFTER the new file has been written\n// over the old one, deleting the new file.\n//\n// To work around this, on Windows systems, we rename the file and then\n// delete the renamed file. It's a sloppy kludge, but frankly, I do not\n// know of a better way to do this, given windows' non-atomic unlink\n// semantics.\n//\n// See: https://github.com/npm/node-tar/issues/183\n/* c8 ignore start */\nconst unlinkFile = (\n path: string,\n cb: (er?: Error | null) => void,\n) => {\n if (!isWindows) {\n return fs.unlink(path, cb)\n }\n\n const name = path + '.DELETE.' + randomBytes(16).toString('hex')\n fs.rename(path, name, er => {\n if (er) {\n return cb(er)\n }\n fs.unlink(name, cb)\n })\n}\n/* c8 ignore stop */\n\n/* c8 ignore start */\nconst unlinkFileSync = (path: string) => {\n if (!isWindows) {\n return fs.unlinkSync(path)\n }\n\n const name = path + '.DELETE.' + randomBytes(16).toString('hex')\n fs.renameSync(path, name)\n fs.unlinkSync(name)\n}\n/* c8 ignore stop */\n\n// this.gid, entry.gid, this.processUid\nconst uint32 = (\n a: number | undefined,\n b: number | undefined,\n c: number | undefined,\n) =>\n a !== undefined && a === a >>> 0 ? a\n : b !== undefined && b === b >>> 0 ? b\n : c\n\nexport class Unpack extends Parser {\n [ENDED]: boolean = false;\n [CHECKED_CWD]: boolean = false;\n [PENDING]: number = 0\n\n reservations: PathReservations = new PathReservations()\n transform?: TarOptions['transform']\n writable: true = true\n readable: false = false\n uid?: number\n gid?: number\n setOwner: boolean\n preserveOwner: boolean\n processGid?: number\n processUid?: number\n maxDepth: number\n forceChown: boolean\n win32: boolean\n newer: boolean\n keep: boolean\n noMtime: boolean\n preservePaths: boolean\n unlink: boolean\n cwd: string\n strip: number\n processUmask: number\n umask: number\n dmode: number\n fmode: number\n chmod: boolean\n\n constructor(opt: TarOptions = {}) {\n opt.ondone = () => {\n this[ENDED] = true\n this[MAYBECLOSE]()\n }\n\n super(opt)\n\n this.transform = opt.transform\n\n this.chmod = !!opt.chmod\n\n if (typeof opt.uid === 'number' || typeof opt.gid === 'number') {\n // need both or neither\n if (\n typeof opt.uid !== 'number' ||\n typeof opt.gid !== 'number'\n ) {\n throw new TypeError(\n 'cannot set owner without number uid and gid',\n )\n }\n if (opt.preserveOwner) {\n throw new TypeError(\n 'cannot preserve owner in archive and also set owner explicitly',\n )\n }\n this.uid = opt.uid\n this.gid = opt.gid\n this.setOwner = true\n } else {\n this.uid = undefined\n this.gid = undefined\n this.setOwner = false\n }\n\n // default true for root\n if (\n opt.preserveOwner === undefined &&\n typeof opt.uid !== 'number'\n ) {\n this.preserveOwner = !!(\n process.getuid && process.getuid() === 0\n )\n } else {\n this.preserveOwner = !!opt.preserveOwner\n }\n\n this.processUid =\n (this.preserveOwner || this.setOwner) && process.getuid ?\n process.getuid()\n : undefined\n this.processGid =\n (this.preserveOwner || this.setOwner) && process.getgid ?\n process.getgid()\n : undefined\n\n // prevent excessively deep nesting of subfolders\n // set to `Infinity` to remove this restriction\n this.maxDepth =\n typeof opt.maxDepth === 'number' ?\n opt.maxDepth\n : DEFAULT_MAX_DEPTH\n\n // mostly just for testing, but useful in some cases.\n // Forcibly trigger a chown on every entry, no matter what\n this.forceChown = opt.forceChown === true\n\n // turn > this[ONENTRY](entry))\n }\n\n // a bad or damaged archive is a warning for Parser, but an error\n // when extracting. Mark those errors as unrecoverable, because\n // the Unpack contract cannot be met.\n warn(code: string, msg: string | Error, data: WarnData = {}) {\n if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') {\n data.recoverable = false\n }\n return super.warn(code, msg, data)\n }\n\n [MAYBECLOSE]() {\n if (this[ENDED] && this[PENDING] === 0) {\n this.emit('prefinish')\n this.emit('finish')\n this.emit('end')\n }\n }\n\n // return false if we need to skip this file\n // return true if the field was successfully sanitized\n [STRIPABSOLUTEPATH](\n entry: ReadEntry,\n field: 'path' | 'linkpath',\n ): boolean {\n const p = entry[field]\n const { type } = entry\n if (!p || this.preservePaths) return true\n\n const parts = p.split('/')\n\n if (\n parts.includes('..') ||\n /* c8 ignore next */\n (isWindows && /^[a-z]:\\.\\.$/i.test(parts[0] ?? ''))\n ) {\n // For linkpath, check if the resolved path escapes cwd rather than\n // just rejecting any path with '..' - relative symlinks like\n // '../sibling/file' are valid if they resolve within the cwd.\n // For paths, they just simply may not ever use .. at all.\n if (field === 'path' || type === 'Link') {\n this.warn('TAR_ENTRY_ERROR', `${field} contains '..'`, {\n entry,\n [field]: p,\n })\n // not ok!\n return false\n } else {\n // Resolve linkpath relative to the entry's directory.\n // `path.posix` is safe to use because we're operating on\n // tar paths, not a filesystem.\n const entryDir = path.posix.dirname(entry.path)\n const resolved = path.posix.normalize(\n path.posix.join(entryDir, p),\n )\n // If the resolved path escapes (starts with ..), reject it\n if (resolved.startsWith('../') || resolved === '..') {\n this.warn(\n 'TAR_ENTRY_ERROR',\n `${field} escapes extraction directory`,\n {\n entry,\n [field]: p,\n },\n )\n return false\n }\n }\n }\n\n // strip off the root\n const [root, stripped] = stripAbsolutePath(p)\n if (root) {\n // ok, but triggers warning about stripping root\n entry[field] = String(stripped)\n this.warn(\n 'TAR_ENTRY_INFO',\n `stripping ${root} from absolute ${field}`,\n {\n entry,\n [field]: p,\n },\n )\n }\n return true\n }\n\n // no IO, just string checking for absolute indicators\n [CHECKPATH](entry: ReadEntry) {\n const p = normalizeWindowsPath(entry.path)\n const parts = p.split('/')\n\n if (this.strip) {\n if (parts.length < this.strip) {\n return false\n }\n if (entry.type === 'Link') {\n const linkparts = normalizeWindowsPath(\n String(entry.linkpath),\n ).split('/')\n if (linkparts.length >= this.strip) {\n entry.linkpath = linkparts.slice(this.strip).join('/')\n } else {\n return false\n }\n }\n parts.splice(0, this.strip)\n entry.path = parts.join('/')\n }\n\n if (isFinite(this.maxDepth) && parts.length > this.maxDepth) {\n this.warn('TAR_ENTRY_ERROR', 'path excessively deep', {\n entry,\n path: p,\n depth: parts.length,\n maxDepth: this.maxDepth,\n })\n return false\n }\n\n if (\n !this[STRIPABSOLUTEPATH](entry, 'path') ||\n !this[STRIPABSOLUTEPATH](entry, 'linkpath')\n ) {\n return false\n }\n\n if (path.isAbsolute(entry.path)) {\n entry.absolute = normalizeWindowsPath(path.resolve(entry.path))\n } else {\n entry.absolute = normalizeWindowsPath(\n path.resolve(this.cwd, entry.path),\n )\n }\n\n // if we somehow ended up with a path that escapes the cwd, and we are\n // not in preservePaths mode, then something is fishy! This should have\n // been prevented above, so ignore this for coverage.\n /* c8 ignore start - defense in depth */\n if (\n !this.preservePaths &&\n typeof entry.absolute === 'string' &&\n entry.absolute.indexOf(this.cwd + '/') !== 0 &&\n entry.absolute !== this.cwd\n ) {\n this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', {\n entry,\n path: normalizeWindowsPath(entry.path),\n resolvedPath: entry.absolute,\n cwd: this.cwd,\n })\n return false\n }\n /* c8 ignore stop */\n\n // an archive can set properties on the extraction directory, but it\n // may not replace the cwd with a different kind of thing entirely.\n if (\n entry.absolute === this.cwd &&\n entry.type !== 'Directory' &&\n entry.type !== 'GNUDumpDir'\n ) {\n return false\n }\n\n // only encode : chars that aren't drive letter indicators\n if (this.win32) {\n const { root: aRoot } = path.win32.parse(String(entry.absolute))\n entry.absolute =\n aRoot + wc.encode(String(entry.absolute).slice(aRoot.length))\n const { root: pRoot } = path.win32.parse(entry.path)\n entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length))\n }\n\n return true\n }\n\n [ONENTRY](entry: ReadEntry) {\n if (!this[CHECKPATH](entry)) {\n return entry.resume()\n }\n\n assert.equal(typeof entry.absolute, 'string')\n\n switch (entry.type) {\n case 'Directory':\n case 'GNUDumpDir':\n if (entry.mode) {\n entry.mode = entry.mode | 0o700\n }\n\n // eslint-disable-next-line no-fallthrough\n case 'File':\n case 'OldFile':\n case 'ContiguousFile':\n case 'Link':\n case 'SymbolicLink':\n return this[CHECKFS](entry)\n\n case 'CharacterDevice':\n case 'BlockDevice':\n case 'FIFO':\n default:\n return this[UNSUPPORTED](entry)\n }\n }\n\n [ONERROR](er: Error, entry: ReadEntry) {\n // Cwd has to exist, or else nothing works. That's serious.\n // Other errors are warnings, which raise the error in strict\n // mode, but otherwise continue on.\n if (er.name === 'CwdError') {\n this.emit('error', er)\n } else {\n this.warn('TAR_ENTRY_ERROR', er, { entry })\n this[UNPEND]()\n entry.resume()\n }\n }\n\n [MKDIR](\n dir: string,\n mode: number,\n cb: (er?: null | MkdirError, made?: string) => void,\n ) {\n mkdir(\n normalizeWindowsPath(dir),\n {\n uid: this.uid,\n gid: this.gid,\n processUid: this.processUid,\n processGid: this.processGid,\n umask: this.processUmask,\n preserve: this.preservePaths,\n unlink: this.unlink,\n cwd: this.cwd,\n mode: mode,\n },\n cb,\n )\n }\n\n [DOCHOWN](entry: ReadEntry) {\n // in preserve owner mode, chown if the entry doesn't match process\n // in set owner mode, chown if setting doesn't match process\n return (\n this.forceChown ||\n (this.preserveOwner &&\n ((typeof entry.uid === 'number' &&\n entry.uid !== this.processUid) ||\n (typeof entry.gid === 'number' &&\n entry.gid !== this.processGid))) ||\n (typeof this.uid === 'number' &&\n this.uid !== this.processUid) ||\n (typeof this.gid === 'number' && this.gid !== this.processGid)\n )\n }\n\n [UID](entry: ReadEntry) {\n return uint32(this.uid, entry.uid, this.processUid)\n }\n\n [GID](entry: ReadEntry) {\n return uint32(this.gid, entry.gid, this.processGid)\n }\n\n [FILE](entry: ReadEntry, fullyDone: () => void) {\n const mode =\n typeof entry.mode === 'number' ?\n entry.mode & 0o7777\n : this.fmode\n const stream = new fsm.WriteStream(String(entry.absolute), {\n // slight lie, but it can be numeric flags\n flags: getWriteFlag(entry.size) as string,\n mode: mode,\n autoClose: false,\n })\n stream.on('error', (er: Error) => {\n if (stream.fd) {\n fs.close(stream.fd, () => {})\n }\n\n // flush all the data out so that we aren't left hanging\n // if the error wasn't actually fatal. otherwise the parse\n // is blocked, and we never proceed.\n stream.write = () => true\n this[ONERROR](er, entry)\n fullyDone()\n })\n\n let actions = 1\n const done = (er?: null | Error) => {\n if (er) {\n /* c8 ignore start - we should always have a fd by now */\n if (stream.fd) {\n fs.close(stream.fd, () => {})\n }\n /* c8 ignore stop */\n\n this[ONERROR](er, entry)\n fullyDone()\n return\n }\n\n if (--actions === 0) {\n if (stream.fd !== undefined) {\n fs.close(stream.fd, er => {\n if (er) {\n this[ONERROR](er, entry)\n } else {\n this[UNPEND]()\n }\n fullyDone()\n })\n }\n }\n }\n\n stream.on('finish', () => {\n // if futimes fails, try utimes\n // if utimes fails, fail with the original error\n // same for fchown/chown\n const abs = String(entry.absolute)\n const fd = stream.fd\n\n if (typeof fd === 'number' && entry.mtime && !this.noMtime) {\n actions++\n const atime = entry.atime || new Date()\n const mtime = entry.mtime\n fs.futimes(fd, atime, mtime, er =>\n er ?\n fs.utimes(abs, atime, mtime, er2 => done(er2 && er))\n : done(),\n )\n }\n\n if (typeof fd === 'number' && this[DOCHOWN](entry)) {\n actions++\n const uid = this[UID](entry)\n const gid = this[GID](entry)\n if (typeof uid === 'number' && typeof gid === 'number') {\n fs.fchown(fd, uid, gid, er =>\n er ?\n fs.chown(abs, uid, gid, er2 => done(er2 && er))\n : done(),\n )\n }\n }\n\n done()\n })\n\n const tx = this.transform ? this.transform(entry) || entry : entry\n if (tx !== entry) {\n tx.on('error', (er: Error) => {\n this[ONERROR](er, entry)\n fullyDone()\n })\n entry.pipe(tx)\n }\n tx.pipe(stream)\n }\n\n [DIRECTORY](entry: ReadEntry, fullyDone: () => void) {\n const mode =\n typeof entry.mode === 'number' ?\n entry.mode & 0o7777\n : this.dmode\n this[MKDIR](String(entry.absolute), mode, er => {\n if (er) {\n this[ONERROR](er, entry)\n fullyDone()\n return\n }\n\n let actions = 1\n const done = () => {\n if (--actions === 0) {\n fullyDone()\n this[UNPEND]()\n entry.resume()\n }\n }\n\n if (entry.mtime && !this.noMtime) {\n actions++\n fs.utimes(\n String(entry.absolute),\n entry.atime || new Date(),\n entry.mtime,\n done,\n )\n }\n\n if (this[DOCHOWN](entry)) {\n actions++\n fs.chown(\n String(entry.absolute),\n Number(this[UID](entry)),\n Number(this[GID](entry)),\n done,\n )\n }\n\n done()\n })\n }\n\n [UNSUPPORTED](entry: ReadEntry) {\n entry.unsupported = true\n this.warn(\n 'TAR_ENTRY_UNSUPPORTED',\n `unsupported entry type: ${entry.type}`,\n { entry },\n )\n entry.resume()\n }\n\n [SYMLINK](entry: ReadEntry, done: () => void) {\n const parts = normalizeWindowsPath(\n path.relative(\n this.cwd,\n path.resolve(\n path.dirname(String(entry.absolute)),\n String(entry.linkpath),\n ),\n ),\n ).split('/')\n this[ENSURE_NO_SYMLINK](\n entry,\n this.cwd,\n parts,\n () =>\n this[LINK](entry, String(entry.linkpath), 'symlink', done),\n er => {\n this[ONERROR](er, entry)\n done()\n },\n )\n }\n\n [HARDLINK](entry: ReadEntry, done: () => void) {\n const linkpath = normalizeWindowsPath(\n path.resolve(this.cwd, String(entry.linkpath)),\n )\n const parts = normalizeWindowsPath(String(entry.linkpath)).split(\n '/',\n )\n this[ENSURE_NO_SYMLINK](\n entry,\n this.cwd,\n parts,\n () => this[LINK](entry, linkpath, 'link', done),\n er => {\n this[ONERROR](er, entry)\n done()\n },\n )\n }\n\n [ENSURE_NO_SYMLINK](\n entry: ReadEntry,\n cwd: string,\n parts: string[],\n done: () => void,\n onError: (er: SymlinkError) => void,\n ) {\n const p = parts.shift()\n if (this.preservePaths || p === undefined) return done()\n const t = path.resolve(cwd, p)\n fs.lstat(t, (er, st) => {\n if (er) return done()\n if (st?.isSymbolicLink()) {\n return onError(\n new SymlinkError(t, path.resolve(t, parts.join('/'))),\n )\n }\n this[ENSURE_NO_SYMLINK](entry, t, parts, done, onError)\n })\n }\n\n [PEND]() {\n this[PENDING]++\n }\n\n [UNPEND]() {\n this[PENDING]--\n this[MAYBECLOSE]()\n }\n\n [SKIP](entry: ReadEntry) {\n this[UNPEND]()\n entry.resume()\n }\n\n // Check if we can reuse an existing filesystem entry safely and\n // overwrite it, rather than unlinking and recreating\n // Windows doesn't report a useful nlink, so we just never reuse entries\n [ISREUSABLE](entry: ReadEntry, st: Stats) {\n return (\n entry.type === 'File' &&\n !this.unlink &&\n st.isFile() &&\n st.nlink <= 1 &&\n !isWindows\n )\n }\n\n // check if a thing is there, and if so, try to clobber it\n [CHECKFS](entry: ReadEntry) {\n this[PEND]()\n const paths = [entry.path]\n if (entry.linkpath) {\n paths.push(entry.linkpath)\n }\n this.reservations.reserve(paths, done =>\n this[CHECKFS2](entry, done),\n )\n }\n\n [CHECKFS2](entry: ReadEntry, fullyDone: (er?: Error) => void) {\n const done = (er?: Error) => {\n fullyDone(er)\n }\n\n const checkCwd = () => {\n this[MKDIR](this.cwd, this.dmode, er => {\n if (er) {\n this[ONERROR](er, entry)\n done()\n return\n }\n this[CHECKED_CWD] = true\n start()\n })\n }\n\n const start = () => {\n if (entry.absolute !== this.cwd) {\n const parent = normalizeWindowsPath(\n path.dirname(String(entry.absolute)),\n )\n if (parent !== this.cwd) {\n return this[MKDIR](parent, this.dmode, er => {\n if (er) {\n this[ONERROR](er, entry)\n done()\n return\n }\n afterMakeParent()\n })\n }\n }\n afterMakeParent()\n }\n\n const afterMakeParent = () => {\n fs.lstat(String(entry.absolute), (lstatEr, st) => {\n if (\n st &&\n (this.keep ||\n /* c8 ignore next */\n (this.newer && st.mtime > (entry.mtime ?? st.mtime)))\n ) {\n this[SKIP](entry)\n done()\n return\n }\n if (lstatEr || this[ISREUSABLE](entry, st)) {\n return this[MAKEFS](null, entry, done)\n }\n\n if (st.isDirectory()) {\n if (entry.type === 'Directory') {\n const needChmod =\n this.chmod &&\n entry.mode &&\n (st.mode & 0o7777) !== entry.mode\n const afterChmod = (er?: Error | null | undefined) =>\n this[MAKEFS](er ?? null, entry, done)\n if (!needChmod) {\n return afterChmod()\n }\n return fs.chmod(\n String(entry.absolute),\n Number(entry.mode),\n afterChmod,\n )\n }\n // Not a dir entry, have to remove it.\n // NB: the only way to end up with an entry that is the cwd\n // itself, in such a way that == does not detect, is a\n // tricky windows absolute path with UNC or 8.3 parts (and\n // preservePaths:true, or else it will have been stripped).\n // In that case, the user has opted out of path protections\n // explicitly, so if they blow away the cwd, c'est la vie.\n if (entry.absolute !== this.cwd) {\n return fs.rmdir(\n String(entry.absolute),\n (er?: null | Error) =>\n this[MAKEFS](er ?? null, entry, done),\n )\n }\n }\n\n // not a dir, and not reusable\n // don't remove if the cwd, we want that error\n if (entry.absolute === this.cwd) {\n return this[MAKEFS](null, entry, done)\n }\n\n unlinkFile(String(entry.absolute), er =>\n this[MAKEFS](er ?? null, entry, done),\n )\n })\n }\n\n if (this[CHECKED_CWD]) {\n start()\n } else {\n checkCwd()\n }\n }\n\n [MAKEFS](\n er: null | undefined | Error,\n entry: ReadEntry,\n done: () => void,\n ) {\n if (er) {\n this[ONERROR](er, entry)\n done()\n return\n }\n\n switch (entry.type) {\n case 'File':\n case 'OldFile':\n case 'ContiguousFile':\n return this[FILE](entry, done)\n\n case 'Link':\n return this[HARDLINK](entry, done)\n\n case 'SymbolicLink':\n return this[SYMLINK](entry, done)\n\n case 'Directory':\n case 'GNUDumpDir':\n return this[DIRECTORY](entry, done)\n }\n }\n\n [LINK](\n entry: ReadEntry,\n linkpath: string,\n link: 'link' | 'symlink',\n done: () => void,\n ) {\n fs[link](linkpath, String(entry.absolute), er => {\n if (er) {\n this[ONERROR](er, entry)\n } else {\n this[UNPEND]()\n entry.resume()\n }\n done()\n })\n }\n}\n\nconst callSync = (\n fn: () => T,\n): [null, T] | [NodeJS.ErrnoException, null] => {\n try {\n return [null, fn()]\n } catch (er) {\n return [er as NodeJS.ErrnoException, null]\n }\n}\n\nexport class UnpackSync extends Unpack {\n sync: true = true;\n\n [MAKEFS](er: null | Error | undefined, entry: ReadEntry) {\n return super[MAKEFS](er, entry, () => {})\n }\n\n [CHECKFS](entry: ReadEntry) {\n if (!this[CHECKED_CWD]) {\n const er = this[MKDIR](this.cwd, this.dmode)\n if (er) {\n return this[ONERROR](er as Error, entry)\n }\n this[CHECKED_CWD] = true\n }\n\n // don't bother to make the parent if the current entry is the cwd,\n // we've already checked it.\n if (entry.absolute !== this.cwd) {\n const parent = normalizeWindowsPath(\n path.dirname(String(entry.absolute)),\n )\n if (parent !== this.cwd) {\n const mkParent = this[MKDIR](parent, this.dmode)\n if (mkParent) {\n return this[ONERROR](mkParent as Error, entry)\n }\n }\n }\n\n const [lstatEr, st] = callSync(() =>\n fs.lstatSync(String(entry.absolute)),\n )\n if (\n st &&\n (this.keep ||\n /* c8 ignore next */\n (this.newer && st.mtime > (entry.mtime ?? st.mtime)))\n ) {\n return this[SKIP](entry)\n }\n\n if (lstatEr || this[ISREUSABLE](entry, st)) {\n return this[MAKEFS](null, entry)\n }\n\n if (st.isDirectory()) {\n if (entry.type === 'Directory') {\n const needChmod =\n this.chmod &&\n entry.mode &&\n (st.mode & 0o7777) !== entry.mode\n const [er] =\n needChmod ?\n callSync(() => {\n fs.chmodSync(String(entry.absolute), Number(entry.mode))\n })\n : []\n return this[MAKEFS](er, entry)\n }\n // not a dir entry, have to remove it\n const [er] = callSync(() =>\n fs.rmdirSync(String(entry.absolute)),\n )\n this[MAKEFS](er, entry)\n }\n\n // not a dir, and not reusable.\n // don't remove if it's the cwd, since we want that error.\n const [er] =\n entry.absolute === this.cwd ?\n []\n : callSync(() => unlinkFileSync(String(entry.absolute)))\n this[MAKEFS](er, entry)\n }\n\n [FILE](entry: ReadEntry, done: () => void) {\n const mode =\n typeof entry.mode === 'number' ?\n entry.mode & 0o7777\n : this.fmode\n\n const oner = (er?: null | Error | undefined) => {\n let closeError\n try {\n fs.closeSync(fd)\n } catch (e) {\n closeError = e\n }\n if (er || closeError) {\n this[ONERROR]((er as Error) || closeError, entry)\n }\n done()\n }\n\n let fd: number\n try {\n fd = fs.openSync(\n String(entry.absolute),\n getWriteFlag(entry.size),\n mode,\n )\n /* c8 ignore start - This is only a problem if the file was successfully\n * statted, BUT failed to open. Testing this is annoying, and we\n * already have ample testint for other uses of oner() methods.\n */\n } catch (er) {\n return oner(er as Error)\n }\n /* c8 ignore stop */\n const tx = this.transform ? this.transform(entry) || entry : entry\n if (tx !== entry) {\n tx.on('error', (er: Error) => this[ONERROR](er, entry))\n entry.pipe(tx)\n }\n\n tx.on('data', (chunk: Buffer) => {\n try {\n fs.writeSync(fd, chunk, 0, chunk.length)\n } catch (er) {\n oner(er as Error)\n }\n })\n\n tx.on('end', () => {\n let er = null\n // try both, falling futimes back to utimes\n // if either fails, handle the first error\n if (entry.mtime && !this.noMtime) {\n const atime = entry.atime || new Date()\n const mtime = entry.mtime\n try {\n fs.futimesSync(fd, atime, mtime)\n } catch (futimeser) {\n try {\n fs.utimesSync(String(entry.absolute), atime, mtime)\n } catch (utimeser) {\n er = futimeser\n }\n }\n }\n\n if (this[DOCHOWN](entry)) {\n const uid = this[UID](entry)\n const gid = this[GID](entry)\n\n try {\n fs.fchownSync(fd, Number(uid), Number(gid))\n } catch (fchowner) {\n try {\n fs.chownSync(\n String(entry.absolute),\n Number(uid),\n Number(gid),\n )\n } catch (chowner) {\n er = er || fchowner\n }\n }\n }\n\n oner(er as Error)\n })\n }\n\n [DIRECTORY](entry: ReadEntry, done: () => void) {\n const mode =\n typeof entry.mode === 'number' ?\n entry.mode & 0o7777\n : this.dmode\n const er = this[MKDIR](String(entry.absolute), mode)\n if (er) {\n this[ONERROR](er as Error, entry)\n done()\n return\n }\n if (entry.mtime && !this.noMtime) {\n try {\n fs.utimesSync(\n String(entry.absolute),\n entry.atime || new Date(),\n entry.mtime,\n )\n /* c8 ignore next */\n } catch (er) {}\n }\n if (this[DOCHOWN](entry)) {\n try {\n fs.chownSync(\n String(entry.absolute),\n Number(this[UID](entry)),\n Number(this[GID](entry)),\n )\n } catch (er) {}\n }\n done()\n entry.resume()\n }\n\n [MKDIR](dir: string, mode: number) {\n try {\n return mkdirSync(normalizeWindowsPath(dir), {\n uid: this.uid,\n gid: this.gid,\n processUid: this.processUid,\n processGid: this.processGid,\n umask: this.processUmask,\n preserve: this.preservePaths,\n unlink: this.unlink,\n cwd: this.cwd,\n mode: mode,\n })\n } catch (er) {\n return er\n }\n }\n\n [ENSURE_NO_SYMLINK](\n _entry: ReadEntry,\n cwd: string,\n parts: string[],\n done: () => void,\n onError: (er: SymlinkError) => void,\n ) {\n if (this.preservePaths || !parts.length) return done()\n let t = cwd\n for (const p of parts) {\n t = path.resolve(t, p)\n const [er, st] = callSync(() => fs.lstatSync(t))\n if (er) return done()\n if (st.isSymbolicLink()) {\n return onError(\n new SymlinkError(t, path.resolve(cwd, parts.join('/'))),\n )\n }\n }\n done()\n }\n\n [LINK](\n entry: ReadEntry,\n linkpath: string,\n link: 'link' | 'symlink',\n done: () => void,\n ) {\n const linkSync: `${typeof link}Sync` = `${link}Sync`\n try {\n fs[linkSync](linkpath, String(entry.absolute))\n done()\n entry.resume()\n } catch (er) {\n return this[ONERROR](er as Error, entry)\n }\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/update.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/update.d.ts new file mode 100644 index 0000000..45784eb --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/update.d.ts @@ -0,0 +1,2 @@ +export declare const update: import("./make-command.js").TarCommand; +//# sourceMappingURL=update.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/update.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/update.d.ts.map new file mode 100644 index 0000000..4f2ff18 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/update.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/update.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,MAAM,sDASlB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/update.js b/node_modules/cmake-js/node_modules/tar/dist/esm/update.js new file mode 100644 index 0000000..21398e9 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/update.js @@ -0,0 +1,30 @@ +// tar -u +import { makeCommand } from './make-command.js'; +import { replace as r } from './replace.js'; +// just call tar.r with the filter and mtimeCache +export const update = makeCommand(r.syncFile, r.asyncFile, r.syncNoFile, r.asyncNoFile, (opt, entries = []) => { + r.validate?.(opt, entries); + mtimeFilter(opt); +}); +const mtimeFilter = (opt) => { + const filter = opt.filter; + if (!opt.mtimeCache) { + opt.mtimeCache = new Map(); + } + opt.filter = + filter ? + (path, stat) => filter(path, stat) && + !( + /* c8 ignore start */ + ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) > + (stat.mtime ?? 0)) + /* c8 ignore stop */ + ) + : (path, stat) => !( + /* c8 ignore start */ + ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) > + (stat.mtime ?? 0)) + /* c8 ignore stop */ + ); +}; +//# sourceMappingURL=update.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/update.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/update.js.map new file mode 100644 index 0000000..611fae1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/update.js.map @@ -0,0 +1 @@ +{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/update.ts"],"names":[],"mappings":"AAAA,SAAS;AAET,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAG/C,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,cAAc,CAAA;AAE3C,iDAAiD;AACjD,MAAM,CAAC,MAAM,MAAM,GAAG,WAAW,CAC/B,CAAC,CAAC,QAAQ,EACV,CAAC,CAAC,SAAS,EACX,CAAC,CAAC,UAAU,EACZ,CAAC,CAAC,WAAW,EACb,CAAC,GAAG,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE;IACpB,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAC1B,WAAW,CAAC,GAAG,CAAC,CAAA;AAClB,CAAC,CACF,CAAA;AAED,MAAM,WAAW,GAAG,CAAC,GAA0B,EAAE,EAAE;IACjD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;IAEzB,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;QACpB,GAAG,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAAA;IAC5B,CAAC;IAED,GAAG,CAAC,MAAM;QACR,MAAM,CAAC,CAAC;YACN,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CACb,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC;gBAClB,CAAC;gBACC,qBAAqB;gBACrB,CACE,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;oBAC9C,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAClB;gBACD,oBAAoB;iBACrB;YACL,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CACb,CAAC;YACC,qBAAqB;YACrB,CACE,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;gBAC9C,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAClB;YACD,oBAAoB;aACrB,CAAA;AACT,CAAC,CAAA","sourcesContent":["// tar -u\n\nimport { makeCommand } from './make-command.js'\nimport { type TarOptionsWithAliases } from './options.js'\n\nimport { replace as r } from './replace.js'\n\n// just call tar.r with the filter and mtimeCache\nexport const update = makeCommand(\n r.syncFile,\n r.asyncFile,\n r.syncNoFile,\n r.asyncNoFile,\n (opt, entries = []) => {\n r.validate?.(opt, entries)\n mtimeFilter(opt)\n },\n)\n\nconst mtimeFilter = (opt: TarOptionsWithAliases) => {\n const filter = opt.filter\n\n if (!opt.mtimeCache) {\n opt.mtimeCache = new Map()\n }\n\n opt.filter =\n filter ?\n (path, stat) =>\n filter(path, stat) &&\n !(\n /* c8 ignore start */\n (\n (opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) >\n (stat.mtime ?? 0)\n )\n /* c8 ignore stop */\n )\n : (path, stat) =>\n !(\n /* c8 ignore start */\n (\n (opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) >\n (stat.mtime ?? 0)\n )\n /* c8 ignore stop */\n )\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/warn-method.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/warn-method.d.ts new file mode 100644 index 0000000..491d175 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/warn-method.d.ts @@ -0,0 +1,24 @@ +import { type Minipass } from 'minipass'; +/** has a warn method */ +export type Warner = { + warn(code: string, message: string | Error, data: any): void; + file?: string; + cwd?: string; + strict?: boolean; + emit(event: 'warn', code: string, message: string, data?: WarnData): void; + emit(event: 'error', error: TarError): void; +}; +export type WarnEvent = Minipass.Events & { + warn: [code: string, message: string, data: WarnData]; +}; +export type WarnData = { + file?: string; + cwd?: string; + code?: string; + tarCode?: string; + recoverable?: boolean; + [k: string]: any; +}; +export type TarError = Error & WarnData; +export declare const warnMethod: (self: Warner, code: string, message: string | Error, data?: WarnData) => void; +//# sourceMappingURL=warn-method.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/warn-method.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/warn-method.d.ts.map new file mode 100644 index 0000000..25d1c84 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/warn-method.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"warn-method.d.ts","sourceRoot":"","sources":["../../src/warn-method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,wBAAwB;AACxB,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI,CAAA;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB,IAAI,CACF,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,QAAQ,GACd,IAAI,CAAA;IACP,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAA;CAC5C,CAAA;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,GAAG,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG;IACvD,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;CACtD,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAA;AAEvC,eAAO,MAAM,UAAU,GACrB,MAAM,MAAM,EACZ,MAAM,MAAM,EACZ,SAAS,MAAM,GAAG,KAAK,EACvB,OAAM,QAAa,SA2BpB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/warn-method.js b/node_modules/cmake-js/node_modules/tar/dist/esm/warn-method.js new file mode 100644 index 0000000..13e798a --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/warn-method.js @@ -0,0 +1,27 @@ +export const warnMethod = (self, code, message, data = {}) => { + if (self.file) { + data.file = self.file; + } + if (self.cwd) { + data.cwd = self.cwd; + } + data.code = + (message instanceof Error && + message.code) || + code; + data.tarCode = code; + if (!self.strict && data.recoverable !== false) { + if (message instanceof Error) { + data = Object.assign(message, data); + message = message.message; + } + self.emit('warn', code, message, data); + } + else if (message instanceof Error) { + self.emit('error', Object.assign(message, data)); + } + else { + self.emit('error', Object.assign(new Error(`${code}: ${message}`), data)); + } +}; +//# sourceMappingURL=warn-method.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/warn-method.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/warn-method.js.map new file mode 100644 index 0000000..1c1bbd3 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/warn-method.js.map @@ -0,0 +1 @@ +{"version":3,"file":"warn-method.js","sourceRoot":"","sources":["../../src/warn-method.ts"],"names":[],"mappings":"AAiCA,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,IAAY,EACZ,IAAY,EACZ,OAAuB,EACvB,OAAiB,EAAE,EACnB,EAAE;IACF,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;IACvB,CAAC;IACD,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAA;IACrB,CAAC;IACD,IAAI,CAAC,IAAI;QACP,CAAC,OAAO,YAAY,KAAK;YACtB,OAAiC,CAAC,IAAI,CAAC;YAC1C,IAAI,CAAA;IACN,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;IACnB,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,KAAK,KAAK,EAAE,CAAC;QAC/C,IAAI,OAAO,YAAY,KAAK,EAAE,CAAC;YAC7B,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;YACnC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;QAC3B,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;IACxC,CAAC;SAAM,IAAI,OAAO,YAAY,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;IAClD,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,IAAI,CACP,OAAO,EACP,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,CACtD,CAAA;IACH,CAAC;AACH,CAAC,CAAA","sourcesContent":["import { type Minipass } from 'minipass'\n\n/** has a warn method */\nexport type Warner = {\n warn(code: string, message: string | Error, data: any): void\n file?: string\n cwd?: string\n strict?: boolean\n\n emit(\n event: 'warn',\n code: string,\n message: string,\n data?: WarnData,\n ): void\n emit(event: 'error', error: TarError): void\n}\n\nexport type WarnEvent = Minipass.Events & {\n warn: [code: string, message: string, data: WarnData]\n}\n\nexport type WarnData = {\n file?: string\n cwd?: string\n code?: string\n tarCode?: string\n recoverable?: boolean\n [k: string]: any\n}\n\nexport type TarError = Error & WarnData\n\nexport const warnMethod = (\n self: Warner,\n code: string,\n message: string | Error,\n data: WarnData = {},\n) => {\n if (self.file) {\n data.file = self.file\n }\n if (self.cwd) {\n data.cwd = self.cwd\n }\n data.code =\n (message instanceof Error &&\n (message as NodeJS.ErrnoException).code) ||\n code\n data.tarCode = code\n if (!self.strict && data.recoverable !== false) {\n if (message instanceof Error) {\n data = Object.assign(message, data)\n message = message.message\n }\n self.emit('warn', code, message, data)\n } else if (message instanceof Error) {\n self.emit('error', Object.assign(message, data))\n } else {\n self.emit(\n 'error',\n Object.assign(new Error(`${code}: ${message}`), data),\n )\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/winchars.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/winchars.d.ts new file mode 100644 index 0000000..6c24143 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/winchars.d.ts @@ -0,0 +1,3 @@ +export declare const encode: (s: string) => string; +export declare const decode: (s: string) => string; +//# sourceMappingURL=winchars.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/winchars.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/winchars.d.ts.map new file mode 100644 index 0000000..32895d1 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/winchars.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"winchars.d.ts","sourceRoot":"","sources":["../../src/winchars.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,WACwB,CAAA;AACxD,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,WACwB,CAAA"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/winchars.js b/node_modules/cmake-js/node_modules/tar/dist/esm/winchars.js new file mode 100644 index 0000000..c41eb86 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/winchars.js @@ -0,0 +1,9 @@ +// When writing files on Windows, translate the characters to their +// 0xf000 higher-encoded versions. +const raw = ['|', '<', '>', '?', ':']; +const win = raw.map(char => String.fromCharCode(0xf000 + char.charCodeAt(0))); +const toWin = new Map(raw.map((char, i) => [char, win[i]])); +const toRaw = new Map(win.map((char, i) => [char, raw[i]])); +export const encode = (s) => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s); +export const decode = (s) => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s); +//# sourceMappingURL=winchars.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/winchars.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/winchars.js.map new file mode 100644 index 0000000..4394ba2 --- /dev/null +++ b/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CAAC,EAAE,CAAC,CAAC,CAAA","sourcesContent":["// When writing files on Windows, translate the characters to their\n// 0xf000 higher-encoded versions.\n\nconst raw = ['|', '<', '>', '?', ':']\n\nconst win = raw.map(char =>\n String.fromCharCode(0xf000 + char.charCodeAt(0)),\n)\n\nconst toWin = new Map(raw.map((char, i) => [char, win[i]]))\nconst toRaw = new Map(win.map((char, i) => [char, raw[i]]))\n\nexport const encode = (s: string) =>\n raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s)\nexport const decode = (s: string) =>\n win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s)\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/write-entry.d.ts b/node_modules/cmake-js/node_modules/tar/dist/esm/write-entry.d.ts new file mode 100644 index 0000000..40d0aa7 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/write-entry.d.ts @@ -0,0 +1,129 @@ +import { type Stats } from 'fs'; +import { Minipass } from 'minipass'; +import { Header } from './header.js'; +import { TarOptions, TarOptionsWithAliases } from './options.js'; +import { ReadEntry } from './read-entry.js'; +import { EntryTypeName } from './types.js'; +import { WarnData, Warner, WarnEvent } from './warn-method.js'; +declare const PROCESS: unique symbol; +declare const FILE: unique symbol; +declare const DIRECTORY: unique symbol; +declare const SYMLINK: unique symbol; +declare const HARDLINK: unique symbol; +declare const HEADER: unique symbol; +declare const READ: unique symbol; +declare const LSTAT: unique symbol; +declare const ONLSTAT: unique symbol; +declare const ONREAD: unique symbol; +declare const ONREADLINK: unique symbol; +declare const OPENFILE: unique symbol; +declare const ONOPENFILE: unique symbol; +declare const CLOSE: unique symbol; +declare const MODE: unique symbol; +declare const AWAITDRAIN: unique symbol; +declare const ONDRAIN: unique symbol; +declare const PREFIX: unique symbol; +export declare class WriteEntry extends Minipass implements Warner { + #private; + path: string; + portable: boolean; + myuid: number; + myuser: string; + maxReadSize: number; + linkCache: Exclude; + statCache: Exclude; + preservePaths: boolean; + cwd: string; + strict: boolean; + mtime?: Date; + noPax: boolean; + noMtime: boolean; + prefix?: string; + fd?: number; + blockLen: number; + blockRemain: number; + buf?: Buffer; + pos: number; + remain: number; + length: number; + offset: number; + win32: boolean; + absolute: string; + header?: Header; + type?: EntryTypeName | 'Unsupported'; + linkpath?: string; + stat?: Stats; + onWriteEntry?: (entry: WriteEntry) => any; + constructor(p: string, opt_?: TarOptionsWithAliases); + warn(code: string, message: string | Error, data?: WarnData): void; + emit(ev: keyof WarnEvent, ...data: any[]): boolean; + [LSTAT](): void; + [ONLSTAT](stat: Stats): void; + [PROCESS](): void | this; + [MODE](mode: number): number; + [PREFIX](path: string): string; + [HEADER](): void; + [DIRECTORY](): void; + [SYMLINK](): void; + [ONREADLINK](linkpath: string): void; + [HARDLINK](linkpath: string): void; + [FILE](): void | this; + [OPENFILE](): void; + [ONOPENFILE](fd: number): void; + [READ](): void; + [CLOSE](cb?: (er?: null | Error | NodeJS.ErrnoException) => any): void; + [ONREAD](bytesRead: number): void; + [AWAITDRAIN](cb: () => any): void; + write(buffer: Buffer | string, cb?: () => void): boolean; + write(str: Buffer | string, encoding?: BufferEncoding | null, cb?: () => void): boolean; + [ONDRAIN](): void; +} +export declare class WriteEntrySync extends WriteEntry implements Warner { + sync: true; + [LSTAT](): void; + [SYMLINK](): void; + [OPENFILE](): void; + [READ](): void; + [AWAITDRAIN](cb: () => any): void; + [CLOSE](cb?: (er?: null | Error | NodeJS.ErrnoException) => any): void; +} +export declare class WriteEntryTar extends Minipass implements Warner { + blockLen: number; + blockRemain: number; + buf: number; + pos: number; + remain: number; + length: number; + preservePaths: boolean; + portable: boolean; + strict: boolean; + noPax: boolean; + noMtime: boolean; + readEntry: ReadEntry; + type: EntryTypeName; + prefix?: string; + path: string; + mode?: number; + uid?: number; + gid?: number; + uname?: string; + gname?: string; + header?: Header; + mtime?: Date; + atime?: Date; + ctime?: Date; + linkpath?: string; + size: number; + onWriteEntry?: (entry: WriteEntry) => any; + warn(code: string, message: string | Error, data?: WarnData): void; + constructor(readEntry: ReadEntry, opt_?: TarOptionsWithAliases); + [PREFIX](path: string): string; + [MODE](mode: number): number; + write(buffer: Buffer | string, cb?: () => void): boolean; + write(str: Buffer | string, encoding?: BufferEncoding | null, cb?: () => void): boolean; + end(cb?: () => void): this; + end(chunk: Buffer | string, cb?: () => void): this; + end(chunk: Buffer | string, encoding?: BufferEncoding, cb?: () => void): this; +} +export {}; +//# sourceMappingURL=write-entry.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/write-entry.d.ts.map b/node_modules/cmake-js/node_modules/tar/dist/esm/write-entry.d.ts.map new file mode 100644 index 0000000..ea99532 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/write-entry.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"write-entry.d.ts","sourceRoot":"","sources":["../../src/write-entry.ts"],"names":[],"mappings":"AAAA,OAAW,EAAE,KAAK,KAAK,EAAE,MAAM,IAAI,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,OAAO,EAGL,UAAU,EACV,qBAAqB,EACtB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAG3C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EAEV,MAAM,kBAAkB,CAAA;AAazB,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,IAAI,eAAiB,CAAA;AAC3B,QAAA,MAAM,SAAS,eAAsB,CAAA;AACrC,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,IAAI,eAAiB,CAAA;AAC3B,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,IAA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IAAI,CAAA;IACZ,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,GAAG,CAAA;IAEzC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,EAAE,IAAI,GAAE,QAAa;gBAK7D,SAAS,EAAE,SAAS,EACpB,IAAI,GAAE,qBAA0B;IAyHlC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,MAAM;IAIrB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,MAAM;IAInB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO;IACxD,KAAK,CACH,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,EAChC,EAAE,CAAC,EAAE,MAAM,IAAI,GACd,OAAO;IA0BV,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI;IAC1B,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI;IAClD,GAAG,CACD,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,QAAQ,CAAC,EAAE,cAAc,EACzB,EAAE,CAAC,EAAE,MAAM,IAAI,GACd,IAAI;CA2BR"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/write-entry.js b/node_modules/cmake-js/node_modules/tar/dist/esm/write-entry.js new file mode 100644 index 0000000..9028cd6 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/write-entry.js @@ -0,0 +1,657 @@ +import fs from 'fs'; +import { Minipass } from 'minipass'; +import path from 'path'; +import { Header } from './header.js'; +import { modeFix } from './mode-fix.js'; +import { normalizeWindowsPath } from './normalize-windows-path.js'; +import { dealias, } from './options.js'; +import { Pax } from './pax.js'; +import { stripAbsolutePath } from './strip-absolute-path.js'; +import { stripTrailingSlashes } from './strip-trailing-slashes.js'; +import { warnMethod, } from './warn-method.js'; +import * as winchars from './winchars.js'; +const prefixPath = (path, prefix) => { + if (!prefix) { + return normalizeWindowsPath(path); + } + path = normalizeWindowsPath(path).replace(/^\.(\/|$)/, ''); + return stripTrailingSlashes(prefix) + '/' + path; +}; +const maxReadSize = 16 * 1024 * 1024; +const PROCESS = Symbol('process'); +const FILE = Symbol('file'); +const DIRECTORY = Symbol('directory'); +const SYMLINK = Symbol('symlink'); +const HARDLINK = Symbol('hardlink'); +const HEADER = Symbol('header'); +const READ = Symbol('read'); +const LSTAT = Symbol('lstat'); +const ONLSTAT = Symbol('onlstat'); +const ONREAD = Symbol('onread'); +const ONREADLINK = Symbol('onreadlink'); +const OPENFILE = Symbol('openfile'); +const ONOPENFILE = Symbol('onopenfile'); +const CLOSE = Symbol('close'); +const MODE = Symbol('mode'); +const AWAITDRAIN = Symbol('awaitDrain'); +const ONDRAIN = Symbol('ondrain'); +const PREFIX = Symbol('prefix'); +export class WriteEntry extends Minipass { + path; + portable; + myuid = (process.getuid && process.getuid()) || 0; + // until node has builtin pwnam functions, this'll have to do + myuser = process.env.USER || ''; + maxReadSize; + linkCache; + statCache; + preservePaths; + cwd; + strict; + mtime; + noPax; + noMtime; + prefix; + fd; + blockLen = 0; + blockRemain = 0; + buf; + pos = 0; + remain = 0; + length = 0; + offset = 0; + win32; + absolute; + header; + type; + linkpath; + stat; + onWriteEntry; + #hadError = false; + constructor(p, opt_ = {}) { + const opt = dealias(opt_); + super(); + this.path = normalizeWindowsPath(p); + // suppress atime, ctime, uid, gid, uname, gname + this.portable = !!opt.portable; + this.maxReadSize = opt.maxReadSize || maxReadSize; + this.linkCache = opt.linkCache || new Map(); + this.statCache = opt.statCache || new Map(); + this.preservePaths = !!opt.preservePaths; + this.cwd = normalizeWindowsPath(opt.cwd || process.cwd()); + this.strict = !!opt.strict; + this.noPax = !!opt.noPax; + this.noMtime = !!opt.noMtime; + this.mtime = opt.mtime; + this.prefix = + opt.prefix ? normalizeWindowsPath(opt.prefix) : undefined; + this.onWriteEntry = opt.onWriteEntry; + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn); + } + let pathWarn = false; + if (!this.preservePaths) { + const [root, stripped] = stripAbsolutePath(this.path); + if (root && typeof stripped === 'string') { + this.path = stripped; + pathWarn = root; + } + } + this.win32 = !!opt.win32 || process.platform === 'win32'; + if (this.win32) { + // force the \ to / normalization, since we might not *actually* + // be on windows, but want \ to be considered a path separator. + this.path = winchars.decode(this.path.replace(/\\/g, '/')); + p = p.replace(/\\/g, '/'); + } + this.absolute = normalizeWindowsPath(opt.absolute || path.resolve(this.cwd, p)); + if (this.path === '') { + this.path = './'; + } + if (pathWarn) { + this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { + entry: this, + path: pathWarn + this.path, + }); + } + const cs = this.statCache.get(this.absolute); + if (cs) { + this[ONLSTAT](cs); + } + else { + this[LSTAT](); + } + } + warn(code, message, data = {}) { + return warnMethod(this, code, message, data); + } + emit(ev, ...data) { + if (ev === 'error') { + this.#hadError = true; + } + return super.emit(ev, ...data); + } + [LSTAT]() { + fs.lstat(this.absolute, (er, stat) => { + if (er) { + return this.emit('error', er); + } + this[ONLSTAT](stat); + }); + } + [ONLSTAT](stat) { + this.statCache.set(this.absolute, stat); + this.stat = stat; + if (!stat.isFile()) { + stat.size = 0; + } + this.type = getType(stat); + this.emit('stat', stat); + this[PROCESS](); + } + [PROCESS]() { + switch (this.type) { + case 'File': + return this[FILE](); + case 'Directory': + return this[DIRECTORY](); + case 'SymbolicLink': + return this[SYMLINK](); + // unsupported types are ignored. + default: + return this.end(); + } + } + [MODE](mode) { + return modeFix(mode, this.type === 'Directory', this.portable); + } + [PREFIX](path) { + return prefixPath(path, this.prefix); + } + [HEADER]() { + /* c8 ignore start */ + if (!this.stat) { + throw new Error('cannot write header before stat'); + } + /* c8 ignore stop */ + if (this.type === 'Directory' && this.portable) { + this.noMtime = true; + } + this.onWriteEntry?.(this); + this.header = new Header({ + path: this[PREFIX](this.path), + // only apply the prefix to hard links. + linkpath: this.type === 'Link' && this.linkpath !== undefined ? + this[PREFIX](this.linkpath) + : this.linkpath, + // only the permissions and setuid/setgid/sticky bitflags + // not the higher-order bits that specify file type + mode: this[MODE](this.stat.mode), + uid: this.portable ? undefined : this.stat.uid, + gid: this.portable ? undefined : this.stat.gid, + size: this.stat.size, + mtime: this.noMtime ? undefined : this.mtime || this.stat.mtime, + /* c8 ignore next */ + type: this.type === 'Unsupported' ? undefined : this.type, + uname: this.portable ? undefined + : this.stat.uid === this.myuid ? this.myuser + : '', + atime: this.portable ? undefined : this.stat.atime, + ctime: this.portable ? undefined : this.stat.ctime, + }); + if (this.header.encode() && !this.noPax) { + super.write(new Pax({ + atime: this.portable ? undefined : this.header.atime, + ctime: this.portable ? undefined : this.header.ctime, + gid: this.portable ? undefined : this.header.gid, + mtime: this.noMtime ? undefined : (this.mtime || this.header.mtime), + path: this[PREFIX](this.path), + linkpath: this.type === 'Link' && this.linkpath !== undefined ? + this[PREFIX](this.linkpath) + : this.linkpath, + size: this.header.size, + uid: this.portable ? undefined : this.header.uid, + uname: this.portable ? undefined : this.header.uname, + dev: this.portable ? undefined : this.stat.dev, + ino: this.portable ? undefined : this.stat.ino, + nlink: this.portable ? undefined : this.stat.nlink, + }).encode()); + } + const block = this.header?.block; + /* c8 ignore start */ + if (!block) { + throw new Error('failed to encode header'); + } + /* c8 ignore stop */ + super.write(block); + } + [DIRECTORY]() { + /* c8 ignore start */ + if (!this.stat) { + throw new Error('cannot create directory entry without stat'); + } + /* c8 ignore stop */ + if (this.path.slice(-1) !== '/') { + this.path += '/'; + } + this.stat.size = 0; + this[HEADER](); + this.end(); + } + [SYMLINK]() { + fs.readlink(this.absolute, (er, linkpath) => { + if (er) { + return this.emit('error', er); + } + this[ONREADLINK](linkpath); + }); + } + [ONREADLINK](linkpath) { + this.linkpath = normalizeWindowsPath(linkpath); + this[HEADER](); + this.end(); + } + [HARDLINK](linkpath) { + /* c8 ignore start */ + if (!this.stat) { + throw new Error('cannot create link entry without stat'); + } + /* c8 ignore stop */ + this.type = 'Link'; + this.linkpath = normalizeWindowsPath(path.relative(this.cwd, linkpath)); + this.stat.size = 0; + this[HEADER](); + this.end(); + } + [FILE]() { + /* c8 ignore start */ + if (!this.stat) { + throw new Error('cannot create file entry without stat'); + } + /* c8 ignore stop */ + if (this.stat.nlink > 1) { + const linkKey = `${this.stat.dev}:${this.stat.ino}`; + const linkpath = this.linkCache.get(linkKey); + if (linkpath?.indexOf(this.cwd) === 0) { + return this[HARDLINK](linkpath); + } + this.linkCache.set(linkKey, this.absolute); + } + this[HEADER](); + if (this.stat.size === 0) { + return this.end(); + } + this[OPENFILE](); + } + [OPENFILE]() { + fs.open(this.absolute, 'r', (er, fd) => { + if (er) { + return this.emit('error', er); + } + this[ONOPENFILE](fd); + }); + } + [ONOPENFILE](fd) { + this.fd = fd; + if (this.#hadError) { + return this[CLOSE](); + } + /* c8 ignore start */ + if (!this.stat) { + throw new Error('should stat before calling onopenfile'); + } + /* c8 ignore start */ + this.blockLen = 512 * Math.ceil(this.stat.size / 512); + this.blockRemain = this.blockLen; + const bufLen = Math.min(this.blockLen, this.maxReadSize); + this.buf = Buffer.allocUnsafe(bufLen); + this.offset = 0; + this.pos = 0; + this.remain = this.stat.size; + this.length = this.buf.length; + this[READ](); + } + [READ]() { + const { fd, buf, offset, length, pos } = this; + if (fd === undefined || buf === undefined) { + throw new Error('cannot read file without first opening'); + } + fs.read(fd, buf, offset, length, pos, (er, bytesRead) => { + if (er) { + // ignoring the error from close(2) is a bad practice, but at + // this point we already have an error, don't need another one + return this[CLOSE](() => this.emit('error', er)); + } + this[ONREAD](bytesRead); + }); + } + /* c8 ignore start */ + [CLOSE](cb = () => { }) { + /* c8 ignore stop */ + if (this.fd !== undefined) + fs.close(this.fd, cb); + } + [ONREAD](bytesRead) { + if (bytesRead <= 0 && this.remain > 0) { + const er = Object.assign(new Error('encountered unexpected EOF'), { + path: this.absolute, + syscall: 'read', + code: 'EOF', + }); + return this[CLOSE](() => this.emit('error', er)); + } + if (bytesRead > this.remain) { + const er = Object.assign(new Error('did not encounter expected EOF'), { + path: this.absolute, + syscall: 'read', + code: 'EOF', + }); + return this[CLOSE](() => this.emit('error', er)); + } + /* c8 ignore start */ + if (!this.buf) { + throw new Error('should have created buffer prior to reading'); + } + /* c8 ignore stop */ + // null out the rest of the buffer, if we could fit the block padding + // at the end of this loop, we've incremented bytesRead and this.remain + // to be incremented up to the blockRemain level, as if we had expected + // to get a null-padded file, and read it until the end. then we will + // decrement both remain and blockRemain by bytesRead, and know that we + // reached the expected EOF, without any null buffer to append. + if (bytesRead === this.remain) { + for (let i = bytesRead; i < this.length && bytesRead < this.blockRemain; i++) { + this.buf[i + this.offset] = 0; + bytesRead++; + this.remain++; + } + } + const chunk = this.offset === 0 && bytesRead === this.buf.length ? + this.buf + : this.buf.subarray(this.offset, this.offset + bytesRead); + const flushed = this.write(chunk); + if (!flushed) { + this[AWAITDRAIN](() => this[ONDRAIN]()); + } + else { + this[ONDRAIN](); + } + } + [AWAITDRAIN](cb) { + this.once('drain', cb); + } + write(chunk, encoding, cb) { + /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8'); + } + /* c8 ignore stop */ + if (this.blockRemain < chunk.length) { + const er = Object.assign(new Error('writing more data than expected'), { + path: this.absolute, + }); + return this.emit('error', er); + } + this.remain -= chunk.length; + this.blockRemain -= chunk.length; + this.pos += chunk.length; + this.offset += chunk.length; + return super.write(chunk, null, cb); + } + [ONDRAIN]() { + if (!this.remain) { + if (this.blockRemain) { + super.write(Buffer.alloc(this.blockRemain)); + } + return this[CLOSE](er => er ? this.emit('error', er) : this.end()); + } + /* c8 ignore start */ + if (!this.buf) { + throw new Error('buffer lost somehow in ONDRAIN'); + } + /* c8 ignore stop */ + if (this.offset >= this.length) { + // if we only have a smaller bit left to read, alloc a smaller buffer + // otherwise, keep it the same length it was before. + this.buf = Buffer.allocUnsafe(Math.min(this.blockRemain, this.buf.length)); + this.offset = 0; + } + this.length = this.buf.length - this.offset; + this[READ](); + } +} +export class WriteEntrySync extends WriteEntry { + sync = true; + [LSTAT]() { + this[ONLSTAT](fs.lstatSync(this.absolute)); + } + [SYMLINK]() { + this[ONREADLINK](fs.readlinkSync(this.absolute)); + } + [OPENFILE]() { + this[ONOPENFILE](fs.openSync(this.absolute, 'r')); + } + [READ]() { + let threw = true; + try { + const { fd, buf, offset, length, pos } = this; + /* c8 ignore start */ + if (fd === undefined || buf === undefined) { + throw new Error('fd and buf must be set in READ method'); + } + /* c8 ignore stop */ + const bytesRead = fs.readSync(fd, buf, offset, length, pos); + this[ONREAD](bytesRead); + threw = false; + } + finally { + // ignoring the error from close(2) is a bad practice, but at + // this point we already have an error, don't need another one + if (threw) { + try { + this[CLOSE](() => { }); + } + catch (er) { } + } + } + } + [AWAITDRAIN](cb) { + cb(); + } + /* c8 ignore start */ + [CLOSE](cb = () => { }) { + /* c8 ignore stop */ + if (this.fd !== undefined) + fs.closeSync(this.fd); + cb(); + } +} +export class WriteEntryTar extends Minipass { + blockLen = 0; + blockRemain = 0; + buf = 0; + pos = 0; + remain = 0; + length = 0; + preservePaths; + portable; + strict; + noPax; + noMtime; + readEntry; + type; + prefix; + path; + mode; + uid; + gid; + uname; + gname; + header; + mtime; + atime; + ctime; + linkpath; + size; + onWriteEntry; + warn(code, message, data = {}) { + return warnMethod(this, code, message, data); + } + constructor(readEntry, opt_ = {}) { + const opt = dealias(opt_); + super(); + this.preservePaths = !!opt.preservePaths; + this.portable = !!opt.portable; + this.strict = !!opt.strict; + this.noPax = !!opt.noPax; + this.noMtime = !!opt.noMtime; + this.onWriteEntry = opt.onWriteEntry; + this.readEntry = readEntry; + const { type } = readEntry; + /* c8 ignore start */ + if (type === 'Unsupported') { + throw new Error('writing entry that should be ignored'); + } + /* c8 ignore stop */ + this.type = type; + if (this.type === 'Directory' && this.portable) { + this.noMtime = true; + } + this.prefix = opt.prefix; + this.path = normalizeWindowsPath(readEntry.path); + this.mode = + readEntry.mode !== undefined ? + this[MODE](readEntry.mode) + : undefined; + this.uid = this.portable ? undefined : readEntry.uid; + this.gid = this.portable ? undefined : readEntry.gid; + this.uname = this.portable ? undefined : readEntry.uname; + this.gname = this.portable ? undefined : readEntry.gname; + this.size = readEntry.size; + this.mtime = + this.noMtime ? undefined : opt.mtime || readEntry.mtime; + this.atime = this.portable ? undefined : readEntry.atime; + this.ctime = this.portable ? undefined : readEntry.ctime; + this.linkpath = + readEntry.linkpath !== undefined ? + normalizeWindowsPath(readEntry.linkpath) + : undefined; + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn); + } + let pathWarn = false; + if (!this.preservePaths) { + const [root, stripped] = stripAbsolutePath(this.path); + if (root && typeof stripped === 'string') { + this.path = stripped; + pathWarn = root; + } + } + this.remain = readEntry.size; + this.blockRemain = readEntry.startBlockSize; + this.onWriteEntry?.(this); + this.header = new Header({ + path: this[PREFIX](this.path), + linkpath: this.type === 'Link' && this.linkpath !== undefined ? + this[PREFIX](this.linkpath) + : this.linkpath, + // only the permissions and setuid/setgid/sticky bitflags + // not the higher-order bits that specify file type + mode: this.mode, + uid: this.portable ? undefined : this.uid, + gid: this.portable ? undefined : this.gid, + size: this.size, + mtime: this.noMtime ? undefined : this.mtime, + type: this.type, + uname: this.portable ? undefined : this.uname, + atime: this.portable ? undefined : this.atime, + ctime: this.portable ? undefined : this.ctime, + }); + if (pathWarn) { + this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { + entry: this, + path: pathWarn + this.path, + }); + } + if (this.header.encode() && !this.noPax) { + super.write(new Pax({ + atime: this.portable ? undefined : this.atime, + ctime: this.portable ? undefined : this.ctime, + gid: this.portable ? undefined : this.gid, + mtime: this.noMtime ? undefined : this.mtime, + path: this[PREFIX](this.path), + linkpath: this.type === 'Link' && this.linkpath !== undefined ? + this[PREFIX](this.linkpath) + : this.linkpath, + size: this.size, + uid: this.portable ? undefined : this.uid, + uname: this.portable ? undefined : this.uname, + dev: this.portable ? undefined : this.readEntry.dev, + ino: this.portable ? undefined : this.readEntry.ino, + nlink: this.portable ? undefined : this.readEntry.nlink, + }).encode()); + } + const b = this.header?.block; + /* c8 ignore start */ + if (!b) + throw new Error('failed to encode header'); + /* c8 ignore stop */ + super.write(b); + readEntry.pipe(this); + } + [PREFIX](path) { + return prefixPath(path, this.prefix); + } + [MODE](mode) { + return modeFix(mode, this.type === 'Directory', this.portable); + } + write(chunk, encoding, cb) { + /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8'); + } + /* c8 ignore stop */ + const writeLen = chunk.length; + if (writeLen > this.blockRemain) { + throw new Error('writing more to entry than is appropriate'); + } + this.blockRemain -= writeLen; + return super.write(chunk, cb); + } + end(chunk, encoding, cb) { + if (this.blockRemain) { + super.write(Buffer.alloc(this.blockRemain)); + } + /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ + if (typeof chunk === 'function') { + cb = chunk; + encoding = undefined; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding ?? 'utf8'); + } + if (cb) + this.once('finish', cb); + chunk ? super.end(chunk, cb) : super.end(cb); + /* c8 ignore stop */ + return this; + } +} +const getType = (stat) => stat.isFile() ? 'File' + : stat.isDirectory() ? 'Directory' + : stat.isSymbolicLink() ? 'SymbolicLink' + : 'Unsupported'; +//# sourceMappingURL=write-entry.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/dist/esm/write-entry.js.map b/node_modules/cmake-js/node_modules/tar/dist/esm/write-entry.js.map new file mode 100644 index 0000000..0ef345a --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/dist/esm/write-entry.js.map @@ -0,0 +1 @@ +{"version":3,"file":"write-entry.js","sourceRoot":"","sources":["../../src/write-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,MAAM,IAAI,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,EACL,OAAO,GAIR,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAElE,OAAO,EAIL,UAAU,GACX,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAEzC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,MAAe,EAAE,EAAE;IACnD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAA;IACnC,CAAC;IACD,IAAI,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;IAC1D,OAAO,oBAAoB,CAAC,MAAM,CAAC,GAAG,GAAG,GAAG,IAAI,CAAA;AAClD,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;AAEpC,MAAM,OA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AAG,CAAC,IAAW,EAAiC,EAAE,CAC7D,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM;IACtB,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,WAAW;QAClC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,cAAc;YACxC,CAAC,CAAC,aAAa,CAAA","sourcesContent":["import fs, { type Stats } from 'fs'\nimport { Minipass } from 'minipass'\nimport path from 'path'\nimport { Header } from './header.js'\nimport { modeFix } from './mode-fix.js'\nimport { normalizeWindowsPath } from './normalize-windows-path.js'\nimport {\n dealias,\n LinkCacheKey,\n TarOptions,\n TarOptionsWithAliases,\n} from './options.js'\nimport { Pax } from './pax.js'\nimport { ReadEntry } from './read-entry.js'\nimport { stripAbsolutePath } from './strip-absolute-path.js'\nimport { stripTrailingSlashes } from './strip-trailing-slashes.js'\nimport { EntryTypeName } from './types.js'\nimport {\n WarnData,\n Warner,\n WarnEvent,\n warnMethod,\n} from './warn-method.js'\nimport * as winchars from './winchars.js'\n\nconst prefixPath = (path: string, prefix?: string) => {\n if (!prefix) {\n return normalizeWindowsPath(path)\n }\n path = normalizeWindowsPath(path).replace(/^\\.(\\/|$)/, '')\n return stripTrailingSlashes(prefix) + '/' + path\n}\n\nconst maxReadSize = 16 * 1024 * 1024\n\nconst PROCESS = Symbol('process')\nconst FILE = Symbol('file')\nconst DIRECTORY = Symbol('directory')\nconst SYMLINK = Symbol('symlink')\nconst HARDLINK = Symbol('hardlink')\nconst HEADER = Symbol('header')\nconst READ = Symbol('read')\nconst LSTAT = Symbol('lstat')\nconst ONLSTAT = Symbol('onlstat')\nconst ONREAD = Symbol('onread')\nconst ONREADLINK = Symbol('onreadlink')\nconst OPENFILE = Symbol('openfile')\nconst ONOPENFILE = Symbol('onopenfile')\nconst CLOSE = Symbol('close')\nconst MODE = Symbol('mode')\nconst AWAITDRAIN = Symbol('awaitDrain')\nconst ONDRAIN = Symbol('ondrain')\nconst PREFIX = Symbol('prefix')\n\nexport class WriteEntry\n extends Minipass\n implements Warner\n{\n path: string\n portable: boolean\n myuid: number = (process.getuid && process.getuid()) || 0\n // until node has builtin pwnam functions, this'll have to do\n myuser: string = process.env.USER || ''\n maxReadSize: number\n linkCache: Exclude\n statCache: Exclude\n preservePaths: boolean\n cwd: string\n strict: boolean\n mtime?: Date\n noPax: boolean\n noMtime: boolean\n prefix?: string\n fd?: number\n\n blockLen: number = 0\n blockRemain: number = 0\n buf?: Buffer\n pos: number = 0\n remain: number = 0\n length: number = 0\n offset: number = 0\n\n win32: boolean\n absolute: string\n\n header?: Header\n type?: EntryTypeName | 'Unsupported'\n linkpath?: string\n stat?: Stats\n onWriteEntry?: (entry: WriteEntry) => any\n\n #hadError: boolean = false\n\n constructor(p: string, opt_: TarOptionsWithAliases = {}) {\n const opt = dealias(opt_)\n super()\n this.path = normalizeWindowsPath(p)\n // suppress atime, ctime, uid, gid, uname, gname\n this.portable = !!opt.portable\n this.maxReadSize = opt.maxReadSize || maxReadSize\n this.linkCache = opt.linkCache || new Map()\n this.statCache = opt.statCache || new Map()\n this.preservePaths = !!opt.preservePaths\n this.cwd = normalizeWindowsPath(opt.cwd || process.cwd())\n this.strict = !!opt.strict\n this.noPax = !!opt.noPax\n this.noMtime = !!opt.noMtime\n this.mtime = opt.mtime\n this.prefix =\n opt.prefix ? normalizeWindowsPath(opt.prefix) : undefined\n this.onWriteEntry = opt.onWriteEntry\n\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n\n let pathWarn: string | boolean = false\n if (!this.preservePaths) {\n const [root, stripped] = stripAbsolutePath(this.path)\n if (root && typeof stripped === 'string') {\n this.path = stripped\n pathWarn = root\n }\n }\n\n this.win32 = !!opt.win32 || process.platform === 'win32'\n if (this.win32) {\n // force the \\ to / normalization, since we might not *actually*\n // be on windows, but want \\ to be considered a path separator.\n this.path = winchars.decode(this.path.replace(/\\\\/g, '/'))\n p = p.replace(/\\\\/g, '/')\n }\n\n this.absolute = normalizeWindowsPath(\n opt.absolute || path.resolve(this.cwd, p),\n )\n\n if (this.path === '') {\n this.path = './'\n }\n\n if (pathWarn) {\n this.warn(\n 'TAR_ENTRY_INFO',\n `stripping ${pathWarn} from absolute path`,\n {\n entry: this,\n path: pathWarn + this.path,\n },\n )\n }\n\n const cs = this.statCache.get(this.absolute)\n if (cs) {\n this[ONLSTAT](cs)\n } else {\n this[LSTAT]()\n }\n }\n\n warn(code: string, message: string | Error, data: WarnData = {}) {\n return warnMethod(this, code, message, data)\n }\n\n emit(ev: keyof WarnEvent, ...data: any[]) {\n if (ev === 'error') {\n this.#hadError = true\n }\n return super.emit(ev, ...data)\n }\n\n [LSTAT]() {\n fs.lstat(this.absolute, (er, stat) => {\n if (er) {\n return this.emit('error', er)\n }\n this[ONLSTAT](stat)\n })\n }\n\n [ONLSTAT](stat: Stats) {\n this.statCache.set(this.absolute, stat)\n this.stat = stat\n if (!stat.isFile()) {\n stat.size = 0\n }\n this.type = getType(stat)\n this.emit('stat', stat)\n this[PROCESS]()\n }\n\n [PROCESS]() {\n switch (this.type) {\n case 'File':\n return this[FILE]()\n case 'Directory':\n return this[DIRECTORY]()\n case 'SymbolicLink':\n return this[SYMLINK]()\n // unsupported types are ignored.\n default:\n return this.end()\n }\n }\n\n [MODE](mode: number) {\n return modeFix(mode, this.type === 'Directory', this.portable)\n }\n\n [PREFIX](path: string) {\n return prefixPath(path, this.prefix)\n }\n\n [HEADER]() {\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('cannot write header before stat')\n }\n /* c8 ignore stop */\n\n if (this.type === 'Directory' && this.portable) {\n this.noMtime = true\n }\n\n this.onWriteEntry?.(this)\n this.header = new Header({\n path: this[PREFIX](this.path),\n // only apply the prefix to hard links.\n linkpath:\n this.type === 'Link' && this.linkpath !== undefined ?\n this[PREFIX](this.linkpath)\n : this.linkpath,\n // only the permissions and setuid/setgid/sticky bitflags\n // not the higher-order bits that specify file type\n mode: this[MODE](this.stat.mode),\n uid: this.portable ? undefined : this.stat.uid,\n gid: this.portable ? undefined : this.stat.gid,\n size: this.stat.size,\n mtime: this.noMtime ? undefined : this.mtime || this.stat.mtime,\n /* c8 ignore next */\n type: this.type === 'Unsupported' ? undefined : this.type,\n uname:\n this.portable ? undefined\n : this.stat.uid === this.myuid ? this.myuser\n : '',\n atime: this.portable ? undefined : this.stat.atime,\n ctime: this.portable ? undefined : this.stat.ctime,\n })\n\n if (this.header.encode() && !this.noPax) {\n super.write(\n new Pax({\n atime: this.portable ? undefined : this.header.atime,\n ctime: this.portable ? undefined : this.header.ctime,\n gid: this.portable ? undefined : this.header.gid,\n mtime:\n this.noMtime ? undefined : (\n this.mtime || this.header.mtime\n ),\n path: this[PREFIX](this.path),\n linkpath:\n this.type === 'Link' && this.linkpath !== undefined ?\n this[PREFIX](this.linkpath)\n : this.linkpath,\n size: this.header.size,\n uid: this.portable ? undefined : this.header.uid,\n uname: this.portable ? undefined : this.header.uname,\n dev: this.portable ? undefined : this.stat.dev,\n ino: this.portable ? undefined : this.stat.ino,\n nlink: this.portable ? undefined : this.stat.nlink,\n }).encode(),\n )\n }\n const block = this.header?.block\n /* c8 ignore start */\n if (!block) {\n throw new Error('failed to encode header')\n }\n /* c8 ignore stop */\n super.write(block)\n }\n\n [DIRECTORY]() {\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('cannot create directory entry without stat')\n }\n /* c8 ignore stop */\n if (this.path.slice(-1) !== '/') {\n this.path += '/'\n }\n this.stat.size = 0\n this[HEADER]()\n this.end()\n }\n\n [SYMLINK]() {\n fs.readlink(this.absolute, (er, linkpath) => {\n if (er) {\n return this.emit('error', er)\n }\n this[ONREADLINK](linkpath)\n })\n }\n\n [ONREADLINK](linkpath: string) {\n this.linkpath = normalizeWindowsPath(linkpath)\n this[HEADER]()\n this.end()\n }\n\n [HARDLINK](linkpath: string) {\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('cannot create link entry without stat')\n }\n /* c8 ignore stop */\n this.type = 'Link'\n this.linkpath = normalizeWindowsPath(\n path.relative(this.cwd, linkpath),\n )\n this.stat.size = 0\n this[HEADER]()\n this.end()\n }\n\n [FILE]() {\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('cannot create file entry without stat')\n }\n /* c8 ignore stop */\n if (this.stat.nlink > 1) {\n const linkKey =\n `${this.stat.dev}:${this.stat.ino}` as LinkCacheKey\n const linkpath = this.linkCache.get(linkKey)\n if (linkpath?.indexOf(this.cwd) === 0) {\n return this[HARDLINK](linkpath)\n }\n this.linkCache.set(linkKey, this.absolute)\n }\n\n this[HEADER]()\n if (this.stat.size === 0) {\n return this.end()\n }\n\n this[OPENFILE]()\n }\n\n [OPENFILE]() {\n fs.open(this.absolute, 'r', (er, fd) => {\n if (er) {\n return this.emit('error', er)\n }\n this[ONOPENFILE](fd)\n })\n }\n\n [ONOPENFILE](fd: number) {\n this.fd = fd\n if (this.#hadError) {\n return this[CLOSE]()\n }\n /* c8 ignore start */\n if (!this.stat) {\n throw new Error('should stat before calling onopenfile')\n }\n /* c8 ignore start */\n\n this.blockLen = 512 * Math.ceil(this.stat.size / 512)\n this.blockRemain = this.blockLen\n const bufLen = Math.min(this.blockLen, this.maxReadSize)\n this.buf = Buffer.allocUnsafe(bufLen)\n this.offset = 0\n this.pos = 0\n this.remain = this.stat.size\n this.length = this.buf.length\n this[READ]()\n }\n\n [READ]() {\n const { fd, buf, offset, length, pos } = this\n if (fd === undefined || buf === undefined) {\n throw new Error('cannot read file without first opening')\n }\n fs.read(fd, buf, offset, length, pos, (er, bytesRead) => {\n if (er) {\n // ignoring the error from close(2) is a bad practice, but at\n // this point we already have an error, don't need another one\n return this[CLOSE](() => this.emit('error', er))\n }\n this[ONREAD](bytesRead)\n })\n }\n\n /* c8 ignore start */\n [CLOSE](\n cb: (er?: null | Error | NodeJS.ErrnoException) => any = () => {},\n ) {\n /* c8 ignore stop */\n if (this.fd !== undefined) fs.close(this.fd, cb)\n }\n\n [ONREAD](bytesRead: number) {\n if (bytesRead <= 0 && this.remain > 0) {\n const er = Object.assign(\n new Error('encountered unexpected EOF'),\n {\n path: this.absolute,\n syscall: 'read',\n code: 'EOF',\n },\n )\n return this[CLOSE](() => this.emit('error', er))\n }\n\n if (bytesRead > this.remain) {\n const er = Object.assign(\n new Error('did not encounter expected EOF'),\n {\n path: this.absolute,\n syscall: 'read',\n code: 'EOF',\n },\n )\n return this[CLOSE](() => this.emit('error', er))\n }\n\n /* c8 ignore start */\n if (!this.buf) {\n throw new Error('should have created buffer prior to reading')\n }\n /* c8 ignore stop */\n\n // null out the rest of the buffer, if we could fit the block padding\n // at the end of this loop, we've incremented bytesRead and this.remain\n // to be incremented up to the blockRemain level, as if we had expected\n // to get a null-padded file, and read it until the end. then we will\n // decrement both remain and blockRemain by bytesRead, and know that we\n // reached the expected EOF, without any null buffer to append.\n if (bytesRead === this.remain) {\n for (\n let i = bytesRead;\n i < this.length && bytesRead < this.blockRemain;\n i++\n ) {\n this.buf[i + this.offset] = 0\n bytesRead++\n this.remain++\n }\n }\n\n const chunk =\n this.offset === 0 && bytesRead === this.buf.length ?\n this.buf\n : this.buf.subarray(this.offset, this.offset + bytesRead)\n\n const flushed = this.write(chunk)\n if (!flushed) {\n this[AWAITDRAIN](() => this[ONDRAIN]())\n } else {\n this[ONDRAIN]()\n }\n }\n\n [AWAITDRAIN](cb: () => any) {\n this.once('drain', cb)\n }\n\n write(buffer: Buffer | string, cb?: () => void): boolean\n write(\n str: Buffer | string,\n encoding?: BufferEncoding | null,\n cb?: () => void,\n ): boolean\n write(\n chunk: Buffer | string,\n encoding?: BufferEncoding | (() => any) | null,\n cb?: () => any,\n ): boolean {\n /* c8 ignore start - just junk to comply with NodeJS.WritableStream */\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(\n chunk,\n typeof encoding === 'string' ? encoding : 'utf8',\n )\n }\n /* c8 ignore stop */\n\n if (this.blockRemain < chunk.length) {\n const er = Object.assign(\n new Error('writing more data than expected'),\n {\n path: this.absolute,\n },\n )\n return this.emit('error', er)\n }\n this.remain -= chunk.length\n this.blockRemain -= chunk.length\n this.pos += chunk.length\n this.offset += chunk.length\n return super.write(chunk, null, cb)\n }\n\n [ONDRAIN]() {\n if (!this.remain) {\n if (this.blockRemain) {\n super.write(Buffer.alloc(this.blockRemain))\n }\n return this[CLOSE](er =>\n er ? this.emit('error', er) : this.end(),\n )\n }\n\n /* c8 ignore start */\n if (!this.buf) {\n throw new Error('buffer lost somehow in ONDRAIN')\n }\n /* c8 ignore stop */\n\n if (this.offset >= this.length) {\n // if we only have a smaller bit left to read, alloc a smaller buffer\n // otherwise, keep it the same length it was before.\n this.buf = Buffer.allocUnsafe(\n Math.min(this.blockRemain, this.buf.length),\n )\n this.offset = 0\n }\n this.length = this.buf.length - this.offset\n this[READ]()\n }\n}\n\nexport class WriteEntrySync extends WriteEntry implements Warner {\n sync: true = true;\n\n [LSTAT]() {\n this[ONLSTAT](fs.lstatSync(this.absolute))\n }\n\n [SYMLINK]() {\n this[ONREADLINK](fs.readlinkSync(this.absolute))\n }\n\n [OPENFILE]() {\n this[ONOPENFILE](fs.openSync(this.absolute, 'r'))\n }\n\n [READ]() {\n let threw = true\n try {\n const { fd, buf, offset, length, pos } = this\n /* c8 ignore start */\n if (fd === undefined || buf === undefined) {\n throw new Error('fd and buf must be set in READ method')\n }\n /* c8 ignore stop */\n const bytesRead = fs.readSync(fd, buf, offset, length, pos)\n this[ONREAD](bytesRead)\n threw = false\n } finally {\n // ignoring the error from close(2) is a bad practice, but at\n // this point we already have an error, don't need another one\n if (threw) {\n try {\n this[CLOSE](() => {})\n } catch (er) {}\n }\n }\n }\n\n [AWAITDRAIN](cb: () => any) {\n cb()\n }\n\n /* c8 ignore start */\n [CLOSE](\n cb: (er?: null | Error | NodeJS.ErrnoException) => any = () => {},\n ) {\n /* c8 ignore stop */\n if (this.fd !== undefined) fs.closeSync(this.fd)\n cb()\n }\n}\n\nexport class WriteEntryTar\n extends Minipass\n implements Warner\n{\n blockLen: number = 0\n blockRemain: number = 0\n buf: number = 0\n pos: number = 0\n remain: number = 0\n length: number = 0\n preservePaths: boolean\n portable: boolean\n strict: boolean\n noPax: boolean\n noMtime: boolean\n readEntry: ReadEntry\n type: EntryTypeName\n prefix?: string\n path: string\n mode?: number\n uid?: number\n gid?: number\n uname?: string\n gname?: string\n header?: Header\n mtime?: Date\n atime?: Date\n ctime?: Date\n linkpath?: string\n size: number\n onWriteEntry?: (entry: WriteEntry) => any\n\n warn(code: string, message: string | Error, data: WarnData = {}) {\n return warnMethod(this, code, message, data)\n }\n\n constructor(\n readEntry: ReadEntry,\n opt_: TarOptionsWithAliases = {},\n ) {\n const opt = dealias(opt_)\n super()\n this.preservePaths = !!opt.preservePaths\n this.portable = !!opt.portable\n this.strict = !!opt.strict\n this.noPax = !!opt.noPax\n this.noMtime = !!opt.noMtime\n this.onWriteEntry = opt.onWriteEntry\n\n this.readEntry = readEntry\n const { type } = readEntry\n /* c8 ignore start */\n if (type === 'Unsupported') {\n throw new Error('writing entry that should be ignored')\n }\n /* c8 ignore stop */\n this.type = type\n if (this.type === 'Directory' && this.portable) {\n this.noMtime = true\n }\n\n this.prefix = opt.prefix\n\n this.path = normalizeWindowsPath(readEntry.path)\n this.mode =\n readEntry.mode !== undefined ?\n this[MODE](readEntry.mode)\n : undefined\n this.uid = this.portable ? undefined : readEntry.uid\n this.gid = this.portable ? undefined : readEntry.gid\n this.uname = this.portable ? undefined : readEntry.uname\n this.gname = this.portable ? undefined : readEntry.gname\n this.size = readEntry.size\n this.mtime =\n this.noMtime ? undefined : opt.mtime || readEntry.mtime\n this.atime = this.portable ? undefined : readEntry.atime\n this.ctime = this.portable ? undefined : readEntry.ctime\n this.linkpath =\n readEntry.linkpath !== undefined ?\n normalizeWindowsPath(readEntry.linkpath)\n : undefined\n\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n\n let pathWarn: false | string = false\n if (!this.preservePaths) {\n const [root, stripped] = stripAbsolutePath(this.path)\n if (root && typeof stripped === 'string') {\n this.path = stripped\n pathWarn = root\n }\n }\n\n this.remain = readEntry.size\n this.blockRemain = readEntry.startBlockSize\n\n this.onWriteEntry?.(this as unknown as WriteEntry)\n this.header = new Header({\n path: this[PREFIX](this.path),\n linkpath:\n this.type === 'Link' && this.linkpath !== undefined ?\n this[PREFIX](this.linkpath)\n : this.linkpath,\n // only the permissions and setuid/setgid/sticky bitflags\n // not the higher-order bits that specify file type\n mode: this.mode,\n uid: this.portable ? undefined : this.uid,\n gid: this.portable ? undefined : this.gid,\n size: this.size,\n mtime: this.noMtime ? undefined : this.mtime,\n type: this.type,\n uname: this.portable ? undefined : this.uname,\n atime: this.portable ? undefined : this.atime,\n ctime: this.portable ? undefined : this.ctime,\n })\n\n if (pathWarn) {\n this.warn(\n 'TAR_ENTRY_INFO',\n `stripping ${pathWarn} from absolute path`,\n {\n entry: this,\n path: pathWarn + this.path,\n },\n )\n }\n\n if (this.header.encode() && !this.noPax) {\n super.write(\n new Pax({\n atime: this.portable ? undefined : this.atime,\n ctime: this.portable ? undefined : this.ctime,\n gid: this.portable ? undefined : this.gid,\n mtime: this.noMtime ? undefined : this.mtime,\n path: this[PREFIX](this.path),\n linkpath:\n this.type === 'Link' && this.linkpath !== undefined ?\n this[PREFIX](this.linkpath)\n : this.linkpath,\n size: this.size,\n uid: this.portable ? undefined : this.uid,\n uname: this.portable ? undefined : this.uname,\n dev: this.portable ? undefined : this.readEntry.dev,\n ino: this.portable ? undefined : this.readEntry.ino,\n nlink: this.portable ? undefined : this.readEntry.nlink,\n }).encode(),\n )\n }\n\n const b = this.header?.block\n /* c8 ignore start */\n if (!b) throw new Error('failed to encode header')\n /* c8 ignore stop */\n super.write(b)\n readEntry.pipe(this)\n }\n\n [PREFIX](path: string) {\n return prefixPath(path, this.prefix)\n }\n\n [MODE](mode: number) {\n return modeFix(mode, this.type === 'Directory', this.portable)\n }\n\n write(buffer: Buffer | string, cb?: () => void): boolean\n write(\n str: Buffer | string,\n encoding?: BufferEncoding | null,\n cb?: () => void,\n ): boolean\n write(\n chunk: Buffer | string,\n encoding?: BufferEncoding | (() => any) | null,\n cb?: () => any,\n ): boolean {\n /* c8 ignore start - just junk to comply with NodeJS.WritableStream */\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(\n chunk,\n typeof encoding === 'string' ? encoding : 'utf8',\n )\n }\n /* c8 ignore stop */\n const writeLen = chunk.length\n if (writeLen > this.blockRemain) {\n throw new Error('writing more to entry than is appropriate')\n }\n this.blockRemain -= writeLen\n return super.write(chunk, cb)\n }\n\n end(cb?: () => void): this\n end(chunk: Buffer | string, cb?: () => void): this\n end(\n chunk: Buffer | string,\n encoding?: BufferEncoding,\n cb?: () => void,\n ): this\n end(\n chunk?: Buffer | string | (() => void),\n encoding?: BufferEncoding | (() => void),\n cb?: () => void,\n ): this {\n if (this.blockRemain) {\n super.write(Buffer.alloc(this.blockRemain))\n }\n /* c8 ignore start - just junk to comply with NodeJS.WritableStream */\n if (typeof chunk === 'function') {\n cb = chunk\n encoding = undefined\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n if (typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding ?? 'utf8')\n }\n if (cb) this.once('finish', cb)\n chunk ? super.end(chunk, cb) : super.end(cb)\n /* c8 ignore stop */\n return this\n }\n}\n\nconst getType = (stat: Stats): EntryTypeName | 'Unsupported' =>\n stat.isFile() ? 'File'\n : stat.isDirectory() ? 'Directory'\n : stat.isSymbolicLink() ? 'SymbolicLink'\n : 'Unsupported'\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/tar/package.json b/node_modules/cmake-js/node_modules/tar/package.json new file mode 100644 index 0000000..7565cf8 --- /dev/null +++ b/node_modules/cmake-js/node_modules/tar/package.json @@ -0,0 +1,292 @@ +{ + "author": "Isaac Z. Schlueter", + "name": "tar", + "description": "tar for node", + "version": "7.5.9", + "repository": { + "type": "git", + "url": "https://github.com/isaacs/node-tar.git" + }, + "scripts": { + "genparse": "node scripts/generate-parse-fixtures.js", + "snap": "tap", + "test": "tap", + "pretest": "npm run prepare", + "presnap": "npm run prepare", + "prepare": "tshy && bash scripts/build.sh", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "format": "prettier --write . --log-level warn", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" + }, + "dependencies": { + "@isaacs/fs-minipass": "^4.0.0", + "chownr": "^3.0.0", + "minipass": "^7.1.2", + "minizlib": "^3.1.0", + "yallist": "^5.0.0" + }, + "devDependencies": { + "@types/node": "^25.0.9", + "chmodr": "^2.0.2", + "end-of-stream": "^1.4.3", + "esbuild": "^0.27.3", + "events-to-array": "^2.0.3", + "mutate-fs": "^2.1.1", + "nock": "^13.5.4", + "prettier": "^3.8.0", + "rimraf": "^6.1.2", + "tap": "^21.5.0", + "tshy": "^3.1.0", + "typedoc": "^0.28.16" + }, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + }, + "files": [ + "dist" + ], + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.min.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.min.js" + } + }, + "./raw": "./src/index.ts", + "./c": "./src/create.ts", + "./create": "./src/create.ts", + "./replace": "./src/create.ts", + "./r": "./src/create.ts", + "./list": "./src/list.ts", + "./t": "./src/list.ts", + "./update": "./src/update.ts", + "./u": "./src/update.ts", + "./extract": "./src/extract.ts", + "./x": "./src/extract.ts", + "./pack": "./src/pack.ts", + "./unpack": "./src/unpack.ts", + "./parse": "./src/parse.ts", + "./read-entry": "./src/read-entry.ts", + "./write-entry": "./src/write-entry.ts", + "./header": "./src/header.ts", + "./pax": "./src/pax.ts", + "./types": "./src/types.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.min.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.min.js" + } + }, + "./raw": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + }, + "./c": { + "import": { + "types": "./dist/esm/create.d.ts", + "default": "./dist/esm/create.js" + }, + "require": { + "types": "./dist/commonjs/create.d.ts", + "default": "./dist/commonjs/create.js" + } + }, + "./create": { + "import": { + "types": "./dist/esm/create.d.ts", + "default": "./dist/esm/create.js" + }, + "require": { + "types": "./dist/commonjs/create.d.ts", + "default": "./dist/commonjs/create.js" + } + }, + "./replace": { + "import": { + "types": "./dist/esm/create.d.ts", + "default": "./dist/esm/create.js" + }, + "require": { + "types": "./dist/commonjs/create.d.ts", + "default": "./dist/commonjs/create.js" + } + }, + "./r": { + "import": { + "types": "./dist/esm/create.d.ts", + "default": "./dist/esm/create.js" + }, + "require": { + "types": "./dist/commonjs/create.d.ts", + "default": "./dist/commonjs/create.js" + } + }, + "./list": { + "import": { + "types": "./dist/esm/list.d.ts", + "default": "./dist/esm/list.js" + }, + "require": { + "types": "./dist/commonjs/list.d.ts", + "default": "./dist/commonjs/list.js" + } + }, + "./t": { + "import": { + "types": "./dist/esm/list.d.ts", + "default": "./dist/esm/list.js" + }, + "require": { + "types": "./dist/commonjs/list.d.ts", + "default": "./dist/commonjs/list.js" + } + }, + "./update": { + "import": { + "types": "./dist/esm/update.d.ts", + "default": "./dist/esm/update.js" + }, + "require": { + "types": "./dist/commonjs/update.d.ts", + "default": "./dist/commonjs/update.js" + } + }, + "./u": { + "import": { + "types": "./dist/esm/update.d.ts", + "default": "./dist/esm/update.js" + }, + "require": { + "types": "./dist/commonjs/update.d.ts", + "default": "./dist/commonjs/update.js" + } + }, + "./extract": { + "import": { + "types": "./dist/esm/extract.d.ts", + "default": "./dist/esm/extract.js" + }, + "require": { + "types": "./dist/commonjs/extract.d.ts", + "default": "./dist/commonjs/extract.js" + } + }, + "./x": { + "import": { + "types": "./dist/esm/extract.d.ts", + "default": "./dist/esm/extract.js" + }, + "require": { + "types": "./dist/commonjs/extract.d.ts", + "default": "./dist/commonjs/extract.js" + } + }, + "./pack": { + "import": { + "types": "./dist/esm/pack.d.ts", + "default": "./dist/esm/pack.js" + }, + "require": { + "types": "./dist/commonjs/pack.d.ts", + "default": "./dist/commonjs/pack.js" + } + }, + "./unpack": { + "import": { + "types": "./dist/esm/unpack.d.ts", + "default": "./dist/esm/unpack.js" + }, + "require": { + "types": "./dist/commonjs/unpack.d.ts", + "default": "./dist/commonjs/unpack.js" + } + }, + "./parse": { + "import": { + "types": "./dist/esm/parse.d.ts", + "default": "./dist/esm/parse.js" + }, + "require": { + "types": "./dist/commonjs/parse.d.ts", + "default": "./dist/commonjs/parse.js" + } + }, + "./read-entry": { + "import": { + "types": "./dist/esm/read-entry.d.ts", + "default": "./dist/esm/read-entry.js" + }, + "require": { + "types": "./dist/commonjs/read-entry.d.ts", + "default": "./dist/commonjs/read-entry.js" + } + }, + "./write-entry": { + "import": { + "types": "./dist/esm/write-entry.d.ts", + "default": "./dist/esm/write-entry.js" + }, + "require": { + "types": "./dist/commonjs/write-entry.d.ts", + "default": "./dist/commonjs/write-entry.js" + } + }, + "./header": { + "import": { + "types": "./dist/esm/header.d.ts", + "default": "./dist/esm/header.js" + }, + "require": { + "types": "./dist/commonjs/header.d.ts", + "default": "./dist/commonjs/header.js" + } + }, + "./pax": { + "import": { + "types": "./dist/esm/pax.d.ts", + "default": "./dist/esm/pax.js" + }, + "require": { + "types": "./dist/commonjs/pax.d.ts", + "default": "./dist/commonjs/pax.js" + } + }, + "./types": { + "import": { + "types": "./dist/esm/types.d.ts", + "default": "./dist/esm/types.js" + }, + "require": { + "types": "./dist/commonjs/types.d.ts", + "default": "./dist/commonjs/types.js" + } + } + }, + "type": "module", + "main": "./dist/commonjs/index.min.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.min.js" +} diff --git a/node_modules/cmake-js/node_modules/universalify/LICENSE b/node_modules/cmake-js/node_modules/universalify/LICENSE new file mode 100644 index 0000000..514e84e --- /dev/null +++ b/node_modules/cmake-js/node_modules/universalify/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2017, Ryan Zimmerman + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the 'Software'), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/cmake-js/node_modules/universalify/README.md b/node_modules/cmake-js/node_modules/universalify/README.md new file mode 100644 index 0000000..1184939 --- /dev/null +++ b/node_modules/cmake-js/node_modules/universalify/README.md @@ -0,0 +1,76 @@ +# universalify + +![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/RyanZim/universalify/ci.yml?branch=master) +![Coveralls github branch](https://img.shields.io/coveralls/github/RyanZim/universalify/master.svg) +![npm](https://img.shields.io/npm/dm/universalify.svg) +![npm](https://img.shields.io/npm/l/universalify.svg) + +Make a callback- or promise-based function support both promises and callbacks. + +Uses the native promise implementation. + +## Installation + +```bash +npm install universalify +``` + +## API + +### `universalify.fromCallback(fn)` + +Takes a callback-based function to universalify, and returns the universalified function. + +Function must take a callback as the last parameter that will be called with the signature `(error, result)`. `universalify` does not support calling the callback with three or more arguments, and does not ensure that the callback is only called once. + +```js +function callbackFn (n, cb) { + setTimeout(() => cb(null, n), 15) +} + +const fn = universalify.fromCallback(callbackFn) + +// Works with Promises: +fn('Hello World!') +.then(result => console.log(result)) // -> Hello World! +.catch(error => console.error(error)) + +// Works with Callbacks: +fn('Hi!', (error, result) => { + if (error) return console.error(error) + console.log(result) + // -> Hi! +}) +``` + +### `universalify.fromPromise(fn)` + +Takes a promise-based function to universalify, and returns the universalified function. + +Function must return a valid JS promise. `universalify` does not ensure that a valid promise is returned. + +```js +function promiseFn (n) { + return new Promise(resolve => { + setTimeout(() => resolve(n), 15) + }) +} + +const fn = universalify.fromPromise(promiseFn) + +// Works with Promises: +fn('Hello World!') +.then(result => console.log(result)) // -> Hello World! +.catch(error => console.error(error)) + +// Works with Callbacks: +fn('Hi!', (error, result) => { + if (error) return console.error(error) + console.log(result) + // -> Hi! +}) +``` + +## License + +MIT diff --git a/node_modules/cmake-js/node_modules/universalify/index.js b/node_modules/cmake-js/node_modules/universalify/index.js new file mode 100644 index 0000000..233beac --- /dev/null +++ b/node_modules/cmake-js/node_modules/universalify/index.js @@ -0,0 +1,24 @@ +'use strict' + +exports.fromCallback = function (fn) { + return Object.defineProperty(function (...args) { + if (typeof args[args.length - 1] === 'function') fn.apply(this, args) + else { + return new Promise((resolve, reject) => { + args.push((err, res) => (err != null) ? reject(err) : resolve(res)) + fn.apply(this, args) + }) + } + }, 'name', { value: fn.name }) +} + +exports.fromPromise = function (fn) { + return Object.defineProperty(function (...args) { + const cb = args[args.length - 1] + if (typeof cb !== 'function') return fn.apply(this, args) + else { + args.pop() + fn.apply(this, args).then(r => cb(null, r), cb) + } + }, 'name', { value: fn.name }) +} diff --git a/node_modules/cmake-js/node_modules/universalify/package.json b/node_modules/cmake-js/node_modules/universalify/package.json new file mode 100644 index 0000000..d60fccb --- /dev/null +++ b/node_modules/cmake-js/node_modules/universalify/package.json @@ -0,0 +1,34 @@ +{ + "name": "universalify", + "version": "2.0.1", + "description": "Make a callback- or promise-based function support both promises and callbacks.", + "keywords": [ + "callback", + "native", + "promise" + ], + "homepage": "https://github.com/RyanZim/universalify#readme", + "bugs": "https://github.com/RyanZim/universalify/issues", + "license": "MIT", + "author": "Ryan Zimmerman ", + "files": [ + "index.js" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/RyanZim/universalify.git" + }, + "scripts": { + "test": "standard && nyc --reporter text --reporter lcovonly tape test/*.js | colortape" + }, + "devDependencies": { + "colortape": "^0.1.2", + "coveralls": "^3.0.1", + "nyc": "^15.0.0", + "standard": "^14.3.1", + "tape": "^5.0.1" + }, + "engines": { + "node": ">= 10.0.0" + } +} diff --git a/node_modules/cmake-js/node_modules/which/LICENSE b/node_modules/cmake-js/node_modules/which/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/cmake-js/node_modules/which/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/cmake-js/node_modules/which/README.md b/node_modules/cmake-js/node_modules/which/README.md new file mode 100644 index 0000000..323aaf2 --- /dev/null +++ b/node_modules/cmake-js/node_modules/which/README.md @@ -0,0 +1,51 @@ +# which + +Like the unix `which` utility. + +Finds the first instance of a specified executable in the PATH +environment variable. Does not cache the results, so `hash -r` is not +needed when the PATH changes. + +## USAGE + +```javascript +const which = require('which') + +// async usage +// rejects if not found +const resolved = await which('node') + +// if nothrow option is used, returns null if not found +const resolvedOrNull = await which('node', { nothrow: true }) + +// sync usage +// throws if not found +const resolved = which.sync('node') + +// if nothrow option is used, returns null if not found +const resolvedOrNull = which.sync('node', { nothrow: true }) + +// Pass options to override the PATH and PATHEXT environment vars. +await which('node', { path: someOtherPath, pathExt: somePathExt }) +``` + +## CLI USAGE + +Just like the BSD `which(1)` binary but using `node-which`. + +``` +usage: node-which [-as] program ... +``` + +You can learn more about why the binary is `node-which` and not `which` +[here](https://github.com/npm/node-which/pull/67) + +## OPTIONS + +You may pass an options object as the second argument. + +- `path`: Use instead of the `PATH` environment variable. +- `pathExt`: Use instead of the `PATHEXT` environment variable. +- `all`: Return all matches, instead of just the first one. Note that + this means the function returns an array of strings instead of a + single string. diff --git a/node_modules/cmake-js/node_modules/which/bin/which.js b/node_modules/cmake-js/node_modules/which/bin/which.js new file mode 100755 index 0000000..6df16f2 --- /dev/null +++ b/node_modules/cmake-js/node_modules/which/bin/which.js @@ -0,0 +1,52 @@ +#!/usr/bin/env node + +const which = require('../lib') +const argv = process.argv.slice(2) + +const usage = (err) => { + if (err) { + console.error(`which: ${err}`) + } + console.error('usage: which [-as] program ...') + process.exit(1) +} + +if (!argv.length) { + return usage() +} + +let dashdash = false +const [commands, flags] = argv.reduce((acc, arg) => { + if (dashdash || arg === '--') { + dashdash = true + return acc + } + + if (!/^-/.test(arg)) { + acc[0].push(arg) + return acc + } + + for (const flag of arg.slice(1).split('')) { + if (flag === 's') { + acc[1].silent = true + } else if (flag === 'a') { + acc[1].all = true + } else { + usage(`illegal option -- ${flag}`) + } + } + + return acc +}, [[], {}]) + +for (const command of commands) { + try { + const res = which.sync(command, { all: flags.all }) + if (!flags.silent) { + console.log([].concat(res).join('\n')) + } + } catch (err) { + process.exitCode = 1 + } +} diff --git a/node_modules/cmake-js/node_modules/which/lib/index.js b/node_modules/cmake-js/node_modules/which/lib/index.js new file mode 100644 index 0000000..2fd358b --- /dev/null +++ b/node_modules/cmake-js/node_modules/which/lib/index.js @@ -0,0 +1,111 @@ +const { isexe, sync: isexeSync } = require('isexe') +const { join, delimiter, sep, posix } = require('path') + +const isWindows = process.platform === 'win32' + +// used to check for slashed in commands passed in. always checks for the posix +// seperator on all platforms, and checks for the current separator when not on +// a posix platform. don't use the isWindows check for this since that is mocked +// in tests but we still need the code to actually work when called. that is also +// why it is ignored from coverage. +/* istanbul ignore next */ +const rSlash = new RegExp(`[${posix.sep}${sep === posix.sep ? '' : sep}]`.replace(/(\\)/g, '\\$1')) +const rRel = new RegExp(`^\\.${rSlash.source}`) + +const getNotFoundError = (cmd) => + Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' }) + +const getPathInfo = (cmd, { + path: optPath = process.env.PATH, + pathExt: optPathExt = process.env.PATHEXT, + delimiter: optDelimiter = delimiter, +}) => { + // If it has a slash, then we don't bother searching the pathenv. + // just check the file itself, and that's it. + const pathEnv = cmd.match(rSlash) ? [''] : [ + // windows always checks the cwd first + ...(isWindows ? [process.cwd()] : []), + ...(optPath || /* istanbul ignore next: very unusual */ '').split(optDelimiter), + ] + + if (isWindows) { + const pathExtExe = optPathExt || + ['.EXE', '.CMD', '.BAT', '.COM'].join(optDelimiter) + const pathExt = pathExtExe.split(optDelimiter).flatMap((item) => [item, item.toLowerCase()]) + if (cmd.includes('.') && pathExt[0] !== '') { + pathExt.unshift('') + } + return { pathEnv, pathExt, pathExtExe } + } + + return { pathEnv, pathExt: [''] } +} + +const getPathPart = (raw, cmd) => { + const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw + const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : '' + return prefix + join(pathPart, cmd) +} + +const which = async (cmd, opt = {}) => { + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) + const found = [] + + for (const envPart of pathEnv) { + const p = getPathPart(envPart, cmd) + + for (const ext of pathExt) { + const withExt = p + ext + const is = await isexe(withExt, { pathExt: pathExtExe, ignoreErrors: true }) + if (is) { + if (!opt.all) { + return withExt + } + found.push(withExt) + } + } + } + + if (opt.all && found.length) { + return found + } + + if (opt.nothrow) { + return null + } + + throw getNotFoundError(cmd) +} + +const whichSync = (cmd, opt = {}) => { + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) + const found = [] + + for (const pathEnvPart of pathEnv) { + const p = getPathPart(pathEnvPart, cmd) + + for (const ext of pathExt) { + const withExt = p + ext + const is = isexeSync(withExt, { pathExt: pathExtExe, ignoreErrors: true }) + if (is) { + if (!opt.all) { + return withExt + } + found.push(withExt) + } + } + } + + if (opt.all && found.length) { + return found + } + + if (opt.nothrow) { + return null + } + + throw getNotFoundError(cmd) +} + +module.exports = which +which.sync = whichSync diff --git a/node_modules/cmake-js/node_modules/which/package.json b/node_modules/cmake-js/node_modules/which/package.json new file mode 100644 index 0000000..c6a4bf2 --- /dev/null +++ b/node_modules/cmake-js/node_modules/which/package.json @@ -0,0 +1,52 @@ +{ + "author": "GitHub Inc.", + "name": "which", + "description": "Like which(1) unix command. Find the first instance of an executable in the PATH.", + "version": "6.0.1", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/node-which.git" + }, + "main": "lib/index.js", + "bin": { + "node-which": "./bin/which.js" + }, + "license": "ISC", + "dependencies": { + "isexe": "^4.0.0" + }, + "devDependencies": { + "@npmcli/eslint-config": "^6.0.0", + "@npmcli/template-oss": "4.28.1", + "tap": "^16.3.0" + }, + "scripts": { + "test": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "files": [ + "bin/", + "lib/" + ], + "tap": { + "check-coverage": true, + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.28.1", + "publish": "true" + } +} diff --git a/node_modules/cmake-js/node_modules/yallist/LICENSE.md b/node_modules/cmake-js/node_modules/yallist/LICENSE.md new file mode 100644 index 0000000..881248b --- /dev/null +++ b/node_modules/cmake-js/node_modules/yallist/LICENSE.md @@ -0,0 +1,63 @@ +All packages under `src/` are licensed according to the terms in +their respective `LICENSE` or `LICENSE.md` files. + +The remainder of this project is licensed under the Blue Oak +Model License, as follows: + +----- + +# Blue Oak Model License + +Version 1.0.0 + +## Purpose + +This license gives everyone as much permission to work with +this software as possible, while protecting contributors +from liability. + +## Acceptance + +In order to receive this license, you must agree to its +rules. The rules of this license are both obligations +under that agreement and conditions to your license. +You must not do anything with this software that triggers +a rule that you cannot or will not follow. + +## Copyright + +Each contributor licenses you to do everything with this +software that would otherwise infringe that contributor's +copyright in it. + +## Notices + +You must ensure that everyone who gets a copy of +any part of this software from you, with or without +changes, also gets the text of this license or a link to +. + +## Excuse + +If anyone notifies you in writing that you have not +complied with [Notices](#notices), you can keep your +license by taking all practical steps to comply within 30 +days after the notice. If you do not do so, your license +ends immediately. + +## Patent + +Each contributor licenses you to do everything with this +software that would otherwise infringe any patent claims +they can license or become able to license. + +## Reliability + +No contributor can revoke this license. + +## No Liability + +***As far as the law allows, this software comes as is, +without any warranty or condition, and no contributor +will be liable to anyone for any damages related to this +software or this license, under any kind of legal claim.*** diff --git a/node_modules/cmake-js/node_modules/yallist/README.md b/node_modules/cmake-js/node_modules/yallist/README.md new file mode 100644 index 0000000..68f6162 --- /dev/null +++ b/node_modules/cmake-js/node_modules/yallist/README.md @@ -0,0 +1,205 @@ +# yallist + +Yet Another Linked List + +There are many doubly-linked list implementations like it, but this +one is mine. + +For when an array would be too big, and a Map can't be iterated in +reverse order. + +## basic usage + +```js +import { Yallist } from 'yallist' +var myList = new Yallist([1, 2, 3]) +myList.push('foo') +myList.unshift('bar') +// of course pop() and shift() are there, too +console.log(myList.toArray()) // ['bar', 1, 2, 3, 'foo'] +myList.forEach(function (k) { + // walk the list head to tail +}) +myList.forEachReverse(function (k, index, list) { + // walk the list tail to head +}) +var myDoubledList = myList.map(function (k) { + return k + k +}) +// now myDoubledList contains ['barbar', 2, 4, 6, 'foofoo'] +// mapReverse is also a thing +var myDoubledListReverse = myList.mapReverse(function (k) { + return k + k +}) // ['foofoo', 6, 4, 2, 'barbar'] + +var reduced = myList.reduce(function (set, entry) { + set += entry + return set +}, 'start') +console.log(reduced) // 'startfoo123bar' +``` + +## api + +The whole API is considered "public". + +Functions with the same name as an Array method work more or less the +same way. + +There's reverse versions of most things because that's the point. + +### Yallist + +Default export, the class that holds and manages a list. + +Call it with either a forEach-able (like an array) or a set of +arguments, to initialize the list. + +The Array-ish methods all act like you'd expect. No magic length, +though, so if you change that it won't automatically prune or add +empty spots. + +### Yallist.create(..) + +Alias for Yallist function. Some people like factories. + +#### yallist.head + +The first node in the list + +#### yallist.tail + +The last node in the list + +#### yallist.length + +The number of nodes in the list. (Change this at your peril. It is +not magic like Array length.) + +#### yallist.toArray() + +Convert the list to an array. + +#### yallist.forEach(fn, [thisp]) + +Call a function on each item in the list. + +#### yallist.forEachReverse(fn, [thisp]) + +Call a function on each item in the list, in reverse order. + +#### yallist.get(n) + +Get the data at position `n` in the list. If you use this a lot, +probably better off just using an Array. + +#### yallist.getReverse(n) + +Get the data at position `n`, counting from the tail. + +#### yallist.map(fn, thisp) + +Create a new Yallist with the result of calling the function on each +item. + +#### yallist.mapReverse(fn, thisp) + +Same as `map`, but in reverse. + +#### yallist.pop() + +Get the data from the list tail, and remove the tail from the list. + +#### yallist.push(item, ...) + +Insert one or more items to the tail of the list. + +#### yallist.reduce(fn, initialValue) + +Like Array.reduce. + +#### yallist.reduceReverse + +Like Array.reduce, but in reverse. + +#### yallist.reverse + +Reverse the list in place. + +#### yallist.shift() + +Get the data from the list head, and remove the head from the list. + +#### yallist.slice([from], [to]) + +Just like Array.slice, but returns a new Yallist. + +#### yallist.sliceReverse([from], [to]) + +Just like yallist.slice, but the result is returned in reverse. + +#### yallist.splice(start, deleteCount, ...) + +Like Array.splice. + +#### yallist.toArray() + +Create an array representation of the list. + +#### yallist.toArrayReverse() + +Create a reversed array representation of the list. + +#### yallist.unshift(item, ...) + +Insert one or more items to the head of the list. + +#### yallist.unshiftNode(node) + +Move a Node object to the front of the list. (That is, pull it out of +wherever it lives, and make it the new head.) + +If the node belongs to a different list, then that list will remove it +first. + +#### yallist.pushNode(node) + +Move a Node object to the end of the list. (That is, pull it out of +wherever it lives, and make it the new tail.) + +If the node belongs to a list already, then that list will remove it +first. + +#### yallist.removeNode(node) + +Remove a node from the list, preserving referential integrity of head +and tail and other nodes. + +Will throw an error if you try to have a list remove a node that +doesn't belong to it. + +### Yallist.Node + +The class that holds the data and is actually the list. + +Call with `const n = new Node(value, previousNode, nextNode)` + +Note that if you do direct operations on Nodes themselves, it's very +easy to get into weird states where the list is broken. Be careful :) + +#### node.next + +The next node in the list. + +#### node.prev + +The previous node in the list. + +#### node.value + +The data the node contains. + +#### node.list + +The list to which this node belongs. (Null if it does not belong to +any list.) diff --git a/node_modules/cmake-js/node_modules/yallist/dist/commonjs/index.d.ts b/node_modules/cmake-js/node_modules/yallist/dist/commonjs/index.d.ts new file mode 100644 index 0000000..044a1d7 --- /dev/null +++ b/node_modules/cmake-js/node_modules/yallist/dist/commonjs/index.d.ts @@ -0,0 +1,39 @@ +export declare class Yallist { + tail?: Node; + head?: Node; + length: number; + static create(list?: Iterable): Yallist; + constructor(list?: Iterable); + [Symbol.iterator](): Generator; + removeNode(node: Node): Node | undefined; + unshiftNode(node: Node): void; + pushNode(node: Node): void; + push(...args: T[]): number; + unshift(...args: T[]): number; + pop(): T | undefined; + shift(): T | undefined; + forEach(fn: (value: T, i: number, list: Yallist) => any, thisp?: any): void; + forEachReverse(fn: (value: T, i: number, list: Yallist) => any, thisp?: any): void; + get(n: number): T | undefined; + getReverse(n: number): T | undefined; + map(fn: (value: T, list: Yallist) => R, thisp?: any): Yallist; + mapReverse(fn: (value: T, list: Yallist) => R, thisp?: any): Yallist; + reduce(fn: (left: T, right: T, i: number) => T): T; + reduce(fn: (acc: R, next: T, i: number) => R, initial: R): R; + reduceReverse(fn: (left: T, right: T, i: number) => T): T; + reduceReverse(fn: (acc: R, next: T, i: number) => R, initial: R): R; + toArray(): any[]; + toArrayReverse(): any[]; + slice(from?: number, to?: number): Yallist; + sliceReverse(from?: number, to?: number): Yallist; + splice(start: number, deleteCount?: number, ...nodes: T[]): T[]; + reverse(): this; +} +export declare class Node { + list?: Yallist; + next?: Node; + prev?: Node; + value: T; + constructor(value: T, prev?: Node | undefined, next?: Node | undefined, list?: Yallist | undefined); +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/yallist/dist/commonjs/index.d.ts.map b/node_modules/cmake-js/node_modules/yallist/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000..22a0438 --- /dev/null +++ b/node_modules/cmake-js/node_modules/yallist/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,qBAAa,OAAO,CAAC,CAAC,GAAG,OAAO;IAC9B,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACd,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACd,MAAM,EAAE,MAAM,CAAI;IAElB,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,GAAE,QAA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AC,CAAC,CAAC,GAAG,SAAS;CAmBhC"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/yallist/dist/commonjs/index.js b/node_modules/cmake-js/node_modules/yallist/dist/commonjs/index.js new file mode 100644 index 0000000..c1e1e47 --- /dev/null +++ b/node_modules/cmake-js/node_modules/yallist/dist/commonjs/index.js @@ -0,0 +1,384 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Node = exports.Yallist = void 0; +class Yallist { + tail; + head; + length = 0; + static create(list = []) { + return new Yallist(list); + } + constructor(list = []) { + for (const item of list) { + this.push(item); + } + } + *[Symbol.iterator]() { + for (let walker = this.head; walker; walker = walker.next) { + yield walker.value; + } + } + removeNode(node) { + if (node.list !== this) { + throw new Error('removing node which does not belong to this list'); + } + const next = node.next; + const prev = node.prev; + if (next) { + next.prev = prev; + } + if (prev) { + prev.next = next; + } + if (node === this.head) { + this.head = next; + } + if (node === this.tail) { + this.tail = prev; + } + this.length--; + node.next = undefined; + node.prev = undefined; + node.list = undefined; + return next; + } + unshiftNode(node) { + if (node === this.head) { + return; + } + if (node.list) { + node.list.removeNode(node); + } + const head = this.head; + node.list = this; + node.next = head; + if (head) { + head.prev = node; + } + this.head = node; + if (!this.tail) { + this.tail = node; + } + this.length++; + } + pushNode(node) { + if (node === this.tail) { + return; + } + if (node.list) { + node.list.removeNode(node); + } + const tail = this.tail; + node.list = this; + node.prev = tail; + if (tail) { + tail.next = node; + } + this.tail = node; + if (!this.head) { + this.head = node; + } + this.length++; + } + push(...args) { + for (let i = 0, l = args.length; i < l; i++) { + push(this, args[i]); + } + return this.length; + } + unshift(...args) { + for (var i = 0, l = args.length; i < l; i++) { + unshift(this, args[i]); + } + return this.length; + } + pop() { + if (!this.tail) { + return undefined; + } + const res = this.tail.value; + const t = this.tail; + this.tail = this.tail.prev; + if (this.tail) { + this.tail.next = undefined; + } + else { + this.head = undefined; + } + t.list = undefined; + this.length--; + return res; + } + shift() { + if (!this.head) { + return undefined; + } + const res = this.head.value; + const h = this.head; + this.head = this.head.next; + if (this.head) { + this.head.prev = undefined; + } + else { + this.tail = undefined; + } + h.list = undefined; + this.length--; + return res; + } + forEach(fn, thisp) { + thisp = thisp || this; + for (let walker = this.head, i = 0; !!walker; i++) { + fn.call(thisp, walker.value, i, this); + walker = walker.next; + } + } + forEachReverse(fn, thisp) { + thisp = thisp || this; + for (let walker = this.tail, i = this.length - 1; !!walker; i--) { + fn.call(thisp, walker.value, i, this); + walker = walker.prev; + } + } + get(n) { + let i = 0; + let walker = this.head; + for (; !!walker && i < n; i++) { + walker = walker.next; + } + if (i === n && !!walker) { + return walker.value; + } + } + getReverse(n) { + let i = 0; + let walker = this.tail; + for (; !!walker && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.prev; + } + if (i === n && !!walker) { + return walker.value; + } + } + map(fn, thisp) { + thisp = thisp || this; + const res = new Yallist(); + for (let walker = this.head; !!walker;) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.next; + } + return res; + } + mapReverse(fn, thisp) { + thisp = thisp || this; + var res = new Yallist(); + for (let walker = this.tail; !!walker;) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.prev; + } + return res; + } + reduce(fn, initial) { + let acc; + let walker = this.head; + if (arguments.length > 1) { + acc = initial; + } + else if (this.head) { + walker = this.head.next; + acc = this.head.value; + } + else { + throw new TypeError('Reduce of empty list with no initial value'); + } + for (var i = 0; !!walker; i++) { + acc = fn(acc, walker.value, i); + walker = walker.next; + } + return acc; + } + reduceReverse(fn, initial) { + let acc; + let walker = this.tail; + if (arguments.length > 1) { + acc = initial; + } + else if (this.tail) { + walker = this.tail.prev; + acc = this.tail.value; + } + else { + throw new TypeError('Reduce of empty list with no initial value'); + } + for (let i = this.length - 1; !!walker; i--) { + acc = fn(acc, walker.value, i); + walker = walker.prev; + } + return acc; + } + toArray() { + const arr = new Array(this.length); + for (let i = 0, walker = this.head; !!walker; i++) { + arr[i] = walker.value; + walker = walker.next; + } + return arr; + } + toArrayReverse() { + const arr = new Array(this.length); + for (let i = 0, walker = this.tail; !!walker; i++) { + arr[i] = walker.value; + walker = walker.prev; + } + return arr; + } + slice(from = 0, to = this.length) { + if (to < 0) { + to += this.length; + } + if (from < 0) { + from += this.length; + } + const ret = new Yallist(); + if (to < from || to < 0) { + return ret; + } + if (from < 0) { + from = 0; + } + if (to > this.length) { + to = this.length; + } + let walker = this.head; + let i = 0; + for (i = 0; !!walker && i < from; i++) { + walker = walker.next; + } + for (; !!walker && i < to; i++, walker = walker.next) { + ret.push(walker.value); + } + return ret; + } + sliceReverse(from = 0, to = this.length) { + if (to < 0) { + to += this.length; + } + if (from < 0) { + from += this.length; + } + const ret = new Yallist(); + if (to < from || to < 0) { + return ret; + } + if (from < 0) { + from = 0; + } + if (to > this.length) { + to = this.length; + } + let i = this.length; + let walker = this.tail; + for (; !!walker && i > to; i--) { + walker = walker.prev; + } + for (; !!walker && i > from; i--, walker = walker.prev) { + ret.push(walker.value); + } + return ret; + } + splice(start, deleteCount = 0, ...nodes) { + if (start > this.length) { + start = this.length - 1; + } + if (start < 0) { + start = this.length + start; + } + let walker = this.head; + for (let i = 0; !!walker && i < start; i++) { + walker = walker.next; + } + const ret = []; + for (let i = 0; !!walker && i < deleteCount; i++) { + ret.push(walker.value); + walker = this.removeNode(walker); + } + if (!walker) { + walker = this.tail; + } + else if (walker !== this.tail) { + walker = walker.prev; + } + for (const v of nodes) { + walker = insertAfter(this, walker, v); + } + return ret; + } + reverse() { + const head = this.head; + const tail = this.tail; + for (let walker = head; !!walker; walker = walker.prev) { + const p = walker.prev; + walker.prev = walker.next; + walker.next = p; + } + this.head = tail; + this.tail = head; + return this; + } +} +exports.Yallist = Yallist; +// insertAfter undefined means "make the node the new head of list" +function insertAfter(self, node, value) { + const prev = node; + const next = node ? node.next : self.head; + const inserted = new Node(value, prev, next, self); + if (inserted.next === undefined) { + self.tail = inserted; + } + if (inserted.prev === undefined) { + self.head = inserted; + } + self.length++; + return inserted; +} +function push(self, item) { + self.tail = new Node(item, self.tail, undefined, self); + if (!self.head) { + self.head = self.tail; + } + self.length++; +} +function unshift(self, item) { + self.head = new Node(item, undefined, self.head, self); + if (!self.tail) { + self.tail = self.head; + } + self.length++; +} +class Node { + list; + next; + prev; + value; + constructor(value, prev, next, list) { + this.list = list; + this.value = value; + if (prev) { + prev.next = this; + this.prev = prev; + } + else { + this.prev = undefined; + } + if (next) { + next.prev = this; + this.next = next; + } + else { + this.next = undefined; + } + } +} +exports.Node = Node; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/yallist/dist/commonjs/index.js.map b/node_modules/cmake-js/node_modules/yallist/dist/commonjs/index.js.map new file mode 100644 index 0000000..e90e328 --- /dev/null +++ b/node_modules/cmake-js/node_modules/yallist/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,MAAa,OAAO;IAClB,IAAI,CAAU;IACd,IAAI,CAAU;IACd,MAAM,GAAW,CAAC,CAAA;IAElB,MAAM,CAAC,MAAM,CAAc,OAAoB,EAAE;QAC/C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC;IAED,YAAY,OAAoB,EAAE;QAChC,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACjB,CAAC;IACH,CAAC;IAED,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,KAAK,IAAI,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;YAC1D,MAAM,MAAM,CAAC,KAAK,CAAA;QACpB,CAAC;IACH,CAAC;IAED,UAAU,CAAC,IAAa;QACtB,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CACb,kDA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AI,GAAG,IAAI,CAAA;YAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAClB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,GAAG,SAAS,CAAA;QACvB,CAAC;IACH,CAAC;CACF;AA7BD,oBA6BC","sourcesContent":["export class Yallist {\n tail?: Node\n head?: Node\n length: number = 0\n\n static create(list: Iterable = []) {\n return new Yallist(list)\n }\n\n constructor(list: Iterable = []) {\n for (const item of list) {\n this.push(item)\n }\n }\n\n *[Symbol.iterator]() {\n for (let walker = this.head; walker; walker = walker.next) {\n yield walker.value\n }\n }\n\n removeNode(node: Node) {\n if (node.list !== this) {\n throw new Error(\n 'removing node which does not belong to this list',\n )\n }\n\n const next = node.next\n const prev = node.prev\n\n if (next) {\n next.prev = prev\n }\n\n if (prev) {\n prev.next = next\n }\n\n if (node === this.head) {\n this.head = next\n }\n if (node === this.tail) {\n this.tail = prev\n }\n\n this.length--\n node.next = undefined\n node.prev = undefined\n node.list = undefined\n\n return next\n }\n\n unshiftNode(node: Node) {\n if (node === this.head) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n const head = this.head\n node.list = this\n node.next = head\n if (head) {\n head.prev = node\n }\n\n this.head = node\n if (!this.tail) {\n this.tail = node\n }\n this.length++\n }\n\n pushNode(node: Node) {\n if (node === this.tail) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n const tail = this.tail\n node.list = this\n node.prev = tail\n if (tail) {\n tail.next = node\n }\n\n this.tail = node\n if (!this.head) {\n this.head = node\n }\n this.length++\n }\n\n push(...args: T[]) {\n for (let i = 0, l = args.length; i < l; i++) {\n push(this, args[i])\n }\n return this.length\n }\n\n unshift(...args: T[]) {\n for (var i = 0, l = args.length; i < l; i++) {\n unshift(this, args[i])\n }\n return this.length\n }\n\n pop() {\n if (!this.tail) {\n return undefined\n }\n\n const res = this.tail.value\n const t = this.tail\n this.tail = this.tail.prev\n if (this.tail) {\n this.tail.next = undefined\n } else {\n this.head = undefined\n }\n t.list = undefined\n this.length--\n return res\n }\n\n shift() {\n if (!this.head) {\n return undefined\n }\n\n const res = this.head.value\n const h = this.head\n this.head = this.head.next\n if (this.head) {\n this.head.prev = undefined\n } else {\n this.tail = undefined\n }\n h.list = undefined\n this.length--\n return res\n }\n\n forEach(\n fn: (value: T, i: number, list: Yallist) => any,\n thisp?: any,\n ) {\n thisp = thisp || this\n for (let walker = this.head, i = 0; !!walker; i++) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.next\n }\n }\n\n forEachReverse(\n fn: (value: T, i: number, list: Yallist) => any,\n thisp?: any,\n ) {\n thisp = thisp || this\n for (let walker = this.tail, i = this.length - 1; !!walker; i--) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.prev\n }\n }\n\n get(n: number) {\n let i = 0\n let walker = this.head\n for (; !!walker && i < n; i++) {\n walker = walker.next\n }\n if (i === n && !!walker) {\n return walker.value\n }\n }\n\n getReverse(n: number) {\n let i = 0\n let walker = this.tail\n for (; !!walker && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.prev\n }\n if (i === n && !!walker) {\n return walker.value\n }\n }\n\n map(\n fn: (value: T, list: Yallist) => R,\n thisp?: any,\n ): Yallist {\n thisp = thisp || this\n const res = new Yallist()\n for (let walker = this.head; !!walker; ) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.next\n }\n return res\n }\n\n mapReverse(\n fn: (value: T, list: Yallist) => R,\n thisp?: any,\n ): Yallist {\n thisp = thisp || this\n var res = new Yallist()\n for (let walker = this.tail; !!walker; ) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.prev\n }\n return res\n }\n\n reduce(fn: (left: T, right: T, i: number) => T): T\n reduce(\n fn: (acc: R, next: T, i: number) => R,\n initial: R,\n ): R\n reduce(\n fn: (acc: R, next: T, i: number) => R,\n initial?: R,\n ): R {\n let acc: R | T\n let walker = this.head\n if (arguments.length > 1) {\n acc = initial as R\n } else if (this.head) {\n walker = this.head.next\n acc = this.head.value\n } else {\n throw new TypeError(\n 'Reduce of empty list with no initial value',\n )\n }\n\n for (var i = 0; !!walker; i++) {\n acc = fn(acc as R, walker.value, i)\n walker = walker.next\n }\n\n return acc as R\n }\n\n reduceReverse(fn: (left: T, right: T, i: number) => T): T\n reduceReverse(\n fn: (acc: R, next: T, i: number) => R,\n initial: R,\n ): R\n reduceReverse(\n fn: (acc: R, next: T, i: number) => R,\n initial?: R,\n ): R {\n let acc: R | T\n let walker = this.tail\n if (arguments.length > 1) {\n acc = initial as R\n } else if (this.tail) {\n walker = this.tail.prev\n acc = this.tail.value\n } else {\n throw new TypeError(\n 'Reduce of empty list with no initial value',\n )\n }\n\n for (let i = this.length - 1; !!walker; i--) {\n acc = fn(acc as R, walker.value, i)\n walker = walker.prev\n }\n\n return acc as R\n }\n\n toArray() {\n const arr = new Array(this.length)\n for (let i = 0, walker = this.head; !!walker; i++) {\n arr[i] = walker.value\n walker = walker.next\n }\n return arr\n }\n\n toArrayReverse() {\n const arr = new Array(this.length)\n for (let i = 0, walker = this.tail; !!walker; i++) {\n arr[i] = walker.value\n walker = walker.prev\n }\n return arr\n }\n\n slice(from: number = 0, to: number = this.length) {\n if (to < 0) {\n to += this.length\n }\n if (from < 0) {\n from += this.length\n }\n const ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n let walker = this.head\n let i = 0\n for (i = 0; !!walker && i < from; i++) {\n walker = walker.next\n }\n for (; !!walker && i < to; i++, walker = walker.next) {\n ret.push(walker.value)\n }\n return ret\n }\n\n sliceReverse(from: number = 0, to: number = this.length) {\n if (to < 0) {\n to += this.length\n }\n if (from < 0) {\n from += this.length\n }\n const ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n let i = this.length\n let walker = this.tail\n for (; !!walker && i > to; i--) {\n walker = walker.prev\n }\n for (; !!walker && i > from; i--, walker = walker.prev) {\n ret.push(walker.value)\n }\n return ret\n }\n\n splice(start: number, deleteCount: number = 0, ...nodes: T[]) {\n if (start > this.length) {\n start = this.length - 1\n }\n if (start < 0) {\n start = this.length + start\n }\n\n let walker = this.head\n\n for (let i = 0; !!walker && i < start; i++) {\n walker = walker.next\n }\n\n const ret: T[] = []\n for (let i = 0; !!walker && i < deleteCount; i++) {\n ret.push(walker.value)\n walker = this.removeNode(walker)\n }\n if (!walker) {\n walker = this.tail\n } else if (walker !== this.tail) {\n walker = walker.prev\n }\n\n for (const v of nodes) {\n walker = insertAfter(this, walker, v)\n }\n\n return ret\n }\n\n reverse() {\n const head = this.head\n const tail = this.tail\n for (let walker = head; !!walker; walker = walker.prev) {\n const p = walker.prev\n walker.prev = walker.next\n walker.next = p\n }\n this.head = tail\n this.tail = head\n return this\n }\n}\n\n// insertAfter undefined means \"make the node the new head of list\"\nfunction insertAfter(\n self: Yallist,\n node: Node | undefined,\n value: T,\n) {\n const prev = node\n const next = node ? node.next : self.head\n const inserted = new Node(value, prev, next, self)\n\n if (inserted.next === undefined) {\n self.tail = inserted\n }\n if (inserted.prev === undefined) {\n self.head = inserted\n }\n\n self.length++\n\n return inserted\n}\n\nfunction push(self: Yallist, item: T) {\n self.tail = new Node(item, self.tail, undefined, self)\n if (!self.head) {\n self.head = self.tail\n }\n self.length++\n}\n\nfunction unshift(self: Yallist, item: T) {\n self.head = new Node(item, undefined, self.head, self)\n if (!self.tail) {\n self.tail = self.head\n }\n self.length++\n}\n\nexport class Node {\n list?: Yallist\n next?: Node\n prev?: Node\n value: T\n\n constructor(\n value: T,\n prev?: Node | undefined,\n next?: Node | undefined,\n list?: Yallist | undefined,\n ) {\n this.list = list\n this.value = value\n\n if (prev) {\n prev.next = this\n this.prev = prev\n } else {\n this.prev = undefined\n }\n\n if (next) {\n next.prev = this\n this.next = next\n } else {\n this.next = undefined\n }\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/yallist/dist/commonjs/package.json b/node_modules/cmake-js/node_modules/yallist/dist/commonjs/package.json new file mode 100644 index 0000000..5bbefff --- /dev/null +++ b/node_modules/cmake-js/node_modules/yallist/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/cmake-js/node_modules/yallist/dist/esm/index.d.ts b/node_modules/cmake-js/node_modules/yallist/dist/esm/index.d.ts new file mode 100644 index 0000000..044a1d7 --- /dev/null +++ b/node_modules/cmake-js/node_modules/yallist/dist/esm/index.d.ts @@ -0,0 +1,39 @@ +export declare class Yallist { + tail?: Node; + head?: Node; + length: number; + static create(list?: Iterable): Yallist; + constructor(list?: Iterable); + [Symbol.iterator](): Generator; + removeNode(node: Node): Node | undefined; + unshiftNode(node: Node): void; + pushNode(node: Node): void; + push(...args: T[]): number; + unshift(...args: T[]): number; + pop(): T | undefined; + shift(): T | undefined; + forEach(fn: (value: T, i: number, list: Yallist) => any, thisp?: any): void; + forEachReverse(fn: (value: T, i: number, list: Yallist) => any, thisp?: any): void; + get(n: number): T | undefined; + getReverse(n: number): T | undefined; + map(fn: (value: T, list: Yallist) => R, thisp?: any): Yallist; + mapReverse(fn: (value: T, list: Yallist) => R, thisp?: any): Yallist; + reduce(fn: (left: T, right: T, i: number) => T): T; + reduce(fn: (acc: R, next: T, i: number) => R, initial: R): R; + reduceReverse(fn: (left: T, right: T, i: number) => T): T; + reduceReverse(fn: (acc: R, next: T, i: number) => R, initial: R): R; + toArray(): any[]; + toArrayReverse(): any[]; + slice(from?: number, to?: number): Yallist; + sliceReverse(from?: number, to?: number): Yallist; + splice(start: number, deleteCount?: number, ...nodes: T[]): T[]; + reverse(): this; +} +export declare class Node { + list?: Yallist; + next?: Node; + prev?: Node; + value: T; + constructor(value: T, prev?: Node | undefined, next?: Node | undefined, list?: Yallist | undefined); +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/yallist/dist/esm/index.d.ts.map b/node_modules/cmake-js/node_modules/yallist/dist/esm/index.d.ts.map new file mode 100644 index 0000000..22a0438 --- /dev/null +++ b/node_modules/cmake-js/node_modules/yallist/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,qBAAa,OAAO,CAAC,CAAC,GAAG,OAAO;IAC9B,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACd,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACd,MAAM,EAAE,MAAM,CAAI;IAElB,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,GAAE,QAAQ,CAAC,CAAC,CAAM;gBAIrC,IAAI,GAAE,QAAQ,CAAC,CAAC,CAAM;IAMjC,CAAC,MAAM,CAAC,QAAQ,CAAC;IAMlB,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAiCxB,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAuBzB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAuBtB,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE;IAOjB,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE;IAOpB,GAAG;IAkBH,KAAK;IAkBL,OAAO,CACL,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,EAClD,KAAK,CAAC,EAAE,GAAG;IASb,cAAc,CACZ,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,EAClD,KAAK,CAAC,EAAE,GAAG;IASb,GAAG,CAAC,CAAC,EAAE,MAAM;IAWb,UAAU,CAAC,CAAC,EAAE,MAAM;IAY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C5D,OAAO;CAYR;AAwCD,qBAAa,IAAI,CAAC,CAAC,GAAG,OAAO;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;IACjB,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACd,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACd,KAAK,EAAE,CAAC,CAAA;gBAGN,KAAK,EAAE,CAAC,EACR,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,SAAS,EAC1B,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,SAAS,EAC1B,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS;CAmBhC"} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/yallist/dist/esm/index.js b/node_modules/cmake-js/node_modules/yallist/dist/esm/index.js new file mode 100644 index 0000000..3d81c51 --- /dev/null +++ b/node_modules/cmake-js/node_modules/yallist/dist/esm/index.js @@ -0,0 +1,379 @@ +export class Yallist { + tail; + head; + length = 0; + static create(list = []) { + return new Yallist(list); + } + constructor(list = []) { + for (const item of list) { + this.push(item); + } + } + *[Symbol.iterator]() { + for (let walker = this.head; walker; walker = walker.next) { + yield walker.value; + } + } + removeNode(node) { + if (node.list !== this) { + throw new Error('removing node which does not belong to this list'); + } + const next = node.next; + const prev = node.prev; + if (next) { + next.prev = prev; + } + if (prev) { + prev.next = next; + } + if (node === this.head) { + this.head = next; + } + if (node === this.tail) { + this.tail = prev; + } + this.length--; + node.next = undefined; + node.prev = undefined; + node.list = undefined; + return next; + } + unshiftNode(node) { + if (node === this.head) { + return; + } + if (node.list) { + node.list.removeNode(node); + } + const head = this.head; + node.list = this; + node.next = head; + if (head) { + head.prev = node; + } + this.head = node; + if (!this.tail) { + this.tail = node; + } + this.length++; + } + pushNode(node) { + if (node === this.tail) { + return; + } + if (node.list) { + node.list.removeNode(node); + } + const tail = this.tail; + node.list = this; + node.prev = tail; + if (tail) { + tail.next = node; + } + this.tail = node; + if (!this.head) { + this.head = node; + } + this.length++; + } + push(...args) { + for (let i = 0, l = args.length; i < l; i++) { + push(this, args[i]); + } + return this.length; + } + unshift(...args) { + for (var i = 0, l = args.length; i < l; i++) { + unshift(this, args[i]); + } + return this.length; + } + pop() { + if (!this.tail) { + return undefined; + } + const res = this.tail.value; + const t = this.tail; + this.tail = this.tail.prev; + if (this.tail) { + this.tail.next = undefined; + } + else { + this.head = undefined; + } + t.list = undefined; + this.length--; + return res; + } + shift() { + if (!this.head) { + return undefined; + } + const res = this.head.value; + const h = this.head; + this.head = this.head.next; + if (this.head) { + this.head.prev = undefined; + } + else { + this.tail = undefined; + } + h.list = undefined; + this.length--; + return res; + } + forEach(fn, thisp) { + thisp = thisp || this; + for (let walker = this.head, i = 0; !!walker; i++) { + fn.call(thisp, walker.value, i, this); + walker = walker.next; + } + } + forEachReverse(fn, thisp) { + thisp = thisp || this; + for (let walker = this.tail, i = this.length - 1; !!walker; i--) { + fn.call(thisp, walker.value, i, this); + walker = walker.prev; + } + } + get(n) { + let i = 0; + let walker = this.head; + for (; !!walker && i < n; i++) { + walker = walker.next; + } + if (i === n && !!walker) { + return walker.value; + } + } + getReverse(n) { + let i = 0; + let walker = this.tail; + for (; !!walker && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.prev; + } + if (i === n && !!walker) { + return walker.value; + } + } + map(fn, thisp) { + thisp = thisp || this; + const res = new Yallist(); + for (let walker = this.head; !!walker;) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.next; + } + return res; + } + mapReverse(fn, thisp) { + thisp = thisp || this; + var res = new Yallist(); + for (let walker = this.tail; !!walker;) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.prev; + } + return res; + } + reduce(fn, initial) { + let acc; + let walker = this.head; + if (arguments.length > 1) { + acc = initial; + } + else if (this.head) { + walker = this.head.next; + acc = this.head.value; + } + else { + throw new TypeError('Reduce of empty list with no initial value'); + } + for (var i = 0; !!walker; i++) { + acc = fn(acc, walker.value, i); + walker = walker.next; + } + return acc; + } + reduceReverse(fn, initial) { + let acc; + let walker = this.tail; + if (arguments.length > 1) { + acc = initial; + } + else if (this.tail) { + walker = this.tail.prev; + acc = this.tail.value; + } + else { + throw new TypeError('Reduce of empty list with no initial value'); + } + for (let i = this.length - 1; !!walker; i--) { + acc = fn(acc, walker.value, i); + walker = walker.prev; + } + return acc; + } + toArray() { + const arr = new Array(this.length); + for (let i = 0, walker = this.head; !!walker; i++) { + arr[i] = walker.value; + walker = walker.next; + } + return arr; + } + toArrayReverse() { + const arr = new Array(this.length); + for (let i = 0, walker = this.tail; !!walker; i++) { + arr[i] = walker.value; + walker = walker.prev; + } + return arr; + } + slice(from = 0, to = this.length) { + if (to < 0) { + to += this.length; + } + if (from < 0) { + from += this.length; + } + const ret = new Yallist(); + if (to < from || to < 0) { + return ret; + } + if (from < 0) { + from = 0; + } + if (to > this.length) { + to = this.length; + } + let walker = this.head; + let i = 0; + for (i = 0; !!walker && i < from; i++) { + walker = walker.next; + } + for (; !!walker && i < to; i++, walker = walker.next) { + ret.push(walker.value); + } + return ret; + } + sliceReverse(from = 0, to = this.length) { + if (to < 0) { + to += this.length; + } + if (from < 0) { + from += this.length; + } + const ret = new Yallist(); + if (to < from || to < 0) { + return ret; + } + if (from < 0) { + from = 0; + } + if (to > this.length) { + to = this.length; + } + let i = this.length; + let walker = this.tail; + for (; !!walker && i > to; i--) { + walker = walker.prev; + } + for (; !!walker && i > from; i--, walker = walker.prev) { + ret.push(walker.value); + } + return ret; + } + splice(start, deleteCount = 0, ...nodes) { + if (start > this.length) { + start = this.length - 1; + } + if (start < 0) { + start = this.length + start; + } + let walker = this.head; + for (let i = 0; !!walker && i < start; i++) { + walker = walker.next; + } + const ret = []; + for (let i = 0; !!walker && i < deleteCount; i++) { + ret.push(walker.value); + walker = this.removeNode(walker); + } + if (!walker) { + walker = this.tail; + } + else if (walker !== this.tail) { + walker = walker.prev; + } + for (const v of nodes) { + walker = insertAfter(this, walker, v); + } + return ret; + } + reverse() { + const head = this.head; + const tail = this.tail; + for (let walker = head; !!walker; walker = walker.prev) { + const p = walker.prev; + walker.prev = walker.next; + walker.next = p; + } + this.head = tail; + this.tail = head; + return this; + } +} +// insertAfter undefined means "make the node the new head of list" +function insertAfter(self, node, value) { + const prev = node; + const next = node ? node.next : self.head; + const inserted = new Node(value, prev, next, self); + if (inserted.next === undefined) { + self.tail = inserted; + } + if (inserted.prev === undefined) { + self.head = inserted; + } + self.length++; + return inserted; +} +function push(self, item) { + self.tail = new Node(item, self.tail, undefined, self); + if (!self.head) { + self.head = self.tail; + } + self.length++; +} +function unshift(self, item) { + self.head = new Node(item, undefined, self.head, self); + if (!self.tail) { + self.tail = self.head; + } + self.length++; +} +export class Node { + list; + next; + prev; + value; + constructor(value, prev, next, list) { + this.list = list; + this.value = value; + if (prev) { + prev.next = this; + this.prev = prev; + } + else { + this.prev = undefined; + } + if (next) { + next.prev = this; + this.next = next; + } + else { + this.next = undefined; + } + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/yallist/dist/esm/index.js.map b/node_modules/cmake-js/node_modules/yallist/dist/esm/index.js.map new file mode 100644 index 0000000..21f21e6 --- /dev/null +++ b/node_modules/cmake-js/node_modules/yallist/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,OAAO;IAClB,IAAI,CAAU;IACd,IAAI,CAAU;IACd,MAAM,GAAW,CAAC,CAAA;IAElB,MAAM,CAAC,MAAM,CAAc,OAAoB,EAAE;QAC/C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC;IAED,YAAY,OAAoB,EAAE;QAChC,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACjB,CAA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QAE7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAElB,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;YAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAClB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,GAAG,SAAS,CAAA;QACvB,CAAC;QAED,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;YAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAClB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,GAAG,SAAS,CAAA;QACvB,CAAC;IACH,CAAC;CACF","sourcesContent":["export class Yallist {\n tail?: Node\n head?: Node\n length: number = 0\n\n static create(list: Iterable = []) {\n return new Yallist(list)\n }\n\n constructor(list: Iterable = []) {\n for (const item of list) {\n this.push(item)\n }\n }\n\n *[Symbol.iterator]() {\n for (let walker = this.head; walker; walker = walker.next) {\n yield walker.value\n }\n }\n\n removeNode(node: Node) {\n if (node.list !== this) {\n throw new Error(\n 'removing node which does not belong to this list',\n )\n }\n\n const next = node.next\n const prev = node.prev\n\n if (next) {\n next.prev = prev\n }\n\n if (prev) {\n prev.next = next\n }\n\n if (node === this.head) {\n this.head = next\n }\n if (node === this.tail) {\n this.tail = prev\n }\n\n this.length--\n node.next = undefined\n node.prev = undefined\n node.list = undefined\n\n return next\n }\n\n unshiftNode(node: Node) {\n if (node === this.head) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n const head = this.head\n node.list = this\n node.next = head\n if (head) {\n head.prev = node\n }\n\n this.head = node\n if (!this.tail) {\n this.tail = node\n }\n this.length++\n }\n\n pushNode(node: Node) {\n if (node === this.tail) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n const tail = this.tail\n node.list = this\n node.prev = tail\n if (tail) {\n tail.next = node\n }\n\n this.tail = node\n if (!this.head) {\n this.head = node\n }\n this.length++\n }\n\n push(...args: T[]) {\n for (let i = 0, l = args.length; i < l; i++) {\n push(this, args[i])\n }\n return this.length\n }\n\n unshift(...args: T[]) {\n for (var i = 0, l = args.length; i < l; i++) {\n unshift(this, args[i])\n }\n return this.length\n }\n\n pop() {\n if (!this.tail) {\n return undefined\n }\n\n const res = this.tail.value\n const t = this.tail\n this.tail = this.tail.prev\n if (this.tail) {\n this.tail.next = undefined\n } else {\n this.head = undefined\n }\n t.list = undefined\n this.length--\n return res\n }\n\n shift() {\n if (!this.head) {\n return undefined\n }\n\n const res = this.head.value\n const h = this.head\n this.head = this.head.next\n if (this.head) {\n this.head.prev = undefined\n } else {\n this.tail = undefined\n }\n h.list = undefined\n this.length--\n return res\n }\n\n forEach(\n fn: (value: T, i: number, list: Yallist) => any,\n thisp?: any,\n ) {\n thisp = thisp || this\n for (let walker = this.head, i = 0; !!walker; i++) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.next\n }\n }\n\n forEachReverse(\n fn: (value: T, i: number, list: Yallist) => any,\n thisp?: any,\n ) {\n thisp = thisp || this\n for (let walker = this.tail, i = this.length - 1; !!walker; i--) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.prev\n }\n }\n\n get(n: number) {\n let i = 0\n let walker = this.head\n for (; !!walker && i < n; i++) {\n walker = walker.next\n }\n if (i === n && !!walker) {\n return walker.value\n }\n }\n\n getReverse(n: number) {\n let i = 0\n let walker = this.tail\n for (; !!walker && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.prev\n }\n if (i === n && !!walker) {\n return walker.value\n }\n }\n\n map(\n fn: (value: T, list: Yallist) => R,\n thisp?: any,\n ): Yallist {\n thisp = thisp || this\n const res = new Yallist()\n for (let walker = this.head; !!walker; ) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.next\n }\n return res\n }\n\n mapReverse(\n fn: (value: T, list: Yallist) => R,\n thisp?: any,\n ): Yallist {\n thisp = thisp || this\n var res = new Yallist()\n for (let walker = this.tail; !!walker; ) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.prev\n }\n return res\n }\n\n reduce(fn: (left: T, right: T, i: number) => T): T\n reduce(\n fn: (acc: R, next: T, i: number) => R,\n initial: R,\n ): R\n reduce(\n fn: (acc: R, next: T, i: number) => R,\n initial?: R,\n ): R {\n let acc: R | T\n let walker = this.head\n if (arguments.length > 1) {\n acc = initial as R\n } else if (this.head) {\n walker = this.head.next\n acc = this.head.value\n } else {\n throw new TypeError(\n 'Reduce of empty list with no initial value',\n )\n }\n\n for (var i = 0; !!walker; i++) {\n acc = fn(acc as R, walker.value, i)\n walker = walker.next\n }\n\n return acc as R\n }\n\n reduceReverse(fn: (left: T, right: T, i: number) => T): T\n reduceReverse(\n fn: (acc: R, next: T, i: number) => R,\n initial: R,\n ): R\n reduceReverse(\n fn: (acc: R, next: T, i: number) => R,\n initial?: R,\n ): R {\n let acc: R | T\n let walker = this.tail\n if (arguments.length > 1) {\n acc = initial as R\n } else if (this.tail) {\n walker = this.tail.prev\n acc = this.tail.value\n } else {\n throw new TypeError(\n 'Reduce of empty list with no initial value',\n )\n }\n\n for (let i = this.length - 1; !!walker; i--) {\n acc = fn(acc as R, walker.value, i)\n walker = walker.prev\n }\n\n return acc as R\n }\n\n toArray() {\n const arr = new Array(this.length)\n for (let i = 0, walker = this.head; !!walker; i++) {\n arr[i] = walker.value\n walker = walker.next\n }\n return arr\n }\n\n toArrayReverse() {\n const arr = new Array(this.length)\n for (let i = 0, walker = this.tail; !!walker; i++) {\n arr[i] = walker.value\n walker = walker.prev\n }\n return arr\n }\n\n slice(from: number = 0, to: number = this.length) {\n if (to < 0) {\n to += this.length\n }\n if (from < 0) {\n from += this.length\n }\n const ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n let walker = this.head\n let i = 0\n for (i = 0; !!walker && i < from; i++) {\n walker = walker.next\n }\n for (; !!walker && i < to; i++, walker = walker.next) {\n ret.push(walker.value)\n }\n return ret\n }\n\n sliceReverse(from: number = 0, to: number = this.length) {\n if (to < 0) {\n to += this.length\n }\n if (from < 0) {\n from += this.length\n }\n const ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n let i = this.length\n let walker = this.tail\n for (; !!walker && i > to; i--) {\n walker = walker.prev\n }\n for (; !!walker && i > from; i--, walker = walker.prev) {\n ret.push(walker.value)\n }\n return ret\n }\n\n splice(start: number, deleteCount: number = 0, ...nodes: T[]) {\n if (start > this.length) {\n start = this.length - 1\n }\n if (start < 0) {\n start = this.length + start\n }\n\n let walker = this.head\n\n for (let i = 0; !!walker && i < start; i++) {\n walker = walker.next\n }\n\n const ret: T[] = []\n for (let i = 0; !!walker && i < deleteCount; i++) {\n ret.push(walker.value)\n walker = this.removeNode(walker)\n }\n if (!walker) {\n walker = this.tail\n } else if (walker !== this.tail) {\n walker = walker.prev\n }\n\n for (const v of nodes) {\n walker = insertAfter(this, walker, v)\n }\n\n return ret\n }\n\n reverse() {\n const head = this.head\n const tail = this.tail\n for (let walker = head; !!walker; walker = walker.prev) {\n const p = walker.prev\n walker.prev = walker.next\n walker.next = p\n }\n this.head = tail\n this.tail = head\n return this\n }\n}\n\n// insertAfter undefined means \"make the node the new head of list\"\nfunction insertAfter(\n self: Yallist,\n node: Node | undefined,\n value: T,\n) {\n const prev = node\n const next = node ? node.next : self.head\n const inserted = new Node(value, prev, next, self)\n\n if (inserted.next === undefined) {\n self.tail = inserted\n }\n if (inserted.prev === undefined) {\n self.head = inserted\n }\n\n self.length++\n\n return inserted\n}\n\nfunction push(self: Yallist, item: T) {\n self.tail = new Node(item, self.tail, undefined, self)\n if (!self.head) {\n self.head = self.tail\n }\n self.length++\n}\n\nfunction unshift(self: Yallist, item: T) {\n self.head = new Node(item, undefined, self.head, self)\n if (!self.tail) {\n self.tail = self.head\n }\n self.length++\n}\n\nexport class Node {\n list?: Yallist\n next?: Node\n prev?: Node\n value: T\n\n constructor(\n value: T,\n prev?: Node | undefined,\n next?: Node | undefined,\n list?: Yallist | undefined,\n ) {\n this.list = list\n this.value = value\n\n if (prev) {\n prev.next = this\n this.prev = prev\n } else {\n this.prev = undefined\n }\n\n if (next) {\n next.prev = this\n this.next = next\n } else {\n this.next = undefined\n }\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/cmake-js/node_modules/yallist/dist/esm/package.json b/node_modules/cmake-js/node_modules/yallist/dist/esm/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/node_modules/cmake-js/node_modules/yallist/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/cmake-js/node_modules/yallist/package.json b/node_modules/cmake-js/node_modules/yallist/package.json new file mode 100644 index 0000000..2f52478 --- /dev/null +++ b/node_modules/cmake-js/node_modules/yallist/package.json @@ -0,0 +1,68 @@ +{ + "name": "yallist", + "version": "5.0.0", + "description": "Yet Another Linked List", + "files": [ + "dist" + ], + "devDependencies": { + "prettier": "^3.2.5", + "tap": "^18.7.2", + "tshy": "^1.13.1", + "typedoc": "^0.25.13" + }, + "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "prepare": "tshy", + "pretest": "npm run prepare", + "presnap": "npm run prepare", + "test": "tap", + "snap": "tap", + "format": "prettier --write . --loglevel warn --ignore-path ../../.prettierignore --cache", + "typedoc": "typedoc" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/yallist.git" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "BlueOak-1.0.0", + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "type": "module", + "prettier": { + "semi": false, + "printWidth": 70, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + }, + "engines": { + "node": ">=18" + } +} diff --git a/node_modules/cmake-js/package.json b/node_modules/cmake-js/package.json new file mode 100644 index 0000000..7a6b7a6 --- /dev/null +++ b/node_modules/cmake-js/package.json @@ -0,0 +1,74 @@ +{ + "name": "cmake-js", + "description": "CMake.js - a Node.js native addon build tool", + "license": "MIT", + "keywords": [ + "native", + "addon", + "module", + "c", + "c++", + "bindings", + "build", + "buildtools", + "cmake", + "nw.js", + "electron", + "boost", + "nan", + "napi", + "node-api", + "node-addon-api" + ], + "main": "lib", + "version": "8.0.0", + "author": "Gábor Mező aka unbornchikken", + "maintainers": [ + { + "name": "Julian Waller", + "email": "git@julusian.co.uk", + "url": "https://github.com/julusian/" + } + ], + "repository": { + "type": "git", + "url": "git://github.com/cmake-js/cmake-js.git" + }, + "bin": { + "cmake-js": "./bin/cmake-js" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + }, + "dependencies": { + "debug": "^4.4.3", + "fs-extra": "^11.3.3", + "node-api-headers": "^1.8.0", + "rc": "1.2.8", + "semver": "^7.7.3", + "tar": "^7.5.6", + "url-join": "^4.0.1", + "which": "^6.0.0", + "yargs": "^17.7.2" + }, + "devDependencies": { + "eslint": "^8.56.0", + "eslint-config-prettier": "^9.1.0", + "mocha": "*", + "nan": "^2.25.0", + "node-addon-api": "^6.1.0", + "prettier": "^3.8.1" + }, + "scripts": { + "test": "mocha tests", + "lint": "eslint lib bin/cmake-js tests" + }, + "files": [ + "lib", + "bin", + "*.md", + "bindings.js", + "bindings.d.ts" + ], + "packageManager": "yarn@1.22.22+sha256.c17d3797fb9a9115bf375e31bfd30058cac6bc9c3b8807a3d8cb2094794b51ca" +} diff --git a/node_modules/eventemitter3/LICENSE b/node_modules/eventemitter3/LICENSE new file mode 100644 index 0000000..abcbd54 --- /dev/null +++ b/node_modules/eventemitter3/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Arnout Kazemier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/eventemitter3/README.md b/node_modules/eventemitter3/README.md new file mode 100644 index 0000000..e45aa10 --- /dev/null +++ b/node_modules/eventemitter3/README.md @@ -0,0 +1,85 @@ +# EventEmitter3 + +[![Version npm](https://img.shields.io/npm/v/eventemitter3.svg?style=flat-square)](https://www.npmjs.com/package/eventemitter3)[![CI](https://img.shields.io/github/actions/workflow/status/primus/eventemitter3/ci.yml?branch=master&label=CI&style=flat-square)](https://github.com/primus/eventemitter3/actions?query=workflow%3ACI+branch%3Amaster)[![Coverage Status](https://img.shields.io/coveralls/primus/eventemitter3/master.svg?style=flat-square)](https://coveralls.io/r/primus/eventemitter3?branch=master) + +EventEmitter3 is a high performance EventEmitter. It has been micro-optimized +for various of code paths making this, one of, if not the fastest EventEmitter +available for Node.js and browsers. The module is API compatible with the +EventEmitter that ships by default with Node.js but there are some slight +differences: + +- Domain support has been removed. +- We do not `throw` an error when you emit an `error` event and nobody is + listening. +- The `newListener` and `removeListener` events have been removed as they + are useful only in some uncommon use-cases. +- The `setMaxListeners`, `getMaxListeners`, `prependListener` and + `prependOnceListener` methods are not available. +- Support for custom context for events so there is no need to use `fn.bind`. +- The `removeListener` method removes all matching listeners, not only the + first. + +It's a drop in replacement for existing EventEmitters, but just faster. Free +performance, who wouldn't want that? The EventEmitter is written in EcmaScript 3 +so it will work in the oldest browsers and node versions that you need to +support. + +## Installation + +```bash +$ npm install --save eventemitter3 +``` + +## CDN + +Recommended CDN: + +```text +https://unpkg.com/eventemitter3@latest/dist/eventemitter3.umd.min.js +``` + +## Usage + +After installation the only thing you need to do is require the module: + +```js +var EventEmitter = require('eventemitter3'); +``` + +And you're ready to create your own EventEmitter instances. For the API +documentation, please follow the official Node.js documentation: + +http://nodejs.org/api/events.html + +### Contextual emits + +We've upgraded the API of the `EventEmitter.on`, `EventEmitter.once` and +`EventEmitter.removeListener` to accept an extra argument which is the `context` +or `this` value that should be set for the emitted events. This means you no +longer have the overhead of an event that required `fn.bind` in order to get a +custom `this` value. + +```js +var EE = new EventEmitter() + , context = { foo: 'bar' }; + +function emitted() { + console.log(this === context); // true +} + +EE.once('event-name', emitted, context); +EE.on('another-event', emitted, context); +EE.removeListener('another-event', emitted, context); +``` + +### Tests and benchmarks + +To run tests run `npm test`. To run the benchmarks run `npm run benchmark`. + +Tests and benchmarks are not included in the npm package. If you want to play +with them you have to clone the GitHub repository. Note that you will have to +run an additional `npm i` in the benchmarks folder before `npm run benchmark`. + +## License + +[MIT](LICENSE) diff --git a/node_modules/eventemitter3/dist/eventemitter3.esm.js b/node_modules/eventemitter3/dist/eventemitter3.esm.js new file mode 100644 index 0000000..70759d0 --- /dev/null +++ b/node_modules/eventemitter3/dist/eventemitter3.esm.js @@ -0,0 +1,355 @@ +function getDefaultExportFromCjs (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; +} + +var eventemitter3 = {exports: {}}; + +var hasRequiredEventemitter3; + +function requireEventemitter3 () { + if (hasRequiredEventemitter3) return eventemitter3.exports; + hasRequiredEventemitter3 = 1; + (function (module) { + + var has = Object.prototype.hasOwnProperty + , prefix = '~'; + + /** + * Constructor to create a storage for our `EE` objects. + * An `Events` instance is a plain object whose properties are event names. + * + * @constructor + * @private + */ + function Events() {} + + // + // We try to not inherit from `Object.prototype`. In some engines creating an + // instance in this way is faster than calling `Object.create(null)` directly. + // If `Object.create(null)` is not supported we prefix the event names with a + // character to make sure that the built-in object properties are not + // overridden or used as an attack vector. + // + if (Object.create) { + Events.prototype = Object.create(null); + + // + // This hack is needed because the `__proto__` property is still inherited in + // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. + // + if (!new Events().__proto__) prefix = false; + } + + /** + * Representation of a single event listener. + * + * @param {Function} fn The listener function. + * @param {*} context The context to invoke the listener with. + * @param {Boolean} [once=false] Specify if the listener is a one-time listener. + * @constructor + * @private + */ + function EE(fn, context, once) { + this.fn = fn; + this.context = context; + this.once = once || false; + } + + /** + * Add a listener for a given event. + * + * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} context The context to invoke the listener with. + * @param {Boolean} once Specify if the listener is a one-time listener. + * @returns {EventEmitter} + * @private + */ + function addListener(emitter, event, fn, context, once) { + if (typeof fn !== 'function') { + throw new TypeError('The listener must be a function'); + } + + var listener = new EE(fn, context || emitter, once) + , evt = prefix ? prefix + event : event; + + if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++; + else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); + else emitter._events[evt] = [emitter._events[evt], listener]; + + return emitter; + } + + /** + * Clear event by name. + * + * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. + * @param {(String|Symbol)} evt The Event name. + * @private + */ + function clearEvent(emitter, evt) { + if (--emitter._eventsCount === 0) emitter._events = new Events(); + else delete emitter._events[evt]; + } + + /** + * Minimal `EventEmitter` interface that is molded against the Node.js + * `EventEmitter` interface. + * + * @constructor + * @public + */ + function EventEmitter() { + this._events = new Events(); + this._eventsCount = 0; + } + + /** + * Return an array listing the events for which the emitter has registered + * listeners. + * + * @returns {Array} + * @public + */ + EventEmitter.prototype.eventNames = function eventNames() { + var names = [] + , events + , name; + + if (this._eventsCount === 0) return names; + + for (name in (events = this._events)) { + if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); + } + + if (Object.getOwnPropertySymbols) { + return names.concat(Object.getOwnPropertySymbols(events)); + } + + return names; + }; + + /** + * Return the listeners registered for a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Array} The registered listeners. + * @public + */ + EventEmitter.prototype.listeners = function listeners(event) { + var evt = prefix ? prefix + event : event + , handlers = this._events[evt]; + + if (!handlers) return []; + if (handlers.fn) return [handlers.fn]; + + for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { + ee[i] = handlers[i].fn; + } + + return ee; + }; + + /** + * Return the number of listeners listening to a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Number} The number of listeners. + * @public + */ + EventEmitter.prototype.listenerCount = function listenerCount(event) { + var evt = prefix ? prefix + event : event + , listeners = this._events[evt]; + + if (!listeners) return 0; + if (listeners.fn) return 1; + return listeners.length; + }; + + /** + * Calls each of the listeners registered for a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Boolean} `true` if the event had listeners, else `false`. + * @public + */ + EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { + var evt = prefix ? prefix + event : event; + + if (!this._events[evt]) return false; + + var listeners = this._events[evt] + , len = arguments.length + , args + , i; + + if (listeners.fn) { + if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); + + switch (len) { + case 1: return listeners.fn.call(listeners.context), true; + case 2: return listeners.fn.call(listeners.context, a1), true; + case 3: return listeners.fn.call(listeners.context, a1, a2), true; + case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; + case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; + case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; + } + + for (i = 1, args = new Array(len -1); i < len; i++) { + args[i - 1] = arguments[i]; + } + + listeners.fn.apply(listeners.context, args); + } else { + var length = listeners.length + , j; + + for (i = 0; i < length; i++) { + if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); + + switch (len) { + case 1: listeners[i].fn.call(listeners[i].context); break; + case 2: listeners[i].fn.call(listeners[i].context, a1); break; + case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; + case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; + default: + if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { + args[j - 1] = arguments[j]; + } + + listeners[i].fn.apply(listeners[i].context, args); + } + } + } + + return true; + }; + + /** + * Add a listener for a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @public + */ + EventEmitter.prototype.on = function on(event, fn, context) { + return addListener(this, event, fn, context, false); + }; + + /** + * Add a one-time listener for a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @public + */ + EventEmitter.prototype.once = function once(event, fn, context) { + return addListener(this, event, fn, context, true); + }; + + /** + * Remove the listeners of a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn Only remove the listeners that match this function. + * @param {*} context Only remove the listeners that have this context. + * @param {Boolean} once Only remove one-time listeners. + * @returns {EventEmitter} `this`. + * @public + */ + EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { + var evt = prefix ? prefix + event : event; + + if (!this._events[evt]) return this; + if (!fn) { + clearEvent(this, evt); + return this; + } + + var listeners = this._events[evt]; + + if (listeners.fn) { + if ( + listeners.fn === fn && + (!once || listeners.once) && + (!context || listeners.context === context) + ) { + clearEvent(this, evt); + } + } else { + for (var i = 0, events = [], length = listeners.length; i < length; i++) { + if ( + listeners[i].fn !== fn || + (once && !listeners[i].once) || + (context && listeners[i].context !== context) + ) { + events.push(listeners[i]); + } + } + + // + // Reset the array, or remove it completely if we have no more listeners. + // + if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; + else clearEvent(this, evt); + } + + return this; + }; + + /** + * Remove all listeners, or those of the specified event. + * + * @param {(String|Symbol)} [event] The event name. + * @returns {EventEmitter} `this`. + * @public + */ + EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { + var evt; + + if (event) { + evt = prefix ? prefix + event : event; + if (this._events[evt]) clearEvent(this, evt); + } else { + this._events = new Events(); + this._eventsCount = 0; + } + + return this; + }; + + // + // Alias methods names because people roll like that. + // + EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + EventEmitter.prototype.addListener = EventEmitter.prototype.on; + + // + // Expose the prefix. + // + EventEmitter.prefixed = prefix; + + // + // Allow `EventEmitter` to be imported as module namespace. + // + EventEmitter.EventEmitter = EventEmitter; + + // + // Expose the module. + // + { + module.exports = EventEmitter; + } + } (eventemitter3)); + return eventemitter3.exports; +} + +var eventemitter3Exports = requireEventemitter3(); +var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports); + +export { EventEmitter, EventEmitter as default }; diff --git a/node_modules/eventemitter3/dist/eventemitter3.esm.min.js b/node_modules/eventemitter3/dist/eventemitter3.esm.min.js new file mode 100644 index 0000000..82c1ec0 --- /dev/null +++ b/node_modules/eventemitter3/dist/eventemitter3.esm.min.js @@ -0,0 +1 @@ +function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t,n={exports:{}};var r=(t||(t=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,r,s,i){if("function"!=typeof r)throw new TypeError("The listener must be a function");var c=new o(r,s||e,i),f=n?n+t:t;return e._events[f]?e._events[f].fn?e._events[f]=[e._events[f],c]:e._events[f].push(c):(e._events[f]=c,e._eventsCount++),e}function i(e,t){0===--e._eventsCount?e._events=new r:delete e._events[t]}function c(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),c.prototype.eventNames=function(){var e,r,o=[];if(0===this._eventsCount)return o;for(r in e=this._events)t.call(e,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},c.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,s=r.length,i=new Array(s);o { + static prefixed: string | boolean; + + /** + * Return an array listing the events for which the emitter has registered + * listeners. + */ + eventNames(): Array>; + + /** + * Return the listeners registered for a given event. + */ + listeners>( + event: T + ): Array>; + + /** + * Return the number of listeners listening to a given event. + */ + listenerCount(event: EventEmitter.EventNames): number; + + /** + * Calls each of the listeners registered for a given event. + */ + emit>( + event: T, + ...args: EventEmitter.EventArgs + ): boolean; + + /** + * Add a listener for a given event. + */ + on>( + event: T, + fn: EventEmitter.EventListener, + context?: Context + ): this; + addListener>( + event: T, + fn: EventEmitter.EventListener, + context?: Context + ): this; + + /** + * Add a one-time listener for a given event. + */ + once>( + event: T, + fn: EventEmitter.EventListener, + context?: Context + ): this; + + /** + * Remove the listeners of a given event. + */ + removeListener>( + event: T, + fn?: EventEmitter.EventListener, + context?: Context, + once?: boolean + ): this; + off>( + event: T, + fn?: EventEmitter.EventListener, + context?: Context, + once?: boolean + ): this; + + /** + * Remove all listeners, or those of the specified event. + */ + removeAllListeners(event?: EventEmitter.EventNames): this; +} + +declare namespace EventEmitter { + export interface ListenerFn { + (...args: Args): void; + } + + export interface EventEmitterStatic { + new < + EventTypes extends ValidEventTypes = string | symbol, + Context = any + >(): EventEmitter; + } + + /** + * `object` should be in either of the following forms: + * ``` + * interface EventTypes { + * 'event-with-parameters': any[] + * 'event-with-example-handler': (...args: any[]) => void + * } + * ``` + */ + export type ValidEventTypes = string | symbol | object; + + export type EventNames = T extends string | symbol + ? T + : keyof T; + + export type ArgumentMap = { + [K in keyof T]: T[K] extends (...args: any[]) => void + ? Parameters + : T[K] extends any[] + ? T[K] + : any[]; + }; + + export type EventListener< + T extends ValidEventTypes, + K extends EventNames + > = T extends string | symbol + ? (...args: any[]) => void + : ( + ...args: ArgumentMap>[Extract] + ) => void; + + export type EventArgs< + T extends ValidEventTypes, + K extends EventNames + > = Parameters>; + + export const EventEmitter: EventEmitterStatic; +} + +export { EventEmitter } +export default EventEmitter; diff --git a/node_modules/eventemitter3/index.js b/node_modules/eventemitter3/index.js new file mode 100644 index 0000000..6ea485c --- /dev/null +++ b/node_modules/eventemitter3/index.js @@ -0,0 +1,336 @@ +'use strict'; + +var has = Object.prototype.hasOwnProperty + , prefix = '~'; + +/** + * Constructor to create a storage for our `EE` objects. + * An `Events` instance is a plain object whose properties are event names. + * + * @constructor + * @private + */ +function Events() {} + +// +// We try to not inherit from `Object.prototype`. In some engines creating an +// instance in this way is faster than calling `Object.create(null)` directly. +// If `Object.create(null)` is not supported we prefix the event names with a +// character to make sure that the built-in object properties are not +// overridden or used as an attack vector. +// +if (Object.create) { + Events.prototype = Object.create(null); + + // + // This hack is needed because the `__proto__` property is still inherited in + // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. + // + if (!new Events().__proto__) prefix = false; +} + +/** + * Representation of a single event listener. + * + * @param {Function} fn The listener function. + * @param {*} context The context to invoke the listener with. + * @param {Boolean} [once=false] Specify if the listener is a one-time listener. + * @constructor + * @private + */ +function EE(fn, context, once) { + this.fn = fn; + this.context = context; + this.once = once || false; +} + +/** + * Add a listener for a given event. + * + * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} context The context to invoke the listener with. + * @param {Boolean} once Specify if the listener is a one-time listener. + * @returns {EventEmitter} + * @private + */ +function addListener(emitter, event, fn, context, once) { + if (typeof fn !== 'function') { + throw new TypeError('The listener must be a function'); + } + + var listener = new EE(fn, context || emitter, once) + , evt = prefix ? prefix + event : event; + + if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++; + else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); + else emitter._events[evt] = [emitter._events[evt], listener]; + + return emitter; +} + +/** + * Clear event by name. + * + * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. + * @param {(String|Symbol)} evt The Event name. + * @private + */ +function clearEvent(emitter, evt) { + if (--emitter._eventsCount === 0) emitter._events = new Events(); + else delete emitter._events[evt]; +} + +/** + * Minimal `EventEmitter` interface that is molded against the Node.js + * `EventEmitter` interface. + * + * @constructor + * @public + */ +function EventEmitter() { + this._events = new Events(); + this._eventsCount = 0; +} + +/** + * Return an array listing the events for which the emitter has registered + * listeners. + * + * @returns {Array} + * @public + */ +EventEmitter.prototype.eventNames = function eventNames() { + var names = [] + , events + , name; + + if (this._eventsCount === 0) return names; + + for (name in (events = this._events)) { + if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); + } + + if (Object.getOwnPropertySymbols) { + return names.concat(Object.getOwnPropertySymbols(events)); + } + + return names; +}; + +/** + * Return the listeners registered for a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Array} The registered listeners. + * @public + */ +EventEmitter.prototype.listeners = function listeners(event) { + var evt = prefix ? prefix + event : event + , handlers = this._events[evt]; + + if (!handlers) return []; + if (handlers.fn) return [handlers.fn]; + + for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { + ee[i] = handlers[i].fn; + } + + return ee; +}; + +/** + * Return the number of listeners listening to a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Number} The number of listeners. + * @public + */ +EventEmitter.prototype.listenerCount = function listenerCount(event) { + var evt = prefix ? prefix + event : event + , listeners = this._events[evt]; + + if (!listeners) return 0; + if (listeners.fn) return 1; + return listeners.length; +}; + +/** + * Calls each of the listeners registered for a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Boolean} `true` if the event had listeners, else `false`. + * @public + */ +EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { + var evt = prefix ? prefix + event : event; + + if (!this._events[evt]) return false; + + var listeners = this._events[evt] + , len = arguments.length + , args + , i; + + if (listeners.fn) { + if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); + + switch (len) { + case 1: return listeners.fn.call(listeners.context), true; + case 2: return listeners.fn.call(listeners.context, a1), true; + case 3: return listeners.fn.call(listeners.context, a1, a2), true; + case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; + case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; + case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; + } + + for (i = 1, args = new Array(len -1); i < len; i++) { + args[i - 1] = arguments[i]; + } + + listeners.fn.apply(listeners.context, args); + } else { + var length = listeners.length + , j; + + for (i = 0; i < length; i++) { + if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); + + switch (len) { + case 1: listeners[i].fn.call(listeners[i].context); break; + case 2: listeners[i].fn.call(listeners[i].context, a1); break; + case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; + case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; + default: + if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { + args[j - 1] = arguments[j]; + } + + listeners[i].fn.apply(listeners[i].context, args); + } + } + } + + return true; +}; + +/** + * Add a listener for a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @public + */ +EventEmitter.prototype.on = function on(event, fn, context) { + return addListener(this, event, fn, context, false); +}; + +/** + * Add a one-time listener for a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @public + */ +EventEmitter.prototype.once = function once(event, fn, context) { + return addListener(this, event, fn, context, true); +}; + +/** + * Remove the listeners of a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn Only remove the listeners that match this function. + * @param {*} context Only remove the listeners that have this context. + * @param {Boolean} once Only remove one-time listeners. + * @returns {EventEmitter} `this`. + * @public + */ +EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { + var evt = prefix ? prefix + event : event; + + if (!this._events[evt]) return this; + if (!fn) { + clearEvent(this, evt); + return this; + } + + var listeners = this._events[evt]; + + if (listeners.fn) { + if ( + listeners.fn === fn && + (!once || listeners.once) && + (!context || listeners.context === context) + ) { + clearEvent(this, evt); + } + } else { + for (var i = 0, events = [], length = listeners.length; i < length; i++) { + if ( + listeners[i].fn !== fn || + (once && !listeners[i].once) || + (context && listeners[i].context !== context) + ) { + events.push(listeners[i]); + } + } + + // + // Reset the array, or remove it completely if we have no more listeners. + // + if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; + else clearEvent(this, evt); + } + + return this; +}; + +/** + * Remove all listeners, or those of the specified event. + * + * @param {(String|Symbol)} [event] The event name. + * @returns {EventEmitter} `this`. + * @public + */ +EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { + var evt; + + if (event) { + evt = prefix ? prefix + event : event; + if (this._events[evt]) clearEvent(this, evt); + } else { + this._events = new Events(); + this._eventsCount = 0; + } + + return this; +}; + +// +// Alias methods names because people roll like that. +// +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; +EventEmitter.prototype.addListener = EventEmitter.prototype.on; + +// +// Expose the prefix. +// +EventEmitter.prefixed = prefix; + +// +// Allow `EventEmitter` to be imported as module namespace. +// +EventEmitter.EventEmitter = EventEmitter; + +// +// Expose the module. +// +if ('undefined' !== typeof module) { + module.exports = EventEmitter; +} diff --git a/node_modules/eventemitter3/index.mjs b/node_modules/eventemitter3/index.mjs new file mode 100644 index 0000000..89bb405 --- /dev/null +++ b/node_modules/eventemitter3/index.mjs @@ -0,0 +1,4 @@ +import EventEmitter from './index.js' + +export { EventEmitter } +export default EventEmitter diff --git a/node_modules/eventemitter3/package.json b/node_modules/eventemitter3/package.json new file mode 100644 index 0000000..29a040d --- /dev/null +++ b/node_modules/eventemitter3/package.json @@ -0,0 +1,62 @@ +{ + "name": "eventemitter3", + "version": "5.0.4", + "description": "EventEmitter3 focuses on performance while maintaining a Node.js AND browser compatible interface.", + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./index.mjs", + "require": "./index.js" + }, + "./package.json": "./package.json" + }, + "main": "index.js", + "types": "index.d.ts", + "scripts": { + "rollup": "rm -rf dist && rollup -c", + "benchmark": "find benchmarks/run -name '*.js' -exec benchmarks/start.sh {} \\;", + "test": "c8 --reporter=lcov --reporter=text mocha test/test.js", + "test-esm": "mocha test/test.mjs", + "prepublishOnly": "npm run rollup" + }, + "files": [ + "index.js", + "index.mjs", + "index.d.ts", + "dist" + ], + "repository": { + "type": "git", + "url": "git://github.com/primus/eventemitter3.git" + }, + "keywords": [ + "EventEmitter", + "EventEmitter2", + "EventEmitter3", + "Events", + "addEventListener", + "addListener", + "emit", + "emits", + "emitter", + "event", + "once", + "pub/sub", + "publish", + "reactor", + "subscribe" + ], + "author": "Arnout Kazemier", + "license": "MIT", + "bugs": { + "url": "https://github.com/primus/eventemitter3/issues" + }, + "devDependencies": { + "@rollup/plugin-commonjs": "^29.0.0", + "@rollup/plugin-terser": "^0.4.0", + "assume": "^2.2.0", + "c8": "^10.1.3", + "mocha": "^11.7.5", + "rollup": "^4.5.2" + } +} diff --git a/node_modules/jpeg-js/.github/workflows/ci.yml b/node_modules/jpeg-js/.github/workflows/ci.yml new file mode 100644 index 0000000..0114b69 --- /dev/null +++ b/node_modules/jpeg-js/.github/workflows/ci.yml @@ -0,0 +1,19 @@ +name: CI +on: + push: + branches: [master] + pull_request: # run on all PRs, not just PRs to a particular branch +jobs: + test: + strategy: + fail-fast: true + matrix: + nodeversion: [8.x, 10.x, 12.x, 14.x] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.nodeversion }} + - run: npm install + - run: npm test diff --git a/node_modules/jpeg-js/CONTRIBUTING.md b/node_modules/jpeg-js/CONTRIBUTING.md new file mode 100644 index 0000000..1954cb5 --- /dev/null +++ b/node_modules/jpeg-js/CONTRIBUTING.md @@ -0,0 +1,27 @@ +# jpeg-js is an OPEN Open Source Project + +----------------------------------------- + +## What? + +Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project. + +## Rules + +There are a few basic ground-rules for contributors: + +1. **No `--force` pushes** or modifying the Git history in any way. +1. **Non-master branches** ought to be used for ongoing work. +1. **External API changes and significant modifications** ought to be subject to an **internal pull-request** to solicit feedback from other contributors. +1. Internal pull-requests to solicit feedback are *encouraged* for any other non-trivial contribution but left to the discretion of the contributor. +1. Contributors should attempt to adhere to the prevailing code-style. + +## Releases + +Declaring formal releases remains the prerogative of the project maintainer. + +## Changes to this arrangement + +This is an experiment and feedback is welcome! This document may also be subject to pull-requests or changes by contributors where you believe you have something valuable to add or change. + +----------------------------------------- diff --git a/node_modules/jpeg-js/LICENSE b/node_modules/jpeg-js/LICENSE new file mode 100644 index 0000000..5f12266 --- /dev/null +++ b/node_modules/jpeg-js/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2014, Eugene Ware +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name of Eugene Ware nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY EUGENE WARE ''AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL EUGENE WARE BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/jpeg-js/README.md b/node_modules/jpeg-js/README.md new file mode 100644 index 0000000..380176f --- /dev/null +++ b/node_modules/jpeg-js/README.md @@ -0,0 +1,176 @@ +# jpeg-js + +A pure javascript JPEG encoder and decoder for node.js + +**NOTE:** this is a _synchronous_ (i.e. CPU-blocking) library that is much slower than native alternatives. If you don't need a _pure javascript_ implementation, consider using async alternatives like [sharp](http://npmjs.com/package/sharp) in node or the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API) in the browser. + +[![build status](https://secure.travis-ci.org/eugeneware/jpeg-js.png)](http://travis-ci.org/eugeneware/jpeg-js) + +## Installation + +This module is installed via npm: + +```bash +$ npm install jpeg-js +``` + +## Example Usage + +### Decoding JPEGs + +Will decode a buffer or typed array into a `Buffer`; + +```js +var jpeg = require('jpeg-js'); +var jpegData = fs.readFileSync('grumpycat.jpg'); +var rawImageData = jpeg.decode(jpegData); +console.log(rawImageData); +/* +{ width: 320, + height: 180, + data: } +*/ +``` + +To decode directly into a `Uint8Array`, pass `useTArray: true` in options +`decode`: + +```js +var jpeg = require('jpeg-js'); +var jpegData = fs.readFileSync('grumpycat.jpg'); +var rawImageData = jpeg.decode(jpegData, {useTArray: true}); // return as Uint8Array +console.log(rawImageData); +/* +{ width: 320, + height: 180, + data: { '0': 91, '1': 64, ... } } // typed array +*/ +``` + +#### Decode Options + +| Option | Description | Default | +| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | +| `colorTransform` | Transform alternate colorspaces like YCbCr. `undefined` means respect the default behavior encoded in metadata. | `undefined` | +| `useTArray` | Decode pixels into a typed `Uint8Array` instead of a `Buffer`. | `false` | +| `formatAsRGBA` | Decode pixels into RGBA vs. RGB. | `true` | +| `tolerantDecoding` | Be more tolerant when encountering technically invalid JPEGs. | `true` | +| `maxResolutionInMP` | The maximum resolution image that `jpeg-js` should attempt to decode in megapixels. Images larger than this resolution will throw an error instead of decoding. | `100` | +| `maxMemoryUsageInMB` | The (approximate) maximum memory that `jpeg-js` should allocate while attempting to decode the image in mebibyte. Images requiring more memory than this will throw an error instead of decoding. | `512` | + +### Encoding JPEGs + +```js +var jpeg = require('jpeg-js'); +var width = 320, + height = 180; +var frameData = new Buffer(width * height * 4); +var i = 0; +while (i < frameData.length) { + frameData[i++] = 0xff; // red + frameData[i++] = 0x00; // green + frameData[i++] = 0x00; // blue + frameData[i++] = 0xff; // alpha - ignored in JPEGs +} +var rawImageData = { + data: frameData, + width: width, + height: height, +}; +var jpegImageData = jpeg.encode(rawImageData, 50); +console.log(jpegImageData); +/* +{ width: 320, + height: 180, + data: } +*/ +// write to file +fs.writeFileSync('image.jpg', jpegImageData.data); +``` + +## License + +### Decoding + +This library builds on the work of two other JPEG javascript libraries, +namely [jpgjs](https://github.com/notmasteryet/jpgjs) for the decoding +which is licensed under the Apache 2.0 License below: + +Copyright 2011 notmasteryet + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +### Encoding + +The encoding is based off a port of the JPEG encoder in [as3corelib](https://code.google.com/p/as3corelib/source/browse/trunk/src/com/adobe/images/JPGEncoder.as). + +The port to Javascript was done by by Andreas Ritter, www.bytestrom.eu, 11/2009. + +The Adobe License for the encoder is: + +**Adobe** + +Copyright (c) 2008, Adobe Systems Incorporated +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +- Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +## Contributing + +jpeg-js is an **OPEN Open Source Project**. This means that: + +> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project. + +See the [CONTRIBUTING.md](https://github.com/eugeneware/jpeg-js/blob/master/CONTRIBUTING.md) file for more details. + +### Contributors + +jpeg-js is only possible due to the excellent work of the following contributors: + + + + + + + + + + + + +
AdobeGitHub/adobe
Yury DelendikGitHub/notmasteryet
Eugene WareGitHub/eugeneware
Michael KellyGitHub/mrkelly
Peter LiljenbergGitHub/petli
XadillaXGitHub/XadillaX
strandedcityGitHub/strandedcity
wmossmanGitHub/wmossman
Patrick HulceGitHub/patrickhulce
Ben WileyGitHub/benwiley4000
diff --git a/node_modules/jpeg-js/index.d.ts b/node_modules/jpeg-js/index.d.ts new file mode 100644 index 0000000..adbdd4b --- /dev/null +++ b/node_modules/jpeg-js/index.d.ts @@ -0,0 +1,36 @@ +export interface RawImageData { + width: number; + height: number; + data: T; +} + +type BufferRet = RawImageData; +type UintArrRet = RawImageData; + +type ImageData = BufferRet | UintArrRet; +type BufferLike = Buffer | Uint8Array | ArrayLike | Iterable | ArrayBuffer; + +export declare function encode(imgData: RawImageData & {comments?: string[]}, quality?: number): BufferRet + +export declare function decode( + jpegData: BufferLike, + opts: { + useTArray: true; + colorTransform?: boolean; + formatAsRGBA?: boolean; + tolerantDecoding?: boolean; + maxResolutionInMP?: number; + maxMemoryUsageInMB?: number; + }, +): UintArrRet & {comments?: string[]}; +export declare function decode( + jpegData: BufferLike, + opts?: { + useTArray?: false; + colorTransform?: boolean; + formatAsRGBA?: boolean; + tolerantDecoding?: boolean; + maxResolutionInMP?: number; + maxMemoryUsageInMB?: number; + }, +): BufferRet & {comments?: string[]}; diff --git a/node_modules/jpeg-js/index.js b/node_modules/jpeg-js/index.js new file mode 100644 index 0000000..2373484 --- /dev/null +++ b/node_modules/jpeg-js/index.js @@ -0,0 +1,7 @@ +var encode = require('./lib/encoder'), + decode = require('./lib/decoder'); + +module.exports = { + encode: encode, + decode: decode +}; diff --git a/node_modules/jpeg-js/lib/decoder.js b/node_modules/jpeg-js/lib/decoder.js new file mode 100644 index 0000000..1982481 --- /dev/null +++ b/node_modules/jpeg-js/lib/decoder.js @@ -0,0 +1,1151 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- / +/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ +/* + Copyright 2011 notmasteryet + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +// - The JPEG specification can be found in the ITU CCITT Recommendation T.81 +// (www.w3.org/Graphics/JPEG/itu-t81.pdf) +// - The JFIF specification can be found in the JPEG File Interchange Format +// (www.w3.org/Graphics/JPEG/jfif3.pdf) +// - The Adobe Application-Specific JPEG markers in the Supporting the DCT Filters +// in PostScript Level 2, Technical Note #5116 +// (partners.adobe.com/public/developer/en/ps/sdk/5116.DCT_Filter.pdf) + +var JpegImage = (function jpegImage() { + "use strict"; + var dctZigZag = new Int32Array([ + 0, + 1, 8, + 16, 9, 2, + 3, 10, 17, 24, + 32, 25, 18, 11, 4, + 5, 12, 19, 26, 33, 40, + 48, 41, 34, 27, 20, 13, 6, + 7, 14, 21, 28, 35, 42, 49, 56, + 57, 50, 43, 36, 29, 22, 15, + 23, 30, 37, 44, 51, 58, + 59, 52, 45, 38, 31, + 39, 46, 53, 60, + 61, 54, 47, + 55, 62, + 63 + ]); + + var dctCos1 = 4017 // cos(pi/16) + var dctSin1 = 799 // sin(pi/16) + var dctCos3 = 3406 // cos(3*pi/16) + var dctSin3 = 2276 // sin(3*pi/16) + var dctCos6 = 1567 // cos(6*pi/16) + var dctSin6 = 3784 // sin(6*pi/16) + var dctSqrt2 = 5793 // sqrt(2) + var dctSqrt1d2 = 2896 // sqrt(2) / 2 + + function constructor() { + } + + function buildHuffmanTable(codeLengths, values) { + var k = 0, code = [], i, j, length = 16; + while (length > 0 && !codeLengths[length - 1]) + length--; + code.push({children: [], index: 0}); + var p = code[0], q; + for (i = 0; i < length; i++) { + for (j = 0; j < codeLengths[i]; j++) { + p = code.pop(); + p.children[p.index] = values[k]; + while (p.index > 0) { + if (code.length === 0) + throw new Error('Could not recreate Huffman Table'); + p = code.pop(); + } + p.index++; + code.push(p); + while (code.length <= i) { + code.push(q = {children: [], index: 0}); + p.children[p.index] = q.children; + p = q; + } + k++; + } + if (i + 1 < length) { + // p here points to last code + code.push(q = {children: [], index: 0}); + p.children[p.index] = q.children; + p = q; + } + } + return code[0].children; + } + + function decodeScan(data, offset, + frame, components, resetInterval, + spectralStart, spectralEnd, + successivePrev, successive, opts) { + var precision = frame.precision; + var samplesPerLine = frame.samplesPerLine; + var scanLines = frame.scanLines; + var mcusPerLine = frame.mcusPerLine; + var progressive = frame.progressive; + var maxH = frame.maxH, maxV = frame.maxV; + + var startOffset = offset, bitsData = 0, bitsCount = 0; + function readBit() { + if (bitsCount > 0) { + bitsCount--; + return (bitsData >> bitsCount) & 1; + } + bitsData = data[offset++]; + if (bitsData == 0xFF) { + var nextByte = data[offset++]; + if (nextByte) { + throw new Error("unexpected marker: " + ((bitsData << 8) | nextByte).toString(16)); + } + // unstuff 0 + } + bitsCount = 7; + return bitsData >>> 7; + } + function decodeHuffman(tree) { + var node = tree, bit; + while ((bit = readBit()) !== null) { + node = node[bit]; + if (typeof node === 'number') + return node; + if (typeof node !== 'object') + throw new Error("invalid huffman sequence"); + } + return null; + } + function receive(length) { + var n = 0; + while (length > 0) { + var bit = readBit(); + if (bit === null) return; + n = (n << 1) | bit; + length--; + } + return n; + } + function receiveAndExtend(length) { + var n = receive(length); + if (n >= 1 << (length - 1)) + return n; + return n + (-1 << length) + 1; + } + function decodeBaseline(component, zz) { + var t = decodeHuffman(component.huffmanTableDC); + var diff = t === 0 ? 0 : receiveAndExtend(t); + zz[0]= (component.pred += diff); + var k = 1; + while (k < 64) { + var rs = decodeHuffman(component.huffmanTableAC); + var s = rs & 15, r = rs >> 4; + if (s === 0) { + if (r < 15) + break; + k += 16; + continue; + } + k += r; + var z = dctZigZag[k]; + zz[z] = receiveAndExtend(s); + k++; + } + } + function decodeDCFirst(component, zz) { + var t = decodeHuffman(component.huffmanTableDC); + var diff = t === 0 ? 0 : (receiveAndExtend(t) << successive); + zz[0] = (component.pred += diff); + } + function decodeDCSuccessive(component, zz) { + zz[0] |= readBit() << successive; + } + var eobrun = 0; + function decodeACFirst(component, zz) { + if (eobrun > 0) { + eobrun--; + return; + } + var k = spectralStart, e = spectralEnd; + while (k <= e) { + var rs = decodeHuffman(component.huffmanTableAC); + var s = rs & 15, r = rs >> 4; + if (s === 0) { + if (r < 15) { + eobrun = receive(r) + (1 << r) - 1; + break; + } + k += 16; + continue; + } + k += r; + var z = dctZigZag[k]; + zz[z] = receiveAndExtend(s) * (1 << successive); + k++; + } + } + var successiveACState = 0, successiveACNextValue; + function decodeACSuccessive(component, zz) { + var k = spectralStart, e = spectralEnd, r = 0; + while (k <= e) { + var z = dctZigZag[k]; + var direction = zz[z] < 0 ? -1 : 1; + switch (successiveACState) { + case 0: // initial state + var rs = decodeHuffman(component.huffmanTableAC); + var s = rs & 15, r = rs >> 4; + if (s === 0) { + if (r < 15) { + eobrun = receive(r) + (1 << r); + successiveACState = 4; + } else { + r = 16; + successiveACState = 1; + } + } else { + if (s !== 1) + throw new Error("invalid ACn encoding"); + successiveACNextValue = receiveAndExtend(s); + successiveACState = r ? 2 : 3; + } + continue; + case 1: // skipping r zero items + case 2: + if (zz[z]) + zz[z] += (readBit() << successive) * direction; + else { + r--; + if (r === 0) + successiveACState = successiveACState == 2 ? 3 : 0; + } + break; + case 3: // set value for a zero item + if (zz[z]) + zz[z] += (readBit() << successive) * direction; + else { + zz[z] = successiveACNextValue << successive; + successiveACState = 0; + } + break; + case 4: // eob + if (zz[z]) + zz[z] += (readBit() << successive) * direction; + break; + } + k++; + } + if (successiveACState === 4) { + eobrun--; + if (eobrun === 0) + successiveACState = 0; + } + } + function decodeMcu(component, decode, mcu, row, col) { + var mcuRow = (mcu / mcusPerLine) | 0; + var mcuCol = mcu % mcusPerLine; + var blockRow = mcuRow * component.v + row; + var blockCol = mcuCol * component.h + col; + // If the block is missing and we're in tolerant mode, just skip it. + if (component.blocks[blockRow] === undefined && opts.tolerantDecoding) + return; + decode(component, component.blocks[blockRow][blockCol]); + } + function decodeBlock(component, decode, mcu) { + var blockRow = (mcu / component.blocksPerLine) | 0; + var blockCol = mcu % component.blocksPerLine; + // If the block is missing and we're in tolerant mode, just skip it. + if (component.blocks[blockRow] === undefined && opts.tolerantDecoding) + return; + decode(component, component.blocks[blockRow][blockCol]); + } + + var componentsLength = components.length; + var component, i, j, k, n; + var decodeFn; + if (progressive) { + if (spectralStart === 0) + decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive; + else + decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive; + } else { + decodeFn = decodeBaseline; + } + + var mcu = 0, marker; + var mcuExpected; + if (componentsLength == 1) { + mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn; + } else { + mcuExpected = mcusPerLine * frame.mcusPerColumn; + } + if (!resetInterval) resetInterval = mcuExpected; + + var h, v; + while (mcu < mcuExpected) { + // reset interval stuff + for (i = 0; i < componentsLength; i++) + components[i].pred = 0; + eobrun = 0; + + if (componentsLength == 1) { + component = components[0]; + for (n = 0; n < resetInterval; n++) { + decodeBlock(component, decodeFn, mcu); + mcu++; + } + } else { + for (n = 0; n < resetInterval; n++) { + for (i = 0; i < componentsLength; i++) { + component = components[i]; + h = component.h; + v = component.v; + for (j = 0; j < v; j++) { + for (k = 0; k < h; k++) { + decodeMcu(component, decodeFn, mcu, j, k); + } + } + } + mcu++; + + // If we've reached our expected MCU's, stop decoding + if (mcu === mcuExpected) break; + } + } + + if (mcu === mcuExpected) { + // Skip trailing bytes at the end of the scan - until we reach the next marker + do { + if (data[offset] === 0xFF) { + if (data[offset + 1] !== 0x00) { + break; + } + } + offset += 1; + } while (offset < data.length - 2); + } + + // find marker + bitsCount = 0; + marker = (data[offset] << 8) | data[offset + 1]; + if (marker < 0xFF00) { + throw new Error("marker was not found"); + } + + if (marker >= 0xFFD0 && marker <= 0xFFD7) { // RSTx + offset += 2; + } + else + break; + } + + return offset - startOffset; + } + + function buildComponentData(frame, component) { + var lines = []; + var blocksPerLine = component.blocksPerLine; + var blocksPerColumn = component.blocksPerColumn; + var samplesPerLine = blocksPerLine << 3; + // Only 1 used per invocation of this function and garbage collected after invocation, so no need to account for its memory footprint. + var R = new Int32Array(64), r = new Uint8Array(64); + + // A port of poppler's IDCT method which in turn is taken from: + // Christoph Loeffler, Adriaan Ligtenberg, George S. Moschytz, + // "Practical Fast 1-D DCT Algorithms with 11 Multiplications", + // IEEE Intl. Conf. on Acoustics, Speech & Signal Processing, 1989, + // 988-991. + function quantizeAndInverse(zz, dataOut, dataIn) { + var qt = component.quantizationTable; + var v0, v1, v2, v3, v4, v5, v6, v7, t; + var p = dataIn; + var i; + + // dequant + for (i = 0; i < 64; i++) + p[i] = zz[i] * qt[i]; + + // inverse DCT on rows + for (i = 0; i < 8; ++i) { + var row = 8 * i; + + // check for all-zero AC coefficients + if (p[1 + row] == 0 && p[2 + row] == 0 && p[3 + row] == 0 && + p[4 + row] == 0 && p[5 + row] == 0 && p[6 + row] == 0 && + p[7 + row] == 0) { + t = (dctSqrt2 * p[0 + row] + 512) >> 10; + p[0 + row] = t; + p[1 + row] = t; + p[2 + row] = t; + p[3 + row] = t; + p[4 + row] = t; + p[5 + row] = t; + p[6 + row] = t; + p[7 + row] = t; + continue; + } + + // stage 4 + v0 = (dctSqrt2 * p[0 + row] + 128) >> 8; + v1 = (dctSqrt2 * p[4 + row] + 128) >> 8; + v2 = p[2 + row]; + v3 = p[6 + row]; + v4 = (dctSqrt1d2 * (p[1 + row] - p[7 + row]) + 128) >> 8; + v7 = (dctSqrt1d2 * (p[1 + row] + p[7 + row]) + 128) >> 8; + v5 = p[3 + row] << 4; + v6 = p[5 + row] << 4; + + // stage 3 + t = (v0 - v1+ 1) >> 1; + v0 = (v0 + v1 + 1) >> 1; + v1 = t; + t = (v2 * dctSin6 + v3 * dctCos6 + 128) >> 8; + v2 = (v2 * dctCos6 - v3 * dctSin6 + 128) >> 8; + v3 = t; + t = (v4 - v6 + 1) >> 1; + v4 = (v4 + v6 + 1) >> 1; + v6 = t; + t = (v7 + v5 + 1) >> 1; + v5 = (v7 - v5 + 1) >> 1; + v7 = t; + + // stage 2 + t = (v0 - v3 + 1) >> 1; + v0 = (v0 + v3 + 1) >> 1; + v3 = t; + t = (v1 - v2 + 1) >> 1; + v1 = (v1 + v2 + 1) >> 1; + v2 = t; + t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12; + v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12; + v7 = t; + t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12; + v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12; + v6 = t; + + // stage 1 + p[0 + row] = v0 + v7; + p[7 + row] = v0 - v7; + p[1 + row] = v1 + v6; + p[6 + row] = v1 - v6; + p[2 + row] = v2 + v5; + p[5 + row] = v2 - v5; + p[3 + row] = v3 + v4; + p[4 + row] = v3 - v4; + } + + // inverse DCT on columns + for (i = 0; i < 8; ++i) { + var col = i; + + // check for all-zero AC coefficients + if (p[1*8 + col] == 0 && p[2*8 + col] == 0 && p[3*8 + col] == 0 && + p[4*8 + col] == 0 && p[5*8 + col] == 0 && p[6*8 + col] == 0 && + p[7*8 + col] == 0) { + t = (dctSqrt2 * dataIn[i+0] + 8192) >> 14; + p[0*8 + col] = t; + p[1*8 + col] = t; + p[2*8 + col] = t; + p[3*8 + col] = t; + p[4*8 + col] = t; + p[5*8 + col] = t; + p[6*8 + col] = t; + p[7*8 + col] = t; + continue; + } + + // stage 4 + v0 = (dctSqrt2 * p[0*8 + col] + 2048) >> 12; + v1 = (dctSqrt2 * p[4*8 + col] + 2048) >> 12; + v2 = p[2*8 + col]; + v3 = p[6*8 + col]; + v4 = (dctSqrt1d2 * (p[1*8 + col] - p[7*8 + col]) + 2048) >> 12; + v7 = (dctSqrt1d2 * (p[1*8 + col] + p[7*8 + col]) + 2048) >> 12; + v5 = p[3*8 + col]; + v6 = p[5*8 + col]; + + // stage 3 + t = (v0 - v1 + 1) >> 1; + v0 = (v0 + v1 + 1) >> 1; + v1 = t; + t = (v2 * dctSin6 + v3 * dctCos6 + 2048) >> 12; + v2 = (v2 * dctCos6 - v3 * dctSin6 + 2048) >> 12; + v3 = t; + t = (v4 - v6 + 1) >> 1; + v4 = (v4 + v6 + 1) >> 1; + v6 = t; + t = (v7 + v5 + 1) >> 1; + v5 = (v7 - v5 + 1) >> 1; + v7 = t; + + // stage 2 + t = (v0 - v3 + 1) >> 1; + v0 = (v0 + v3 + 1) >> 1; + v3 = t; + t = (v1 - v2 + 1) >> 1; + v1 = (v1 + v2 + 1) >> 1; + v2 = t; + t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12; + v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12; + v7 = t; + t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12; + v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12; + v6 = t; + + // stage 1 + p[0*8 + col] = v0 + v7; + p[7*8 + col] = v0 - v7; + p[1*8 + col] = v1 + v6; + p[6*8 + col] = v1 - v6; + p[2*8 + col] = v2 + v5; + p[5*8 + col] = v2 - v5; + p[3*8 + col] = v3 + v4; + p[4*8 + col] = v3 - v4; + } + + // convert to 8-bit integers + for (i = 0; i < 64; ++i) { + var sample = 128 + ((p[i] + 8) >> 4); + dataOut[i] = sample < 0 ? 0 : sample > 0xFF ? 0xFF : sample; + } + } + + requestMemoryAllocation(samplesPerLine * blocksPerColumn * 8); + + var i, j; + for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) { + var scanLine = blockRow << 3; + for (i = 0; i < 8; i++) + lines.push(new Uint8Array(samplesPerLine)); + for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) { + quantizeAndInverse(component.blocks[blockRow][blockCol], r, R); + + var offset = 0, sample = blockCol << 3; + for (j = 0; j < 8; j++) { + var line = lines[scanLine + j]; + for (i = 0; i < 8; i++) + line[sample + i] = r[offset++]; + } + } + } + return lines; + } + + function clampTo8bit(a) { + return a < 0 ? 0 : a > 255 ? 255 : a; + } + + constructor.prototype = { + load: function load(path) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", path, true); + xhr.responseType = "arraybuffer"; + xhr.onload = (function() { + // TODO catch parse error + var data = new Uint8Array(xhr.response || xhr.mozResponseArrayBuffer); + this.parse(data); + if (this.onload) + this.onload(); + }).bind(this); + xhr.send(null); + }, + parse: function parse(data) { + var maxResolutionInPixels = this.opts.maxResolutionInMP * 1000 * 1000; + var offset = 0, length = data.length; + function readUint16() { + var value = (data[offset] << 8) | data[offset + 1]; + offset += 2; + return value; + } + function readDataBlock() { + var length = readUint16(); + var array = data.subarray(offset, offset + length - 2); + offset += array.length; + return array; + } + function prepareComponents(frame) { + // According to the JPEG standard, the sampling factor must be between 1 and 4 + // See https://github.com/libjpeg-turbo/libjpeg-turbo/blob/9abeff46d87bd201a952e276f3e4339556a403a3/libjpeg.txt#L1138-L1146 + var maxH = 1, maxV = 1; + var component, componentId; + for (componentId in frame.components) { + if (frame.components.hasOwnProperty(componentId)) { + component = frame.components[componentId]; + if (maxH < component.h) maxH = component.h; + if (maxV < component.v) maxV = component.v; + } + } + var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / maxH); + var mcusPerColumn = Math.ceil(frame.scanLines / 8 / maxV); + for (componentId in frame.components) { + if (frame.components.hasOwnProperty(componentId)) { + component = frame.components[componentId]; + var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / maxH); + var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / maxV); + var blocksPerLineForMcu = mcusPerLine * component.h; + var blocksPerColumnForMcu = mcusPerColumn * component.v; + var blocksToAllocate = blocksPerColumnForMcu * blocksPerLineForMcu; + var blocks = []; + + // Each block is a Int32Array of length 64 (4 x 64 = 256 bytes) + requestMemoryAllocation(blocksToAllocate * 256); + + for (var i = 0; i < blocksPerColumnForMcu; i++) { + var row = []; + for (var j = 0; j < blocksPerLineForMcu; j++) + row.push(new Int32Array(64)); + blocks.push(row); + } + component.blocksPerLine = blocksPerLine; + component.blocksPerColumn = blocksPerColumn; + component.blocks = blocks; + } + } + frame.maxH = maxH; + frame.maxV = maxV; + frame.mcusPerLine = mcusPerLine; + frame.mcusPerColumn = mcusPerColumn; + } + var jfif = null; + var adobe = null; + var pixels = null; + var frame, resetInterval; + var quantizationTables = [], frames = []; + var huffmanTablesAC = [], huffmanTablesDC = []; + var fileMarker = readUint16(); + var malformedDataOffset = -1; + this.comments = []; + if (fileMarker != 0xFFD8) { // SOI (Start of Image) + throw new Error("SOI not found"); + } + + fileMarker = readUint16(); + while (fileMarker != 0xFFD9) { // EOI (End of image) + var i, j, l; + switch(fileMarker) { + case 0xFF00: break; + case 0xFFE0: // APP0 (Application Specific) + case 0xFFE1: // APP1 + case 0xFFE2: // APP2 + case 0xFFE3: // APP3 + case 0xFFE4: // APP4 + case 0xFFE5: // APP5 + case 0xFFE6: // APP6 + case 0xFFE7: // APP7 + case 0xFFE8: // APP8 + case 0xFFE9: // APP9 + case 0xFFEA: // APP10 + case 0xFFEB: // APP11 + case 0xFFEC: // APP12 + case 0xFFED: // APP13 + case 0xFFEE: // APP14 + case 0xFFEF: // APP15 + case 0xFFFE: // COM (Comment) + var appData = readDataBlock(); + + if (fileMarker === 0xFFFE) { + var comment = String.fromCharCode.apply(null, appData); + this.comments.push(comment); + } + + if (fileMarker === 0xFFE0) { + if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 && + appData[3] === 0x46 && appData[4] === 0) { // 'JFIF\x00' + jfif = { + version: { major: appData[5], minor: appData[6] }, + densityUnits: appData[7], + xDensity: (appData[8] << 8) | appData[9], + yDensity: (appData[10] << 8) | appData[11], + thumbWidth: appData[12], + thumbHeight: appData[13], + thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13]) + }; + } + } + // TODO APP1 - Exif + if (fileMarker === 0xFFE1) { + if (appData[0] === 0x45 && + appData[1] === 0x78 && + appData[2] === 0x69 && + appData[3] === 0x66 && + appData[4] === 0) { // 'EXIF\x00' + this.exifBuffer = appData.subarray(5, appData.length); + } + } + + if (fileMarker === 0xFFEE) { + if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F && + appData[3] === 0x62 && appData[4] === 0x65 && appData[5] === 0) { // 'Adobe\x00' + adobe = { + version: appData[6], + flags0: (appData[7] << 8) | appData[8], + flags1: (appData[9] << 8) | appData[10], + transformCode: appData[11] + }; + } + } + break; + + case 0xFFDB: // DQT (Define Quantization Tables) + var quantizationTablesLength = readUint16(); + var quantizationTablesEnd = quantizationTablesLength + offset - 2; + while (offset < quantizationTablesEnd) { + var quantizationTableSpec = data[offset++]; + requestMemoryAllocation(64 * 4); + var tableData = new Int32Array(64); + if ((quantizationTableSpec >> 4) === 0) { // 8 bit values + for (j = 0; j < 64; j++) { + var z = dctZigZag[j]; + tableData[z] = data[offset++]; + } + } else if ((quantizationTableSpec >> 4) === 1) { //16 bit + for (j = 0; j < 64; j++) { + var z = dctZigZag[j]; + tableData[z] = readUint16(); + } + } else + throw new Error("DQT: invalid table spec"); + quantizationTables[quantizationTableSpec & 15] = tableData; + } + break; + + case 0xFFC0: // SOF0 (Start of Frame, Baseline DCT) + case 0xFFC1: // SOF1 (Start of Frame, Extended DCT) + case 0xFFC2: // SOF2 (Start of Frame, Progressive DCT) + readUint16(); // skip data length + frame = {}; + frame.extended = (fileMarker === 0xFFC1); + frame.progressive = (fileMarker === 0xFFC2); + frame.precision = data[offset++]; + frame.scanLines = readUint16(); + frame.samplesPerLine = readUint16(); + frame.components = {}; + frame.componentsOrder = []; + + var pixelsInFrame = frame.scanLines * frame.samplesPerLine; + if (pixelsInFrame > maxResolutionInPixels) { + var exceededAmount = Math.ceil((pixelsInFrame - maxResolutionInPixels) / 1e6); + throw new Error(`maxResolutionInMP limit exceeded by ${exceededAmount}MP`); + } + + var componentsCount = data[offset++], componentId; + var maxH = 0, maxV = 0; + for (i = 0; i < componentsCount; i++) { + componentId = data[offset]; + var h = data[offset + 1] >> 4; + var v = data[offset + 1] & 15; + var qId = data[offset + 2]; + + if ( h <= 0 || v <= 0 ) { + throw new Error('Invalid sampling factor, expected values above 0'); + } + + frame.componentsOrder.push(componentId); + frame.components[componentId] = { + h: h, + v: v, + quantizationIdx: qId + }; + offset += 3; + } + prepareComponents(frame); + frames.push(frame); + break; + + case 0xFFC4: // DHT (Define Huffman Tables) + var huffmanLength = readUint16(); + for (i = 2; i < huffmanLength;) { + var huffmanTableSpec = data[offset++]; + var codeLengths = new Uint8Array(16); + var codeLengthSum = 0; + for (j = 0; j < 16; j++, offset++) { + codeLengthSum += (codeLengths[j] = data[offset]); + } + requestMemoryAllocation(16 + codeLengthSum); + var huffmanValues = new Uint8Array(codeLengthSum); + for (j = 0; j < codeLengthSum; j++, offset++) + huffmanValues[j] = data[offset]; + i += 17 + codeLengthSum; + + ((huffmanTableSpec >> 4) === 0 ? + huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = + buildHuffmanTable(codeLengths, huffmanValues); + } + break; + + case 0xFFDD: // DRI (Define Restart Interval) + readUint16(); // skip data length + resetInterval = readUint16(); + break; + + case 0xFFDC: // Number of Lines marker + readUint16() // skip data length + readUint16() // Ignore this data since it represents the image height + break; + + case 0xFFDA: // SOS (Start of Scan) + var scanLength = readUint16(); + var selectorsCount = data[offset++]; + var components = [], component; + for (i = 0; i < selectorsCount; i++) { + component = frame.components[data[offset++]]; + var tableSpec = data[offset++]; + component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4]; + component.huffmanTableAC = huffmanTablesAC[tableSpec & 15]; + components.push(component); + } + var spectralStart = data[offset++]; + var spectralEnd = data[offset++]; + var successiveApproximation = data[offset++]; + var processed = decodeScan(data, offset, + frame, components, resetInterval, + spectralStart, spectralEnd, + successiveApproximation >> 4, successiveApproximation & 15, this.opts); + offset += processed; + break; + + case 0xFFFF: // Fill bytes + if (data[offset] !== 0xFF) { // Avoid skipping a valid marker. + offset--; + } + break; + default: + if (data[offset - 3] == 0xFF && + data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) { + // could be incorrect encoding -- last 0xFF byte of the previous + // block was eaten by the encoder + offset -= 3; + break; + } + else if (fileMarker === 0xE0 || fileMarker == 0xE1) { + // Recover from malformed APP1 markers popular in some phone models. + // See https://github.com/eugeneware/jpeg-js/issues/82 + if (malformedDataOffset !== -1) { + throw new Error(`first unknown JPEG marker at offset ${malformedDataOffset.toString(16)}, second unknown JPEG marker ${fileMarker.toString(16)} at offset ${(offset - 1).toString(16)}`); + } + malformedDataOffset = offset - 1; + const nextOffset = readUint16(); + if (data[offset + nextOffset - 2] === 0xFF) { + offset += nextOffset - 2; + break; + } + } + throw new Error("unknown JPEG marker " + fileMarker.toString(16)); + } + fileMarker = readUint16(); + } + if (frames.length != 1) + throw new Error("only single frame JPEGs supported"); + + // set each frame's components quantization table + for (var i = 0; i < frames.length; i++) { + var cp = frames[i].components; + for (var j in cp) { + cp[j].quantizationTable = quantizationTables[cp[j].quantizationIdx]; + delete cp[j].quantizationIdx; + } + } + + this.width = frame.samplesPerLine; + this.height = frame.scanLines; + this.jfif = jfif; + this.adobe = adobe; + this.components = []; + for (var i = 0; i < frame.componentsOrder.length; i++) { + var component = frame.components[frame.componentsOrder[i]]; + this.components.push({ + lines: buildComponentData(frame, component), + scaleX: component.h / frame.maxH, + scaleY: component.v / frame.maxV + }); + } + }, + getData: function getData(width, height) { + var scaleX = this.width / width, scaleY = this.height / height; + + var component1, component2, component3, component4; + var component1Line, component2Line, component3Line, component4Line; + var x, y; + var offset = 0; + var Y, Cb, Cr, K, C, M, Ye, R, G, B; + var colorTransform; + var dataLength = width * height * this.components.length; + requestMemoryAllocation(dataLength); + var data = new Uint8Array(dataLength); + switch (this.components.length) { + case 1: + component1 = this.components[0]; + for (y = 0; y < height; y++) { + component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)]; + for (x = 0; x < width; x++) { + Y = component1Line[0 | (x * component1.scaleX * scaleX)]; + + data[offset++] = Y; + } + } + break; + case 2: + // PDF might compress two component data in custom colorspace + component1 = this.components[0]; + component2 = this.components[1]; + for (y = 0; y < height; y++) { + component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)]; + component2Line = component2.lines[0 | (y * component2.scaleY * scaleY)]; + for (x = 0; x < width; x++) { + Y = component1Line[0 | (x * component1.scaleX * scaleX)]; + data[offset++] = Y; + Y = component2Line[0 | (x * component2.scaleX * scaleX)]; + data[offset++] = Y; + } + } + break; + case 3: + // The default transform for three components is true + colorTransform = true; + // The adobe transform marker overrides any previous setting + if (this.adobe && this.adobe.transformCode) + colorTransform = true; + else if (typeof this.opts.colorTransform !== 'undefined') + colorTransform = !!this.opts.colorTransform; + + component1 = this.components[0]; + component2 = this.components[1]; + component3 = this.components[2]; + for (y = 0; y < height; y++) { + component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)]; + component2Line = component2.lines[0 | (y * component2.scaleY * scaleY)]; + component3Line = component3.lines[0 | (y * component3.scaleY * scaleY)]; + for (x = 0; x < width; x++) { + if (!colorTransform) { + R = component1Line[0 | (x * component1.scaleX * scaleX)]; + G = component2Line[0 | (x * component2.scaleX * scaleX)]; + B = component3Line[0 | (x * component3.scaleX * scaleX)]; + } else { + Y = component1Line[0 | (x * component1.scaleX * scaleX)]; + Cb = component2Line[0 | (x * component2.scaleX * scaleX)]; + Cr = component3Line[0 | (x * component3.scaleX * scaleX)]; + + R = clampTo8bit(Y + 1.402 * (Cr - 128)); + G = clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128)); + B = clampTo8bit(Y + 1.772 * (Cb - 128)); + } + + data[offset++] = R; + data[offset++] = G; + data[offset++] = B; + } + } + break; + case 4: + if (!this.adobe) + throw new Error('Unsupported color mode (4 components)'); + // The default transform for four components is false + colorTransform = false; + // The adobe transform marker overrides any previous setting + if (this.adobe && this.adobe.transformCode) + colorTransform = true; + else if (typeof this.opts.colorTransform !== 'undefined') + colorTransform = !!this.opts.colorTransform; + + component1 = this.components[0]; + component2 = this.components[1]; + component3 = this.components[2]; + component4 = this.components[3]; + for (y = 0; y < height; y++) { + component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)]; + component2Line = component2.lines[0 | (y * component2.scaleY * scaleY)]; + component3Line = component3.lines[0 | (y * component3.scaleY * scaleY)]; + component4Line = component4.lines[0 | (y * component4.scaleY * scaleY)]; + for (x = 0; x < width; x++) { + if (!colorTransform) { + C = component1Line[0 | (x * component1.scaleX * scaleX)]; + M = component2Line[0 | (x * component2.scaleX * scaleX)]; + Ye = component3Line[0 | (x * component3.scaleX * scaleX)]; + K = component4Line[0 | (x * component4.scaleX * scaleX)]; + } else { + Y = component1Line[0 | (x * component1.scaleX * scaleX)]; + Cb = component2Line[0 | (x * component2.scaleX * scaleX)]; + Cr = component3Line[0 | (x * component3.scaleX * scaleX)]; + K = component4Line[0 | (x * component4.scaleX * scaleX)]; + + C = 255 - clampTo8bit(Y + 1.402 * (Cr - 128)); + M = 255 - clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128)); + Ye = 255 - clampTo8bit(Y + 1.772 * (Cb - 128)); + } + data[offset++] = 255-C; + data[offset++] = 255-M; + data[offset++] = 255-Ye; + data[offset++] = 255-K; + } + } + break; + default: + throw new Error('Unsupported color mode'); + } + return data; + }, + copyToImageData: function copyToImageData(imageData, formatAsRGBA) { + var width = imageData.width, height = imageData.height; + var imageDataArray = imageData.data; + var data = this.getData(width, height); + var i = 0, j = 0, x, y; + var Y, K, C, M, R, G, B; + switch (this.components.length) { + case 1: + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + Y = data[i++]; + + imageDataArray[j++] = Y; + imageDataArray[j++] = Y; + imageDataArray[j++] = Y; + if (formatAsRGBA) { + imageDataArray[j++] = 255; + } + } + } + break; + case 3: + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + R = data[i++]; + G = data[i++]; + B = data[i++]; + + imageDataArray[j++] = R; + imageDataArray[j++] = G; + imageDataArray[j++] = B; + if (formatAsRGBA) { + imageDataArray[j++] = 255; + } + } + } + break; + case 4: + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + C = data[i++]; + M = data[i++]; + Y = data[i++]; + K = data[i++]; + + R = 255 - clampTo8bit(C * (1 - K / 255) + K); + G = 255 - clampTo8bit(M * (1 - K / 255) + K); + B = 255 - clampTo8bit(Y * (1 - K / 255) + K); + + imageDataArray[j++] = R; + imageDataArray[j++] = G; + imageDataArray[j++] = B; + if (formatAsRGBA) { + imageDataArray[j++] = 255; + } + } + } + break; + default: + throw new Error('Unsupported color mode'); + } + } + }; + + + // We cap the amount of memory used by jpeg-js to avoid unexpected OOMs from untrusted content. + var totalBytesAllocated = 0; + var maxMemoryUsageBytes = 0; + function requestMemoryAllocation(increaseAmount = 0) { + var totalMemoryImpactBytes = totalBytesAllocated + increaseAmount; + if (totalMemoryImpactBytes > maxMemoryUsageBytes) { + var exceededAmount = Math.ceil((totalMemoryImpactBytes - maxMemoryUsageBytes) / 1024 / 1024); + throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${exceededAmount}MB`); + } + + totalBytesAllocated = totalMemoryImpactBytes; + } + + constructor.resetMaxMemoryUsage = function (maxMemoryUsageBytes_) { + totalBytesAllocated = 0; + maxMemoryUsageBytes = maxMemoryUsageBytes_; + }; + + constructor.getBytesAllocated = function () { + return totalBytesAllocated; + }; + + constructor.requestMemoryAllocation = requestMemoryAllocation; + + return constructor; +})(); + +if (typeof module !== 'undefined') { + module.exports = decode; +} else if (typeof window !== 'undefined') { + window['jpeg-js'] = window['jpeg-js'] || {}; + window['jpeg-js'].decode = decode; +} + +function decode(jpegData, userOpts = {}) { + var defaultOpts = { + // "undefined" means "Choose whether to transform colors based on the image’s color model." + colorTransform: undefined, + useTArray: false, + formatAsRGBA: true, + tolerantDecoding: true, + maxResolutionInMP: 100, // Don't decode more than 100 megapixels + maxMemoryUsageInMB: 512, // Don't decode if memory footprint is more than 512MB + }; + + var opts = {...defaultOpts, ...userOpts}; + var arr = new Uint8Array(jpegData); + var decoder = new JpegImage(); + decoder.opts = opts; + // If this constructor ever supports async decoding this will need to be done differently. + // Until then, treating as singleton limit is fine. + JpegImage.resetMaxMemoryUsage(opts.maxMemoryUsageInMB * 1024 * 1024); + decoder.parse(arr); + + var channels = (opts.formatAsRGBA) ? 4 : 3; + var bytesNeeded = decoder.width * decoder.height * channels; + try { + JpegImage.requestMemoryAllocation(bytesNeeded); + var image = { + width: decoder.width, + height: decoder.height, + exifBuffer: decoder.exifBuffer, + data: opts.useTArray ? + new Uint8Array(bytesNeeded) : + Buffer.alloc(bytesNeeded) + }; + if(decoder.comments.length > 0) { + image["comments"] = decoder.comments; + } + } catch (err) { + if (err instanceof RangeError) { + throw new Error("Could not allocate enough memory for the image. " + + "Required: " + bytesNeeded); + } + + if (err instanceof ReferenceError) { + if (err.message === "Buffer is not defined") { + throw new Error("Buffer is not globally defined in this environment. " + + "Consider setting useTArray to true"); + } + } + throw err; + } + + decoder.copyToImageData(image, opts.formatAsRGBA); + + return image; +} diff --git a/node_modules/jpeg-js/lib/encoder.js b/node_modules/jpeg-js/lib/encoder.js new file mode 100644 index 0000000..fdbc184 --- /dev/null +++ b/node_modules/jpeg-js/lib/encoder.js @@ -0,0 +1,814 @@ +/* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/* +JPEG encoder ported to JavaScript and optimized by Andreas Ritter, www.bytestrom.eu, 11/2009 + +Basic GUI blocking jpeg encoder +*/ + +var btoa = btoa || function(buf) { + return Buffer.from(buf).toString('base64'); +}; + +function JPEGEncoder(quality) { + var self = this; + var fround = Math.round; + var ffloor = Math.floor; + var YTable = new Array(64); + var UVTable = new Array(64); + var fdtbl_Y = new Array(64); + var fdtbl_UV = new Array(64); + var YDC_HT; + var UVDC_HT; + var YAC_HT; + var UVAC_HT; + + var bitcode = new Array(65535); + var category = new Array(65535); + var outputfDCTQuant = new Array(64); + var DU = new Array(64); + var byteout = []; + var bytenew = 0; + var bytepos = 7; + + var YDU = new Array(64); + var UDU = new Array(64); + var VDU = new Array(64); + var clt = new Array(256); + var RGB_YUV_TABLE = new Array(2048); + var currentQuality; + + var ZigZag = [ + 0, 1, 5, 6,14,15,27,28, + 2, 4, 7,13,16,26,29,42, + 3, 8,12,17,25,30,41,43, + 9,11,18,24,31,40,44,53, + 10,19,23,32,39,45,52,54, + 20,22,33,38,46,51,55,60, + 21,34,37,47,50,56,59,61, + 35,36,48,49,57,58,62,63 + ]; + + var std_dc_luminance_nrcodes = [0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0]; + var std_dc_luminance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_luminance_nrcodes = [0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d]; + var std_ac_luminance_values = [ + 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12, + 0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07, + 0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08, + 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0, + 0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16, + 0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28, + 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39, + 0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49, + 0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59, + 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69, + 0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79, + 0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89, + 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98, + 0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7, + 0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6, + 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5, + 0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4, + 0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2, + 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea, + 0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + var std_dc_chrominance_nrcodes = [0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0]; + var std_dc_chrominance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_chrominance_nrcodes = [0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77]; + var std_ac_chrominance_values = [ + 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21, + 0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71, + 0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91, + 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0, + 0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34, + 0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26, + 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38, + 0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48, + 0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58, + 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68, + 0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78, + 0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96, + 0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5, + 0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4, + 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3, + 0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2, + 0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda, + 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9, + 0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + function initQuantTables(sf){ + var YQT = [ + 16, 11, 10, 16, 24, 40, 51, 61, + 12, 12, 14, 19, 26, 58, 60, 55, + 14, 13, 16, 24, 40, 57, 69, 56, + 14, 17, 22, 29, 51, 87, 80, 62, + 18, 22, 37, 56, 68,109,103, 77, + 24, 35, 55, 64, 81,104,113, 92, + 49, 64, 78, 87,103,121,120,101, + 72, 92, 95, 98,112,100,103, 99 + ]; + + for (var i = 0; i < 64; i++) { + var t = ffloor((YQT[i]*sf+50)/100); + if (t < 1) { + t = 1; + } else if (t > 255) { + t = 255; + } + YTable[ZigZag[i]] = t; + } + var UVQT = [ + 17, 18, 24, 47, 99, 99, 99, 99, + 18, 21, 26, 66, 99, 99, 99, 99, + 24, 26, 56, 99, 99, 99, 99, 99, + 47, 66, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99 + ]; + for (var j = 0; j < 64; j++) { + var u = ffloor((UVQT[j]*sf+50)/100); + if (u < 1) { + u = 1; + } else if (u > 255) { + u = 255; + } + UVTable[ZigZag[j]] = u; + } + var aasf = [ + 1.0, 1.387039845, 1.306562965, 1.175875602, + 1.0, 0.785694958, 0.541196100, 0.275899379 + ]; + var k = 0; + for (var row = 0; row < 8; row++) + { + for (var col = 0; col < 8; col++) + { + fdtbl_Y[k] = (1.0 / (YTable [ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + fdtbl_UV[k] = (1.0 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + k++; + } + } + } + + function computeHuffmanTbl(nrcodes, std_table){ + var codevalue = 0; + var pos_in_table = 0; + var HT = new Array(); + for (var k = 1; k <= 16; k++) { + for (var j = 1; j <= nrcodes[k]; j++) { + HT[std_table[pos_in_table]] = []; + HT[std_table[pos_in_table]][0] = codevalue; + HT[std_table[pos_in_table]][1] = k; + pos_in_table++; + codevalue++; + } + codevalue*=2; + } + return HT; + } + + function initHuffmanTbl() + { + YDC_HT = computeHuffmanTbl(std_dc_luminance_nrcodes,std_dc_luminance_values); + UVDC_HT = computeHuffmanTbl(std_dc_chrominance_nrcodes,std_dc_chrominance_values); + YAC_HT = computeHuffmanTbl(std_ac_luminance_nrcodes,std_ac_luminance_values); + UVAC_HT = computeHuffmanTbl(std_ac_chrominance_nrcodes,std_ac_chrominance_values); + } + + function initCategoryNumber() + { + var nrlower = 1; + var nrupper = 2; + for (var cat = 1; cat <= 15; cat++) { + //Positive numbers + for (var nr = nrlower; nr>0] = 38470 * i; + RGB_YUV_TABLE[(i+ 512)>>0] = 7471 * i + 0x8000; + RGB_YUV_TABLE[(i+ 768)>>0] = -11059 * i; + RGB_YUV_TABLE[(i+1024)>>0] = -21709 * i; + RGB_YUV_TABLE[(i+1280)>>0] = 32768 * i + 0x807FFF; + RGB_YUV_TABLE[(i+1536)>>0] = -27439 * i; + RGB_YUV_TABLE[(i+1792)>>0] = - 5329 * i; + } + } + + // IO functions + function writeBits(bs) + { + var value = bs[0]; + var posval = bs[1]-1; + while ( posval >= 0 ) { + if (value & (1 << posval) ) { + bytenew |= (1 << bytepos); + } + posval--; + bytepos--; + if (bytepos < 0) { + if (bytenew == 0xFF) { + writeByte(0xFF); + writeByte(0); + } + else { + writeByte(bytenew); + } + bytepos=7; + bytenew=0; + } + } + } + + function writeByte(value) + { + //byteout.push(clt[value]); // write char directly instead of converting later + byteout.push(value); + } + + function writeWord(value) + { + writeByte((value>>8)&0xFF); + writeByte((value )&0xFF); + } + + // DCT & quantization core + function fDCTQuant(data, fdtbl) + { + var d0, d1, d2, d3, d4, d5, d6, d7; + /* Pass 1: process rows. */ + var dataOff=0; + var i; + var I8 = 8; + var I64 = 64; + for (i=0; i 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0); + //outputfDCTQuant[i] = fround(fDCTQuant); + + } + return outputfDCTQuant; + } + + function writeAPP0() + { + writeWord(0xFFE0); // marker + writeWord(16); // length + writeByte(0x4A); // J + writeByte(0x46); // F + writeByte(0x49); // I + writeByte(0x46); // F + writeByte(0); // = "JFIF",'\0' + writeByte(1); // versionhi + writeByte(1); // versionlo + writeByte(0); // xyunits + writeWord(1); // xdensity + writeWord(1); // ydensity + writeByte(0); // thumbnwidth + writeByte(0); // thumbnheight + } + + function writeAPP1(exifBuffer) { + if (!exifBuffer) return; + + writeWord(0xFFE1); // APP1 marker + + if (exifBuffer[0] === 0x45 && + exifBuffer[1] === 0x78 && + exifBuffer[2] === 0x69 && + exifBuffer[3] === 0x66) { + // Buffer already starts with EXIF, just use it directly + writeWord(exifBuffer.length + 2); // length is buffer + length itself! + } else { + // Buffer doesn't start with EXIF, write it for them + writeWord(exifBuffer.length + 5 + 2); // length is buffer + EXIF\0 + length itself! + writeByte(0x45); // E + writeByte(0x78); // X + writeByte(0x69); // I + writeByte(0x66); // F + writeByte(0); // = "EXIF",'\0' + } + + for (var i = 0; i < exifBuffer.length; i++) { + writeByte(exifBuffer[i]); + } + } + + function writeSOF0(width, height) + { + writeWord(0xFFC0); // marker + writeWord(17); // length, truecolor YUV JPG + writeByte(8); // precision + writeWord(height); + writeWord(width); + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0x11); // HVY + writeByte(0); // QTY + writeByte(2); // IdU + writeByte(0x11); // HVU + writeByte(1); // QTU + writeByte(3); // IdV + writeByte(0x11); // HVV + writeByte(1); // QTV + } + + function writeDQT() + { + writeWord(0xFFDB); // marker + writeWord(132); // length + writeByte(0); + for (var i=0; i<64; i++) { + writeByte(YTable[i]); + } + writeByte(1); + for (var j=0; j<64; j++) { + writeByte(UVTable[j]); + } + } + + function writeDHT() + { + writeWord(0xFFC4); // marker + writeWord(0x01A2); // length + + writeByte(0); // HTYDCinfo + for (var i=0; i<16; i++) { + writeByte(std_dc_luminance_nrcodes[i+1]); + } + for (var j=0; j<=11; j++) { + writeByte(std_dc_luminance_values[j]); + } + + writeByte(0x10); // HTYACinfo + for (var k=0; k<16; k++) { + writeByte(std_ac_luminance_nrcodes[k+1]); + } + for (var l=0; l<=161; l++) { + writeByte(std_ac_luminance_values[l]); + } + + writeByte(1); // HTUDCinfo + for (var m=0; m<16; m++) { + writeByte(std_dc_chrominance_nrcodes[m+1]); + } + for (var n=0; n<=11; n++) { + writeByte(std_dc_chrominance_values[n]); + } + + writeByte(0x11); // HTUACinfo + for (var o=0; o<16; o++) { + writeByte(std_ac_chrominance_nrcodes[o+1]); + } + for (var p=0; p<=161; p++) { + writeByte(std_ac_chrominance_values[p]); + } + } + + function writeCOM(comments) + { + if (typeof comments === "undefined" || comments.constructor !== Array) return; + comments.forEach(e => { + if (typeof e !== "string") return; + writeWord(0xFFFE); // marker + var l = e.length; + writeWord(l + 2); // length itself as well + var i; + for (i = 0; i < l; i++) + writeByte(e.charCodeAt(i)); + }); + } + + function writeSOS() + { + writeWord(0xFFDA); // marker + writeWord(12); // length + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0); // HTY + writeByte(2); // IdU + writeByte(0x11); // HTU + writeByte(3); // IdV + writeByte(0x11); // HTV + writeByte(0); // Ss + writeByte(0x3f); // Se + writeByte(0); // Bf + } + + function processDU(CDU, fdtbl, DC, HTDC, HTAC){ + var EOB = HTAC[0x00]; + var M16zeroes = HTAC[0xF0]; + var pos; + var I16 = 16; + var I63 = 63; + var I64 = 64; + var DU_DCT = fDCTQuant(CDU, fdtbl); + //ZigZag reorder + for (var j=0;j0)&&(DU[end0pos]==0); end0pos--) {}; + //end0pos = first element in reverse order !=0 + if ( end0pos == 0) { + writeBits(EOB); + return DC; + } + var i = 1; + var lng; + while ( i <= end0pos ) { + var startpos = i; + for (; (DU[i]==0) && (i<=end0pos); ++i) {} + var nrzeroes = i-startpos; + if ( nrzeroes >= I16 ) { + lng = nrzeroes>>4; + for (var nrmarker=1; nrmarker <= lng; ++nrmarker) + writeBits(M16zeroes); + nrzeroes = nrzeroes&0xF; + } + pos = 32767+DU[i]; + writeBits(HTAC[(nrzeroes<<4)+category[pos]]); + writeBits(bitcode[pos]); + i++; + } + if ( end0pos != I63 ) { + writeBits(EOB); + } + return DC; + } + + function initCharLookupTable(){ + var sfcc = String.fromCharCode; + for(var i=0; i < 256; i++){ ///// ACHTUNG // 255 + clt[i] = sfcc(i); + } + } + + this.encode = function(image,quality) // image data object + { + var time_start = new Date().getTime(); + + if(quality) setQuality(quality); + + // Initialize bit writer + byteout = new Array(); + bytenew=0; + bytepos=7; + + // Add JPEG headers + writeWord(0xFFD8); // SOI + writeAPP0(); + writeCOM(image.comments); + writeAPP1(image.exifBuffer); + writeDQT(); + writeSOF0(image.width,image.height); + writeDHT(); + writeSOS(); + + + // Encode 8x8 macroblocks + var DCY=0; + var DCU=0; + var DCV=0; + + bytenew=0; + bytepos=7; + + + this.encode.displayName = "_encode_"; + + var imageData = image.data; + var width = image.width; + var height = image.height; + + var quadWidth = width*4; + var tripleWidth = width*3; + + var x, y = 0; + var r, g, b; + var start,p, col,row,pos; + while(y < height){ + x = 0; + while(x < quadWidth){ + start = quadWidth * y + x; + p = start; + col = -1; + row = 0; + + for(pos=0; pos < 64; pos++){ + row = pos >> 3;// /8 + col = ( pos & 7 ) * 4; // %8 + p = start + ( row * quadWidth ) + col; + + if(y+row >= height){ // padding bottom + p-= (quadWidth*(y+1+row-height)); + } + + if(x+col >= quadWidth){ // padding right + p-= ((x+col) - quadWidth +4) + } + + r = imageData[ p++ ]; + g = imageData[ p++ ]; + b = imageData[ p++ ]; + + + /* // calculate YUV values dynamically + YDU[pos]=((( 0.29900)*r+( 0.58700)*g+( 0.11400)*b))-128; //-0x80 + UDU[pos]=(((-0.16874)*r+(-0.33126)*g+( 0.50000)*b)); + VDU[pos]=((( 0.50000)*r+(-0.41869)*g+(-0.08131)*b)); + */ + + // use lookup table (slightly faster) + YDU[pos] = ((RGB_YUV_TABLE[r] + RGB_YUV_TABLE[(g + 256)>>0] + RGB_YUV_TABLE[(b + 512)>>0]) >> 16)-128; + UDU[pos] = ((RGB_YUV_TABLE[(r + 768)>>0] + RGB_YUV_TABLE[(g + 1024)>>0] + RGB_YUV_TABLE[(b + 1280)>>0]) >> 16)-128; + VDU[pos] = ((RGB_YUV_TABLE[(r + 1280)>>0] + RGB_YUV_TABLE[(g + 1536)>>0] + RGB_YUV_TABLE[(b + 1792)>>0]) >> 16)-128; + + } + + DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); + DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); + x+=32; + } + y+=8; + } + + + //////////////////////////////////////////////////////////////// + + // Do the bit alignment of the EOI marker + if ( bytepos >= 0 ) { + var fillbits = []; + fillbits[1] = bytepos+1; + fillbits[0] = (1<<(bytepos+1))-1; + writeBits(fillbits); + } + + writeWord(0xFFD9); //EOI + + if (typeof module === 'undefined') return new Uint8Array(byteout); + return Buffer.from(byteout); + + var jpegDataUri = 'data:image/jpeg;base64,' + btoa(byteout.join('')); + + byteout = []; + + // benchmarking + var duration = new Date().getTime() - time_start; + //console.log('Encoding time: '+ duration + 'ms'); + // + + return jpegDataUri + } + + function setQuality(quality){ + if (quality <= 0) { + quality = 1; + } + if (quality > 100) { + quality = 100; + } + + if(currentQuality == quality) return // don't recalc if unchanged + + var sf = 0; + if (quality < 50) { + sf = Math.floor(5000 / quality); + } else { + sf = Math.floor(200 - quality*2); + } + + initQuantTables(sf); + currentQuality = quality; + //console.log('Quality set to: '+quality +'%'); + } + + function init(){ + var time_start = new Date().getTime(); + if(!quality) quality = 50; + // Create tables + initCharLookupTable() + initHuffmanTbl(); + initCategoryNumber(); + initRGBYUVTable(); + + setQuality(quality); + var duration = new Date().getTime() - time_start; + //console.log('Initialization '+ duration + 'ms'); + } + + init(); + +}; + +if (typeof module !== 'undefined') { + module.exports = encode; +} else if (typeof window !== 'undefined') { + window['jpeg-js'] = window['jpeg-js'] || {}; + window['jpeg-js'].encode = encode; +} + +function encode(imgData, qu) { + if (typeof qu === 'undefined') qu = 50; + var encoder = new JPEGEncoder(qu); + var data = encoder.encode(imgData, qu); + return { + data: data, + width: imgData.width, + height: imgData.height, + }; +} + +// helper function to get the imageData of an existing image on the current page. +function getImageDataFromImage(idOrElement){ + var theImg = (typeof(idOrElement)=='string')? document.getElementById(idOrElement):idOrElement; + var cvs = document.createElement('canvas'); + cvs.width = theImg.width; + cvs.height = theImg.height; + var ctx = cvs.getContext("2d"); + ctx.drawImage(theImg,0,0); + + return (ctx.getImageData(0, 0, cvs.width, cvs.height)); +} diff --git a/node_modules/jpeg-js/package.json b/node_modules/jpeg-js/package.json new file mode 100644 index 0000000..c19658c --- /dev/null +++ b/node_modules/jpeg-js/package.json @@ -0,0 +1,32 @@ +{ + "name": "jpeg-js", + "version": "0.4.4", + "description": "A pure javascript JPEG encoder and decoder", + "main": "index.js", + "scripts": { + "test": "jest --testMatch=**/test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/eugeneware/jpeg-js" + }, + "keywords": [ + "jpeg", + "jpg", + "encoder", + "decoder", + "codec", + "image", + "javascript", + "js" + ], + "author": "Eugene Ware ", + "license": "BSD-3-Clause", + "bugs": { + "url": "https://github.com/eugeneware/jpeg-js/issues" + }, + "dependencies": {}, + "devDependencies": { + "jest": "^25.4.0" + } +} \ No newline at end of file diff --git a/node_modules/node-api-headers/.release-please-manifest.json b/node_modules/node-api-headers/.release-please-manifest.json new file mode 100644 index 0000000..3800c06 --- /dev/null +++ b/node_modules/node-api-headers/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.8.0" +} diff --git a/node_modules/node-api-headers/CHANGELOG.md b/node_modules/node-api-headers/CHANGELOG.md new file mode 100644 index 0000000..1aa5f05 --- /dev/null +++ b/node_modules/node-api-headers/CHANGELOG.md @@ -0,0 +1,130 @@ +# node-api-headers Changelog + +## [1.8.0](https://github.com/nodejs/node-api-headers/compare/v1.7.0...v1.8.0) (2026-01-23) + + +### Features + +* update headers from nodejs/node tag v25.4.0 ([#70](https://github.com/nodejs/node-api-headers/issues/70)) ([ebc02e1](https://github.com/nodejs/node-api-headers/commit/ebc02e18357a4d49f127f094c144371948b60c84)) + +## [1.7.0](https://github.com/nodejs/node-api-headers/compare/v1.6.0...v1.7.0) (2025-11-28) + + +### Features + +* update headers from nodejs/node tag v25.1.0 ([#65](https://github.com/nodejs/node-api-headers/issues/65)) ([f90f754](https://github.com/nodejs/node-api-headers/commit/f90f75459375cb4725914895aa418efefdde7af2)) +* update headers from nodejs/node tag v25.2.1 ([#68](https://github.com/nodejs/node-api-headers/issues/68)) ([769031b](https://github.com/nodejs/node-api-headers/commit/769031b208acd820bf3f2c3b2cf9f8b4b2e2bd83)) + +## [1.6.0](https://github.com/nodejs/node-api-headers/compare/v1.5.0...v1.6.0) (2025-09-26) + + +### Features + +* update headers from nodejs/node tag v24.9.0 ([#60](https://github.com/nodejs/node-api-headers/issues/60)) ([5963ef9](https://github.com/nodejs/node-api-headers/commit/5963ef9937c8f6bd8f33cb45c50f70bd9cbc0ffd)) + +## [1.5.0](https://github.com/nodejs/node-api-headers/compare/v1.4.0...v1.5.0) (2025-01-09) + + +### Features + +* update headers from nodejs/node tag v23.6.0 ([#57](https://github.com/nodejs/node-api-headers/issues/57)) ([64747b1](https://github.com/nodejs/node-api-headers/commit/64747b17a73e8356ed606d1b4dccb626804777f2)) + +## [1.4.0](https://github.com/nodejs/node-api-headers/compare/v1.3.0...v1.4.0) (2024-10-30) + + +### Features + +* **no-release:** add conditional support in `#if` ([#52](https://github.com/nodejs/node-api-headers/issues/52)) ([e1b8feb](https://github.com/nodejs/node-api-headers/commit/e1b8feb060cf85522538ec1b8a1d6eb782620022)) +* update headers from nodejs/node tag v23.1.0 ([#56](https://github.com/nodejs/node-api-headers/issues/56)) ([3336912](https://github.com/nodejs/node-api-headers/commit/33369124c7f8a670422a0c5a27ad149da83ed8d6)) + +## [1.3.0](https://github.com/nodejs/node-api-headers/compare/v1.2.0...v1.3.0) (2024-09-04) + + +### Features + +* update headers from nodejs/node tag v22.7.0 ([#48](https://github.com/nodejs/node-api-headers/issues/48)) ([6c73c34](https://github.com/nodejs/node-api-headers/commit/6c73c34b72e836531530f863eac315bd42e4569e)) + +## [1.2.0](https://github.com/nodejs/node-api-headers/compare/node-api-headers-v1.1.0...node-api-headers-v1.2.0) (2024-07-09) + + +### Features + +* update headers from nodejs/node tag v22.1.0 ([d5cfe19](https://github.com/nodejs/node-api-headers/commit/d5cfe19da8b974ca35764dd1c73b91d57cd3c4ce)) + +## 2023-08-05 Version 1.1.0, @NickNaso + +### Notable changes + +- Update headers from nodejs/node tag v20.3.0. + +### Commits + +- \[[`1f5a85dbb0`](https://github.com/nodejs/node-api-headers/commit/1f5a85dbb0)] - Update headers from nodejs/node tag v20.3.0 (#30) (github-actions\[bot]) + +## 2023-05-18 Version 1.0.1, @NickNaso + +### Notable changes + +- Update headers from nodejs/node tag v20.2.0. + +### Commits + +- \[[`d61451e6a3`](https://github.com/nodejs/node-api-headers/commit/d61451e6a3)] - Update headers from nodejs/node tag v20.2.0 (#27) (github-actions\[bot]) + +## 2023-04-20 Version 1.0.0, @NickNaso + +### Notable changes + +- Explain package version rationale. +- Update headers from nodejs/node tag v19.9.0. + +### Commits + +- \[[`130338da33`](https://github.com/nodejs/node-api-headers/commit/130338da33)] - **doc**: explain package version rationale (#26) (Chengzhong Wu) +- \[[`1a328031da`](https://github.com/nodejs/node-api-headers/commit/1a328031da)] - Update headers from nodejs/node tag v19.9.0 (#24) (github-actions\[bot]) + +## 2023-04-06 Version 0.0.5, @NickNaso + +### Notable changes + +- Provide def file for windows import lib. + +### Commits + +- \[[`15477c5898`](https://github.com/nodejs/node-api-headers/commit/15477c5898)] - Update headers from nodejs/node tag v19.8.1 (#22) (github-actions\[bot]) +- \[[`d7fa23b60e`](https://github.com/nodejs/node-api-headers/commit/d7fa23b60e)] - Use git status instead of git diff for change calculation (#21) (Kevin Eady) +- \[[`ea0dc01425`](https://github.com/nodejs/node-api-headers/commit/ea0dc01425)] - **fix**: moved def files on a proper folder. (#19) (Nicola Del Gobbo) +- \[[`069c3eb6f8`](https://github.com/nodejs/node-api-headers/commit/069c3eb6f8)] - **doc**: how to create a new release. (#18) (Nicola Del Gobbo) +- \[[`d23c2879c8`](https://github.com/nodejs/node-api-headers/commit/d23c2879c8)] - Provide def file for windows import lib (#17) (Leonid Pospelov) + +## 2023-03-17 Version 0.0.4, @NickNaso + +### Notable changes + +- Update headers from nodejs/node tag v19.8.0. + +### Commits + +- \[[`a1f0d41240`](https://github.com/nodejs/node-api-headers/commit/a1f0d41240)] - Merge pull request #14 from nodejs/update-headers/v19.8.0 (Nicola Del Gobbo) +- \[[`7548267285`](https://github.com/nodejs/node-api-headers/commit/7548267285)] - Update headers from nodejs/node tag v19.8.0 (github-actions\[bot]) + +## 2023-03-08 Version 0.0.3, @NickNaso + +### Notable changes + +- Add helper scripts for updating headers and symbols.js. + +### Commits + +- \[[`4fdbdd1710`](https://github.com/nodejs/node-api-headers/commit/4fdbdd1710)] - Update headers from nodejs/node tag v19.6.0 (#9) (github-actions\[bot]) +- \[[`ecefbdd00f`](https://github.com/nodejs/node-api-headers/commit/ecefbdd00f)] - Add helper scripts for updating headers and symbols.js (#7) (Kevin Eady) + +## 2022-12-29 Version 0.0.2, @NickNaso + +### Notable changes + +- Fixed wrong symblos in v6. + +### Commits + +- \[[`9c0b4ecaa5`](https://github.com/nodejs/node-api-headers/commit/9c0b4ecaa5)] - **fix**: wrong symblos in v6 (#6) (Nicola Del Gobbo) diff --git a/node_modules/node-api-headers/CODE_OF_CONDUCT.md b/node_modules/node-api-headers/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..eb07a97 --- /dev/null +++ b/node_modules/node-api-headers/CODE_OF_CONDUCT.md @@ -0,0 +1,4 @@ +# Code of Conduct + +The Node.js Code of Conduct, which applies to this project, can be found at +https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md. diff --git a/node_modules/node-api-headers/CONTRIBUTING.md b/node_modules/node-api-headers/CONTRIBUTING.md new file mode 100644 index 0000000..9446956 --- /dev/null +++ b/node_modules/node-api-headers/CONTRIBUTING.md @@ -0,0 +1,32 @@ +# Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +* (a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +* (b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +* (c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +* (d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. + +## Moderation Policy + +The [Node.js Moderation Policy] applies to this project. + +[Node.js Moderation Policy]: +https://github.com/nodejs/admin/blob/master/Moderation-Policy.md \ No newline at end of file diff --git a/node_modules/node-api-headers/CREATING_A_RELEASE.md b/node_modules/node-api-headers/CREATING_A_RELEASE.md new file mode 100644 index 0000000..abc1a37 --- /dev/null +++ b/node_modules/node-api-headers/CREATING_A_RELEASE.md @@ -0,0 +1,68 @@ +# Creating a release + +Only collaborators in npm for **node-api-headers** can create releases. If you +want to be able to do releases ask one of the existing collaborators to add +you. If necessary you can ask the build Working Group who manages the Node.js +npm user to add you if there are no other active collaborators. + +Generally, the release is handled by the +[release-please](https://github.com/nodejs/node-api-headers/blob/main/.github/workflows/release-please.yml) +GitHub action. It will bump the version in `package.json` and publish +node-api-headers to npm. + +In cases that the release-please action is not working, please follow the steps +below to publish node-api-headers manually. + +## Publish new release manually + +### Prerequisites + +Before to start creating a new release check if you have installed the following +tools: + +* [Changelog maker](https://www.npmjs.com/package/changelog-maker) + +If not please follow the instruction reported in the tool's documentation to +install it. + +### Steps + +These are the steps to follow to create a new release: + +* Open an issue in the **node-api-headers** repo documenting the intent to +create a new release. Give people some time to comment or suggest PRs that +should land first. + +* Update the version in **package.json** appropriately. + +* Update the [README.md][] to show the latest stable version of Node-API. + +* Generate the changelog for the new version using **changelog maker** tool. +From the root folder of the repo launch the following command: + +```bash +> changelog-maker --format=markdown +``` + +* Use the output generated by **changelog maker** to update the +[CHANGELOG.md][] following the style used in publishing the previous release. + +* Add any new contributors to the "contributors" section in the +**package.json**. + +* Do a clean checkout of `node-api-headers`. + +* Login and then run `npm publish`. + +* Create a release in Github (look at existing releases for an example). + +* Validate that you can run `npm install node-api-headers` successfully +and that the correct version is installed. + +* Comment on the issue opened in the first step that the release has been created +and close the issue. + +* Tweet that the release has been created. + +[README.md]: ./README.md +[CHANGELOG.md]: ./CHANGELOG.md \ No newline at end of file diff --git a/node_modules/node-api-headers/LICENSE b/node_modules/node-api-headers/LICENSE new file mode 100644 index 0000000..a32c171 --- /dev/null +++ b/node_modules/node-api-headers/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Node.js + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/node-api-headers/README.md b/node_modules/node-api-headers/README.md new file mode 100644 index 0000000..68f7356 --- /dev/null +++ b/node_modules/node-api-headers/README.md @@ -0,0 +1,95 @@ +# node-api-headers + +- **[Introduction](#introduction)** +- **[Contributing](CONTRIBUTING.md)** +- **[Code of Conduct](CODE_OF_CONDUCT.md)** +- **[Install](#install)** +- **[API](#api)** +- **[Creating a release](CREATING_A_RELEASE.md)** +- **[Team](#team)** +- **[License](#license)** + + + +## Introduction + +**node-api-headers** contains the header files for the C-based Node-API +provided by Node.js. Node-API is an API for building native addons that +guarantees the ABI (Application Binary Interface) stability across versions +of Node.js (see: [Node-API](https://nodejs.org/dist/latest/docs/api/n-api.html)). + +Node-API headers are in the `include` folder. The Node-APIs that provide +ECMAScript features from native code can be found in `js_native_api_types.h` +and `js_native_api.h`. The APIs defined in these headers are included in +`node_api_types.h` and `node_api.h`. +The headers are structured in this way in order to allow implementations of +Node-API outside of Node.js considering that for those implementations the +Node.js specific APIs may not be applicable. + +**node-api-headers** is also a package published on **npm** that could be used +in a process to compile and build native addons for Node.js. + + + +## Install + +``` +npm i node-api-headers +``` + + + +## Versions + +Node-API C headers are backward-compatible. Its version (e.g. `8`) is released +separately from the Node.js version stream (e.g. `19.8.1`) and changes are +backported to active Node.js LTS lines (e.g. `16.x` and `18.x`). + +This package publishes semver-minor versions with new Node-API C headers changes. +JS API breaking changes are published with new semver-major versions. + + + +## API + +The module exports two properties `include_dir` and `symbols`. + +### `include_dir` + +This property is a string that represents the include path for the Node-API +headers. + +### `def_paths` + +This property is an object that has two keys `js_native_api_def` and +`node_api_def` which represents the path of the module definition file for the +`js_native_api` and `node_api` respectively. + +### `symbols` + +This property is an object that represents the symbols exported by Node-API +grouped by version and api types. + +```js + V1: { + js_native_api_symbols: [ + // List of symbols in js_native_api.h for the version 1. + ], + node_api_symbols: [ + // List of symbols in node_api.h for the version 1 + ] + }, + // ... +``` + + + +## Team members + +The project is maintained by the [Node-API team members](https://github.com/nodejs/abi-stable-node/?tab=readme-ov-file#project-participants). + + + +## License + +Licensed under [MIT](./LICENSE.md) diff --git a/node_modules/node-api-headers/def/js_native_api.def b/node_modules/node-api-headers/def/js_native_api.def new file mode 100644 index 0000000..99a5422 --- /dev/null +++ b/node_modules/node-api-headers/def/js_native_api.def @@ -0,0 +1,125 @@ +NAME NODE.EXE +EXPORTS +napi_adjust_external_memory +napi_call_function +napi_close_escapable_handle_scope +napi_close_handle_scope +napi_coerce_to_bool +napi_coerce_to_number +napi_coerce_to_object +napi_coerce_to_string +napi_create_array +napi_create_array_with_length +napi_create_arraybuffer +napi_create_dataview +napi_create_double +napi_create_error +napi_create_external +napi_create_external_arraybuffer +napi_create_function +napi_create_int32 +napi_create_int64 +napi_create_object +napi_create_promise +napi_create_range_error +napi_create_reference +napi_create_string_latin1 +napi_create_string_utf16 +napi_create_string_utf8 +napi_create_symbol +napi_create_type_error +napi_create_typedarray +napi_create_uint32 +napi_define_class +napi_define_properties +napi_delete_element +napi_delete_property +napi_delete_reference +napi_escape_handle +napi_get_and_clear_last_exception +napi_get_array_length +napi_get_arraybuffer_info +napi_get_boolean +napi_get_cb_info +napi_get_dataview_info +napi_get_element +napi_get_global +napi_get_last_error_info +napi_get_named_property +napi_get_new_target +napi_get_null +napi_get_property +napi_get_property_names +napi_get_prototype +napi_get_reference_value +napi_get_typedarray_info +napi_get_undefined +napi_get_value_bool +napi_get_value_double +napi_get_value_external +napi_get_value_int32 +napi_get_value_int64 +napi_get_value_string_latin1 +napi_get_value_string_utf16 +napi_get_value_string_utf8 +napi_get_value_uint32 +napi_get_version +napi_has_element +napi_has_named_property +napi_has_own_property +napi_has_property +napi_instanceof +napi_is_array +napi_is_arraybuffer +napi_is_dataview +napi_is_error +napi_is_exception_pending +napi_is_promise +napi_is_typedarray +napi_new_instance +napi_open_escapable_handle_scope +napi_open_handle_scope +napi_reference_ref +napi_reference_unref +napi_reject_deferred +napi_remove_wrap +napi_resolve_deferred +napi_run_script +napi_set_element +napi_set_named_property +napi_set_property +napi_strict_equals +napi_throw +napi_throw_error +napi_throw_range_error +napi_throw_type_error +napi_typeof +napi_unwrap +napi_wrap +napi_add_finalizer +napi_create_date +napi_get_date_value +napi_is_date +napi_create_bigint_int64 +napi_create_bigint_uint64 +napi_create_bigint_words +napi_get_all_property_names +napi_get_instance_data +napi_get_value_bigint_int64 +napi_get_value_bigint_uint64 +napi_get_value_bigint_words +napi_set_instance_data +napi_detach_arraybuffer +napi_is_detached_arraybuffer +napi_check_object_type_tag +napi_object_freeze +napi_object_seal +napi_type_tag_object +node_api_create_syntax_error +node_api_symbol_for +node_api_throw_syntax_error +node_api_create_external_string_latin1 +node_api_create_external_string_utf16 +node_api_create_property_key_latin1 +node_api_create_property_key_utf16 +node_api_create_property_key_utf8 \ No newline at end of file diff --git a/node_modules/node-api-headers/def/node_api.def b/node_modules/node-api-headers/def/node_api.def new file mode 100644 index 0000000..1c53ce0 --- /dev/null +++ b/node_modules/node-api-headers/def/node_api.def @@ -0,0 +1,157 @@ +NAME NODE.EXE +EXPORTS +napi_async_destroy +napi_async_init +napi_cancel_async_work +napi_create_async_work +napi_create_buffer +napi_create_buffer_copy +napi_create_external_buffer +napi_delete_async_work +napi_fatal_error +napi_get_buffer_info +napi_get_node_version +napi_is_buffer +napi_make_callback +napi_module_register +napi_queue_async_work +napi_adjust_external_memory +napi_call_function +napi_close_escapable_handle_scope +napi_close_handle_scope +napi_coerce_to_bool +napi_coerce_to_number +napi_coerce_to_object +napi_coerce_to_string +napi_create_array +napi_create_array_with_length +napi_create_arraybuffer +napi_create_dataview +napi_create_double +napi_create_error +napi_create_external +napi_create_external_arraybuffer +napi_create_function +napi_create_int32 +napi_create_int64 +napi_create_object +napi_create_promise +napi_create_range_error +napi_create_reference +napi_create_string_latin1 +napi_create_string_utf16 +napi_create_string_utf8 +napi_create_symbol +napi_create_type_error +napi_create_typedarray +napi_create_uint32 +napi_define_class +napi_define_properties +napi_delete_element +napi_delete_property +napi_delete_reference +napi_escape_handle +napi_get_and_clear_last_exception +napi_get_array_length +napi_get_arraybuffer_info +napi_get_boolean +napi_get_cb_info +napi_get_dataview_info +napi_get_element +napi_get_global +napi_get_last_error_info +napi_get_named_property +napi_get_new_target +napi_get_null +napi_get_property +napi_get_property_names +napi_get_prototype +napi_get_reference_value +napi_get_typedarray_info +napi_get_undefined +napi_get_value_bool +napi_get_value_double +napi_get_value_external +napi_get_value_int32 +napi_get_value_int64 +napi_get_value_string_latin1 +napi_get_value_string_utf16 +napi_get_value_string_utf8 +napi_get_value_uint32 +napi_get_version +napi_has_element +napi_has_named_property +napi_has_own_property +napi_has_property +napi_instanceof +napi_is_array +napi_is_arraybuffer +napi_is_dataview +napi_is_error +napi_is_exception_pending +napi_is_promise +napi_is_typedarray +napi_new_instance +napi_open_escapable_handle_scope +napi_open_handle_scope +napi_reference_ref +napi_reference_unref +napi_reject_deferred +napi_remove_wrap +napi_resolve_deferred +napi_run_script +napi_set_element +napi_set_named_property +napi_set_property +napi_strict_equals +napi_throw +napi_throw_error +napi_throw_range_error +napi_throw_type_error +napi_typeof +napi_unwrap +napi_wrap +napi_get_uv_event_loop +napi_add_env_cleanup_hook +napi_close_callback_scope +napi_fatal_exception +napi_open_callback_scope +napi_remove_env_cleanup_hook +napi_acquire_threadsafe_function +napi_call_threadsafe_function +napi_create_threadsafe_function +napi_get_threadsafe_function_context +napi_ref_threadsafe_function +napi_release_threadsafe_function +napi_unref_threadsafe_function +napi_add_finalizer +napi_create_date +napi_get_date_value +napi_is_date +napi_create_bigint_int64 +napi_create_bigint_uint64 +napi_create_bigint_words +napi_get_all_property_names +napi_get_instance_data +napi_get_value_bigint_int64 +napi_get_value_bigint_uint64 +napi_get_value_bigint_words +napi_set_instance_data +napi_detach_arraybuffer +napi_is_detached_arraybuffer +napi_add_async_cleanup_hook +napi_remove_async_cleanup_hook +napi_check_object_type_tag +napi_object_freeze +napi_object_seal +napi_type_tag_object +node_api_get_module_file_name +node_api_create_syntax_error +node_api_symbol_for +node_api_throw_syntax_error +node_api_create_buffer_from_arraybuffer +node_api_create_external_string_latin1 +node_api_create_external_string_utf16 +node_api_create_property_key_latin1 +node_api_create_property_key_utf16 +node_api_create_property_key_utf8 \ No newline at end of file diff --git a/node_modules/node-api-headers/include/js_native_api.h b/node_modules/node-api-headers/include/js_native_api.h new file mode 100644 index 0000000..8e91d6c --- /dev/null +++ b/node_modules/node-api-headers/include/js_native_api.h @@ -0,0 +1,591 @@ +#ifndef SRC_JS_NATIVE_API_H_ +#define SRC_JS_NATIVE_API_H_ + +// This file needs to be compatible with C compilers. +#include // NOLINT(modernize-deprecated-headers) +#include // NOLINT(modernize-deprecated-headers) + +#include "js_native_api_types.h" + +// If you need __declspec(dllimport), either include instead, or +// define NAPI_EXTERN as __declspec(dllimport) on the compiler's command line. +#ifndef NAPI_EXTERN +#ifdef _WIN32 +#define NAPI_EXTERN __declspec(dllexport) +#elif defined(__wasm__) +#define NAPI_EXTERN \ + __attribute__((visibility("default"))) \ + __attribute__((__import_module__("napi"))) +#else +#define NAPI_EXTERN __attribute__((visibility("default"))) +#endif +#endif + +#define NAPI_AUTO_LENGTH SIZE_MAX + +#ifdef __cplusplus +#define EXTERN_C_START extern "C" { +#define EXTERN_C_END } +#else +#define EXTERN_C_START +#define EXTERN_C_END +#endif + +EXTERN_C_START + +NAPI_EXTERN napi_status NAPI_CDECL napi_get_last_error_info( + node_api_basic_env env, const napi_extended_error_info** result); + +// Getters for defined singletons +NAPI_EXTERN napi_status NAPI_CDECL napi_get_undefined(napi_env env, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_get_null(napi_env env, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_get_global(napi_env env, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_get_boolean(napi_env env, + bool value, + napi_value* result); + +// Methods to create Primitive types/Objects +NAPI_EXTERN napi_status NAPI_CDECL napi_create_object(napi_env env, + napi_value* result); + +NAPI_EXTERN napi_status NAPI_CDECL napi_create_array(napi_env env, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL +napi_create_array_with_length(napi_env env, size_t length, napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_create_double(napi_env env, + double value, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_create_int32(napi_env env, + int32_t value, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_create_uint32(napi_env env, + uint32_t value, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_create_int64(napi_env env, + int64_t value, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_create_string_latin1( + napi_env env, const char* str, size_t length, napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_create_string_utf8(napi_env env, + const char* str, + size_t length, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_create_string_utf16(napi_env env, + const char16_t* str, + size_t length, + napi_value* result); +#if NAPI_VERSION >= 10 +NAPI_EXTERN napi_status NAPI_CDECL node_api_create_external_string_latin1( + napi_env env, + char* str, + size_t length, + node_api_basic_finalize finalize_callback, + void* finalize_hint, + napi_value* result, + bool* copied); +NAPI_EXTERN napi_status NAPI_CDECL +node_api_create_external_string_utf16(napi_env env, + char16_t* str, + size_t length, + node_api_basic_finalize finalize_callback, + void* finalize_hint, + napi_value* result, + bool* copied); + +NAPI_EXTERN napi_status NAPI_CDECL node_api_create_property_key_latin1( + napi_env env, const char* str, size_t length, napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL node_api_create_property_key_utf8( + napi_env env, const char* str, size_t length, napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL node_api_create_property_key_utf16( + napi_env env, const char16_t* str, size_t length, napi_value* result); +#endif // NAPI_VERSION >= 10 + +NAPI_EXTERN napi_status NAPI_CDECL napi_create_symbol(napi_env env, + napi_value description, + napi_value* result); +#if NAPI_VERSION >= 9 +NAPI_EXTERN napi_status NAPI_CDECL +node_api_symbol_for(napi_env env, + const char* utf8description, + size_t length, + napi_value* result); +#endif // NAPI_VERSION >= 9 +NAPI_EXTERN napi_status NAPI_CDECL napi_create_function(napi_env env, + const char* utf8name, + size_t length, + napi_callback cb, + void* data, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_create_error(napi_env env, + napi_value code, + napi_value msg, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_create_type_error(napi_env env, + napi_value code, + napi_value msg, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_create_range_error(napi_env env, + napi_value code, + napi_value msg, + napi_value* result); +#if NAPI_VERSION >= 9 +NAPI_EXTERN napi_status NAPI_CDECL node_api_create_syntax_error( + napi_env env, napi_value code, napi_value msg, napi_value* result); +#endif // NAPI_VERSION >= 9 + +// Methods to get the native napi_value from Primitive type +NAPI_EXTERN napi_status NAPI_CDECL napi_typeof(napi_env env, + napi_value value, + napi_valuetype* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_get_value_double(napi_env env, + napi_value value, + double* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_get_value_int32(napi_env env, + napi_value value, + int32_t* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_get_value_uint32(napi_env env, + napi_value value, + uint32_t* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_get_value_int64(napi_env env, + napi_value value, + int64_t* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_get_value_bool(napi_env env, + napi_value value, + bool* result); + +// Copies LATIN-1 encoded bytes from a string into a buffer. +NAPI_EXTERN napi_status NAPI_CDECL napi_get_value_string_latin1( + napi_env env, napi_value value, char* buf, size_t bufsize, size_t* result); + +// Copies UTF-8 encoded bytes from a string into a buffer. +NAPI_EXTERN napi_status NAPI_CDECL napi_get_value_string_utf8( + napi_env env, napi_value value, char* buf, size_t bufsize, size_t* result); + +// Copies UTF-16 encoded bytes from a string into a buffer. +NAPI_EXTERN napi_status NAPI_CDECL napi_get_value_string_utf16(napi_env env, + napi_value value, + char16_t* buf, + size_t bufsize, + size_t* result); + +// Methods to coerce values +// These APIs may execute user scripts +NAPI_EXTERN napi_status NAPI_CDECL napi_coerce_to_bool(napi_env env, + napi_value value, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_coerce_to_number(napi_env env, + napi_value value, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_coerce_to_object(napi_env env, + napi_value value, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_coerce_to_string(napi_env env, + napi_value value, + napi_value* result); + +// Methods to work with Objects +NAPI_EXTERN napi_status NAPI_CDECL napi_get_prototype(napi_env env, + napi_value object, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_get_property_names(napi_env env, + napi_value object, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_set_property(napi_env env, + napi_value object, + napi_value key, + napi_value value); +NAPI_EXTERN napi_status NAPI_CDECL napi_has_property(napi_env env, + napi_value object, + napi_value key, + bool* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_get_property(napi_env env, + napi_value object, + napi_value key, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_delete_property(napi_env env, + napi_value object, + napi_value key, + bool* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_has_own_property(napi_env env, + napi_value object, + napi_value key, + bool* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_set_named_property(napi_env env, + napi_value object, + const char* utf8name, + napi_value value); +NAPI_EXTERN napi_status NAPI_CDECL napi_has_named_property(napi_env env, + napi_value object, + const char* utf8name, + bool* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_get_named_property(napi_env env, + napi_value object, + const char* utf8name, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_set_element(napi_env env, + napi_value object, + uint32_t index, + napi_value value); +NAPI_EXTERN napi_status NAPI_CDECL napi_has_element(napi_env env, + napi_value object, + uint32_t index, + bool* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_get_element(napi_env env, + napi_value object, + uint32_t index, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_delete_element(napi_env env, + napi_value object, + uint32_t index, + bool* result); +NAPI_EXTERN napi_status NAPI_CDECL +napi_define_properties(napi_env env, + napi_value object, + size_t property_count, + const napi_property_descriptor* properties); + +// Methods to work with Arrays +NAPI_EXTERN napi_status NAPI_CDECL napi_is_array(napi_env env, + napi_value value, + bool* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_get_array_length(napi_env env, + napi_value value, + uint32_t* result); + +// Methods to compare values +NAPI_EXTERN napi_status NAPI_CDECL napi_strict_equals(napi_env env, + napi_value lhs, + napi_value rhs, + bool* result); + +// Methods to work with Functions +NAPI_EXTERN napi_status NAPI_CDECL napi_call_function(napi_env env, + napi_value recv, + napi_value func, + size_t argc, + const napi_value* argv, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_new_instance(napi_env env, + napi_value constructor, + size_t argc, + const napi_value* argv, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_instanceof(napi_env env, + napi_value object, + napi_value constructor, + bool* result); + +// Methods to work with napi_callbacks + +// Gets all callback info in a single call. (Ugly, but faster.) +NAPI_EXTERN napi_status NAPI_CDECL napi_get_cb_info( + napi_env env, // [in] Node-API environment handle + napi_callback_info cbinfo, // [in] Opaque callback-info handle + size_t* argc, // [in-out] Specifies the size of the provided argv array + // and receives the actual count of args. + napi_value* argv, // [out] Array of values + napi_value* this_arg, // [out] Receives the JS 'this' arg for the call + void** data); // [out] Receives the data pointer for the callback. + +NAPI_EXTERN napi_status NAPI_CDECL napi_get_new_target( + napi_env env, napi_callback_info cbinfo, napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL +napi_define_class(napi_env env, + const char* utf8name, + size_t length, + napi_callback constructor, + void* data, + size_t property_count, + const napi_property_descriptor* properties, + napi_value* result); + +// Methods to work with external data objects +NAPI_EXTERN napi_status NAPI_CDECL +napi_wrap(napi_env env, + napi_value js_object, + void* native_object, + node_api_basic_finalize finalize_cb, + void* finalize_hint, + napi_ref* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_unwrap(napi_env env, + napi_value js_object, + void** result); +NAPI_EXTERN napi_status NAPI_CDECL napi_remove_wrap(napi_env env, + napi_value js_object, + void** result); +NAPI_EXTERN napi_status NAPI_CDECL +napi_create_external(napi_env env, + void* data, + node_api_basic_finalize finalize_cb, + void* finalize_hint, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_get_value_external(napi_env env, + napi_value value, + void** result); + +// Methods to control object lifespan + +// Set initial_refcount to 0 for a weak reference, >0 for a strong reference. +NAPI_EXTERN napi_status NAPI_CDECL +napi_create_reference(napi_env env, + napi_value value, + uint32_t initial_refcount, + napi_ref* result); + +// Deletes a reference. The referenced value is released, and may +// be GC'd unless there are other references to it. +NAPI_EXTERN napi_status NAPI_CDECL napi_delete_reference(node_api_basic_env env, + napi_ref ref); + +// Increments the reference count, optionally returning the resulting count. +// After this call the reference will be a strong reference because its +// refcount is >0, and the referenced object is effectively "pinned". +// Calling this when the refcount is 0 and the object is unavailable +// results in an error. +NAPI_EXTERN napi_status NAPI_CDECL napi_reference_ref(napi_env env, + napi_ref ref, + uint32_t* result); + +// Decrements the reference count, optionally returning the resulting count. +// If the result is 0 the reference is now weak and the object may be GC'd +// at any time if there are no other references. Calling this when the +// refcount is already 0 results in an error. +NAPI_EXTERN napi_status NAPI_CDECL napi_reference_unref(napi_env env, + napi_ref ref, + uint32_t* result); + +// Attempts to get a referenced value. If the reference is weak, +// the value might no longer be available, in that case the call +// is still successful but the result is NULL. +NAPI_EXTERN napi_status NAPI_CDECL napi_get_reference_value(napi_env env, + napi_ref ref, + napi_value* result); + +NAPI_EXTERN napi_status NAPI_CDECL +napi_open_handle_scope(napi_env env, napi_handle_scope* result); +NAPI_EXTERN napi_status NAPI_CDECL +napi_close_handle_scope(napi_env env, napi_handle_scope scope); +NAPI_EXTERN napi_status NAPI_CDECL napi_open_escapable_handle_scope( + napi_env env, napi_escapable_handle_scope* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_close_escapable_handle_scope( + napi_env env, napi_escapable_handle_scope scope); + +NAPI_EXTERN napi_status NAPI_CDECL +napi_escape_handle(napi_env env, + napi_escapable_handle_scope scope, + napi_value escapee, + napi_value* result); + +// Methods to support error handling +NAPI_EXTERN napi_status NAPI_CDECL napi_throw(napi_env env, napi_value error); +NAPI_EXTERN napi_status NAPI_CDECL napi_throw_error(napi_env env, + const char* code, + const char* msg); +NAPI_EXTERN napi_status NAPI_CDECL napi_throw_type_error(napi_env env, + const char* code, + const char* msg); +NAPI_EXTERN napi_status NAPI_CDECL napi_throw_range_error(napi_env env, + const char* code, + const char* msg); +#if NAPI_VERSION >= 9 +NAPI_EXTERN napi_status NAPI_CDECL node_api_throw_syntax_error(napi_env env, + const char* code, + const char* msg); +#endif // NAPI_VERSION >= 9 +NAPI_EXTERN napi_status NAPI_CDECL napi_is_error(napi_env env, + napi_value value, + bool* result); + +// Methods to support catching exceptions +NAPI_EXTERN napi_status NAPI_CDECL napi_is_exception_pending(napi_env env, + bool* result); +NAPI_EXTERN napi_status NAPI_CDECL +napi_get_and_clear_last_exception(napi_env env, napi_value* result); + +// Methods to work with array buffers and typed arrays +NAPI_EXTERN napi_status NAPI_CDECL napi_is_arraybuffer(napi_env env, + napi_value value, + bool* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_create_arraybuffer(napi_env env, + size_t byte_length, + void** data, + napi_value* result); +#ifndef NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED +NAPI_EXTERN napi_status NAPI_CDECL +napi_create_external_arraybuffer(napi_env env, + void* external_data, + size_t byte_length, + node_api_basic_finalize finalize_cb, + void* finalize_hint, + napi_value* result); +#endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED +NAPI_EXTERN napi_status NAPI_CDECL napi_get_arraybuffer_info( + napi_env env, napi_value arraybuffer, void** data, size_t* byte_length); +NAPI_EXTERN napi_status NAPI_CDECL napi_is_typedarray(napi_env env, + napi_value value, + bool* result); +NAPI_EXTERN napi_status NAPI_CDECL +napi_create_typedarray(napi_env env, + napi_typedarray_type type, + size_t length, + napi_value arraybuffer, + size_t byte_offset, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL +napi_get_typedarray_info(napi_env env, + napi_value typedarray, + napi_typedarray_type* type, + size_t* length, + void** data, + napi_value* arraybuffer, + size_t* byte_offset); + +NAPI_EXTERN napi_status NAPI_CDECL napi_create_dataview(napi_env env, + size_t length, + napi_value arraybuffer, + size_t byte_offset, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_is_dataview(napi_env env, + napi_value value, + bool* result); +NAPI_EXTERN napi_status NAPI_CDECL +napi_get_dataview_info(napi_env env, + napi_value dataview, + size_t* bytelength, + void** data, + napi_value* arraybuffer, + size_t* byte_offset); + + +// version management +NAPI_EXTERN napi_status NAPI_CDECL napi_get_version(node_api_basic_env env, + uint32_t* result); + +// Promises +NAPI_EXTERN napi_status NAPI_CDECL napi_create_promise(napi_env env, + napi_deferred* deferred, + napi_value* promise); +NAPI_EXTERN napi_status NAPI_CDECL napi_resolve_deferred(napi_env env, + napi_deferred deferred, + napi_value resolution); +NAPI_EXTERN napi_status NAPI_CDECL napi_reject_deferred(napi_env env, + napi_deferred deferred, + napi_value rejection); +NAPI_EXTERN napi_status NAPI_CDECL napi_is_promise(napi_env env, + napi_value value, + bool* is_promise); + +// Running a script +NAPI_EXTERN napi_status NAPI_CDECL napi_run_script(napi_env env, + napi_value script, + napi_value* result); + +// Memory management +NAPI_EXTERN napi_status NAPI_CDECL napi_adjust_external_memory( + node_api_basic_env env, int64_t change_in_bytes, int64_t* adjusted_value); + +#if NAPI_VERSION >= 5 + +// Dates +NAPI_EXTERN napi_status NAPI_CDECL napi_create_date(napi_env env, + double time, + napi_value* result); + +NAPI_EXTERN napi_status NAPI_CDECL napi_is_date(napi_env env, + napi_value value, + bool* is_date); + +NAPI_EXTERN napi_status NAPI_CDECL napi_get_date_value(napi_env env, + napi_value value, + double* result); + +// Add finalizer for pointer +NAPI_EXTERN napi_status NAPI_CDECL +napi_add_finalizer(napi_env env, + napi_value js_object, + void* finalize_data, + node_api_basic_finalize finalize_cb, + void* finalize_hint, + napi_ref* result); + +#endif // NAPI_VERSION >= 5 + + +#if NAPI_VERSION >= 6 + +// BigInt +NAPI_EXTERN napi_status NAPI_CDECL napi_create_bigint_int64(napi_env env, + int64_t value, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL +napi_create_bigint_uint64(napi_env env, uint64_t value, napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL +napi_create_bigint_words(napi_env env, + int sign_bit, + size_t word_count, + const uint64_t* words, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_get_value_bigint_int64(napi_env env, + napi_value value, + int64_t* result, + bool* lossless); +NAPI_EXTERN napi_status NAPI_CDECL napi_get_value_bigint_uint64( + napi_env env, napi_value value, uint64_t* result, bool* lossless); +NAPI_EXTERN napi_status NAPI_CDECL +napi_get_value_bigint_words(napi_env env, + napi_value value, + int* sign_bit, + size_t* word_count, + uint64_t* words); + +// Object +NAPI_EXTERN napi_status NAPI_CDECL +napi_get_all_property_names(napi_env env, + napi_value object, + napi_key_collection_mode key_mode, + napi_key_filter key_filter, + napi_key_conversion key_conversion, + napi_value* result); + +// Instance data +NAPI_EXTERN napi_status NAPI_CDECL +napi_set_instance_data(node_api_basic_env env, + void* data, + napi_finalize finalize_cb, + void* finalize_hint); + +NAPI_EXTERN napi_status NAPI_CDECL +napi_get_instance_data(node_api_basic_env env, void** data); +#endif // NAPI_VERSION >= 6 + +#if NAPI_VERSION >= 7 +// ArrayBuffer detaching +NAPI_EXTERN napi_status NAPI_CDECL +napi_detach_arraybuffer(napi_env env, napi_value arraybuffer); + +NAPI_EXTERN napi_status NAPI_CDECL +napi_is_detached_arraybuffer(napi_env env, napi_value value, bool* result); +#endif // NAPI_VERSION >= 7 + +#if NAPI_VERSION >= 8 +// Type tagging +NAPI_EXTERN napi_status NAPI_CDECL napi_type_tag_object( + napi_env env, napi_value value, const napi_type_tag* type_tag); + +NAPI_EXTERN napi_status NAPI_CDECL +napi_check_object_type_tag(napi_env env, + napi_value value, + const napi_type_tag* type_tag, + bool* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_object_freeze(napi_env env, + napi_value object); +NAPI_EXTERN napi_status NAPI_CDECL napi_object_seal(napi_env env, + napi_value object); +#endif // NAPI_VERSION >= 8 + +EXTERN_C_END + +#endif // SRC_JS_NATIVE_API_H_ diff --git a/node_modules/node-api-headers/include/js_native_api_types.h b/node_modules/node-api-headers/include/js_native_api_types.h new file mode 100644 index 0000000..a5b4663 --- /dev/null +++ b/node_modules/node-api-headers/include/js_native_api_types.h @@ -0,0 +1,210 @@ +#ifndef SRC_JS_NATIVE_API_TYPES_H_ +#define SRC_JS_NATIVE_API_TYPES_H_ + +// Use INT_MAX, this should only be consumed by the pre-processor anyway. +#define NAPI_VERSION_EXPERIMENTAL 2147483647 +#ifndef NAPI_VERSION +// The baseline version for N-API. +// The NAPI_VERSION controls which version will be used by default when +// compilling a native addon. If the addon developer specifically wants to use +// functions available in a new version of N-API that is not yet ported in all +// LTS versions, they can set NAPI_VERSION knowing that they have specifically +// depended on that version. +#define NAPI_VERSION 8 +#endif + + +// This file needs to be compatible with C compilers. +// This is a public include file, and these includes have essentially +// became part of it's API. +#include // NOLINT(modernize-deprecated-headers) +#include // NOLINT(modernize-deprecated-headers) + +#if !defined __cplusplus || (defined(_MSC_VER) && _MSC_VER < 1900) +typedef uint16_t char16_t; +#endif + +#ifndef NAPI_CDECL +#ifdef _WIN32 +#define NAPI_CDECL __cdecl +#else +#define NAPI_CDECL +#endif +#endif + +// JSVM API types are all opaque pointers for ABI stability +// typedef undefined structs instead of void* for compile time type safety +typedef struct napi_env__* napi_env; + +// We need to mark APIs which can be called during garbage collection (GC), +// meaning that they do not affect the state of the JS engine, and can +// therefore be called synchronously from a finalizer that itself runs +// synchronously during GC. Such APIs can receive either a `napi_env` or a +// `node_api_basic_env` as their first parameter, because we should be able to +// also call them during normal, non-garbage-collecting operations, whereas +// APIs that affect the state of the JS engine can only receive a `napi_env` as +// their first parameter, because we must not call them during GC. In lieu of +// inheritance, we use the properties of the const qualifier to accomplish +// this, because both a const and a non-const value can be passed to an API +// expecting a const value, but only a non-const value can be passed to an API +// expecting a non-const value. +// +// In conjunction with appropriate CFLAGS to warn us if we're passing a const +// (basic) environment into an API that expects a non-const environment, and +// the definition of basic finalizer function pointer types below, which +// receive a basic environment as their first parameter, and can thus only call +// basic APIs (unless the user explicitly casts the environment), we achieve +// the ability to ensure at compile time that we do not call APIs that affect +// the state of the JS engine from a synchronous (basic) finalizer. +typedef struct napi_env__* node_api_nogc_env; +typedef node_api_nogc_env node_api_basic_env; + +typedef struct napi_value__* napi_value; +typedef struct napi_ref__* napi_ref; +typedef struct napi_handle_scope__* napi_handle_scope; +typedef struct napi_escapable_handle_scope__* napi_escapable_handle_scope; +typedef struct napi_callback_info__* napi_callback_info; +typedef struct napi_deferred__* napi_deferred; + +typedef enum { + napi_default = 0, + napi_writable = 1 << 0, + napi_enumerable = 1 << 1, + napi_configurable = 1 << 2, + + // Used with napi_define_class to distinguish static properties + // from instance properties. Ignored by napi_define_properties. + napi_static = 1 << 10, + +#if NAPI_VERSION >= 8 + // Default for class methods. + napi_default_method = napi_writable | napi_configurable, + + // Default for object properties, like in JS obj[prop]. + napi_default_jsproperty = napi_writable | napi_enumerable | napi_configurable, +#endif // NAPI_VERSION >= 8 +} napi_property_attributes; + +typedef enum { + // ES6 types (corresponds to typeof) + napi_undefined, + napi_null, + napi_boolean, + napi_number, + napi_string, + napi_symbol, + napi_object, + napi_function, + napi_external, + napi_bigint, +} napi_valuetype; + +typedef enum { + napi_int8_array, + napi_uint8_array, + napi_uint8_clamped_array, + napi_int16_array, + napi_uint16_array, + napi_int32_array, + napi_uint32_array, + napi_float32_array, + napi_float64_array, + napi_bigint64_array, + napi_biguint64_array, +#define NODE_API_HAS_FLOAT16_ARRAY + napi_float16_array, +} napi_typedarray_type; + +typedef enum { + napi_ok, + napi_invalid_arg, + napi_object_expected, + napi_string_expected, + napi_name_expected, + napi_function_expected, + napi_number_expected, + napi_boolean_expected, + napi_array_expected, + napi_generic_failure, + napi_pending_exception, + napi_cancelled, + napi_escape_called_twice, + napi_handle_scope_mismatch, + napi_callback_scope_mismatch, + napi_queue_full, + napi_closing, + napi_bigint_expected, + napi_date_expected, + napi_arraybuffer_expected, + napi_detachable_arraybuffer_expected, + napi_would_deadlock, // unused + napi_no_external_buffers_allowed, + napi_cannot_run_js, +} napi_status; +// Note: when adding a new enum value to `napi_status`, please also update +// * `const int last_status` in the definition of `napi_get_last_error_info()' +// in file js_native_api_v8.cc. +// * `const char* error_messages[]` in file js_native_api_v8.cc with a brief +// message explaining the error. +// * the definition of `napi_status` in doc/api/n-api.md to reflect the newly +// added value(s). + +typedef napi_value(NAPI_CDECL* napi_callback)(napi_env env, + napi_callback_info info); +typedef void(NAPI_CDECL* napi_finalize)(napi_env env, + void* finalize_data, + void* finalize_hint); + +typedef napi_finalize node_api_nogc_finalize; +typedef node_api_nogc_finalize node_api_basic_finalize; + +typedef struct { + // One of utf8name or name should be NULL. + const char* utf8name; + napi_value name; + + napi_callback method; + napi_callback getter; + napi_callback setter; + napi_value value; + + napi_property_attributes attributes; + void* data; +} napi_property_descriptor; + +typedef struct { + const char* error_message; + void* engine_reserved; + uint32_t engine_error_code; + napi_status error_code; +} napi_extended_error_info; + +#if NAPI_VERSION >= 6 +typedef enum { + napi_key_include_prototypes, + napi_key_own_only +} napi_key_collection_mode; + +typedef enum { + napi_key_all_properties = 0, + napi_key_writable = 1, + napi_key_enumerable = 1 << 1, + napi_key_configurable = 1 << 2, + napi_key_skip_strings = 1 << 3, + napi_key_skip_symbols = 1 << 4 +} napi_key_filter; + +typedef enum { + napi_key_keep_numbers, + napi_key_numbers_to_strings +} napi_key_conversion; +#endif // NAPI_VERSION >= 6 + +#if NAPI_VERSION >= 8 +typedef struct { + uint64_t lower; + uint64_t upper; +} napi_type_tag; +#endif // NAPI_VERSION >= 8 + +#endif // SRC_JS_NATIVE_API_TYPES_H_ diff --git a/node_modules/node-api-headers/include/node_api.h b/node_modules/node-api-headers/include/node_api.h new file mode 100644 index 0000000..46dbb02 --- /dev/null +++ b/node_modules/node-api-headers/include/node_api.h @@ -0,0 +1,265 @@ +#ifndef SRC_NODE_API_H_ +#define SRC_NODE_API_H_ + +#if defined(BUILDING_NODE_EXTENSION) && !defined(NAPI_EXTERN) +#ifdef _WIN32 +// Building native addon against node +#define NAPI_EXTERN __declspec(dllimport) +#elif defined(__wasm__) +#define NAPI_EXTERN __attribute__((__import_module__("napi"))) +#endif +#endif +#include "js_native_api.h" +#include "node_api_types.h" + +struct uv_loop_s; // Forward declaration. + +#ifdef _WIN32 +#define NAPI_MODULE_EXPORT __declspec(dllexport) +#else +#ifdef __EMSCRIPTEN__ +#define NAPI_MODULE_EXPORT \ + __attribute__((visibility("default"))) __attribute__((used)) +#else +#define NAPI_MODULE_EXPORT __attribute__((visibility("default"))) +#endif +#endif + +#if defined(__GNUC__) +#define NAPI_NO_RETURN __attribute__((noreturn)) +#elif defined(_WIN32) +#define NAPI_NO_RETURN __declspec(noreturn) +#else +#define NAPI_NO_RETURN +#endif + +// Used by deprecated registration method napi_module_register. +typedef struct napi_module { + int nm_version; + unsigned int nm_flags; + const char* nm_filename; + napi_addon_register_func nm_register_func; + const char* nm_modname; + void* nm_priv; + void* reserved[4]; +} napi_module; + +#define NAPI_MODULE_VERSION 1 + +#define NAPI_MODULE_INITIALIZER_X(base, version) \ + NAPI_MODULE_INITIALIZER_X_HELPER(base, version) +#define NAPI_MODULE_INITIALIZER_X_HELPER(base, version) base##version + +#ifdef __wasm__ +#define NAPI_MODULE_INITIALIZER_BASE napi_register_wasm_v +#else +#define NAPI_MODULE_INITIALIZER_BASE napi_register_module_v +#endif + +#define NODE_API_MODULE_GET_API_VERSION_BASE node_api_module_get_api_version_v + +#define NAPI_MODULE_INITIALIZER \ + NAPI_MODULE_INITIALIZER_X(NAPI_MODULE_INITIALIZER_BASE, NAPI_MODULE_VERSION) + +#define NODE_API_MODULE_GET_API_VERSION \ + NAPI_MODULE_INITIALIZER_X(NODE_API_MODULE_GET_API_VERSION_BASE, \ + NAPI_MODULE_VERSION) + +#define NAPI_MODULE_INIT() \ + EXTERN_C_START \ + NAPI_MODULE_EXPORT int32_t NODE_API_MODULE_GET_API_VERSION(void) { \ + return NAPI_VERSION; \ + } \ + NAPI_MODULE_EXPORT napi_value NAPI_MODULE_INITIALIZER(napi_env env, \ + napi_value exports); \ + EXTERN_C_END \ + napi_value NAPI_MODULE_INITIALIZER(napi_env env, napi_value exports) + +#define NAPI_MODULE(modname, regfunc) \ + NAPI_MODULE_INIT() { return regfunc(env, exports); } + +// Deprecated. Use NAPI_MODULE. +#define NAPI_MODULE_X(modname, regfunc, priv, flags) \ + NAPI_MODULE(modname, regfunc) + +EXTERN_C_START + +// Deprecated. Replaced by symbol-based registration defined by NAPI_MODULE +// and NAPI_MODULE_INIT macros. +NAPI_EXTERN void NAPI_CDECL +napi_module_register(napi_module* mod); + +NAPI_EXTERN NAPI_NO_RETURN void NAPI_CDECL +napi_fatal_error(const char* location, + size_t location_len, + const char* message, + size_t message_len); + +// Methods for custom handling of async operations +NAPI_EXTERN napi_status NAPI_CDECL +napi_async_init(napi_env env, + napi_value async_resource, + napi_value async_resource_name, + napi_async_context* result); + +NAPI_EXTERN napi_status NAPI_CDECL +napi_async_destroy(napi_env env, napi_async_context async_context); + +NAPI_EXTERN napi_status NAPI_CDECL +napi_make_callback(napi_env env, + napi_async_context async_context, + napi_value recv, + napi_value func, + size_t argc, + const napi_value* argv, + napi_value* result); + +// Methods to provide node::Buffer functionality with napi types +NAPI_EXTERN napi_status NAPI_CDECL napi_create_buffer(napi_env env, + size_t length, + void** data, + napi_value* result); +#ifndef NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED +NAPI_EXTERN napi_status NAPI_CDECL +napi_create_external_buffer(napi_env env, + size_t length, + void* data, + node_api_basic_finalize finalize_cb, + void* finalize_hint, + napi_value* result); +#endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED + +#if NAPI_VERSION >= 10 + +NAPI_EXTERN napi_status NAPI_CDECL +node_api_create_buffer_from_arraybuffer(napi_env env, + napi_value arraybuffer, + size_t byte_offset, + size_t byte_length, + napi_value* result); +#endif // NAPI_VERSION >= 10 + +NAPI_EXTERN napi_status NAPI_CDECL napi_create_buffer_copy(napi_env env, + size_t length, + const void* data, + void** result_data, + napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_is_buffer(napi_env env, + napi_value value, + bool* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_get_buffer_info(napi_env env, + napi_value value, + void** data, + size_t* length); + +// Methods to manage simple async operations +NAPI_EXTERN napi_status NAPI_CDECL +napi_create_async_work(napi_env env, + napi_value async_resource, + napi_value async_resource_name, + napi_async_execute_callback execute, + napi_async_complete_callback complete, + void* data, + napi_async_work* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_delete_async_work(napi_env env, + napi_async_work work); +NAPI_EXTERN napi_status NAPI_CDECL napi_queue_async_work(node_api_basic_env env, + napi_async_work work); +NAPI_EXTERN napi_status NAPI_CDECL +napi_cancel_async_work(node_api_basic_env env, napi_async_work work); + +// version management +NAPI_EXTERN napi_status NAPI_CDECL napi_get_node_version( + node_api_basic_env env, const napi_node_version** version); + +#if NAPI_VERSION >= 2 + +// Return the current libuv event loop for a given environment +NAPI_EXTERN napi_status NAPI_CDECL +napi_get_uv_event_loop(node_api_basic_env env, struct uv_loop_s** loop); + +#endif // NAPI_VERSION >= 2 + +#if NAPI_VERSION >= 3 + +NAPI_EXTERN napi_status NAPI_CDECL napi_fatal_exception(napi_env env, + napi_value err); + +NAPI_EXTERN napi_status NAPI_CDECL napi_add_env_cleanup_hook( + node_api_basic_env env, napi_cleanup_hook fun, void* arg); + +NAPI_EXTERN napi_status NAPI_CDECL napi_remove_env_cleanup_hook( + node_api_basic_env env, napi_cleanup_hook fun, void* arg); + +NAPI_EXTERN napi_status NAPI_CDECL +napi_open_callback_scope(napi_env env, + napi_value resource_object, + napi_async_context context, + napi_callback_scope* result); + +NAPI_EXTERN napi_status NAPI_CDECL +napi_close_callback_scope(napi_env env, napi_callback_scope scope); + +#endif // NAPI_VERSION >= 3 + +#if NAPI_VERSION >= 4 + +// Calling into JS from other threads +NAPI_EXTERN napi_status NAPI_CDECL +napi_create_threadsafe_function(napi_env env, + napi_value func, + napi_value async_resource, + napi_value async_resource_name, + size_t max_queue_size, + size_t initial_thread_count, + void* thread_finalize_data, + napi_finalize thread_finalize_cb, + void* context, + napi_threadsafe_function_call_js call_js_cb, + napi_threadsafe_function* result); + +NAPI_EXTERN napi_status NAPI_CDECL napi_get_threadsafe_function_context( + napi_threadsafe_function func, void** result); + +NAPI_EXTERN napi_status NAPI_CDECL +napi_call_threadsafe_function(napi_threadsafe_function func, + void* data, + napi_threadsafe_function_call_mode is_blocking); + +NAPI_EXTERN napi_status NAPI_CDECL +napi_acquire_threadsafe_function(napi_threadsafe_function func); + +NAPI_EXTERN napi_status NAPI_CDECL napi_release_threadsafe_function( + napi_threadsafe_function func, napi_threadsafe_function_release_mode mode); + +NAPI_EXTERN napi_status NAPI_CDECL napi_unref_threadsafe_function( + node_api_basic_env env, napi_threadsafe_function func); + +NAPI_EXTERN napi_status NAPI_CDECL napi_ref_threadsafe_function( + node_api_basic_env env, napi_threadsafe_function func); + +#endif // NAPI_VERSION >= 4 + +#if NAPI_VERSION >= 8 + +NAPI_EXTERN napi_status NAPI_CDECL +napi_add_async_cleanup_hook(node_api_basic_env env, + napi_async_cleanup_hook hook, + void* arg, + napi_async_cleanup_hook_handle* remove_handle); + +NAPI_EXTERN napi_status NAPI_CDECL +napi_remove_async_cleanup_hook(napi_async_cleanup_hook_handle remove_handle); + +#endif // NAPI_VERSION >= 8 + +#if NAPI_VERSION >= 9 + +NAPI_EXTERN napi_status NAPI_CDECL +node_api_get_module_file_name(node_api_basic_env env, const char** result); + +#endif // NAPI_VERSION >= 9 + +EXTERN_C_END + +#endif // SRC_NODE_API_H_ diff --git a/node_modules/node-api-headers/include/node_api_types.h b/node_modules/node-api-headers/include/node_api_types.h new file mode 100644 index 0000000..79123f0 --- /dev/null +++ b/node_modules/node-api-headers/include/node_api_types.h @@ -0,0 +1,58 @@ +#ifndef SRC_NODE_API_TYPES_H_ +#define SRC_NODE_API_TYPES_H_ + +#include "js_native_api_types.h" + +typedef napi_value(NAPI_CDECL* napi_addon_register_func)(napi_env env, + napi_value exports); +// False positive: https://github.com/cpplint/cpplint/issues/409 +// NOLINTNEXTLINE (readability/casting) +typedef int32_t(NAPI_CDECL* node_api_addon_get_api_version_func)(void); + +typedef struct napi_callback_scope__* napi_callback_scope; +typedef struct napi_async_context__* napi_async_context; +typedef struct napi_async_work__* napi_async_work; + +#if NAPI_VERSION >= 3 +typedef void(NAPI_CDECL* napi_cleanup_hook)(void* arg); +#endif // NAPI_VERSION >= 3 + +#if NAPI_VERSION >= 4 +typedef struct napi_threadsafe_function__* napi_threadsafe_function; +#endif // NAPI_VERSION >= 4 + +#if NAPI_VERSION >= 4 +typedef enum { + napi_tsfn_release, + napi_tsfn_abort +} napi_threadsafe_function_release_mode; + +typedef enum { + napi_tsfn_nonblocking, + napi_tsfn_blocking +} napi_threadsafe_function_call_mode; +#endif // NAPI_VERSION >= 4 + +typedef void(NAPI_CDECL* napi_async_execute_callback)(napi_env env, void* data); +typedef void(NAPI_CDECL* napi_async_complete_callback)(napi_env env, + napi_status status, + void* data); +#if NAPI_VERSION >= 4 +typedef void(NAPI_CDECL* napi_threadsafe_function_call_js)( + napi_env env, napi_value js_callback, void* context, void* data); +#endif // NAPI_VERSION >= 4 + +typedef struct { + uint32_t major; + uint32_t minor; + uint32_t patch; + const char* release; +} napi_node_version; + +#if NAPI_VERSION >= 8 +typedef struct napi_async_cleanup_hook_handle__* napi_async_cleanup_hook_handle; +typedef void(NAPI_CDECL* napi_async_cleanup_hook)( + napi_async_cleanup_hook_handle handle, void* data); +#endif // NAPI_VERSION >= 8 + +#endif // SRC_NODE_API_TYPES_H_ diff --git a/node_modules/node-api-headers/index.js b/node_modules/node-api-headers/index.js new file mode 100644 index 0000000..d9123bb --- /dev/null +++ b/node_modules/node-api-headers/index.js @@ -0,0 +1,17 @@ +'use strict' + +const path = require('path'); +const symbols = require('./symbols'); + +const include_dir = path.resolve(__dirname, 'include'); +const defRoot = path.resolve(__dirname, 'def') +const def_paths = { + js_native_api_def: path.join(defRoot, 'js_native_api.def'), + node_api_def: path.join(defRoot, 'node_api.def') +} + +module.exports = { + include_dir, + def_paths, + symbols +} diff --git a/node_modules/node-api-headers/lib/clang-utils.js b/node_modules/node-api-headers/lib/clang-utils.js new file mode 100644 index 0000000..2f2b032 --- /dev/null +++ b/node_modules/node-api-headers/lib/clang-utils.js @@ -0,0 +1,50 @@ +'use strict'; + +const { spawn } = require('child_process'); + +/** + * @param {Array} [args] + * @returns {Promise<{exitCode: number | null, stdout: string, stderr: string}>} + */ +async function runClang(args = []) { + try { + const { exitCode, stdout, stderr } = await new Promise((resolve, reject) => { + const spawned = spawn('clang', + ['-Xclang', ...args] + ); + + let stdout = ''; + let stderr = ''; + + spawned.stdout?.on('data', (data) => { + stdout += data.toString('utf-8'); + }); + spawned.stderr?.on('data', (data) => { + stderr += data.toString('utf-8'); + }); + + spawned.on('exit', function (exitCode) { + resolve({ exitCode, stdout, stderr }); + }); + + spawned.on('error', function (err) { + reject(err); + }); + }); + + if (exitCode !== 0) { + throw new Error(`clang exited with non-zero exit code ${exitCode}. stderr: ${stderr ? stderr : ''}`); + } + + return { exitCode, stdout, stderr }; + } catch (err) { + if (err.code === 'ENOENT') { + throw new Error('This tool requires clang to be installed.'); + } + throw err; + } +} + +module.exports = { + runClang +}; diff --git a/node_modules/node-api-headers/lib/parse-utils.js b/node_modules/node-api-headers/lib/parse-utils.js new file mode 100644 index 0000000..7b2e755 --- /dev/null +++ b/node_modules/node-api-headers/lib/parse-utils.js @@ -0,0 +1,92 @@ +const parser = require("acorn"); + +/** + * @param {string} text Code to evaluate + * @returns {boolean | undefined} The result of the evaluation, `undefined` if + * parsing failed or the result is unknown. + */ +function evaluate(text) { + try { + const ast = parser.parse(text, { ecmaVersion: 2020 }); + + const expressionStatement = ast.body[0]; + + if (expressionStatement.type !== "ExpressionStatement") { + throw new Error("Expected an ExpressionStatement"); + } + + return visitExpression(expressionStatement.expression); + } catch { + // Return an unknown result if parsing failed + return undefined; + } +} + +/** + * @param {import("acorn").Expression} node + */ +const visitExpression = (node) => { + if (node.type === "LogicalExpression") { + return visitLogicalExpression(node); + } else if (node.type === "UnaryExpression") { + return visitUnaryExpression(node); + } else if (node.type === "CallExpression") { + return visitCallExpression(node); + } else { + throw new Error(`Unknown node type: ${node.type} ${JSON.stringify(node)}`); + } +}; + +/** + * @param {import("acorn").LogicalExpression} node + */ +const visitLogicalExpression = (node) => { + const left = visitExpression(node.left); + const right = visitExpression(node.right); + + if (node.operator === "&&") { + // We can shortcircuit regardless of `unknown` if either are false. + if (left === false || right === false) { + return false; + } else if (left === undefined || right === undefined) { + return undefined; + } else { + return left && right; + } + } else if (node.operator === "||") { + if (left === undefined || right === undefined) { + return undefined; + } else { + return left || right; + } + } +}; + +/** + * @param {import("acorn").UnaryExpression} node + */ +const visitUnaryExpression = (node) => { + const argument = visitExpression(node.argument); + if (typeof argument === 'boolean') { + return !argument; + } +}; + +/** + * @param {import("acorn").CallExpression} node + */ +const visitCallExpression = (node) => { + const isDefinedExperimentalCall = + // is `defined(arg)` call + node.callee.type === 'Identifier' && node.callee.name === 'defined' && node.arguments.length == 1 + // and that arg is `NAPI_EXPERIMENTAL` + && node.arguments[0].type === 'Identifier' && node.arguments[0].name === 'NAPI_EXPERIMENTAL'; + + if (isDefinedExperimentalCall) { + return false; + } +}; + +module.exports = { + evaluate +}; diff --git a/node_modules/node-api-headers/package.json b/node_modules/node-api-headers/package.json new file mode 100644 index 0000000..936b8b5 --- /dev/null +++ b/node_modules/node-api-headers/package.json @@ -0,0 +1,59 @@ +{ + "bugs": { + "url": "https://github.com/nodejs/node-api-headers/issues" + }, + "contributors": [ + { + "name": "Gabriel Schulhof", + "url": "https://github.com/gabrielschulhof" + }, + { + "name": "Jim Schlight", + "url": "https://github.com/jschlight" + }, + { + "name": "Kevin Eady", + "url": "https://github.com/KevinEady" + }, + { + "name": "legendecas", + "url": "https://github.com/legendecas" + }, + { + "name": "Leonid Pospelov", + "url": "https://github.com/Pospelove" + }, + { + "name": "Michael Dawson", + "url": "https://github.com/mhdawson" + }, + { + "name": "Nicola Del Gobbo", + "url": "https://github.com/NickNaso" + } + ], + "description": "Node-API headers", + "devDependencies": { + "acorn": "^8.12.1" + }, + "directories": {}, + "gypfile": false, + "homepage": "https://github.com/nodejs/node-api-headers", + "keywords": [], + "license": "MIT", + "main": "index.js", + "name": "node-api-headers", + "readme": "README.md", + "repository": { + "type": "git", + "url": "git://github.com/nodejs/node-api-headers.git" + }, + "scripts": { + "update-headers": "node --no-warnings scripts/update-headers.js", + "write-symbols": "node --no-warnings scripts/write-symbols.js", + "write-win32-def": "node --no-warnings scripts/write-win32-def.js", + "test": "node test/parse-utils.js " + }, + "version": "1.8.0", + "support": true +} diff --git a/node_modules/node-api-headers/release-please-config.json b/node_modules/node-api-headers/release-please-config.json new file mode 100644 index 0000000..77c3645 --- /dev/null +++ b/node_modules/node-api-headers/release-please-config.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "release-type": "node", + "pull-request-title-pattern": "chore: release v${version}", + "bootstrap-sha": "9d78c7da25c5f90617600e23d2a8e7a23288f1ae", + "packages": { + ".": { + "include-component-in-tag": false, + "changelog-path": "CHANGELOG.md" + } + } +} diff --git a/node_modules/node-api-headers/symbols.js b/node_modules/node-api-headers/symbols.js new file mode 100644 index 0000000..3cf6b4e --- /dev/null +++ b/node_modules/node-api-headers/symbols.js @@ -0,0 +1,257 @@ +'use strict' + +const v1 = { + js_native_api_symbols: [ + 'napi_adjust_external_memory', + 'napi_call_function', + 'napi_close_escapable_handle_scope', + 'napi_close_handle_scope', + 'napi_coerce_to_bool', + 'napi_coerce_to_number', + 'napi_coerce_to_object', + 'napi_coerce_to_string', + 'napi_create_array', + 'napi_create_array_with_length', + 'napi_create_arraybuffer', + 'napi_create_dataview', + 'napi_create_double', + 'napi_create_error', + 'napi_create_external', + 'napi_create_external_arraybuffer', + 'napi_create_function', + 'napi_create_int32', + 'napi_create_int64', + 'napi_create_object', + 'napi_create_promise', + 'napi_create_range_error', + 'napi_create_reference', + 'napi_create_string_latin1', + 'napi_create_string_utf16', + 'napi_create_string_utf8', + 'napi_create_symbol', + 'napi_create_type_error', + 'napi_create_typedarray', + 'napi_create_uint32', + 'napi_define_class', + 'napi_define_properties', + 'napi_delete_element', + 'napi_delete_property', + 'napi_delete_reference', + 'napi_escape_handle', + 'napi_get_and_clear_last_exception', + 'napi_get_array_length', + 'napi_get_arraybuffer_info', + 'napi_get_boolean', + 'napi_get_cb_info', + 'napi_get_dataview_info', + 'napi_get_element', + 'napi_get_global', + 'napi_get_last_error_info', + 'napi_get_named_property', + 'napi_get_new_target', + 'napi_get_null', + 'napi_get_property', + 'napi_get_property_names', + 'napi_get_prototype', + 'napi_get_reference_value', + 'napi_get_typedarray_info', + 'napi_get_undefined', + 'napi_get_value_bool', + 'napi_get_value_double', + 'napi_get_value_external', + 'napi_get_value_int32', + 'napi_get_value_int64', + 'napi_get_value_string_latin1', + 'napi_get_value_string_utf16', + 'napi_get_value_string_utf8', + 'napi_get_value_uint32', + 'napi_get_version', + 'napi_has_element', + 'napi_has_named_property', + 'napi_has_own_property', + 'napi_has_property', + 'napi_instanceof', + 'napi_is_array', + 'napi_is_arraybuffer', + 'napi_is_dataview', + 'napi_is_error', + 'napi_is_exception_pending', + 'napi_is_promise', + 'napi_is_typedarray', + 'napi_new_instance', + 'napi_open_escapable_handle_scope', + 'napi_open_handle_scope', + 'napi_reference_ref', + 'napi_reference_unref', + 'napi_reject_deferred', + 'napi_remove_wrap', + 'napi_resolve_deferred', + 'napi_run_script', + 'napi_set_element', + 'napi_set_named_property', + 'napi_set_property', + 'napi_strict_equals', + 'napi_throw', + 'napi_throw_error', + 'napi_throw_range_error', + 'napi_throw_type_error', + 'napi_typeof', + 'napi_unwrap', + 'napi_wrap' + ], + node_api_symbols: [ + 'napi_async_destroy', + 'napi_async_init', + 'napi_cancel_async_work', + 'napi_create_async_work', + 'napi_create_buffer', + 'napi_create_buffer_copy', + 'napi_create_external_buffer', + 'napi_delete_async_work', + 'napi_fatal_error', + 'napi_get_buffer_info', + 'napi_get_node_version', + 'napi_is_buffer', + 'napi_make_callback', + 'napi_module_register', + 'napi_queue_async_work' + ] +} + +const v2 = { + js_native_api_symbols: [ + ...v1.js_native_api_symbols + ], + node_api_symbols: [ + ...v1.node_api_symbols, + 'napi_get_uv_event_loop' + ] +} + +const v3 = { + js_native_api_symbols: [ + ...v2.js_native_api_symbols + ], + node_api_symbols: [ + ...v2.node_api_symbols, + 'napi_add_env_cleanup_hook', + 'napi_close_callback_scope', + 'napi_fatal_exception', + 'napi_open_callback_scope', + 'napi_remove_env_cleanup_hook' + ] +} + +const v4 = { + js_native_api_symbols: [ + ...v3.js_native_api_symbols + ], + node_api_symbols: [ + ...v3.node_api_symbols, + 'napi_acquire_threadsafe_function', + 'napi_call_threadsafe_function', + 'napi_create_threadsafe_function', + 'napi_get_threadsafe_function_context', + 'napi_ref_threadsafe_function', + 'napi_release_threadsafe_function', + 'napi_unref_threadsafe_function' + ] +} + +const v5 = { + js_native_api_symbols: [ + ...v4.js_native_api_symbols, + 'napi_add_finalizer', + 'napi_create_date', + 'napi_get_date_value', + 'napi_is_date' + ], + node_api_symbols: [ + ...v4.node_api_symbols + ] +} + +const v6 = { + js_native_api_symbols: [ + ...v5.js_native_api_symbols, + 'napi_create_bigint_int64', + 'napi_create_bigint_uint64', + 'napi_create_bigint_words', + 'napi_get_all_property_names', + 'napi_get_instance_data', + 'napi_get_value_bigint_int64', + 'napi_get_value_bigint_uint64', + 'napi_get_value_bigint_words', + 'napi_set_instance_data' + ], + node_api_symbols: [ + ...v5.node_api_symbols + ] +} + +const v7 = { + js_native_api_symbols: [ + ...v6.js_native_api_symbols, + 'napi_detach_arraybuffer', + 'napi_is_detached_arraybuffer' + ], + node_api_symbols: [ + ...v6.node_api_symbols + ] +} + +const v8 = { + js_native_api_symbols: [ + ...v7.js_native_api_symbols, + 'napi_check_object_type_tag', + 'napi_object_freeze', + 'napi_object_seal', + 'napi_type_tag_object' + ], + node_api_symbols: [ + ...v7.node_api_symbols, + 'napi_add_async_cleanup_hook', + 'napi_remove_async_cleanup_hook' + ] +} + +const v9 = { + js_native_api_symbols: [ + ...v8.js_native_api_symbols, + 'node_api_create_syntax_error', + 'node_api_symbol_for', + 'node_api_throw_syntax_error' + ], + node_api_symbols: [ + ...v8.node_api_symbols, + 'node_api_get_module_file_name' + ] +} + +const v10 = { + js_native_api_symbols: [ + ...v9.js_native_api_symbols, + 'node_api_create_external_string_latin1', + 'node_api_create_external_string_utf16', + 'node_api_create_property_key_latin1', + 'node_api_create_property_key_utf16', + 'node_api_create_property_key_utf8' + ], + node_api_symbols: [ + ...v9.node_api_symbols, + 'node_api_create_buffer_from_arraybuffer' + ] +} + +module.exports = { + v1, + v2, + v3, + v4, + v5, + v6, + v7, + v8, + v9, + v10 +} diff --git a/node_modules/node-api-headers/test/parse-utils.js b/node_modules/node-api-headers/test/parse-utils.js new file mode 100644 index 0000000..e11b57f --- /dev/null +++ b/node_modules/node-api-headers/test/parse-utils.js @@ -0,0 +1,21 @@ +const test = require('node:test'); +const assert = require('node:assert'); +const { evaluate } = require("../lib/parse-utils"); + +/** @type {Array<[string, boolean | undefined]>} */ +const testCases = [ + [`defined(NAPI_EXPERIMENTAL)`, false], + [`!defined(NAPI_EXPERIMENTAL)`, true], + [`defined(NAPI_EXPERIMENTAL) || defined(NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT)`, undefined], + [`defined(NAPI_EXPERIMENTAL) && defined(NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT)`, false], + [`!defined(NAPI_EXPERIMENTAL) || (defined(NAPI_EXPERIMENTAL) && (defined(NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT) || defined(NODE_API_EXPERIMENTAL_BASIC_ENV_OPT_OUT)))`, true], + [`NAPI_VERSION >= 9`, undefined], + [`!defined __cplusplus || (defined(_MSC_VER) && _MSC_VER < 1900)`, undefined], // parser error on `defined __cplusplus` +]; + +for (const [text, expected] of testCases) { + test(`${text} -> ${expected}`, (t) => { + const result = evaluate(text); + assert.strictEqual(result, expected); + }); +} diff --git a/node_modules/node-hid/LICENSE-bsd.txt b/node_modules/node-hid/LICENSE-bsd.txt new file mode 100644 index 0000000..b2f9e21 --- /dev/null +++ b/node_modules/node-hid/LICENSE-bsd.txt @@ -0,0 +1,27 @@ + +Copyright Hans Huebner and contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Signal 11 Software nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/node-hid/README.md b/node_modules/node-hid/README.md new file mode 100644 index 0000000..875525c --- /dev/null +++ b/node_modules/node-hid/README.md @@ -0,0 +1,804 @@ +# node-hid - Access USB HID devices from Node.js + +[![npm](https://img.shields.io/npm/dm/node-hid.svg?maxAge=2592000)](http://npmjs.com/package/node-hid) +[![Prebuild](https://github.com/node-hid/node-hid/actions/workflows/build.yml/badge.svg)](https://github.com/node-hid/node-hid/actions/workflows/build.yml) + +- [node-hid - Access USB HID devices from Node.js](#node-hid---access-usb-hid-devices-from-nodejs) + - [Platform Support](#platform-support) + - [Supported Platforms](#supported-platforms) + - [Supported Node versions](#supported-node-versions) + - [Supported Electron versions](#supported-electron-versions) + - [Installation](#installation) + - [Installation Special Cases](#installation-special-cases) + - [Examples](#examples) + - [Async API Usage](#async-api-usage) + - [Sync API Usage](#sync-api-usage) + - [Complete Async API](#complete-async-api) + - [Complete Sync API](#complete-sync-api) + - [General notes:](#general-notes) + - [Thread safety, Worker threads, Context-aware modules](#thread-safety-worker-threads-context-aware-modules) + - [Devices node-hid cannot read](#devices-node-hid-cannot-read) + - [Mac notes](#mac-notes) + - [Windows notes](#windows-notes) + - [Xbox 360 Controller on Windows 10](#xbox-360-controller-on-windows-10) + - [Linux notes](#linux-notes) + - [udev device permissions](#udev-device-permissions) + - [Selecting driver type](#selecting-driver-type) + - [Compiling from source](#compiling-from-source) + - [Linux (kernel 2.6 ) : (install examples shown for Debian/Ubuntu)](#linux-kernel-26--install-examples-shown-for-debianubuntu) + - [FreeBSD](#freebsd) + - [Mac OS X 10.8 ](#mac-os-x-108) + - [Windows 7, 8, 10](#windows-7-8-10) + - [Building node-hid from source, for your projects](#building-node-hid-from-source-for-your-projects) + - [Build node-hid for node-hid development](#build-node-hid-for-node-hid-development) + - [Building node-hid for cross-compiling](#building-node-hid-for-cross-compiling) + - [Electron projects using node-hid](#electron-projects-using-node-hid) + - [NW.js projects using node-hid](#nwjs-projects-using-node-hid) + - [Support](#support) + +## Platform Support + +`node-hid` currently supports Node.js v10 and upwards. For versions before that, you will need to use an older version. +The platforms, architectures and node versions `node-hid` supports are the following. +In general we try to provide pre-built native library binaries for the most common platforms, Node and Electron versions. + +We strive to make `node-hid` cross-platform so there's a good chance any +combination not listed here will compile and work. + +### Supported Platforms + +- Windows x86 (32-bit) +- Windows x64 (64-bit) +- Mac OSX 10.9+ +- Linux x64 (²) +- Linux x86 (¹) +- Linux ARM / Raspberry Pi / Various SBC (²) +- Linux ARM64 / Various SBC (²) +- Linux MIPSel (¹) +- Linux PPC64 (¹) + +¹ prebuilt-binaries not provided for these platforms +² prebuilt binary built on Debian 10 Buster + +### Supported Node versions + +- Node v10 to +- Node v20 + +### Supported Electron versions + +- Electron v3 to +- Electron v24 + +Future versions of Node or Electron should work with no extra work, since `node-hid` is now based on NAPI. + +## Installation + +For most "standard" use cases (macOS, Windows, Linux x86), `node-hid` will install like a standard npm package: + +``` +npm install node-hid +``` + +If you install globally, the test program `src/show-devices.js` is installed as `hid-showdevices`. On Linux you can use it to try the difference between `hidraw` and `libusb` driverTypes: + +``` +$ npm install -g node-hid +$ hid-showdevices libusb +$ hid-showdevices hidraw +``` + +### Installation Special Cases + +We are using [prebuild](https://github.com/mafintosh/prebuild) to compile and post binaries of the library for most common use cases (Linux, MacOS, Windows on standard processor platforms). If a prebuild is not available, `node-hid` will work, but `npm install node-hid` will compile the binary when you install. For more details on compiler setup, see [Compling from source](#compiling-from-source) below. + +## Examples + +In the `src/` directory, various JavaScript programs can be found +that talk to specific devices in some way. Some interesting ones: + +- [`show-devices.js`](./src/show-devices.js) - display all HID devices in the system +- [`test-ps3-rumbleled.js`](./src/test-ps3-rumbleled.js) - Read PS3 joystick and control its LED & rumblers +- [`test-powermate.js`](./src/test-powermate.js) - Read Griffin PowerMate knob and change its LED +- [`test-blink1.js`](./src/test-blink1.js) - Fade colors on blink(1) RGB LED +- [`test-bigredbutton.js`](./src/test-bigredbutton.js) - Read Dreamcheeky Big Red Button +- [`test-teensyrawhid.js`](./src/test-teensyrawhid.js) - Read/write Teensy running RawHID "Basic" Arduino sketch + +To try them out, run them with `node src/showdevices.js` from within the node-hid directory. + +--- + +## Async vs sync API + +Since 3.0.0, `node-hid` supports both the old synchronous api, and a newer async api. +It is recommended to use the async api to avoid `node-hid` from blocking your code from executing. For prototyping or tiny applications, this likely will not matter, but for npm libraries or larger applications it can be problematic. + +Additionally, the sync api is limited to only beind able to read up to the `UV_THREADPOOL_SIZE` (default is 4) number of devices at once. Reading from multiple could degrade performance of your application, as there will be fewer than expected uv workers available for nodejs and other libraries to use for other tasks. + +The async API is identical to the sync API described below, except every method returns a `Promise` that must be handled. Any unhandled promise can crash your application. + +It is safe to use the sync api for some devices in an application, and the async api for other devices. The thread safety of `hidapi` is handled for you here to avoid crashes. + +## Cost of `HID.devices()`, `HID.devicesAsync()`, `new HID.HID()` and `HIDAsync.open()` for detecting device plug/unplug + +All of `HID.devices()`, `HID.devicesAsync()`, `new HID.HID()` and `HIDAsync.open()` are relatively costly, each causing a USB (and potentially Bluetooth) enumeration. This takes time and OS resources. Doing either can slow down the read/write that you do in parallel with a device, and cause other USB devices to slow down too. This is how USB works. + +If you are polling `HID.devices()` or `HID.devicesAsync()` or other inefficient methods to detect device plug / unplug, consider instead using [node-usb](https://github.com/node-usb/node-usb#usbdetection). `node-usb` uses OS-specific, non-bus enumeration ways to detect device plug / unplug. + +## Async API Usage + +### List all HID devices connected + +```js +var HID = require("node-hid"); +var devices = await HID.devicesAsync(); +``` + +`devices` will contain an array of objects, one for each HID device +available. Of particular interest are the `vendorId` and +`productId`, as they uniquely identify a device, and the +`path`, which is needed to open a particular device. + +Sample output: + +```js +await HID.devicesAsync(); +{ vendorId: 10168, + productId: 493, + path: 'IOService:/AppleACPIPl...HIDDevice@14210000,0', + serialNumber: '20002E8C', + manufacturer: 'ThingM', + product: 'blink(1) mk2', + release: 2, + interface: -1, + usagePage: 65280, + usage: 1 }, + { vendorId: 1452, + productId: 610, + path: 'IOService:/AppleACPIPl...Keyboard@14400000,0', + serialNumber: '', + manufacturer: 'Apple Inc.', + product: 'Apple Internal Keyboard / Trackpad', + release: 549, + interface: -1, + usagePage: 1, + usage: 6 }, + +``` + +### Opening a device + +Before a device can be read from or written to, it must be opened. +Use either the `path` from the list returned by a prior call to `HID.devicesAsync()`: + +```js +var device = await HID.HIDAsync.open(path); +``` + +or open the first device matching a VID/PID pair: + +```js +var device = await HID.HIDAsync.open(vid, pid); +``` + +**On MacOs** if set to true the `nonExclusive` property allows the device to be opened in non-exclusive mode. +For the other plaforms the flag has no impact. +If the flag is not set the behaviour will default to that of the specific os. + +```js +// With path +var device = await HID.HIDAsync.open(path, { nonExclusive: true }); + +// With vid, pid +var device = await HID.HIDAsync.open(vid, pid, { nonExclusive: true }); +``` + +The `device` variable will contain a handle to the device. +If an error occurs opening the device, an exception will be thrown. + +A `node-hid` device is an `EventEmitter`. +While it shares some method names and usage patterns with +`Readable` and `Writable` streams, it is not a stream and the semantics vary. +For example, `device.write` does not take encoding or callback args and +`device.pause` does not do the same thing as `readable.pause`. +There is also no `pipe` method. + +### Reading from a device + +To receive FEATURE reports, use `await device.getFeatureReport()`. + +To receive INPUT reports, use `device.on("data",...)`. +A `node-hid` device is an EventEmitter. +Reading from a device is performed by registering a "data" event handler: + +```js +device.on("data", function (data) {}); +``` + +You can also listen for errors like this: + +```js +device.on("error", function (err) {}); +``` + +For FEATURE reports: + +```js +var buf = await device.getFeatureReport(reportId, reportLength); +``` + +Notes: + +- Reads via `device.on("data")` are asynchronous +- To remove an event handler, close the device with `device.close()` +- When there is not yet a data handler or no data handler exists, + data is not read at all -- there is no buffer. + +### Writing to a device + +To send FEATURE reports, use `device.sendFeatureReport()`. + +To send OUTPUT reports, use `device.write()`. + +The ReportId is the first byte of the array sent to `device.sendFeatureReport()` or `device.write()`, meaning the array should be one byte bigger than your report. +If your device does NOT use numbered reports, set the first byte of the 0x00. + +```js +device.write([0x00, 0x01, 0x01, 0x05, 0xff, 0xff]); +``` + +```js +device.sendFeatureReport([0x01, "c", 0, 0xff, 0x33, 0x00, 70, 0, 0]); +``` + +Notes: + +- All writes and other operations performed with the HIDAsync device are done in a work-queue, so will happen in the order you issue them with the returned `Promise` resolving once the operation is completed +- You must send the exact number of bytes for your chosen OUTPUT or FEATURE report. +- Both `device.write()` and `device.sendFeatureReport()` return a Promise containing the number of bytes written + 1. +- For devices using Report Ids, the first byte of the array to `write()` or `sendFeatureReport()` must be the Report Id. + +## Sync API Usage + +### List all HID devices connected + +```js +var HID = require("node-hid"); +var devices = HID.devices(); +``` + +`devices` will contain an array of objects, one for each HID device +available. Of particular interest are the `vendorId` and +`productId`, as they uniquely identify a device, and the +`path`, which is needed to open a particular device. + +Sample output: + +```js +HID.devices(); +{ vendorId: 10168, + productId: 493, + path: 'IOService:/AppleACPIPl...HIDDevice@14210000,0', + serialNumber: '20002E8C', + manufacturer: 'ThingM', + product: 'blink(1) mk2', + release: 2, + interface: -1, + usagePage: 65280, + usage: 1 }, + { vendorId: 1452, + productId: 610, + path: 'IOService:/AppleACPIPl...Keyboard@14400000,0', + serialNumber: '', + manufacturer: 'Apple Inc.', + product: 'Apple Internal Keyboard / Trackpad', + release: 549, + interface: -1, + usagePage: 1, + usage: 6 }, + +``` + +### Opening a device + +Before a device can be read from or written to, it must be opened. +Use either the `path` from the list returned by a prior call to `HID.devices()`: + +```js +var device = new HID.HID(path); +``` + +or open the first device matching a VID/PID pair: + +```js +var device = new HID.HID(vid, pid); +``` + +**On MacOs** if set to true the `nonExclusive` property allows the device to be opened in non-exclusive mode. +For the other plaforms the flag has no impact. +If the flag is not set the behaviour will default to that of the specific os. + +```js +// With path +var device = await HID.HID(path, { nonExclusive: true }); + +// With vid, pid +var device = await HID.HID(vid, pid, { nonExclusive: true }); +``` + +The `device` variable will contain a handle to the device. +If an error occurs opening the device, an exception will be thrown. + +A `node-hid` device is an `EventEmitter`. +While it shares some method names and usage patterns with +`Readable` and `Writable` streams, it is not a stream and the semantics vary. +For example, `device.write` does not take encoding or callback args and +`device.pause` does not do the same thing as `readable.pause`. +There is also no `pipe` method. + +### Picking a device from the device list + +If you need to filter down the `HID.devices()` list, you can use +standard Javascript array techniques: + +```js +var devices = HID.devices(); +var deviceInfo = devices.find(function (d) { + var isTeensy = d.vendorId === 0x16c0 && d.productId === 0x0486; + return isTeensy && d.usagePage === 0xffab && d.usage === 0x200; +}); +if (deviceInfo) { + var device = new HID.HID(deviceInfo.path); + // ... use device +} +``` + +You can also find device of interest by passing VID and PID + +```js +//return all the devices that match specified VID and PID +var devices = HID.devices(0x16c0, 0x0486); +``` + +### Reading from a device + +To receive FEATURE reports, use `device.getFeatureReport()`. + +To receive INPUT reports, use `device.on("data",...)`. +A `node-hid` device is an EventEmitter. +Reading from a device is performed by registering a "data" event handler: + +```js +device.on("data", function (data) {}); +``` + +You can also listen for errors like this: + +```js +device.on("error", function (err) {}); +``` + +For FEATURE reports: + +```js +var buf = device.getFeatureReport(reportId, reportLength); +``` + +Notes: + +- Reads via `device.on("data")` are asynchronous +- Reads via `device.getFeatureReport()` are synchronous +- To remove an event handler, close the device with `device.close()` +- When there is not yet a data handler or no data handler exists, + data is not read at all -- there is no buffer. + +### Writing to a device + +To send FEATURE reports, use `device.sendFeatureReport()`. + +To send OUTPUT reports, use `device.write()`. + +All writing is synchronous. + +The ReportId is the first byte of the array sent to `device.sendFeatureReport()` or `device.write()`, meaning the array should be one byte bigger than your report. +If your device does NOT use numbered reports, set the first byte of the 0x00. + +```js +device.write([0x00, 0x01, 0x01, 0x05, 0xff, 0xff]); +``` + +```js +device.sendFeatureReport([0x01, "c", 0, 0xff, 0x33, 0x00, 70, 0, 0]); +``` + +Notes: + +- You must send the exact number of bytes for your chosen OUTPUT or FEATURE report. +- Both `device.write()` and `device.sendFeatureReport()` return + number of bytes written + 1. +- For devices using Report Ids, the first byte of the array to `write()` or + `sendFeatureReport()` must be the Report Id. + +## Complete Async API + +### `devices = await HID.devicesAsync()` + +- Return array listing all connected HID devices + +### `devices = await HID.devicesAsync(vid,pid)` + +- Return array listing all connected HID devices with specific VendorId and ProductId + +### `device = await HID.HIDAsync.open(path,options?:{nonExclusive?:boolean})` + +- Open a HID device at the specified platform-specific path + +### `device = await HID.HIDAsync.open(vid,pid,options?:{nonExclusive?:boolean})` + +- Open first HID device with specific VendorId and ProductId + +### `device.on('data', function(data) {} )` + +- `data` - Buffer - the data read from the device + +### `device.on('error, function(error) {} )` + +- `error` - The error Object emitted + +### `device.write(data)` + +- `data` - the data to be synchronously written to the device, + first byte is Report Id or 0x00 if not using numbered reports. +- Returns number of bytes actually written + +### `device.close()` + +- Closes the device. Subsequent reads will raise an error. + +### `device.pause()` + +- Pauses reading and the emission of `data` events. + This means the underlying device is _silenced_ until resumption -- + it is not like pausing a stream, where data continues to accumulate. + +### `device.resume()` + +- This method will cause the HID device to resume emmitting `data` events. + If no listeners are registered for the `data` event, data will be lost. + +- When a `data` event is registered for this HID device, this method will + be automatically called. + +### `device.read(time_out)` + +- (optional) `time_out` - timeout in milliseconds +- Low-level function call to initiate an asynchronous read from the device. +- Returns a Promise containing a Buffer or the Promise will reject upon error. +- This can only be used when `device.on('data', () => {})` is not being used. It will fail if a data handler is registered + +### `device.sendFeatureReport(data)` + +- `data` - data of HID feature report, with 0th byte being report_id (`[report_id,...]`) +- Returns number of bytes actually written + +### `device.getFeatureReport(report_id, report_length)` + +- `report_id` - HID feature report id to get +- `report_length` - length of report + +### `device.setNonBlocking(no_block)` + +- `no_block` - boolean. Set to `true` to enable non-blocking reads +- exactly mirrors `hid_set_nonblocking()` in [`hidapi`](https://github.com/libusb/hidapi) + +## Complete Sync API + +### `devices = HID.devices()` + +- Return array listing all connected HID devices + +### `devices = HID.devices(vid,pid)` + +- Return array listing all connected HID devices with specific VendorId and ProductId + +### `HID.setDriverType(type)` + +- Linux only +- Sets underlying HID driver type +- `type` can be `"hidraw"` or `"libusb"`, defaults to `"hidraw"` + +### `device = new HID.HID(path,options?:{nonExclusive?:boolean})` + +- Open a HID device at the specified platform-specific path + +### `device = new HID.HID(vid,pid,options?:{nonExclusive?:boolean})` + +- Open first HID device with specific VendorId and ProductId + +### `device.on('data', function(data) {} )` + +- `data` - Buffer - the data read from the device + +### `device.on('error', function(error) {} )` + +- `error` - The error Object emitted + +### `device.write(data)` + +- `data` - the data to be synchronously written to the device, + first byte is Report Id or 0x00 if not using numbered reports. +- Returns number of bytes actually written + +### `device.close()` + +- Closes the device. Subsequent reads will raise an error. + +### `device.pause()` + +- Pauses reading and the emission of `data` events. + This means the underlying device is _silenced_ until resumption -- + it is not like pausing a stream, where data continues to accumulate. + +### `device.resume()` + +- This method will cause the HID device to resume emmitting `data` events. + If no listeners are registered for the `data` event, data will be lost. + +- When a `data` event is registered for this HID device, this method will + be automatically called. + +### `device.read(callback)` + +- Low-level function call to initiate an asynchronous read from the device. +- `callback` is of the form `callback(err, data)` + +### `device.readSync()` + +- Return an array of numbers data. If an error occurs, an exception will be thrown. + +### `device.readTimeout(time_out)` + +- `time_out` - timeout in milliseconds +- Return an array of numbers data. If an error occurs, an exception will be thrown. + +### `device.sendFeatureReport(data)` + +- `data` - data of HID feature report, with 0th byte being report_id (`[report_id,...]`) +- Returns number of bytes actually written + +### `device.getFeatureReport(report_id, report_length)` + +- `report_id` - HID feature report id to get +- `report_length` - length of report + +### `device.setNonBlocking(no_block)` + +- `no_block` - boolean. Set to `true` to enable non-blocking reads +- exactly mirrors `hid_set_nonblocking()` in [`hidapi`](https://github.com/libusb/hidapi) + +--- + +## General notes: + +### Thread safety, Worker threads, Context-aware modules + +In general `node-hid` is thread-safe even though the underlying C-library it wraps (`hidapi`) is not entirely thread-safe. +To mitigate this we are doing locking to ensure operations are performed safely. If you are using the sync api from multiple worker_threads, this will result in them waiting on each other at times. + +### Devices `node-hid` cannot read + +The following devices are unavailable to `node-hid` because the OS owns them: + +- Keyboards +- Mice +- Barcode readers (in USB HID keyboard mode) +- RFID scanners (in USB HID keyboard mode) +- Postage Scales (in USB HID keyboard mode) + +Most OSes will prevent USB HID keyboards or mice, or devices that appear as a keyboard to the OS. +This includes many RFID scanners, barcode readers, USB HID scales, and many other devices. +This is a security precaution. Otherwise, it would be trivial to build keyloggers. + +Some keyboard-pretending devices like barcode or RFID readers can be configured to be in +"HID data" mode or "Serial / UART" mode. If in "HID Data" mode then `node-hid` can access them, +if in "Serial / UART" mode, you should use `node-serialport` instead. + +## Mac notes + +See General notes above Keyboards with the exception if you open a device in nonExclusive mode. +In that case the os will request permission from the user to read the device. +If permission is given `node-hid` will be able to read data coming from the device normally. + +## Windows notes + +See General notes above about Keyboards + +### Xbox 360 Controller on Windows 10 + +For reasons similar to mice & keyboards it appears you can't access this controller on Windows 10. + +## Linux notes + +See General notes above about Keyboards + +### udev device permissions + +Most Linux distros use `udev` to manage access to physical devices, +and USB HID devices are normally owned by the `root` user. +To allow non-root access, you must create a udev rule for the device, +based on the devices vendorId and productId. + +This rule is a text file placed in `/etc/udev/rules.d`. + +For an example HID device (say a blink(1) light with vendorId = 0x27b8 and productId = 0x01ed, +the rules file to support both `hidraw` and `libusb` would look like: + +``` +SUBSYSTEM=="input", GROUP="input", MODE="0666" +SUBSYSTEM=="usb", ATTRS{idVendor}=="27b8", ATTRS{idProduct}=="01ed", MODE:="666", GROUP="plugdev" +KERNEL=="hidraw*", ATTRS{idVendor}=="27b8", ATTRS{idProduct}=="01ed", MODE="0666", GROUP="plugdev" +``` + +Note that the values for idVendor and idProduct must be in hex and lower-case. + +Save this file as `/etc/udev/rules.d/51-blink1.rules`, unplug the HID device, +and reload the rules with: + +``` +sudo udevadm control --reload-rules +``` + +For a complete example, see the +[blink1 udev rules](https://github.com/todbot/blink1/blob/master/linux/51-blink1.rules). + +### Selecting driver type + +By default as of `node-hid@0.7.0`, the [hidraw](https://www.kernel.org/doc/Documentation/hid/hidraw.txt) driver is used to talk to HID devices. Before `node-hid@0.7.0`, the more older but less capable [libusb](http://libusb.info/) driver was used. With `hidraw` Linux apps can now see `usage` and `usagePage` attributes of devices. + +If you would still like to use the `libusb` driver, then you can do either: + +During runtime, you can use `HID.setDriverType('libusb')` immediately after require()-ing `node-hid`: + +```js +var HID = require("node-hid"); +HID.setDriverType("libusb"); +``` + +If you must have the libusb version and cannot use `setDriverType()`, +you can install older node-hid or build from source: + +``` +npm install node-hid@0.5.7 +``` + +or: + +``` +npm install node-hid --build-from-source --driver=libusb +``` + +## Compiling from source + +To compile & develop locally or if `prebuild` cannot download a pre-built +binary for you, you will need the following compiler tools and libraries: + +### Linux (kernel 2.6+) : (install examples shown for Debian/Ubuntu) + +- Compilation tools: `apt install build-essential git pkg-config` +- libudev-dev: `apt install libudev-dev` (Debian/Ubuntu) / + `yum install libusbx-devel` (Fedora) +- libusb-1.0-0 w/headers:`apt install libusb-1.0-0 libusb-1.0-0-dev` + +### FreeBSD + +- Compilation tools: `pkg install git gcc gmake libiconv node npm` + +### Mac OS X 10.8+ + +- [Xcode](https://itunes.apple.com/us/app/xcode/id497799835?mt=12) + +### Windows 7, 8, 10 + +The below is slightly stale. The 2021 solution is to use the official NodeJs Windows installer +and pick "install native module tools" + +- Visual C++ compiler and Python 2.7 + - either: + - `npm install --global windows-build-tools` + - add `%USERPROFILE%\.windows-build-tools\python27` to `PATH`, + like PowerShell: `$env:Path += ";$env:USERPROFILE\.windows-build-tools\python27"` + - or: + - [Python 2.7](https://www.python.org/downloads/windows/) + - [Visual Studio Express 2013 for Desktop](https://www.visualstudio.com/downloads/download-visual-studio-vs#d-2013-express) + +### Building `node-hid` from source, for your projects + +``` +npm install node-hid --build-from-source +``` + +### Build `node-hid` for `node-hid` development + +- check out a copy of this repo +- change into its directory +- update the submodules +- build the node package + +For example: + +``` +git clone https://github.com/node-hid/node-hid.git +cd node-hid # must change into node-hid directory +npm install -g rimraf # just so it doesn't get 'clean'ed +npm run prepublishOnly # get the needed hidapi submodule +npm install --build-from-source # rebuilds the module with C code +npm run showdevices # list connected HID devices +node ./src/show-devices.js # same as above +``` + +You may see some warnings from the C compiler as it compiles +[hidapi](https://github.com/libusb/hidapi) (the underlying C library `node-hid` uses). +This is expected. + +For ease of development, there are also the scripts: + +``` +npm run gypclean # "node-gyp clean" clean gyp build directory +npm run gypconfigure # "node-gyp configure" configure makefiles +npm run gypbuild # "node-gyp build" build native code +``` + +### Building `node-hid` for cross-compiling + +When cross-compiling you need to override `node-hid`'s normal behavior +of using Linux `pkg-config` to determine CLFAGS and LDFLAGS for `libusb`. +To do this, you can use the `node-gyp` variable `node_hid_no_pkg_config` +and then invoke a `node-hid` rebuild with either: + +``` + node-gyp rebuild --node_hid_no_pkg_config=1 +``` + +or + +``` + npm gyprebuild --node_hid_no_pkg_config=1 +``` + +## Electron projects using `node-hid` + +If using `node-hid` with `webpack` or similar bundler, you may need to exclude +`node-hid` and other libraries with native code. In webpack, you say which +`externals` you have in your `webpack-config.js`: + +``` + externals: { + "node-hid": 'commonjs node-hid' + } +``` + +Examples of `node-hid` in Electron: + +- [electron-hid-test](https://github.com/todbot/electron-hid-test) - Simple example of using `node-hid`, should track latest Electron release +- [electron-hid-test-erb](https://github.com/todbot/electron-hid-test-erb) - Simple example of using `node-hid` using [electron-react-boilerplate](https://github.com/electron-react-boilerplate/electron-react-boilerplate/) +- [electron-hid-toy](https://github.com/todbot/electron-hid-toy) - Simple example of using `node-hid`, showing packaging and signing +- [Blink1Control2](https://github.com/todbot/Blink1Control2/) - a complete application, using webpack (e.g. see its [webpack-config.js](https://github.com/todbot/Blink1Control2/blob/master/webpack.config.js)) + +## NW.js projects using `node-hid` + +Without knowing much about NW.js, a quick hacky solution that works is: + +``` +cd my-nwjs-app +npm install node-hid --save +npm install -g nw-gyp +cd node_modules/node-hid +nw-gyp rebuild --target=0.42.3 --arch=x64 // or whatever NW.js version you have +cd ../.. +nwjs . +``` + +## Support + +Please use the [node-hid github issues page](https://github.com/node-hid/node-hid/issues) +for support questions and issues. diff --git a/node_modules/node-hid/binding-options.js b/node_modules/node-hid/binding-options.js new file mode 100644 index 0000000..d804166 --- /dev/null +++ b/node_modules/node-hid/binding-options.js @@ -0,0 +1,4 @@ +module.exports = { + name: 'HID', + napi_versions: [4], +} \ No newline at end of file diff --git a/node_modules/node-hid/binding.gyp b/node_modules/node-hid/binding.gyp new file mode 100644 index 0000000..1e1d2bd --- /dev/null +++ b/node_modules/node-hid/binding.gyp @@ -0,0 +1,182 @@ +{ + 'variables': { + 'driver%': 'libusb', + 'node_hid_no_pkg_config%': '0' + }, + 'targets': [ + { + 'target_name': 'HID', + 'sources': [ + 'src/exports.cc', + 'src/HID.cc', + 'src/HIDAsync.cc', + 'src/devices.cc', + 'src/read.cc', + 'src/util.cc' + ], + 'dependencies': ['hidapi'], + 'defines': [ + '_LARGEFILE_SOURCE', + '_FILE_OFFSET_BITS=64', + ], + 'conditions': [ + [ 'OS=="mac"', { + 'LDFLAGS': [ + '-framework IOKit', + '-framework CoreFoundation', + '-framework AppKit' + ], + 'xcode_settings': { + 'CLANG_CXX_LIBRARY': 'libc++', + 'MACOSX_DEPLOYMENT_TARGET': '10.9', + 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', + 'OTHER_LDFLAGS': [ + '-framework IOKit', + '-framework CoreFoundation', + '-framework AppKit' + ], + } + }], # OS==mac + [ 'OS=="linux"', { + 'conditions': [ + [ 'driver=="libusb"', { + 'libraries': ['-lusb-1.0'] + }], + [ 'driver=="hidraw"', { + 'libraries': ['-ludev','-lusb-1.0'] + }] + ], + }], # OS==linux + [ 'OS=="freebsd"', { + 'libraries': ['-lusb'] + }], # OS==freebsd + [ 'OS=="win"', { + 'msvs_settings': { + 'VCCLCompilerTool': { + 'ExceptionHandling': '2', # /EHsc + 'DisableSpecificWarnings': [ '4290', '4530', '4267' ], + }, + 'VCLinkerTool': { + 'AdditionalDependencies': ['setupapi.lib'] + } + } + }] # OS==win + ], + 'cflags!': ['-ansi', '-fno-exceptions' ], + 'cflags_cc!': [ '-fno-exceptions' ], + 'cflags': ['-g', '-exceptions'], + 'cflags_cc': ['-g', '-exceptions'] + }, # target HID + + { + 'target_name': 'hidapi', + 'type': 'static_library', + 'conditions': [ + [ 'OS=="mac"', { + 'sources': [ 'hidapi/mac/hid.c' ], + 'include_dirs+': ['/usr/include/libusb-1.0/'], + 'xcode_settings': { + 'OTHER_CFLAGS': ['-Wno-sign-compare'], + 'MACOSX_DEPLOYMENT_TARGET': '10.9', + } + }], + [ 'OS=="freebsd"', { + 'sources': [ 'hidapi/libusb/hid.c' ], + }], + [ 'OS=="linux"', { + 'conditions': [ + [ 'driver=="libusb"', { + 'sources': [ 'hidapi/libusb/hid.c' ], + 'conditions': [ + ['node_hid_no_pkg_config != 1', { + 'include_dirs+': ['> $(depfile) +# Add extra rules as in (2). +# We remove slashes and replace spaces with new lines; +# remove blank lines; +# delete the first line and append a colon to the remaining lines. +sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ + grep -v '^$$' |\ + sed -e 1d -e 's|$$|:|' \ + >> $(depfile) +rm $(depfile).raw +endef + +# Command definitions: +# - cmd_foo is the actual command to run; +# - quiet_cmd_foo is the brief-output summary of the command. + +quiet_cmd_cc = CC($(TOOLSET)) $@ +cmd_cc = $(CC.$(TOOLSET)) -o $@ $< $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c + +quiet_cmd_cxx = CXX($(TOOLSET)) $@ +cmd_cxx = $(CXX.$(TOOLSET)) -o $@ $< $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c + +quiet_cmd_touch = TOUCH $@ +cmd_touch = touch $@ + +quiet_cmd_copy = COPY $@ +# send stderr to /dev/null to ignore messages when linking directories. +cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp -af "$<" "$@") + +quiet_cmd_symlink = SYMLINK $@ +cmd_symlink = ln -sf "$<" "$@" + +quiet_cmd_alink = AR($(TOOLSET)) $@ +cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) + +quiet_cmd_alink_thin = AR($(TOOLSET)) $@ +cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) + +# Due to circular dependencies between libraries :(, we wrap the +# special "figure out circular dependencies" flags around the entire +# input list during linking. +quiet_cmd_link = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group + +# Note: this does not handle spaces in paths +define xargs + $(1) $(word 1,$(2)) +$(if $(word 2,$(2)),$(call xargs,$(1),$(wordlist 2,$(words $(2)),$(2)))) +endef + +define write-to-file + @: >$(1) +$(call xargs,@printf "%s\n" >>$(1),$(2)) +endef + +OBJ_FILE_LIST := ar-file-list + +define create_archive + rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)` + $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) + $(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST) +endef + +define create_thin_archive + rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)` + $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) + $(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST) +endef + +# We support two kinds of shared objects (.so): +# 1) shared_library, which is just bundling together many dependent libraries +# into a link line. +# 2) loadable_module, which is generating a module intended for dlopen(). +# +# They differ only slightly: +# In the former case, we want to package all dependent code into the .so. +# In the latter case, we want to package just the API exposed by the +# outermost module. +# This means shared_library uses --whole-archive, while loadable_module doesn't. +# (Note that --whole-archive is incompatible with the --start-group used in +# normal linking.) + +# Other shared-object link notes: +# - Set SONAME to the library filename so our binaries don't reference +# the local, absolute paths used on the link command-line. +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) + + +# Define an escape_quotes function to escape single quotes. +# This allows us to handle quotes properly as long as we always use +# use single quotes and escape_quotes. +escape_quotes = $(subst ','\'',$(1)) +# This comment is here just to include a ' to unconfuse syntax highlighting. +# Define an escape_vars function to escape '$' variable syntax. +# This allows us to read/write command lines with shell variables (e.g. +# $LD_LIBRARY_PATH), without triggering make substitution. +escape_vars = $(subst $$,$$$$,$(1)) +# Helper that expands to a shell command to echo a string exactly as it is in +# make. This uses printf instead of echo because printf's behaviour with respect +# to escape sequences is more portable than echo's across different shells +# (e.g., dash, bash). +exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' + +# Helper to compare the command we're about to run against the command +# we logged the last time we ran the command. Produces an empty +# string (false) when the commands match. +# Tricky point: Make has no string-equality test function. +# The kernel uses the following, but it seems like it would have false +# positives, where one string reordered its arguments. +# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ +# $(filter-out $(cmd_$@), $(cmd_$(1)))) +# We instead substitute each for the empty string into the other, and +# say they're equal if both substitutions produce the empty string. +# .d files contain ? instead of spaces, take that into account. +command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ + $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) + +# Helper that is non-empty when a prerequisite changes. +# Normally make does this implicitly, but we force rules to always run +# so we can check their command lines. +# $? -- new prerequisites +# $| -- order-only dependencies +prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) + +# Helper that executes all postbuilds until one fails. +define do_postbuilds + @E=0;\ + for p in $(POSTBUILDS); do\ + eval $$p;\ + E=$$?;\ + if [ $$E -ne 0 ]; then\ + break;\ + fi;\ + done;\ + if [ $$E -ne 0 ]; then\ + rm -rf "$@";\ + exit $$E;\ + fi +endef + +# do_cmd: run a command via the above cmd_foo names, if necessary. +# Should always run for a given target to handle command-line changes. +# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. +# Third argument, if non-zero, makes it do POSTBUILDS processing. +# Note: We intentionally do NOT call dirx for depfile, since it contains ? for +# spaces already and dirx strips the ? characters. +define do_cmd +$(if $(or $(command_changed),$(prereq_changed)), + @$(call exact_echo, $($(quiet)cmd_$(1))) + @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" + $(if $(findstring flock,$(word 1,$(cmd_$1))), + @$(cmd_$(1)) + @echo " $(quiet_cmd_$(1)): Finished", + @$(cmd_$(1)) + ) + @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) + @$(if $(2),$(fixup_dep)) + $(if $(and $(3), $(POSTBUILDS)), + $(call do_postbuilds) + ) +) +endef + +# Declare the "all" target first so it is the default, +# even though we don't have the deps yet. +.PHONY: all +all: + +# make looks for ways to re-generate included makefiles, but in our case, we +# don't have a direct way. Explicitly telling make that it has nothing to do +# for them makes it go faster. +%.d: ; + +# Use FORCE_DO_CMD to force a target to run. Should be coupled with +# do_cmd. +.PHONY: FORCE_DO_CMD +FORCE_DO_CMD: + +TOOLSET := target +# Suffix rules, putting all outputs into $(obj). +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) + +# Try building from generated source, too. +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) + +$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) + + +ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ + $(findstring $(join ^,$(prefix)),\ + $(join ^,HID.target.mk)))),) + include HID.target.mk +endif +ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ + $(findstring $(join ^,$(prefix)),\ + $(join ^,HID_hidraw.target.mk)))),) + include HID_hidraw.target.mk +endif +ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ + $(findstring $(join ^,$(prefix)),\ + $(join ^,hidapi-linux-hidraw.target.mk)))),) + include hidapi-linux-hidraw.target.mk +endif +ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ + $(findstring $(join ^,$(prefix)),\ + $(join ^,hidapi.target.mk)))),) + include hidapi.target.mk +endif + +quiet_cmd_regen_makefile = ACTION Regenerating $@ +cmd_regen_makefile = cd $(srcdir); /usr/lib/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/home/erik/.electron-gyp/28.3.3" "-Dnode_gyp_dir=/usr/lib/node_modules/node-gyp" "-Dnode_lib_file=/home/erik/.electron-gyp/28.3.3/<(target_arch)/node.lib" "-Dmodule_root_dir=/home/erik/Git/PackControl/node_modules/node-hid" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/home/erik/Git/PackControl/node_modules/node-hid/build/config.gypi -I/usr/lib/node_modules/node-gyp/addon.gypi -I/home/erik/.electron-gyp/28.3.3/include/node/common.gypi "--toplevel-dir=." binding.gyp +Makefile: $(srcdir)/../../../../../../usr/lib/node_modules/node-gyp/addon.gypi $(srcdir)/../../../../.electron-gyp/28.3.3/include/node/common.gypi $(srcdir)/binding.gyp $(srcdir)/build/config.gypi + $(call do_cmd,regen_makefile) + +# "all" is a concatenation of the "all" targets from all the included +# sub-makefiles. This is just here to clarify. +all: + +# Add in dependency-tracking rules. $(all_deps) is the list of every single +# target in our tree. Only consider the ones with .d (dependency) info: +d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) +ifneq ($(d_files),) + include $(d_files) +endif diff --git a/node_modules/node-hid/build/Release/.deps/Release/HID.node.d b/node_modules/node-hid/build/Release/.deps/Release/HID.node.d new file mode 100644 index 0000000..041edc8 --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/HID.node.d @@ -0,0 +1 @@ +cmd_Release/HID.node := ln -f "Release/obj.target/HID.node" "Release/HID.node" 2>/dev/null || (rm -rf "Release/HID.node" && cp -af "Release/obj.target/HID.node" "Release/HID.node") diff --git a/node_modules/node-hid/build/Release/.deps/Release/HID_hidraw.node.d b/node_modules/node-hid/build/Release/.deps/Release/HID_hidraw.node.d new file mode 100644 index 0000000..5be4f55 --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/HID_hidraw.node.d @@ -0,0 +1 @@ +cmd_Release/HID_hidraw.node := ln -f "Release/obj.target/HID_hidraw.node" "Release/HID_hidraw.node" 2>/dev/null || (rm -rf "Release/HID_hidraw.node" && cp -af "Release/obj.target/HID_hidraw.node" "Release/HID_hidraw.node") diff --git a/node_modules/node-hid/build/Release/.deps/Release/hidapi-linux-hidraw.a.d b/node_modules/node-hid/build/Release/.deps/Release/hidapi-linux-hidraw.a.d new file mode 100644 index 0000000..02d4fa3 --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/hidapi-linux-hidraw.a.d @@ -0,0 +1 @@ +cmd_Release/hidapi-linux-hidraw.a := ln -f "Release/obj.target/hidapi-linux-hidraw.a" "Release/hidapi-linux-hidraw.a" 2>/dev/null || (rm -rf "Release/hidapi-linux-hidraw.a" && cp -af "Release/obj.target/hidapi-linux-hidraw.a" "Release/hidapi-linux-hidraw.a") diff --git a/node_modules/node-hid/build/Release/.deps/Release/hidapi.a.d b/node_modules/node-hid/build/Release/.deps/Release/hidapi.a.d new file mode 100644 index 0000000..635d1f8 --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/hidapi.a.d @@ -0,0 +1 @@ +cmd_Release/hidapi.a := ln -f "Release/obj.target/hidapi.a" "Release/hidapi.a" 2>/dev/null || (rm -rf "Release/hidapi.a" && cp -af "Release/obj.target/hidapi.a" "Release/hidapi.a") diff --git a/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID.node.d b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID.node.d new file mode 100644 index 0000000..3b797d2 --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID.node.d @@ -0,0 +1 @@ +cmd_Release/obj.target/HID.node := g++ -o Release/obj.target/HID.node -shared -pthread -rdynamic -m64 -Wl,-soname=HID.node -Wl,--start-group Release/obj.target/HID/src/exports.o Release/obj.target/HID/src/HID.o Release/obj.target/HID/src/HIDAsync.o Release/obj.target/HID/src/devices.o Release/obj.target/HID/src/read.o Release/obj.target/HID/src/util.o Release/obj.target/hidapi.a -Wl,--end-group -lusb-1.0 diff --git a/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/HID.o.d b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/HID.o.d new file mode 100644 index 0000000..3415132 --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/HID.o.d @@ -0,0 +1,23 @@ +cmd_Release/obj.target/HID/src/HID.o := g++ -o Release/obj.target/HID/src/HID.o ../src/HID.cc '-DNODE_GYP_MODULE_NAME=HID' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DELECTRON_ENSURE_CONFIG_GYPI' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DUSING_ELECTRON_CONFIG_GYPI' '-DV8_COMPRESS_POINTERS' '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' '-DV8_ENABLE_SANDBOX' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DBUILDING_NODE_EXTENSION' -I/home/erik/.electron-gyp/28.3.3/include/node -I/home/erik/.electron-gyp/28.3.3/src -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include -I/home/erik/.electron-gyp/28.3.3/deps/uv/include -I/home/erik/.electron-gyp/28.3.3/deps/zlib -I/home/erik/.electron-gyp/28.3.3/deps/v8/include -I../hidapi/hidapi -I/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -g -exceptions -m64 -O3 -fno-omit-frame-pointer -fno-rtti -std=gnu++17 -g -exceptions -MMD -MF ./Release/.deps/Release/obj.target/HID/src/HID.o.d.raw -c +Release/obj.target/HID/src/HID.o: ../src/HID.cc ../src/devices.h \ + ../src/util.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h \ + ../hidapi/hidapi/hidapi.h ../src/HID.h +../src/HID.cc: +../src/devices.h: +../src/util.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h: +../hidapi/hidapi/hidapi.h: +../src/HID.h: diff --git a/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/HIDAsync.o.d b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/HIDAsync.o.d new file mode 100644 index 0000000..8146e17 --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/HIDAsync.o.d @@ -0,0 +1,24 @@ +cmd_Release/obj.target/HID/src/HIDAsync.o := g++ -o Release/obj.target/HID/src/HIDAsync.o ../src/HIDAsync.cc '-DNODE_GYP_MODULE_NAME=HID' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DELECTRON_ENSURE_CONFIG_GYPI' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DUSING_ELECTRON_CONFIG_GYPI' '-DV8_COMPRESS_POINTERS' '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' '-DV8_ENABLE_SANDBOX' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DBUILDING_NODE_EXTENSION' -I/home/erik/.electron-gyp/28.3.3/include/node -I/home/erik/.electron-gyp/28.3.3/src -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include -I/home/erik/.electron-gyp/28.3.3/deps/uv/include -I/home/erik/.electron-gyp/28.3.3/deps/zlib -I/home/erik/.electron-gyp/28.3.3/deps/v8/include -I../hidapi/hidapi -I/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -g -exceptions -m64 -O3 -fno-omit-frame-pointer -fno-rtti -std=gnu++17 -g -exceptions -MMD -MF ./Release/.deps/Release/obj.target/HID/src/HIDAsync.o.d.raw -c +Release/obj.target/HID/src/HIDAsync.o: ../src/HIDAsync.cc \ + ../src/devices.h ../src/util.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h \ + ../hidapi/hidapi/hidapi.h ../src/HIDAsync.h ../src/read.h +../src/HIDAsync.cc: +../src/devices.h: +../src/util.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h: +../hidapi/hidapi/hidapi.h: +../src/HIDAsync.h: +../src/read.h: diff --git a/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/devices.o.d b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/devices.o.d new file mode 100644 index 0000000..614e5c8 --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/devices.o.d @@ -0,0 +1,22 @@ +cmd_Release/obj.target/HID/src/devices.o := g++ -o Release/obj.target/HID/src/devices.o ../src/devices.cc '-DNODE_GYP_MODULE_NAME=HID' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DELECTRON_ENSURE_CONFIG_GYPI' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DUSING_ELECTRON_CONFIG_GYPI' '-DV8_COMPRESS_POINTERS' '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' '-DV8_ENABLE_SANDBOX' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DBUILDING_NODE_EXTENSION' -I/home/erik/.electron-gyp/28.3.3/include/node -I/home/erik/.electron-gyp/28.3.3/src -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include -I/home/erik/.electron-gyp/28.3.3/deps/uv/include -I/home/erik/.electron-gyp/28.3.3/deps/zlib -I/home/erik/.electron-gyp/28.3.3/deps/v8/include -I../hidapi/hidapi -I/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -g -exceptions -m64 -O3 -fno-omit-frame-pointer -fno-rtti -std=gnu++17 -g -exceptions -MMD -MF ./Release/.deps/Release/obj.target/HID/src/devices.o.d.raw -c +Release/obj.target/HID/src/devices.o: ../src/devices.cc ../src/devices.h \ + ../src/util.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h \ + ../hidapi/hidapi/hidapi.h +../src/devices.cc: +../src/devices.h: +../src/util.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h: +../hidapi/hidapi/hidapi.h: diff --git a/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/exports.o.d b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/exports.o.d new file mode 100644 index 0000000..89003d7 --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/exports.o.d @@ -0,0 +1,25 @@ +cmd_Release/obj.target/HID/src/exports.o := g++ -o Release/obj.target/HID/src/exports.o ../src/exports.cc '-DNODE_GYP_MODULE_NAME=HID' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DELECTRON_ENSURE_CONFIG_GYPI' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DUSING_ELECTRON_CONFIG_GYPI' '-DV8_COMPRESS_POINTERS' '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' '-DV8_ENABLE_SANDBOX' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DBUILDING_NODE_EXTENSION' -I/home/erik/.electron-gyp/28.3.3/include/node -I/home/erik/.electron-gyp/28.3.3/src -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include -I/home/erik/.electron-gyp/28.3.3/deps/uv/include -I/home/erik/.electron-gyp/28.3.3/deps/zlib -I/home/erik/.electron-gyp/28.3.3/deps/v8/include -I../hidapi/hidapi -I/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -g -exceptions -m64 -O3 -fno-omit-frame-pointer -fno-rtti -std=gnu++17 -g -exceptions -MMD -MF ./Release/.deps/Release/obj.target/HID/src/exports.o.d.raw -c +Release/obj.target/HID/src/exports.o: ../src/exports.cc ../src/util.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h \ + ../hidapi/hidapi/hidapi.h ../src/HID.h ../src/HIDAsync.h ../src/read.h \ + ../src/devices.h +../src/exports.cc: +../src/util.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h: +../hidapi/hidapi/hidapi.h: +../src/HID.h: +../src/HIDAsync.h: +../src/read.h: +../src/devices.h: diff --git a/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/read.o.d b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/read.o.d new file mode 100644 index 0000000..260c350 --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/read.o.d @@ -0,0 +1,22 @@ +cmd_Release/obj.target/HID/src/read.o := g++ -o Release/obj.target/HID/src/read.o ../src/read.cc '-DNODE_GYP_MODULE_NAME=HID' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DELECTRON_ENSURE_CONFIG_GYPI' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DUSING_ELECTRON_CONFIG_GYPI' '-DV8_COMPRESS_POINTERS' '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' '-DV8_ENABLE_SANDBOX' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DBUILDING_NODE_EXTENSION' -I/home/erik/.electron-gyp/28.3.3/include/node -I/home/erik/.electron-gyp/28.3.3/src -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include -I/home/erik/.electron-gyp/28.3.3/deps/uv/include -I/home/erik/.electron-gyp/28.3.3/deps/zlib -I/home/erik/.electron-gyp/28.3.3/deps/v8/include -I../hidapi/hidapi -I/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -g -exceptions -m64 -O3 -fno-omit-frame-pointer -fno-rtti -std=gnu++17 -g -exceptions -MMD -MF ./Release/.deps/Release/obj.target/HID/src/read.o.d.raw -c +Release/obj.target/HID/src/read.o: ../src/read.cc ../src/read.h \ + ../src/util.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h \ + ../hidapi/hidapi/hidapi.h +../src/read.cc: +../src/read.h: +../src/util.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h: +../hidapi/hidapi/hidapi.h: diff --git a/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/util.o.d b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/util.o.d new file mode 100644 index 0000000..07cc251 --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID/src/util.o.d @@ -0,0 +1,20 @@ +cmd_Release/obj.target/HID/src/util.o := g++ -o Release/obj.target/HID/src/util.o ../src/util.cc '-DNODE_GYP_MODULE_NAME=HID' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DELECTRON_ENSURE_CONFIG_GYPI' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DUSING_ELECTRON_CONFIG_GYPI' '-DV8_COMPRESS_POINTERS' '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' '-DV8_ENABLE_SANDBOX' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DBUILDING_NODE_EXTENSION' -I/home/erik/.electron-gyp/28.3.3/include/node -I/home/erik/.electron-gyp/28.3.3/src -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include -I/home/erik/.electron-gyp/28.3.3/deps/uv/include -I/home/erik/.electron-gyp/28.3.3/deps/zlib -I/home/erik/.electron-gyp/28.3.3/deps/v8/include -I../hidapi/hidapi -I/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -g -exceptions -m64 -O3 -fno-omit-frame-pointer -fno-rtti -std=gnu++17 -g -exceptions -MMD -MF ./Release/.deps/Release/obj.target/HID/src/util.o.d.raw -c +Release/obj.target/HID/src/util.o: ../src/util.cc ../src/util.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h \ + ../hidapi/hidapi/hidapi.h +../src/util.cc: +../src/util.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h: +../hidapi/hidapi/hidapi.h: diff --git a/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw.node.d b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw.node.d new file mode 100644 index 0000000..3db64ac --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw.node.d @@ -0,0 +1 @@ +cmd_Release/obj.target/HID_hidraw.node := g++ -o Release/obj.target/HID_hidraw.node -shared -pthread -rdynamic -m64 -Wl,-soname=HID_hidraw.node -Wl,--start-group Release/obj.target/HID_hidraw/src/exports.o Release/obj.target/HID_hidraw/src/HID.o Release/obj.target/HID_hidraw/src/HIDAsync.o Release/obj.target/HID_hidraw/src/devices.o Release/obj.target/HID_hidraw/src/read.o Release/obj.target/HID_hidraw/src/util.o Release/obj.target/hidapi-linux-hidraw.a -Wl,--end-group -ludev -lusb-1.0 diff --git a/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/HID.o.d b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/HID.o.d new file mode 100644 index 0000000..f625c24 --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/HID.o.d @@ -0,0 +1,23 @@ +cmd_Release/obj.target/HID_hidraw/src/HID.o := g++ -o Release/obj.target/HID_hidraw/src/HID.o ../src/HID.cc '-DNODE_GYP_MODULE_NAME=HID_hidraw' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DELECTRON_ENSURE_CONFIG_GYPI' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DUSING_ELECTRON_CONFIG_GYPI' '-DV8_COMPRESS_POINTERS' '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' '-DV8_ENABLE_SANDBOX' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DBUILDING_NODE_EXTENSION' -I/home/erik/.electron-gyp/28.3.3/include/node -I/home/erik/.electron-gyp/28.3.3/src -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include -I/home/erik/.electron-gyp/28.3.3/deps/uv/include -I/home/erik/.electron-gyp/28.3.3/deps/zlib -I/home/erik/.electron-gyp/28.3.3/deps/v8/include -I../hidapi/hidapi -I/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -g -exceptions -m64 -O3 -fno-omit-frame-pointer -fno-rtti -std=gnu++17 -g -exceptions -MMD -MF ./Release/.deps/Release/obj.target/HID_hidraw/src/HID.o.d.raw -c +Release/obj.target/HID_hidraw/src/HID.o: ../src/HID.cc ../src/devices.h \ + ../src/util.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h \ + ../hidapi/hidapi/hidapi.h ../src/HID.h +../src/HID.cc: +../src/devices.h: +../src/util.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h: +../hidapi/hidapi/hidapi.h: +../src/HID.h: diff --git a/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/HIDAsync.o.d b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/HIDAsync.o.d new file mode 100644 index 0000000..2838271 --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/HIDAsync.o.d @@ -0,0 +1,24 @@ +cmd_Release/obj.target/HID_hidraw/src/HIDAsync.o := g++ -o Release/obj.target/HID_hidraw/src/HIDAsync.o ../src/HIDAsync.cc '-DNODE_GYP_MODULE_NAME=HID_hidraw' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DELECTRON_ENSURE_CONFIG_GYPI' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DUSING_ELECTRON_CONFIG_GYPI' '-DV8_COMPRESS_POINTERS' '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' '-DV8_ENABLE_SANDBOX' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DBUILDING_NODE_EXTENSION' -I/home/erik/.electron-gyp/28.3.3/include/node -I/home/erik/.electron-gyp/28.3.3/src -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include -I/home/erik/.electron-gyp/28.3.3/deps/uv/include -I/home/erik/.electron-gyp/28.3.3/deps/zlib -I/home/erik/.electron-gyp/28.3.3/deps/v8/include -I../hidapi/hidapi -I/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -g -exceptions -m64 -O3 -fno-omit-frame-pointer -fno-rtti -std=gnu++17 -g -exceptions -MMD -MF ./Release/.deps/Release/obj.target/HID_hidraw/src/HIDAsync.o.d.raw -c +Release/obj.target/HID_hidraw/src/HIDAsync.o: ../src/HIDAsync.cc \ + ../src/devices.h ../src/util.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h \ + ../hidapi/hidapi/hidapi.h ../src/HIDAsync.h ../src/read.h +../src/HIDAsync.cc: +../src/devices.h: +../src/util.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h: +../hidapi/hidapi/hidapi.h: +../src/HIDAsync.h: +../src/read.h: diff --git a/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/devices.o.d b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/devices.o.d new file mode 100644 index 0000000..2bbde5d --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/devices.o.d @@ -0,0 +1,22 @@ +cmd_Release/obj.target/HID_hidraw/src/devices.o := g++ -o Release/obj.target/HID_hidraw/src/devices.o ../src/devices.cc '-DNODE_GYP_MODULE_NAME=HID_hidraw' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DELECTRON_ENSURE_CONFIG_GYPI' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DUSING_ELECTRON_CONFIG_GYPI' '-DV8_COMPRESS_POINTERS' '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' '-DV8_ENABLE_SANDBOX' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DBUILDING_NODE_EXTENSION' -I/home/erik/.electron-gyp/28.3.3/include/node -I/home/erik/.electron-gyp/28.3.3/src -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include -I/home/erik/.electron-gyp/28.3.3/deps/uv/include -I/home/erik/.electron-gyp/28.3.3/deps/zlib -I/home/erik/.electron-gyp/28.3.3/deps/v8/include -I../hidapi/hidapi -I/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -g -exceptions -m64 -O3 -fno-omit-frame-pointer -fno-rtti -std=gnu++17 -g -exceptions -MMD -MF ./Release/.deps/Release/obj.target/HID_hidraw/src/devices.o.d.raw -c +Release/obj.target/HID_hidraw/src/devices.o: ../src/devices.cc \ + ../src/devices.h ../src/util.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h \ + ../hidapi/hidapi/hidapi.h +../src/devices.cc: +../src/devices.h: +../src/util.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h: +../hidapi/hidapi/hidapi.h: diff --git a/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/exports.o.d b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/exports.o.d new file mode 100644 index 0000000..9c7947d --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/exports.o.d @@ -0,0 +1,26 @@ +cmd_Release/obj.target/HID_hidraw/src/exports.o := g++ -o Release/obj.target/HID_hidraw/src/exports.o ../src/exports.cc '-DNODE_GYP_MODULE_NAME=HID_hidraw' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DELECTRON_ENSURE_CONFIG_GYPI' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DUSING_ELECTRON_CONFIG_GYPI' '-DV8_COMPRESS_POINTERS' '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' '-DV8_ENABLE_SANDBOX' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DBUILDING_NODE_EXTENSION' -I/home/erik/.electron-gyp/28.3.3/include/node -I/home/erik/.electron-gyp/28.3.3/src -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include -I/home/erik/.electron-gyp/28.3.3/deps/uv/include -I/home/erik/.electron-gyp/28.3.3/deps/zlib -I/home/erik/.electron-gyp/28.3.3/deps/v8/include -I../hidapi/hidapi -I/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -g -exceptions -m64 -O3 -fno-omit-frame-pointer -fno-rtti -std=gnu++17 -g -exceptions -MMD -MF ./Release/.deps/Release/obj.target/HID_hidraw/src/exports.o.d.raw -c +Release/obj.target/HID_hidraw/src/exports.o: ../src/exports.cc \ + ../src/util.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h \ + ../hidapi/hidapi/hidapi.h ../src/HID.h ../src/HIDAsync.h ../src/read.h \ + ../src/devices.h +../src/exports.cc: +../src/util.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h: +../hidapi/hidapi/hidapi.h: +../src/HID.h: +../src/HIDAsync.h: +../src/read.h: +../src/devices.h: diff --git a/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/read.o.d b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/read.o.d new file mode 100644 index 0000000..c272af0 --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/read.o.d @@ -0,0 +1,22 @@ +cmd_Release/obj.target/HID_hidraw/src/read.o := g++ -o Release/obj.target/HID_hidraw/src/read.o ../src/read.cc '-DNODE_GYP_MODULE_NAME=HID_hidraw' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DELECTRON_ENSURE_CONFIG_GYPI' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DUSING_ELECTRON_CONFIG_GYPI' '-DV8_COMPRESS_POINTERS' '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' '-DV8_ENABLE_SANDBOX' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DBUILDING_NODE_EXTENSION' -I/home/erik/.electron-gyp/28.3.3/include/node -I/home/erik/.electron-gyp/28.3.3/src -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include -I/home/erik/.electron-gyp/28.3.3/deps/uv/include -I/home/erik/.electron-gyp/28.3.3/deps/zlib -I/home/erik/.electron-gyp/28.3.3/deps/v8/include -I../hidapi/hidapi -I/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -g -exceptions -m64 -O3 -fno-omit-frame-pointer -fno-rtti -std=gnu++17 -g -exceptions -MMD -MF ./Release/.deps/Release/obj.target/HID_hidraw/src/read.o.d.raw -c +Release/obj.target/HID_hidraw/src/read.o: ../src/read.cc ../src/read.h \ + ../src/util.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h \ + ../hidapi/hidapi/hidapi.h +../src/read.cc: +../src/read.h: +../src/util.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h: +../hidapi/hidapi/hidapi.h: diff --git a/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/util.o.d b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/util.o.d new file mode 100644 index 0000000..d9858a7 --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/obj.target/HID_hidraw/src/util.o.d @@ -0,0 +1,20 @@ +cmd_Release/obj.target/HID_hidraw/src/util.o := g++ -o Release/obj.target/HID_hidraw/src/util.o ../src/util.cc '-DNODE_GYP_MODULE_NAME=HID_hidraw' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DELECTRON_ENSURE_CONFIG_GYPI' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DUSING_ELECTRON_CONFIG_GYPI' '-DV8_COMPRESS_POINTERS' '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' '-DV8_ENABLE_SANDBOX' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DBUILDING_NODE_EXTENSION' -I/home/erik/.electron-gyp/28.3.3/include/node -I/home/erik/.electron-gyp/28.3.3/src -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include -I/home/erik/.electron-gyp/28.3.3/deps/uv/include -I/home/erik/.electron-gyp/28.3.3/deps/zlib -I/home/erik/.electron-gyp/28.3.3/deps/v8/include -I../hidapi/hidapi -I/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -g -exceptions -m64 -O3 -fno-omit-frame-pointer -fno-rtti -std=gnu++17 -g -exceptions -MMD -MF ./Release/.deps/Release/obj.target/HID_hidraw/src/util.o.d.raw -c +Release/obj.target/HID_hidraw/src/util.o: ../src/util.cc ../src/util.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h \ + /home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h \ + /home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h \ + /home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h \ + ../hidapi/hidapi/hidapi.h +../src/util.cc: +../src/util.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api.h: +/home/erik/.electron-gyp/28.3.3/include/node/js_native_api_types.h: +/home/erik/.electron-gyp/28.3.3/include/node/node_api_types.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.h: +/home/erik/Git/PackControl/node_modules/node-hid/node_modules/node-addon-api/napi-inl.deprecated.h: +../hidapi/hidapi/hidapi.h: diff --git a/node_modules/node-hid/build/Release/.deps/Release/obj.target/hidapi-linux-hidraw/hidapi/linux/hid.o.d b/node_modules/node-hid/build/Release/.deps/Release/obj.target/hidapi-linux-hidraw/hidapi/linux/hid.o.d new file mode 100644 index 0000000..a5c9e82 --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/obj.target/hidapi-linux-hidraw/hidapi/linux/hid.o.d @@ -0,0 +1,5 @@ +cmd_Release/obj.target/hidapi-linux-hidraw/hidapi/linux/hid.o := cc -o Release/obj.target/hidapi-linux-hidraw/hidapi/linux/hid.o ../hidapi/linux/hid.c '-DNODE_GYP_MODULE_NAME=hidapi-linux-hidraw' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DELECTRON_ENSURE_CONFIG_GYPI' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DUSING_ELECTRON_CONFIG_GYPI' '-DV8_COMPRESS_POINTERS' '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' '-DV8_ENABLE_SANDBOX' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' -I/home/erik/.electron-gyp/28.3.3/include/node -I/home/erik/.electron-gyp/28.3.3/src -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include -I/home/erik/.electron-gyp/28.3.3/deps/uv/include -I/home/erik/.electron-gyp/28.3.3/deps/zlib -I/home/erik/.electron-gyp/28.3.3/deps/v8/include -I../hidapi/hidapi -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -g -m64 -O3 -fno-omit-frame-pointer -MMD -MF ./Release/.deps/Release/obj.target/hidapi-linux-hidraw/hidapi/linux/hid.o.d.raw -c +Release/obj.target/hidapi-linux-hidraw/hidapi/linux/hid.o: \ + ../hidapi/linux/hid.c ../hidapi/hidapi/hidapi.h +../hidapi/linux/hid.c: +../hidapi/hidapi/hidapi.h: diff --git a/node_modules/node-hid/build/Release/.deps/Release/obj.target/hidapi/hidapi/libusb/hid.o.d b/node_modules/node-hid/build/Release/.deps/Release/obj.target/hidapi/hidapi/libusb/hid.o.d new file mode 100644 index 0000000..e79634e --- /dev/null +++ b/node_modules/node-hid/build/Release/.deps/Release/obj.target/hidapi/hidapi/libusb/hid.o.d @@ -0,0 +1,9 @@ +cmd_Release/obj.target/hidapi/hidapi/libusb/hid.o := cc -o Release/obj.target/hidapi/hidapi/libusb/hid.o ../hidapi/libusb/hid.c '-DNODE_GYP_MODULE_NAME=hidapi' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DELECTRON_ENSURE_CONFIG_GYPI' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DUSING_ELECTRON_CONFIG_GYPI' '-DV8_COMPRESS_POINTERS' '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' '-DV8_ENABLE_SANDBOX' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' -I/home/erik/.electron-gyp/28.3.3/include/node -I/home/erik/.electron-gyp/28.3.3/src -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include -I/home/erik/.electron-gyp/28.3.3/deps/uv/include -I/home/erik/.electron-gyp/28.3.3/deps/zlib -I/home/erik/.electron-gyp/28.3.3/deps/v8/include -I../hidapi/hidapi -I/usr/include/libusb-1.0 -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -g -m64 -O3 -fno-omit-frame-pointer -MMD -MF ./Release/.deps/Release/obj.target/hidapi/hidapi/libusb/hid.o.d.raw -c +Release/obj.target/hidapi/hidapi/libusb/hid.o: ../hidapi/libusb/hid.c \ + /usr/include/libusb-1.0/libusb.h ../hidapi/libusb/hidapi_libusb.h \ + ../hidapi/hidapi/hidapi.h ../hidapi/libusb/hidapi_thread_pthread.h +../hidapi/libusb/hid.c: +/usr/include/libusb-1.0/libusb.h: +../hidapi/libusb/hidapi_libusb.h: +../hidapi/hidapi/hidapi.h: +../hidapi/libusb/hidapi_thread_pthread.h: diff --git a/node_modules/node-hid/build/Release/HID.node b/node_modules/node-hid/build/Release/HID.node new file mode 100755 index 0000000..4034037 Binary files /dev/null and b/node_modules/node-hid/build/Release/HID.node differ diff --git a/node_modules/node-hid/build/Release/HID_hidraw.node b/node_modules/node-hid/build/Release/HID_hidraw.node new file mode 100755 index 0000000..00acbe7 Binary files /dev/null and b/node_modules/node-hid/build/Release/HID_hidraw.node differ diff --git a/node_modules/node-hid/build/Release/hidapi-linux-hidraw.a b/node_modules/node-hid/build/Release/hidapi-linux-hidraw.a new file mode 100644 index 0000000..e9245ac Binary files /dev/null and b/node_modules/node-hid/build/Release/hidapi-linux-hidraw.a differ diff --git a/node_modules/node-hid/build/Release/hidapi.a b/node_modules/node-hid/build/Release/hidapi.a new file mode 100644 index 0000000..5c16695 Binary files /dev/null and b/node_modules/node-hid/build/Release/hidapi.a differ diff --git a/node_modules/node-hid/build/Release/obj.target/HID.node b/node_modules/node-hid/build/Release/obj.target/HID.node new file mode 100755 index 0000000..4034037 Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/HID.node differ diff --git a/node_modules/node-hid/build/Release/obj.target/HID/src/HID.o b/node_modules/node-hid/build/Release/obj.target/HID/src/HID.o new file mode 100644 index 0000000..4fe7076 Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/HID/src/HID.o differ diff --git a/node_modules/node-hid/build/Release/obj.target/HID/src/HIDAsync.o b/node_modules/node-hid/build/Release/obj.target/HID/src/HIDAsync.o new file mode 100644 index 0000000..9f389ed Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/HID/src/HIDAsync.o differ diff --git a/node_modules/node-hid/build/Release/obj.target/HID/src/devices.o b/node_modules/node-hid/build/Release/obj.target/HID/src/devices.o new file mode 100644 index 0000000..a0045c5 Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/HID/src/devices.o differ diff --git a/node_modules/node-hid/build/Release/obj.target/HID/src/exports.o b/node_modules/node-hid/build/Release/obj.target/HID/src/exports.o new file mode 100644 index 0000000..cf914d9 Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/HID/src/exports.o differ diff --git a/node_modules/node-hid/build/Release/obj.target/HID/src/read.o b/node_modules/node-hid/build/Release/obj.target/HID/src/read.o new file mode 100644 index 0000000..12d7875 Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/HID/src/read.o differ diff --git a/node_modules/node-hid/build/Release/obj.target/HID/src/util.o b/node_modules/node-hid/build/Release/obj.target/HID/src/util.o new file mode 100644 index 0000000..a4e75f2 Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/HID/src/util.o differ diff --git a/node_modules/node-hid/build/Release/obj.target/HID_hidraw.node b/node_modules/node-hid/build/Release/obj.target/HID_hidraw.node new file mode 100755 index 0000000..00acbe7 Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/HID_hidraw.node differ diff --git a/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/HID.o b/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/HID.o new file mode 100644 index 0000000..4fe7076 Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/HID.o differ diff --git a/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/HIDAsync.o b/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/HIDAsync.o new file mode 100644 index 0000000..9f389ed Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/HIDAsync.o differ diff --git a/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/devices.o b/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/devices.o new file mode 100644 index 0000000..a0045c5 Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/devices.o differ diff --git a/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/exports.o b/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/exports.o new file mode 100644 index 0000000..cf914d9 Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/exports.o differ diff --git a/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/read.o b/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/read.o new file mode 100644 index 0000000..12d7875 Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/read.o differ diff --git a/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/util.o b/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/util.o new file mode 100644 index 0000000..a4e75f2 Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/HID_hidraw/src/util.o differ diff --git a/node_modules/node-hid/build/Release/obj.target/hidapi-linux-hidraw.a b/node_modules/node-hid/build/Release/obj.target/hidapi-linux-hidraw.a new file mode 100644 index 0000000..e9245ac Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/hidapi-linux-hidraw.a differ diff --git a/node_modules/node-hid/build/Release/obj.target/hidapi-linux-hidraw.a.ar-file-list b/node_modules/node-hid/build/Release/obj.target/hidapi-linux-hidraw.a.ar-file-list new file mode 100644 index 0000000..10a457e --- /dev/null +++ b/node_modules/node-hid/build/Release/obj.target/hidapi-linux-hidraw.a.ar-file-list @@ -0,0 +1 @@ +Release/obj.target/hidapi-linux-hidraw/hidapi/linux/hid.o diff --git a/node_modules/node-hid/build/Release/obj.target/hidapi-linux-hidraw/hidapi/linux/hid.o b/node_modules/node-hid/build/Release/obj.target/hidapi-linux-hidraw/hidapi/linux/hid.o new file mode 100644 index 0000000..9051dad Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/hidapi-linux-hidraw/hidapi/linux/hid.o differ diff --git a/node_modules/node-hid/build/Release/obj.target/hidapi.a b/node_modules/node-hid/build/Release/obj.target/hidapi.a new file mode 100644 index 0000000..5c16695 Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/hidapi.a differ diff --git a/node_modules/node-hid/build/Release/obj.target/hidapi.a.ar-file-list b/node_modules/node-hid/build/Release/obj.target/hidapi.a.ar-file-list new file mode 100644 index 0000000..fcf8a24 --- /dev/null +++ b/node_modules/node-hid/build/Release/obj.target/hidapi.a.ar-file-list @@ -0,0 +1 @@ +Release/obj.target/hidapi/hidapi/libusb/hid.o diff --git a/node_modules/node-hid/build/Release/obj.target/hidapi/hidapi/libusb/hid.o b/node_modules/node-hid/build/Release/obj.target/hidapi/hidapi/libusb/hid.o new file mode 100644 index 0000000..7a6548a Binary files /dev/null and b/node_modules/node-hid/build/Release/obj.target/hidapi/hidapi/libusb/hid.o differ diff --git a/node_modules/node-hid/build/binding.Makefile b/node_modules/node-hid/build/binding.Makefile new file mode 100644 index 0000000..98b2d17 --- /dev/null +++ b/node_modules/node-hid/build/binding.Makefile @@ -0,0 +1,6 @@ +# This file is generated by gyp; do not edit. + +export builddir_name ?= ./build/. +.PHONY: all +all: + $(MAKE) hidapi-linux-hidraw HID_hidraw hidapi HID diff --git a/node_modules/node-hid/build/config.gypi b/node_modules/node-hid/build/config.gypi new file mode 100644 index 0000000..9e530b9 --- /dev/null +++ b/node_modules/node-hid/build/config.gypi @@ -0,0 +1,428 @@ +# Do not edit. File was generated by node-gyp's "configure" step +{ + "target_defaults": { + "cflags": [], + "default_configuration": "Release", + "defines": [], + "include_dirs": [], + "libraries": [] + }, + "variables": { + "asan": 0, + "build_v8_with_gn": "false", + "built_with_electron": 1, + "coverage": "false", + "dcheck_always_on": 0, + "debug_nghttp2": "false", + "debug_node": "false", + "enable_lto": "false", + "enable_pgo_generate": "false", + "enable_pgo_use": "false", + "error_on_warn": "false", + "force_dynamic_crt": 0, + "host_arch": "x64", + "icu_data_in": "..\\..\\deps\\icu-tmp\\icudt73l.dat", + "icu_endianness": "l", + "icu_gyp_path": "tools/icu/icu-generic.gyp", + "icu_path": "deps/icu-small", + "icu_small": "false", + "icu_ver_major": "73", + "is_debug": 0, + "libdir": "lib", + "llvm_version": "0.0", + "napi_build_version": "9", + "node_builtin_shareable_builtins": [ + "deps/cjs-module-lexer/lexer.js", + "deps/cjs-module-lexer/dist/lexer.js", + "deps/undici/undici.js" + ], + "node_byteorder": "little", + "node_debug_lib": "false", + "node_enable_d8": "false", + "node_enable_v8_vtunejit": "false", + "node_fipsinstall": "false", + "node_install_corepack": "true", + "node_install_npm": "true", + "node_library_files": [ + "lib/_http_agent.js", + "lib/_http_client.js", + "lib/_http_common.js", + "lib/_http_incoming.js", + "lib/_http_outgoing.js", + "lib/_http_server.js", + "lib/_stream_duplex.js", + "lib/_stream_passthrough.js", + "lib/_stream_readable.js", + "lib/_stream_transform.js", + "lib/_stream_wrap.js", + "lib/_stream_writable.js", + "lib/_tls_common.js", + "lib/_tls_wrap.js", + "lib/assert.js", + "lib/assert/strict.js", + "lib/async_hooks.js", + "lib/buffer.js", + "lib/child_process.js", + "lib/cluster.js", + "lib/console.js", + "lib/constants.js", + "lib/crypto.js", + "lib/dgram.js", + "lib/diagnostics_channel.js", + "lib/dns.js", + "lib/dns/promises.js", + "lib/domain.js", + "lib/events.js", + "lib/fs.js", + "lib/fs/promises.js", + "lib/http.js", + "lib/http2.js", + "lib/https.js", + "lib/inspector.js", + "lib/internal/abort_controller.js", + "lib/internal/assert.js", + "lib/internal/assert/assertion_error.js", + "lib/internal/assert/calltracker.js", + "lib/internal/async_hooks.js", + "lib/internal/blob.js", + "lib/internal/blocklist.js", + "lib/internal/bootstrap/browser.js", + "lib/internal/bootstrap/loaders.js", + "lib/internal/bootstrap/node.js", + "lib/internal/bootstrap/switches/does_not_own_process_state.js", + "lib/internal/bootstrap/switches/does_own_process_state.js", + "lib/internal/bootstrap/switches/is_main_thread.js", + "lib/internal/bootstrap/switches/is_not_main_thread.js", + "lib/internal/buffer.js", + "lib/internal/child_process.js", + "lib/internal/child_process/serialization.js", + "lib/internal/cli_table.js", + "lib/internal/cluster/child.js", + "lib/internal/cluster/primary.js", + "lib/internal/cluster/round_robin_handle.js", + "lib/internal/cluster/shared_handle.js", + "lib/internal/cluster/utils.js", + "lib/internal/cluster/worker.js", + "lib/internal/console/constructor.js", + "lib/internal/console/global.js", + "lib/internal/constants.js", + "lib/internal/crypto/aes.js", + "lib/internal/crypto/certificate.js", + "lib/internal/crypto/cfrg.js", + "lib/internal/crypto/cipher.js", + "lib/internal/crypto/diffiehellman.js", + "lib/internal/crypto/ec.js", + "lib/internal/crypto/hash.js", + "lib/internal/crypto/hashnames.js", + "lib/internal/crypto/hkdf.js", + "lib/internal/crypto/keygen.js", + "lib/internal/crypto/keys.js", + "lib/internal/crypto/mac.js", + "lib/internal/crypto/pbkdf2.js", + "lib/internal/crypto/random.js", + "lib/internal/crypto/rsa.js", + "lib/internal/crypto/scrypt.js", + "lib/internal/crypto/sig.js", + "lib/internal/crypto/util.js", + "lib/internal/crypto/webcrypto.js", + "lib/internal/crypto/webidl.js", + "lib/internal/crypto/x509.js", + "lib/internal/debugger/inspect.js", + "lib/internal/debugger/inspect_client.js", + "lib/internal/debugger/inspect_repl.js", + "lib/internal/dgram.js", + "lib/internal/dns/callback_resolver.js", + "lib/internal/dns/promises.js", + "lib/internal/dns/utils.js", + "lib/internal/dtrace.js", + "lib/internal/encoding.js", + "lib/internal/error_serdes.js", + "lib/internal/errors.js", + "lib/internal/event_target.js", + "lib/internal/file.js", + "lib/internal/fixed_queue.js", + "lib/internal/freelist.js", + "lib/internal/freeze_intrinsics.js", + "lib/internal/fs/cp/cp-sync.js", + "lib/internal/fs/cp/cp.js", + "lib/internal/fs/dir.js", + "lib/internal/fs/promises.js", + "lib/internal/fs/read_file_context.js", + "lib/internal/fs/recursive_watch.js", + "lib/internal/fs/rimraf.js", + "lib/internal/fs/streams.js", + "lib/internal/fs/sync_write_stream.js", + "lib/internal/fs/utils.js", + "lib/internal/fs/watchers.js", + "lib/internal/heap_utils.js", + "lib/internal/histogram.js", + "lib/internal/http.js", + "lib/internal/http2/compat.js", + "lib/internal/http2/core.js", + "lib/internal/http2/util.js", + "lib/internal/idna.js", + "lib/internal/inspector_async_hook.js", + "lib/internal/js_stream_socket.js", + "lib/internal/legacy/processbinding.js", + "lib/internal/linkedlist.js", + "lib/internal/main/check_syntax.js", + "lib/internal/main/environment.js", + "lib/internal/main/eval_stdin.js", + "lib/internal/main/eval_string.js", + "lib/internal/main/inspect.js", + "lib/internal/main/mksnapshot.js", + "lib/internal/main/print_help.js", + "lib/internal/main/prof_process.js", + "lib/internal/main/repl.js", + "lib/internal/main/run_main_module.js", + "lib/internal/main/single_executable_application.js", + "lib/internal/main/test_runner.js", + "lib/internal/main/watch_mode.js", + "lib/internal/main/worker_thread.js", + "lib/internal/mime.js", + "lib/internal/modules/cjs/helpers.js", + "lib/internal/modules/cjs/loader.js", + "lib/internal/modules/esm/assert.js", + "lib/internal/modules/esm/create_dynamic_module.js", + "lib/internal/modules/esm/fetch_module.js", + "lib/internal/modules/esm/formats.js", + "lib/internal/modules/esm/get_format.js", + "lib/internal/modules/esm/handle_process_exit.js", + "lib/internal/modules/esm/initialize_import_meta.js", + "lib/internal/modules/esm/load.js", + "lib/internal/modules/esm/loader.js", + "lib/internal/modules/esm/module_job.js", + "lib/internal/modules/esm/module_map.js", + "lib/internal/modules/esm/package_config.js", + "lib/internal/modules/esm/resolve.js", + "lib/internal/modules/esm/translators.js", + "lib/internal/modules/esm/utils.js", + "lib/internal/modules/package_json_reader.js", + "lib/internal/modules/run_main.js", + "lib/internal/net.js", + "lib/internal/options.js", + "lib/internal/per_context/domexception.js", + "lib/internal/per_context/messageport.js", + "lib/internal/per_context/primordials.js", + "lib/internal/perf/event_loop_delay.js", + "lib/internal/perf/event_loop_utilization.js", + "lib/internal/perf/nodetiming.js", + "lib/internal/perf/observe.js", + "lib/internal/perf/performance.js", + "lib/internal/perf/performance_entry.js", + "lib/internal/perf/resource_timing.js", + "lib/internal/perf/timerify.js", + "lib/internal/perf/usertiming.js", + "lib/internal/perf/utils.js", + "lib/internal/policy/manifest.js", + "lib/internal/policy/sri.js", + "lib/internal/priority_queue.js", + "lib/internal/process/esm_loader.js", + "lib/internal/process/execution.js", + "lib/internal/process/per_thread.js", + "lib/internal/process/policy.js", + "lib/internal/process/pre_execution.js", + "lib/internal/process/promises.js", + "lib/internal/process/report.js", + "lib/internal/process/signal.js", + "lib/internal/process/task_queues.js", + "lib/internal/process/warning.js", + "lib/internal/process/worker_thread_only.js", + "lib/internal/promise_hooks.js", + "lib/internal/querystring.js", + "lib/internal/readline/callbacks.js", + "lib/internal/readline/emitKeypressEvents.js", + "lib/internal/readline/interface.js", + "lib/internal/readline/promises.js", + "lib/internal/readline/utils.js", + "lib/internal/repl.js", + "lib/internal/repl/await.js", + "lib/internal/repl/history.js", + "lib/internal/repl/utils.js", + "lib/internal/socket_list.js", + "lib/internal/socketaddress.js", + "lib/internal/source_map/prepare_stack_trace.js", + "lib/internal/source_map/source_map.js", + "lib/internal/source_map/source_map_cache.js", + "lib/internal/stream_base_commons.js", + "lib/internal/streams/add-abort-signal.js", + "lib/internal/streams/buffer_list.js", + "lib/internal/streams/compose.js", + "lib/internal/streams/destroy.js", + "lib/internal/streams/duplex.js", + "lib/internal/streams/duplexify.js", + "lib/internal/streams/end-of-stream.js", + "lib/internal/streams/from.js", + "lib/internal/streams/lazy_transform.js", + "lib/internal/streams/legacy.js", + "lib/internal/streams/operators.js", + "lib/internal/streams/passthrough.js", + "lib/internal/streams/pipeline.js", + "lib/internal/streams/readable.js", + "lib/internal/streams/state.js", + "lib/internal/streams/transform.js", + "lib/internal/streams/utils.js", + "lib/internal/streams/writable.js", + "lib/internal/structured_clone.js", + "lib/internal/test/binding.js", + "lib/internal/test/transfer.js", + "lib/internal/test_runner/coverage.js", + "lib/internal/test_runner/harness.js", + "lib/internal/test_runner/mock.js", + "lib/internal/test_runner/reporter/dot.js", + "lib/internal/test_runner/reporter/spec.js", + "lib/internal/test_runner/reporter/tap.js", + "lib/internal/test_runner/reporter/v8-serializer.js", + "lib/internal/test_runner/runner.js", + "lib/internal/test_runner/test.js", + "lib/internal/test_runner/tests_stream.js", + "lib/internal/test_runner/utils.js", + "lib/internal/timers.js", + "lib/internal/tls/secure-context.js", + "lib/internal/tls/secure-pair.js", + "lib/internal/trace_events_async_hooks.js", + "lib/internal/tty.js", + "lib/internal/url.js", + "lib/internal/util.js", + "lib/internal/util/colors.js", + "lib/internal/util/comparisons.js", + "lib/internal/util/debuglog.js", + "lib/internal/util/inspect.js", + "lib/internal/util/inspector.js", + "lib/internal/util/iterable_weak_map.js", + "lib/internal/util/parse_args/parse_args.js", + "lib/internal/util/parse_args/utils.js", + "lib/internal/util/types.js", + "lib/internal/v8/startup_snapshot.js", + "lib/internal/v8_prof_polyfill.js", + "lib/internal/v8_prof_processor.js", + "lib/internal/validators.js", + "lib/internal/vm.js", + "lib/internal/vm/module.js", + "lib/internal/wasm_web_api.js", + "lib/internal/watch_mode/files_watcher.js", + "lib/internal/watchdog.js", + "lib/internal/webidl.js", + "lib/internal/webstreams/adapters.js", + "lib/internal/webstreams/compression.js", + "lib/internal/webstreams/encoding.js", + "lib/internal/webstreams/queuingstrategies.js", + "lib/internal/webstreams/readablestream.js", + "lib/internal/webstreams/transfer.js", + "lib/internal/webstreams/transformstream.js", + "lib/internal/webstreams/util.js", + "lib/internal/webstreams/writablestream.js", + "lib/internal/worker.js", + "lib/internal/worker/io.js", + "lib/internal/worker/js_transferable.js", + "lib/module.js", + "lib/net.js", + "lib/os.js", + "lib/path.js", + "lib/path/posix.js", + "lib/path/win32.js", + "lib/perf_hooks.js", + "lib/process.js", + "lib/punycode.js", + "lib/querystring.js", + "lib/readline.js", + "lib/readline/promises.js", + "lib/repl.js", + "lib/stream.js", + "lib/stream/consumers.js", + "lib/stream/promises.js", + "lib/stream/web.js", + "lib/string_decoder.js", + "lib/sys.js", + "lib/test.js", + "lib/test/reporters.js", + "lib/timers.js", + "lib/timers/promises.js", + "lib/tls.js", + "lib/trace_events.js", + "lib/tty.js", + "lib/url.js", + "lib/util.js", + "lib/util/types.js", + "lib/v8.js", + "lib/vm.js", + "lib/wasi.js", + "lib/worker_threads.js", + "lib/zlib.js" + ], + "node_module_version": 119, + "node_no_browser_globals": "false", + "node_prefix": "\\usr\\local", + "node_release_urlbase": "", + "node_shared": "false", + "node_shared_brotli": "false", + "node_shared_cares": "false", + "node_shared_http_parser": "false", + "node_shared_libuv": "false", + "node_shared_nghttp2": "false", + "node_shared_nghttp3": "false", + "node_shared_ngtcp2": "false", + "node_shared_openssl": "false", + "node_shared_zlib": "false", + "node_tag": "", + "node_target_type": "executable", + "node_use_bundled_v8": "true", + "node_use_dtrace": "false", + "node_use_etw": "true", + "node_use_node_code_cache": "true", + "node_use_node_snapshot": "true", + "node_use_openssl": "true", + "node_use_v8_platform": "true", + "node_with_ltcg": "true", + "node_without_node_options": "false", + "openssl_is_fips": "false", + "openssl_no_asm": 1, + "openssl_quic": "true", + "ossfuzz": "false", + "shlib_suffix": "so.108", + "single_executable_application": "true", + "target_arch": "x64", + "using_electron_config_gypi": 1, + "v8_enable_31bit_smis_on_64bit_arch": 1, + "v8_enable_gdbjit": 0, + "v8_enable_hugepage": 0, + "v8_enable_i18n_support": 1, + "v8_enable_inspector": 1, + "v8_enable_javascript_promise_hooks": 1, + "v8_enable_lite_mode": 0, + "v8_enable_object_print": 1, + "v8_enable_pointer_compression": 1, + "v8_enable_sandbox": 1, + "v8_enable_shared_ro_heap": 0, + "v8_enable_short_builtin_calls": 1, + "v8_enable_webassembly": 1, + "v8_no_strict_aliasing": 1, + "v8_optimized_debug": 1, + "v8_promise_internal_field_count": 1, + "v8_random_seed": 0, + "v8_trace_maps": 0, + "v8_use_siphash": 1, + "want_separate_host_toolset": 0, + "nodedir": "/home/erik/.electron-gyp/28.3.3", + "python": "/usr/bin/python3", + "standalone_static_library": 1, + "global_prefix": "/usr", + "disturl": "https://electronjs.org/headers", + "node_gyp": "/usr/lib/node_modules/node-gyp/bin/node-gyp.js", + "target": "28.3.3", + "platform": "linux", + "user_agent": "npm/11.10.1 node/v25.6.1 linux x64 workspaces/false", + "fallback_to_build": "true", + "update_binary": "true", + "prefix": "/usr", + "npm_version": "11.10.1", + "runtime": "electron", + "target_platform": "linux", + "init_module": "/home/erik/.npm-init.js", + "globalconfig": "/etc/npmrc", + "build_from_source": "false", + "local_prefix": "/home/erik/Git/PackControl", + "cache": "/home/erik/.npm", + "userconfig": "/home/erik/.npmrc" + } +} diff --git a/node_modules/node-hid/build/hidapi-linux-hidraw.target.mk b/node_modules/node-hid/build/hidapi-linux-hidraw.target.mk new file mode 100644 index 0000000..913c635 --- /dev/null +++ b/node_modules/node-hid/build/hidapi-linux-hidraw.target.mk @@ -0,0 +1,182 @@ +# This file is generated by gyp; do not edit. + +TOOLSET := target +TARGET := hidapi-linux-hidraw +DEFS_Debug := \ + '-DNODE_GYP_MODULE_NAME=hidapi-linux-hidraw' \ + '-DUSING_UV_SHARED=1' \ + '-DUSING_V8_SHARED=1' \ + '-DV8_DEPRECATION_WARNINGS=1' \ + '-DV8_DEPRECATION_WARNINGS' \ + '-DV8_IMMINENT_DEPRECATION_WARNINGS' \ + '-D_GLIBCXX_USE_CXX11_ABI=1' \ + '-DELECTRON_ENSURE_CONFIG_GYPI' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSING_ELECTRON_CONFIG_GYPI' \ + '-DV8_COMPRESS_POINTERS' \ + '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' \ + '-DV8_ENABLE_SANDBOX' \ + '-DV8_31BIT_SMIS_ON_64BIT_ARCH' \ + '-D__STDC_FORMAT_MACROS' \ + '-DOPENSSL_NO_PINSHARED' \ + '-DOPENSSL_THREADS' \ + '-DOPENSSL_NO_ASM' \ + '-DDEBUG' \ + '-D_DEBUG' \ + '-DV8_ENABLE_CHECKS' + +# Flags passed to all source files. +CFLAGS_Debug := \ + -fPIC \ + -pthread \ + -Wall \ + -Wextra \ + -Wno-unused-parameter \ + -g \ + -m64 \ + -g \ + -O0 + +# Flags passed to only C files. +CFLAGS_C_Debug := + +# Flags passed to only C++ files. +CFLAGS_CC_Debug := \ + -fno-rtti \ + -fno-exceptions \ + -std=gnu++17 + +INCS_Debug := \ + -I/home/erik/.electron-gyp/28.3.3/include/node \ + -I/home/erik/.electron-gyp/28.3.3/src \ + -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config \ + -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include \ + -I/home/erik/.electron-gyp/28.3.3/deps/uv/include \ + -I/home/erik/.electron-gyp/28.3.3/deps/zlib \ + -I/home/erik/.electron-gyp/28.3.3/deps/v8/include \ + -I$(srcdir)/hidapi/hidapi + +DEFS_Release := \ + '-DNODE_GYP_MODULE_NAME=hidapi-linux-hidraw' \ + '-DUSING_UV_SHARED=1' \ + '-DUSING_V8_SHARED=1' \ + '-DV8_DEPRECATION_WARNINGS=1' \ + '-DV8_DEPRECATION_WARNINGS' \ + '-DV8_IMMINENT_DEPRECATION_WARNINGS' \ + '-D_GLIBCXX_USE_CXX11_ABI=1' \ + '-DELECTRON_ENSURE_CONFIG_GYPI' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSING_ELECTRON_CONFIG_GYPI' \ + '-DV8_COMPRESS_POINTERS' \ + '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' \ + '-DV8_ENABLE_SANDBOX' \ + '-DV8_31BIT_SMIS_ON_64BIT_ARCH' \ + '-D__STDC_FORMAT_MACROS' \ + '-DOPENSSL_NO_PINSHARED' \ + '-DOPENSSL_THREADS' \ + '-DOPENSSL_NO_ASM' + +# Flags passed to all source files. +CFLAGS_Release := \ + -fPIC \ + -pthread \ + -Wall \ + -Wextra \ + -Wno-unused-parameter \ + -g \ + -m64 \ + -O3 \ + -fno-omit-frame-pointer + +# Flags passed to only C files. +CFLAGS_C_Release := + +# Flags passed to only C++ files. +CFLAGS_CC_Release := \ + -fno-rtti \ + -fno-exceptions \ + -std=gnu++17 + +INCS_Release := \ + -I/home/erik/.electron-gyp/28.3.3/include/node \ + -I/home/erik/.electron-gyp/28.3.3/src \ + -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config \ + -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include \ + -I/home/erik/.electron-gyp/28.3.3/deps/uv/include \ + -I/home/erik/.electron-gyp/28.3.3/deps/zlib \ + -I/home/erik/.electron-gyp/28.3.3/deps/v8/include \ + -I$(srcdir)/hidapi/hidapi + +OBJS := \ + $(obj).target/$(TARGET)/hidapi/linux/hid.o + +# Add to the list of files we specially track dependencies for. +all_deps += $(OBJS) + +# CFLAGS et al overrides must be target-local. +# See "Target-specific Variable Values" in the GNU Make manual. +$(OBJS): TOOLSET := $(TOOLSET) +$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) +$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) + +# Suffix rules, putting all outputs into $(obj). + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) + +# Try building from generated source, too. + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) + +# End of this set of suffix rules +### Rules for final target. +LDFLAGS_Debug := \ + -pthread \ + -rdynamic \ + -m64 + +LDFLAGS_Release := \ + -pthread \ + -rdynamic \ + -m64 + +LIBS := + +$(obj).target/hidapi-linux-hidraw.a: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) +$(obj).target/hidapi-linux-hidraw.a: LIBS := $(LIBS) +$(obj).target/hidapi-linux-hidraw.a: TOOLSET := $(TOOLSET) +$(obj).target/hidapi-linux-hidraw.a: $(OBJS) + $(call create_archive,$@,$^) + +# Add target alias +.PHONY: hidapi-linux-hidraw +hidapi-linux-hidraw: $(obj).target/hidapi-linux-hidraw.a + +# Add target alias to "all" target. +.PHONY: all +all: hidapi-linux-hidraw + +# Add target alias +.PHONY: hidapi-linux-hidraw +hidapi-linux-hidraw: $(builddir)/hidapi-linux-hidraw.a + +# Copy this to the static library output path. +$(builddir)/hidapi-linux-hidraw.a: TOOLSET := $(TOOLSET) +$(builddir)/hidapi-linux-hidraw.a: $(obj).target/hidapi-linux-hidraw.a FORCE_DO_CMD + $(call do_cmd,copy) + +all_deps += $(builddir)/hidapi-linux-hidraw.a +# Short alias for building this static library. +.PHONY: hidapi-linux-hidraw.a +hidapi-linux-hidraw.a: $(obj).target/hidapi-linux-hidraw.a $(builddir)/hidapi-linux-hidraw.a + +# Add static library to "all" target. +.PHONY: all +all: $(builddir)/hidapi-linux-hidraw.a + diff --git a/node_modules/node-hid/build/hidapi.target.mk b/node_modules/node-hid/build/hidapi.target.mk new file mode 100644 index 0000000..ced5e16 --- /dev/null +++ b/node_modules/node-hid/build/hidapi.target.mk @@ -0,0 +1,184 @@ +# This file is generated by gyp; do not edit. + +TOOLSET := target +TARGET := hidapi +DEFS_Debug := \ + '-DNODE_GYP_MODULE_NAME=hidapi' \ + '-DUSING_UV_SHARED=1' \ + '-DUSING_V8_SHARED=1' \ + '-DV8_DEPRECATION_WARNINGS=1' \ + '-DV8_DEPRECATION_WARNINGS' \ + '-DV8_IMMINENT_DEPRECATION_WARNINGS' \ + '-D_GLIBCXX_USE_CXX11_ABI=1' \ + '-DELECTRON_ENSURE_CONFIG_GYPI' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSING_ELECTRON_CONFIG_GYPI' \ + '-DV8_COMPRESS_POINTERS' \ + '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' \ + '-DV8_ENABLE_SANDBOX' \ + '-DV8_31BIT_SMIS_ON_64BIT_ARCH' \ + '-D__STDC_FORMAT_MACROS' \ + '-DOPENSSL_NO_PINSHARED' \ + '-DOPENSSL_THREADS' \ + '-DOPENSSL_NO_ASM' \ + '-DDEBUG' \ + '-D_DEBUG' \ + '-DV8_ENABLE_CHECKS' + +# Flags passed to all source files. +CFLAGS_Debug := \ + -fPIC \ + -pthread \ + -Wall \ + -Wextra \ + -Wno-unused-parameter \ + -g \ + -m64 \ + -g \ + -O0 + +# Flags passed to only C files. +CFLAGS_C_Debug := + +# Flags passed to only C++ files. +CFLAGS_CC_Debug := \ + -fno-rtti \ + -fno-exceptions \ + -std=gnu++17 + +INCS_Debug := \ + -I/home/erik/.electron-gyp/28.3.3/include/node \ + -I/home/erik/.electron-gyp/28.3.3/src \ + -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config \ + -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include \ + -I/home/erik/.electron-gyp/28.3.3/deps/uv/include \ + -I/home/erik/.electron-gyp/28.3.3/deps/zlib \ + -I/home/erik/.electron-gyp/28.3.3/deps/v8/include \ + -I$(srcdir)/hidapi/hidapi \ + -I/usr/include/libusb-1.0 + +DEFS_Release := \ + '-DNODE_GYP_MODULE_NAME=hidapi' \ + '-DUSING_UV_SHARED=1' \ + '-DUSING_V8_SHARED=1' \ + '-DV8_DEPRECATION_WARNINGS=1' \ + '-DV8_DEPRECATION_WARNINGS' \ + '-DV8_IMMINENT_DEPRECATION_WARNINGS' \ + '-D_GLIBCXX_USE_CXX11_ABI=1' \ + '-DELECTRON_ENSURE_CONFIG_GYPI' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSING_ELECTRON_CONFIG_GYPI' \ + '-DV8_COMPRESS_POINTERS' \ + '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' \ + '-DV8_ENABLE_SANDBOX' \ + '-DV8_31BIT_SMIS_ON_64BIT_ARCH' \ + '-D__STDC_FORMAT_MACROS' \ + '-DOPENSSL_NO_PINSHARED' \ + '-DOPENSSL_THREADS' \ + '-DOPENSSL_NO_ASM' + +# Flags passed to all source files. +CFLAGS_Release := \ + -fPIC \ + -pthread \ + -Wall \ + -Wextra \ + -Wno-unused-parameter \ + -g \ + -m64 \ + -O3 \ + -fno-omit-frame-pointer + +# Flags passed to only C files. +CFLAGS_C_Release := + +# Flags passed to only C++ files. +CFLAGS_CC_Release := \ + -fno-rtti \ + -fno-exceptions \ + -std=gnu++17 + +INCS_Release := \ + -I/home/erik/.electron-gyp/28.3.3/include/node \ + -I/home/erik/.electron-gyp/28.3.3/src \ + -I/home/erik/.electron-gyp/28.3.3/deps/openssl/config \ + -I/home/erik/.electron-gyp/28.3.3/deps/openssl/openssl/include \ + -I/home/erik/.electron-gyp/28.3.3/deps/uv/include \ + -I/home/erik/.electron-gyp/28.3.3/deps/zlib \ + -I/home/erik/.electron-gyp/28.3.3/deps/v8/include \ + -I$(srcdir)/hidapi/hidapi \ + -I/usr/include/libusb-1.0 + +OBJS := \ + $(obj).target/$(TARGET)/hidapi/libusb/hid.o + +# Add to the list of files we specially track dependencies for. +all_deps += $(OBJS) + +# CFLAGS et al overrides must be target-local. +# See "Target-specific Variable Values" in the GNU Make manual. +$(OBJS): TOOLSET := $(TOOLSET) +$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) +$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) + +# Suffix rules, putting all outputs into $(obj). + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) + +# Try building from generated source, too. + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) + +# End of this set of suffix rules +### Rules for final target. +LDFLAGS_Debug := \ + -pthread \ + -rdynamic \ + -m64 + +LDFLAGS_Release := \ + -pthread \ + -rdynamic \ + -m64 + +LIBS := + +$(obj).target/hidapi.a: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) +$(obj).target/hidapi.a: LIBS := $(LIBS) +$(obj).target/hidapi.a: TOOLSET := $(TOOLSET) +$(obj).target/hidapi.a: $(OBJS) + $(call create_archive,$@,$^) + +# Add target alias +.PHONY: hidapi +hidapi: $(obj).target/hidapi.a + +# Add target alias to "all" target. +.PHONY: all +all: hidapi + +# Add target alias +.PHONY: hidapi +hidapi: $(builddir)/hidapi.a + +# Copy this to the static library output path. +$(builddir)/hidapi.a: TOOLSET := $(TOOLSET) +$(builddir)/hidapi.a: $(obj).target/hidapi.a FORCE_DO_CMD + $(call do_cmd,copy) + +all_deps += $(builddir)/hidapi.a +# Short alias for building this static library. +.PHONY: hidapi.a +hidapi.a: $(obj).target/hidapi.a $(builddir)/hidapi.a + +# Add static library to "all" target. +.PHONY: all +all: $(builddir)/hidapi.a + diff --git a/node_modules/node-hid/hidapi/.appveyor.yml b/node_modules/node-hid/hidapi/.appveyor.yml new file mode 100644 index 0000000..210b3fa --- /dev/null +++ b/node_modules/node-hid/hidapi/.appveyor.yml @@ -0,0 +1,31 @@ +environment: + matrix: + - BUILD_ENV: msbuild + arch: x64 + - BUILD_ENV: msbuild + arch: Win32 + - BUILD_ENV: cygwin + +for: + - + matrix: + only: + - BUILD_ENV: msbuild + + os: Visual Studio 2015 + + build_script: + - cmd: msbuild .\windows\hidapi.sln /p:Configuration=Release /p:Platform=%arch% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + + - + matrix: + only: + - BUILD_ENV: cygwin + + os: Visual Studio 2022 + + install: + - cmd: C:\cygwin64\setup-x86_64.exe --quiet-mode --no-shortcuts --upgrade-also --packages autoconf,automake + + build_script: + - cmd: C:\cygwin64\bin\bash -exlc "cd $APPVEYOR_BUILD_FOLDER; ./bootstrap; ./configure; make" diff --git a/node_modules/node-hid/hidapi/.builds/freebsd.yml b/node_modules/node-hid/hidapi/.builds/freebsd.yml new file mode 100644 index 0000000..1679b03 --- /dev/null +++ b/node_modules/node-hid/hidapi/.builds/freebsd.yml @@ -0,0 +1,34 @@ +image: freebsd/latest +packages: +- autoconf +- automake +- gmake +- libiconv +- libtool +- pkgconf +- cmake +- ninja +sources: +- https://github.com/libusb/hidapi +tasks: +- configure: | + cd hidapi + echo Configure Autotools build + ./bootstrap + ./configure + echo Configure CMake build + mkdir -p build install_cmake + cmake -GNinja -B build -S . -DCMAKE_INSTALL_PREFIX=install_cmake +- build-autotools: | + cd hidapi + make + make DESTDIR=$PWD/root install + make clean +- build-cmake: | + cd hidapi/build + ninja + ninja install + ninja clean +- build-manual: | + cd hidapi/libusb + gmake -f Makefile-manual diff --git a/node_modules/node-hid/hidapi/.builds/netbsd.yml b/node_modules/node-hid/hidapi/.builds/netbsd.yml new file mode 100644 index 0000000..413d91c --- /dev/null +++ b/node_modules/node-hid/hidapi/.builds/netbsd.yml @@ -0,0 +1,18 @@ +image: netbsd/latest +packages: +- cmake +- pkgconf +- libusb1 +- libiconv +sources: +- https://github.com/libusb/hidapi +tasks: +- configure: | + cd hidapi + mkdir -p build install + cmake -B build -S . -DCMAKE_INSTALL_PREFIX=install +- build: | + cd hidapi/build + make + make install + make clean diff --git a/node_modules/node-hid/hidapi/.builds/openbsd.yml b/node_modules/node-hid/hidapi/.builds/openbsd.yml new file mode 100644 index 0000000..780df7f --- /dev/null +++ b/node_modules/node-hid/hidapi/.builds/openbsd.yml @@ -0,0 +1,19 @@ +image: openbsd/latest +packages: +- cmake +- pkgconf +- libusb1-- +- libiconv +- ninja +sources: +- https://github.com/libusb/hidapi +tasks: +- configure: | + cd hidapi + mkdir -p build install + cmake -GNinja -B build -S . -DCMAKE_INSTALL_PREFIX=install +- build: | + cd hidapi/build + ninja + ninja install + ninja clean diff --git a/node_modules/node-hid/hidapi/.cirrus.yml b/node_modules/node-hid/hidapi/.cirrus.yml new file mode 100644 index 0000000..b4cf201 --- /dev/null +++ b/node_modules/node-hid/hidapi/.cirrus.yml @@ -0,0 +1,33 @@ +alpine_task: + container: + image: alpine:latest + install_script: apk add autoconf automake g++ gcc libusb-dev libtool linux-headers eudev-dev make musl-dev + script: + - ./bootstrap + - ./configure || { cat config.log; exit 1; } + - make + - make install + +freebsd11_task: + freebsd_instance: + image: freebsd-11-2-release-amd64 + install_script: + - pkg install -y + autoconf automake libiconv libtool pkgconf + script: + - ./bootstrap + - ./configure || { cat config.log; exit 1; } + - make + - make install + +freebsd12_task: + freebsd_instance: + image: freebsd-12-1-release-amd64 + install_script: + - pkg install -y + autoconf automake libiconv libtool pkgconf + script: + - ./bootstrap + - ./configure || { cat config.log; exit 1; } + - make + - make install diff --git a/node_modules/node-hid/hidapi/.gitattributes b/node_modules/node-hid/hidapi/.gitattributes new file mode 100644 index 0000000..edb79fe --- /dev/null +++ b/node_modules/node-hid/hidapi/.gitattributes @@ -0,0 +1,7 @@ +* text=auto + +*.sln text eol=crlf +*.vcproj text eol=crlf + +bootstrap text eol=lf +configure.ac text eol=lf diff --git a/node_modules/node-hid/hidapi/.github/workflows/builds.yml b/node_modules/node-hid/hidapi/.github/workflows/builds.yml new file mode 100644 index 0000000..90fe893 --- /dev/null +++ b/node_modules/node-hid/hidapi/.github/workflows/builds.yml @@ -0,0 +1,580 @@ +name: GitHub Builds + +on: [push, pull_request] + +env: + NIX_COMPILE_FLAGS: -Wall -Wextra -pedantic -Werror + GNU_COMPILE_FLAGS: -Wall -Wextra -pedantic -Werror -Wformat-signedness + MSVC_COMPILE_FLAGS: /W4 /WX + +jobs: + macos-automake: + + runs-on: macos-latest + + steps: + - uses: actions/checkout@v3 + - name: Install build tools + run: brew install autoconf automake libtool + - name: Configure Automake + run: | + ./bootstrap + ./configure --prefix=$(pwd)/install + - name: Build Automake + run: | + make + make install + - name: Clean build + run: make clean + - name: Build Manual makefile + working-directory: mac + run: make -f Makefile-manual + + + macos-cmake: + + runs-on: macos-latest + + steps: + - uses: actions/checkout@v3 + with: + path: hidapisrc + - name: Install dependencies + run: brew install meson ninja + - name: Configure CMake + run: | + rm -rf build install + cmake -B build/shared -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_ENABLE_ASAN=ON -DCMAKE_INSTALL_PREFIX=install/shared -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}" + cmake -B build/static -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_ENABLE_ASAN=ON -DCMAKE_INSTALL_PREFIX=install/static -DBUILD_SHARED_LIBS=FALSE -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}" + cmake -B build/framework -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_ENABLE_ASAN=ON -DCMAKE_INSTALL_PREFIX=install/framework -DCMAKE_FRAMEWORK=ON -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}" + - name: Build CMake Shared + working-directory: build/shared + run: make install + - name: Build CMake Static + working-directory: build/static + run: make install + - name: Build CMake Framework + working-directory: build/framework + run: make install + - name: Check artifacts + uses: andstor/file-existence-action@v2 + with: + files: "install/shared/lib/libhidapi.dylib, \ + install/shared/include/hidapi/hidapi.h, \ + install/shared/include/hidapi/hidapi_darwin.h, \ + install/static/lib/libhidapi.a, \ + install/static/include/hidapi/hidapi.h, \ + install/static/include/hidapi/hidapi_darwin.h, \ + install/framework/lib/hidapi.framework/hidapi, \ + install/framework/lib/hidapi.framework/Headers/hidapi.h, \ + install/framework/lib/hidapi.framework/Headers/hidapi_darwin.h" + fail: true + - name: Check CMake Export Package Shared + run: | + cmake \ + -B build/shared_test \ + -S hidapisrc/hidtest \ + -Dhidapi_ROOT=install/shared \ + -DCMAKE_INSTALL_PREFIX=install/shared_test \ + "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}" + cd build/shared_test + make install + - name: Check CMake Export Package Static + run: | + cmake \ + -B build/static_test \ + -S hidapisrc/hidtest \ + -Dhidapi_ROOT=install/static \ + -DCMAKE_INSTALL_PREFIX=install/static_test \ + "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}" + cd build/static_test + make install + + - name: Check Meson build + run: | + meson setup build_meson hidapisrc + cd build_meson + ninja + + + ubuntu-cmake: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + path: hidapisrc + - name: Install dependencies + run: | + sudo apt update + sudo apt install libudev-dev libusb-1.0-0-dev python3-pip ninja-build + sudo -H pip3 install meson + - name: Configure CMake + run: | + rm -rf build install + cmake -B build/shared -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_ENABLE_ASAN=ON -DCMAKE_INSTALL_PREFIX=install/shared -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}" + cmake -B build/static -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_ENABLE_ASAN=ON -DCMAKE_INSTALL_PREFIX=install/static -DBUILD_SHARED_LIBS=FALSE -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}" + - name: Build CMake Shared + working-directory: build/shared + run: make install + - name: Build CMake Static + working-directory: build/static + run: make install + - name: Check artifacts + uses: andstor/file-existence-action@v2 + with: + files: "install/shared/lib/libhidapi-libusb.so, \ + install/shared/lib/libhidapi-hidraw.so, \ + install/shared/include/hidapi/hidapi.h, \ + install/shared/include/hidapi/hidapi_libusb.h, \ + install/static/lib/libhidapi-libusb.a, \ + install/static/lib/libhidapi-hidraw.a, \ + install/static/include/hidapi/hidapi.h, \ + install/static/include/hidapi/hidapi_libusb.h" + fail: true + - name: Check CMake Export Package Shared + run: | + cmake \ + -B build/shared_test \ + -S hidapisrc/hidtest \ + -Dhidapi_ROOT=install/shared \ + -DCMAKE_INSTALL_PREFIX=install/shared_test \ + "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}" + cd build/shared_test + make install + - name: Check CMake Export Package Static + run: | + cmake \ + -B build/static_test \ + -S hidapisrc/hidtest \ + -Dhidapi_ROOT=install/static \ + -DCMAKE_INSTALL_PREFIX=install/static_test \ + "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}" + cd build/static_test + make install + + - name: Check Meson build + run: | + meson setup build_meson hidapisrc + cd build_meson + ninja + + + windows-cmake: + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v3 + with: + path: hidapisrc + - name: Install dependencies + shell: cmd + run: | + choco install ninja + pip3 install meson + refreshenv + - name: Configure CMake MSVC + shell: cmd + run: | + cmake -B build\msvc -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_WITH_TESTS=ON -DHIDAPI_BUILD_PP_DATA_DUMP=ON -DHIDAPI_ENABLE_ASAN=ON -DCMAKE_INSTALL_PREFIX=install\msvc -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=%MSVC_COMPILE_FLAGS%" + - name: Build CMake MSVC + working-directory: build/msvc + run: cmake --build . --config RelWithDebInfo --target install + - name: Check artifacts CMake MSVC + uses: andstor/file-existence-action@v2 + with: + files: "install/msvc/lib/hidapi.lib, \ + install/msvc/bin/hidapi.dll, \ + install/msvc/include/hidapi/hidapi.h, \ + install/msvc/include/hidapi/hidapi_winapi.h" + fail: true + - name: Check CMake MSVC Export Package + shell: cmd + run: | + cmake ^ + -B build\msvc_test ^ + -S hidapisrc\hidtest ^ + -Dhidapi_ROOT=install\msvc ^ + -DCMAKE_INSTALL_PREFIX=install\msvc_test ^ + "-DCMAKE_C_FLAGS=%MSVC_COMPILE_FLAGS%" + cd build\msvc_test + cmake --build . --target install + - name: Run CTest MSVC + shell: cmd + working-directory: build/msvc + run: ctest -C RelWithDebInfo --no-compress-output --output-on-failure + + - name: Configure CMake NMake MSVC + shell: cmd + run: | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + cmake -G"NMake Makefiles" -B build\nmake -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_WITH_TESTS=ON -DHIDAPI_BUILD_PP_DATA_DUMP=ON -DHIDAPI_ENABLE_ASAN=ON -DCMAKE_INSTALL_PREFIX=install\nmake -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=%MSVC_COMPILE_FLAGS%" + - name: Build CMake NMake MSVC + working-directory: build\nmake + shell: cmd + run: | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + nmake install + - name: Check artifacts CMake NMake MSVC + uses: andstor/file-existence-action@v2 + with: + files: "install/nmake/lib/hidapi.lib, \ + install/nmake/bin/hidapi.dll, \ + install/nmake/include/hidapi/hidapi.h, \ + install/nmake/include/hidapi/hidapi_winapi.h" + fail: true + - name: Check CMake NMake MSVC Export Package + shell: cmd + run: | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + cmake ^ + -G"NMake Makefiles" ^ + -B build\nmake_test ^ + -S hidapisrc\hidtest ^ + -Dhidapi_ROOT=install\nmake ^ + -DCMAKE_INSTALL_PREFIX=install\nmake_test ^ + "-DCMAKE_C_FLAGS=%MSVC_COMPILE_FLAGS%" + cd build\nmake_test + nmake install + - name: Run CTest NMake MSVC + working-directory: build\nmake + run: ctest --no-compress-output --output-on-failure + + - name: Configure CMake NMake ClangCL + shell: cmd + run: | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + cmake -G"NMake Makefiles" -B build\clang_cl -S hidapisrc -D CMAKE_C_COMPILER=clang-cl -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_WITH_TESTS=ON -DHIDAPI_BUILD_PP_DATA_DUMP=ON -DHIDAPI_ENABLE_ASAN=OFF -DCMAKE_INSTALL_PREFIX=install\clang_cl -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=%MSVC_COMPILE_FLAGS%" + - name: Build CMake NMake ClangCL + working-directory: build\clang_cl + shell: cmd + run: | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + nmake install + - name: Check artifacts CMake NMake ClangCL + uses: andstor/file-existence-action@v2 + with: + files: "install/clang_cl/lib/hidapi.lib, \ + install/clang_cl/bin/hidapi.dll, \ + install/clang_cl/include/hidapi/hidapi.h, \ + install/clang_cl/include/hidapi/hidapi_winapi.h" + fail: true + - name: Check CMake NMake ClangCL Export Package + shell: cmd + run: | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + cmake ^ + -G"NMake Makefiles" ^ + -B build\clang_cl_test ^ + -S hidapisrc\hidtest ^ + -D CMAKE_C_COMPILER=clang-cl ^ + -Dhidapi_ROOT=install\clang_cl ^ + -DCMAKE_INSTALL_PREFIX=install\clang_cl_test ^ + "-DCMAKE_C_FLAGS=%MSVC_COMPILE_FLAGS%" + cd build\clang_cl_test + cmake --build . --target install + - name: Run CTest NMake ClangCL + shell: cmd + working-directory: build/clang_cl + run: ctest -C RelWithDebInfo --no-compress-output --output-on-failure + + - name: Configure CMake MinGW + shell: cmd + run: | + cmake -G"MinGW Makefiles" -B build\mingw -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_WITH_TESTS=ON -DHIDAPI_BUILD_PP_DATA_DUMP=ON -DCMAKE_INSTALL_PREFIX=install\mingw -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=%GNU_COMPILE_FLAGS%" + - name: Build CMake MinGW + working-directory: build\mingw + run: cmake --build . --target install + - name: Check artifacts MinGW + uses: andstor/file-existence-action@v2 + with: + files: "install/mingw/lib/libhidapi.dll.a, \ + install/mingw/bin/libhidapi.dll, \ + install/mingw/include/hidapi/hidapi.h, \ + install/mingw/include/hidapi/hidapi_winapi.h" + fail: true + - name: Check CMake Export Package MinGW + shell: cmd + run: | + cmake ^ + -G"MinGW Makefiles" ^ + -B build\mingw_test ^ + -S hidapisrc\hidtest ^ + -Dhidapi_ROOT=install\mingw ^ + -DCMAKE_INSTALL_PREFIX=install\mingw_test ^ + "-DCMAKE_C_FLAGS=%GNU_COMPILE_FLAGS%" + cd build\mingw_test + cmake --build . --target install + - name: Run CTest MinGW + working-directory: build\mingw + run: ctest --no-compress-output --output-on-failure + + - name: Check Meson build + shell: cmd + run: | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + meson setup build_meson hidapisrc + cd build_meson + ninja + + + windows-msbuild: + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v3 + - uses: microsoft/setup-msbuild@v1.1 + - name: MSBuild x86 MSVC + run: msbuild windows\hidapi.sln /p:Configuration=Release /p:Platform=Win32 + - name: Check artifacts x86 + uses: andstor/file-existence-action@v2 + with: + files: "windows/Release/hidapi.dll, windows/Release/hidapi.lib, windows/Release/hidapi.pdb" + fail: true + - name: MSBuild x64 MSVC + run: msbuild windows\hidapi.sln /p:Configuration=Release /p:Platform=x64 + - name: Check artifacts x64 + uses: andstor/file-existence-action@v2 + with: + files: "windows/x64/Release/hidapi.dll, windows/x64/Release/hidapi.lib, windows/x64/Release/hidapi.pdb" + fail: true + - name: Gather artifacts + run: | + md artifacts + md artifacts\x86 + md artifacts\x64 + md artifacts\include + Copy-Item "windows\Release\hidapi.dll","windows\Release\hidapi.lib","windows\Release\hidapi.pdb" -Destination "artifacts\x86" + Copy-Item "windows\x64\Release\hidapi.dll","windows\x64\Release\hidapi.lib","windows\x64\Release\hidapi.pdb" -Destination "artifacts\x64" + Copy-Item "hidapi\hidapi.h","windows\hidapi_winapi.h" -Destination "artifacts\include" + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: hidapi-win + path: artifacts/ + retention-days: ${{ (github.event_name == 'pull_request' || github.ref_name != 'master') && 7 || 90 }} + + + fedora-mingw: + + runs-on: ubuntu-latest + container: fedora:latest + steps: + - uses: actions/checkout@v3 + with: + path: hidapisrc + - name: Install dependencies + run: sudo dnf install -y autoconf automake libtool gawk mingw64-gcc cmake ninja-build make + - name: Configure CMake + run: | + rm -rf build install + mingw64-cmake -B build/shared-cmake -S hidapisrc -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/shared-cmake -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}" + mingw64-cmake -B build/static-cmake -S hidapisrc -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/static-cmake -DBUILD_SHARED_LIBS=FALSE -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}" + - name: Configure Automake + working-directory: hidapisrc + run: | + ./bootstrap + mingw64-configure + - name: Build CMake Shared + working-directory: build/shared-cmake + run: ninja install + - name: Build CMake Static + working-directory: build/static-cmake + run: ninja install + - name: Build Automake + working-directory: hidapisrc + run: | + make + make DESTDIR=$PWD/../install/automake install + make clean + - name: Build manual Makefile + working-directory: hidapisrc/windows + run: make -f Makefile-manual OS=MINGW CC=x86_64-w64-mingw32-gcc + - name: Check artifacts + uses: andstor/file-existence-action@v2 + with: + files: "install/shared-cmake/bin/libhidapi.dll, \ + install/shared-cmake/lib/libhidapi.dll.a, \ + install/shared-cmake/include/hidapi/hidapi.h, \ + install/shared-cmake/include/hidapi/hidapi_winapi.h, \ + install/static-cmake/lib/libhidapi.a, \ + install/static-cmake/include/hidapi/hidapi.h, \ + install/static-cmake/include/hidapi/hidapi_winapi.h" + fail: true + - name: Check CMake Export Package Shared + run: | + mingw64-cmake \ + -GNinja \ + -B build/shared_test \ + -S hidapisrc/hidtest \ + -Dhidapi_DIR=$PWD/install/shared-cmake/lib/cmake/hidapi \ + -DCMAKE_INSTALL_PREFIX=install/shared_test \ + "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}" + cd build/shared_test + ninja install + - name: Check CMake Export Package Static + run: | + mingw64-cmake \ + -GNinja \ + -B build/static_test \ + -S hidapisrc/hidtest \ + -Dhidapi_DIR=$PWD/install/static-cmake/lib/cmake/hidapi \ + -DCMAKE_INSTALL_PREFIX=install/static_test \ + "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}" + cd build/static_test + ninja install + + + archlinux: + + runs-on: ubuntu-latest + container: archlinux:latest + steps: + - uses: actions/checkout@v3 + with: + path: hidapisrc + - name: Install dependencies + run: | + pacman -Sy + pacman -S --noconfirm glibc lib32-glibc gcc pkg-config autoconf automake libtool libusb libudev0 cmake make + - name: Configure CMake + run: | + rm -rf build install + cmake -B build/shared-cmake -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/shared-cmake -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}" + cmake -B build/static-cmake -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/static-cmake -DBUILD_SHARED_LIBS=FALSE -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}" + - name: Configure Automake + working-directory: hidapisrc + run: | + ./bootstrap + ./configure + - name: Build CMake Shared + working-directory: build/shared-cmake + run: make install + - name: Build CMake Static + working-directory: build/static-cmake + run: make install + - name: Build Automake + working-directory: hidapisrc + run: | + make + make DESTDIR=$PWD/../install/automake install + make clean + - name: Build manual Makefile + run: | + cd hidapisrc/linux + make -f Makefile-manual + cd ../libusb + make -f Makefile-manual + - name: Check artifacts + uses: andstor/file-existence-action@v2 + with: + files: "install/shared-cmake/lib/libhidapi-libusb.so, \ + install/shared-cmake/lib/libhidapi-hidraw.so, \ + install/shared-cmake/include/hidapi/hidapi.h, \ + install/shared-cmake/include/hidapi/hidapi_libusb.h, \ + install/static-cmake/lib/libhidapi-libusb.a, \ + install/static-cmake/lib/libhidapi-hidraw.a, \ + install/static-cmake/include/hidapi/hidapi.h, \ + install/static-cmake/include/hidapi/hidapi_libusb.h" + fail: true + - name: Check CMake Export Package Shared + run: | + cmake \ + -B build/shared_test \ + -S hidapisrc/hidtest \ + -Dhidapi_ROOT=$(pwd)/install/shared-cmake \ + -DCMAKE_INSTALL_PREFIX=install/shared_test \ + "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}" + cd build/shared_test + make install + - name: Check CMake Export Package Static + run: | + cmake \ + -B build/static_test \ + -S hidapisrc/hidtest \ + -Dhidapi_ROOT=$(pwd)/install/static-cmake \ + -DCMAKE_INSTALL_PREFIX=install/static_test \ + "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}" + cd build/static_test + make install + + + alpine: + + runs-on: ubuntu-latest + container: alpine:edge + env: + # A bug in musl: https://www.openwall.com/lists/musl/2020/01/20/2 + ALPINE_COMPILE_FLAGS: ${GNU_COMPILE_FLAGS} -Wno-overflow + steps: + - uses: actions/checkout@v3 + with: + path: hidapisrc + - name: Install dependencies + run: | + apk add gcc musl-dev autoconf automake libtool eudev-dev libusb-dev linux-headers cmake ninja make + - name: Configure CMake + run: | + rm -rf build install + cmake -B build/shared-cmake -S hidapisrc -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/shared-cmake -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${ALPINE_COMPILE_FLAGS}" + cmake -B build/static-cmake -S hidapisrc -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/static-cmake -DBUILD_SHARED_LIBS=FALSE -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${ALPINE_COMPILE_FLAGS}" + - name: Configure Automake + working-directory: hidapisrc + run: | + ./bootstrap + ./configure + - name: Build CMake Shared + working-directory: build/shared-cmake + run: ninja install + - name: Build CMake Static + working-directory: build/static-cmake + run: ninja install + - name: Build Automake + working-directory: hidapisrc + run: | + make + make DESTDIR=$PWD/../install/automake install + make clean + - name: Build manual Makefile + run: | + cd hidapisrc/linux + make -f Makefile-manual + cd ../libusb + make -f Makefile-manual + - name: Check artifacts + uses: andstor/file-existence-action@v2 + with: + files: "install/shared-cmake/lib/libhidapi-libusb.so, \ + install/shared-cmake/lib/libhidapi-hidraw.so, \ + install/shared-cmake/include/hidapi/hidapi.h, \ + install/shared-cmake/include/hidapi/hidapi_libusb.h, \ + install/static-cmake/lib/libhidapi-libusb.a, \ + install/static-cmake/lib/libhidapi-hidraw.a, \ + install/static-cmake/include/hidapi/hidapi.h, \ + install/static-cmake/include/hidapi/hidapi_libusb.h" + fail: true + - name: Check CMake Export Package Shared + run: | + cmake \ + -GNinja \ + -B build/shared_test \ + -S hidapisrc/hidtest \ + -Dhidapi_ROOT=install/shared-cmake \ + -DCMAKE_INSTALL_PREFIX=install/shared_test \ + "-DCMAKE_C_FLAGS=${ALPINE_COMPILE_FLAGS}" + cd build/shared_test + ninja install + - name: Check CMake Export Package Static + run: | + cmake \ + -GNinja \ + -B build/static_test \ + -S hidapisrc/hidtest \ + -Dhidapi_ROOT=install/static-cmake \ + -DCMAKE_INSTALL_PREFIX=install/static_test \ + "-DCMAKE_C_FLAGS=${ALPINE_COMPILE_FLAGS}" + cd build/static_test + ninja install diff --git a/node_modules/node-hid/hidapi/.github/workflows/checks.yml b/node_modules/node-hid/hidapi/.github/workflows/checks.yml new file mode 100644 index 0000000..4566a43 --- /dev/null +++ b/node_modules/node-hid/hidapi/.github/workflows/checks.yml @@ -0,0 +1,198 @@ +name: Checks +run-name: Code checks for '${{ github.ref_name }}' + +# General comment: +# Coverity doesn't support merging or including reports from multible machine/platforms (at least not officially). +# But otherwise there is no good way to keep the issues from all platforms at Coverity Scans at once. +# This script uses undocumented (but appears to be working) hack: +# The build logs from one machine/platform gets moved to a next once, +# and "fixed" so that cov-build can append logs from the next platform. +# The "fix" is based on the fact, that Coverity perfectly allows appending logs from multiple builds +# that are done *on the same host* machine. + +on: + # On-demand run + workflow_dispatch: + # Weekly run + schedule: + - cron: '30 5 * * 0' + +jobs: + coverity-windows: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v3 + with: + path: src + - name: Setup MSVC + uses: TheMrMilchmann/setup-msvc-dev@v2.0.0 + with: + arch: x64 + - name: Configure + run: | + cmake -B build -S src -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_WITH_TESTS=ON -DHIDAPI_BUILD_HIDTEST=ON + - name: Lookup Coverity Build Tool hash + id: coverity-cache-lookup + run: | + $coverity_hash=Invoke-RestMethod -Uri https://scan.coverity.com/download/cxx/win64 -Method Post -Body @{token='${{ secrets.COVERITY_SCAN_TOKEN }}';project='hidapi';md5=1} + echo "coverity_hash=$coverity_hash" >> $Env:GITHUB_OUTPUT + - name: Get cached Coverity Build Tool + id: cov-build-cache + uses: actions/cache@v3 + with: + path: cov-root + key: cov-root-cxx-win64-${{ steps.coverity-cache-lookup.outputs.coverity_hash }} + - name: Get and configure Coverity + if: steps.cov-build-cache.outputs.cache-hit != 'true' + run: | + Invoke-WebRequest -Uri https://scan.coverity.com/download/cxx/win64 -OutFile coverity.zip -Method Post -Body @{token='${{ secrets.COVERITY_SCAN_TOKEN }}';project='hidapi'} + Remove-Item 'cov-root' -Recurse -Force -ErrorAction SilentlyContinue + Expand-Archive coverity.zip -DestinationPath cov-root + + $cov_root=Get-ChildItem -Path 'cov-root' + $Env:PATH += ";$($cov_root.FullName)\bin" + cov-configure -msvc + - name: Make Coverity available in PATH + run: | + $cov_root=Get-ChildItem -Path 'cov-root' + echo "$($cov_root.FullName)\bin" >> $Env:GITHUB_PATH + - name: Build with Coverity + working-directory: build + run: | + cov-build --dir cov-int nmake + Rename-Item ".\cov-int\emit\$(hostname)" hostname + - name: Backup Coverity logs + uses: actions/upload-artifact@v4 + with: + name: coverity-logs-windows + path: build/cov-int + retention-days: 7 + + + coverity-macos: + runs-on: macos-13 + needs: [coverity-windows] + + steps: + - uses: actions/checkout@v3 + with: + path: src + - name: Install dependencies + run: brew install ninja + - name: Configure + run: | + cmake -B build -S src -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_WITH_TESTS=ON -DHIDAPI_BUILD_HIDTEST=ON -DCMAKE_C_COMPILER=clang + - uses: actions/download-artifact@v4 + with: + name: coverity-logs-windows + path: build/cov-int + - name: Fixup cov-int + run: | + rm -f build/cov-int/emit/hostname/emit-db.lock build/cov-int/emit/hostname/emit-db.write-lock + mv build/cov-int/emit/hostname build/cov-int/emit/$(hostname) + - name: Lookup Coverity Build Tool hash + id: coverity-cache-lookup + shell: bash + run: | + hash=$(curl https://scan.coverity.com/download/cxx/Darwin --data "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=hidapi&md5=1") + echo "coverity_hash=${hash}" >> $GITHUB_OUTPUT + - name: Get cached Coverity Build Tool + id: cov-build-cache + uses: actions/cache@v3 + with: + path: cov-root + key: cov-root-cxx-Darwin-${{ steps.coverity-cache-lookup.outputs.coverity_hash }} + - name: Get and configure Coverity + if: steps.cov-build-cache.outputs.cache-hit != 'true' + run: | + curl https://scan.coverity.com/download/cxx/Darwin --output coverity.dmg --data "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=hidapi" + hdiutil attach coverity.dmg -mountroot coverity + export COV_DIR_NAME=$(ls -1 --color=never coverity) + rm -rf cov-root + mkdir cov-root + cp ./coverity/${COV_DIR_NAME}/${COV_DIR_NAME}.sh cov-root/ + cd cov-root/ + ./${COV_DIR_NAME}.sh + ./bin/cov-configure --clang + - name: Make Coverity available in PATH + run: echo "$(pwd)/cov-root/bin" >> $GITHUB_PATH + - name: Build with Coverity + working-directory: build + run: | + cov-build --dir cov-int --append-log ninja + mv cov-int/emit/$(hostname) cov-int/emit/hostname + - name: Backup Coverity logs + uses: actions/upload-artifact@v4 + with: + name: coverity-logs-windows-macos + path: build/cov-int + retention-days: 7 + + + coverity-ubuntu: + runs-on: ubuntu-latest + needs: [coverity-macos] + + steps: + - uses: actions/checkout@v3 + with: + path: src + - name: Install dependencies + run: | + sudo apt update + sudo apt install libudev-dev libusb-1.0-0-dev ninja-build + - name: Configure + run: | + cmake -B build -S src -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_WITH_TESTS=ON -DHIDAPI_BUILD_HIDTEST=ON -DCMAKE_C_COMPILER=gcc + - uses: actions/download-artifact@v4 + with: + name: coverity-logs-windows-macos + path: build/cov-int + - name: Fixup cov-int + run: | + rm -f build/cov-int/emit/hostname/emit-db.lock build/cov-int/emit/hostname/emit-db.write-lock + mv build/cov-int/emit/hostname build/cov-int/emit/$(hostname) + - name: Lookup Coverity Build Tool hash + id: coverity-cache-lookup + shell: bash + run: | + hash=$(curl https://scan.coverity.com/download/cxx/linux64 --data "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=hidapi&md5=1") + echo "coverity_hash=${hash}" >> $GITHUB_OUTPUT + - name: Get cached Coverity Build Tool + id: cov-build-cache + uses: actions/cache@v3 + with: + path: cov-root + key: cov-root-cxx-linux64-${{ steps.coverity-cache-lookup.outputs.coverity_hash }} + - name: Get and configure Coverity + if: steps.cov-build-cache.outputs.cache-hit != 'true' + run: | + curl https://scan.coverity.com/download/cxx/linux64 --output coverity.tar.gz --data "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=hidapi" + rm -rf cov-root + mkdir cov-root + tar -xzf coverity.tar.gz --strip 1 -C cov-root + ./cov-root/bin/cov-configure --gcc + - name: Make Coverity available in PATH + run: echo "$(pwd)/cov-root/bin" >> $GITHUB_PATH + - name: Build with Coverity + working-directory: build + run: | + cov-build --dir cov-int --append-log ninja + - name: Submit results to Coverity Scan + working-directory: build + run: | + tar -czf cov-int.tar.gz cov-int + curl --form token=${{ secrets.COVERITY_SCAN_TOKEN }} \ + --form email=${{ secrets.COVERITY_SCAN_EMAIL }} \ + --form file=@cov-int.tar.gz \ + --form version="$GITHUB_SHA" \ + --form description="Automatic HIDAPI build" \ + https://scan.coverity.com/builds?project=hidapi + mv cov-int/emit/$(hostname) cov-int/emit/hostname + - name: Backup Coverity logs + uses: actions/upload-artifact@v4 + with: + name: coverity-logs-windows-macos-linux + path: build/cov-int + retention-days: 7 diff --git a/node_modules/node-hid/hidapi/.github/workflows/docs.yaml b/node_modules/node-hid/hidapi/.github/workflows/docs.yaml new file mode 100644 index 0000000..99f4e43 --- /dev/null +++ b/node_modules/node-hid/hidapi/.github/workflows/docs.yaml @@ -0,0 +1,46 @@ +name: Docs + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build: + runs-on: ubuntu-24.04 + steps: + - name: Install Doxygen + run: sudo apt satisfy "doxygen (>= 1.9.6)" + + - uses: actions/checkout@v4 + + - run: doxygen + working-directory: doxygen + + - name: Save doxygen docs as artifact + uses: actions/upload-artifact@v4 + with: + name: HIDAPI_doxygen_docs + path: ${{ github.workspace }}/doxygen/html + + deploy-docs: + runs-on: ubuntu-24.04 + needs: [build] + if: github.ref_type == 'branch' && github.ref_name == 'master' + concurrency: + group: "github-pages-deploy" + cancel-in-progress: true + steps: + - name: downlod artifact + uses: actions/download-artifact@v4 + with: + name: HIDAPI_doxygen_docs + path: docs + + - name: upload to github pages + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs + force_orphan: true diff --git a/node_modules/node-hid/hidapi/AUTHORS.txt b/node_modules/node-hid/hidapi/AUTHORS.txt new file mode 100644 index 0000000..7c2a035 --- /dev/null +++ b/node_modules/node-hid/hidapi/AUTHORS.txt @@ -0,0 +1,18 @@ + +HIDAPI Authors: + +Alan Ott : + Original Author and Maintainer + Linux, Windows, and Mac implementations + +Ludovic Rousseau : + Formatting for Doxygen documentation + Bug fixes + Correctness fixes + +libusb/hidapi Team: + Development/maintenance since June 4th 2019 + +For a comprehensive list of contributions, see the commit list at github: + https://github.com/libusb/hidapi/graphs/contributors + diff --git a/node_modules/node-hid/hidapi/BUILD.autotools.md b/node_modules/node-hid/hidapi/BUILD.autotools.md new file mode 100644 index 0000000..34cf56a --- /dev/null +++ b/node_modules/node-hid/hidapi/BUILD.autotools.md @@ -0,0 +1,116 @@ +# Building HIDAPI using Autotools (deprecated) + +--- +**NOTE**: for all intentions and purposes the Autotools build scripts for HIDAPI are _deprecated_ and going to be obsolete in the future. +HIDAPI Team recommends using CMake build for HIDAPI. +If you are already using Autotools build scripts provided by HIDAPI, +consider switching to CMake build scripts as soon as possible. + +--- + +To be able to use Autotools to build HIDAPI, it has to be [installed](#installing-autotools)/available in the system. + +Make sure you've checked [prerequisites](BUILD.md#prerequisites) and installed all required dependencies. + +## Installing Autotools + +HIDAPI uses few specific tools/packages from Autotools: `autoconf`, `automake`, `libtool`. + +On different platforms or package managers, those could be named a bit differently or packaged together. +You'll have to check the documentation/package list for your specific package manager. + +### Linux + +On Ubuntu the tools are available via APT: + +```sh +sudo apt install autoconf automake libtool +``` + +### FreeBSD + +FreeBSD Autotools can be installed as: + +```sh +pkg_add -r autotools +``` + +Additionally, on FreeBSD you will need to install GNU make: +```sh +pkg_add -r gmake +``` + +## Building HIDAPI with Autotools + +A simple command list, to build HIDAPI with Autotools as a _shared library_ and install in into your system: + +```sh +./bootstrap # this prepares the configure script +mkdir build +cd build # in-source builds are not recommended and known to be broken in some cases (https://github.com/libusb/hidapi/issues/621) +../configure +make # build the library +make install # as root, or using sudo, this will install hidapi into your system +``` + +`./configure` can take several arguments which control the build. A few commonly used options: +```sh + --enable-testgui + # Enable the build of Foxit-based Test GUI. This requires Fox toolkit to + # be installed/available. See README.md#test-gui for remarks. + + --prefix=/usr + # Specify where you want the output headers and libraries to + # be installed. The example above will put the headers in + # /usr/include and the binaries in /usr/lib. The default is to + # install into /usr/local which is fine on most systems. + + --disable-shared + # By default, both shared and static libraries are going to be built/installed. + # This option disables shared library build, if only static library is required. +``` + + +## Cross Compiling + +This section talks about cross compiling HIDAPI for Linux using Autotools. +This is useful for using HIDAPI on embedded Linux targets. These +instructions assume the most raw kind of embedded Linux build, where all +prerequisites will need to be built first. This process will of course vary +based on your embedded Linux build system if you are using one, such as +OpenEmbedded or Buildroot. + +For the purpose of this section, it will be assumed that the following +environment variables are exported. +```sh +$ export STAGING=$HOME/out +$ export HOST=arm-linux +``` + +`STAGING` and `HOST` can be modified to suit your setup. + +### Prerequisites + +Depending on what backend you want to cross-compile, you also need to prepare the dependencies: +`libusb` for libusb HIDAPI backend, or `libudev` for hidraw HIDAPI backend. + +An example of cross-compiling `libusb`. From `libusb` source directory, run: +```sh +./configure --host=$HOST --prefix=$STAGING +make +make install +``` + +An example of cross-comping `libudev` is not covered by this section. +Check `libudev`'s documentation for details. + +### Building HIDAPI + +Build HIDAPI: +```sh +PKG_CONFIG_DIR= \ +PKG_CONFIG_LIBDIR=$STAGING/lib/pkgconfig:$STAGING/share/pkgconfig \ +PKG_CONFIG_SYSROOT_DIR=$STAGING \ +./configure --host=$HOST --prefix=$STAGING +# make / make install - same as for a regular build +``` diff --git a/node_modules/node-hid/hidapi/BUILD.cmake.md b/node_modules/node-hid/hidapi/BUILD.cmake.md new file mode 100644 index 0000000..573f910 --- /dev/null +++ b/node_modules/node-hid/hidapi/BUILD.cmake.md @@ -0,0 +1,280 @@ +# Building HIDAPI using CMake + +To build HIDAPI with CMake, it has to be [installed](#installing-cmake)/available in the system. + +Make sure you've checked [prerequisites](BUILD.md#prerequisites) and installed all required dependencies. + +HIDAPI CMake build system allows you to build HIDAPI in two generally different ways: +1) As a [standalone package/library](#standalone-package-build); +2) As [part of a larger CMake project](#hidapi-as-a-subdirectory). + +**TL;DR**: if you're experienced developer and have been working with CMake projects or have been written some of your own - +most of this document may not be of interest for you; just check variables names, its default values and the target names. + +## Installing CMake + +CMake can be installed either using your system's package manager, +or by downloading an installer/prebuilt version from the [official website](https://cmake.org/download/). + +On most \*nix systems, the preferred way to install CMake is via package manager, +e.g. `sudo apt install cmake`. + +On Windows CMake could be provided by your development environment (e.g. by Visual Studio Installer or MinGW installer), +or you may install it system-wise using the installer from the official website. + +On macOS CMake may be installed by Homebrew/MacPorts or using the installer from the official website. + +## Standalone package build + +To build HIDAPI as a standalone package, you follow [general steps](https://cmake.org/runningcmake/) of building any CMake project. + +An example of building HIDAPI with CMake: +```sh +# precondition: create a somewhere on the filesystem (preferably outside of the HIDAPI source) +# this is the place where all intermediate/build files are going to be located +cd +# configure the build +cmake +# build it! +cmake --build . +# install library; by default installs into /usr/local/ +cmake --build . --target install +# NOTE: you need to run install command as root, to be able to install into /usr/local/ +``` +Such invocation will use the default (as per CMake magic) compiler/build environment available in your system. + +You may pass some additional CMake variables to control the build configuration as `-D=value`. +E.g.: +```sh +# install command now would install things into /usr +cmake -DCMAKE_INSTALL_PREFIX=/usr +``` + +
+ Using a specific CMake generator + +An example of using `Ninja` as a CMake generator: + +```sh +cd +# configure the build +cmake -GNinja +# we know, that CMake has generated build files for Ninja, +# so we can use `ninja` directly, instead of `cmake --build .` +ninja +# install library +ninja install +``` + +`-G` here specifies a native build system CMake would generate build files for. +Check [CMake Documentation](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html) for a list of available generators (system-specific). + +

+ +Some of the [standard](https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html) CMake variables you may want to use to configure a build: + +- [`CMAKE_INSTALL_PREFIX`](https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html) - prefix where `install` target would install the library(ies); +- [`CMAKE_BUILD_TYPE`](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html) - standard possible values: `Debug`, `Release`, `RelWithDebInfo`, `MinSizeRel`; Defaults to `Release` for HIDAPI, if not specified; +- [`BUILD_SHARED_LIBS`](https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html) - when set to TRUE, HIDAPI is built as a shared library, otherwise build statically; Defaults to `TRUE` for HIDAPI, if not specified; + +
+ macOS-specific variables + + - [`CMAKE_FRAMEWORK`](https://cmake.org/cmake/help/latest/variable/CMAKE_FRAMEWORK.html) - (since CMake 3.15) when set to TRUE, HIDAPI is built as a framework library, otherwise build as a regular static/shared library; Defaults to `FALSE` for HIDAPI, if not specified; + - [`CMAKE_OSX_DEPLOYMENT_TARGET`](https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_DEPLOYMENT_TARGET.html) - minimum version of the target platform (e.g. macOS or iOS) on which the target binaries are to be deployed; defaults to a maximum supported target platform by currently used XCode/Toolchain; + +

+ +HIDAPI-specific CMake variables: + +- `HIDAPI_BUILD_HIDTEST` - when set to TRUE, build a small test application `hidtest`; +- `HIDAPI_WITH_TESTS` - when set to TRUE, build all (unit-)tests; +currently this option is only available on Windows, since only Windows backend has tests; + +
+ Linux-specific variables + + - `HIDAPI_WITH_HIDRAW` - when set to TRUE, build HIDRAW-based implementation of HIDAPI (`hidapi-hidraw`), otherwise don't build it; defaults to TRUE; + - `HIDAPI_WITH_LIBUSB` - when set to TRUE, build LIBUSB-based implementation of HIDAPI (`hidapi-libusb`), otherwise don't build it; defaults to TRUE; + + **NOTE**: at least one of `HIDAPI_WITH_HIDRAW` or `HIDAPI_WITH_LIBUSB` has to be set to TRUE. + +

+ +To see all most-useful CMake variables available for HIDAPI, one of the most convenient ways is too use [`cmake-gui`](https://cmake.org/cmake/help/latest/manual/cmake-gui.1.html) tool ([example](https://cmake.org/runningcmake/)). + +_NOTE_: HIDAPI packages built by CMake can be used with `pkg-config`, as if built with [Autotools](BUILD.autotools.md). + +### MSVC and Ninja +It is possible to build a CMake project (including HIDAPI) using MSVC compiler and Ninja (for medium and larger projects it is so much faster than msbuild). + +For that: +1) Open cmd.exe; +2) Setup MSVC build environment variables, e.g.: `vcvarsall.bat x64`, where: + - `vcvarsall.bat` is an environment setup script of your MSVC toolchain installation;
For MSVC 2019 Community edition it is located at: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\`; + - `x64` -a target architecture to build; +3) Follow general build steps, and use `Ninja` as a generator. + +### Using HIDAPI in a CMake project + +When HIDAPI is used as a standalone package (either installed into the system or built manually and installed elsewhere), the simplest way to use it is as showed in the example: + +```cmake +project(my_application) + +add_executable(my_application main.c) + +find_package(hidapi REQUIRED) +target_link_libraries(my_application PRIVATE hidapi::hidapi) +``` + +If HIDAPI isn't installed in your system, or `find_package` cannot find HIDAPI by default for any other reasons, +the recommended way manually specify which HIDAPI package to use is via `hidapi_ROOT` CMake variable, e.g.: +`-Dhidapi_ROOT=`. + +_NOTE_: usage of `hidapi_ROOT` is only possible (and recommended) with CMake 3.12 and higher. For older versions of CMake you'd need to specify [`CMAKE_PREFIX_PATH`](https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html#variable:CMAKE_PREFIX_PATH) instead. + +Check with [`find_package`](https://cmake.org/cmake/help/latest/command/find_package.html) documentation if you need more details. + +Available CMake targets after successful `find_package(hidapi)`: +- `hidapi::hidapi` - indented to be used in most cases; +- `hidapi::include` - if you need only to include `` but not link against the library; +- `hidapi::winapi` - same as `hidapi::hidapi` on Windows; available only on Windows; +- `hidapi::darwin` - same as `hidapi::hidapi` on macOS; available only on macOS; +- `hidapi::libusb` - available when libusb backend is used/available; +- `hidapi::hidraw` - available when hidraw backend is used/available on Linux; + +**NOTE**: on Linux often both `hidapi::libusb` and `hidapi::hidraw` backends are available; in that case `hidapi::hidapi` is an alias for **`hidapi::hidraw`**. The motivation is that `hidraw` backend is a native Linux kernel implementation of HID protocol, and supports various HID devices (USB, Bluetooth, I2C, etc.). If `hidraw` backend isn't built at all (`hidapi::libusb` is the only target) - `hidapi::hidapi` is an alias for `hidapi::libusb`. +If you're developing a cross-platform application and you are sure you need to use `libusb` backend on Linux, the simple way to achieve this is: +```cmake +if(TARGET hidapi::libusb) + target_link_libraries(my_project PRIVATE hidapi::libusb) +else() + target_link_libraries(my_project PRIVATE hidapi::hidapi) +endif() +``` + +## HIDAPI as a subdirectory + +HIDAPI can be easily used as a subdirectory of a larger CMake project: +```cmake +# root CMakeLists.txt +cmake_minimum_required(VERSION 3.4.3...3.25 FATAL_ERROR) + +add_subdirectory(hidapi) +add_subdirectory(my_application) + +# my_application/CMakeLists.txt +project(my_application) + +add_executable(my_application main.c) + +# NOTE: no `find_package` is required, since HIDAPI targets are already a part of the project tree +target_link_libraries(my_application PRIVATE hidapi::hidapi) +``` +Lets call this "larger project" a "host project". + +All of the variables described in [standalone build](#standalone-package-build) section can be used to control HIDAPI build in case of a subdirectory, e.g.: +```cmake +set(HIDAPI_WITH_LIBUSB FALSE) # surely will be used only on Linux +set(BUILD_SHARED_LIBS FALSE) # HIDAPI as static library on all platforms +add_subdirectory(hidapi) +``` + +
+ NOTE + + If you project happen to use `BUILD_SHARED_LIBS` as a `CACHE` variable globally for you project, setting it as simple variable, as showed above _will have not affect_ up until _CMake 3.13_. See [CMP0077](https://cmake.org/cmake/help/latest/policy/CMP0077.html) for details. +

+ +There are several important differences in the behavior of HIDAPI CMake build system when CMake is built as standalone package vs subdirectory build: + +1) In _standalone build_ a number of standard and HIDAPI-specific variables are marked as _cache variables_ or _options_. +This is done for convenience: when you're building HIDAPI as a standalone package and using tools like `cmake-gui` - those are highlighted as variables that can be changed and has some short description/documentation. E.g.: +![an example of highlighted variables in cmake-gui](documentation/cmake-gui-highlights.png "cmake-gui highlighted variables")
+E.g.2:
+![an example of drop-down menu in cmake-gui](documentation/cmake-gui-drop-down.png "cmake-gui drop-down menu")
+When HIDAPI is built as a _subdirectory_ - **_none of the variables are marked for cache or as options_** by HIDAPI. +This is done to let the host project's developer decide what is important (what needs to be highlighted) and what's not. + +2) The default behavior/default value for some of the variables is a bit different: + - by default, none of HIDAPI targets are [installed](https://cmake.org/cmake/help/latest/command/install.html); if required, HIDAPI targets can be installed by host project _after_ including HIDAPI subdirectory (requires CMake 3.13 or later); **or**, the default installation can be enabled by setting `HIDAPI_INSTALL_TARGETS` variable _before_ including HIDAPI subdirectory. + HIDAPI uses [GNUInstallDirs](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html) to specify install locations. Variables like `CMAKE_INSTALL_LIBDIR` can be used to control HIDAPI's installation locations. E.g.: + ```cmake + # enable the installation if you need it + set(HIDAPI_INSTALL_TARGETS ON) + # (optionally) change default installation locations if it makes sense for your target platform, etc. + set(CMAKE_INSTALL_LIBDIR "lib64") + add_subdirectory(hidapi) + ``` + - HIDAPI prints its version during the configuration when built as a standalone package; to enable this for subdirectory builds - set `HIDAPI_PRINT_VERSION` to TRUE before including HIDAPI; + +3) In a subdirectory build, HIDAPI _doesn't modify or set any of the CMake variables_ that may change the build behavior. + For instance, in a _standalone build_, if CMAKE_BUILD_TYPE or BUILD_SHARED_LIBS variables are not set, those are defaulted to "Release" and "TRUE" explicitly. + In a _subdirectory build_, even if not set, those variables remain unchanged, so a host project's developer has a full control over the HIDAPI build configuration. + +Available CMake targets after `add_subdirectory(hidapi)` _are the same as in case of [standalone build](#standalone-package-build)_, and a few additional ones: +- `hidapi_include` - the interface library; `hidapi::include` is an alias of it; +- `hidapi_winapi` - library target on Windows; `hidapi::winapi` is an alias of it; +- `hidapi_darwin` - library target on macOS; `hidapi::darwin` is an alias of it; +- `hidapi_libusb` - library target for libusb backend; `hidapi::libusb` is an alias of it; +- `hidapi_hidraw` - library target for hidraw backend; `hidapi::hidraw` is an alias of it; +- `hidapi-libusb` - an alias of `hidapi_libusb` for compatibility with raw library name; +- `hidapi-hidraw` - an alias of `hidapi_hidraw` for compatibility with raw library name; +- `hidapi` - an alias of `hidapi_winapi` or `hidapi_darwin` on Windows or macOS respectfully. + +Advanced: +- Why would I need additional targets described in this section above, if I already have alias targets compatible with `find_package`? + - an example: + ```cmake + add_subdirectory(hidapi) + if(TARGET hidapi_libusb) + # see libusb/hid.c for usage of `NO_ICONV` + target_compile_definitions(hidapi_libusb PRIVATE NO_ICONV) + endif() + ``` + +## Both Shared and Static build + +If you're a former (or present) user of Autotools build scripts for HIDAPI, or you're a package manager maintainer and you're often working with those - you're likely asking how to build HIDAPI with CMake and get both Shared and Static libraries (as would be done by Autotools: `./configure --enable-static --enable-shared ...`). + +CMake doesn't have such option of-the-box and it is decided not to introduce any manual CMake-level workarounds for HIDAPI on this matter. + +If you want to mimic the Autotools behavior, it is possible by building/installing first the static version of the library and then shared version of the library. The installation folder (`CMAKE_INSTALL_PREFIX`) should point to the same directory for both variants, that way: +- both static and shared library binaries will be available and usable; +- a single header file(s) for both of them; +- Autotools/pkg-config (`.pc`) files will be generated and usable _as if_ generated by Autotools natively and build configured with both `-enable-static --enable-shared` options; +- CMake package scripts will be generated and fully usable, but _only the last build installed_, i.e. if the last was installed Shared version of the binary - CMake targets found by `find_package(hidapi)` would point to a Shared binaries. + +There is a historical discussion, why such solution is simplest/preferable: https://github.com/libusb/hidapi/issues/424 + +#### TL;DR/Sample + +```sh +# First - configure/build + +# Static libraries +cmake -S -B "/static" -DCMAKE_INSTALL_PREFIX= -DBUILD_SHARED_LIBS=FALSE +cmake --build "/static" +# Shared libraries +cmake -S -B "/shared" -DCMAKE_INSTALL_PREFIX= -DBUILD_SHARED_LIBS=TRUE +cmake --build "/shared" + +# (Optionally) change the installation destination. +# NOTE1: this is supported by CMake only on UNIX platforms +# See https://cmake.org/cmake/help/latest/envvar/DESTDIR.html +# NOTE2: this is not the same as `CMAKE_INSTALL_PREFIX` set above +# NOTE3: this is only required if you have a staging dir other than the final runtime dir, +# e.g. during cross-compilation +export DESTDIR="$STAGING_DIR" + +# +# Install the libraries +# NOTE: order of installation matters - install Shared variant *the last* + +# Static libraries +cmake --install "/static" +# Shared libraries +cmake --install "/shared" + +``` diff --git a/node_modules/node-hid/hidapi/BUILD.md b/node_modules/node-hid/hidapi/BUILD.md new file mode 100644 index 0000000..d7a3546 --- /dev/null +++ b/node_modules/node-hid/hidapi/BUILD.md @@ -0,0 +1,127 @@ +# Building HIDAPI from Source + +## Table of content + +* [Intro](#intro) +* [Prerequisites](#prerequisites) + * [Linux](#linux) + * [FreeBSD](#freebsd) + * [Mac](#mac) + * [Windows](#windows) +* [Embedding HIDAPI directly into your source tree](#embedding-hidapi-directly-into-your-source-tree) +* [Building the manual way on Unix platforms](#building-the-manual-way-on-unix-platforms) +* [Building on Windows](#building-on-windows) + +## Intro + +For various reasons, you may need to build HIDAPI on your own. + +It can be done in several different ways: +- using [CMake](BUILD.cmake.md); +- using [Autotools](BUILD.autotools.md) (deprecated); +- using [manual makefiles](#building-the-manual-way-on-unix-platforms); +- using `Meson` (requires CMake); + +**Autotools** build system is historically the first mature build system for +HIDAPI. The most common usage of it is in its separate README: [BUILD.autotools.md](BUILD.autotools.md).
+NOTE: for all intentions and purposes the Autotools build scripts for HIDAPI are _deprecated_ and going to be obsolete in the future. +HIDAPI Team recommends using CMake build for HIDAPI. + +**CMake** build system is de facto an industry standard for many open-source and proprietary projects and solutions. +HIDAPI is one of the projects which use the power of CMake to its advantage. +More documentation is available in its separate README: [BUILD.cmake.md](BUILD.cmake.md). + +**Meson** build system for HIDAPI is designed as a [wrapper](https://mesonbuild.com/CMake-module.html) over CMake build script. +It is present for the convenience of Meson users who need to use HIDAPI and need to be sure HIDAPI is built in accordance with officially supported build scripts.
+In the Meson script of your project you need a `hidapi = subproject('hidapi')` subproject, and `hidapi.get_variable('hidapi_dep')` as your dependency. +There are also backend/platform-specific dependencies available: `hidapi_winapi`, `hidapi_darwin`, `hidapi_hidraw`, `hidapi_libusb`. + +If you don't know where to start to build HIDAPI, we recommend starting with [CMake](BUILD.cmake.md) build. + +## Prerequisites: + +Regardless of what build system you choose to use, there are specific dependencies for each platform/backend. + +### Linux: + +Depending on which backend you're going to build, you'll need to install +additional development packages. For `linux/hidraw` backend, you need a +development package for `libudev`. For `libusb` backend, naturally, you need +`libusb` development package. + +On Debian/Ubuntu systems these can be installed by running: +```sh +# required only by hidraw backend +sudo apt install libudev-dev +# required only by libusb backend +sudo apt install libusb-1.0-0-dev +``` + +### FreeBSD: + +On FreeBSD, you will need to install libiconv. This is done by running +the following: +```sh +pkg_add -r libiconv +``` + +### Mac: + +Make sure you have XCode installed and its Command Line Tools. + +### Windows: + +You just need a compiler. You may use Visual Studio or Cygwin/MinGW, +depending on which environment is best for your needs. + +## Embedding HIDAPI directly into your source tree + +Instead of using one of the provided standalone build systems, +you may want to integrate HIDAPI directly into your source tree. + +--- +If your project uses CMake as a build system, it is safe to add HIDAPI as a [subdirectory](BUILD.cmake.md#hidapi-as-a-subdirectory). + +--- +If _the only option_ that works for you is adding HIDAPI sources directly +to your project's build system, then you need: +- include a _single source file_ into your project's build system, +depending on your platform and the backend you want to use: + - [`windows\hid.c`](windows/hid.c); + - [`linux/hid.c`](linux/hid.c); + - [`libusb/hid.c`](libusb/hid.c); + - [`mac/hid.c`](mac/hid.c); +- add a [`hidapi`](hidapi) folder to the include path when building `hid.c`; +- make the platform/backend specific [dependencies](#prerequisites) available during the compilation/linking, when building `hid.c`; + +NOTE: the above doesn't guarantee that having a copy of `/hid.c` and `hidapi/hidapi.h` is enough to build HIDAPI. +The only guarantee that `/hid.c` includes all necessary sources to compile it as a single file. + +Check the manual makefiles for a simple example/reference of what are the dependencies of each specific backend. + +## Building the manual way on Unix platforms + +Manual Makefiles are provided mostly to give the user an idea what it takes +to build a program which embeds HIDAPI directly inside of it. These should +really be used as examples only. If you want to build a system-wide shared +library, use one of the build systems mentioned above. + +To build HIDAPI using the manual Makefiles, change the directory +of your platform and run make. For example, on Linux run: +```sh +cd linux/ +make -f Makefile-manual +``` + +## Building on Windows + +To build the HIDAPI DLL on Windows using Visual Studio, build the `.sln` file +in the `windows/` directory. + +To build HIDAPI using MinGW or Cygwin using Autotools, use general Autotools + [instruction](BUILD.autotools.md). + +Any windows builds (MSVC or MinGW/Cygwin) are also supported by [CMake](BUILD.cmake.md). + +If you are looking for information regarding DDK build of HIDAPI: +- the build has been broken for a while and now the support files are obsolete. diff --git a/node_modules/node-hid/hidapi/CMakeLists.txt b/node_modules/node-hid/hidapi/CMakeLists.txt new file mode 100644 index 0000000..d708681 --- /dev/null +++ b/node_modules/node-hid/hidapi/CMakeLists.txt @@ -0,0 +1,108 @@ +cmake_minimum_required(VERSION 3.1.3...3.25 FATAL_ERROR) + +if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + add_subdirectory(src) + # compatibility with find_package() vs add_subdirectory + set(hidapi_VERSION "${hidapi_VERSION}" PARENT_SCOPE) + return() +endif() +# All of the below in this file is meant for a standalone build. +# When building as a subdirectory of a larger project, most of the options may not make sense for it, +# so it is up to developer to configure those, e.g.: +# +# # a subfolder of a master project, e.g.: 3rdparty/hidapi/CMakeLists.txt +# +# set(HIDAPI_WITH_HIDRAW OFF) +# set(CMAKE_FRAMEWORK ON) +# # and keep everything else to their defaults +# add_subdirectory(hidapi) +# + +set(DEFAULT_CMAKE_BUILD_TYPES "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +if(NOT DEFINED CMAKE_BUILD_TYPE OR NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "${DEFAULT_CMAKE_BUILD_TYPES}" FORCE) +endif() +# This part is for convenience, when used one of the standard build types with cmake-gui +list(FIND DEFAULT_CMAKE_BUILD_TYPES "${CMAKE_BUILD_TYPE}" _build_type_index) +if(${_build_type_index} GREATER -1) + # set it optionally, so a custom CMAKE_BUILD_TYPE can be used as well, if needed + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${DEFAULT_CMAKE_BUILD_TYPES}) +endif() +unset(_build_type_index) +# + +project(hidapi LANGUAGES C) + +if(APPLE) + if(NOT CMAKE_VERSION VERSION_LESS "3.15") + option(CMAKE_FRAMEWORK "Build macOS/iOS Framework version of the library" OFF) + endif() +elseif(NOT WIN32) + if(CMAKE_SYSTEM_NAME MATCHES "Linux") + option(HIDAPI_WITH_HIDRAW "Build HIDRAW-based implementation of HIDAPI" ON) + option(HIDAPI_WITH_LIBUSB "Build LIBUSB-based implementation of HIDAPI" ON) + endif() + if(CMAKE_SYSTEM_NAME MATCHES "NetBSD") + option(HIDAPI_WITH_NETBSD "Build NetBSD/UHID implementation of HIDAPI" ON) + endif() +endif() + +option(BUILD_SHARED_LIBS "Build shared version of the libraries, otherwise build statically" ON) + +set(HIDAPI_INSTALL_TARGETS ON) +set(HIDAPI_PRINT_VERSION ON) + +set(IS_DEBUG_BUILD OFF) +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(IS_DEBUG_BUILD ON) +endif() + +option(HIDAPI_ENABLE_ASAN "Build HIDAPI with ASAN address sanitizer instrumentation" OFF) + +if(HIDAPI_ENABLE_ASAN) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") + if(MSVC) + # the default is to have "/INCREMENTAL" which causes a warning when "-fsanitize=address" is present + set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO") + set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO") + set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /INCREMENTAL:NO") + set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /INCREMENTAL:NO") + endif() +endif() + +if(WIN32) + # so far only Windows has tests + option(HIDAPI_WITH_TESTS "Build HIDAPI (unit-)tests" ${IS_DEBUG_BUILD}) +else() + set(HIDAPI_WITH_TESTS OFF) +endif() + +if(HIDAPI_WITH_TESTS) + enable_testing() +endif() + +if(WIN32) + option(HIDAPI_BUILD_PP_DATA_DUMP "Build small Windows console application pp_data_dump.exe" ${IS_DEBUG_BUILD}) +endif() + +add_subdirectory(src) + +option(HIDAPI_BUILD_HIDTEST "Build small console test application hidtest" ${IS_DEBUG_BUILD}) +if(HIDAPI_BUILD_HIDTEST) + add_subdirectory(hidtest) +endif() + +if(HIDAPI_ENABLE_ASAN) + if(NOT MSVC) + # MSVC doesn't recognize those options, other compilers - requiring it + foreach(HIDAPI_TARGET hidapi_winapi hidapi_darwin hidapi_hidraw hidapi_libusb hidtest_hidraw hidtest_libusb hidtest) + if(TARGET ${HIDAPI_TARGET}) + if(BUILD_SHARED_LIBS) + target_link_options(${HIDAPI_TARGET} PRIVATE -fsanitize=address) + else() + target_link_options(${HIDAPI_TARGET} PUBLIC -fsanitize=address) + endif() + endif() + endforeach() + endif() +endif() diff --git a/node_modules/node-hid/hidapi/HACKING.txt b/node_modules/node-hid/hidapi/HACKING.txt new file mode 100644 index 0000000..e06b533 --- /dev/null +++ b/node_modules/node-hid/hidapi/HACKING.txt @@ -0,0 +1,19 @@ +This file is mostly for the maintainer. + +Updating a Version: +1. Update VERSION file. +2. HID_API_VERSION_MAJOR/HID_API_VERSION_MINOR/HID_API_VERSION_PATCH in hidapi.h. + +Before firing a new release: +1. Run the "Checks" Githtub Action +2. Make sure no defects are found at: https://scan.coverity.com/projects/hidapi +3. Fix if any + +Firing a new release: +1. Update the Version (if not yet updated). +2. Prepare the Release Notes. +3. Store the Release Notes into a file. +4. Create locally an annotated git tag with release notes attached, e.g.: `git tag -aF ../hidapi_release_notes hidapi-` +5. Push newly created tag: `git push origin hidapi-` +6. Grab the hidapi-win.zip from Summary page of "GitHub Builds" Action for latest master build. +7. Create a Github Release with hidapi-win.zip attached, for newly created tag. diff --git a/node_modules/node-hid/hidapi/LICENSE-bsd.txt b/node_modules/node-hid/hidapi/LICENSE-bsd.txt new file mode 100644 index 0000000..538cdf9 --- /dev/null +++ b/node_modules/node-hid/hidapi/LICENSE-bsd.txt @@ -0,0 +1,26 @@ +Copyright (c) 2010, Alan Ott, Signal 11 Software +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Signal 11 Software nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/node-hid/hidapi/LICENSE-gpl3.txt b/node_modules/node-hid/hidapi/LICENSE-gpl3.txt new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/node_modules/node-hid/hidapi/LICENSE-gpl3.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/node_modules/node-hid/hidapi/LICENSE-orig.txt b/node_modules/node-hid/hidapi/LICENSE-orig.txt new file mode 100644 index 0000000..e3f3380 --- /dev/null +++ b/node_modules/node-hid/hidapi/LICENSE-orig.txt @@ -0,0 +1,9 @@ + HIDAPI - Multi-Platform library for + communication with HID devices. + + Copyright 2009, Alan Ott, Signal 11 Software. + All Rights Reserved. + + This software may be used by anyone for any reason so + long as the copyright notice in the source files + remains intact. diff --git a/node_modules/node-hid/hidapi/LICENSE.txt b/node_modules/node-hid/hidapi/LICENSE.txt new file mode 100644 index 0000000..e1676d4 --- /dev/null +++ b/node_modules/node-hid/hidapi/LICENSE.txt @@ -0,0 +1,13 @@ +HIDAPI can be used under one of three licenses. + +1. The GNU General Public License, version 3.0, in LICENSE-gpl3.txt +2. A BSD-Style License, in LICENSE-bsd.txt. +3. The more liberal original HIDAPI license. LICENSE-orig.txt + +The license chosen is at the discretion of the user of HIDAPI. For example: +1. An author of GPL software would likely use HIDAPI under the terms of the +GPL. + +2. An author of commercial closed-source software would likely use HIDAPI +under the terms of the BSD-style license or the original HIDAPI license. + diff --git a/node_modules/node-hid/hidapi/Makefile.am b/node_modules/node-hid/hidapi/Makefile.am new file mode 100644 index 0000000..00bcb73 --- /dev/null +++ b/node_modules/node-hid/hidapi/Makefile.am @@ -0,0 +1,85 @@ + +ACLOCAL_AMFLAGS = -I m4 + +if OS_FREEBSD +pkgconfigdir=$(prefix)/libdata/pkgconfig +else +pkgconfigdir=$(libdir)/pkgconfig +endif + +if OS_LINUX +pkgconfig_DATA=pc/hidapi-hidraw.pc pc/hidapi-libusb.pc +else +pkgconfig_DATA=pc/hidapi.pc +endif + +SUBDIRS= + +if OS_LINUX +SUBDIRS += linux libusb +endif + +if OS_DARWIN +SUBDIRS += mac +endif + +if OS_FREEBSD +SUBDIRS += libusb +endif + +if OS_KFREEBSD +SUBDIRS += libusb +endif + +if OS_HAIKU +SUBDIRS += libusb +endif + +if OS_WINDOWS +SUBDIRS += windows +endif + +SUBDIRS += hidtest + +if BUILD_TESTGUI +SUBDIRS += testgui +endif + +EXTRA_DIST = udev doxygen + +dist_doc_DATA = \ + README.md \ + AUTHORS.txt \ + LICENSE-bsd.txt \ + LICENSE-gpl3.txt \ + LICENSE-orig.txt \ + LICENSE.txt + +SCMCLEAN_TARGETS= \ + aclocal.m4 \ + config.guess \ + config.sub \ + configure \ + config.h.in \ + depcomp \ + install-sh \ + ltmain.sh \ + missing \ + mac/Makefile.in \ + testgui/Makefile.in \ + libusb/Makefile.in \ + Makefile.in \ + linux/Makefile.in \ + windows/Makefile.in \ + m4/libtool.m4 \ + m4/lt~obsolete.m4 \ + m4/ltoptions.m4 \ + m4/ltsugar.m4 \ + m4/ltversion.m4 + +SCMCLEAN_DIR_TARGETS = \ + autom4te.cache + +scm-clean: distclean + rm -f $(SCMCLEAN_TARGETS) + rm -Rf $(SCMCLEAN_DIR_TARGETS) diff --git a/node_modules/node-hid/hidapi/README.md b/node_modules/node-hid/hidapi/README.md new file mode 100644 index 0000000..cf5e6e0 --- /dev/null +++ b/node_modules/node-hid/hidapi/README.md @@ -0,0 +1,196 @@ +## HIDAPI library for Windows, Linux, FreeBSD and macOS + +| CI instance | Status | +|----------------------|--------| +| `Linux/macOS/Windows (master)` | [![GitHub Builds](https://github.com/libusb/hidapi/actions/workflows/builds.yml/badge.svg?branch=master)](https://github.com/libusb/hidapi/actions/workflows/builds.yml?query=branch%3Amaster) | +| `Windows (master)` | [![Build status](https://ci.appveyor.com/api/projects/status/xfmr5fo8w0re8ded/branch/master?svg=true)](https://ci.appveyor.com/project/libusb/hidapi/branch/master) | +| `BSD, last build (branch/PR)` | [![builds.sr.ht status](https://builds.sr.ht/~z3ntu/hidapi.svg)](https://builds.sr.ht/~z3ntu/hidapi) | +| `Coverity Scan (last)` | [![Coverity Scan](https://scan.coverity.com/projects/583/badge.svg)](https://scan.coverity.com/projects/hidapi) | + +HIDAPI is a multi-platform library which allows an application to interface +with USB and Bluetooth HID-Class devices on Windows, Linux, FreeBSD, and macOS. +HIDAPI can be either built as a shared library (`.so`, `.dll` or `.dylib`) or +can be embedded directly into a target application by adding a _single source_ +file (per platform) and a single header.
+See [remarks](BUILD.md#embedding-hidapi-directly-into-your-source-tree) on embedding _directly_ into your build system. + +HIDAPI library was originally developed by Alan Ott ([signal11](https://github.com/signal11)). + +It was moved to [libusb/hidapi](https://github.com/libusb/hidapi) on June 4th, 2019, in order to merge important bugfixes and continue development of the library. + +## Table of Contents + +* [About](#about) + * [Test GUI](#test-gui) + * [Console Test App](#console-test-app) +* [What Does the API Look Like?](#what-does-the-api-look-like) +* [License](#license) +* [Installing HIDAPI](#installing-hidapi) +* [Build from Source](#build-from-source) + + +## About + +### HIDAPI has four back-ends: +* Windows (using `hid.dll`) +* Linux/hidraw (using the Kernel's hidraw driver) +* libusb (using libusb-1.0 - Linux/BSD/other UNIX-like systems) +* macOS (using IOHidManager) + +On Linux, either the hidraw or the libusb back-end can be used. There are +tradeoffs, and the functionality supported is slightly different. Both are +built by default. It is up to the application linking to hidapi to choose +the backend at link time by linking to either `libhidapi-libusb` or +`libhidapi-hidraw`. + +Note that you will need to install an udev rule file with your application +for unprivileged users to be able to access HID devices with hidapi. Refer +to the [69-hid.rules](udev/69-hid.rules) file in the `udev` directory +for an example. + +#### __Linux/hidraw__ (`linux/hid.c`): + +This back-end uses the hidraw interface in the Linux kernel, and supports +both USB and Bluetooth HID devices. It requires kernel version at least 2.6.39 +to build. In addition, it will only communicate with devices which have hidraw +nodes associated with them. +Keyboards, mice, and some other devices which are blacklisted from having +hidraw nodes will not work. Fortunately, for nearly all the uses of hidraw, +this is not a problem. + +#### __Linux/FreeBSD/libusb__ (`libusb/hid.c`): + +This back-end uses libusb-1.0 to communicate directly to a USB device. This +back-end will of course not work with Bluetooth devices. + +### Test GUI + +HIDAPI also comes with a Test GUI. The Test GUI is cross-platform and uses +Fox Toolkit . It will build on every platform +which HIDAPI supports. Since it relies on a 3rd party library, building it +is optional but it is useful when debugging hardware. + +NOTE: Test GUI based on Fox Toolkit is not actively developed nor supported +by HIDAPI team. It is kept as a historical artifact. It may even work sometime +or on some platforms, but it is not going to get any new features or bugfixes. + +Instructions for installing Fox-Toolkit on each platform is not provided. +Make sure to use Fox-Toolkit v1.6 if you choose to use it. + +### Console Test App + +If you want to play around with your HID device before starting +any development with HIDAPI and using a GUI app is not an option for you, you may try [`hidapitester`](https://github.com/todbot/hidapitester). + +This app has a console interface for most of the features supported +by HIDAPI library. + +## What Does the API Look Like? + +The API provides the most commonly used HID functions including sending +and receiving of input, output, and feature reports. The sample program, +which communicates with a heavily hacked up version of the Microchip USB +Generic HID sample looks like this (with error checking removed for +simplicity): + +**Warning: Only run the code you understand, and only when it conforms to the +device spec. Writing data (`hid_write`) at random to your HID devices can break them.** + +```c +#include // printf +#include // wchar_t + +#include + +#define MAX_STR 255 + +int main(int argc, char* argv[]) +{ + int res; + unsigned char buf[65]; + wchar_t wstr[MAX_STR]; + hid_device *handle; + int i; + + // Initialize the hidapi library + res = hid_init(); + + // Open the device using the VID, PID, + // and optionally the Serial number. + handle = hid_open(0x4d8, 0x3f, NULL); + if (!handle) { + printf("Unable to open device\n"); + hid_exit(); + return 1; + } + + // Read the Manufacturer String + res = hid_get_manufacturer_string(handle, wstr, MAX_STR); + printf("Manufacturer String: %ls\n", wstr); + + // Read the Product String + res = hid_get_product_string(handle, wstr, MAX_STR); + printf("Product String: %ls\n", wstr); + + // Read the Serial Number String + res = hid_get_serial_number_string(handle, wstr, MAX_STR); + printf("Serial Number String: (%d) %ls\n", wstr[0], wstr); + + // Read Indexed String 1 + res = hid_get_indexed_string(handle, 1, wstr, MAX_STR); + printf("Indexed String 1: %ls\n", wstr); + + // Toggle LED (cmd 0x80). The first byte is the report number (0x0). + buf[0] = 0x0; + buf[1] = 0x80; + res = hid_write(handle, buf, 65); + + // Request state (cmd 0x81). The first byte is the report number (0x0). + buf[0] = 0x0; + buf[1] = 0x81; + res = hid_write(handle, buf, 65); + + // Read requested state + res = hid_read(handle, buf, 65); + + // Print out the returned buffer. + for (i = 0; i < 4; i++) + printf("buf[%d]: %d\n", i, buf[i]); + + // Close the device + hid_close(handle); + + // Finalize the hidapi library + res = hid_exit(); + + return 0; +} +``` + +You can also use [hidtest/test.c](hidtest/test.c) +as a starting point for your applications. + + +## License + +HIDAPI may be used by one of three licenses as outlined in [LICENSE.txt](LICENSE.txt). + +## Installing HIDAPI + +If you want to build your own application that uses HID devices with HIDAPI, +you need to get HIDAPI development package. + +Depending on what your development environment is, HIDAPI likely to be provided +by your package manager. + +For instance on Ubuntu, HIDAPI is available via APT: +```sh +sudo apt install libhidapi-dev +``` + +HIDAPI package name for other systems/package managers may differ. +Check the documentation/package list of your package manager. + +## Build from Source + +Check [BUILD.md](BUILD.md) for details. diff --git a/node_modules/node-hid/hidapi/VERSION b/node_modules/node-hid/hidapi/VERSION new file mode 100644 index 0000000..7092c7c --- /dev/null +++ b/node_modules/node-hid/hidapi/VERSION @@ -0,0 +1 @@ +0.15.0 \ No newline at end of file diff --git a/node_modules/node-hid/hidapi/android/jni/Android.mk b/node_modules/node-hid/hidapi/android/jni/Android.mk new file mode 100644 index 0000000..527b43f --- /dev/null +++ b/node_modules/node-hid/hidapi/android/jni/Android.mk @@ -0,0 +1,19 @@ +LOCAL_PATH:= $(call my-dir) + +HIDAPI_ROOT_REL:= ../.. +HIDAPI_ROOT_ABS:= $(LOCAL_PATH)/../.. + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + $(HIDAPI_ROOT_REL)/libusb/hid.c + +LOCAL_C_INCLUDES += \ + $(HIDAPI_ROOT_ABS)/hidapi \ + $(HIDAPI_ROOT_ABS)/android + +LOCAL_SHARED_LIBRARIES := libusb1.0 + +LOCAL_MODULE := libhidapi + +include $(BUILD_SHARED_LIBRARY) diff --git a/node_modules/node-hid/hidapi/bootstrap b/node_modules/node-hid/hidapi/bootstrap new file mode 100755 index 0000000..81e9b74 --- /dev/null +++ b/node_modules/node-hid/hidapi/bootstrap @@ -0,0 +1,2 @@ +#!/bin/sh -x +autoreconf --install --verbose --force diff --git a/node_modules/node-hid/hidapi/configure.ac b/node_modules/node-hid/hidapi/configure.ac new file mode 100644 index 0000000..1b20510 --- /dev/null +++ b/node_modules/node-hid/hidapi/configure.ac @@ -0,0 +1,256 @@ +AC_PREREQ(2.63) + +AC_INIT([hidapi],[m4_normalize(m4_builtin([include], VERSION))],[https://github.com/libusb/hidapi/issues]) + +echo "This build script for HIDAPI is deprecated." +echo "Consider using CMake instead." + +# Library soname version +# Follow the following rules (particularly the ones in the second link): +# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html +# http://sourceware.org/autobook/autobook/autobook_91.html +lt_current="0" +lt_revision="0" +lt_age="0" +LTLDFLAGS="-version-info ${lt_current}:${lt_revision}:${lt_age}" + +AC_CONFIG_MACRO_DIR([m4]) +AM_INIT_AUTOMAKE([foreign -Wall -Werror]) + +m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) +LT_INIT + +AC_PROG_CC +AC_PROG_CXX +AC_PROG_OBJC +PKG_PROG_PKG_CONFIG + + +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +hidapi_lib_error() { + echo "" + echo " Library $1 was not found on this system." + echo " Please install it and re-run ./configure" + echo "" + exit 1 +} + +hidapi_prog_error() { + echo "" + echo " Program $1 was not found on this system." + echo " This program is part of $2." + echo " Please install it and re-run ./configure" + echo "" + exit 1 +} + +AC_MSG_CHECKING([operating system]) +AC_MSG_RESULT($host) +case $host in +*-linux*) + AC_MSG_RESULT([ (Linux back-end)]) + AC_DEFINE(OS_LINUX, 1, [Linux implementations]) + AC_SUBST(OS_LINUX) + backend="linux" + os="linux" + threads="pthreads" + + # HIDAPI/hidraw libs + PKG_CHECK_MODULES([libudev], [libudev], true, [hidapi_lib_error libudev]) + LIBS_HIDRAW_PR="${LIBS_HIDRAW_PR} $libudev_LIBS" + CFLAGS_HIDRAW="${CFLAGS_HIDRAW} $libudev_CFLAGS" + + # HIDAPI/libusb libs + AC_CHECK_LIB([rt], [clock_gettime], [LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} -lrt"], [hidapi_lib_error librt]) + PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9], true, [hidapi_lib_error libusb-1.0]) + LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} $libusb_LIBS" + CFLAGS_LIBUSB="${CFLAGS_LIBUSB} $libusb_CFLAGS" + ;; +*-darwin*) + AC_MSG_RESULT([ (Mac OS X back-end)]) + AC_DEFINE(OS_DARWIN, 1, [Mac implementation]) + AC_SUBST(OS_DARWIN) + backend="mac" + os="darwin" + threads="pthreads" + LIBS="${LIBS} -framework IOKit -framework CoreFoundation" + ;; +*-freebsd*) + AC_MSG_RESULT([ (FreeBSD back-end)]) + AC_DEFINE(OS_FREEBSD, 1, [FreeBSD implementation]) + AC_SUBST(OS_FREEBSD) + backend="libusb" + os="freebsd" + threads="pthreads" + + CFLAGS="$CFLAGS -I/usr/local/include" + LDFLAGS="$LDFLAGS -L/usr/local/lib" + LIBS="${LIBS}" + PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9], true, [hidapi_lib_error libusb-1.0]) + LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} $libusb_LIBS" + CFLAGS_LIBUSB="${CFLAGS_LIBUSB} $libusb_CFLAGS" + AC_CHECK_LIB([iconv], [iconv_open], [LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} -liconv"], [hidapi_lib_error libiconv]) + ;; +*-kfreebsd*) + AC_MSG_RESULT([ (kFreeBSD back-end)]) + AC_DEFINE(OS_KFREEBSD, 1, [kFreeBSD implementation]) + AC_SUBST(OS_KFREEBSD) + backend="libusb" + os="kfreebsd" + threads="pthreads" + + PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9], true, [hidapi_lib_error libusb-1.0]) + LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} $libusb_LIBS" + CFLAGS_LIBUSB="${CFLAGS_LIBUSB} $libusb_CFLAGS" + ;; +*-*-haiku) + AC_MSG_RESULT([ (Haiku back-end)]) + AC_DEFINE(OS_HAIKU, 1, [Haiku implementation]) + AC_SUBST(OS_HAIKU) + backend="libusb" + os="haiku" + threads="pthreads" + + PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9], true, [hidapi_lib_error libusb-1.0]) + LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} $libusb_LIBS" + CFLAGS_LIBUSB="${CFLAGS_LIBUSB} $libusb_CFLAGS" + AC_CHECK_LIB([iconv], [libiconv_open], [LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} -liconv"], [hidapi_lib_error libiconv]) + ;; +*-mingw*) + AC_MSG_RESULT([ (Windows back-end, using MinGW)]) + backend="windows" + os="windows" + threads="windows" + win_implementation="mingw" + LDFLAGS="${LDFLAGS} -static-libgcc" + ;; +*-msys*) + AC_MSG_RESULT([ (Windows back-end, using MSYS2)]) + backend="windows" + os="windows" + threads="windows" + win_implementation="mingw" + LDFLAGS="${LDFLAGS} -static-libgcc" + ;; +*-cygwin*) + AC_MSG_RESULT([ (Windows back-end, using Cygwin)]) + backend="windows" + os="windows" + threads="windows" + win_implementation="cygwin" + ;; +*) + AC_MSG_ERROR([HIDAPI is not supported on your operating system yet]) +esac + +LIBS_HIDRAW="${LIBS} ${LIBS_HIDRAW_PR}" +LIBS_LIBUSB="${LIBS} ${LIBS_LIBUSB_PRIVATE}" +AC_SUBST([LIBS_HIDRAW]) +AC_SUBST([LIBS_LIBUSB]) +AC_SUBST([CFLAGS_LIBUSB]) +AC_SUBST([CFLAGS_HIDRAW]) + +if test "x$os" = xwindows; then + AC_DEFINE(OS_WINDOWS, 1, [Windows implementations]) + AC_SUBST(OS_WINDOWS) + LDFLAGS="${LDFLAGS} -no-undefined" + LIBS="${LIBS}" +fi + +if test "x$threads" = xpthreads; then + AX_PTHREAD([found_pthreads=yes], [found_pthreads=no]) + + if test "x$found_pthreads" = xyes; then + if test "x$os" = xlinux; then + # Only use pthreads for libusb implementation on Linux. + LIBS_LIBUSB="$PTHREAD_LIBS $LIBS_LIBUSB" + CFLAGS_LIBUSB="$CFLAGS_LIBUSB $PTHREAD_CFLAGS" + # There's no separate CC on Linux for threading, + # so it's ok that both implementations use $PTHREAD_CC + CC="$PTHREAD_CC" + else + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + CC="$PTHREAD_CC" + fi + fi +fi + +# Test GUI +AC_ARG_ENABLE([testgui], + [AS_HELP_STRING([--enable-testgui], + [enable building of test GUI (default n)])], + [testgui_enabled=$enableval], + [testgui_enabled='no']) +AM_CONDITIONAL([BUILD_TESTGUI], [test "x$testgui_enabled" != "xno"]) + +# Configure the MacOS TestGUI app bundle +rm -Rf testgui/TestGUI.app +mkdir -p testgui/TestGUI.app +cp -R ${srcdir}/testgui/TestGUI.app.in/* testgui/TestGUI.app +chmod -R u+w testgui/TestGUI.app +mkdir testgui/TestGUI.app/Contents/MacOS/ + +if test "x$testgui_enabled" != "xno"; then + if test "x$os" = xdarwin; then + # On Mac OS, do not use pkg-config. + AC_CHECK_PROG([foxconfig], [fox-config], [fox-config], false) + if test "x$foxconfig" = "xfalse"; then + hidapi_prog_error fox-config "FOX Toolkit" + fi + LIBS_TESTGUI="${LIBS_TESTGUI} `$foxconfig --libs`" + LIBS_TESTGUI="${LIBS_TESTGUI} -framework Cocoa -L/usr/X11R6/lib" + CFLAGS_TESTGUI="${CFLAGS_TESTGUI} `$foxconfig --cflags`" + OBJCFLAGS="${OBJCFLAGS} -x objective-c++" + elif test "x$os" = xwindows; then + # On Windows, just set the paths for Fox toolkit + if test "x$win_implementation" = xmingw; then + CFLAGS_TESTGUI="-I\$(srcdir)/../../hidapi-externals/fox/include -g -c" + LIBS_TESTGUI=" -mwindows \$(srcdir)/../../hidapi-externals/fox/lib/libFOX-1.6.a -lgdi32 -Wl,--enable-auto-import -static-libgcc -static-libstdc++ -lkernel32" + else + # Cygwin + CFLAGS_TESTGUI="-DWIN32 -I\$(srcdir)/../../hidapi-externals/fox/include -g -c" + LIBS_TESTGUI="\$(srcdir)/../../hidapi-externals/fox/lib/libFOX-cygwin-1.6.a -lgdi32 -Wl,--enable-auto-import -static-libgcc -static-libstdc++ -lkernel32" + fi + else + # On Linux and FreeBSD platforms, use pkg-config to find fox. + PKG_CHECK_MODULES([fox], [fox17], [], [PKG_CHECK_MODULES([fox], [fox])]) + LIBS_TESTGUI="${LIBS_TESTGUI} $fox_LIBS" + if test "x$os" = xfreebsd; then + LIBS_TESTGUI="${LIBS_TESTGUI} -L/usr/local/lib" + fi + CFLAGS_TESTGUI="${CFLAGS_TESTGUI} $fox_CFLAGS" + fi +fi +AC_SUBST([LIBS_TESTGUI]) +AC_SUBST([CFLAGS_TESTGUI]) +AC_SUBST([backend]) + +# OS info for Automake +AM_CONDITIONAL(OS_LINUX, test "x$os" = xlinux) +AM_CONDITIONAL(OS_DARWIN, test "x$os" = xdarwin) +AM_CONDITIONAL(OS_FREEBSD, test "x$os" = xfreebsd) +AM_CONDITIONAL(OS_KFREEBSD, test "x$os" = xkfreebsd) +AM_CONDITIONAL(OS_HAIKU, test "x$os" = xhaiku) +AM_CONDITIONAL(OS_WINDOWS, test "x$os" = xwindows) + +AC_CONFIG_HEADERS([config.h]) + +if test "x$os" = "xlinux"; then + AC_CONFIG_FILES([pc/hidapi-hidraw.pc]) + AC_CONFIG_FILES([pc/hidapi-libusb.pc]) +else + AC_CONFIG_FILES([pc/hidapi.pc]) +fi + +AC_SUBST(LTLDFLAGS) + +AC_CONFIG_FILES([Makefile \ + hidtest/Makefile \ + libusb/Makefile \ + linux/Makefile \ + mac/Makefile \ + testgui/Makefile \ + windows/Makefile]) +AC_OUTPUT diff --git a/node_modules/node-hid/hidapi/dist/hidapi.podspec b/node_modules/node-hid/hidapi/dist/hidapi.podspec new file mode 100644 index 0000000..8588514 --- /dev/null +++ b/node_modules/node-hid/hidapi/dist/hidapi.podspec @@ -0,0 +1,31 @@ +Pod::Spec.new do |spec| + + spec.name = "hidapi" + spec.version = File.read('../VERSION') + spec.summary = "A Simple library for communicating with USB and Bluetooth HID devices on Linux, Mac and Windows." + + spec.description = <<-DESC + HIDAPI is a multi-platform library which allows an application to interface with USB and Bluetooth HID-Class devices on Windows, Linux, FreeBSD, and macOS. HIDAPI can be either built as a shared library (.so, .dll or .dylib) or can be embedded directly into a target application by adding a single source file (per platform) and a single header. + DESC + + spec.homepage = "https://github.com/libusb/hidapi" + + spec.license = { :type=> "GNU GPLv3 or BSD or HIDAPI original", :file => "LICENSE.txt" } + + spec.authors = { "Alan Ott" => "alan@signal11.us", + "Ludovic Rousseau" => "rousseau@debian.org", + "libusb/hidapi Team" => "https://github.com/libusb/hidapi/blob/master/AUTHORS.txt", + } + + spec.platform = :osx + spec.osx.deployment_target = "10.7" + + spec.source = { :git => "https://github.com/libusb/hidapi.git", :tag => "hidapi-#{spec.version}" } + + spec.source_files = "mac/hid.c", "hidapi/hidapi.h", "mac/hidapi_darwin.h" + + spec.public_header_files = "hidapi/hidapi.h", "mac/hidapi_darwin.h" + + spec.frameworks = "IOKit", "CoreFoundation" + +end diff --git a/node_modules/node-hid/hidapi/documentation/cmake-gui-drop-down.png b/node_modules/node-hid/hidapi/documentation/cmake-gui-drop-down.png new file mode 100644 index 0000000..548abe8 Binary files /dev/null and b/node_modules/node-hid/hidapi/documentation/cmake-gui-drop-down.png differ diff --git a/node_modules/node-hid/hidapi/documentation/cmake-gui-highlights.png b/node_modules/node-hid/hidapi/documentation/cmake-gui-highlights.png new file mode 100644 index 0000000..228838f Binary files /dev/null and b/node_modules/node-hid/hidapi/documentation/cmake-gui-highlights.png differ diff --git a/node_modules/node-hid/hidapi/doxygen/Doxyfile b/node_modules/node-hid/hidapi/doxygen/Doxyfile new file mode 100644 index 0000000..4e01360 --- /dev/null +++ b/node_modules/node-hid/hidapi/doxygen/Doxyfile @@ -0,0 +1,2724 @@ +# Doxyfile 1.9.6 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). +# +# Note: +# +# Use doxygen to compare the used configuration file with the template +# configuration file: +# doxygen -x [configFile] +# Use doxygen to compare the used configuration file with the template +# configuration file without replacing the environment variables or CMake type +# replacement variables: +# doxygen -x_noenv [configFile] + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = hidapi + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 +# sub-directories (in 2 levels) under the output directory of each output format +# and will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to +# control the number of sub-directories. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# Controls the number of sub-directories that will be created when +# CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every +# level increment doubles the number of directories, resulting in 4096 +# directories at level 8 which is the default and also the maximum value. The +# sub-directories are organized in 2 levels, the first level always has a fixed +# number of 16 directories. +# Minimum value: 0, maximum value: 8, default value: 8. +# This tag requires that the tag CREATE_SUBDIRS is set to YES. + +CREATE_SUBDIRS_LEVEL = 8 + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian, +# Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English +# (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek, +# Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with +# English messages), Korean, Korean-en (Korean with English messages), Latvian, +# Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, +# Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, +# Swedish, Turkish, Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = ../ + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:^^" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". Note that you cannot put \n's in the value part of an alias +# to insert newlines (in the resulting output). You can put ^^ in the value part +# of an alias to insert a newline as if a physical newline was in the original +# file. When you need a literal { or } or , in the value part of an alias you +# have to escape them by means of a backslash (\), this can lead to conflicts +# with the commands \{ and \} for these it is advised to use the version @{ and +# @} or use a double escape (\\{ and \\}) + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice, +# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See https://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = NO + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 5. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 5 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which effectively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# will also hide undocumented C++ concepts if enabled. This option has no effect +# if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# declarations. If set to NO, these declarations will be included in the +# documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. +# Possible values are: SYSTEM, NO and YES. +# The default value is: SYSTEM. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class +# will show which file needs to be included to use the class. +# The default value is: YES. + +SHOW_HEADERFILE = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. See also section "Changing the +# layout of pages" for information. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as documenting some parameters in +# a documented function twice, or documenting parameters that don't exist or +# using markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete +# function parameter documentation. If set to NO, doxygen will accept that some +# parameters have no documentation without warning. +# The default value is: YES. + +WARN_IF_INCOMPLETE_DOC = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong parameter +# documentation, but not about the absence of documentation. If EXTRACT_ALL is +# set to YES then this flag will automatically be disabled. See also +# WARN_IF_INCOMPLETE_DOC +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If WARN_IF_UNDOC_ENUM_VAL option is set to YES, doxygen will warn about +# undocumented enumeration values. If set to NO, doxygen will accept +# undocumented enumeration values. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: NO. + +WARN_IF_UNDOC_ENUM_VAL = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# Possible values are: NO, YES and FAIL_ON_WARNINGS. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# See also: WARN_LINE_FORMAT +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# In the $text part of the WARN_FORMAT command it is possible that a reference +# to a more specific place is given. To make it easier to jump to this place +# (outside of doxygen) the user can define a custom "cut" / "paste" string. +# Example: +# WARN_LINE_FORMAT = "'vi $file +$line'" +# See also: WARN_FORMAT +# The default value is: at line $line of file $file. + +WARN_LINE_FORMAT = "at line $line of file $file" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). In case the file specified cannot be opened for writing the +# warning and error messages are written to standard error. When as file - is +# specified the warning and error messages are written to standard output +# (stdout). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = ../hidapi \ + ./main_page.md + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. +# See also: INPUT_FILE_ENCODING +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses The INPUT_FILE_ENCODING tag can be used to specify +# character encoding on a per file pattern basis. Doxygen will compare the file +# name with each pattern and apply the encoding instead of the default +# INPUT_ENCODING) if there is a match. The character encodings are a list of the +# form: pattern=encoding (like *.php=ISO-8859-1). See cfg_input_encoding +# "INPUT_ENCODING" for further information on supported encodings. + +INPUT_FILE_ENCODING = + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, +# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C +# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, +# *.vhdl, *.ucf, *.qsf and *.ice. + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# ANamespace::AClass, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = HID_API_AS_STR_IMPL \ + HID_API_AS_STR \ + HID_API_TO_VERSION_STR + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = ../hidtest + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = *.c + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that doxygen will use the data processed and written to standard output +# for further processing, therefore nothing else, like debug statements or used +# commands (so in case of a Windows batch file always use @echo OFF), should be +# written to standard output. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = main_page.md + +# The Fortran standard specifies that for fixed formatted Fortran code all +# characters from position 72 are to be considered as comment. A common +# extension is to allow longer lines before the automatic comment starts. The +# setting FORTRAN_COMMENT_AFTER will also make it possible that longer lines can +# be processed before the automatic comment starts. +# Minimum value: 7, maximum value: 10000, default value: 72. + +FORTRAN_COMMENT_AFTER = 72 + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# entity all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see https://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: +# http://clang.llvm.org/) for more accurate parsing at the cost of reduced +# performance. This can be particularly helpful with template rich C++ code for +# which doxygen's built-in parser lacks the necessary type information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If the CLANG_ASSISTED_PARSING tag is set to YES and the CLANG_ADD_INC_PATHS +# tag is set to YES then doxygen will add the directory of each input to the +# include path. +# The default value is: YES. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_ADD_INC_PATHS = YES + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the directory containing a file called compile_commands.json. This +# file is the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the +# options used when the source files were built. This is equivalent to +# specifying the -p option to a clang tool, such as clang-check. These options +# will then be passed to the parser. Any options specified with CLANG_OPTIONS +# will be added as well. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. + +CLANG_DATABASE_PATH = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) +# that should be ignored while generating the index headers. The IGNORE_PREFIX +# tag works for classes, function and member names. The entity will be placed in +# the alphabetical list under the first letter of the entity name that remains +# after removing the prefix. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). +# Note: Since the styling of scrollbars can currently not be overruled in +# Webkit/Chromium, the styling will be left out of the default doxygen.css if +# one or more extra stylesheets have been specified. So if scrollbar +# customization is desired it has to be added explicitly. For an example see the +# documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output +# should be rendered with a dark or light theme. +# Possible values are: LIGHT always generate light mode output, DARK always +# generate dark mode output, AUTO_LIGHT automatically set the mode according to +# the user preference, use light mode if no preference is set (the default), +# AUTO_DARK automatically set the mode according to the user preference, use +# dark mode if no preference is set and TOGGLE allow to user to switch between +# light and dark mode via a button. +# The default value is: AUTO_LIGHT. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE = AUTO_LIGHT + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a color-wheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use gray-scales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via JavaScript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have JavaScript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag determines the URL of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDURL = + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# on Windows. In the beginning of 2021 Microsoft took the original page, with +# a.o. the download links, offline the HTML help workshop was already many years +# in maintenance mode). You can download the HTML help workshop from the web +# archives at Installation executable (see: +# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo +# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe). +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the main .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine tune the look of the index (see "Fine-tuning the output"). As an +# example, the default style sheet generated by doxygen has an example that +# shows how to put an image at the root of the tree instead of the PROJECT_NAME. +# Since the tree basically has the same information as the tab index, you could +# consider setting DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the +# FULL_SIDEBAR option determines if the side bar is limited to only the treeview +# area (value NO) or if it should extend to the full height of the window (value +# YES). Setting this to YES gives a layout similar to +# https://docs.readthedocs.io with more room for contents, but less room for the +# project logo, title, and description. If either GENERATE_TREEVIEW or +# DISABLE_INDEX is set to NO, this option has no effect. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FULL_SIDEBAR = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email +# addresses. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +OBFUSCATE_EMAILS = YES + +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. + +FORMULA_MACROFILE = + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# https://www.mathjax.org) which uses client side JavaScript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# With MATHJAX_VERSION it is possible to specify the MathJax version to be used. +# Note that the different versions of MathJax have different requirements with +# regards to the different settings, so it is possible that also other MathJax +# settings have to be changed when switching between the different MathJax +# versions. +# Possible values are: MathJax_2 and MathJax_3. +# The default value is: MathJax_2. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_VERSION = MathJax_2 + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. For more details about the output format see MathJax +# version 2 (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3 +# (see: +# http://docs.mathjax.org/en/latest/web/components/output.html). +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility. This is the name for Mathjax version 2, for MathJax version 3 +# this will be translated into chtml), NativeMML (i.e. MathML. Only supported +# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This +# is the name for Mathjax version 3, for MathJax version 2 this will be +# translated into HTML-CSS) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from https://www.mathjax.org before deployment. The default value is: +# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2 +# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3 +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/ + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# for MathJax version 2 (see +# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions): +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# For example for MathJax version 3 (see +# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html): +# MATHJAX_EXTENSIONS = ams +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /