@divriots/jampack 0.10.0 → 0.11.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.
Files changed (2) hide show
  1. package/dist/optimize.js +4 -7
  2. package/package.json +2 -3
package/dist/optimize.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { globby } from 'globby';
2
2
  import * as path from 'path';
3
3
  import * as fs from 'fs/promises';
4
- import cheerio from 'cheerio';
4
+ import * as cheerio from '@divriots/cheerio';
5
5
  import { isNumeric } from './utils.js';
6
6
  import config from './config.js';
7
7
  import { compressImage, } from './compressors/images.js';
@@ -14,14 +14,11 @@ async function analyse(file) {
14
14
  var _a;
15
15
  console.log('▶ ' + file);
16
16
  const html = (await fs.readFile(path.join($state.dir, file))).toString();
17
- const $ = cheerio.load(html, {
18
- withStartIndices: true,
19
- decodeEntities: false,
20
- });
17
+ const $ = cheerio.load(html, { sourceCodeLocationInfo: true });
21
18
  const theFold = getTheFold($);
22
19
  const imgs = $('img');
23
20
  const imgsArray = [];
24
- imgs.each(async (index, imgElement) => {
21
+ imgs.each((index, imgElement) => {
25
22
  imgsArray.push(imgElement);
26
23
  });
27
24
  // Process images sequentially
@@ -54,7 +51,7 @@ async function analyse(file) {
54
51
  }
55
52
  const iframes = $('iframe');
56
53
  const iframesArray = [];
57
- iframes.each(async (index, ifElement) => {
54
+ iframes.each((index, ifElement) => {
58
55
  iframesArray.push(ifElement);
59
56
  });
60
57
  // Process iframes sequentially
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@divriots/jampack",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Packer for static websites",
5
5
  "author": "Georges Gomes @georges-gomes",
6
6
  "bin": {
@@ -16,14 +16,13 @@
16
16
  "/dist"
17
17
  ],
18
18
  "dependencies": {
19
+ "@divriots/cheerio": "1.0.0-rc.12",
19
20
  "@proload/core": "^0.3.3",
20
21
  "@swc/core": "^1.3.57",
21
- "@types/cheerio": "^0.22.31",
22
22
  "@types/csso": "^5.0.0",
23
23
  "@types/html-minifier-terser": "^7.0.0",
24
24
  "@types/sharp": "^0.32.0",
25
25
  "@types/svgo": "^3.0.0",
26
- "cheerio": "0.22.0",
27
26
  "commander": "^10.0.1",
28
27
  "csso": "^5.0.5",
29
28
  "deepmerge": "^4.3.1",