@divriots/jampack 0.20.0 → 0.20.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/LICENSE CHANGED
File without changes
package/README.md CHANGED
@@ -106,7 +106,21 @@ Lazy-load assets below-the-fold ⬇️.
106
106
 
107
107
  - Images and Iframes are lazy loaded.
108
108
 
109
- See [details](https://jampack.divriots.com/features/optimize-above-the-fold/).
109
+ See [Above-the-fold optimisations](https://jampack.divriots.com/features/optimize-above-the-fold/) for details.
110
+
111
+ ## Inline critical CSS
112
+
113
+ Avoid [FOUC](https://en.wikipedia.org/wiki/Flash_of_unstyled_content) while stylesheets are downloaded and parsed.
114
+ `jampack` will inline critical CSS and lazy-load the rest of CSS.
115
+
116
+ See [Inline critical CSS](https://jampack.divriots.com/features/inline-critical-css/) for details.
117
+
118
+ ## Prefetch links
119
+
120
+ Speedup the future page navigations by prefetching the links on the page.
121
+ Thanks to [quicklink](https://github.com/GoogleChromeLabs/quicklink), this can be done dynamically as links enter the viewport.
122
+
123
+ See [Prefetch links](https://jampack.divriots.com/features/prefetch-links/) for details.
110
124
 
111
125
  ### All assets are compressed
112
126
 
package/dist/index.js CHANGED
File without changes
package/dist/optimize.js CHANGED
@@ -121,8 +121,7 @@ async function analyse(file) {
121
121
  //
122
122
  if (config.css.inline_critical_css) {
123
123
  try {
124
- const location = path.resolve(path.dirname(path.join($state.dir, file)));
125
- htmlResult = await inlineCriticalCss(location, htmlResult);
124
+ htmlResult = await inlineCriticalCss($state.dir, htmlResult);
126
125
  }
127
126
  catch (e) {
128
127
  console.warn('Fail to inline critical CSS', e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@divriots/jampack",
3
- "version": "0.20.0",
3
+ "version": "0.20.2",
4
4
  "cache-version": {
5
5
  "img": "v1",
6
6
  "img-ext": "v1"
@@ -50,18 +50,17 @@
50
50
  "tslib": "^2.6.2",
51
51
  "typescript": "^5.2.2"
52
52
  },
53
+ "engines": {
54
+ "node": ">=14.0.0"
55
+ },
56
+ "bugs": "https://github.com/divriots/jampack/issues",
57
+ "keywords": [],
58
+ "types": "dist/index.d.ts",
53
59
  "scripts": {
54
60
  "watch": "pnpm build --watch",
55
61
  "try": "shx rm -fr demo && cp -R demo_ref demo && node ./dist/index.js ./demo --nocache",
56
62
  "build": "shx rm -rf dist && tsc -b",
57
63
  "lint": "eslint . --ext .ts --config .eslintrc",
58
- "prepublishOnly": "pnpm build",
59
64
  "cleanAllDotJampack": "find -s . | grep '.jampack$' | xargs rm -fr"
60
- },
61
- "engines": {
62
- "node": ">=14.0.0"
63
- },
64
- "bugs": "https://github.com/divriots/jampack/issues",
65
- "keywords": [],
66
- "types": "dist/index.d.ts"
67
- }
65
+ }
66
+ }