jspm 0.17.0-beta.45 → 0.17.0-beta.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/.DS_Store ADDED
Binary file
package/lib/.DS_Store ADDED
Binary file
package/lib/install.js CHANGED
@@ -499,12 +499,25 @@ function install(name, target, options, seen) {
499
499
  options.peer = true;
500
500
  }
501
501
 
502
+ function replaceDependency(dependencies, name, newPackage) {
503
+ var existingDependency = dependencies[name];
504
+ if (!existingDependency) { //No existing dependency
505
+ dependencies[name] = newPackage;
506
+ } else { //Enforce maximum compatibility version
507
+ var existingMinVersion = semver.rangeToMinSemver(existingDependency.version);
508
+ var matches = semver.match(newPackage.version, existingMinVersion);
509
+ if (!matches) { //Need to update because current min version would not match the criteria set by this package
510
+ dependencies[name] = newPackage;
511
+ }
512
+ }
513
+ }
514
+
502
515
  if (options.peer)
503
- config.pjson.peerDependencies[name] = primaryRanges[name];
516
+ replaceDependency(config.pjson.peerDependencies, name, primaryRanges[name]);
504
517
  else if (options.dev)
505
- config.pjson.devDependencies[name] = primaryRanges[name];
518
+ replaceDependency(config.pjson.devDependencies, name, primaryRanges[name]);
506
519
  else
507
- config.pjson.dependencies[name] = primaryRanges[name];
520
+ replaceDependency(config.pjson.dependencies, name, primaryRanges[name]);
508
521
 
509
522
  // remove any alternative installs of this dependency
510
523
  if (!options.dev)
@@ -1017,20 +1030,25 @@ function showInstallGraph(pkg) {
1017
1030
  ui.log('info', '\nInstalled versions of %' + pkg.name + '%');
1018
1031
  visitForkRanges(installed, pkg, null, null, function(name, parent, resolved, range) {
1019
1032
  found = true;
1020
- if (range.version === '')
1021
- range.version = '*';
1022
- var rangeVersion = range.name === resolved.name ? range.version : range.exactName;
1023
- if (range.version === '*')
1024
- range.version = '';
1025
-
1026
- if (!parent)
1027
- ui.log('info', '\n %' + name + '% `' + resolved.version + '` (' + rangeVersion + ')');
1033
+ var rangeVersion;
1034
+ if (range) {
1035
+ if (range.version === '') {
1036
+ range.version = '*';
1037
+ }
1038
+ rangeVersion = range.name === resolved.name ? range.version : range.exactName;
1039
+ if (range.version === '*') {
1040
+ range.version = '';
1041
+ }
1042
+ }
1043
+ if (!parent) {
1044
+ ui.log('info', '\n %' + name + '% `' + resolved.version + '`' + (range ? ' (' + rangeVersion + ')' : ''));
1045
+ }
1028
1046
  else {
1029
1047
  if (lastParent !== parent) {
1030
1048
  ui.log('info', '\n ' + parent);
1031
1049
  lastParent = parent;
1032
1050
  }
1033
- ui.log('info', ' ' + name + ' `' + resolved.version + '` (' + rangeVersion + ')');
1051
+ ui.log('info', ' ' + name + ' `' + resolved.version + '`' + (range ? ' (' + rangeVersion + ')' : ''));
1034
1052
  }
1035
1053
  });
1036
1054
  if (!found)
package/lib/semver.js CHANGED
@@ -190,6 +190,11 @@ function parseRange(range) {
190
190
 
191
191
  exports.semverRegEx = semverRegEx;
192
192
 
193
+ exports.rangeToMinSemver = function(r) {
194
+ var parsed = parseRange(r).version;
195
+ return parsed.major + '.' + parsed.minor + '.' + parsed.patch;
196
+ };
197
+
193
198
  exports.compare = function(v1, v2) {
194
199
  return semverCompareParsed(parseSemver(v1), parseSemver(v2));
195
200
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jspm",
3
3
  "description": "Registry and format agnostic JavaScript package manager",
4
- "version": "0.17.0-beta.45",
4
+ "version": "0.17.0-beta.49",
5
5
  "main": "./api.js",
6
6
  "author": "",
7
7
  "dependencies": {
@@ -22,8 +22,8 @@
22
22
  "rimraf": "^2.4.4",
23
23
  "sane": "^1.3.3",
24
24
  "semver": "^5.1.0",
25
- "systemjs": "0.20.19",
26
- "systemjs-builder": "0.16.11",
25
+ "systemjs": "0.21.4",
26
+ "systemjs-builder": "0.16.13",
27
27
  "traceur": "0.0.105",
28
28
  "uglify-js": "^2.6.1"
29
29
  },
@@ -1,25 +0,0 @@
1
- # Logs
2
- logs
3
- *.log
4
-
5
- # Runtime data
6
- pids
7
- *.pid
8
- *.seed
9
-
10
- # Directory for instrumented libs generated by jscoverage/JSCover
11
- lib-cov
12
-
13
- # Coverage directory used by tools like istanbul
14
- coverage
15
-
16
- # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17
- .grunt
18
-
19
- # Compiled binary addons (http://nodejs.org/api/addons.html)
20
- build/Release
21
-
22
- # Dependency directory
23
- # Deployed apps should consider commenting this line out:
24
- # see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
25
- node_modules
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "{}"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright {yyyy} {name of copyright owner}
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
@@ -1,48 +0,0 @@
1
- Google Analytics tracking for GitBook
2
- ==============
3
-
4
- You can use install it via **NPM**:
5
-
6
- ```
7
- $ npm install gitbook-plugin-ga
8
- ```
9
-
10
- And use it for your book with in the book.json:
11
-
12
- ```
13
- {
14
- "plugins": ["ga"]
15
- }
16
- ```
17
-
18
- You can set the Google Analytics tracking ID using the plugins configuration in the book.json:
19
-
20
- ```
21
- {
22
- "plugins": ["ga"],
23
- "pluginsConfig": {
24
- "ga": {
25
- "token": "UA-XXXX-Y"
26
- }
27
- }
28
- }
29
- ```
30
-
31
- You can customize the tracker object by passing additional configuration options. You can either pass in `auto`, `none` or an object:
32
-
33
- ```
34
- {
35
- "plugins": ["ga"],
36
- "pluginsConfig": {
37
- "ga": {
38
- "token": "UA-XXXX-Y",
39
- "configuration": {
40
- "cookieName": "new_cookie_name",
41
- "cookieDomain": "mynew.domain.com"
42
- }
43
- }
44
- }
45
- }
46
- ```
47
-
48
- For an overview of all available configuration parameters, please refer to the [analytics.js field reference](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#create).
@@ -1,17 +0,0 @@
1
- require(["gitbook"], function(gitbook) {
2
- // Load analytics.js
3
- gitbook.events.bind("start", function(e, config) {
4
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
5
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
6
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
7
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
8
-
9
- var cfg = config.ga;
10
- ga('create', cfg.token, cfg.configuration);
11
- });
12
-
13
- // Notify pageview
14
- gitbook.events.bind("page.change", function() {
15
- ga('send', 'pageview', window.location.pathname+window.location.search);
16
- });
17
- });
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- book: {
3
- assets: "./book",
4
- js: [
5
- "plugin.js"
6
- ]
7
- }
8
- };
@@ -1,63 +0,0 @@
1
- {
2
- "name": "gitbook-plugin-ga",
3
- "description": "Google Analytics tracking for your gitbook",
4
- "main": "index.js",
5
- "version": "1.0.1",
6
- "engines": {
7
- "gitbook": ">=2.5.1"
8
- },
9
- "homepage": "https://github.com/GitbookIO/plugin-ga",
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/GitbookIO/plugin-ga.git"
13
- },
14
- "license": "Apache-2.0",
15
- "bugs": {
16
- "url": "https://github.com/GitbookIO/plugin-ga/issues"
17
- },
18
- "gitbook": {
19
- "properties": {
20
- "token": {
21
- "type": "string",
22
- "title": "Google Analytics Token",
23
- "required": true
24
- },
25
- "configuration": {
26
- "type": [
27
- "string",
28
- "object"
29
- ],
30
- "title": "Configuration mode",
31
- "default": "auto"
32
- }
33
- }
34
- },
35
- "gitHead": "ec1840f9c822ad5dfbdbb9190c2b051088df2271",
36
- "_id": "gitbook-plugin-ga@1.0.1",
37
- "scripts": {},
38
- "_shasum": "c85d7b8c01640c4bb3dc3b231ab9fe74aa6e521b",
39
- "_from": "gitbook-plugin-ga@1.0.1",
40
- "_npmVersion": "3.3.12",
41
- "_nodeVersion": "5.1.0",
42
- "_npmUser": {
43
- "name": "samypesse",
44
- "email": "samypesse@gmail.com"
45
- },
46
- "dist": {
47
- "shasum": "c85d7b8c01640c4bb3dc3b231ab9fe74aa6e521b",
48
- "tarball": "http://registry.npmjs.org/gitbook-plugin-ga/-/gitbook-plugin-ga-1.0.1.tgz"
49
- },
50
- "maintainers": [
51
- {
52
- "name": "samypesse",
53
- "email": "samypesse@gmail.com"
54
- },
55
- {
56
- "name": "aarono",
57
- "email": "aaron.omullan@gmail.com"
58
- }
59
- ],
60
- "directories": {},
61
- "_resolved": "https://registry.npmjs.org/gitbook-plugin-ga/-/gitbook-plugin-ga-1.0.1.tgz",
62
- "readme": "ERROR: No README data found!"
63
- }
@@ -1,10 +0,0 @@
1
- MIT License
2
- -----------
3
-
4
- Copyright (C) 2014-2016 Guy Bedford
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
-
8
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
-
10
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,356 +0,0 @@
1
- SystemJS Build Tool [![Build Status][travis-image]][travis-url] [![Support](https://supporterhq.com/api/b/33df4abbec4d39260f49015d2457eafe/SystemJS)](https://supporterhq.com/support/33df4abbec4d39260f49015d2457eafe/SystemJS)
2
- ===
3
-
4
- _[SystemJS Builder 0.15 release notes](https://github.com/systemjs/builder/releases/tag/0.15.0)_
5
-
6
- _As of SystemJS Builder 0.14, `builder.build` and `builder.buildTree` are both `builder.bundle`, while `builder.buildSFX` is now `builder.buildStatic`.
7
- The previous APIs will continue to work, but display deprecation warnings._
8
-
9
- _Note SystemJS Builder 0.11-0.14 correspond to the SystemJS 0.17+ releases which include the breaking change making module names URLs.
10
- Read the [SystemJS 0.17 release notes](https://github.com/systemjs/systemjs/releases/tag/0.17.0) for more information on this change._
11
-
12
- Provides a single-file build for SystemJS of mixed-dependency module trees.
13
-
14
- Builds ES6 into ES5, CommonJS, AMD and globals into a single file in a way that supports the CSP SystemJS loader
15
- as well as circular references.
16
-
17
- Example
18
- ---
19
-
20
- app.js
21
- ```javascript
22
- import $ from "./jquery.js";
23
- export var hello = 'es6';
24
- ```
25
-
26
- jquery.js
27
- ```javascript
28
- define(function() {
29
- return 'this is jquery';
30
- });
31
- ```
32
-
33
- Will build the module `app` into a bundle containing both `app` and `jquery` defined through `System.register` calls.
34
-
35
- Circular references and bindings in ES6, CommonJS and AMD all behave exactly as they should, including maintaining execution order.
36
-
37
- Documentation
38
- ---
39
- [API Reference] (docs/api.md)
40
-
41
- Usage
42
- ---
43
-
44
- ### Install
45
-
46
- ```javascript
47
- npm install systemjs-builder
48
- ```
49
-
50
- ### Basic Use
51
-
52
- Ensure that the transpiler is installed separately (`npm install babel-core` here).
53
-
54
- ```javascript
55
- var path = require("path");
56
- var Builder = require('systemjs-builder');
57
-
58
- // optional constructor options
59
- // sets the baseURL and loads the configuration file
60
- var builder = new Builder('path/to/baseURL', 'path/to/system/config-file.js');
61
-
62
- builder
63
- .bundle('local/module.js', 'outfile.js')
64
- .then(function() {
65
- console.log('Build complete');
66
- })
67
- .catch(function(err) {
68
- console.log('Build error');
69
- console.log(err);
70
- });
71
- ```
72
-
73
- ### Setting Configuration
74
-
75
- Configuration can be injected via `builder.config`:
76
-
77
- ```javascript
78
- builder.config({
79
- map: {
80
- 'a': 'b.js'
81
- }
82
- });
83
- builder.build('a');
84
- ```
85
-
86
- To load custom configuration files use `builder.loadConfig`:
87
-
88
- ```javascript
89
- // `builder.loadConfig` will load config from a file containing `System.config({...})`
90
- builder.loadConfig('./cfg.js')
91
- .then(function() {
92
- // ready to build
93
- });
94
- ```
95
-
96
- Multiple config calls can be run, which will combine into the loader configuration.
97
-
98
- #### Resetting Configuration
99
-
100
- To reset the loader state and configuration use `builder.reset()`.
101
-
102
- When config was passed into the `new Builder(baseURL, configFile)` constructor, the config will be reset to this exact `configFile` state.
103
-
104
- ### Self-Executing (SFX) Bundles
105
-
106
- To make a bundle that is independent of the SystemJS loader entirely, we can make SFX bundles:
107
-
108
- ```javascript
109
- builder.buildStatic('myModule.js', 'outfile.js', options);
110
- ```
111
-
112
- This bundle file can then be included with a `<script>` tag, and no other dependencies would need to be included in the page. You'll likely want your module
113
- to export a global variable when loaded from a script tag, and this can be configured via `globalName`. For example
114
-
115
- ```javascript
116
- builder.buildStatic('src/NavBar.js', 'dist/NavBarStaticBuild.js', {
117
- globalName: 'NavBar'
118
- });
119
- ```
120
-
121
- will cause the output of your module to be assigned to a global variable named `NavBar`. If you're making a static bundle, while excluding certain dependencies, those dependencies
122
- will of course need to have already been loaded on your page, with their own global variables exported. You can match these global variables up with your needed dependencies
123
- with `globalDeps`. For example
124
-
125
- ```javascript
126
- builder.buildStatic('src/NavBar.js - react', 'dist/NavBarStaticBuild.js', {
127
- globalName: 'NavBar',
128
- globalDeps: {
129
- 'react': 'React'
130
- }
131
- });
132
- ```
133
-
134
- will create a static build of NavBar—without React—which, when loaded via a script tag, exports an eponymous global variable, and assumes the existence of a React global variable, which will be used for the `react` dependency.
135
-
136
- This would support users with a setup of
137
-
138
- ```javascript
139
- <script src='path/to/react.min.js'></script>
140
- <script src='path/to/NavBarStaticBuild.js'></script>
141
- ```
142
-
143
- Note that another way of excluding `react` would be with `externals`.
144
-
145
- ```javascript
146
- builder.buildStatic('src/NavBar.js', 'dist/NavBarStaticBuild.js', {
147
- externals: ['react'],
148
- globalName: 'NavBar',
149
- globalDeps: {
150
- 'react': 'React'
151
- }
152
- });
153
- ```
154
-
155
- This would also exclude react but, if react defined any dependencies which NavBar *also* defined, those dependencies would be *included* in the build.
156
-
157
- Of course the above explanations involving `globalDeps` and `globalName` only apply to when your end user loads the static file from a script tag. Since the output is (by default, see below) UMD, a
158
- script loader like SystemJS or requireJS would process it as configured, or via AMD respectively.
159
-
160
- By default, the Traceur or Babel runtime are automatically included in the SFX bundle if needed. To exclude the Babel or Traceur runtime set the `runtime` build option to false:
161
-
162
- ```javascript
163
- builder.buildStatic('myModule.js', 'outfile.js', { runtime: false });
164
- ```
165
-
166
- #### SFX Format
167
-
168
- SFX bundles can also be output as a custom module format - `amd`, `cjs` or `es6` for consumption in different environments.
169
-
170
- This is handled via the `format` (previously `sfxFormat`) option:
171
-
172
- ```javascript
173
- builder.buildStatic('myModule.js', 'outfile.js', { format: 'cjs' });
174
- ```
175
-
176
- The first module used as input (`myModule.js` here) will then have its exports output as the CommonJS exports of the whole SFX bundle itself
177
- when run in a CommonJS environment.
178
-
179
- #### Adapter Modules
180
-
181
- To have globals like `jQuery` not included, and included in a separate script tag, set up an adapter module something like:
182
-
183
- jquery.js
184
- ```javascript
185
- module.exports = window.jQuery;
186
- ```
187
-
188
- ### Minification & Source Maps
189
-
190
- As well as an `options.config` parameter, it is also possible to specify minification and source maps options:
191
-
192
- ```javascript
193
- builder.bundle('myModule.js', 'outfile.js', { minify: true, sourceMaps: true, config: cfg });
194
- ```
195
-
196
- Compile time with source maps can also be improved with the `lowResSourceMaps` option, where the mapping granularity is per-line instead of per-character:
197
-
198
- ```javascript
199
- builder.bundle('myModule.js', 'outfile.js', { sourceMaps: true, lowResSourceMaps: true });
200
- ```
201
-
202
- #### Minification Options
203
-
204
- * `mangle`, defaults to true.
205
- * `globalDefs`, object allowing for global definition assignments for dead code removal.
206
-
207
- ```javascript
208
- builder.bundle('myModule.js', 'outfile.js', { minify: true, mangle: false, globalDefs: { DEBUG: false } });
209
- ```
210
-
211
- #### SourceMap Options
212
-
213
- * `sourceMaps`, Either boolean value (enable/disable) or string value `'inline'` which will inline the SourceMap data as Base64 data URI right in the generated output file (never use in production). *(Default is `false`)*
214
- * `sourceMapContents`, Boolean value that determines if original sources shall be directly included in the SourceMap. Using inline source contents generates truely self contained SourceMaps which will not need to load the external original source files during debugging. *(Default is `false`; when using `sourceMaps='inline'` it defaults `true`)*
215
-
216
-
217
- ### In-Memory Builds
218
-
219
- Leave out the `outFile` option to run an in-memory build:
220
-
221
- ```javascript
222
- builder.bundle('myModule.js', { minify: true }).then(function(output) {
223
- output.source; // generated bundle source
224
- output.sourceMap; // generated bundle source map
225
- output.modules; // array of module names defined in the bundle
226
- });
227
- ```
228
-
229
- The `output` object above is provided for all builds, including when `outFile` is set.
230
-
231
- `output.modules` can be used to directly populate SystemJS bundles configuration.
232
-
233
- ### Ignore Resources
234
-
235
- If loading resources that shouldn't even be traced as part of the build (say an external import), these
236
- can be configured with:
237
-
238
- ```javascript
239
- builder.config({
240
- meta: {
241
- 'resource/to/ignore.js': {
242
- build: false
243
- }
244
- }
245
- });
246
- ```
247
-
248
- ### Overriding Fetch
249
-
250
- The framework fetch function can be overridden in order to provide the source for a file manually. This is useful if you want to pre-process the source of a file before using the builder.
251
-
252
- ```javascript
253
- var mySource = 'import * from foo; var foo = "bar";'; // get source as a string
254
- builder.bundle('foo.js', {
255
- fetch: function (load, fetch) {
256
- if (load.name.indexOf('foo.js') !== -1) {
257
- return mySource;
258
- } else {
259
- // fall back to the normal fetch method
260
- return fetch(load);
261
- }
262
- }
263
- });
264
- ```
265
-
266
- The `load` variable describes the file that is trying to be loaded. This is called once for every file that is trying to be fetched, including dependencies.
267
-
268
- The `fetch` function should return a string.
269
-
270
- ### Bundle Arithmetic
271
-
272
- Both `builder.build` and `builder.buildStatic` support bundle arithmetic expressions. This allows for the easy construction of custom bundles.
273
-
274
- There is also a `builder.trace` for building direct trace tree objects, which can be directly passed into `builder.bundle` or `builder.buildStatic`.
275
-
276
- #### Example - Arithmetic Expressions
277
-
278
- In this example we build all our application code in `app/` excluding the tree `app/corelibs`:
279
-
280
- ```javascript
281
- var Builder = require('systemjs-builder');
282
-
283
- var builder = new Builder({
284
- baseURL: '...',
285
- map: {
286
- } // etc. config
287
- });
288
-
289
- builder.bundle('app/* - app/corelibs.js', 'output-file.js', { minify: true, sourceMaps: true });
290
- ```
291
-
292
- #### Example - Common Bundles
293
-
294
- To build the dependencies in common between two modules, use the `&` operator:
295
-
296
- ```javascript
297
- builder.bundle('app/page1.js & app/page2.js', 'common.js');
298
- ```
299
-
300
- We can then exclude this common bundle in future builds:
301
-
302
- ```javascript
303
- builder.bundle('app/componentA.js - common.js', { minify: true, sourceMaps: true });
304
- ```
305
-
306
- #### Example - Third-Party Dependency Bundles
307
-
308
- Build a bundle of all dependencies of the `app/` package excluding anything from `app/` itself.
309
-
310
- For this we can use the `[module]` syntax which represents a single module instead of all its dependencies as well:
311
-
312
- ```javascript
313
- builder.bundle('app/**/* - [app/**/*]', 'dependencies.js', { minify: true, sourceMaps: true });
314
- ```
315
-
316
- The above means _take the tree of app and all its dependencies, and subtract just the modules in app_, thus leaving us with just the tree of dependencies of the app package.
317
-
318
- #### Example - Multiple Common Bundles
319
-
320
- Parentheses are supported, so the following would bundle everything in common with `page1` and `page2`, and also everything in common between `page3` and `page4`:
321
-
322
- ```javascript
323
- builder.bundle('(app/page1.js & app/page2.js) + (app/page3.js & app/page4.js)', 'common.js');
324
- ```
325
-
326
- #### Example - Direct Trace API
327
-
328
- Instead of using the arithmetic syntax, we can construct the trace ourselves.
329
-
330
- In this example we build `app/first` and `app/second` into two separate bundles, while creating a separate shared bundle:
331
-
332
- ```javascript
333
- var Builder = require('systemjs-builder');
334
-
335
- var builder = new Builder({
336
- // ...
337
- });
338
-
339
- Promise.all([builder.trace('app/first.js'), builder.trace('app/second.js')])
340
- .then(function(trees) {
341
- var commonTree = builder.intersectTrees(trees[0], trees[1]);
342
- return Promise.all([
343
- builder.bundle(commonTree, 'shared-bundle.js'),
344
- builder.bundle(builder.subtractTrees(trees[0], commonTree), 'first-bundle.js'),
345
- builder.bundle(builder.subtractTrees(trees[1], commonTree), 'second-bundle.js')
346
- ]);
347
- });
348
- ```
349
-
350
- License
351
- ---
352
-
353
- MIT
354
-
355
- [travis-url]: https://travis-ci.org/systemjs/builder
356
- [travis-image]: https://travis-ci.org/systemjs/builder.svg?branch=master
@@ -1 +0,0 @@
1
- module.exports = require('./lib/builder');
@@ -1,73 +0,0 @@
1
- {
2
- "_from": "systemjs-builder@0.15",
3
- "_id": "systemjs-builder@0.15.36",
4
- "_inBundle": false,
5
- "_integrity": "sha1-MLAjctQifPN4gPWA/mfLTtt/FCA=",
6
- "_location": "/systemjs-builder",
7
- "_phantomChildren": {},
8
- "_requested": {
9
- "type": "range",
10
- "registry": true,
11
- "raw": "systemjs-builder@0.15",
12
- "name": "systemjs-builder",
13
- "escapedName": "systemjs-builder",
14
- "rawSpec": "0.15",
15
- "saveSpec": null,
16
- "fetchSpec": "0.15"
17
- },
18
- "_requiredBy": [
19
- "#USER",
20
- "/"
21
- ],
22
- "_resolved": "https://registry.npmjs.org/systemjs-builder/-/systemjs-builder-0.15.36.tgz",
23
- "_shasum": "30b02372d4227cf37880f580fe67cb4edb7f1420",
24
- "_spec": "systemjs-builder@0.15",
25
- "_where": "/Users/guybedford/Projects/test/npm",
26
- "author": "",
27
- "bugs": {
28
- "url": "https://github.com/systemjs/builder/issues"
29
- },
30
- "bundleDependencies": false,
31
- "dependencies": {
32
- "babel-core": "^6.9.0",
33
- "babel-plugin-transform-cjs-system-wrapper": "^0.3.0",
34
- "babel-plugin-transform-es2015-modules-systemjs": "^6.6.5",
35
- "babel-plugin-transform-global-system-wrapper": "0.0.1",
36
- "babel-plugin-transform-system-register": "0.0.1",
37
- "bluebird": "^3.3.4",
38
- "data-uri-to-buffer": "0.0.4",
39
- "es6-template-strings": "^2.0.0",
40
- "glob": "^7.0.3",
41
- "mkdirp": "^0.5.1",
42
- "rollup": "^0.36.3",
43
- "source-map": "^0.5.3",
44
- "systemjs": "^0.19.43",
45
- "traceur": "0.0.105",
46
- "uglify-js": "~2.7.5"
47
- },
48
- "deprecated": false,
49
- "description": "SystemJS Build Tool",
50
- "devDependencies": {
51
- "babel": "^5.8.38",
52
- "chai": "^3.0.0",
53
- "mocha": "^2.2.5",
54
- "mocha-phantomjs": "3.5.6",
55
- "phantomjs": "1.9.18",
56
- "systemjs-plugin-babel": "0.0.19",
57
- "typescript": "1.6.2",
58
- "unexpected": "^9.11.0"
59
- },
60
- "homepage": "https://github.com/systemjs/builder",
61
- "license": "MIT",
62
- "main": "index.js",
63
- "name": "systemjs-builder",
64
- "repository": {
65
- "type": "git",
66
- "url": "git+ssh://git@github.com/systemjs/builder.git"
67
- },
68
- "scripts": {
69
- "test": "mocha",
70
- "update-expectations": "UPDATE_EXPECTATIONS=1 mocha"
71
- },
72
- "version": "0.15.36"
73
- }