Skip to content

Commit f45a5bd

Browse files
committed
Merged with 1.0.0 branch
2 parents 114f98c + 349f5d6 commit f45a5bd

File tree

104 files changed

+2279
-2421
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+2279
-2421
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ yarn.lock
2121
examples/drag/package-lock.json
2222
examples/todomvc/package-lock.json
2323
.vscode/launch.json
24+
*.tgz

Gruntfile.js

Lines changed: 48 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,39 @@
11
module.exports = function(grunt) {
2-
3-
var dop = 'dop.js';
4-
var dopnodejs = 'dop.nodejs.js';
5-
var dopmin = 'dop.min.js';
2+
var dop = 'dop.js'
3+
var dopnodejs = 'dop.nodejs.js'
4+
var dopmin = 'dop.min.js'
65

76
// Project configuration.
87
grunt.initConfig({
9-
108
pkg: grunt.file.readJSON('package.json'),
119

1210
watch: {
1311
scripts: {
1412
files: ['src/**', 'package.json'],
1513
tasks: ['default'],
1614
options: {
17-
spawn: false,
18-
},
19-
},
15+
spawn: false
16+
}
17+
}
2018
},
2119

22-
23-
2420
copy: {
2521
main: {
2622
src: 'node_modules/dop-transports/connect/websocket.js',
27-
dest: 'src/env/browser/websocket.js',
28-
},
23+
dest: 'src/env/browser/websocket.js'
24+
}
2925
},
3026

3127
concat: {
3228
options: {
33-
banner: '/*\n' +
34-
' * dop@<%= pkg.version %>\n' +
35-
' * www.distributedobjectprotocol.org\n' +
36-
' * (c) 2018 Josema Gonzalez\n' +
37-
' * MIT License.\n' +
38-
' */\n',
29+
banner:
30+
'/*\n' +
31+
' * dop@<%= pkg.version %>\n' +
32+
' * www.distributedobjectprotocol.org\n' +
33+
' * MIT License.\n' +
34+
' */\n',
3935
process: function(src, filepath) {
40-
return '\n////////// ' + filepath + '\n' + src + '\n\n\n';
36+
return '\n////////// ' + filepath + '\n' + src + '\n\n\n'
4137
}
4238
},
4339
nodejs: {
@@ -51,7 +47,7 @@ module.exports = function(grunt) {
5147
'src/node/*',
5248
'src/umd.js'
5349
],
54-
dest: 'dist/'+dopnodejs
50+
dest: 'dist/' + dopnodejs
5551
},
5652
browser: {
5753
src: [
@@ -64,30 +60,30 @@ module.exports = function(grunt) {
6460
'src/node/*',
6561
'src/umd.js'
6662
],
67-
dest: 'dist/'+dop
63+
dest: 'dist/' + dop
6864
}
6965
},
7066

71-
7267
'string-replace': {
7368
dist: {
7469
files: {
75-
'dist/': ['dist/'+dop,'dist/'+dopnodejs],
70+
'dist/': ['dist/' + dop, 'dist/' + dopnodejs]
7671
},
7772
options: {
78-
replacements: [{
79-
pattern: /{{VERSION}}/ig,
80-
replacement: '<%= pkg.version %>'
81-
}]
73+
replacements: [
74+
{
75+
pattern: /{{VERSION}}/gi,
76+
replacement: '<%= pkg.version %>'
77+
}
78+
]
8279
}
8380
}
8481
},
8582

86-
8783
uglify: {
8884
build: {
89-
src: 'dist/'+dop,
90-
dest: 'dist/'+dopmin
85+
src: 'dist/' + dop,
86+
dest: 'dist/' + dopmin
9187
},
9288
options: {
9389
banner: '/* dop - (c) 2018 Josema Gonzalez - MIT Licensed */\n'
@@ -116,7 +112,7 @@ module.exports = function(grunt) {
116112
{
117113
expand: true,
118114
flatten: true,
119-
src: 'dist/'+dopmin,
115+
src: 'dist/' + dopmin,
120116
dest: 'dist'
121117
}
122118
]
@@ -130,28 +126,27 @@ module.exports = function(grunt) {
130126
},
131127
dist: {
132128
files: {
133-
'dist/dop.min.opt.js': 'dist/'+dopmin
129+
'dist/dop.min.opt.js': 'dist/' + dopmin
134130
}
135131
}
136132
}
137-
138-
});
139-
140-
141-
142-
grunt.loadNpmTasks('grunt-contrib-copy');
143-
grunt.loadNpmTasks('grunt-contrib-concat');
144-
grunt.loadNpmTasks('grunt-contrib-uglify');
145-
grunt.loadNpmTasks('grunt-contrib-watch');
146-
grunt.loadNpmTasks('grunt-replace');
147-
grunt.loadNpmTasks('grunt-optimize-js');
148-
grunt.loadNpmTasks('grunt-string-replace');
149-
150-
151-
var tasks = ['copy', 'concat:nodejs', 'concat:browser', 'string-replace', 'uglify', /*'replace', 'optimize-js'*/];
152-
if (grunt.option('build') === undefined)
153-
tasks.push('watch');
154-
grunt.registerTask('default', tasks);
155-
156-
157-
};
133+
})
134+
135+
grunt.loadNpmTasks('grunt-contrib-copy')
136+
grunt.loadNpmTasks('grunt-contrib-concat')
137+
grunt.loadNpmTasks('grunt-contrib-uglify')
138+
grunt.loadNpmTasks('grunt-contrib-watch')
139+
grunt.loadNpmTasks('grunt-replace')
140+
grunt.loadNpmTasks('grunt-optimize-js')
141+
grunt.loadNpmTasks('grunt-string-replace')
142+
143+
var tasks = [
144+
'copy',
145+
'concat:nodejs',
146+
'concat:browser',
147+
'string-replace',
148+
'uglify' /*'replace', 'optimize-js'*/
149+
]
150+
if (grunt.option('build') === undefined) tasks.push('watch')
151+
grunt.registerTask('default', tasks)
152+
}

package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dop",
3-
"version": "0.43.4",
3+
"version": "1.0.0-rc3",
44
"main": "./dist/dop.nodejs.js",
55
"browser": "./dist/dop.js",
66
"unpkg": "./dist/dop.min.js",
@@ -34,7 +34,7 @@
3434
"client"
3535
],
3636
"dependencies": {
37-
"dop-transports": "^2.0.14"
37+
"dop-transports": "3.0.0-rc1"
3838
},
3939
"devDependencies": {
4040
"coveralls": "^2.11.4",
@@ -60,15 +60,10 @@
6060
"dev": "grunt",
6161
"build": "grunt --build",
6262
"test": "tap test/*.js test/protocol/*.js",
63-
"test:websockets": "tap test/protocol/*.js --test-arg=websockets",
64-
"test:socketio": "tap test/protocol/*.js --test-arg=socketio",
65-
"test:sockjs": "tap test/protocol/*.js --test-arg=sockjs",
66-
"test:local": "tap test/protocol/*.js --test-arg=local",
6763
"test:electron": "browserify test/protocol/*.js test/*.js | tape-run --render=\"faucet\"",
6864
"test:chrome": "browserify test/protocol/*.js test/*.js | tape-run --render=\"faucet\" --browser chrome",
6965
"test:firefox": "browserify test/protocol/*.js test/*.js | tape-run --render=\"faucet\" --browser firefox",
7066
"test:safari": "browserify test/protocol/*.js test/*.js | tape-run --render=\"faucet\" --browser safari",
71-
"test:proxy": "tap test/*.js test/protocol/*.js --test-arg=proxy",
7267
"testtravis": "tap test/*.js test/protocol/*.js"
7368
}
7469
}

src/api/action.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
dop.action = function(f) {
1+
dop.action = function(f, filterMutationsToNode) {
22
dop.util.invariant(
33
isFunction(f),
4-
'dop.action only accept one argument as function'
4+
'dop.action needs one argument as function'
55
)
66
return function() {
77
var collectors = dop.data.collectors
88
var collector = dop.core.createCollector(collectors, collectors.length)
99
var output = f.apply(this, arguments)
10-
collector.emit()
10+
collector.emit(filterMutationsToNode)
1111
return output
1212
}
1313
}

src/api/collectGetters.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
dop.collectGetters = function() {
2+
var stopCollect = dop.core.collectGettersPaths()
3+
return function stopCollectGetters() {
4+
var objects_collected = stopCollect()
5+
var output = []
6+
var unique_paths = {}
7+
for (var index = 0; index < objects_collected.length; ++index) {
8+
var object_collected = objects_collected[index]
9+
var unique_path = dop.core.pathSeparator(object_collected.path)
10+
if (unique_paths[unique_path] === undefined) {
11+
unique_paths[unique_path] = true
12+
output.push({
13+
object: dop.getObjectProxy(object_collected.object),
14+
property: object_collected.property
15+
// path: object_collected.path
16+
})
17+
}
18+
}
19+
return output
20+
}
21+
}

src/api/connect.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
dop.connect = function(options) {
2+
if (dop.util.typeof(options) != 'object') options = {}
3+
4+
if (options.transport === undefined)
5+
options.transport = dop.getDefaultConnectTransport()
6+
7+
return typeof options.transport == 'function'
8+
? options.transport(dop, options)
9+
: options.transport
10+
}

src/api/createObserver.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
dop.createObserver = function(callback) {
2-
dop.util.invariant(
3-
isFunction(callback),
4-
'dop.createObserver only accept one argument as function'
5-
)
6-
var observers = dop.data.observers,
7-
index,
8-
observer_id,
9-
observer
10-
for (index in observers)
11-
if (observers[index].callback === callback) return observers[index]
12-
13-
observer_id = dop.data.observers_inc++
14-
observer = new dop.core.observer(callback, observer_id)
15-
return (observers[observer_id] = observer)
16-
}
1+
dop.createObserver = function(callback) {
2+
dop.util.invariant(
3+
isFunction(callback),
4+
'dop.createObserver only accept one argument as function'
5+
)
6+
var observers = dop.data.observers,
7+
index,
8+
observer_id,
9+
observer
10+
for (index in observers)
11+
if (observers[index].callback === callback) return observers[index]
12+
13+
observer_id = dop.data.observers_inc++
14+
observer = new dop.core.observer(callback, observer_id)
15+
return (observers[observer_id] = observer)
16+
}

src/api/createTransport.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dop.createTransport = function(socket, close) {
2+
return new dop.core.transport(socket, close)
3+
}

src/api/decode.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
dop.decode = function(data, node) {
1+
dop.decode = function(data) {
22
var undefineds = [],
33
index = 0,
44
total,
55
output = JSON.parse(data, function(property, value) {
6-
return dop.core.decode.call(this, property, value, node, undefineds)
6+
return dop.core.decode.call(this, property, value, undefineds)
77
})
88

99
for (total = undefineds.length, index = 0; index < total; ++index)

src/api/getNode.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dop.getNode = function(args) {
2+
return dop.getRequest(args).node
3+
}

0 commit comments

Comments
 (0)