@divriots/jampack 0.4.0 → 0.4.2

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.md CHANGED
@@ -60,6 +60,9 @@ Check the [Documentation side](https://jampack.divriots.com).
60
60
  - [divRIOTS.com](https://divRIOTS.com)
61
61
  - [Backlight.dev](https://backlight.dev)
62
62
  - [story.to.design](https://story.to.design)
63
+ - [html.to.design](https://html.to.design/docs)
64
+ - [WebComponents.dev](https://WebComponents.dev)
65
+ - [LWC.studio](https://lwc.studio)
63
66
  - [Components.studio](https://components.studio)
64
67
  > Add yours here
65
68
 
@@ -81,10 +84,6 @@ This pass takes all `*.{html|.htm}` files and parse them for optimisation.
81
84
 
82
85
  | Optimization | Technical details | Related links | Available |
83
86
  | -------------- | --------------------- |:------------:|:---------:|
84
- | 🔽 `<img>` | | | |
85
- | Optimize `png` to `WebP` | Given `foo.png`, creates a **near loss less** `foo.png.webp` if size reduced. | [web.dev](https://web.dev/uses-webp-images/) | ✅ |
86
- | Optimize `jpeg` to `WebP` | Given `foo.jpg`, creates a **lossly** `foo.jpg.webp` if size reduced. | [web.dev](https://web.dev/uses-webp-images/) | ✅ |
87
- | Optimize `svg` | | | ✅ |
88
87
  | Generate responsive images and set `srcset` | Multiple smaller images are generated exclusively in `WebP` and `srcset` attribute is set accordingly. | [web.dev](https://web.dev/patterns/web-vitals-patterns/images/responsive-images/) | ✅ |
89
88
  | Embed small images | If optimised image size is <500 bytes, image is embed in `[src]` | | ✅ |
90
89
  | Set `width` and `height` if missing | Uses image size and aspect ratio to fill values | [web.dev](https://web.dev/optimize-cls/#images-without-dimensions) | ✅ |
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" resolution-mode="require"/>
1
2
  import sharp from 'sharp';
2
3
  import type { Image } from './types.js';
3
4
  export declare const compressImage: (data: Buffer, options: {
package/dist/index.js CHANGED
@@ -10,20 +10,21 @@ import { printTitle } from './logger.js';
10
10
  import { exit } from 'process';
11
11
  import kleur from 'kleur';
12
12
  import { cleanCache } from './cache.js';
13
+ import { VERSION } from './version.js';
13
14
  const logo = ` __ __
14
15
  |__|____ _____ ___________ ____ | | __
15
16
  | \\__ \\ / \\\\____ \\__ \\ _/ ___\\| |/ /
16
17
  | |/ __ \\| Y Y \\ |_> > __ \\\\ \\___| <
17
18
  /\\__| (____ /__|_| / __(____ /\\___ >__|_ \\
18
19
  \\______| \\/ \\/| | \\/ \\/ \\/
19
- |__| by ‹div›RIOTS (c)2022-2023
20
+ v${VERSION.padEnd(14)} |__| by ‹div›RIOTS
20
21
  `;
21
22
  console.log(logo);
22
23
  const program = new Command();
23
24
  program
24
25
  .name('jampack')
25
26
  .description('Static website Optimizer')
26
- .version('0.0.1');
27
+ .version(VERSION);
27
28
  program.command('pack', { isDefault: true })
28
29
  .description('todo')
29
30
  .argument('<dir>', 'Directory to pack')
package/dist/optimize.js CHANGED
@@ -13,7 +13,7 @@ import { isLocal, Resource, translateSrc } from "./utils/resource.js";
13
13
  async function analyse(file) {
14
14
  console.log("▶ " + file);
15
15
  const html = (await fs.readFile(path.join($state.dir, file))).toString();
16
- const $ = cheerio.load(html, { withStartIndices: true });
16
+ const $ = cheerio.load(html, { withStartIndices: true, decodeEntities: false });
17
17
  const theFold = getTheFold($);
18
18
  const imgs = $("img");
19
19
  const imgsArray = [];
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION: string;
1
+ export declare const VERSION: any;
package/dist/version.js CHANGED
@@ -1,3 +1,6 @@
1
- // @ts-ignore
2
- import json from '../package.json' assert { type: 'json' };
3
- export const VERSION = json.version;
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
5
+ const pkgjson = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json')).toString());
6
+ export const VERSION = pkgjson.version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@divriots/jampack",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Packer for static websites",
5
5
  "author": "Georges Gomes @georges-gomes",
6
6
  "bin": {