ajax-client
Advanced tools
Comparing version
{ | ||
"name": "ajax-client", | ||
"version": "0.1.0", | ||
"description": "", | ||
"main": "index.js", | ||
"version": "1.0.0", | ||
"description": "Lightweight ajax client", | ||
"main": "lib/ajaxclient.js", | ||
"scripts": { | ||
"start": "webpack-dev-server", | ||
"build": "webpack --config webpack.config.js", | ||
"test-server":"node src/TestServer.js" | ||
"release": "webpack --config webpack.config.js --mode production", | ||
"server": "node src_test_server/TestServer.js", | ||
"test": "jest -i" | ||
}, | ||
"author": "Tom Misawa <riversun.org@gmail.com> (https://github.com/riversun)", | ||
"license": "ISC", | ||
"license": "MIT", | ||
"repository": { | ||
@@ -22,10 +24,17 @@ "type": "git", | ||
"devDependencies": { | ||
"@babel/core": "^7.1.5", | ||
"@babel/preset-env": "^7.1.5", | ||
"babel-loader": "^8.0.4", | ||
"express": "^4.16.4", | ||
"webpack": "^4.19.1", | ||
"webpack-cli": "^3.1.0", | ||
"webpack-dev-server": "^3.1.8" | ||
"@babel/core": "^7.9.6", | ||
"@babel/preset-env": "^7.9.6", | ||
"babel-loader": "^8.1.0", | ||
"express": "^4.17.1", | ||
"webpack": "^4.43.0", | ||
"webpack-cli": "^3.3.11", | ||
"webpack-dev-server": "^3.11.0", | ||
"babel-jest": "^26.0.1", | ||
"jest": "^26.0.1" | ||
}, | ||
"dependencies": { | ||
}, | ||
"directories": { | ||
"test": "test" | ||
} | ||
} |
# ajax-client | ||
A simple ajax client for js. | ||
[](https://badge.fury.io/js/ajax-client) | ||
[](https://circleci.com/gh/riversun/ajax-client/tree/master) | ||
[](https://codecov.io/gh/riversun/ajax-client) | ||
[](https://opensource.org/licenses/MIT) | ||
A simple ajax client with jQuery like ajax API for js. | ||
jQuery is great, but do you use jQuery(80KB over) only for ajax? | ||
@@ -9,8 +14,4 @@ | ||
- Download directly | ||
- use package with npm | ||
[download ajax-client.js](https://raw.githubusercontent.com/riversun/ajax-client/master/dist/ajaxclient.js) | ||
- install package with npm | ||
```shell | ||
@@ -20,3 +21,8 @@ npm install ajax-client | ||
- use from CDN | ||
``` | ||
<script src="https://cdn.jsdelivr.net/npm/ajax-client@1.0.0/lib/ajax-client.js"></script> | ||
``` | ||
## usage | ||
@@ -28,3 +34,3 @@ | ||
const ajax = new org.riversun.AjaxClient(); | ||
const ajax = new AjaxClient(); | ||
@@ -38,2 +44,3 @@ //Data object to send | ||
ajax.postAsync({ | ||
type: 'post', | ||
url: 'http://localhost:9999/api',//Endpoint | ||
@@ -74,3 +81,3 @@ headers: { | ||
<script> | ||
const ajax = new org.riversun.AjaxClient(); | ||
const ajax = new AjaxClient(); | ||
@@ -77,0 +84,0 @@ //Data object to send |
@@ -1,44 +0,78 @@ | ||
const path = require("path"); | ||
const packageJson = require('./package.json'); | ||
const version = packageJson.version; | ||
const path = require('path'); | ||
const TerserPlugin = require('terser-webpack-plugin'); | ||
const webpack = require('webpack'); | ||
module.exports = { | ||
mode: 'development', | ||
devServer: { | ||
open: true, | ||
openPage: "index.html", | ||
contentBase: path.join(__dirname, 'public'), | ||
watchContentBase: true, | ||
port: 8080, | ||
}, | ||
entry: {ajaxclient: './src/index.js'}, | ||
output: { | ||
path: path.join(__dirname, "dist"), | ||
publicPath: "/", | ||
filename: '[name].js', | ||
library: ["org", "riversun"], | ||
libraryTarget: 'umd' | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /(node_modules|bower_components)/, | ||
use: { | ||
loader: 'babel-loader', | ||
options: { | ||
presets: [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"useBuiltIns": "usage", | ||
"targets": "> 0.25%, not dead" | ||
} | ||
] | ||
] | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
devtool: 'inline-source-map' | ||
module.exports = (env, argv) => { | ||
}; | ||
const conf = { | ||
mode: 'development', | ||
devServer: { | ||
open: true, | ||
openPage: 'index.html', | ||
contentBase: path.join(__dirname, 'public'), | ||
watchContentBase: true, | ||
port: 8080, | ||
host: argv.mode === 'production' ? `localhost` : `localhost`, | ||
disableHostCheck: true, | ||
}, | ||
entry: { | ||
'ajax-client': ['./src/AjaxClient.js'], | ||
}, | ||
output: { | ||
path: path.join(__dirname, 'lib'), | ||
publicPath: '/', | ||
filename: argv.mode === 'production' ? `[name].js` : `[name].js`, //`[name].min.js` | ||
library: 'AjaxClient', | ||
libraryExport: 'default', | ||
libraryTarget: 'umd', | ||
globalObject: 'this',//for both browser and node.js | ||
umdNamedDefine: true, | ||
}, | ||
optimization: { | ||
minimizer: [new TerserPlugin({ | ||
//extractComments: true, | ||
//cache: true, | ||
//parallel: true, | ||
//sourceMap: true, | ||
terserOptions: { | ||
compress: { | ||
drop_console: true, | ||
}, | ||
}, | ||
extractComments: true, | ||
})], | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /(node_modules|bower_components)/, | ||
use: [ | ||
{ | ||
loader: 'babel-loader', | ||
} | ||
], | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
alias: {} | ||
}, | ||
plugins: [ | ||
// new webpack.BannerPlugin(`[name] v${version} Copyright (c) 2019-2020 https://github.com/riversun(riversun.org@gmail.com)`), | ||
], | ||
}; | ||
if (argv.mode !== 'production') { | ||
conf.devtool = 'inline-source-map'; | ||
} | ||
return conf; | ||
}; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
10
11.11%0
-100%222
3.26%13589
-56.61%9
28.57%169
-50.29%1
Infinity%