Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite in ES6 using webpack #511

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
b6a452e
Initial effort to rewrite in ES6 using webpack.
mikeric Aug 3, 2015
29d5b6a
Update build command in README.md.
mikeric Aug 3, 2015
0ea82d2
Fixed a couple of test (just a typo!)
benadamstyles Aug 3, 2015
d44ade0
Fixed another couple of failing specs
benadamstyles Aug 4, 2015
57f873c
Another fix (es6 arrow function dropping `this`)
benadamstyles Aug 4, 2015
4ff67e4
Fixed Functional spec `sightglass` reference
benadamstyles Aug 4, 2015
34cfb23
Fixed a whole load of formatter spec failures
benadamstyles Aug 4, 2015
9fb09e1
Fixed undefined binder priority
benadamstyles Aug 4, 2015
47757c5
Quick and dirty getting parseTemplate module into global scope so we …
benadamstyles Aug 14, 2015
45cdbb2
arrow function arguments fix
benadamstyles Aug 15, 2015
fbdabb2
All tests passing, fixes issue where the value binders prototype reci…
Aug 16, 2015
519b4ac
All tests passing, fixes issue where the value binders prototype reci…
Aug 16, 2015
738c38a
Merge branch 'es6' of https://github.com/mikeric/rivets into es6
Aug 16, 2015
0e160db
Added test for rv-each-* popping, and fix to pass test
benadamstyles Aug 21, 2015
a46ccb4
Moving the scope binding of a binders publish method upstream to the …
Sep 13, 2015
115b77d
fix: Undefined constant (missing import)
nopnop Sep 28, 2015
437dc3d
fix: Typo, model is undefined, use this.model
nopnop Sep 28, 2015
afe534a
fix: lastToken variable not in local scope
nopnop Sep 28, 2015
bd40124
Fix scope of `lastToken`
nopnop Oct 1, 2015
9ccfbab
Merge branch 'nopnop-fixUndefinedVariable' into es6
benadamstyles Oct 1, 2015
f4e6924
select-multiple bugfix
benadamstyles Nov 18, 2015
a0e34ec
Use textContent instead of innerText in spec
blikblum Dec 31, 2015
9760c25
Merge pull request #540 from blikblum/use-textcontent-in-tests
benadamstyles Jan 17, 2016
48afe7d
Don't use view.els.forEach to avoid exception when jquery is used
blikblum Jan 17, 2016
08cc3ee
Report regexp to split formatters. Fixed #432
Feb 1, 2016
0663dec
Missed a test in the reports
Feb 1, 2016
6328793
Report for 'Constant string in component HTML attributes #478'. New t…
Feb 1, 2016
bed4510
Fat arrow function simplification
Feb 3, 2016
06fab8d
Report on ES6 branch : generated index for nested rv-each. Docs included
Feb 3, 2016
8322d18
Merge pull request #562 from jccazeaux/fix/quoted_arguments_with_pipe…
benadamstyles Feb 4, 2016
c2153e6
Merge pull request #564 from jccazeaux/nested_rv_each_indexes_ES6
benadamstyles Feb 4, 2016
9381e97
Report Fix uncorrect '0' receive by binders if html attribute is not …
Feb 4, 2016
1f45a58
Code rework
Feb 5, 2016
b5cf6c1
Fix camelcase of dashed attributes in components. #574
Feb 7, 2016
dd7ac1f
Report PR #546 on ES6 branch
Feb 8, 2016
4bd0534
Merge pull request #543 from blikblum/fix-exception-with-jquery
benadamstyles Feb 9, 2016
1cdf37d
Merge pull request #579 from jccazeaux/report-fix-mem-leaks-ES6
benadamstyles Feb 9, 2016
2ac7e8b
Report for PR #612 Set bound to false when unbinding 'if' binder
Apr 18, 2016
1206149
Merge pull request #613 from jccazeaux/ES6-nested-if-dont-correctly-r…
benadamstyles Apr 18, 2016
1b4c72c
Updated babel for test build + included required packages for testing…
May 31, 2016
84fead1
Fixed binding to allow multiple strings, ES6 version of #624 Fixes #620
May 31, 2016
90ded81
testing Travis CI
May 31, 2016
6e6d527
get ES6 branch working with Travis CI
May 31, 2016
fbda5ad
Updated webpack version (and fixed associated invalid syntax / errors)
Jun 1, 2016
e0a5729
Merge pull request #626 from agmonks/es6-2
benadamstyles Aug 7, 2016
12abf28
fixed indentation
Aug 8, 2016
13250b4
remove dist files
Aug 8, 2016
dcfe7c0
Merge pull request #627 from agmonks/es6-travis
benadamstyles Aug 8, 2016
1b7bbc7
added test and report fix from #655
benadamstyles Aug 8, 2016
a5997a0
fix formatter order, improve tests
benadamstyles Aug 9, 2016
861ad9f
Merge pull request #656 from mikeric/es6-fix/two-way-formatter-publish
benadamstyles Aug 9, 2016
c232288
Merge pull request #576 from jccazeaux/fix/camelcase-components-dashe…
benadamstyles Aug 9, 2016
784a5f4
Merge pull request #569 from jccazeaux/fix/binder-value-when-empty-at…
benadamstyles Aug 9, 2016
9d7d5f6
Report fix for #644 on ES6. Only the test has been reported, fix seem…
Oct 10, 2016
88eec5a
Report fix for #650
Oct 10, 2016
fd2d5c7
Report #619. It's only a test, actual fix is on sightglass 0.2.6
Oct 10, 2016
7776edf
Merge pull request #687 from jccazeaux/report-for-#644
benadamstyles Oct 11, 2016
171a491
Merge pull request #688 from jccazeaux/report-for-#650
benadamstyles Oct 11, 2016
c899235
Merge pull request #689 from jccazeaux/report-#619-on-ES6
benadamstyles Oct 11, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: node_js
node_js: "5"

before_script:
- webpack
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ $ npm install

#### Building

Rivets.js uses [gulp](http://gulpjs.com/) as it's build tool. Run the following task to compile + minify the source into `dist/`.
Rivets.js uses [webpack](http://gulpjs.com/) as it's bundling / build tool. Run the following to compile the source into `dist/`.

```
$ gulp build
$ npm run build
```

#### Testing
Expand Down
6 changes: 0 additions & 6 deletions dist/rivets.bundled.min.js

This file was deleted.

17 changes: 17 additions & 0 deletions docs/docs/guide/_sections/iteration/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
To access the index of the current iteration use the syntax `%item%`, Where `item` is the name of the model you provided in `rv-each-[item]`. You can also access the index of the iteration by using the key `index` but using this will access only the current iterations index. Note that when nesting `rv-each`'s the parent index is still accessible within the scope via the model name.

```html
<ul>
<li rv-each-user="app.users">
<span>User Index : { %user% }</span>

<ul>
<li rv-each-comment="user.comments">
<span>Comment Index : { %comment% }</span>

<span>User Index : { %user% }</span>
</li>
</ul>
</li>
<ul>
```
5 changes: 5 additions & 0 deletions docs/docs/guide/_sections/usage/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ rivets.configure({
// Template delimiters for text bindings
templateDelimiters: ['{', '}'],

// Alias for index in rv-each binder
iterationAlias : function(modelName) {
return '%' + modelName + '%';
},

// Augment the event handler of the on-* binder
handler: function(target, event, binding) {
this.call(target, event, binding.view.models)
Expand Down
73 changes: 0 additions & 73 deletions gulpfile.js

This file was deleted.

13 changes: 13 additions & 0 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 17 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,26 @@
"sightglass": "~0.2.4"
},
"scripts": {
"test": "gulp spec",
"build": "gulp build"
"pretest": "babel src/parsers.js --out-file spec/lib/parsers.js --presets es2015 --plugins transform-es2015-modules-umd",
"test": "mocha-phantomjs spec/runner.html",
"build": "webpack"
},
"devDependencies": {
"mocha": "~1.20.1",

"minimist": "~1.1.0",
"mocha": "2.5.3",
"should": "~4.0.4",
"sinon": "~1.10.2",
"minimist": "~1.1.0",
"gulp": "~3.8.7",
"gulp-util": "~2.2.14",
"gulp-coffee": "~1.4.3",
"gulp-header": "~1.0.2",
"gulp-concat": "~2.2.0",
"gulp-uglify": "~0.3.0",
"gulp-bump": "~0.1.11",
"gulp-mocha-phantomjs": "~0.2.0"
"webpack": "1.13.1",
"babel-core": "6.9.1",
"babel-cli": "^6.0.0",
"mocha-phantomjs": "4.0.2",
"babel-loader" : "6.2.4",
"commander": "^2.8.1",
"mocha-phantomjs-core" : "1.3.1",
"babel-preset-es2015": "6.9.0",
"babel-plugin-transform-es2015-modules-umd": "6.8.0",
"phantomjs": "2.1.7",
"babel-plugin-add-module-exports" : "0.2.1"
}
}
109 changes: 109 additions & 0 deletions spec/lib/parsers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(['exports'], factory);
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var mod = {
exports: {}
};
factory(mod.exports);
global.parsers = mod.exports;
}
})(this, function (exports) {
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.parseType = parseType;
exports.parseTemplate = parseTemplate;
var PRIMITIVE = 0;
var KEYPATH = 1;
var TEXT = 0;
var BINDING = 1;

// Parser and tokenizer for getting the type and value from a string.
function parseType(string) {
var type = PRIMITIVE;
var value = string;

if (/^'.*'$|^".*"$/.test(string)) {
value = string.slice(1, -1);
} else if (string === 'true') {
value = true;
} else if (string === 'false') {
value = false;
} else if (string === 'null') {
value = null;
} else if (string === 'undefined') {
value = undefined;
} else if (isNaN(Number(string)) === false) {
value = Number(string);
} else {
type = KEYPATH;
}

return { type: type, value: value };
}

// Template parser and tokenizer for mustache-style text content bindings.
// Parses the template and returns a set of tokens, separating static portions
// of text from binding declarations.
function parseTemplate(template, delimiters) {
var tokens = [];
var length = template.length;
var index = 0;
var lastIndex = 0;

while (lastIndex < length) {
index = template.indexOf(delimiters[0], lastIndex);

if (index < 0) {
tokens.push({
type: TEXT,
value: template.slice(lastIndex)
});

break;
} else {
if (index > 0 && lastIndex < index) {
tokens.push({
type: TEXT,
value: template.slice(lastIndex, index)
});
}

lastIndex = index + delimiters[0].length;
index = template.indexOf(delimiters[1], lastIndex);

if (index < 0) {
var substring = template.slice(lastIndex - delimiters[1].length);
var lastToken = tokens[tokens.length - 1];

if (lastToken && lastToken.type === TEXT) {
lastToken.value += substring;
} else {
tokens.push({
type: TEXT,
value: substring
});
}

break;
}

var value = template.slice(lastIndex, index).trim();

tokens.push({
type: BINDING,
value: value
});

lastIndex = index + delimiters[1].length;
}
}

return tokens;
}
});
Loading