96 |
97 |
98 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
Result
112 |
114 |
115 |
116 |
117 |
Decompression
118 |
120 |
121 |
122 |
123 |
124 |
155 |
--------------------------------------------------------------------------------
/karma.conf.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable import/unambiguous */
2 | const webpackConfig = require('./webpack.config.js');
3 |
4 | // karma-webpack 2.x breaking fix
5 | delete webpackConfig.entry;
6 |
7 | // note: these mods mutate the original config
8 | const MODS = { // eslint-disable-line no-unused-vars
9 | dontAliasLzma(config) {
10 | config.module.rules
11 | .filter(rule => rule.use && rule.use.loader === 'babel-loader')
12 | .forEach(rule => rule.use.options.plugins
13 | .filter(plugin => plugin[0] === 'module-resolver')
14 | .forEach(plugin => plugin[1].alias && delete plugin[1].alias.lzma)
15 | );
16 | return config;
17 | },
18 | dontUglify(config) {
19 | config.plugins = [];
20 | return config;
21 | }
22 | }
23 |
24 | module.exports = config => {
25 | config.set({
26 | frameworks: ['mocha'],
27 | files: ['test/index.js'],
28 | reporters: ['progress'],
29 | port: 9876,
30 | colors: true,
31 | logLevel: config.LOG_DEBUG,
32 | browsers: ['ChromeHeadless'],
33 | autoWatch: false, // if true, Karma will not exit after the tests
34 | concurrency: Infinity,
35 | preprocessors: {
36 | // add webpack as preprocessor
37 | 'test/index.js': ['webpack'],
38 | },
39 | webpack: webpackConfig
40 | });
41 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "json-url",
3 | "version": "3.1.0",
4 | "description": "Compress JSON into compact base64 URI-friendly notation",
5 | "main": "dist/node/index.js",
6 | "browser": "dist/browser/json-url-single.js",
7 | "scripts": {
8 | "lint": "eslint src/*",
9 | "compile": "rm -rf dist/; mkdir dist & wait & npm run compile:node & npm run compile:webpack & npm run compile:webpack:single",
10 | "compile:node": "babel --plugins @babel/plugin-transform-runtime,add-module-exports -d dist/node src src/main",
11 | "compile:webpack": "webpack",
12 | "compile:webpack:single": "webpack --config webpack.config.single.js",
13 | "prepublish": "npm test && npm run compile",
14 | "test": "npm run lint && npm run test:node && npm run test:karma",
15 | "test:node": "BABEL_ENV=test nyc mocha test/index.js --timeout 120000",
16 | "test:karma": "karma start --single-run",
17 | "perf": "babel-node test/perf.js",
18 | "coverage": "nyc report --reporter=text-lcov | coveralls",
19 | "example": "open http://localhost:8000/examples/browser/test.html & static-server --port 8000"
20 | },
21 | "repository": {
22 | "type": "git",
23 | "url": "https://github.com/masotime/json-url"
24 | },
25 | "author": "Benjamin Goh