Git Product home page Git Product logo

Comments (5)

devoncarew avatar devoncarew commented on September 1, 2024

Would love to know! I can see a way to detect whether you are run from a dev. environment. If your cwd contains a pubspec.yaml, and the name property is equal to your app, I think that indicates that you are running in a source checkout of your app.

A local pub run (pub run) of an app that is not the one under development (running packages/grinder in a foobar project), would have the pubspec be for foobar, not grinder.

A pub global activated app will be run from the user's cwd, and the cwd won't be related to where the app's actual code and assets are. Perhaps we could also use the Uri.base property as well? I think for some (all?) pub global activated apps, it's an http: address rather than a file: based one?

The best we may be able to do is infer things for now; not sure what the recipe is though.

from pub_cache.

devoncarew avatar devoncarew commented on September 1, 2024

Happy to put the logic in this package, or in a better location, if we can determine a good way to detect the different runtime configurations.

from pub_cache.

sethladd avatar sethladd commented on September 1, 2024

I'm writing it now for dartdoc, would love a review when I'm done.

from pub_cache.

sethladd avatar sethladd commented on September 1, 2024

Here's a shot at it: https://github.com/dart-lang/dartdoc/blob/warning-on-snapshot/lib/resource_loader.dart

Handles loading a package: resource, under the following scenarios:

  • Just running via the Dart VM
  • Running via pub run + HTTP + source rewriting to HTTP URIs for imports
  • Running via snapshot in global_package directory (this was the tough one)

Does not handle:

  • Respecting package-root, it currently just looks for a package/ dir in most scenarios
  • Probably a billion small details

Would love to discuss this strategy. For now, it might enough until we can load any resource with package: with core SDK capabilities.

from pub_cache.

devoncarew avatar devoncarew commented on September 1, 2024

tabling this for now

from pub_cache.

Related Issues (17)

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.