@travetto/image 3.4.3 → 4.0.0-rc.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/README.md CHANGED
@@ -19,7 +19,7 @@ The utility's primary structure revolves around the [CommandOperation](https://g
19
19
 
20
20
  **Code: Simple Image Resize**
21
21
  ```typescript
22
- import { createReadStream } from 'fs';
22
+ import { createReadStream } from 'node:fs';
23
23
 
24
24
  import { StreamUtil } from '@travetto/base';
25
25
  import { ImageConverter } from '@travetto/image';
package/__index__.ts CHANGED
@@ -1 +1,2 @@
1
+ /// <reference path="./src/trv.d.ts" />
1
2
  export * from './src/convert';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/image",
3
- "version": "3.4.3",
3
+ "version": "4.0.0-rc.0",
4
4
  "description": "Image support, resizing, and optimization",
5
5
  "keywords": [
6
6
  "images",
@@ -23,8 +23,8 @@
23
23
  "directory": "module/image"
24
24
  },
25
25
  "dependencies": {
26
- "@travetto/base": "^3.4.2",
27
- "@travetto/command": "^3.4.3"
26
+ "@travetto/base": "^4.0.0-rc.0",
27
+ "@travetto/command": "^4.0.0-rc.0"
28
28
  },
29
29
  "travetto": {
30
30
  "displayName": "Image"
package/src/convert.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Readable } from 'stream';
2
- import { createReadStream } from 'fs';
1
+ import { Readable } from 'node:stream';
2
+ import { createReadStream } from 'node:fs';
3
3
 
4
4
  import { CommandOperation } from '@travetto/command';
5
5
  import { StreamUtil } from '@travetto/base';
package/src/resource.ts CHANGED
@@ -1,7 +1,7 @@
1
- import fs from 'fs/promises';
2
- import { Readable } from 'stream';
1
+ import fs from 'node:fs/promises';
2
+ import { Readable } from 'node:stream';
3
3
 
4
- import { ManifestFileUtil, RootIndex, path } from '@travetto/manifest';
4
+ import { ManifestFileUtil, RuntimeIndex, path } from '@travetto/manifest';
5
5
  import { Env, ResourceLoader, StreamUtil } from '@travetto/base';
6
6
 
7
7
  import { ImageConverter } from './convert';
@@ -16,7 +16,7 @@ export class ImageOptimizingResourceLoader extends ResourceLoader {
16
16
  constructor(paths: string[] = [], cacheRoot?: string) {
17
17
  super(paths);
18
18
 
19
- this.#cacheRoot = cacheRoot ?? path.resolve(Env.get('TRV_IMAGE_CACHE', ManifestFileUtil.toolPath(RootIndex, 'image_cache')));
19
+ this.#cacheRoot = cacheRoot ?? path.resolve(Env.TRV_IMAGE_CACHE.val || ManifestFileUtil.toolPath(RuntimeIndex, 'image_cache'));
20
20
  }
21
21
 
22
22
  async #openFile(pth: string): Promise<fs.FileHandle> {
package/src/trv.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ import '@travetto/base';
2
+
3
+ declare global {
4
+ interface TravettoEnv {
5
+ /**
6
+ * Where should optimized images be stored by default
7
+ * @default undefined
8
+ */
9
+ TRV_IMAGE_CACHE: string;
10
+ }
11
+ }