@divriots/jampack 0.10.0 → 0.11.1

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/dist/config.js CHANGED
@@ -5,14 +5,14 @@ import default_options from './config-default.js';
5
5
  import fast_options_override from './config-fast.js';
6
6
  const options = default_options;
7
7
  export function fast() {
8
- deepmerge(options, fast_options_override);
8
+ Object.assign(options, deepmerge(options, fast_options_override));
9
9
  }
10
10
  export async function loadConfig() {
11
11
  const proload = await load('jampack', { mustExist: false });
12
12
  if (proload) {
13
13
  console.log('Overriding default config with:');
14
14
  console.log(JSON.stringify(proload.value, null, 2));
15
- deepmerge(options, proload.value);
15
+ Object.assign(options, deepmerge(options, proload.value));
16
16
  }
17
17
  }
18
18
  export default options;
package/dist/index.js CHANGED
@@ -41,6 +41,11 @@ program
41
41
  .action(async (dir, options) => {
42
42
  $state.dir = dir;
43
43
  $state.args = options;
44
+ if (options) {
45
+ console.log('Options:');
46
+ console.log(options);
47
+ console.log('');
48
+ }
44
49
  // Override default config with config file
45
50
  await loadConfig();
46
51
  // Override config with fast options if set
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.1",
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",