No, we're not trying to prescribe a specific structure.
There's a default place to fetch files from, because there has to be
_some_ default. However, I expect that most developers will do one of
the following (Jason listed these options earlier):
1. Load a script tag with `module "backbone" { ... }` in it.
2. Call System.load(some_url) to fetch some source code with `module
"backbone" { ... }` in it.
3. Use System.ondemand() to specify where to fetch "backbone" from.
4. Use a more complex resolve hook, either written by them or from a
loader like YUI, to map "backbone" to some file somewhere.
Of course, there's a sensible default, but for production sites that
will likely not be the right choice.
Sam
On Wed, May 8, 2013 at 2:22 PM, Domenic Denicola
<[email protected]> wrote:
> From: [email protected] [[email protected]] on behalf of Sam Tobin-Hochstadt
> [[email protected]]
>
>> In contrast, usually you want to be using that global version of "backbone",
>> not something specific to your library. Of course, you can bundle backbone,
>> and refer to it with "./backbone" if that's what you want, but that's
>> probably a less-common case.
>
> OK! So, this is the confusion. Because the semantics you gave resolve
> `"backbone"` to a specific URL,
> `"http://example.com/path/to/base/backbone.js"`. To me that doesn't
> correspond at all to "the global version of Backbone". Unless I guess you are
> assuming projects are set up such that their root directory contains a bunch
> of main module files for all the packages they use? So a web dev's workflow
> is something like
>
>
> ```
> index.html
> backbone.js
> chai.js
> rsvp.js
> lib/
> entry.js
> otherModule.js
> packages/
> backbone/
> backbone.js
> README.md
> package.json
> chai/
> index.js
> ... lots of other JS files
> package.json
> rsvp/
> index.js
> promise.js
> ... lots of other JS files
> package.json
> ```
>
> And the root `rsvp.js` contains
>
> ```js
> import { resolve, Promise, ... } from "packages/rsvp/index"; // or
> "./packages/rsvp/index"
> export { resolve, Promise, ... }
> ```
>
> I guess a tool would be needed to generate all these delegating files that
> live in your root directory?
>
> Was that the intent of the way your algorithm resolves `"backbone"`, to move
> web devs toward such a structure?
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss