Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4295010CC1 for ; Fri, 11 Apr 2014 19:46:33 +0000 (UTC) Received: (qmail 78440 invoked by uid 500); 11 Apr 2014 19:46:32 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 77953 invoked by uid 500); 11 Apr 2014 19:46:31 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 77442 invoked by uid 99); 11 Apr 2014 19:46:20 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Apr 2014 19:46:20 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 2C8E898B41C; Fri, 11 Apr 2014 19:46:19 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anis@apache.org To: commits@cordova.apache.org Date: Fri, 11 Apr 2014 19:47:02 -0000 Message-Id: In-Reply-To: <5ae104e14fc54c2cafb6c1196725e493@git.apache.org> References: <5ae104e14fc54c2cafb6c1196725e493@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [46/50] [abbrv] git commit: creating a transform for org.apache.cordova.* modules creating a transform for org.apache.cordova.* modules Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/89c2dadb Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/89c2dadb Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/89c2dadb Branch: refs/heads/browserify Commit: 89c2dadb442d0bccf04597f7a9b016693ca1dbe0 Parents: ef1b980 Author: Anis Kadri Authored: Sat Mar 29 21:16:47 2014 +0100 Committer: Anis Kadri Committed: Fri Apr 11 12:45:45 2014 -0700 ---------------------------------------------------------------------- src/prepare.js | 11 +++++++++++ 1 file changed, 11 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/89c2dadb/src/prepare.js ---------------------------------------------------------------------- diff --git a/src/prepare.js b/src/prepare.js index 8b770e1..ae7f500 100644 --- a/src/prepare.js +++ b/src/prepare.js @@ -33,6 +33,7 @@ var platform_modules = require('./platforms'), plugman = require('../plugman'), et = require('elementtree'), bundle = require('cordova-js/tasks/lib/bundle-browserify'), + requireTr = require('cordova-js/tasks/lib/require-tr'), writeLicenseHeader = require('cordova-js/tasks/lib/write-license-header'); // Called on --prepare. @@ -119,6 +120,7 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_ } /* begin browserify */ + requireTr.platform = platform; var libraryRelease = bundle(platform, false, 'N/A'); /* end browserify */ @@ -185,7 +187,11 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_ var fsPath = path.join.apply(path, pathParts); var scriptPath = path.join(pluginDir, fsPath); + + /* begin browserify */ var bScriptPath = util.format("%s.%s", scriptPath, 'browserify'); + requireTr.addModule({symbol: new RegExp(moduleName), path: bScriptPath}); + /* end browserify */ var scriptContent = fs.readFileSync(scriptPath, 'utf-8'); fs.writeFileSync(bScriptPath, scriptContent, 'utf-8'); @@ -237,7 +243,10 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_ // Add it to the list of module objects bound for cordova_plugins.json moduleObjects.push(obj); + /* begin browserify */ + libraryRelease.transform(requireTr.transform); libraryRelease.add(bScriptPath); + /* end browserify */ }); }); @@ -273,6 +282,7 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_ outReleaseFileStream.on('finish', function() { var newtime = new Date().valueOf() - time; plugman.emit('verbose', 'generated cordova.' + platform + '.js @ ' + commitId + ' in ' + newtime + 'ms'); + // TODO clean up all the *.browserify files }); outReleaseFileStream.on('error', function(err) { @@ -280,4 +290,5 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_ console.log('error while generating cordova_b.js'); plugman.emit('verbose', 'error while generating cordova.js'); }); + /* end browserify */ };