modulejs-rails 1.9.0.1 → 2.2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c14e6cccafeecc903bdc35e560eda5e08b52978
4
- data.tar.gz: d75aaa044ea61834726c9d9b68ec6d6e98bb3733
3
+ metadata.gz: 35545facebf8faef1869c5cf31eb209e0abaac96
4
+ data.tar.gz: 3600367b3ce6510961e86ec28693186b64b31213
5
5
  SHA512:
6
- metadata.gz: 02a045af537fe95152f30d07a35bcbea50326a1fcc8fc9164445b8fe6e3e0bdbd31f2b08035cc9b873804e1ffbc014f56d69187978aa407f8291eb17880fd5f8
7
- data.tar.gz: ff9ba19fae7844e761bb072a541c942376839756fe74698531df583ed58a5a01ccdc38cbd392dcc43a444e69e5dbd621bc63edd07b1a391abf3f1e56c4a4d3d9
6
+ metadata.gz: dd657a34387378a3e63430634b44940eb72a564087fd319995e7b38bc4e54eb9d29d9fb01a529caa9c8d3b23c733e2c9f1823355add4236465b8f950b567c830
7
+ data.tar.gz: dc50dbd9b224e1d392e3b3afe073c47623d3d47045c593bd6042d09dc099eee5329ac41416946a1c903bab0830247c8dc79319eb1936d83767d7eac63ad27934
@@ -1,5 +1,5 @@
1
1
  module Modulejs
2
2
  module Rails
3
- VERSION = "1.9.0.1"
3
+ VERSION = "2.2.0.0"
4
4
  end
5
5
  end
@@ -1,245 +1,260 @@
1
- /* modulejs 1.9.0 - http://larsjung.de/modulejs/ */
2
- (function (root, factory) {
3
- 'use strict';
4
-
5
- // istanbul ignore else
6
- if (typeof exports === 'object') {
7
- module.exports = factory();
8
- } else {
9
- root.modulejs = factory();
10
- }
11
-
12
- }(this, function () {
13
- 'use strict';
14
-
15
- var OBJ_PROTO = Object.prototype;
16
-
17
- // Returns a function that returns `true` if `x` is of the correct
18
- // `type`, otherwise `false`.
19
- function _create_is_x_fn(type) {
20
- return function (x) {
21
- return OBJ_PROTO.toString.call(x) === '[object ' + type + ']';
22
- };
23
- }
24
-
25
- // Type checking functions.
26
- var isArray = _create_is_x_fn('Array');
27
- var isFunction = _create_is_x_fn('Function');
28
- var isString = _create_is_x_fn('String');
29
-
30
- // Short cut for `hasOwnProperty`.
31
- function has(x, id) {
32
- return x !== undefined && x !== null && OBJ_PROTO.hasOwnProperty.call(x, id);
33
- }
34
-
35
- // Iterates over all elements af an array or all own keys of an object.
36
- function each(x, fn) {
37
- if (x && x.length) {
38
- for (var i = 0, l = x.length; i < l; i += 1) {
39
- fn(x[i], i, x);
40
- }
41
- } else {
42
- for (var k in x) {
43
- if (has(x, k)) {
44
- fn(x[k], k, x);
45
- }
46
- }
47
- }
48
- }
49
-
50
- // Returns `true` if `x` contains `val`, otherwise `false`.
51
- function contains(x, val) {
52
- if (x && x.length) {
53
- for (var i = 0, l = x.length; i < l; i += 1) {
54
- if (x[i] === val) {
55
- return true;
56
- }
57
- }
58
- }
59
- return false;
60
- }
61
-
62
- // Returns an new array containing no duplicates. Preserves first
63
- // occurence and order.
64
- function uniq(x) {
65
- var result = [];
66
- each(x, function (val) {
67
- if (!contains(result, val)) {
68
- result.push(val);
69
- }
70
- });
71
- return result;
72
- }
73
-
74
- // Throws an error if `expression` is falsy.
75
- function assert(expression, message) {
76
- if (!expression) {
77
- throw new Error('[modulejs] ' + message);
78
- }
79
- }
80
-
81
- function create() {
82
- // Module definitions.
83
- var definitions = {};
84
-
85
- // Module instances.
86
- var instances = {};
87
-
88
- // Resolves `id` to an object. If `mixed` is `true` only returns
89
- // dependency-IDs. If `mixed` is an object it is used instead of the
90
- // already memorized `instances` to allow mock-dependencies. `stack`
91
- // is used internal to check for circular dependencies.
92
- function resolve(id, mixed, stack) {
93
-
94
- // check arguments
95
- assert(isString(id), 'id must be string: ' + id);
96
- var onlyDepIds = mixed === true;
97
- var resolvedInstances = (onlyDepIds ? undefined : mixed) || instances;
98
-
99
- // if a module is required that was already created return that
100
- // object
101
- if (!onlyDepIds && has(resolvedInstances, id)) {
102
- return resolvedInstances[id];
103
- }
104
-
105
- // check if `id` is defined
106
- var def = definitions[id];
107
- assert(def, 'id not defined: ' + id);
108
-
109
- // copy resolve stack and add this `id`
110
- stack = (stack || []).slice();
111
- stack.push(id);
112
-
113
- // if `onlyDepIds` this will hold the dependency-IDs, otherwise it
114
- // will hold the dependency-objects
115
- var deps = [];
116
-
117
- each(def.deps, function (depId) {
118
-
119
- // check for circular dependencies
120
- assert(!contains(stack, depId), 'circular dependencies: ' + depId + ' in ' + stack);
121
-
122
- if (onlyDepIds) {
123
- deps = deps.concat(resolve(depId, mixed, stack));
124
- deps.push(depId);
125
- } else {
126
- deps.push(resolve(depId, mixed, stack));
127
- }
128
- });
129
-
130
- // if `onlyDepIds` return only dependency-ids in right order
131
- if (onlyDepIds) {
132
- return uniq(deps);
133
- }
134
-
135
- // create, memorize and return object
136
- var obj = def.fn.apply(undefined, deps);
137
- resolvedInstances[id] = obj;
138
- return obj;
139
- }
140
-
141
- // Defines a module for `id: String`, optional `deps: Array[String]`,
142
- // `def: mixed`.
143
- function define(id, deps, def) {
144
-
145
- // sort arguments
146
- if (arguments.length < 3) {
147
- def = deps;
148
- deps = [];
149
- }
150
- // check arguments
151
- assert(isString(id), 'id must be string: ' + id);
152
- assert(!has(definitions, id), 'id already defined: ' + id);
153
- assert(isArray(deps), 'deps must be array: ' + id);
154
-
155
- // accept definition
156
- definitions[id] = {
157
- id: id,
158
- deps: deps,
159
- fn: isFunction(def) ? def : function () { return def; }
160
- };
161
- }
162
-
163
- // Returns an instance for `id`. If a `mocks` object is given, it is
164
- // used to resolve the dependencies.
165
- function require(id, mocks) {
166
-
167
- return resolve(id, mocks);
168
- }
169
-
170
- // Returns an object that holds infos about the current definitions
171
- // and dependencies.
172
- function state() {
173
-
174
- var res = {};
175
-
176
- each(definitions, function (def, id) {
177
-
178
- res[id] = {
179
-
180
- // direct dependencies
181
- deps: def.deps.slice(),
182
-
183
- // transitive dependencies
184
- reqs: resolve(id, true),
185
-
186
- // already initiated/required
187
- init: has(instances, id)
188
- };
189
- });
190
-
191
- each(definitions, function (def, id) {
192
-
193
- var inv = [];
194
- each(definitions, function (def2, id2) {
195
-
196
- if (contains(res[id2].reqs, id)) {
197
- inv.push(id2);
198
- }
199
- });
200
-
201
- // all inverse dependencies
202
- res[id].reqd = inv;
203
- });
204
-
205
- return res;
206
- }
207
-
208
- // Returns a string that displays module dependencies.
209
- function log(inv) {
210
-
211
- var out = '\n';
212
-
213
- each(state(), function (st, id) {
214
-
215
- var list = inv ? st.reqd : st.reqs;
216
- out += (st.init ? '* ' : ' ') + id + ' -> [ ' + list.join(', ') + ' ]\n';
217
- });
218
-
219
- return out;
220
- }
221
-
222
- return {
223
- create: create,
224
- define: define,
225
- log: log,
226
- require: require,
227
- state: state,
228
- _private: {
229
- assert: assert,
230
- contains: contains,
231
- definitions: definitions,
232
- each: each,
233
- has: has,
234
- instances: instances,
235
- isArray: isArray,
236
- isFunction: isFunction,
237
- isString: isString,
238
- resolve: resolve,
239
- uniq: uniq
240
- }
241
- };
242
- }
243
-
244
- return create();
245
- }));
1
+ /*! modulejs v2.2.0 - https://larsjung.de/modulejs/ */
2
+ (function webpackUniversalModuleDefinition(root, factory) {
3
+ if(typeof exports === 'object' && typeof module === 'object')
4
+ module.exports = factory();
5
+ else if(typeof define === 'function' && define.amd)
6
+ define([], factory);
7
+ else if(typeof exports === 'object')
8
+ exports["modulejs"] = factory();
9
+ else
10
+ root["modulejs"] = factory();
11
+ })(this, function() {
12
+ return /******/ (function(modules) { // webpackBootstrap
13
+ /******/ // The module cache
14
+ /******/ var installedModules = {};
15
+
16
+ /******/ // The require function
17
+ /******/ function __webpack_require__(moduleId) {
18
+
19
+ /******/ // Check if module is in cache
20
+ /******/ if(installedModules[moduleId])
21
+ /******/ return installedModules[moduleId].exports;
22
+
23
+ /******/ // Create a new module (and put it into the cache)
24
+ /******/ var module = installedModules[moduleId] = {
25
+ /******/ exports: {},
26
+ /******/ id: moduleId,
27
+ /******/ loaded: false
28
+ /******/ };
29
+
30
+ /******/ // Execute the module function
31
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
32
+
33
+ /******/ // Flag the module as loaded
34
+ /******/ module.loaded = true;
35
+
36
+ /******/ // Return the exports of the module
37
+ /******/ return module.exports;
38
+ /******/ }
39
+
40
+
41
+ /******/ // expose the modules object (__webpack_modules__)
42
+ /******/ __webpack_require__.m = modules;
43
+
44
+ /******/ // expose the module cache
45
+ /******/ __webpack_require__.c = installedModules;
46
+
47
+ /******/ // __webpack_public_path__
48
+ /******/ __webpack_require__.p = "";
49
+
50
+ /******/ // Load entry module and return exports
51
+ /******/ return __webpack_require__(0);
52
+ /******/ })
53
+ /************************************************************************/
54
+ /******/ ([
55
+ /* 0 */
56
+ /***/ function(module, exports, __webpack_require__) {
57
+
58
+ 'use strict';
59
+
60
+ var _require = __webpack_require__(1),
61
+ assert = _require.assert,
62
+ forOwn = _require.forOwn,
63
+ has = _require.has,
64
+ resolve = _require.resolve;
65
+
66
+ var create = function create() {
67
+ // Module definitions.
68
+ var definitions = {};
69
+
70
+ // Module instances.
71
+ var instances = {};
72
+
73
+ // Defines a module for `id: String`, optional `deps: Array[String]`,
74
+ // `def: mixed`.
75
+ var define = function define(id, deps, def) {
76
+ // sort arguments
77
+ if (def === undefined) {
78
+ var _ref = [[], deps];
79
+ deps = _ref[0];
80
+ def = _ref[1];
81
+ }
82
+ // check arguments
83
+ assert(typeof id === 'string', 'id must be string: ' + id);
84
+ assert(!has(definitions, id), 'id already defined: ' + id);
85
+ assert(Array.isArray(deps), 'deps must be array: ' + id);
86
+
87
+ // accept definition
88
+ definitions[id] = {
89
+ id: id,
90
+ deps: deps,
91
+ fn: typeof def === 'function' ? def : function () {
92
+ return def;
93
+ }
94
+ };
95
+ };
96
+
97
+ // Returns an instance for `id`. If a `mocks` object is given, it is
98
+ // used to resolve the dependencies.
99
+ var require = function require(id, mocks) {
100
+ assert(typeof id === 'string', 'id must be string: ' + id);
101
+ return resolve(definitions, mocks || instances, id);
102
+ };
103
+
104
+ // Returns an object that holds infos about the current definitions
105
+ // and dependencies.
106
+ var state = function state() {
107
+ var res = {};
108
+
109
+ forOwn(definitions, function (def, id) {
110
+ res[id] = {
111
+
112
+ // direct dependencies
113
+ deps: def.deps.slice(),
114
+
115
+ // transitive dependencies
116
+ reqs: resolve(definitions, null, id),
117
+
118
+ // already initiated/required
119
+ init: has(instances, id)
120
+ };
121
+ });
122
+
123
+ forOwn(definitions, function (def, id) {
124
+ var inv = [];
125
+
126
+ forOwn(definitions, function (def2, id2) {
127
+ if (res[id2].reqs.indexOf(id) >= 0) {
128
+ inv.push(id2);
129
+ }
130
+ });
131
+
132
+ // all inverse dependencies
133
+ res[id].reqd = inv;
134
+ });
135
+
136
+ return res;
137
+ };
138
+
139
+ // Returns a string that displays module dependencies.
140
+ var log = function log(inv) {
141
+ var out = '\n';
142
+
143
+ forOwn(state(), function (st, id) {
144
+ var list = inv ? st.reqd : st.reqs;
145
+ out += (st.init ? '*' : ' ') + ' ' + id + ' -> [ ' + list.join(', ') + ' ]\n';
146
+ });
147
+
148
+ return out;
149
+ };
150
+
151
+ return {
152
+ create: create,
153
+ define: define,
154
+ log: log,
155
+ require: require,
156
+ state: state,
157
+ _d: definitions,
158
+ _i: instances
159
+ };
160
+ };
161
+
162
+ module.exports = create();
163
+
164
+ /***/ },
165
+ /* 1 */
166
+ /***/ function(module, exports) {
167
+
168
+ "use strict";
169
+
170
+ // Throws an error if `expr` is falsy.
171
+ var assert = function assert(expr, msg) {
172
+ if (!expr) {
173
+ throw new Error("[modulejs] " + msg);
174
+ }
175
+ };
176
+
177
+ // Iterates over all own props of an object.
178
+ var forOwn = function forOwn(x, fn) {
179
+ Object.keys(x).forEach(function (k) {
180
+ return fn(x[k], k);
181
+ });
182
+ };
183
+
184
+ // Short cut for `hasOwnProperty`.
185
+ var has = function has(x, id) {
186
+ return (x || {}).hasOwnProperty(id);
187
+ };
188
+
189
+ // Returns an new array containing no duplicates. Preserves first occurence and
190
+ // order.
191
+ var uniq = function uniq(x) {
192
+ var cache = {};
193
+ return x.filter(function (val) {
194
+ var res = !cache[val];
195
+ cache[val] = 1;
196
+ return res;
197
+ });
198
+ };
199
+
200
+ // Resolves `id` to an object for the given definitions `defs` and already
201
+ // instantiated objects `insts`. Adds any new instances to `insts`. If `insts`
202
+ // is null it only resolves dependency IDs.
203
+ // `stack` is used internal to check for circular dependencies.
204
+ var resolve = function resolve(defs, insts, id, stack) {
205
+ var onlyDepIds = !insts;
206
+
207
+ // if a module is required that was already created return that object
208
+ if (!onlyDepIds && has(insts, id)) {
209
+ return insts[id];
210
+ }
211
+
212
+ // check if `id` is defined
213
+ var def = defs[id];
214
+ assert(def, "id not defined: " + id);
215
+
216
+ // copy resolve stack and add this `id`
217
+ stack = (stack || []).slice();
218
+ stack.push(id);
219
+
220
+ // if `onlyDepIds` this will hold the dependency-IDs, otherwise it
221
+ // will hold the dependency-objects
222
+ var deps = [];
223
+
224
+ def.deps.forEach(function (depId) {
225
+ // check for circular dependencies
226
+ assert(stack.indexOf(depId) < 0, "circular dependencies: " + depId + " in " + stack);
227
+
228
+ var depDeps = resolve(defs, insts, depId, stack);
229
+ if (onlyDepIds) {
230
+ deps = deps.concat(depDeps);
231
+ deps.push(depId);
232
+ } else {
233
+ deps.push(depDeps);
234
+ }
235
+ });
236
+
237
+ if (onlyDepIds) {
238
+ // return only dependency-ids in correct order
239
+ return uniq(deps);
240
+ }
241
+
242
+ // create, memorize and return object
243
+ // using def.fn(...deps) instead would cost ~120B uglified
244
+ var obj = def.fn.apply(undefined, deps);
245
+ insts[id] = obj;
246
+ return obj;
247
+ };
248
+
249
+ module.exports = {
250
+ assert: assert,
251
+ forOwn: forOwn,
252
+ has: has,
253
+ resolve: resolve,
254
+ uniq: uniq
255
+ };
256
+
257
+ /***/ }
258
+ /******/ ])
259
+ });
260
+ ;
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modulejs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0.1
4
+ version: 2.2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ales Vilchytski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-21 00:00:00.000000000 Z
11
+ date: 2017-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: railties
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '4.0'
20
14
  requirement: !ruby/object:Gem::Requirement
21
15
  requirements:
22
- - - '>='
16
+ - - ">="
23
17
  - !ruby/object:Gem::Version
24
18
  version: '4.0'
19
+ name: railties
25
20
  prerelease: false
26
21
  type: :runtime
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
29
22
  version_requirements: !ruby/object:Gem::Requirement
30
23
  requirements:
31
- - - ~>
24
+ - - ">="
32
25
  - !ruby/object:Gem::Version
33
- version: '1.7'
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
34
28
  requirement: !ruby/object:Gem::Requirement
35
29
  requirements:
36
- - - ~>
30
+ - - "~>"
37
31
  - !ruby/object:Gem::Version
38
32
  version: '1.7'
33
+ name: bundler
39
34
  prerelease: false
40
35
  type: :development
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
36
  version_requirements: !ruby/object:Gem::Requirement
44
37
  requirements:
45
- - - ~>
38
+ - - "~>"
46
39
  - !ruby/object:Gem::Version
47
- version: '10.0'
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
48
42
  requirement: !ruby/object:Gem::Requirement
49
43
  requirements:
50
- - - ~>
44
+ - - "~>"
51
45
  - !ruby/object:Gem::Version
52
46
  version: '10.0'
47
+ name: rake
53
48
  prerelease: false
54
49
  type: :development
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
55
  description: JS module system for Ruby on Rails 4 Assets Pipeline that solves scripts order issues
56
56
  email:
57
57
  - vilchytski.ales@yandex.by
@@ -59,7 +59,7 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
62
+ - ".gitignore"
63
63
  - Gemfile
64
64
  - LICENSE
65
65
  - README.md
@@ -80,17 +80,17 @@ require_paths:
80
80
  - lib
81
81
  required_ruby_version: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - '>='
83
+ - - ">="
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '>='
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  requirements: []
92
92
  rubyforge_project:
93
- rubygems_version: 2.1.9
93
+ rubygems_version: 2.4.8
94
94
  signing_key:
95
95
  specification_version: 4
96
96
  summary: Lightweight JavaScript module system for Ruby on Rails 4