@theatrejs/loader-aseprite 1.5.0 → 1.6.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/package.json CHANGED
@@ -57,5 +57,5 @@
57
57
  "postversion": "node ./tools/custom/postversion.cjs"
58
58
  },
59
59
  "type": "commonjs",
60
- "version": "1.5.0"
60
+ "version": "1.6.1"
61
61
  }
@@ -47,30 +47,30 @@ module.exports = function loader() {
47
47
  throw $error;
48
48
  }
49
49
 
50
- if (typeof aseprite === 'undefined') {
50
+ try {
51
51
 
52
- throw new Error('Aseprite executable path is missing in the loader options.');
53
- }
52
+ const location = path.dirname(file);
53
+ const filename = path.basename(file, '.aseprite');
54
+ const sourceTexture = filename + '.png';
55
+ const sourceData = filename + '.json';
54
56
 
55
- if (fs.existsSync(aseprite) === false) {
57
+ if (fs.existsSync(path.resolve(location, sourceTexture)) === false
58
+ || fs.existsSync(path.resolve(location, sourceData)) === false
59
+ || fs.statSync(path.resolve(location, sourceTexture)).mtime < fs.statSync(file).mtime
60
+ || fs.statSync(path.resolve(location, sourceData)).mtime < fs.statSync(file).mtime) {
56
61
 
57
- throw new Error('Aseprite executable not found reading path: ' + (typeof aseprite !== 'undefined' || aseprite !== '' ? '\'' + aseprite + '\'' : '<empty>') + '.');
58
- }
62
+ if (typeof aseprite === 'undefined') {
59
63
 
60
- const location = path.dirname(file);
61
- const filename = path.basename(file, '.aseprite');
62
- const sourceTexture = filename + '.png';
63
- const sourceData = filename + '.json';
64
+ throw new Error('Aseprite executable path is missing in the loader options.');
65
+ }
64
66
 
65
- const trim = (typeof prepare !== 'undefined' && prepare.trim === true) ? ' --trim' : '';
66
- const sheetType = (typeof prepare !== 'undefined' && ['colums', 'horizontal', 'packed', 'rows', 'vertical'].indexOf(prepare.sheet) !== -1) ? prepare.sheet : 'rows';
67
+ if (fs.existsSync(aseprite) === false) {
67
68
 
68
- try {
69
+ throw new Error('Aseprite executable not found reading path: ' + (typeof aseprite !== 'undefined' || aseprite !== '' ? '\'' + aseprite + '\'' : '<empty>') + '.');
70
+ }
69
71
 
70
- if (fs.existsSync(path.resolve(location, sourceTexture)) === false
71
- || fs.existsSync(path.resolve(location, sourceData)) === false
72
- || fs.statSync(path.resolve(location, sourceTexture)).mtime < fs.statSync(file).mtime
73
- || fs.statSync(path.resolve(location, sourceData)).mtime < fs.statSync(file).mtime) {
72
+ const trim = (typeof prepare !== 'undefined' && prepare.trim === true) ? ' --trim' : '';
73
+ const sheetType = (typeof prepare !== 'undefined' && ['colums', 'horizontal', 'packed', 'rows', 'vertical'].indexOf(prepare.sheet) !== -1) ? prepare.sheet : 'rows';
74
74
 
75
75
  subprocess.execSync(
76
76