@stacksjs/defaults 0.75.160 → 0.75.162

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.
@@ -86,7 +86,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
86
86
  | `@stacksjs/slug` | [`stacks-slug`](../stacks-slug/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/slug/src/index.ts) | 4 |
87
87
  | `@stacksjs/sms` | [`stacks-sms`](../stacks-sms/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/sms/src/index.ts) | 5 |
88
88
  | `@stacksjs/socials` | [`stacks-socials`](../stacks-socials/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/index.ts) | 12 |
89
- | `@stacksjs/storage` | [`stacks-storage`](../stacks-storage/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/index.ts) | 36 |
89
+ | `@stacksjs/storage` | [`stacks-storage`](../stacks-storage/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/index.ts) | 37 |
90
90
  | `@stacksjs/strings` | [`stacks-strings`](../stacks-strings/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/strings/src/index.ts) | 7 |
91
91
  | `@stacksjs/testing` | [`stacks-testing`](../stacks-testing/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/src/index.ts) | 11 |
92
92
  | `@stacksjs/tinker` | [`stacks-repl`](../stacks-repl/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/index.ts) | 1 |
@@ -829,7 +829,7 @@ Declared runtime exports: `PathSanitizeError`, `Storage`, `StorageManager`, `Upl
829
829
 
830
830
  Local source modules: [src/adapters/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/adapters/index.ts), [src/copy.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/copy.ts), [src/delete.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/delete.ts), [src/drivers/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/drivers/index.ts), [src/facade.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/facade.ts), [src/file-info.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/file-info.ts), [src/files.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/files.ts), [src/folders.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/folders.ts), [src/fs.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/fs.ts), [src/glob.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/glob.ts), [src/hash.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/hash.ts), [src/helpers.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/helpers.ts), [src/mime-verify.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/mime-verify.ts), [src/path-sanitize.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/path-sanitize.ts), [src/provision.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/provision.ts), [src/s3-presigned-post.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/s3-presigned-post.ts), [src/signed-url.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/signed-url.ts), [src/static-serve.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/static-serve.ts), [src/storage.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/storage.ts), [src/types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/types.ts), [src/types/filesystem.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/types/filesystem.ts), [src/uploaded-file.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/uploaded-file.ts), [src/zip.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/zip.ts).
831
831
 
832
- Evidence directory: [36 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
832
+ Evidence directory: [37 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
833
833
 
834
834
  ### @stacksjs/strings
835
835
 
@@ -63,7 +63,8 @@ import { readJsonFile, readPackageJson, readTextFile, writeFile, writeJsonFile,
63
63
  import { isFolder, isDir, doesFolderExist, createFolder, getFolders } from '@stacksjs/storage'
64
64
  import { glob, globSync } from '@stacksjs/storage'
65
65
  import { hashDirectory, hashPath, hashPaths } from '@stacksjs/storage'
66
- import { zip, unzip, archive, unarchive, compress, decompress, gzipSync, gunzipSync, deflateSync, inflateSync } from '@stacksjs/storage'
66
+ import { zip, unzip, archive, unarchive, compress, decompress, gzipSync, gunzipSync, deflateSync, inflateSync, zipEntries } from '@stacksjs/storage'
67
+ import type { ZipEntriesOptions, ZipEntry } from '@stacksjs/storage'
67
68
  import * as storage from '@stacksjs/storage'
68
69
  ```
69
70
 
@@ -460,6 +461,35 @@ const deflated = deflateSync(data) // Bun.deflateSync
460
461
  const inflated = inflateSync(deflated) // Bun.inflateSync
461
462
  ```
462
463
 
464
+ ### In-memory ZIP (`zipEntries`)
465
+
466
+ `zip()` needs files on disk and the `zip` binary. To answer a request with an
467
+ archive built from data you already hold (an export, a bundle of generated
468
+ CSVs), use `zipEntries()`: it returns the archive's bytes and touches nothing on
469
+ disk.
470
+
471
+ ```typescript
472
+ import { zipEntries } from '@stacksjs/storage'
473
+
474
+ const bytes = zipEntries([
475
+ { name: 'members.csv', data: membersCsv }, // string -> UTF-8
476
+ { name: 'photos/logo.png', data: pngBytes }, // Uint8Array as is
477
+ { name: 'README.txt', data: readme, date: exportedAt }, // per-entry timestamp
478
+ ], { level: 6, date: new Date() }) // both optional
479
+
480
+ return new Response(bytes, {
481
+ headers: {
482
+ 'Content-Type': 'application/zip',
483
+ 'Content-Disposition': 'attachment; filename="export.zip"',
484
+ },
485
+ })
486
+ ```
487
+
488
+ - Each entry is deflated with Bun's raw DEFLATE when that is smaller, else stored; `level: 0` stores everything. CRC-32 per entry, UTF-8 names (flag bit 11), DOS timestamps (local time, 2-second steps, clamped to 1980-2107), files marked `-rw-r--r--`.
489
+ - `options.date` is the timestamp for entries without their own `date` (default now); fix it for byte-identical archives.
490
+ - Entry order is kept. It throws on a repeated name, a name that is empty, absolute (`/x`, `C:/x`), or has an empty, `.` or `..` part; backslashes become `/`. No directory entries: folders come from the paths.
491
+ - No ZIP64: more than 65,535 entries, or any entry, offset or the archive past 4 GB, throws. Everything is held in memory, so it is for downloads, not backups (use `zip()` there).
492
+
463
493
  ### Folder Utilities
464
494
 
465
495
  ```typescript
@@ -629,6 +659,7 @@ const config = configFromEnv({ default: 'local' })
629
659
  - `UploadedFile.hashName()` is cached -- calling it multiple times returns the same hash
630
660
  - Low-level operations (`copy`, `move`, `delete*`, etc.) use synchronous `fs` methods, while the Storage facade uses async operations
631
661
  - `zip()` and `unzip()` shell out to the `zip`/`unzip` commands -- they require these tools to be installed on the system
662
+ - `zipEntries()` is the in-memory alternative: no binary, no disk, returns a `Uint8Array` (no ZIP64, so it refuses 65,535+ entries or 4 GB)
632
663
  - `STORAGE_DRIVER` env var controls the driver selection in `config/filesystems.ts`
633
664
 
634
665
 
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.75.160",
5
+ "version": "0.75.162",
6
6
  "description": "Stacks, built into VS Code: stx templates, pickier linting and formatting, encrypted env files, the dev server preview and every buddy command. No other extensions required.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.160",
5
+ "version": "0.75.162",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/stacksjs/stacks.git",
@@ -55,7 +55,7 @@
55
55
  "dependencies": {
56
56
  "@iconify-json/f7": "^1.2.2",
57
57
  "@iconify-json/hugeicons": "^1.2.35",
58
- "@stacksjs/mobile": "0.75.160",
58
+ "@stacksjs/mobile": "0.75.162",
59
59
  "@stacksjs/sanitizer": "^0.2.483",
60
60
  "@xterm/addon-fit": "^0.11.0",
61
61
  "@xterm/xterm": "^6.0.0",