Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit f8943fb

Browse files
committed
Update require.js and r.js to 2.1.15, and almond.js to 0.3.0
1 parent c46bd8f commit f8943fb

File tree

6 files changed

+72
-54
lines changed

6 files changed

+72
-54
lines changed

CHANGELOG.md

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,71 @@
1-
<!--
2-
Marked Style: GitHub
3-
-->
4-
# v0.9.4
1+
<!-- Marked Style: GitHub -->
2+
3+
## requirejs-rails changelog
4+
5+
### v0.9.5
6+
7+
- Update `require.js` and `r.js` to `2.1.15`, and `almond.js` to `0.3.0`.
8+
- Remove `data-main` attribute generation from `requirejs_include_tag` and replicate its functionality with an explicit
9+
`require` call. This paves the way for proper almond support.
10+
- Instead of disabling JS compression everywhere, only do so when staging `r.js` input files. This enables `require.js`
11+
itself to be compiled (or not) by the asset pipeline, like any other asset.
12+
- Add support for `bower.json` modules.
13+
14+
### v0.9.4
515

616
- Restore compression of non-module JS assets if specified, including `require.js` itself.
717
- Update `require.js` to `2.1.14`.
818

9-
# v0.9.3
19+
### v0.9.3
1020

1121
- Add detection and proper handling of Bower-based modules.
1222
- Update `require.js` to `2.1.11` and `almond.js` to `0.2.9`.
1323

14-
# v0.9.2
24+
### v0.9.2
1525

1626
- Update `require.js` to `2.1.10` and `almond.js` to `0.2.5`.
1727
- Rails 4 support.
1828

19-
# v0.9.1
29+
### v0.9.1
2030

2131
- Updated to to require.js \ r.js 2.1.2, and almond 0.2.3
2232

23-
# v0.9.0
33+
### v0.9.0
2434

2535
- **BREAKING CHANGE**: Upgrade RequireJS and r.js to v2.0.0
2636
- order.js was removed. See the new [RequireJS 2.0 shim config](https://github.com/jrburke/requirejs/wiki/Upgrading-to-RequireJS-2.0#wiki-shim).
2737
- Build support for `empty:` is now handled by r.js 2.0 natively.
2838

29-
# v0.8.2
39+
### v0.8.2
3040

3141
- Fix for `requirejs_include_tag` error when `config/requirejs.yml` has no
3242
`paths` key. Thanks to @JustinLove for the issue and failing test!
3343

34-
# v0.8.0
44+
### v0.8.0
3545

3646
- Build will now substitute `empty:` for the right-hand side of
3747
`config/requirejs.yml` paths entries that are URLs.
3848
- Documented how to configure assets hosted on a CDN.
3949

40-
# v0.7.3
50+
### v0.7.3
4151

4252
- Upgrade RequireJS and r.js to v1.0.8
4353

44-
# v0.7.2
54+
### v0.7.2
4555

4656
- Add require.js to config.assets.precompile in all environments. Closes #45.
4757
This change allows builds to work in Rails environments other than
4858
'production', e.g. 'staging'. Thanks to @hollow for the fix.
4959

50-
# v0.7.1
60+
### v0.7.1
5161

5262
- Liberalize asset path filtering. `0.7.0` added filtering on the logical
5363
asset path which was too aggressive in that only `.js` files were allowed in
5464
builds. The RequireJS config variable `logical_asset_filter` has been
5565
added, which allows `.js`, `.html`, `.txt` files by default and is user
5666
configurable.
5767

58-
# v0.7.0
68+
### v0.7.0
5969

6070
- Support for [almond](https://github.com/jrburke/almond) via
6171
`config.requirejs.loader = :almond` in application.rb.
@@ -66,11 +76,11 @@ Marked Style: GitHub
6676
leverage the asset pipeline for their needs. Thanks to @hollow for the
6777
patch.
6878

69-
# v0.6.1
79+
### v0.6.1
7080

7181
- Fix regression in production env when `paths` specified in requirejs.yml.
7282

73-
# v0.6.0
83+
### v0.6.0
7484

7585
**NOTE:** Upgrade to 0.6.1! This was yanked due to a regression.
7686

@@ -80,30 +90,30 @@ Marked Style: GitHub
8090
tag via `requirejs_include_tag`. See [README](README.md) for details. Closes
8191
pull request #32; thanks to @hollow for the submission!
8292

83-
# v0.5.6
93+
### v0.5.6
8494

8595
- Upgrade to RequireJS and r.js 1.0.7
8696

87-
# v0.5.5
97+
### v0.5.5
8898

8999
- Support for Rails 3.2.x. Rails 3.1.x is also supported by this release.
90100

91-
# v0.5.4
101+
### v0.5.4
92102

93103
- Upgrade to RequireJS and r.js 1.0.5
94104
- Pull request #31, closes #30. Thanks @karelim!
95105

96-
# v0.5.3
106+
### v0.5.3
97107

98108
- Upgrade to RequireJS and r.js 1.0.4
99109
- Pulled #22, fix for asset compliation failure with no config/requirejs.yml.
100110
Thanks @arehberg!
101111

102-
# v0.5.2
112+
### v0.5.2
103113

104114
- Upgrade to RequireJS and r.js 1.0.3
105115

106-
# v0.5.1
116+
### v0.5.1
107117

108118
- This is a quick turn to fix an issue that could trigger an Anonymous mismatched define() error from require.js and/or r.js.
109119

@@ -121,21 +131,20 @@ Marked Style: GitHub
121131
122132
Thanks to Andrew de Andrade for the catch.
123133
124-
# v0.5.0
134+
### v0.5.0
125135
126136
- Precompilation via `rake assets:precompile` is now implemented.
127137
- gem configuration via application.js is deprecated.
128138
- Application-specific require.js configuration lives in `config/requirejs.yml`.
129139
- See [README](README.md) for updated usage details.
130140
131-
# v0.0.2
141+
### v0.0.2
132142
133143
- Fixed stupid problems with Rails::Engine instantiation.
134144
- Test improvements
135145
- Upgrade to RequireJS 1.0.2
136146
137-
# v0.0.1
147+
### v0.0.1
138148
139149
- Birthday!
140150
- This gem makes `require.js` and the `order.js` plugin available to the Rails 3 Asset Pipeline.
141-

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
requirejs-rails (0.9.4)
4+
requirejs-rails (0.9.5)
55
railties (>= 3.1.1)
66

77
GEM

bin/r.js

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @license r.js 2.1.14 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
2+
* @license r.js 2.1.15 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
33
* Available via the MIT or new BSD license.
44
* see: http://github.com/jrburke/requirejs for details
55
*/
@@ -20,7 +20,7 @@ var requirejs, require, define, xpcUtil;
2020
(function (console, args, readFileFunc) {
2121
var fileName, env, fs, vm, path, exec, rhinoContext, dir, nodeRequire,
2222
nodeDefine, exists, reqMain, loadedOptimizedLib, existsForNode, Cc, Ci,
23-
version = '2.1.14',
23+
version = '2.1.15',
2424
jsSuffixRegExp = /\.js$/,
2525
commandOption = '',
2626
useLibLoaded = {},
@@ -238,7 +238,7 @@ var requirejs, require, define, xpcUtil;
238238
}
239239

240240
/** vim: et:ts=4:sw=4:sts=4
241-
* @license RequireJS 2.1.14 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
241+
* @license RequireJS 2.1.15 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
242242
* Available via the MIT or new BSD license.
243243
* see: http://github.com/jrburke/requirejs for details
244244
*/
@@ -251,7 +251,7 @@ var requirejs, require, define, xpcUtil;
251251
(function (global) {
252252
var req, s, head, baseElement, dataMain, src,
253253
interactiveScript, currentlyAddingScript, mainScript, subPath,
254-
version = '2.1.14',
254+
version = '2.1.15',
255255
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
256256
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
257257
jsSuffixRegExp = /\.js$/,
@@ -22949,7 +22949,7 @@ define('parse', ['./esprimaAdapter', 'lang'], function (esprima, lang) {
2294922949
//Like traverse, but skips if branches that would not be processed
2295022950
//after has application that results in tests of true or false boolean
2295122951
//literal values.
22952-
var key, child, result, i, params, param,
22952+
var key, child, result, i, params, param, tempObject,
2295322953
hasHas = options && options.has;
2295422954

2295522955
fnExpScope = fnExpScope || emptyScope;
@@ -22979,23 +22979,23 @@ define('parse', ['./esprimaAdapter', 'lang'], function (esprima, lang) {
2297922979

2298022980
//Build up a "scope" object that informs nested recurse calls if
2298122981
//the define call references an identifier that is likely a UMD
22982-
//wrapped function expresion argument.
22982+
//wrapped function expression argument.
2298322983
if (object.type === 'ExpressionStatement' && object.expression &&
2298422984
object.expression.type === 'CallExpression' && object.expression.callee &&
2298522985
object.expression.callee.type === 'FunctionExpression') {
22986-
object = object.expression.callee;
22987-
22988-
if (object.params && object.params.length) {
22989-
params = object.params;
22990-
fnExpScope = mixin({}, fnExpScope, true);
22991-
for (i = 0; i < params.length; i++) {
22992-
param = params[i];
22993-
if (param.type === 'Identifier') {
22994-
fnExpScope[param.name] = true;
22995-
}
22986+
tempObject = object.expression.callee;
22987+
22988+
if (tempObject.params && tempObject.params.length) {
22989+
params = tempObject.params;
22990+
fnExpScope = mixin({}, fnExpScope, true);
22991+
for (i = 0; i < params.length; i++) {
22992+
param = params[i];
22993+
if (param.type === 'Identifier') {
22994+
fnExpScope[param.name] = true;
2299622995
}
2299722996
}
2299822997
}
22998+
}
2299922999

2300023000
for (key in object) {
2300123001
if (object.hasOwnProperty(key)) {
@@ -23014,12 +23014,12 @@ define('parse', ['./esprimaAdapter', 'lang'], function (esprima, lang) {
2301423014
//wrapping.
2301523015
if (typeof result === 'string') {
2301623016
if (hasProp(fnExpScope, result)) {
23017-
//Just a plain return, parsing can continue past this
23018-
//point.
23019-
return;
23017+
//result still in scope, keep jumping out indicating the
23018+
//identifier still in use.
23019+
return result;
2302023020
}
2302123021

23022-
return result;
23022+
return;
2302323023
}
2302423024
}
2302523025
};
@@ -26539,7 +26539,8 @@ define('build', function (require) {
2653926539
"excludeShallow": true,
2654026540
"insertRequire": true,
2654126541
"stubModules": true,
26542-
"deps": true
26542+
"deps": true,
26543+
"mainConfigFile": true
2654326544
};
2654426545

2654526546
for (i = 0; i < ary.length; i++) {

lib/requirejs/rails/version.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Requirejs
22
module Rails
3-
Version = "0.9.4"
4-
LibVersion = "2.1.14"
3+
Version = "0.9.5"
4+
LibVersion = "2.1.15"
55
end
66
end

vendor/assets/javascripts/almond.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
2+
* @license almond 0.3.0 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
33
* Available via the MIT or new BSD license.
44
* see: http://github.com/jrburke/almond for details
55
*/
@@ -150,7 +150,15 @@ var requirejs, require, define;
150150
//A version of a require function that passes a moduleName
151151
//value for items that may need to
152152
//look up paths relative to the moduleName
153-
return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync]));
153+
var args = aps.call(arguments, 0);
154+
155+
//If first arg is not require('string'), and there is only
156+
//one arg, it is the array form without a callback. Insert
157+
//a null so that the following concat is correct.
158+
if (typeof args[0] !== 'string' && args.length === 1) {
159+
args.push(null);
160+
}
161+
return req.apply(undef, args.concat([relName, forceSync]));
154162
};
155163
}
156164

vendor/assets/javascripts/require.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** vim: et:ts=4:sw=4:sts=4
2-
* @license RequireJS 2.1.14 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
2+
* @license RequireJS 2.1.15 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
33
* Available via the MIT or new BSD license.
44
* see: http://github.com/jrburke/requirejs for details
55
*/
@@ -12,7 +12,7 @@ var requirejs, require, define;
1212
(function (global) {
1313
var req, s, head, baseElement, dataMain, src,
1414
interactiveScript, currentlyAddingScript, mainScript, subPath,
15-
version = '2.1.14',
15+
version = '2.1.15',
1616
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
1717
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
1818
jsSuffixRegExp = /\.js$/,

0 commit comments

Comments
 (0)