Re: Re: ModuleSpecifier: include .js or not?

2015-04-15 Thread monolithed
This question has already been asked https://mail.mozilla.org/pipermail/es-discuss/2015-February/041430.html I prefer to follow the following rules: File structure ``` root/ foo/ index.js ``` Export module ```js export default foo class () {} ``` Import module

ModuleSpecifier: include .js or not?

2015-04-14 Thread Axel Rauschmayer
In Node.js you can either mention the file extension .js or omit it when you require a module. Which one is preferred for ES6 ModuleSpecifiers? Thanks! Axel -- Dr. Axel Rauschmayer a...@rauschma.de rauschma.de ___ es-discuss mailing list

Re: ModuleSpecifier: include .js or not?

2015-04-14 Thread Wes Garland
Some food for thought from a non-standard use-case. In GPSEE, we can require(module) - but we support both modules written in JavaScript, and modules written in C (technically, any compiled binary with the correct C API), or both. We dlload(module.so) (if present), then interpret module.js (if

Re: include 'foo/index.js' or include 'foo'?

2015-02-06 Thread Isiah Meadows
. From: John Barton johnjbar...@google.com To: Glen Huang curvedm...@gmail.com Cc: monolithed monolit...@gmail.com, es-discuss es-discuss@mozilla.org Date: Thu, 5 Feb 2015 07:53:47 -0800 Subject: Re: include 'foo/index.js' or include 'foo'? The following solution has worked very well for us

Re: include 'foo/index.js' or include 'foo'?

2015-02-06 Thread Isiah Meadows
. From: John Barton johnjbar...@google.com To: Glen Huang curvedm...@gmail.com Cc: monolithed monolit...@gmail.com, es-discuss es-discuss@mozilla.org Date: Thu, 5 Feb 2015 07:53:47 -0800 Subject: Re: include 'foo/index.js' or include 'foo'? The following solution has worked very

include 'foo/index.js' or include 'foo'?

2015-02-05 Thread monolithed
I could not find an answer in the specification regarding the following cases: import './foo/index.js' import 'foo/index.js' import 'foo/index' import 'foo' import 'foo/' Is there a difference? Node.js lets create an 'index.js' file, which indicates the main include file for a directory. So

Re: Re: include 'foo/index.js' or include 'foo'?

2015-02-05 Thread monolithed
```js import './foo/index.js'; import 'foo/index.js'; import 'foo/index'; import 'foo'; import 'foo/‘; ``` ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: include 'foo/index.js' or include 'foo'?

2015-02-05 Thread Glen Huang
lets create an 'index.js' file, which indicates the main include file for a directory. So if you call require('./foo'), both a 'foo.js' file as well as an 'foo/index.js' file will be considered, this goes for non-relative includes as well

Re: include 'foo/index.js' or include 'foo'?

2015-02-05 Thread John Barton
the following cases: import './foo/index.js' import 'foo/index.js' import 'foo/index' import 'foo' import 'foo/' Is there a difference? Node.js lets create an 'index.js' file, which indicates the main include file for a directory. So if you call require('./foo'), both a 'foo.js' file as well

include

2014-07-14 Thread John Barton
bad sure, but sometimes you have to play cards you are dealt. We still depend upon foo.js, bad or not bad. In the current module system we have to abandon ship. In our importer we need to: // WARNING pre-load foo.js somehow! Now imagine if we could issue include 'foo'; and the Loader computes

Re: include

2014-07-14 Thread Sam Tobin-Hochstadt
to play cards you are dealt. We still depend upon foo.js, bad or not bad. In the current module system we have to abandon ship. In our importer we need to: // WARNING pre-load foo.js somehow! Now imagine if we could issue include 'foo'; and the Loader computes an address, say foo.js,fetches

Re: include

2014-07-14 Thread Yehuda Katz
importer we need to: // WARNING pre-load foo.js somehow! Now imagine if we could issue include 'foo'; and the Loader computes an address, say foo.js,fetches the resource and compiles it. Since the content has no dependencies, it is evaluated, then the importer is evaluated. Yay

Re: include

2014-07-14 Thread John Barton
Sorry, I was imagining a specific scenario without giving the specifics: include 'foo'; // foo is conventional JS, not a module I have written on global in a module, it works ok, but the goal was specifically to mutate global with code written in a module. Here I have given code, designed

Re: include

2014-07-14 Thread Yehuda Katz
the specifics: include 'foo'; // foo is conventional JS, not a module I have written on global in a module, it works ok, but the goal was specifically to mutate global with code written in a module. Here I have given code, designed to be loaded with a script tag or included with require() in node