@julien-lin/universal-pwa-core 1.2.2 → 1.2.4
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/README.fr.md +187 -0
- package/README.md +65 -28
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +25 -25
- package/dist/index.d.ts +25 -25
- package/dist/index.js +1 -1
- package/package.json +18 -6
package/README.fr.md
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# @julien-lin/universal-pwa-core
|
|
2
|
+
|
|
3
|
+
[](https://github.com/sponsors/julien-lin)
|
|
4
|
+
[](https://www.npmjs.com/package/@julien-lin/universal-pwa-core)
|
|
5
|
+
|
|
6
|
+
Moteur de scan, génération et injection pour UniversalPWA.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @julien-lin/universal-pwa-core
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Ou avec pnpm :
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add @julien-lin/universal-pwa-core
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Utilisation
|
|
21
|
+
|
|
22
|
+
### Scanner un projet
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { scanProject } from '@julien-lin/universal-pwa-core'
|
|
26
|
+
|
|
27
|
+
const result = await scanProject({
|
|
28
|
+
projectPath: './my-project',
|
|
29
|
+
includeAssets: true,
|
|
30
|
+
includeArchitecture: true,
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
console.log(result.framework.framework) // 'react', 'wordpress', etc.
|
|
34
|
+
console.log(result.architecture.architecture) // 'spa', 'ssr', 'static'
|
|
35
|
+
console.log(result.assets.javascript.length) // Nombre de fichiers JS
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Générer un manifest
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { generateManifest, writeManifest } from '@julien-lin/universal-pwa-core'
|
|
42
|
+
|
|
43
|
+
const manifest = generateManifest({
|
|
44
|
+
name: 'My App',
|
|
45
|
+
shortName: 'MyApp',
|
|
46
|
+
startUrl: '/',
|
|
47
|
+
scope: '/',
|
|
48
|
+
display: 'standalone',
|
|
49
|
+
themeColor: '#2c3e50',
|
|
50
|
+
backgroundColor: '#ffffff',
|
|
51
|
+
icons: [
|
|
52
|
+
{
|
|
53
|
+
src: '/icon-192x192.png',
|
|
54
|
+
sizes: '192x192',
|
|
55
|
+
type: 'image/png',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
writeManifest(manifest, './public')
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Générer des icônes
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import { generateIcons } from '@julien-lin/universal-pwa-core'
|
|
67
|
+
|
|
68
|
+
const result = await generateIcons({
|
|
69
|
+
sourceImage: './logo.png',
|
|
70
|
+
outputDir: './public/icons',
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
console.log(result.icons) // Tableau de ManifestIcon
|
|
74
|
+
console.log(result.splashScreens) // Tableau de ManifestSplashScreen
|
|
75
|
+
console.log(result.generatedFiles) // Tableau des chemins de fichiers générés
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
La fonction génère automatiquement :
|
|
79
|
+
- Icônes PWA en multiples tailles (72x72 à 512x512)
|
|
80
|
+
- Apple Touch Icon (180x180)
|
|
81
|
+
- Splash screens pour iOS
|
|
82
|
+
|
|
83
|
+
### Générer un service worker
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { generateServiceWorker } from '@julien-lin/universal-pwa-core'
|
|
87
|
+
|
|
88
|
+
const result = await generateServiceWorker({
|
|
89
|
+
projectPath: './my-project',
|
|
90
|
+
outputDir: './public',
|
|
91
|
+
architecture: 'spa',
|
|
92
|
+
framework: 'react',
|
|
93
|
+
globDirectory: './public',
|
|
94
|
+
globPatterns: ['**/*.{html,js,css,png,jpg,svg}'],
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
console.log(result.swPath) // Chemin vers le service worker généré
|
|
98
|
+
console.log(result.count) // Nombre de fichiers pré-cachés
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Injecter des meta tags
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
import { injectMetaTagsInFile } from '@julien-lin/universal-pwa-core'
|
|
105
|
+
|
|
106
|
+
const result = injectMetaTagsInFile('./index.html', {
|
|
107
|
+
manifestPath: '/manifest.json',
|
|
108
|
+
themeColor: '#2c3e50',
|
|
109
|
+
backgroundColor: '#ffffff',
|
|
110
|
+
appleTouchIcon: '/apple-touch-icon.png',
|
|
111
|
+
serviceWorkerPath: '/sw.js',
|
|
112
|
+
appleMobileWebAppCapable: true,
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
console.log(result.injected) // Tags injectés
|
|
116
|
+
console.log(result.skipped) // Tags déjà présents
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Référence API
|
|
120
|
+
|
|
121
|
+
### Scanner
|
|
122
|
+
|
|
123
|
+
- `scanProject(options)` : Scanne un projet et retourne un rapport complet
|
|
124
|
+
- `detectFramework(projectPath)` : Détecte le framework utilisé
|
|
125
|
+
- `detectAssets(projectPath)` : Détecte les assets (JS, CSS, images, polices)
|
|
126
|
+
- `detectArchitecture(projectPath)` : Détecte l'architecture (SPA, SSR, static)
|
|
127
|
+
|
|
128
|
+
### Générateur
|
|
129
|
+
|
|
130
|
+
- `generateManifest(options)` : Génère un manifest.json
|
|
131
|
+
- `writeManifest(manifest, outputDir)` : Écrit le manifest dans un fichier
|
|
132
|
+
- `generateAndWriteManifest(options, outputDir)` : Génère et écrit le manifest en une seule fois
|
|
133
|
+
- `generateIcons(options)` : Génère les icônes PWA à partir d'une image source
|
|
134
|
+
- `generateServiceWorker(options)` : Génère un service worker avec Workbox
|
|
135
|
+
- `checkProjectHttps(options)` : Vérifie le statut HTTPS d'un projet
|
|
136
|
+
|
|
137
|
+
### Injecteur
|
|
138
|
+
|
|
139
|
+
- `parseHTML(htmlContent)` : Parse du contenu HTML
|
|
140
|
+
- `parseHTMLFile(filePath)` : Parse un fichier HTML
|
|
141
|
+
- `injectMetaTags(htmlContent, options)` : Injecte des meta-tags PWA
|
|
142
|
+
- `injectMetaTagsInFile(filePath, options)` : Injecte des meta-tags dans un fichier
|
|
143
|
+
|
|
144
|
+
## Types
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
import type {
|
|
148
|
+
Framework,
|
|
149
|
+
Architecture,
|
|
150
|
+
ScannerResult,
|
|
151
|
+
Manifest,
|
|
152
|
+
ManifestIcon,
|
|
153
|
+
ManifestSplashScreen,
|
|
154
|
+
ServiceWorkerGenerationResult,
|
|
155
|
+
} from '@julien-lin/universal-pwa-core'
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## 💝 Sponsoring
|
|
159
|
+
|
|
160
|
+
Si UniversalPWA vous est utile, envisagez de [sponsoriser le projet](https://github.com/sponsors/julien-lin) pour aider à le maintenir et l'améliorer.
|
|
161
|
+
|
|
162
|
+
## Développement
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# Installer les dépendances
|
|
166
|
+
pnpm install
|
|
167
|
+
|
|
168
|
+
# Build
|
|
169
|
+
pnpm build
|
|
170
|
+
|
|
171
|
+
# Tests
|
|
172
|
+
pnpm test
|
|
173
|
+
|
|
174
|
+
# Lint
|
|
175
|
+
pnpm lint
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Liens
|
|
179
|
+
|
|
180
|
+
- **Repository** : [https://github.com/julien-lin/UniversalPWA](https://github.com/julien-lin/UniversalPWA)
|
|
181
|
+
- **Issues** : [https://github.com/julien-lin/UniversalPWA/issues](https://github.com/julien-lin/UniversalPWA/issues)
|
|
182
|
+
- **Discussions** : [https://github.com/julien-lin/UniversalPWA/discussions](https://github.com/julien-lin/UniversalPWA/discussions)
|
|
183
|
+
- **Contribution** : [https://github.com/julien-lin/UniversalPWA/blob/main/CONTRIBUTING.md](https://github.com/julien-lin/UniversalPWA/blob/main/CONTRIBUTING.md)
|
|
184
|
+
- **Releases** : [https://github.com/julien-lin/UniversalPWA/releases](https://github.com/julien-lin/UniversalPWA/releases)
|
|
185
|
+
- **Sponsor** : [https://github.com/sponsors/julien-lin](https://github.com/sponsors/julien-lin)
|
|
186
|
+
- **Package npm** : [https://www.npmjs.com/package/@julien-lin/universal-pwa-core](https://www.npmjs.com/package/@julien-lin/universal-pwa-core)
|
|
187
|
+
|
package/README.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# @julien-lin/universal-pwa-core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/sponsors/julien-lin)
|
|
4
|
+
[](https://www.npmjs.com/package/@julien-lin/universal-pwa-core)
|
|
5
|
+
|
|
6
|
+
Core engine for scanning, generation, and injection for UniversalPWA.
|
|
7
|
+
|
|
8
|
+
**🇫🇷 [Documentation en français](./README.fr.md)**
|
|
4
9
|
|
|
5
10
|
## Installation
|
|
6
11
|
|
|
@@ -8,9 +13,15 @@ Moteur de scan, génération et injection pour UniversalPWA.
|
|
|
8
13
|
npm install @julien-lin/universal-pwa-core
|
|
9
14
|
```
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
Or with pnpm:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pnpm add @julien-lin/universal-pwa-core
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
12
23
|
|
|
13
|
-
###
|
|
24
|
+
### Scan a Project
|
|
14
25
|
|
|
15
26
|
```typescript
|
|
16
27
|
import { scanProject } from '@julien-lin/universal-pwa-core'
|
|
@@ -23,9 +34,10 @@ const result = await scanProject({
|
|
|
23
34
|
|
|
24
35
|
console.log(result.framework.framework) // 'react', 'wordpress', etc.
|
|
25
36
|
console.log(result.architecture.architecture) // 'spa', 'ssr', 'static'
|
|
37
|
+
console.log(result.assets.javascript.length) // Number of JS files
|
|
26
38
|
```
|
|
27
39
|
|
|
28
|
-
###
|
|
40
|
+
### Generate a Manifest
|
|
29
41
|
|
|
30
42
|
```typescript
|
|
31
43
|
import { generateManifest, writeManifest } from '@julien-lin/universal-pwa-core'
|
|
@@ -50,7 +62,7 @@ const manifest = generateManifest({
|
|
|
50
62
|
writeManifest(manifest, './public')
|
|
51
63
|
```
|
|
52
64
|
|
|
53
|
-
###
|
|
65
|
+
### Generate Icons
|
|
54
66
|
|
|
55
67
|
```typescript
|
|
56
68
|
import { generateIcons } from '@julien-lin/universal-pwa-core'
|
|
@@ -62,9 +74,15 @@ const result = await generateIcons({
|
|
|
62
74
|
|
|
63
75
|
console.log(result.icons) // Array of ManifestIcon
|
|
64
76
|
console.log(result.splashScreens) // Array of ManifestSplashScreen
|
|
77
|
+
console.log(result.generatedFiles) // Array of generated file paths
|
|
65
78
|
```
|
|
66
79
|
|
|
67
|
-
|
|
80
|
+
The function automatically generates:
|
|
81
|
+
- PWA icons in multiple sizes (72x72 to 512x512)
|
|
82
|
+
- Apple Touch Icon (180x180)
|
|
83
|
+
- Splash screens for iOS
|
|
84
|
+
|
|
85
|
+
### Generate a Service Worker
|
|
68
86
|
|
|
69
87
|
```typescript
|
|
70
88
|
import { generateServiceWorker } from '@julien-lin/universal-pwa-core'
|
|
@@ -78,10 +96,11 @@ const result = await generateServiceWorker({
|
|
|
78
96
|
globPatterns: ['**/*.{html,js,css,png,jpg,svg}'],
|
|
79
97
|
})
|
|
80
98
|
|
|
81
|
-
console.log(result.swPath) //
|
|
99
|
+
console.log(result.swPath) // Path to generated service worker
|
|
100
|
+
console.log(result.count) // Number of files pre-cached
|
|
82
101
|
```
|
|
83
102
|
|
|
84
|
-
###
|
|
103
|
+
### Inject Meta Tags
|
|
85
104
|
|
|
86
105
|
```typescript
|
|
87
106
|
import { injectMetaTagsInFile } from '@julien-lin/universal-pwa-core'
|
|
@@ -89,37 +108,40 @@ import { injectMetaTagsInFile } from '@julien-lin/universal-pwa-core'
|
|
|
89
108
|
const result = injectMetaTagsInFile('./index.html', {
|
|
90
109
|
manifestPath: '/manifest.json',
|
|
91
110
|
themeColor: '#2c3e50',
|
|
111
|
+
backgroundColor: '#ffffff',
|
|
92
112
|
appleTouchIcon: '/apple-touch-icon.png',
|
|
93
113
|
serviceWorkerPath: '/sw.js',
|
|
114
|
+
appleMobileWebAppCapable: true,
|
|
94
115
|
})
|
|
95
116
|
|
|
96
|
-
console.log(result.injected) // Tags
|
|
97
|
-
console.log(result.skipped) // Tags
|
|
117
|
+
console.log(result.injected) // Tags injected
|
|
118
|
+
console.log(result.skipped) // Tags already present
|
|
98
119
|
```
|
|
99
120
|
|
|
100
|
-
## API
|
|
121
|
+
## API Reference
|
|
101
122
|
|
|
102
123
|
### Scanner
|
|
103
124
|
|
|
104
|
-
- `scanProject(options)` :
|
|
105
|
-
- `detectFramework(projectPath)` :
|
|
106
|
-
- `detectAssets(projectPath)` :
|
|
107
|
-
- `detectArchitecture(projectPath)` :
|
|
125
|
+
- `scanProject(options)` : Scan a project and return a complete report
|
|
126
|
+
- `detectFramework(projectPath)` : Detect the framework used
|
|
127
|
+
- `detectAssets(projectPath)` : Detect assets (JS, CSS, images, fonts)
|
|
128
|
+
- `detectArchitecture(projectPath)` : Detect architecture (SPA, SSR, static)
|
|
108
129
|
|
|
109
|
-
###
|
|
130
|
+
### Generator
|
|
110
131
|
|
|
111
|
-
- `generateManifest(options)` :
|
|
112
|
-
- `writeManifest(manifest, outputDir)` :
|
|
113
|
-
- `
|
|
114
|
-
- `
|
|
115
|
-
- `
|
|
132
|
+
- `generateManifest(options)` : Generate a manifest.json
|
|
133
|
+
- `writeManifest(manifest, outputDir)` : Write manifest to a file
|
|
134
|
+
- `generateAndWriteManifest(options, outputDir)` : Generate and write manifest in one call
|
|
135
|
+
- `generateIcons(options)` : Generate PWA icons from a source image
|
|
136
|
+
- `generateServiceWorker(options)` : Generate a service worker with Workbox
|
|
137
|
+
- `checkProjectHttps(options)` : Check project HTTPS status
|
|
116
138
|
|
|
117
|
-
###
|
|
139
|
+
### Injector
|
|
118
140
|
|
|
119
|
-
- `parseHTML(htmlContent)` : Parse
|
|
120
|
-
- `parseHTMLFile(filePath)` : Parse
|
|
121
|
-
- `injectMetaTags(htmlContent, options)` :
|
|
122
|
-
- `injectMetaTagsInFile(filePath, options)` :
|
|
141
|
+
- `parseHTML(htmlContent)` : Parse HTML content
|
|
142
|
+
- `parseHTMLFile(filePath)` : Parse an HTML file
|
|
143
|
+
- `injectMetaTags(htmlContent, options)` : Inject PWA meta-tags
|
|
144
|
+
- `injectMetaTagsInFile(filePath, options)` : Inject meta-tags in a file
|
|
123
145
|
|
|
124
146
|
## Types
|
|
125
147
|
|
|
@@ -130,14 +152,19 @@ import type {
|
|
|
130
152
|
ScannerResult,
|
|
131
153
|
Manifest,
|
|
132
154
|
ManifestIcon,
|
|
155
|
+
ManifestSplashScreen,
|
|
133
156
|
ServiceWorkerGenerationResult,
|
|
134
157
|
} from '@julien-lin/universal-pwa-core'
|
|
135
158
|
```
|
|
136
159
|
|
|
137
|
-
##
|
|
160
|
+
## 💝 Sponsoring
|
|
161
|
+
|
|
162
|
+
If UniversalPWA is useful to you, please consider [sponsoring the project](https://github.com/sponsors/julien-lin) to help maintain and improve it.
|
|
163
|
+
|
|
164
|
+
## Development
|
|
138
165
|
|
|
139
166
|
```bash
|
|
140
|
-
#
|
|
167
|
+
# Install dependencies
|
|
141
168
|
pnpm install
|
|
142
169
|
|
|
143
170
|
# Build
|
|
@@ -149,3 +176,13 @@ pnpm test
|
|
|
149
176
|
# Lint
|
|
150
177
|
pnpm lint
|
|
151
178
|
```
|
|
179
|
+
|
|
180
|
+
## Links
|
|
181
|
+
|
|
182
|
+
- **Repository**: [https://github.com/julien-lin/UniversalPWA](https://github.com/julien-lin/UniversalPWA)
|
|
183
|
+
- **Issues**: [https://github.com/julien-lin/UniversalPWA/issues](https://github.com/julien-lin/UniversalPWA/issues)
|
|
184
|
+
- **Discussions**: [https://github.com/julien-lin/UniversalPWA/discussions](https://github.com/julien-lin/UniversalPWA/discussions)
|
|
185
|
+
- **Contributing**: [https://github.com/julien-lin/UniversalPWA/blob/main/CONTRIBUTING.md](https://github.com/julien-lin/UniversalPWA/blob/main/CONTRIBUTING.md)
|
|
186
|
+
- **Releases**: [https://github.com/julien-lin/UniversalPWA/releases](https://github.com/julien-lin/UniversalPWA/releases)
|
|
187
|
+
- **Sponsor**: [https://github.com/sponsors/julien-lin](https://github.com/sponsors/julien-lin)
|
|
188
|
+
- **npm Package**: [https://www.npmjs.com/package/@julien-lin/universal-pwa-core](https://www.npmjs.com/package/@julien-lin/universal-pwa-core)
|
package/dist/index.cjs
CHANGED
|
@@ -843,7 +843,7 @@ async function generateServiceWorker(options) {
|
|
|
843
843
|
globPatterns,
|
|
844
844
|
swDest: swDestPath,
|
|
845
845
|
swSrc: swSrcPath,
|
|
846
|
-
//
|
|
846
|
+
// Inject manifest into template
|
|
847
847
|
injectionPoint: "self.__WB_MANIFEST"
|
|
848
848
|
};
|
|
849
849
|
if (offlinePage) {
|
package/dist/index.d.cts
CHANGED
|
@@ -51,16 +51,16 @@ interface ScannerOptions {
|
|
|
51
51
|
includeArchitecture?: boolean;
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
54
|
+
* Main scanner orchestrator
|
|
55
|
+
* Combines framework, assets, and architecture detection results
|
|
56
56
|
*/
|
|
57
57
|
declare function scanProject(options: ScannerOptions): Promise<ScannerResult>;
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* Generates a JSON report of the scan
|
|
60
60
|
*/
|
|
61
61
|
declare function generateReport(result: ScannerResult): string;
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
63
|
+
* Validates that a project path exists
|
|
64
64
|
*/
|
|
65
65
|
declare function validateProjectPath(projectPath: string): boolean;
|
|
66
66
|
|
|
@@ -137,15 +137,15 @@ interface ManifestGeneratorOptions {
|
|
|
137
137
|
relatedApplications?: unknown[];
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
|
-
*
|
|
140
|
+
* Generates a manifest.json for PWA
|
|
141
141
|
*/
|
|
142
142
|
declare function generateManifest(options: ManifestGeneratorOptions): Manifest;
|
|
143
143
|
/**
|
|
144
|
-
*
|
|
144
|
+
* Writes manifest.json to the output directory
|
|
145
145
|
*/
|
|
146
146
|
declare function writeManifest(manifest: Manifest, outputDir: string): string;
|
|
147
147
|
/**
|
|
148
|
-
*
|
|
148
|
+
* Generates and writes manifest.json
|
|
149
149
|
*/
|
|
150
150
|
declare function generateAndWriteManifest(options: ManifestGeneratorOptions, outputDir: string): string;
|
|
151
151
|
|
|
@@ -175,29 +175,29 @@ interface IconGenerationResult {
|
|
|
175
175
|
generatedFiles: string[];
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
178
|
-
*
|
|
178
|
+
* Generates all PWA icons from a source image
|
|
179
179
|
*/
|
|
180
180
|
declare function generateIcons(options: IconGeneratorOptions): Promise<IconGenerationResult>;
|
|
181
181
|
/**
|
|
182
|
-
*
|
|
182
|
+
* Generates only icons (without splash screens)
|
|
183
183
|
*/
|
|
184
184
|
declare function generateIconsOnly(options: IconGeneratorOptions): Promise<{
|
|
185
185
|
icons: ManifestIcon[];
|
|
186
186
|
generatedFiles: string[];
|
|
187
187
|
}>;
|
|
188
188
|
/**
|
|
189
|
-
*
|
|
189
|
+
* Generates only splash screens (without icons)
|
|
190
190
|
*/
|
|
191
191
|
declare function generateSplashScreensOnly(options: IconGeneratorOptions): Promise<{
|
|
192
192
|
splashScreens: ManifestSplashScreen[];
|
|
193
193
|
generatedFiles: string[];
|
|
194
194
|
}>;
|
|
195
195
|
/**
|
|
196
|
-
*
|
|
196
|
+
* Generates a favicon.ico from the source image
|
|
197
197
|
*/
|
|
198
198
|
declare function generateFavicon(sourceImage: string, outputDir: string): Promise<string>;
|
|
199
199
|
/**
|
|
200
|
-
*
|
|
200
|
+
* Generates an apple-touch-icon (180x180)
|
|
201
201
|
*/
|
|
202
202
|
declare function generateAppleTouchIcon(sourceImage: string, outputDir: string): Promise<string>;
|
|
203
203
|
|
|
@@ -234,15 +234,15 @@ interface ServiceWorkerGenerationResult {
|
|
|
234
234
|
filePaths: string[];
|
|
235
235
|
}
|
|
236
236
|
/**
|
|
237
|
-
*
|
|
237
|
+
* Generates a service worker with Workbox
|
|
238
238
|
*/
|
|
239
239
|
declare function generateServiceWorker(options: ServiceWorkerGeneratorOptions): Promise<ServiceWorkerGenerationResult>;
|
|
240
240
|
/**
|
|
241
|
-
*
|
|
241
|
+
* Generates a simple service worker without template (uses generateSW)
|
|
242
242
|
*/
|
|
243
243
|
declare function generateSimpleServiceWorker(options: Omit<ServiceWorkerGeneratorOptions, 'templateType' | 'swSrc'>): Promise<ServiceWorkerGenerationResult>;
|
|
244
244
|
/**
|
|
245
|
-
*
|
|
245
|
+
* Generates and writes service worker with template
|
|
246
246
|
*/
|
|
247
247
|
declare function generateAndWriteServiceWorker(options: ServiceWorkerGeneratorOptions): Promise<ServiceWorkerGenerationResult>;
|
|
248
248
|
|
|
@@ -265,11 +265,11 @@ interface HttpsCheckerOptions {
|
|
|
265
265
|
*/
|
|
266
266
|
declare function checkHttps(url: string, allowHttpLocalhost?: boolean): HttpsCheckResult;
|
|
267
267
|
/**
|
|
268
|
-
*
|
|
268
|
+
* Detects project URL from configuration files
|
|
269
269
|
*/
|
|
270
270
|
declare function detectProjectUrl(projectPath: string): string | null;
|
|
271
271
|
/**
|
|
272
|
-
*
|
|
272
|
+
* Checks HTTPS for a project
|
|
273
273
|
*/
|
|
274
274
|
declare function checkProjectHttps(options?: HttpsCheckerOptions): HttpsCheckResult;
|
|
275
275
|
|
|
@@ -285,36 +285,36 @@ interface HTMLParserOptions {
|
|
|
285
285
|
lowerCaseAttributeNames?: boolean;
|
|
286
286
|
}
|
|
287
287
|
/**
|
|
288
|
-
*
|
|
288
|
+
* Parses an HTML file and returns the document structure
|
|
289
289
|
*/
|
|
290
290
|
declare function parseHTMLFile(filePath: string, options?: HTMLParserOptions): ParsedHTML;
|
|
291
291
|
/**
|
|
292
|
-
*
|
|
292
|
+
* Parses an HTML string and returns the document structure
|
|
293
293
|
*/
|
|
294
294
|
declare function parseHTML(htmlContent: string, options?: HTMLParserOptions): ParsedHTML;
|
|
295
295
|
/**
|
|
296
|
-
*
|
|
296
|
+
* Finds an element in the document by tag name
|
|
297
297
|
*/
|
|
298
298
|
declare function findElement(parsed: ParsedHTML, tagName: string, attribute?: {
|
|
299
299
|
name: string;
|
|
300
300
|
value: string;
|
|
301
301
|
}): Element | null;
|
|
302
302
|
/**
|
|
303
|
-
*
|
|
303
|
+
* Finds all elements matching a tag name
|
|
304
304
|
*/
|
|
305
305
|
declare function findAllElements(parsed: ParsedHTML, tagName: string, attribute?: {
|
|
306
306
|
name: string;
|
|
307
307
|
value?: string;
|
|
308
308
|
}): Element[];
|
|
309
309
|
/**
|
|
310
|
-
*
|
|
310
|
+
* Checks if an element already exists in the document
|
|
311
311
|
*/
|
|
312
312
|
declare function elementExists(parsed: ParsedHTML, tagName: string, attribute: {
|
|
313
313
|
name: string;
|
|
314
314
|
value: string;
|
|
315
315
|
}): boolean;
|
|
316
316
|
/**
|
|
317
|
-
*
|
|
317
|
+
* Converts a parsed document to HTML string
|
|
318
318
|
*/
|
|
319
319
|
declare function serializeHTML(parsed: ParsedHTML): string;
|
|
320
320
|
|
|
@@ -334,14 +334,14 @@ interface InjectionResult {
|
|
|
334
334
|
warnings: string[];
|
|
335
335
|
}
|
|
336
336
|
/**
|
|
337
|
-
*
|
|
337
|
+
* Injects PWA meta-tags into HTML
|
|
338
338
|
*/
|
|
339
339
|
declare function injectMetaTags(htmlContent: string, options?: MetaInjectorOptions): {
|
|
340
340
|
html: string;
|
|
341
341
|
result: InjectionResult;
|
|
342
342
|
};
|
|
343
343
|
/**
|
|
344
|
-
*
|
|
344
|
+
* Injects meta-tags into an HTML file
|
|
345
345
|
*/
|
|
346
346
|
declare function injectMetaTagsInFile(filePath: string, options?: MetaInjectorOptions): InjectionResult;
|
|
347
347
|
|
package/dist/index.d.ts
CHANGED
|
@@ -51,16 +51,16 @@ interface ScannerOptions {
|
|
|
51
51
|
includeArchitecture?: boolean;
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
54
|
+
* Main scanner orchestrator
|
|
55
|
+
* Combines framework, assets, and architecture detection results
|
|
56
56
|
*/
|
|
57
57
|
declare function scanProject(options: ScannerOptions): Promise<ScannerResult>;
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* Generates a JSON report of the scan
|
|
60
60
|
*/
|
|
61
61
|
declare function generateReport(result: ScannerResult): string;
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
63
|
+
* Validates that a project path exists
|
|
64
64
|
*/
|
|
65
65
|
declare function validateProjectPath(projectPath: string): boolean;
|
|
66
66
|
|
|
@@ -137,15 +137,15 @@ interface ManifestGeneratorOptions {
|
|
|
137
137
|
relatedApplications?: unknown[];
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
|
-
*
|
|
140
|
+
* Generates a manifest.json for PWA
|
|
141
141
|
*/
|
|
142
142
|
declare function generateManifest(options: ManifestGeneratorOptions): Manifest;
|
|
143
143
|
/**
|
|
144
|
-
*
|
|
144
|
+
* Writes manifest.json to the output directory
|
|
145
145
|
*/
|
|
146
146
|
declare function writeManifest(manifest: Manifest, outputDir: string): string;
|
|
147
147
|
/**
|
|
148
|
-
*
|
|
148
|
+
* Generates and writes manifest.json
|
|
149
149
|
*/
|
|
150
150
|
declare function generateAndWriteManifest(options: ManifestGeneratorOptions, outputDir: string): string;
|
|
151
151
|
|
|
@@ -175,29 +175,29 @@ interface IconGenerationResult {
|
|
|
175
175
|
generatedFiles: string[];
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
178
|
-
*
|
|
178
|
+
* Generates all PWA icons from a source image
|
|
179
179
|
*/
|
|
180
180
|
declare function generateIcons(options: IconGeneratorOptions): Promise<IconGenerationResult>;
|
|
181
181
|
/**
|
|
182
|
-
*
|
|
182
|
+
* Generates only icons (without splash screens)
|
|
183
183
|
*/
|
|
184
184
|
declare function generateIconsOnly(options: IconGeneratorOptions): Promise<{
|
|
185
185
|
icons: ManifestIcon[];
|
|
186
186
|
generatedFiles: string[];
|
|
187
187
|
}>;
|
|
188
188
|
/**
|
|
189
|
-
*
|
|
189
|
+
* Generates only splash screens (without icons)
|
|
190
190
|
*/
|
|
191
191
|
declare function generateSplashScreensOnly(options: IconGeneratorOptions): Promise<{
|
|
192
192
|
splashScreens: ManifestSplashScreen[];
|
|
193
193
|
generatedFiles: string[];
|
|
194
194
|
}>;
|
|
195
195
|
/**
|
|
196
|
-
*
|
|
196
|
+
* Generates a favicon.ico from the source image
|
|
197
197
|
*/
|
|
198
198
|
declare function generateFavicon(sourceImage: string, outputDir: string): Promise<string>;
|
|
199
199
|
/**
|
|
200
|
-
*
|
|
200
|
+
* Generates an apple-touch-icon (180x180)
|
|
201
201
|
*/
|
|
202
202
|
declare function generateAppleTouchIcon(sourceImage: string, outputDir: string): Promise<string>;
|
|
203
203
|
|
|
@@ -234,15 +234,15 @@ interface ServiceWorkerGenerationResult {
|
|
|
234
234
|
filePaths: string[];
|
|
235
235
|
}
|
|
236
236
|
/**
|
|
237
|
-
*
|
|
237
|
+
* Generates a service worker with Workbox
|
|
238
238
|
*/
|
|
239
239
|
declare function generateServiceWorker(options: ServiceWorkerGeneratorOptions): Promise<ServiceWorkerGenerationResult>;
|
|
240
240
|
/**
|
|
241
|
-
*
|
|
241
|
+
* Generates a simple service worker without template (uses generateSW)
|
|
242
242
|
*/
|
|
243
243
|
declare function generateSimpleServiceWorker(options: Omit<ServiceWorkerGeneratorOptions, 'templateType' | 'swSrc'>): Promise<ServiceWorkerGenerationResult>;
|
|
244
244
|
/**
|
|
245
|
-
*
|
|
245
|
+
* Generates and writes service worker with template
|
|
246
246
|
*/
|
|
247
247
|
declare function generateAndWriteServiceWorker(options: ServiceWorkerGeneratorOptions): Promise<ServiceWorkerGenerationResult>;
|
|
248
248
|
|
|
@@ -265,11 +265,11 @@ interface HttpsCheckerOptions {
|
|
|
265
265
|
*/
|
|
266
266
|
declare function checkHttps(url: string, allowHttpLocalhost?: boolean): HttpsCheckResult;
|
|
267
267
|
/**
|
|
268
|
-
*
|
|
268
|
+
* Detects project URL from configuration files
|
|
269
269
|
*/
|
|
270
270
|
declare function detectProjectUrl(projectPath: string): string | null;
|
|
271
271
|
/**
|
|
272
|
-
*
|
|
272
|
+
* Checks HTTPS for a project
|
|
273
273
|
*/
|
|
274
274
|
declare function checkProjectHttps(options?: HttpsCheckerOptions): HttpsCheckResult;
|
|
275
275
|
|
|
@@ -285,36 +285,36 @@ interface HTMLParserOptions {
|
|
|
285
285
|
lowerCaseAttributeNames?: boolean;
|
|
286
286
|
}
|
|
287
287
|
/**
|
|
288
|
-
*
|
|
288
|
+
* Parses an HTML file and returns the document structure
|
|
289
289
|
*/
|
|
290
290
|
declare function parseHTMLFile(filePath: string, options?: HTMLParserOptions): ParsedHTML;
|
|
291
291
|
/**
|
|
292
|
-
*
|
|
292
|
+
* Parses an HTML string and returns the document structure
|
|
293
293
|
*/
|
|
294
294
|
declare function parseHTML(htmlContent: string, options?: HTMLParserOptions): ParsedHTML;
|
|
295
295
|
/**
|
|
296
|
-
*
|
|
296
|
+
* Finds an element in the document by tag name
|
|
297
297
|
*/
|
|
298
298
|
declare function findElement(parsed: ParsedHTML, tagName: string, attribute?: {
|
|
299
299
|
name: string;
|
|
300
300
|
value: string;
|
|
301
301
|
}): Element | null;
|
|
302
302
|
/**
|
|
303
|
-
*
|
|
303
|
+
* Finds all elements matching a tag name
|
|
304
304
|
*/
|
|
305
305
|
declare function findAllElements(parsed: ParsedHTML, tagName: string, attribute?: {
|
|
306
306
|
name: string;
|
|
307
307
|
value?: string;
|
|
308
308
|
}): Element[];
|
|
309
309
|
/**
|
|
310
|
-
*
|
|
310
|
+
* Checks if an element already exists in the document
|
|
311
311
|
*/
|
|
312
312
|
declare function elementExists(parsed: ParsedHTML, tagName: string, attribute: {
|
|
313
313
|
name: string;
|
|
314
314
|
value: string;
|
|
315
315
|
}): boolean;
|
|
316
316
|
/**
|
|
317
|
-
*
|
|
317
|
+
* Converts a parsed document to HTML string
|
|
318
318
|
*/
|
|
319
319
|
declare function serializeHTML(parsed: ParsedHTML): string;
|
|
320
320
|
|
|
@@ -334,14 +334,14 @@ interface InjectionResult {
|
|
|
334
334
|
warnings: string[];
|
|
335
335
|
}
|
|
336
336
|
/**
|
|
337
|
-
*
|
|
337
|
+
* Injects PWA meta-tags into HTML
|
|
338
338
|
*/
|
|
339
339
|
declare function injectMetaTags(htmlContent: string, options?: MetaInjectorOptions): {
|
|
340
340
|
html: string;
|
|
341
341
|
result: InjectionResult;
|
|
342
342
|
};
|
|
343
343
|
/**
|
|
344
|
-
*
|
|
344
|
+
* Injects meta-tags into an HTML file
|
|
345
345
|
*/
|
|
346
346
|
declare function injectMetaTagsInFile(filePath: string, options?: MetaInjectorOptions): InjectionResult;
|
|
347
347
|
|
package/dist/index.js
CHANGED
|
@@ -777,7 +777,7 @@ async function generateServiceWorker(options) {
|
|
|
777
777
|
globPatterns,
|
|
778
778
|
swDest: swDestPath,
|
|
779
779
|
swSrc: swSrcPath,
|
|
780
|
-
//
|
|
780
|
+
// Inject manifest into template
|
|
781
781
|
injectionPoint: "self.__WB_MANIFEST"
|
|
782
782
|
};
|
|
783
783
|
if (offlinePage) {
|
package/package.json
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@julien-lin/universal-pwa-core",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.2.4",
|
|
4
|
+
"description": "Core engine for scanning, generation, and injection for UniversalPWA",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pwa",
|
|
7
7
|
"progressive-web-app",
|
|
8
|
+
"universal-pwa",
|
|
9
|
+
"pwa-generator",
|
|
10
|
+
"pwa-scanner",
|
|
11
|
+
"pwa-injector",
|
|
8
12
|
"workbox",
|
|
9
13
|
"service-worker",
|
|
10
|
-
"manifest"
|
|
14
|
+
"manifest",
|
|
15
|
+
"web-manifest",
|
|
16
|
+
"pwa-manifest",
|
|
17
|
+
"auto-detect",
|
|
18
|
+
"framework-detection",
|
|
19
|
+
"zero-config",
|
|
20
|
+
"multi-framework"
|
|
11
21
|
],
|
|
12
22
|
"author": "julien-lin",
|
|
13
23
|
"license": "MIT",
|
|
@@ -18,7 +28,7 @@
|
|
|
18
28
|
},
|
|
19
29
|
"homepage": "https://github.com/julien-lin/UniversalPWA#readme",
|
|
20
30
|
"bugs": {
|
|
21
|
-
"url": "https://github.com/julien-lin/UniversalPWA/
|
|
31
|
+
"url": "https://github.com/julien-lin/UniversalPWA/discussions"
|
|
22
32
|
},
|
|
23
33
|
"type": "module",
|
|
24
34
|
"main": "dist/index.js",
|
|
@@ -32,7 +42,9 @@
|
|
|
32
42
|
}
|
|
33
43
|
},
|
|
34
44
|
"files": [
|
|
35
|
-
"dist"
|
|
45
|
+
"dist",
|
|
46
|
+
"README.md",
|
|
47
|
+
"README.fr.md"
|
|
36
48
|
],
|
|
37
49
|
"dependencies": {
|
|
38
50
|
"dom-serializer": "^2.0.0",
|
|
@@ -49,7 +61,7 @@
|
|
|
49
61
|
"workbox-routing": "^7.4.0",
|
|
50
62
|
"workbox-strategies": "^7.4.0",
|
|
51
63
|
"zod": "^4.2.1",
|
|
52
|
-
"@julien-lin/universal-pwa-templates": "^1.2.
|
|
64
|
+
"@julien-lin/universal-pwa-templates": "^1.2.4"
|
|
53
65
|
},
|
|
54
66
|
"devDependencies": {
|
|
55
67
|
"@vitest/coverage-v8": "^2.1.4",
|