portapack 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +67 -8
- package/.releaserc.js +25 -27
- package/CHANGELOG.md +14 -22
- package/LICENSE.md +21 -0
- package/README.md +22 -53
- package/commitlint.config.js +30 -34
- package/dist/cli/cli-entry.cjs +183 -98
- package/dist/cli/cli-entry.cjs.map +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +178 -97
- package/dist/index.js.map +1 -1
- package/docs/.vitepress/config.ts +38 -33
- package/docs/.vitepress/sidebar-generator.ts +89 -38
- package/docs/architecture.md +186 -0
- package/docs/cli.md +23 -23
- package/docs/code-of-conduct.md +7 -1
- package/docs/configuration.md +12 -11
- package/docs/contributing.md +6 -2
- package/docs/deployment.md +10 -5
- package/docs/development.md +8 -5
- package/docs/getting-started.md +13 -13
- package/docs/index.md +1 -1
- package/docs/public/android-chrome-192x192.png +0 -0
- package/docs/public/android-chrome-512x512.png +0 -0
- package/docs/public/apple-touch-icon.png +0 -0
- package/docs/public/favicon-16x16.png +0 -0
- package/docs/public/favicon-32x32.png +0 -0
- package/docs/public/favicon.ico +0 -0
- package/docs/roadmap.md +233 -0
- package/docs/site.webmanifest +1 -0
- package/docs/troubleshooting.md +12 -1
- package/examples/main.ts +5 -30
- package/examples/sample-project/script.js +1 -1
- package/jest.config.ts +8 -13
- package/nodemon.json +5 -10
- package/package.json +2 -5
- package/src/cli/cli-entry.ts +2 -2
- package/src/cli/cli.ts +21 -16
- package/src/cli/options.ts +127 -113
- package/src/core/bundler.ts +253 -222
- package/src/core/extractor.ts +632 -565
- package/src/core/minifier.ts +173 -162
- package/src/core/packer.ts +141 -137
- package/src/core/parser.ts +74 -73
- package/src/core/web-fetcher.ts +270 -258
- package/src/index.ts +18 -17
- package/src/types.ts +9 -11
- package/src/utils/font.ts +12 -6
- package/src/utils/logger.ts +110 -105
- package/src/utils/meta.ts +75 -76
- package/src/utils/mime.ts +50 -50
- package/src/utils/slugify.ts +33 -34
- package/tests/unit/cli/cli-entry.test.ts +72 -70
- package/tests/unit/cli/cli.test.ts +314 -278
- package/tests/unit/cli/options.test.ts +294 -301
- package/tests/unit/core/bundler.test.ts +426 -329
- package/tests/unit/core/extractor.test.ts +793 -549
- package/tests/unit/core/minifier.test.ts +374 -274
- package/tests/unit/core/packer.test.ts +298 -264
- package/tests/unit/core/parser.test.ts +538 -150
- package/tests/unit/core/web-fetcher.test.ts +389 -359
- package/tests/unit/index.test.ts +238 -197
- package/tests/unit/utils/font.test.ts +26 -21
- package/tests/unit/utils/logger.test.ts +267 -260
- package/tests/unit/utils/meta.test.ts +29 -28
- package/tests/unit/utils/mime.test.ts +73 -74
- package/tests/unit/utils/slugify.test.ts +14 -12
- package/tsconfig.build.json +9 -10
- package/tsconfig.jest.json +1 -1
- package/tsconfig.json +2 -2
- package/tsup.config.ts +8 -9
- package/typedoc.json +5 -9
- /package/docs/{portapack-transparent.png → public/portapack-transparent.png} +0 -0
- /package/docs/{portapack.jpg → public/portapack.jpg} +0 -0
package/docs/contributing.md
CHANGED
@@ -17,10 +17,12 @@ Refer to our detailed [Development Guide](./development.md) for comprehensive se
|
|
17
17
|
### 🧪 Development Workflow
|
18
18
|
|
19
19
|
1. **Fork the Repository**
|
20
|
+
|
20
21
|
- Navigate to [PortaPack GitHub Repository](https://github.com/manicinc/portapack)
|
21
|
-
- Click "Fork"
|
22
|
+
- Click "Fork"
|
22
23
|
|
23
24
|
2. **Clone Your Fork**
|
25
|
+
|
24
26
|
```bash
|
25
27
|
git clone https://github.com/YOUR_USERNAME/portapack.git
|
26
28
|
cd portapack
|
@@ -38,6 +40,7 @@ Refer to our detailed [Development Guide](./development.md) for comprehensive se
|
|
38
40
|
We use [Conventional Commits](https://www.conventionalcommits.org/) for structured commit messages.
|
39
41
|
|
40
42
|
#### Commit Types
|
43
|
+
|
41
44
|
- `feat`: New features
|
42
45
|
- `fix`: Bug fixes
|
43
46
|
- `docs`: Documentation changes
|
@@ -47,6 +50,7 @@ We use [Conventional Commits](https://www.conventionalcommits.org/) for structur
|
|
47
50
|
- `chore`: Maintenance tasks
|
48
51
|
|
49
52
|
#### Commit Command
|
53
|
+
|
50
54
|
```bash
|
51
55
|
npm run commit
|
52
56
|
```
|
@@ -104,4 +108,4 @@ Please review our [Code of Conduct](./code-of-conduct.md) before contributing.
|
|
104
108
|
|
105
109
|
Open source thrives on community contributions. Your effort helps improve PortaPack for everyone! 🎉
|
106
110
|
|
107
|
-
**Happy Coding!** 💻✨
|
111
|
+
**Happy Coding!** 💻✨
|
package/docs/deployment.md
CHANGED
@@ -16,10 +16,10 @@ When changes are pushed to master, semantic-release will:
|
|
16
16
|
|
17
17
|
### Release Types
|
18
18
|
|
19
|
-
| Commit Format
|
20
|
-
|
21
|
-
| `fix:`
|
22
|
-
| `feat:`
|
19
|
+
| Commit Format | Result |
|
20
|
+
| ---------------------------- | ---------------- |
|
21
|
+
| `fix:` | 🔧 PATCH release |
|
22
|
+
| `feat:` | ✨ MINOR release |
|
23
23
|
| `feat:` + `BREAKING CHANGE:` | 🚨 MAJOR release |
|
24
24
|
|
25
25
|
## 📦 Manual Release (Optional Fallback)
|
@@ -45,6 +45,7 @@ In your GitHub repository:
|
|
45
45
|
2. Add the following secrets:
|
46
46
|
|
47
47
|
- `NPM_TOKEN`
|
48
|
+
|
48
49
|
- Create at npmjs.com > Access Tokens
|
49
50
|
- Choose type: `Automation` (read + publish)
|
50
51
|
- Paste into GitHub as `NPM_TOKEN`
|
@@ -61,6 +62,7 @@ In your GitHub repository:
|
|
61
62
|
## 🧪 Test Coverage
|
62
63
|
|
63
64
|
### Tools Used
|
65
|
+
|
64
66
|
- Jest
|
65
67
|
- Coveralls
|
66
68
|
|
@@ -102,17 +104,20 @@ The project automatically generates a test coverage report and makes it accessib
|
|
102
104
|
## 🧼 Pre-commit Hooks
|
103
105
|
|
104
106
|
We use Husky + `lint-staged`:
|
107
|
+
|
105
108
|
- ✅ Auto-lint + format on commit
|
106
109
|
- ✅ Validate commit messages via Commitizen
|
107
110
|
|
108
111
|
## 🧯 Troubleshooting
|
109
112
|
|
110
113
|
### Commit Fails?
|
114
|
+
|
111
115
|
- Use `npm run commit` (or `git cz`) to follow the correct format
|
112
116
|
- Check Husky is installed (`.husky/` exists)
|
113
117
|
- Run `npm install` again to restore hooks
|
114
118
|
|
115
119
|
### Release Fails?
|
120
|
+
|
116
121
|
- Check GitHub Actions logs
|
117
122
|
- Ensure `NPM_TOKEN` secret is added
|
118
123
|
- Ensure commit messages follow Conventional Commits
|
@@ -129,4 +134,4 @@ npm run commit
|
|
129
134
|
feat(fonts): add base64 embedding with MIME detection
|
130
135
|
fix(extractor): fallback on missing asset
|
131
136
|
chore(ci): enable docs deploy with GitHub Pages
|
132
|
-
```
|
137
|
+
```
|
package/docs/development.md
CHANGED
@@ -16,6 +16,7 @@ npm install -g commitizen
|
|
16
16
|
## 🚀 Getting Started
|
17
17
|
|
18
18
|
1. Clone the repository:
|
19
|
+
|
19
20
|
```bash
|
20
21
|
git clone https://github.com/manicinc/portapack.git
|
21
22
|
cd portapack
|
@@ -38,17 +39,18 @@ npm run dev
|
|
38
39
|
```
|
39
40
|
|
40
41
|
This command simultaneously runs:
|
42
|
+
|
41
43
|
- TypeScript rebuild watcher
|
42
44
|
- Documentation server
|
43
45
|
- Test runner
|
44
46
|
|
45
47
|
### Specific Development Scripts
|
46
48
|
|
47
|
-
| Command
|
48
|
-
|
49
|
+
| Command | Purpose |
|
50
|
+
| ------------------- | ---------------------------- |
|
49
51
|
| `npm run dev:build` | Watch and rebuild TypeScript |
|
50
|
-
| `npm run dev:docs`
|
51
|
-
| `npm run dev:test`
|
52
|
+
| `npm run dev:docs` | Start documentation server |
|
53
|
+
| `npm run dev:test` | Run tests in watch mode |
|
52
54
|
|
53
55
|
## 🧪 Testing Strategies
|
54
56
|
|
@@ -89,6 +91,7 @@ npm run build
|
|
89
91
|
```
|
90
92
|
|
91
93
|
Builds include:
|
94
|
+
|
92
95
|
- TypeScript compilation
|
93
96
|
- API documentation generation
|
94
97
|
- Documentation site build
|
@@ -165,4 +168,4 @@ portapack/
|
|
165
168
|
|
166
169
|
## 📄 License
|
167
170
|
|
168
|
-
MIT License - Built by Manic Agency
|
171
|
+
MIT License - Built by Manic Agency
|
package/docs/getting-started.md
CHANGED
@@ -36,7 +36,7 @@ import { pack } from 'portapack';
|
|
36
36
|
async function bundleLocalSite() {
|
37
37
|
const result = await pack('./index.html');
|
38
38
|
console.log(result.html);
|
39
|
-
|
39
|
+
|
40
40
|
// Access metadata about the build
|
41
41
|
console.log(`Output size: ${result.metadata.outputSize} bytes`);
|
42
42
|
console.log(`Build time: ${result.metadata.buildTimeMs} ms`);
|
@@ -49,9 +49,9 @@ async function bundleWithOptions() {
|
|
49
49
|
minifyCss: true,
|
50
50
|
minifyJs: true,
|
51
51
|
baseUrl: 'https://example.com',
|
52
|
-
embedAssets: true
|
52
|
+
embedAssets: true,
|
53
53
|
});
|
54
|
-
|
54
|
+
|
55
55
|
// Use or save the bundled HTML
|
56
56
|
console.log(result.html);
|
57
57
|
}
|
@@ -59,12 +59,12 @@ async function bundleWithOptions() {
|
|
59
59
|
// Recursive bundling of a website
|
60
60
|
async function bundleWebsite() {
|
61
61
|
const result = await pack('https://example.com', {
|
62
|
-
recursive: 2,
|
62
|
+
recursive: 2, // Crawl up to 2 levels deep
|
63
63
|
minifyHtml: true,
|
64
64
|
minifyCss: true,
|
65
|
-
minifyJs: true
|
65
|
+
minifyJs: true,
|
66
66
|
});
|
67
|
-
|
67
|
+
|
68
68
|
console.log(`Bundled ${result.metadata.pagesBundled} pages`);
|
69
69
|
}
|
70
70
|
```
|
@@ -77,24 +77,23 @@ For more specific use cases, you can access individual components:
|
|
77
77
|
import {
|
78
78
|
generatePortableHTML,
|
79
79
|
generateRecursivePortableHTML,
|
80
|
-
bundleMultiPageHTML
|
81
|
-
fetchAndPackWebPage,
|
80
|
+
bundleMultiPageHTML
|
82
81
|
} from 'portapack';
|
83
82
|
|
84
83
|
// Bundle a single HTML file or URL
|
85
84
|
const singleResult = await generatePortableHTML('./index.html', {
|
86
|
-
minifyHtml: true
|
85
|
+
minifyHtml: true,
|
87
86
|
});
|
88
87
|
|
89
88
|
// Recursively bundle a site
|
90
89
|
const recursiveResult = await generateRecursivePortableHTML('https://example.com', 2, {
|
91
|
-
minifyCss: true
|
90
|
+
minifyCss: true,
|
92
91
|
});
|
93
92
|
|
94
93
|
// Create multi-page bundle
|
95
94
|
const multiPageBundle = await bundleMultiPageHTML([
|
96
95
|
{ path: '/', html: '<html>...</html>' },
|
97
|
-
{ path: '/about', html: '<html>...</html>' }
|
96
|
+
{ path: '/about', html: '<html>...</html>' },
|
98
97
|
]);
|
99
98
|
```
|
100
99
|
|
@@ -117,7 +116,7 @@ For details, see the [CLI Reference](https://manicinc.github.io/portapack/cli).
|
|
117
116
|
|
118
117
|
- 📖 [Explore CLI Options](https://manicinc.github.io/portapack/cli)
|
119
118
|
- 🛠 [Advanced Configuration](https://manicinc.github.io/portapack/configuration)
|
120
|
-
- 💻 [API Reference](https://manicinc.github.io/portapack/api/)
|
119
|
+
- 💻 [API Reference](https://manicinc.github.io/portapack/api/README.html)
|
121
120
|
|
122
121
|
## Troubleshooting
|
123
122
|
|
@@ -126,6 +125,7 @@ Encountering issues? Check our [Troubleshooting Guide](https://manicinc.github.i
|
|
126
125
|
## Contributing
|
127
126
|
|
128
127
|
Interested in improving PortaPack?
|
128
|
+
|
129
129
|
- [View Contributing Guidelines](https://manicinc.github.io/portapack/contributing)
|
130
130
|
|
131
131
|
## Support
|
@@ -133,4 +133,4 @@ Interested in improving PortaPack?
|
|
133
133
|
- 🐛 [Report an Issue](https://github.com/manicinc/portapack/issues)
|
134
134
|
- 💬 [Community Support](https://discord.gg/DzNgXdYm)
|
135
135
|
|
136
|
-
Built by [Manic.agency](https://manic.agency)
|
136
|
+
Built by [Manic.agency](https://manic.agency)
|
package/docs/index.md
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
package/docs/roadmap.md
ADDED
@@ -0,0 +1,233 @@
|
|
1
|
+
# PortaPack Roadmap
|
2
|
+
|
3
|
+
## Version 2: Enhanced Bundling Capabilities
|
4
|
+
|
5
|
+
Version 2 focuses on addressing core limitations and expanding compatibility with modern web applications.
|
6
|
+
|
7
|
+
### 🎯 Script Execution Enhancement
|
8
|
+
|
9
|
+
| Feature | Description | Priority |
|
10
|
+
|---------|-------------|----------|
|
11
|
+
| **Script Execution Manager** | Preserve loading order of async/defer scripts | High |
|
12
|
+
| **Dependency Analysis** | Detect and maintain script dependencies | High |
|
13
|
+
| **Script Initialization Sequencing** | Ensure scripts initialize in the correct order | Medium |
|
14
|
+
|
15
|
+
**Implementation:** Add a lightweight runtime script that:
|
16
|
+
- Maintains a queue of scripts to execute
|
17
|
+
- Respects original async/defer behavior
|
18
|
+
- Adds proper event listeners for load/error events
|
19
|
+
- Enforces correct execution order
|
20
|
+
|
21
|
+
### 🔄 Module Support
|
22
|
+
|
23
|
+
| Feature | Description | Priority |
|
24
|
+
|---------|-------------|----------|
|
25
|
+
| **ES Module Transformation** | Convert ES modules to browser-compatible format | High |
|
26
|
+
| **Import Resolution** | Resolve and inline imported modules | High |
|
27
|
+
| **Export Management** | Create namespace for module exports | Medium |
|
28
|
+
|
29
|
+
**Implementation:**
|
30
|
+
- Parse import statements using an AST parser
|
31
|
+
- Resolve modules relative to source files
|
32
|
+
- Rewrite as namespaced functions
|
33
|
+
- Create a runtime module resolution system
|
34
|
+
|
35
|
+
### 📦 Resource Optimization
|
36
|
+
|
37
|
+
| Feature | Description | Priority |
|
38
|
+
|---------|-------------|----------|
|
39
|
+
| **Bundle Chunking** | Split large bundles into multiple linked files | Medium |
|
40
|
+
| **Lazy Loading** | Load assets only when needed | Medium |
|
41
|
+
| **Selective Embedding** | Configure thresholds for embedding vs. linking | Low |
|
42
|
+
|
43
|
+
**Implementation:**
|
44
|
+
- Create a manifest system for chunked resources
|
45
|
+
- Add intersection observer for lazy loading
|
46
|
+
- Implement size-based decision logic for embedding
|
47
|
+
|
48
|
+
### 🖥️ Enhanced SPA Support
|
49
|
+
|
50
|
+
| Feature | Description | Priority |
|
51
|
+
|---------|-------------|----------|
|
52
|
+
| **Rendered State Capture** | Wait for JavaScript rendering before capture | High |
|
53
|
+
| **Route Detection** | Automatically discover SPA routes | Medium |
|
54
|
+
| **State Interaction** | Simulate user interactions to capture states | Medium |
|
55
|
+
|
56
|
+
**Implementation:**
|
57
|
+
- Add configurable wait strategies
|
58
|
+
- Implement navigation state detection
|
59
|
+
- Create event simulation system
|
60
|
+
|
61
|
+
### 🔒 Authentication Support
|
62
|
+
|
63
|
+
| Feature | Description | Priority |
|
64
|
+
|---------|-------------|----------|
|
65
|
+
| **Authentication Configuration** | Pass credentials to the crawler | High |
|
66
|
+
| **Login Sequence** | Define authentication steps | Medium |
|
67
|
+
| **Session Management** | Maintain authenticated state during crawling | Medium |
|
68
|
+
|
69
|
+
**Implementation:**
|
70
|
+
- Add cookie and header configuration options
|
71
|
+
- Create login sequence definition format
|
72
|
+
- Implement session persistence
|
73
|
+
|
74
|
+
### 💼 Developer Experience
|
75
|
+
|
76
|
+
| Feature | Description | Priority |
|
77
|
+
|---------|-------------|----------|
|
78
|
+
| **Enhanced Diagnostics** | Improved logging and error reporting | Medium |
|
79
|
+
| **Preview Server** | Built-in server for bundle testing | Medium |
|
80
|
+
| **Bundle Analysis** | Visual report of bundle composition | Low |
|
81
|
+
|
82
|
+
**Implementation:**
|
83
|
+
- Expand logging with visualization options
|
84
|
+
- Create lightweight preview server
|
85
|
+
- Implement size and composition analyzer
|
86
|
+
|
87
|
+
## Version 3: Universal Content Platform
|
88
|
+
|
89
|
+
Version 3 transforms PortaPack from a bundling tool into a comprehensive offline content platform.
|
90
|
+
|
91
|
+
### 📱 Cross-Platform Applications
|
92
|
+
|
93
|
+
| Platform | Key Features |
|
94
|
+
|----------|-------------|
|
95
|
+
| **Desktop** (macOS, Windows, Linux) | Native app with system integration, background bundling |
|
96
|
+
| **Mobile** (iOS, Android) | Touch-optimized interface, efficient storage management |
|
97
|
+
| **Browser Extensions** | One-click saving, context menu integration |
|
98
|
+
|
99
|
+
**Implementation:**
|
100
|
+
- Use Electron for desktop applications
|
101
|
+
- React Native for mobile platforms
|
102
|
+
- Extension APIs for major browsers
|
103
|
+
|
104
|
+
### ☁️ Synchronization System
|
105
|
+
|
106
|
+
| Feature | Description |
|
107
|
+
|---------|-------------|
|
108
|
+
| **Encrypted Sync** | End-to-end encrypted content synchronization |
|
109
|
+
| **Delta Updates** | Bandwidth-efficient incremental synchronization |
|
110
|
+
| **Reading State Sync** | Preserve reading position across devices |
|
111
|
+
| **Selective Sync** | Choose what content syncs to which devices |
|
112
|
+
|
113
|
+
**Implementation:**
|
114
|
+
- Create secure synchronization protocol
|
115
|
+
- Implement conflict resolution system
|
116
|
+
- Build metadata synchronization service
|
117
|
+
|
118
|
+
### 🧠 Content Intelligence
|
119
|
+
|
120
|
+
| Feature | Description |
|
121
|
+
|---------|-------------|
|
122
|
+
| **Automatic Summarization** | AI-generated summaries of saved content |
|
123
|
+
| **Smart Tagging** | Automatic categorization and organization |
|
124
|
+
| **Content Relationships** | Identify connections between saved items |
|
125
|
+
| **Content Extraction** | Convert complex pages to readable format |
|
126
|
+
|
127
|
+
**Implementation:**
|
128
|
+
- Integrate NLP models for content understanding
|
129
|
+
- Develop concept extraction algorithms
|
130
|
+
- Create relationship graph between content
|
131
|
+
- Build advanced readability transformations
|
132
|
+
|
133
|
+
### 🔍 Advanced Search & Organization
|
134
|
+
|
135
|
+
| Feature | Description |
|
136
|
+
|---------|-------------|
|
137
|
+
| **Full-Text Search** | Search across all content |
|
138
|
+
| **Semantic Search** | Find content by meaning, not just keywords |
|
139
|
+
| **Smart Collections** | Automatically organize related content |
|
140
|
+
| **Timeline Views** | Chronological content organization |
|
141
|
+
|
142
|
+
**Implementation:**
|
143
|
+
- Build full-text search engine with indexing
|
144
|
+
- Implement vector-based semantic search
|
145
|
+
- Create automatic collection generation
|
146
|
+
- Develop flexible visualization components
|
147
|
+
|
148
|
+
### ✏️ Interactive Features
|
149
|
+
|
150
|
+
| Feature | Description |
|
151
|
+
|---------|-------------|
|
152
|
+
| **Annotation System** | Highlights, notes, and comments |
|
153
|
+
| **Content Transformations** | Dark mode, font adjustment, text-to-speech |
|
154
|
+
| **Social Sharing** | Controlled sharing with privacy options |
|
155
|
+
| **Export Capabilities** | Convert to PDF, EPUB, and other formats |
|
156
|
+
|
157
|
+
**Implementation:**
|
158
|
+
- Create cross-platform annotation framework
|
159
|
+
- Build content adaptation engine
|
160
|
+
- Implement secure sharing mechanism
|
161
|
+
- Develop export converters for multiple formats
|
162
|
+
|
163
|
+
### 🔧 Technical Architecture Expansion
|
164
|
+
|
165
|
+
| Component | Purpose |
|
166
|
+
|-----------|---------|
|
167
|
+
| **Sync Service** | Handle cross-device synchronization |
|
168
|
+
| **Auth System** | Manage user accounts and security |
|
169
|
+
| **Content Processing** | Pipeline for intelligent content handling |
|
170
|
+
| **Analytics** | Privacy-focused usage tracking |
|
171
|
+
|
172
|
+
**Implementation:**
|
173
|
+
- Build scalable backend services
|
174
|
+
- Create secure authentication system
|
175
|
+
- Develop modular processing pipeline
|
176
|
+
- Implement privacy-preserving analytics
|
177
|
+
|
178
|
+
### 🧩 Developer Platform
|
179
|
+
|
180
|
+
| Feature | Description |
|
181
|
+
|---------|-------------|
|
182
|
+
| **Plugin System** | Custom processors and content handlers |
|
183
|
+
| **API** | Third-party integration capabilities |
|
184
|
+
| **Webhooks** | Automation triggers and notifications |
|
185
|
+
| **Theme Engine** | Customization of the reading experience |
|
186
|
+
|
187
|
+
**Implementation:**
|
188
|
+
- Create plugin architecture with sandboxing
|
189
|
+
- Develop comprehensive API documentation
|
190
|
+
- Implement webhook system with security
|
191
|
+
- Build theme and template engine
|
192
|
+
|
193
|
+
### 🤖 Machine Learning Capabilities
|
194
|
+
|
195
|
+
| Feature | Description |
|
196
|
+
|---------|-------------|
|
197
|
+
| **Topic Extraction** | Identify main topics in content |
|
198
|
+
| **Entity Recognition** | Detect people, places, organizations |
|
199
|
+
| **Recommendation Engine** | Suggest related content |
|
200
|
+
| **On-Device Processing** | Local ML for privacy and performance |
|
201
|
+
|
202
|
+
**Implementation:**
|
203
|
+
- Deploy NLP models for content analysis
|
204
|
+
- Create entity linking system
|
205
|
+
- Develop recommendation algorithms
|
206
|
+
- Optimize ML models for on-device usage
|
207
|
+
|
208
|
+
## Development Timeline
|
209
|
+
|
210
|
+
### Version 2 Milestones
|
211
|
+
|
212
|
+
1. **Phase 1:** Script Execution Manager & Module Support
|
213
|
+
2. **Phase 2:** Resource Optimization & SPA Support
|
214
|
+
3. **Phase 3** Authentication Support & Developer Experience
|
215
|
+
4. **Phase 4** Stabilization & Release
|
216
|
+
|
217
|
+
### Version 3 Phased Approach
|
218
|
+
|
219
|
+
1. **Foundation Phase:**
|
220
|
+
- Cross-platform application architecture
|
221
|
+
- Core synchronization system
|
222
|
+
- Basic content intelligence
|
223
|
+
|
224
|
+
2. **Expansion Phase:**
|
225
|
+
- Advanced search and organization
|
226
|
+
- Interactive features
|
227
|
+
- Developer platform beta
|
228
|
+
|
229
|
+
3. **Intelligence Phase:**
|
230
|
+
- Full machine learning capabilities
|
231
|
+
- Recommendation engine
|
232
|
+
- Advanced content relationships
|
233
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
package/docs/troubleshooting.md
CHANGED
@@ -5,8 +5,10 @@
|
|
5
5
|
### 1. Installation Problems
|
6
6
|
|
7
7
|
#### npm Install Fails
|
8
|
+
|
8
9
|
- **Symptom**: Error during `npm install`
|
9
10
|
- **Solutions**:
|
11
|
+
|
10
12
|
```bash
|
11
13
|
# Clear npm cache
|
12
14
|
npm cache clean --force
|
@@ -19,8 +21,10 @@
|
|
19
21
|
### 2. CLI Errors
|
20
22
|
|
21
23
|
#### Permission Denied
|
24
|
+
|
22
25
|
- **Symptom**: `EACCES` errors
|
23
26
|
- **Solutions**:
|
27
|
+
|
24
28
|
```bash
|
25
29
|
# Use npm with sudo (not recommended long-term)
|
26
30
|
sudo npm install -g portapack
|
@@ -31,6 +35,7 @@
|
|
31
35
|
```
|
32
36
|
|
33
37
|
#### Asset Embedding Failures
|
38
|
+
|
34
39
|
- **Symptom**: Some assets not embedded
|
35
40
|
- **Possible Causes**:
|
36
41
|
- Incorrect base URL
|
@@ -40,6 +45,7 @@
|
|
40
45
|
### 3. Performance Issues
|
41
46
|
|
42
47
|
#### Slow Recursive Crawling
|
48
|
+
|
43
49
|
- **Solution**: Limit crawl depth
|
44
50
|
```bash
|
45
51
|
portapack -i https://site.com --recursive --max-depth 2
|
@@ -48,6 +54,7 @@
|
|
48
54
|
### 4. Minification Problems
|
49
55
|
|
50
56
|
#### CSS/JS Not Minifying
|
57
|
+
|
51
58
|
- **Check**:
|
52
59
|
- Use `--no-minify-css` or `--no-minify-js` flags
|
53
60
|
- Verify asset paths
|
@@ -56,12 +63,14 @@
|
|
56
63
|
## 🔍 Debugging Techniques
|
57
64
|
|
58
65
|
### Verbose Logging
|
66
|
+
|
59
67
|
```bash
|
60
68
|
# Enable verbose output
|
61
69
|
portapack -i ./site --verbose
|
62
70
|
```
|
63
71
|
|
64
72
|
### Dry Run
|
73
|
+
|
65
74
|
```bash
|
66
75
|
# Preview bundling without generating file
|
67
76
|
portapack -i ./site --dry-run
|
@@ -70,6 +79,7 @@ portapack -i ./site --dry-run
|
|
70
79
|
## 🌐 Network & Security
|
71
80
|
|
72
81
|
### Proxy Configuration
|
82
|
+
|
73
83
|
```bash
|
74
84
|
# Set proxy for asset fetching
|
75
85
|
export HTTP_PROXY=http://proxy.example.com
|
@@ -79,6 +89,7 @@ portapack -i https://site.com
|
|
79
89
|
## 📊 Diagnostics
|
80
90
|
|
81
91
|
### Generate Diagnostic Report
|
92
|
+
|
82
93
|
```bash
|
83
94
|
# Create debug information
|
84
95
|
portapack --diagnostics > portapack-debug.log
|
@@ -104,4 +115,4 @@ portapack --diagnostics > portapack-debug.log
|
|
104
115
|
|
105
116
|
- Limited support for complex Single Page Applications (SPAs)
|
106
117
|
- Some dynamic content may not embed correctly
|
107
|
-
- Large sites might require significant memory
|
118
|
+
- Large sites might require significant memory
|
package/examples/main.ts
CHANGED
@@ -13,7 +13,6 @@ import {
|
|
13
13
|
generatePortableHTML,
|
14
14
|
bundleMultiPageHTML,
|
15
15
|
generateRecursivePortableHTML,
|
16
|
-
fetchAndPackWebPage
|
17
16
|
} from '../src/index'; // 🔧 use '../src/index' for dev, '../dist/index' for built
|
18
17
|
|
19
18
|
const TEMP_DIR = path.join(os.tmpdir(), 'portapack-example');
|
@@ -40,10 +39,7 @@ function logMetadata(meta: any, filePath: string) {
|
|
40
39
|
}
|
41
40
|
|
42
41
|
// Accepts a function that returns { html, metadata }
|
43
|
-
async function timedBundle(
|
44
|
-
name: string,
|
45
|
-
task: () => Promise<{ html: string; metadata: any }>
|
46
|
-
) {
|
42
|
+
async function timedBundle(name: string, task: () => Promise<{ html: string; metadata: any }>) {
|
47
43
|
const start = Date.now();
|
48
44
|
console.log(chalk.cyanBright(`\n⏳ ${name}`));
|
49
45
|
|
@@ -66,26 +62,15 @@ async function timedBundle(
|
|
66
62
|
embedAssets: true,
|
67
63
|
minifyHtml: true,
|
68
64
|
minifyCss: true,
|
69
|
-
minifyJs: true
|
65
|
+
minifyJs: true,
|
70
66
|
})
|
71
67
|
);
|
72
68
|
|
73
|
-
// 🔹 Fetch and display raw HTML from remote site (no metadata)
|
74
|
-
console.log(chalk.cyan('\n⏳ Fetch and Pack Web Page (raw)'));
|
75
|
-
try {
|
76
|
-
const { html, metadata } = await fetchAndPackWebPage('https://getbootstrap.com');
|
77
|
-
const filePath = await writeTempFile('fetched-page.html', html);
|
78
|
-
console.log(chalk.green('✅ Saved fetched HTML:'), `file://${filePath}`);
|
79
|
-
console.log(`📦 Size: ${(metadata.outputSize / 1024).toFixed(2)} KB`);
|
80
|
-
} catch (err) {
|
81
|
-
console.error(chalk.red('❌ Failed to fetch web page:'), err);
|
82
|
-
}
|
83
|
-
|
84
69
|
// 🔹 Multi-page manual bundle
|
85
70
|
await timedBundle('Multi-Page Site Bundling', async () => {
|
86
71
|
const pages = [
|
87
72
|
{ url: 'https://example.com', html: '<html><body>Page 1</body></html>' },
|
88
|
-
{ url: 'https://example.com/about', html: '<html><body>Page 2</body></html>' }
|
73
|
+
{ url: 'https://example.com/about', html: '<html><body>Page 2</body></html>' },
|
89
74
|
];
|
90
75
|
const html = bundleMultiPageHTML(pages);
|
91
76
|
return {
|
@@ -94,8 +79,8 @@ async function timedBundle(
|
|
94
79
|
input: 'manual pages',
|
95
80
|
pagesBundled: pages.length,
|
96
81
|
outputSize: html.length,
|
97
|
-
buildTimeMs: 0
|
98
|
-
}
|
82
|
+
buildTimeMs: 0,
|
83
|
+
},
|
99
84
|
};
|
100
85
|
});
|
101
86
|
|
@@ -104,15 +89,5 @@ async function timedBundle(
|
|
104
89
|
generateRecursivePortableHTML('https://getbootstrap.com', 2)
|
105
90
|
);
|
106
91
|
|
107
|
-
// 🔹 Broken page test
|
108
|
-
console.log(chalk.cyan('\n⏳ Broken Page Test'));
|
109
|
-
try {
|
110
|
-
const { html, metadata} = await fetchAndPackWebPage('https://example.com/404');
|
111
|
-
const brokenOut = await writeTempFile('broken-page.html', html);
|
112
|
-
console.log(chalk.yellow('⚠️ Page returned something, saved to:'), `file://${brokenOut}`);
|
113
|
-
} catch {
|
114
|
-
console.log(chalk.red('🚫 Could not fetch broken page as expected.'));
|
115
|
-
}
|
116
|
-
|
117
92
|
console.log(chalk.gray(`\n📁 Output directory: ${TEMP_DIR}\n`));
|
118
93
|
})();
|
@@ -1 +1 @@
|
|
1
|
-
console.log('hello');
|
1
|
+
console.log('hello');
|