@localnerve/sass-asset-functions 6.7.0 → 6.8.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Sass Asset Functions Change Log
2
2
 
3
+ ## 6.8.0
4
+ * sass 1.85.1
5
+ * image-size 2.0.0, add heif, tiff64, bigtiff support
6
+
3
7
  ## 6.7.0
4
8
  * sass 1.85.0
5
9
 
@@ -8,7 +8,7 @@ var fs = _interopRequireWildcard(require("node:fs"));
8
8
  var path = _interopRequireWildcard(require("node:path"));
9
9
  var url = _interopRequireWildcard(require("node:url"));
10
10
  var _mimeTypes = _interopRequireDefault(require("mime-types"));
11
- var _imageSize = _interopRequireDefault(require("image-size"));
11
+ var _imageSize = require("image-size");
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
14
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -95,10 +95,24 @@ class Processor {
95
95
  return path.join(this.paths[`http_${segment}_path`], filepath).replace(/\\/g, '/');
96
96
  }
97
97
  image_width(filepath, done) {
98
- done((0, _imageSize.default)(this.real_path(filepath, 'images')).width);
98
+ const src = this.real_path(filepath, 'images');
99
+ let buffer;
100
+ try {
101
+ buffer = fs.readFileSync(src);
102
+ } catch (err) {
103
+ throw new Error(`image_width failed to read '${src}': ${err}`);
104
+ }
105
+ done((0, _imageSize.imageSize)(buffer).width);
99
106
  }
100
107
  image_height(filepath, done) {
101
- done((0, _imageSize.default)(this.real_path(filepath, 'images')).height);
108
+ const src = this.real_path(filepath, 'images');
109
+ let buffer;
110
+ try {
111
+ buffer = fs.readFileSync(src);
112
+ } catch (err) {
113
+ throw new Error(`image_height failed to read '${src}': ${err}`);
114
+ }
115
+ done((0, _imageSize.imageSize)(buffer).height);
102
116
  }
103
117
  inline_image(filepath, mime_type, done) {
104
118
  const src = this.real_path(filepath, 'images');
package/lib/processor.js CHANGED
@@ -8,7 +8,7 @@ import * as fs from 'node:fs';
8
8
  import * as path from 'node:path';
9
9
  import * as url from 'node:url';
10
10
  import mime from 'mime-types';
11
- import sizeOf from 'image-size';
11
+ import { imageSize } from 'image-size';
12
12
 
13
13
  const defaultPaths = {
14
14
  images_path: 'public/images',
@@ -93,11 +93,29 @@ export default class Processor {
93
93
  }
94
94
 
95
95
  image_width (filepath, done) {
96
- done(sizeOf(this.real_path(filepath, 'images')).width);
96
+ const src = this.real_path(filepath, 'images');
97
+ let buffer;
98
+
99
+ try {
100
+ buffer = fs.readFileSync(src);
101
+ } catch (err) {
102
+ throw new Error(`image_width failed to read '${src}': ${err}`);
103
+ }
104
+
105
+ done(imageSize(buffer).width);
97
106
  }
98
-
107
+
99
108
  image_height (filepath, done) {
100
- done(sizeOf(this.real_path(filepath, 'images')).height);
109
+ const src = this.real_path(filepath, 'images');
110
+ let buffer;
111
+
112
+ try {
113
+ buffer = fs.readFileSync(src);
114
+ } catch (err) {
115
+ throw new Error(`image_height failed to read '${src}': ${err}`);
116
+ }
117
+
118
+ done(imageSize(buffer).height);
101
119
  }
102
120
 
103
121
  inline_image (filepath, mime_type, done) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@localnerve/sass-asset-functions",
3
- "version": "6.7.0",
3
+ "version": "6.8.0",
4
4
  "description": "compass-style asset functions for dart-sass or other sass compilers",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -50,18 +50,18 @@
50
50
  },
51
51
  "homepage": "https://github.com/localnerve/sass-asset-functions",
52
52
  "dependencies": {
53
- "image-size": "^1.2.0",
53
+ "image-size": "^2.0.0",
54
54
  "mime-types": "^2.1.35",
55
- "sass": "^1.85.0"
55
+ "sass": "^1.85.1"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@babel/cli": "^7.26.4",
59
59
  "@babel/preset-env": "^7.26.9",
60
- "@eslint/js": "^9.20.0",
61
- "eslint": "^9.20.1",
60
+ "@eslint/js": "^9.21.0",
61
+ "eslint": "^9.21.0",
62
62
  "eslint-plugin-jest": "^28.11.0",
63
63
  "glob": "^11.0.1",
64
- "globals": "^15.15.0",
64
+ "globals": "^16.0.0",
65
65
  "jest": "^29.7.0",
66
66
  "node-sass": "^9.0.0",
67
67
  "rimraf": "^6.0.1",