Coder Social home page Coder Social logo

deno-embedder's People

Contributors

7flash avatar nfnitloop avatar pomdtr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

deno-embedder's Issues

JSR Imports Break `deno check`

deno-embedder creates files that depend on embed.ts, relative to the place that deno-embedder was imported, using import.meta. But it looks like import.meta exposes JSR imports as HTTP imports, which breaks deno check, which gives an error like this:

> deno task check
Task check deno check src/main.ts
error: Failed resolving types. Importing JSR packages via HTTPS specifiers for type checking is not supported for performance reasons. If you would like types, import via a `jsr:` specifier instead or else use a non-statically analyzable dynamic import.
  Importing: https://jsr.io/@nfnitloop/deno-embedder/1.3.0/embed.ts
    at file:///[...]/src/generated/static/dir.ts:1:17

JSR disallows some file patterns.

  • No spaces in filenames.
  • Filenames may not contain .d.ts, even in the middle.

Add some normalization to the file names generated by deno-embedder so that they don't run into these issues.

Feature: Add ETag support

This is a feature I requested and used in rust-embed: pyrossh/rust-embed#140

Would be nice to have it here too.

  • Update the generator to save LastModified
  • Update the generator (or just ad a lazy method) to provide a sha-256 hash of the bytes.
  • Update the oak helpers to properly serve requests w.r.t. Tag/Last-Modified

"Getting Started" docs

Right now I just point to the sample repo.

While it does have a lot of comments to help guide users, a proper README guiding through setup would be better. :)

add a `build --check` option.

As part of a build, it would be nice to be able to re-generate embedded files to make sure they're the most up-to-date versions. (that is: without starting up "dev mode" and then having to kill that server.)

Preferably, there would be an option to also just check that the generated files and return an error if they're not up-to-date.

Support async `import()`s

The current implementation of Deno Embedder creates a dir.ts file which imports all files for an embed directory.

This means that if you have a large set of embeds, you pay the cost of loading all of those embeds every time you start your application, even if you're not going to use them all.

It would be great if we could create a files list like:

const files = {
  "Smiley.svg": () => import("./Smiley.svg_.ts"),
  "index.html": () => import("./index.html_.ts"),
} as const

That way, we'd only need to import one of the embedded files if it's requested.

Blockers

I thought this new feature would allow using dynamic imports:
https://deno.com/blog/v1.32#deno-compile-support-for-web-workers-and-dynamic-import

However, the current implementation seems limited to binaries built with deno compile.

  • deno compile has access to all dynamic imports without requiring additional permissions.
  • deno install does not install dynamic imports, and they must be imported from network/disk, by granting extra permissions to do so.
  • deno run also requires extra permissions to load dynamic imports. (This impacts "dev mode".)

My goal for Deno Embedder is for it to "just work" for all these cases, so I'm not going to bother supporting dynamic imports until Deno supports the above cases.

Upstream tracking issues:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.