Skip to content

Commit

Permalink
Upgrade zen-fs deps (#41)
Browse files Browse the repository at this point in the history
<!-- If this pull request closes an issue, please mention the issue
number below -->
Closes # <!-- Issue # here -->

## 💸 TL;DR
<!-- What's the three sentence summary of purpose of the PR -->
Migrates the unsupported dependency, follow up for
#40

## 📜 Details
[Design Doc](<!-- insert Google Doc link here if applicable -->)

[Jira](<!-- insert Jira link if applicable -->)

<!-- Add additional details required for the PR: breaking changes,
screenshots, external dependency changes -->

## 🧪 Testing Steps / Validation
<!-- add details on how this PR has been tested, include reproductions
and screenshots where applicable -->

## ✅ Checks
<!-- Make sure your pr passes the CI checks and do check the following
fields as needed - -->
- [x] CI tests (if present) are passing
- [x] Adheres to code style for repo
- [ ] Contributor License Agreement (CLA) completed if not a Reddit
employee

---------

Co-authored-by: danil.radkovskyi <danil.radkovskyi@reddit.com>
Co-authored-by: ObsidianSnoo <66971815+ObsidianSnoo@users.noreply.github.com>
3 people authored Jan 6, 2025
1 parent e61990e commit 7d76787
Showing 4 changed files with 741 additions and 71 deletions.
786 changes: 722 additions & 64 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -22,9 +22,9 @@
"@typescript/vfs": "1.6.0",
"@web/dev-server-esbuild": "1.0.2",
"@web/test-runner": "0.19.0",
"@zenfs/core": "0.9.7",
"@zenfs/dom": "0.2.6",
"@zenfs/zip": "0.3.1",
"@zenfs/archives": "1.0.1",
"@zenfs/core": "1.6.17",
"@zenfs/dom": "1.0.3",
"codemirror": "6.0.1",
"esbuild": "0.24.0",
"idb-keyval": "6.2.1",
@@ -60,7 +60,7 @@
"gzip": "3.5 KB"
},
"dist/play-pen.js": {
"none": "26580 KB",
"none": "26818 KB",
"gzip": "4826 KB"
}
},
16 changes: 13 additions & 3 deletions src/elements/play-assets/play-assets.ts
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ import {
tryGetFile,
tryQueryPermission
} from '../../utils/file-access-api.js'
import {Zip} from '@zenfs/zip'
import {Zip} from '@zenfs/archives'
import {Bubble} from '../../utils/bubble.js'

declare global {
@@ -224,7 +224,7 @@ export class PlayAssets extends ReactiveElement {
file = fileHandle as File
await this.#cacheClear()
}
await this.#mountRoot(Zip.create({zipData: await file.arrayBuffer()}))
await this.#mountRoot(Zip.create({data: await file.arrayBuffer()}))
this.#updateState({archiveFilename: fileHandle.name})
}

@@ -256,7 +256,17 @@ export class PlayAssets extends ReactiveElement {

async #mountVirtualFS(): Promise<void> {
if (this.allowStorage) {
await this.#mountRoot(WebStorage.create({}))
const fs = WebStorage.create({})
// dump old localStorage content if it can't be read
try {
await fs.stat('/')
} catch {
console.warn(
`Couldn't read existing virtual filesystem. A new one will be created.`
)
await fs.empty()
}
await this.#mountRoot(fs)
} else {
await this.#mountRoot(InMemory.create({}))
}
2 changes: 2 additions & 0 deletions tools/wds-monkey-patch.js
Original file line number Diff line number Diff line change
@@ -14,6 +14,8 @@ export const monkeyPatchCJS = () => ({
export class Readable {};
export class Writable {};
`
} else if (context.path.endsWith('eventemitter3/index.js')) {
return 'export default class EventEmitter {};'
}
}
})

0 comments on commit 7d76787

Please sign in to comment.