@hyperfrontend/questions 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/FUNDING.md +141 -0
- package/LICENSE.md +21 -0
- package/README.md +147 -0
- package/SECURITY.md +82 -0
- package/index.cjs.js +1217 -0
- package/index.cjs.js.map +1 -0
- package/index.d.ts +12 -0
- package/index.d.ts.map +1 -0
- package/index.esm.js +1211 -0
- package/index.esm.js.map +1 -0
- package/package.json +54 -0
- package/render.d.ts +113 -0
- package/render.d.ts.map +1 -0
- package/terminal.d.ts +109 -0
- package/terminal.d.ts.map +1 -0
- package/types.d.ts +108 -0
- package/types.d.ts.map +1 -0
package/CHANGELOG.md
ADDED
package/FUNDING.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Funding & Support
|
|
2
|
+
|
|
3
|
+
Thank you for considering supporting hyperfrontend! Your contributions help maintain and improve this project.
|
|
4
|
+
|
|
5
|
+
## Why Support hyperfrontend?
|
|
6
|
+
|
|
7
|
+
hyperfrontend is an open-source project that provides:
|
|
8
|
+
|
|
9
|
+
- 🔧 Framework-agnostic micro-frontend architecture
|
|
10
|
+
- 📦 Multiple packages and tools for building scalable web applications
|
|
11
|
+
- 📚 Comprehensive documentation and examples
|
|
12
|
+
- 🆓 Free for everyone to use
|
|
13
|
+
|
|
14
|
+
Your support helps:
|
|
15
|
+
|
|
16
|
+
- ⏰ Dedicate more time to development and maintenance
|
|
17
|
+
- 🐛 Fix bugs and address issues faster
|
|
18
|
+
- ✨ Build new features and improvements
|
|
19
|
+
- 📖 Create better documentation and tutorials
|
|
20
|
+
- 🌟 Keep the project sustainable long-term
|
|
21
|
+
|
|
22
|
+
## How to Support
|
|
23
|
+
|
|
24
|
+
### 💖 GitHub Sponsors
|
|
25
|
+
|
|
26
|
+
You can sponsor the project through GitHub Sponsors:
|
|
27
|
+
|
|
28
|
+
**[Sponsor @AndrewRedican on GitHub](https://github.com/sponsors/AndrewRedican)**
|
|
29
|
+
|
|
30
|
+
GitHub Sponsors benefits:
|
|
31
|
+
|
|
32
|
+
- Direct support to the maintainer
|
|
33
|
+
- No platform fees (GitHub covers them)
|
|
34
|
+
- Various sponsorship tiers available
|
|
35
|
+
- Recognition in the project
|
|
36
|
+
|
|
37
|
+
### 🌐 One-time Donations
|
|
38
|
+
|
|
39
|
+
You can also make a one-time contribution:
|
|
40
|
+
|
|
41
|
+
**[Donate via hyperfrontend.dev](https://hyperfrontend.dev/sponsor)**
|
|
42
|
+
|
|
43
|
+
### 🏢 Corporate Sponsorship
|
|
44
|
+
|
|
45
|
+
If your company uses hyperfrontend in production, consider becoming a corporate sponsor:
|
|
46
|
+
|
|
47
|
+
- **Bronze Sponsor** ($100/month) - Logo in README
|
|
48
|
+
- **Silver Sponsor** ($500/month) - Logo in README + website
|
|
49
|
+
- **Gold Sponsor** ($1000/month) - Logo placement + priority support
|
|
50
|
+
- **Platinum Sponsor** ($2500/month) - All benefits + consulting hours
|
|
51
|
+
|
|
52
|
+
Contact: andrew.redican.mejia@gmail.com
|
|
53
|
+
|
|
54
|
+
## Other Ways to Contribute
|
|
55
|
+
|
|
56
|
+
Not everyone can contribute financially, and that's okay! There are many other ways to support:
|
|
57
|
+
|
|
58
|
+
### 💻 Code Contributions
|
|
59
|
+
|
|
60
|
+
- Submit bug fixes
|
|
61
|
+
- Add new features
|
|
62
|
+
- Improve documentation
|
|
63
|
+
- Write tests
|
|
64
|
+
|
|
65
|
+
See our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
66
|
+
|
|
67
|
+
### 📣 Spread the Word
|
|
68
|
+
|
|
69
|
+
- ⭐ Star the repository on GitHub
|
|
70
|
+
- 🐦 Share on social media
|
|
71
|
+
- 📝 Write blog posts or tutorials
|
|
72
|
+
- 🎤 Give talks about hyperfrontend at meetups/conferences
|
|
73
|
+
|
|
74
|
+
### 🐛 Bug Reports
|
|
75
|
+
|
|
76
|
+
- Report issues you encounter
|
|
77
|
+
- Help triage existing issues
|
|
78
|
+
- Provide detailed reproduction steps
|
|
79
|
+
|
|
80
|
+
### 📚 Documentation
|
|
81
|
+
|
|
82
|
+
- Improve existing docs
|
|
83
|
+
- Write tutorials and guides
|
|
84
|
+
- Translate documentation
|
|
85
|
+
- Create video tutorials
|
|
86
|
+
|
|
87
|
+
### 💬 Community Support
|
|
88
|
+
|
|
89
|
+
- Answer questions in issues
|
|
90
|
+
- Help other users on discussions
|
|
91
|
+
- Share your use cases and examples
|
|
92
|
+
|
|
93
|
+
## Current Sponsors
|
|
94
|
+
|
|
95
|
+
Thank you to all our sponsors and backers! 🙏
|
|
96
|
+
|
|
97
|
+
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
98
|
+
|
|
99
|
+
[](#contributors)
|
|
100
|
+
|
|
101
|
+
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
102
|
+
|
|
103
|
+
### Corporate Sponsors
|
|
104
|
+
|
|
105
|
+
<!-- Corporate sponsors will be listed here -->
|
|
106
|
+
|
|
107
|
+
_Interested in corporate sponsorship? [Contact us](mailto:andrew.redican.mejia@gmail.com)_
|
|
108
|
+
|
|
109
|
+
### Individual Sponsors
|
|
110
|
+
|
|
111
|
+
<!-- Sponsors will be automatically listed through GitHub Sponsors -->
|
|
112
|
+
|
|
113
|
+
_Become the first sponsor!_ ❤️
|
|
114
|
+
|
|
115
|
+
## Recognition
|
|
116
|
+
|
|
117
|
+
All sponsors and contributors are recognized in:
|
|
118
|
+
|
|
119
|
+
- Project README
|
|
120
|
+
- Project website (coming soon)
|
|
121
|
+
- Release notes (for significant contributions)
|
|
122
|
+
|
|
123
|
+
## Transparency
|
|
124
|
+
|
|
125
|
+
All sponsorship funds are used for:
|
|
126
|
+
|
|
127
|
+
- Development time and effort
|
|
128
|
+
- Infrastructure costs (hosting, CI/CD, domains)
|
|
129
|
+
- Development tools and services
|
|
130
|
+
- Community building and events
|
|
131
|
+
|
|
132
|
+
## Questions?
|
|
133
|
+
|
|
134
|
+
If you have questions about sponsorship or funding, please contact:
|
|
135
|
+
|
|
136
|
+
**Email**: andrew.redican.mejia@gmail.com
|
|
137
|
+
**GitHub**: [@AndrewRedican](https://github.com/AndrewRedican)
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
Thank you for your support! Every contribution, whether code, documentation, or financial, helps make hyperfrontend better for everyone. 🚀
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Andrew Redican
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# @hyperfrontend/questions
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://github.com/AndrewRedican/hyperfrontend/actions/workflows/ci-lib-questions.yml">
|
|
5
|
+
<img src="https://img.shields.io/github/actions/workflow/status/AndrewRedican/hyperfrontend/ci-lib-questions.yml?style=flat-square&logo=github&label=build" alt="Build">
|
|
6
|
+
</a>
|
|
7
|
+
<a href="https://codecov.io/gh/AndrewRedican/hyperfrontend/flags?flags%5B0%5D=questions">
|
|
8
|
+
<img src="https://codecov.io/gh/AndrewRedican/hyperfrontend/graph/badge.svg?flag=questions" alt="Coverage">
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://www.npmjs.com/package/@hyperfrontend/questions">
|
|
11
|
+
<img src="https://img.shields.io/npm/v/@hyperfrontend/questions?style=flat-square" alt="npm version">
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://bundlephobia.com/package/@hyperfrontend/questions">
|
|
14
|
+
<img src="https://img.shields.io/bundlephobia/min/%40hyperfrontend%2Fquestions?style=flat-square" alt="npm bundle size">
|
|
15
|
+
</a>
|
|
16
|
+
</p>
|
|
17
|
+
<p align="center">
|
|
18
|
+
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
19
|
+
<a href="#contributors">
|
|
20
|
+
<img src="https://img.shields.io/github/all-contributors/AndrewRedican/hyperfrontend?color=ee8449&style=flat-square" alt="All Contributors">
|
|
21
|
+
</a>
|
|
22
|
+
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
23
|
+
<a href="https://github.com/AndrewRedican/hyperfrontend/blob/main/LICENSE.md">
|
|
24
|
+
<img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="License">
|
|
25
|
+
</a>
|
|
26
|
+
<a href="https://www.npmjs.com/package/@hyperfrontend/questions">
|
|
27
|
+
<img src="https://img.shields.io/npm/dm/@hyperfrontend/questions?style=flat-square" alt="npm downloads">
|
|
28
|
+
</a>
|
|
29
|
+
<a href="https://github.com/AndrewRedican/hyperfrontend">
|
|
30
|
+
<img src="https://img.shields.io/github/stars/AndrewRedican/hyperfrontend?style=flat-square" alt="GitHub stars">
|
|
31
|
+
</a>
|
|
32
|
+
<img src="https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen?style=flat-square&logo=node.js" alt="Node Version">
|
|
33
|
+
<img src="https://img.shields.io/badge/tree%20shakeable-%E2%9C%93-success?style=flat-square" alt="Tree Shakeable">
|
|
34
|
+
</p>
|
|
35
|
+
|
|
36
|
+
Terminal prompting library with composable, functional API for text, select, confirm, and multiselect prompts
|
|
37
|
+
|
|
38
|
+
• 👉 See [**documentation**](https://www.hyperfrontend.dev/docs/libraries/questions/)
|
|
39
|
+
|
|
40
|
+
## What is @hyperfrontend/questions?
|
|
41
|
+
|
|
42
|
+
A terminal prompting library built on functional programming principles. Create interactive CLI experiences with composable, type-safe prompts that return structured outcomes.
|
|
43
|
+
|
|
44
|
+
### Key Features
|
|
45
|
+
|
|
46
|
+
- **Pure Functions** — Every prompt is a pure function returning `Promise<PromptOutcome<T>>`, making results predictable and easily testable
|
|
47
|
+
- **Composable API** — Build complex interactive flows by combining simple prompt functions
|
|
48
|
+
- **Type-Safe** — Full TypeScript support with discriminated unions for prompt outcomes
|
|
49
|
+
- **Zero External Dependencies** — Uses only Node.js built-ins and `@hyperfrontend` utilities
|
|
50
|
+
- **Searchable Multiselect** — Type-to-filter functionality for large option lists
|
|
51
|
+
|
|
52
|
+
### Architecture Highlights
|
|
53
|
+
|
|
54
|
+
Each prompt follows a functional state machine pattern:
|
|
55
|
+
|
|
56
|
+
- **Immutable State** — All prompt state is frozen; updates create new state objects
|
|
57
|
+
- **Explicit Outcomes** — Prompts return either `{ result: 'submitted', value: T }` or `{ result: 'cancelled', value: undefined }`
|
|
58
|
+
- **Terminal Abstraction** — Low-level I/O is encapsulated in a `Terminal` interface for testability
|
|
59
|
+
|
|
60
|
+
## Why Use @hyperfrontend/questions?
|
|
61
|
+
|
|
62
|
+
When building CLI tools, you need interactive prompts that are:
|
|
63
|
+
|
|
64
|
+
1. **Predictable** — Know exactly what a prompt returns, always
|
|
65
|
+
2. **Composable** — Chain prompts without callback hell
|
|
66
|
+
3. **Cancellable** — Handle Ctrl+C gracefully with structured cancellation
|
|
67
|
+
4. **Lightweight** — No large dependency trees for simple prompts
|
|
68
|
+
|
|
69
|
+
This library provides all four while staying true to functional programming principles.
|
|
70
|
+
|
|
71
|
+
## Installation
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install @hyperfrontend/questions
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Quick Start
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import { text, confirm, select, multiselect, PromptResult } from '@hyperfrontend/questions'
|
|
81
|
+
|
|
82
|
+
// Text input
|
|
83
|
+
const nameResult = await text({
|
|
84
|
+
message: 'What is your name?',
|
|
85
|
+
validate: (value) => (value.length < 2 ? 'Name too short' : undefined),
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
if (nameResult.result === PromptResult.Submitted) {
|
|
89
|
+
console.log(`Hello, ${nameResult.value}!`)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Confirmation
|
|
93
|
+
const continueResult = await confirm({
|
|
94
|
+
message: 'Continue?',
|
|
95
|
+
initial: true,
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
// Single select
|
|
99
|
+
const colorResult = await select({
|
|
100
|
+
message: 'Pick a color:',
|
|
101
|
+
choices: [
|
|
102
|
+
{ label: 'Red', value: 'red' },
|
|
103
|
+
{ label: 'Green', value: 'green', hint: 'recommended' },
|
|
104
|
+
{ label: 'Blue', value: 'blue' },
|
|
105
|
+
],
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
// Multiselect with search
|
|
109
|
+
const featuresResult = await multiselect({
|
|
110
|
+
message: 'Select features:',
|
|
111
|
+
choices: [
|
|
112
|
+
{ label: 'TypeScript', value: 'ts' },
|
|
113
|
+
{ label: 'ESLint', value: 'eslint' },
|
|
114
|
+
{ label: 'Prettier', value: 'prettier' },
|
|
115
|
+
],
|
|
116
|
+
searchable: true,
|
|
117
|
+
min: 1,
|
|
118
|
+
})
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## API Overview
|
|
122
|
+
|
|
123
|
+
| Function | Description |
|
|
124
|
+
| -------------- | ------------------------------------------------- |
|
|
125
|
+
| `text` | Free-form text input with optional validation |
|
|
126
|
+
| `confirm` | Yes/no confirmation prompt |
|
|
127
|
+
| `select` | Single selection from a list of choices |
|
|
128
|
+
| `multiselect` | Multiple selections with optional search |
|
|
129
|
+
| `PromptResult` | Discriminated union: `'submitted' \| 'cancelled'` |
|
|
130
|
+
|
|
131
|
+
All prompts return `Promise<PromptOutcome<T>>` where:
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
type PromptOutcome<T> = { result: 'submitted'; value: T } | { result: 'cancelled'; value: undefined }
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Compatibility
|
|
138
|
+
|
|
139
|
+
| Environment | Supported |
|
|
140
|
+
| -------------- | --------- |
|
|
141
|
+
| Node.js >= 18 | ✅ |
|
|
142
|
+
| TTY Terminal | ✅ |
|
|
143
|
+
| Tree Shakeable | ✅ |
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
[MIT](https://github.com/AndrewRedican/hyperfrontend/blob/main/LICENSE.md)
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Reporting a Vulnerability
|
|
4
|
+
|
|
5
|
+
We take the security of hyperfrontend seriously. If you discover a security vulnerability, please help us protect our users by following responsible disclosure practices.
|
|
6
|
+
|
|
7
|
+
### How to Report
|
|
8
|
+
|
|
9
|
+
**Please DO NOT report security vulnerabilities through public GitHub issues.**
|
|
10
|
+
|
|
11
|
+
Instead, please report security vulnerabilities directly via email to:
|
|
12
|
+
|
|
13
|
+
**<andrew.redican.mejia@gmail.com>**
|
|
14
|
+
|
|
15
|
+
### What to Include
|
|
16
|
+
|
|
17
|
+
To help us understand and resolve the issue quickly, please include the following information in your report:
|
|
18
|
+
|
|
19
|
+
- **Description**: A clear description of the vulnerability
|
|
20
|
+
- **Impact**: The potential impact and severity of the issue
|
|
21
|
+
- **Reproduction Steps**: Detailed steps to reproduce the vulnerability
|
|
22
|
+
- **Environment**: The version of hyperfrontend affected, browser/Node.js version, operating system, etc.
|
|
23
|
+
- **Proof of Concept**: If possible, include a minimal code example or proof of concept
|
|
24
|
+
- **Suggested Fix**: If you have ideas on how to fix the issue (optional)
|
|
25
|
+
|
|
26
|
+
### Response Timeline
|
|
27
|
+
|
|
28
|
+
- **Acknowledgment**: We will acknowledge receipt of your vulnerability report within 2 business days
|
|
29
|
+
- **Initial Assessment**: We will provide an initial assessment within 5 business days
|
|
30
|
+
- **Patch Development**: We aim to develop and test a patch within 10 days of acknowledgment
|
|
31
|
+
- **Public Disclosure**: Please allow at least **10 days** from the initial report before making the vulnerability publicly known
|
|
32
|
+
|
|
33
|
+
This grace period gives us time to:
|
|
34
|
+
|
|
35
|
+
- Verify and reproduce the issue
|
|
36
|
+
- Develop and test a fix
|
|
37
|
+
- Release a patched version
|
|
38
|
+
- Notify users to update their dependencies
|
|
39
|
+
|
|
40
|
+
### Coordinated Disclosure
|
|
41
|
+
|
|
42
|
+
We believe in coordinated disclosure and appreciate your cooperation in:
|
|
43
|
+
|
|
44
|
+
- Not exploiting the vulnerability beyond what is necessary to demonstrate it
|
|
45
|
+
- Not accessing, modifying, or deleting data that doesn't belong to you
|
|
46
|
+
- Allowing us reasonable time to address the issue before public disclosure
|
|
47
|
+
- Making a good faith effort to avoid privacy violations, data destruction, and service interruption
|
|
48
|
+
|
|
49
|
+
### Recognition
|
|
50
|
+
|
|
51
|
+
Once the vulnerability is patched and publicly disclosed, we will acknowledge your responsible disclosure in:
|
|
52
|
+
|
|
53
|
+
- Our release notes
|
|
54
|
+
- Our security advisories (if applicable)
|
|
55
|
+
- This SECURITY.md file (with your permission)
|
|
56
|
+
|
|
57
|
+
Thank you for helping keep hyperfrontend and its users safe!
|
|
58
|
+
|
|
59
|
+
## Security Best Practices
|
|
60
|
+
|
|
61
|
+
When using hyperfrontend in your applications:
|
|
62
|
+
|
|
63
|
+
1. **Keep Dependencies Updated**: Regularly update to the latest version to receive security patches
|
|
64
|
+
2. **Content Security Policy**: Implement appropriate CSP headers when embedding features
|
|
65
|
+
3. **Input Validation**: Validate and sanitize all data passed between features
|
|
66
|
+
4. **Origin Verification**: Always verify the origin of messages in cross-frame communication
|
|
67
|
+
5. **Authentication**: Implement proper authentication and authorization for sensitive features
|
|
68
|
+
6. **HTTPS**: Always serve hyperfrontend features over HTTPS in production
|
|
69
|
+
|
|
70
|
+
## Security Updates
|
|
71
|
+
|
|
72
|
+
Security updates will be released as patch versions and documented in the [CHANGELOG](https://github.com/AndrewRedican/hyperfrontend/releases) and GitHub Security Advisories.
|
|
73
|
+
|
|
74
|
+
## Supported Versions
|
|
75
|
+
|
|
76
|
+
We currently provide security updates for:
|
|
77
|
+
|
|
78
|
+
| Version | Supported |
|
|
79
|
+
| ------- | ------------------ |
|
|
80
|
+
| 0.0.x | :white_check_mark: |
|
|
81
|
+
|
|
82
|
+
As the project matures, we will update this table to reflect our long-term support policy.
|