Permalink
Browse files

Reporting for global deps on 'combined' is more informative

  • Loading branch information...
1 parent d671b4b commit 72019fe6de7252794ca7f335f08de3e0c2f3a063 @anodynos committed Feb 4, 2013

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -1,8 +1,8 @@
#!/usr/bin/env node
/*!
-* urequire - version 0.3.0alpha19
-* Compiled on 2013-02-04
+* urequire - version 0.3.0alpha20
+* Compiled on 2013-02-05
* git://github.com/anodynos/urequire
* Copyright(c) 2013 Agelos Pikoulas (agelos.pikoulas@gmail.com )
* Licensed MIT http://www.opensource.org/licenses/mit-license.php
@@ -1,4 +1,4 @@
-var VERSION = '0.3.0alpha19'; //injected by grunt:concat
+var VERSION = '0.3.0alpha20'; //injected by grunt:concat
// Generated by CoffeeScript 1.4.0
var Logger, _,
View
@@ -1,7 +1,7 @@
{
"name": "urequire",
"description": "Module converter: write modular code once, convert to UMD and run/test on AMD (browser/requirejs) & nodejs.",
- "version": "0.3.0alpha19",
+ "version": "0.3.0alpha20",
"homepage": "https://github.com/anodynos/urequire",
"author": {
"name": "Agelos Pikoulas",
@@ -27,8 +27,11 @@ class DependenciesReporter
DT = Dependency.TYPES
_B.okv dependencyTypesMessages,
DT.global,
- header: "Global-looking dependencies (not checked in this version):"
- footer: "They are added as-is."
+ header: "Global-looking dependencies (those without fileRelative (eg `./`) & not present in bundle's root):"
+ footer: """
+ Note: When executing on plain nodejs, globals are `require`d as is.
+ When executing on Web/AMD or uRequire/UMD they use `rjs.baseUrl`/`rjs.paths`, if present.
+ """
DT.notFoundInBundle,
header: "\u001b[31m Bundle-looking dependencies not found in bundle:",
@@ -46,7 +49,7 @@ class DependenciesReporter
reportTemplate: (texts, dependenciesFound)-> """
\n#{texts.header}
- #{ "'#{dependency}' @ [
+ #{ "'#{dependency}' dependendency appears in modules: [
#{("\n '" +
mf + "'" for mf in moduleFiles)}\n ]\n" for dependency, moduleFiles of dependenciesFound
}#{
@@ -146,9 +146,9 @@ class Bundle extends BundleBase
@build.out uModule.modulePath, uModule.convertedJs
# @todo:5 else if String, output to this file ?
- report = @reporter.getReport(@build.interestingDepTypes)
+ report = @reporter.getReport @build.interestingDepTypes
if not _.isEmpty(report)
- l.log '\n########### urequire, final report ########### :\n', report
+ l.log 'Report for this `build`:\n', report
if @build.template.name is 'combined'
if haveChanges
@@ -158,7 +158,7 @@ class Bundle extends BundleBase
else
@build.done true
- getRequireJSConfig: ()-> #@todo: remove & fix this!
+ getRequireJSConfig: ()-> #@todo:(7 5 2) remove & fix this!
paths:
text: "requirejs_plugins/text"
json: "requirejs_plugins/json"
@@ -293,7 +293,23 @@ class Bundle extends BundleBase
setTimeout (=>
l.debug 60, 'Checking r.js output file...'
if _fs.existsSync build.combinedFile
- l.verbose "Combined file '#{build.combinedFile}' written successfully."
+ l.log "Combined file '#{build.combinedFile}' written successfully."
+
+ if not _.isEmpty(@getDepsVars depType:'global')
+ l.log """
+ Global bindinds: make sure the following global dependencies
+
+ #{l.prettify @getDepsVars depType:'global'}
+
+ are available when combined script '#{build.combinedFile}' is running on:
+
+ a) nodejs: they should exist as a local `nodes_modules`.
+
+ b) Web/AMD: they should be declared as `rjs.paths` (or `rjs.baseUrl`)
+
+ c) Web/Script: the binded variables (eg '_' or '$')
+ must be a globally loaded (i.e `window.$`) BEFORE loading '#{build.combinedFile}'
+ """
# delete outputPath, used as temp directory with individual AMD files
if Logger::debugLevel < 50
@@ -126,7 +126,7 @@ class UModule
# add remaining dependencies (eg 'untrustedRequireDependencies') to DependenciesReport
if @bundle.reporter
- for repData in [ (_.pick @moduleInfo, @bundle.reporter.interestingDepTypes) ]
+ for repData in [ (_.pick @moduleInfo, @bundle.reporter.reportedDepTypes) ]
@bundle.reporter.addReportData repData, @modulePath
# our final 'templateInfo' information follows

0 comments on commit 72019fe

Please sign in to comment.