particle-api-js 10.3.0 → 10.3.1
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/.eslintrc.js +23 -21
- package/CHANGELOG.md +8 -0
- package/EventStream-e2e-browser.html +7 -7
- package/EventStream-e2e-node.js +14 -14
- package/dist/particle.min.js +1 -1
- package/dist/particle.min.js.map +1 -1
- package/docs/api.md +3448 -875
- package/karma.conf.js +59 -59
- package/package.json +1 -1
- package/src/Agent.js +387 -363
- package/src/Client.js +162 -162
- package/src/Defaults.js +5 -5
- package/src/EventStream.js +254 -253
- package/src/Library.js +21 -21
- package/src/Particle.js +2685 -2649
- package/test/.eslintrc +5 -5
- package/test/Agent.integration.js +14 -14
- package/test/Agent.spec.js +495 -495
- package/test/Client.spec.js +203 -203
- package/test/Defaults.spec.js +20 -20
- package/test/EventStream.spec.js +231 -231
- package/test/FakeAgent.js +18 -18
- package/test/Library.spec.js +29 -29
- package/test/Particle.integration.js +29 -29
- package/test/Particle.spec.js +3127 -3127
- package/test/fixtures/index.js +7 -7
- package/test/support/FixtureHttpServer.js +16 -16
- package/test/test-setup.js +3 -3
- package/tsconfig.json +3 -1
- package/webpack.config.js +39 -39
package/test/fixtures/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
const fixtures = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
'libraries.json': require('./libraries.json'),
|
|
4
|
+
'library.json': require('./library.json'),
|
|
5
|
+
'libraryVersions.json': require('./libraryVersions.json')
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
function read(filename) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
if (!fixtures[filename]) {
|
|
10
|
+
throw new Error(`Fixture ${filename} doesn't exit`);
|
|
11
|
+
}
|
|
12
|
+
return fixtures[filename];
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
module.exports = { read };
|
|
@@ -4,24 +4,24 @@ const fixtures = require('../fixtures');
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class FixtureHttpServer {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
constructor(){
|
|
8
|
+
this.app = express();
|
|
9
|
+
this.app.get('/:filename', (req, res) => {
|
|
10
|
+
res.writeHead(200, { 'Content-Type': 'application/octet-stream' });
|
|
11
|
+
res.end(fixtures.read(req.params['filename']), 'binary');
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
// Call in a before() test hook
|
|
16
|
+
listen(){
|
|
17
|
+
return new Promise(fulfill => {
|
|
18
|
+
this.server = this.app.listen(0, fulfill);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
url(){
|
|
23
|
+
return `http://localhost:${this.server.address().port}`;
|
|
24
|
+
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
module.exports = FixtureHttpServer;
|
package/test/test-setup.js
CHANGED
package/tsconfig.json
CHANGED
package/webpack.config.js
CHANGED
|
@@ -3,43 +3,43 @@ const webpack = require('webpack');
|
|
|
3
3
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
4
4
|
|
|
5
5
|
module.exports = (env) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
6
|
+
return {
|
|
7
|
+
mode: env.mode,
|
|
8
|
+
target: 'web',
|
|
9
|
+
entry: './src/Particle.js',
|
|
10
|
+
devtool: 'source-map',
|
|
11
|
+
output: {
|
|
12
|
+
filename: `particle${env.mode === 'production' ? '.min' : ''}.js`,
|
|
13
|
+
path: path.resolve(__dirname, 'dist'),
|
|
14
|
+
clean: true,
|
|
15
|
+
library: {
|
|
16
|
+
name: 'Particle',
|
|
17
|
+
type: 'var'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
optimization: {
|
|
21
|
+
minimize: env.mode === 'production',
|
|
22
|
+
minimizer: [new TerserPlugin({
|
|
23
|
+
extractComments: false,
|
|
24
|
+
terserOptions: {
|
|
25
|
+
format: {
|
|
26
|
+
comments: false
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
})]
|
|
30
|
+
},
|
|
31
|
+
resolve: {
|
|
32
|
+
fallback: {
|
|
33
|
+
buffer: require.resolve('buffer'),
|
|
34
|
+
events: require.resolve('events'),
|
|
35
|
+
url: require.resolve('url')
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
plugins: [
|
|
39
|
+
new webpack.ProvidePlugin({
|
|
40
|
+
Buffer: ['buffer', 'Buffer'],
|
|
41
|
+
process: 'process/browser',
|
|
42
|
+
})
|
|
43
|
+
]
|
|
44
|
+
};
|
|
45
45
|
};
|