Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Ideas for standardizing built AMD files

Received: by 10.204.129.200 with SMTP id p8mr1676084bks.2.1330972919232;
        Mon, 05 Mar 2012 10:41:59 -0800 (PST)
X-BeenThere: amd-implement@googlegroups.com
Received: by 10.204.45.87 with SMTP id d23ls7021450bkf.2.gmail; Mon, 05 Mar
 2012 10:41:57 -0800 (PST)
Received: by 10.204.154.143 with SMTP id o15mr1675425bkw.4.1330972917613;
        Mon, 05 Mar 2012 10:41:57 -0800 (PST)
Received: by 10.204.154.143 with SMTP id o15mr1675424bkw.4.1330972917595;
        Mon, 05 Mar 2012 10:41:57 -0800 (PST)
Return-Path: <jrbu...@gmail.com>
Received: from mail-bk0-f50.google.com (mail-bk0-f50.google.com [209.85.214.50])
        by gmr-mx.google.com with ESMTPS id o5si18799610bkz.0.2012.03.05.10.41.57
        (version=TLSv1/SSLv3 cipher=OTHER);
        Mon, 05 Mar 2012 10:41:57 -0800 (PST)
Received-SPF: pass (google.com: domain of jrbu...@gmail.com designates 209.85.214.50 as permitted sender) client-ip=209.85.214.50;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jrbu...@gmail.com designates 209.85.214.50 as permitted sender) smtp.mail=jrbu...@gmail.com; dkim=pass header...@gmail.com
Received: by mail-bk0-f50.google.com with SMTP id w11so4863927bku.37
        for <amd-implement@googlegroups.com>; Mon, 05 Mar 2012 10:41:57 -0800 (PST)
Return-Path: <jrbu...@gmail.com>
Received-SPF: pass (google.com: domain of jrbu...@gmail.com designates 10.204.133.195 as permitted sender) client-ip=10.204.133.195;
Received: from mr.google.com ([10.204.133.195])
        by 10.204.133.195 with SMTP id g3mr10905233bkt.73.1330972917552 (num_hops = 1);
        Mon, 05 Mar 2012 10:41:57 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :content-type;
        bh=ZrHYk9Fglf+V72TudbXpIItvs5e4Cc9HIKtHLSu6f7c=;
        b=x7tAdb/HzlwHeGrMhVkqfJfEtCfrAxJ2MNlgAmBN2DPgJDFq9Y/sFyoBfCXrns03jr
         3uW4u4UO3rdmxPBQRDnLL0Yc8Q7rdOOHMdHg/tkUt2eiQJvqgI4eSGjkIy5lhDPF3JY0
         xvxbkzXd4StHL7ZOiURX9VELJGznboMBX+d4vzTRj/dogyb0TneNhd67gsUjHz2OwDgl
         908AEVeBHPU8YWtrdBmzze1l/IlGqLIcOlx8QxS7uZFE2yVhhxCNGUawXsXmaCRGvF0a
         FQZ1gBpatIt+a4oijThPj43ZG4VSpUd2hANi8a09oO+QKk8UXpSp4Was+1HU0KpKbRmp
         4sug==
MIME-Version: 1.0
Received: by 10.204.133.195 with SMTP id g3mr8609453bkt.73.1330972917419; Mon,
 05 Mar 2012 10:41:57 -0800 (PST)
Received: by 10.204.170.197 with HTTP; Mon, 5 Mar 2012 10:41:57 -0800 (PST)
In-Reply-To: <B4AE8F4E86E26C47AC407D49872F6F9FA43...@SN2PRD0510MB360.namprd05.prod.outlook.com>
References: <CAJxPFDvdBYKB8CvHsPRoPbuF1R14OnH-XoGWB55W6SVtzat...@mail.gmail.com>
	<CAHgY_ico8Z13VnGXDzseHD4F4dKh7yxMmQHGakMbP6EiJBL...@mail.gmail.com>
	<CAJxPFDuKsVuNV2N-hitdnir=Hp=YY=VTOnY=e31DtCL--vT...@mail.gmail.com>
	<CAHgY_idXuhoWz=3HDFxn+xqVm4NE2x4u3s26gAzFNKjOQAx...@mail.gmail.com>
	<CAJxPFDuoA9u1m2CQmfvpE=T-c_O5sm2uTs2C5f0tQRG=nQW...@mail.gmail.com>
	<CAHgY_ifm6qxTr4VUCMBimcaLcWcJHJosNHiujdJjULX33Dw...@mail.gmail.com>
	<CAJxPFDu8XGz_kJ6ewwL7iv12M=02G4ZCVtbd6xWo0dngqZ3...@mail.gmail.com>
	<CAHgY_ieBK1A_7nzBsWwfuufYrGijzfcjGWnikeCD_CZDgcJ...@mail.gmail.com>
	<4F541F85.9010...@gmail.com>
	<CAHgY_idLAc7r6t=jQ7scWhYSKWZePwO_Ra4HBNZ6Tqo+zOX...@mail.gmail.com>
	<B4AE8F4E86E26C47AC407D49872F6F9FA43...@SN2PRD0510MB360.namprd05.prod.outlook.com>
Date: Mon, 5 Mar 2012 10:41:57 -0800
Message-ID: <CAHgY_icKjKtQviaP2fKeK_m2ww9Rf1PG9nkD-c0y25nfi0K...@mail.gmail.com>
Subject: Re: [amd-implement] Ideas for standardizing built AMD files
From: James Burke <jrbu...@gmail.com>
To: amd-implement@googlegroups.com
Content-Type: text/plain; charset=ISO-8859-1

On Mon, Mar 5, 2012 at 1:48 AM, Domenic Denicola
<dome...@domenicdenicola.com> wrote:
> Wasn't this one of the main departures of AMD from CommonJS in the first place? Or between AMD and the present-day CommonJS Modules/2.0 or UncommonJS Modules specs?
>
> http://tagneto.blogspot.com/2010/12/standards-and-proposals-for-javascript.html "AMD and Wrappings Differences"
>
> What's changed?

This is slightly different than that. AMD should still execute all of
the direct dependencies for a given module.

What I want to change in requirejs: it currently runs *every* define
call in a built file, regardless on whether it was referenced as a
direct dependency. A direct dependency is one listed in the dependency
array or as a string literal require('') call (for simplified CJS
wrapping).

So for this module:

//main.js
define(['require', 'a', 'b'], function(require, a, b) {

    return function (cb) {
        require(['c'], cb);
    });
});

If the built file contained the modules in this order: 'c', 'b', 'a',
'main', requirejs will execute c and b before a and main (assuming c
and b did not have dependencies) once a require()/requirejs() call
runs at the end of the file.

What I want to change: c's factory is not executed until it is
directly referenced, and that only factories that are explicitly
referenced as dependencies are executed, and in the order they are
referenced.

However, the 'a' and 'b' factories are still executed before executing
main's factory (the departure point for AMD and CJS). So, for the
initial file execution, the factory execution order would be:

* a
* b
* main

then at some time later, when main's exported function is called, c's
factory is run. If c also directly depended on 'd' (and a, b, main did
not), then d's factory function would then be executed before c's
factory.

James