deps: update
This commit is contained in:
parent
50f614060a
commit
23e859c6a8
|
@ -20,6 +20,9 @@ jobs:
|
|||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
|
||||
# - name: Test script
|
||||
# run: npm test
|
||||
|
||||
|
@ -31,8 +34,5 @@ jobs:
|
|||
|
||||
- name: Dump
|
||||
run: |
|
||||
echo ${HOME}
|
||||
ls -la ${HOME}
|
||||
ls -la
|
||||
echo ${PATH}
|
||||
hugo version
|
||||
|
|
|
@ -1,40 +1,15 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"@actions/core@1.1.0",
|
||||
"/Users/iris/Documents/repos/github.com/peaceiris/actions-hugo"
|
||||
]
|
||||
],
|
||||
"_from": "@actions/core@1.1.0",
|
||||
"_id": "@actions/core@1.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-KKpo3xzo0Zsikni9tbOsEQkxZBGDsYSJZNkTvmo0gPSXrc98TBOcdTvKwwjitjkjHkreTggWdB1ACiAFVgsuzA==",
|
||||
"_location": "/@actions/core",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@actions/core@1.1.0",
|
||||
"name": "@actions/core",
|
||||
"escapedName": "@actions%2fcore",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "1.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.0.tgz",
|
||||
"_spec": "1.1.0",
|
||||
"_where": "/Users/iris/Documents/repos/github.com/peaceiris/actions-hugo",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"name": "@actions/core",
|
||||
"version": "1.1.0",
|
||||
"description": "Actions core lib",
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.2"
|
||||
},
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"core"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
|
||||
"license": "MIT",
|
||||
"main": "lib/core.js",
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
|
@ -42,16 +17,6 @@
|
|||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52",
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"core"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/core.js",
|
||||
"name": "@actions/core",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
|
@ -63,5 +28,15 @@
|
|||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "1.1.0"
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.2"
|
||||
},
|
||||
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52"
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.0.tgz"
|
||||
,"_integrity": "sha512-KKpo3xzo0Zsikni9tbOsEQkxZBGDsYSJZNkTvmo0gPSXrc98TBOcdTvKwwjitjkjHkreTggWdB1ACiAFVgsuzA=="
|
||||
,"_from": "@actions/core@1.1.0"
|
||||
}
|
|
@ -1,37 +1,15 @@
|
|||
{
|
||||
"_from": "@actions/exec@^1.0.1",
|
||||
"_id": "@actions/exec@1.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-nvFkxwiicvpzNiCBF4wFBDfnBvi7xp/as7LE1hBxBxKG2L29+gkIPBiLKMVORL+Hg3JNf07AKRfl0V5djoypjQ==",
|
||||
"_location": "/@actions/exec",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@actions/exec@^1.0.1",
|
||||
"name": "@actions/exec",
|
||||
"escapedName": "@actions%2fexec",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "^1.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.1.tgz",
|
||||
"_shasum": "1624b541165697e7008d7c87bc1f69f191263c6c",
|
||||
"_spec": "@actions/exec@^1.0.1",
|
||||
"_where": "/Users/iris/Documents/repos/github.com/peaceiris/actions-hugo/node_modules/@actions/tool-cache",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"name": "@actions/exec",
|
||||
"version": "1.0.1",
|
||||
"description": "Actions exec lib",
|
||||
"devDependencies": {
|
||||
"@actions/io": "^1.0.1"
|
||||
},
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"exec"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
||||
"license": "MIT",
|
||||
"main": "lib/exec.js",
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
|
@ -39,16 +17,6 @@
|
|||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52",
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"exec"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/exec.js",
|
||||
"name": "@actions/exec",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
|
@ -60,5 +28,15 @@
|
|||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "1.0.1"
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@actions/io": "^1.0.1"
|
||||
},
|
||||
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52"
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.1.tgz"
|
||||
,"_integrity": "sha512-nvFkxwiicvpzNiCBF4wFBDfnBvi7xp/as7LE1hBxBxKG2L29+gkIPBiLKMVORL+Hg3JNf07AKRfl0V5djoypjQ=="
|
||||
,"_from": "@actions/exec@1.0.1"
|
||||
}
|
|
@ -1,36 +1,15 @@
|
|||
{
|
||||
"_from": "@actions/io",
|
||||
"_id": "@actions/io@1.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-rhq+tfZukbtaus7xyUtwKfuiCRXd1hWSfmJNEpFgBQJ4woqPEpsBw04awicjwz9tyG2/MVhAEMfVn664Cri5zA==",
|
||||
"_location": "/@actions/io",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "@actions/io",
|
||||
"name": "@actions/io",
|
||||
"escapedName": "@actions%2fio",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.1.tgz",
|
||||
"_shasum": "81a9418fe2bbdef2d2717a8e9f85188b9c565aca",
|
||||
"_spec": "@actions/io",
|
||||
"_where": "/Users/iris/Documents/repos/github.com/peaceiris/actions-hugo",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"name": "@actions/io",
|
||||
"version": "1.0.1",
|
||||
"description": "Actions io lib",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"io"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/io",
|
||||
"license": "MIT",
|
||||
"main": "lib/io.js",
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
|
@ -38,16 +17,6 @@
|
|||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52",
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/io",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"io"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/io.js",
|
||||
"name": "@actions/io",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
|
@ -59,5 +28,12 @@
|
|||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "1.0.1"
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52"
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.1.tgz"
|
||||
,"_integrity": "sha512-rhq+tfZukbtaus7xyUtwKfuiCRXd1hWSfmJNEpFgBQJ4woqPEpsBw04awicjwz9tyG2/MVhAEMfVn664Cri5zA=="
|
||||
,"_from": "@actions/io@1.0.1"
|
||||
}
|
|
@ -1,60 +1,32 @@
|
|||
{
|
||||
"_from": "semver@^6.1.0",
|
||||
"_id": "semver@6.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"_location": "/@actions/tool-cache/semver",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "semver@^6.1.0",
|
||||
"name": "semver",
|
||||
"escapedName": "semver",
|
||||
"rawSpec": "^6.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^6.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"_shasum": "ee0a64c8af5e8ceea67687b133761e1becbd1d3d",
|
||||
"_spec": "semver@^6.1.0",
|
||||
"_where": "/Users/iris/Documents/repos/github.com/peaceiris/actions-hugo/node_modules/@actions/tool-cache",
|
||||
"bin": {
|
||||
"semver": "./bin/semver.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/npm/node-semver/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"name": "semver",
|
||||
"version": "6.3.0",
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"main": "semver.js",
|
||||
"scripts": {
|
||||
"test": "tap",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"postpublish": "git push origin --follow-tags"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tap": "^14.3.1"
|
||||
},
|
||||
"license": "ISC",
|
||||
"repository": "https://github.com/npm/node-semver",
|
||||
"bin": {
|
||||
"semver": "./bin/semver.js"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"range.bnf",
|
||||
"semver.js"
|
||||
],
|
||||
"homepage": "https://github.com/npm/node-semver#readme",
|
||||
"license": "ISC",
|
||||
"main": "semver.js",
|
||||
"name": "semver",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/npm/node-semver.git"
|
||||
},
|
||||
"scripts": {
|
||||
"postpublish": "git push origin --follow-tags",
|
||||
"postversion": "npm publish",
|
||||
"preversion": "npm test",
|
||||
"test": "tap"
|
||||
},
|
||||
"tap": {
|
||||
"check-coverage": true
|
||||
},
|
||||
"version": "6.3.0"
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz"
|
||||
,"_integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
|
||||
,"_from": "semver@6.3.0"
|
||||
}
|
|
@ -1,49 +1,15 @@
|
|||
{
|
||||
"_from": "@actions/tool-cache",
|
||||
"_id": "@actions/tool-cache@1.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-AILekrrj/L4N/5z5TGtUKVie4nKjxDioCgOEymyYxzPhGfjIxfE71tN2VTTpiICEWJ883rPRj2+WinTr1b6yVA==",
|
||||
"_location": "/@actions/tool-cache",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "@actions/tool-cache",
|
||||
"name": "@actions/tool-cache",
|
||||
"escapedName": "@actions%2ftool-cache",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.1.tgz",
|
||||
"_shasum": "99c5c7463089af5d0a5c5ba8cb5fc3c73fa0c284",
|
||||
"_spec": "@actions/tool-cache",
|
||||
"_where": "/Users/iris/Documents/repos/github.com/peaceiris/actions-hugo",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.1.0",
|
||||
"@actions/exec": "^1.0.1",
|
||||
"@actions/io": "^1.0.1",
|
||||
"semver": "^6.1.0",
|
||||
"typed-rest-client": "^1.4.0",
|
||||
"uuid": "^3.3.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"name": "@actions/tool-cache",
|
||||
"version": "1.1.1",
|
||||
"description": "Actions tool-cache lib",
|
||||
"devDependencies": {
|
||||
"@types/nock": "^10.0.3",
|
||||
"@types/semver": "^6.0.0",
|
||||
"@types/uuid": "^3.4.4",
|
||||
"nock": "^10.0.6"
|
||||
},
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"exec"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
||||
"license": "MIT",
|
||||
"main": "lib/tool-cache.js",
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
|
@ -52,16 +18,6 @@
|
|||
"lib",
|
||||
"scripts"
|
||||
],
|
||||
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52",
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"exec"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/tool-cache.js",
|
||||
"name": "@actions/tool-cache",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
|
@ -73,5 +29,26 @@
|
|||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "1.1.1"
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.1.0",
|
||||
"@actions/exec": "^1.0.1",
|
||||
"@actions/io": "^1.0.1",
|
||||
"semver": "^6.1.0",
|
||||
"typed-rest-client": "^1.4.0",
|
||||
"uuid": "^3.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/nock": "^10.0.3",
|
||||
"@types/semver": "^6.0.0",
|
||||
"@types/uuid": "^3.4.4",
|
||||
"nock": "^10.0.6"
|
||||
},
|
||||
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52"
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.1.tgz"
|
||||
,"_integrity": "sha512-AILekrrj/L4N/5z5TGtUKVie4nKjxDioCgOEymyYxzPhGfjIxfE71tN2VTTpiICEWJ883rPRj2+WinTr1b6yVA=="
|
||||
,"_from": "@actions/tool-cache@1.1.1"
|
||||
}
|
|
@ -1,48 +1,7 @@
|
|||
{
|
||||
"_from": "tunnel@0.0.4",
|
||||
"_id": "tunnel@0.0.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=",
|
||||
"_location": "/tunnel",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "tunnel@0.0.4",
|
||||
"name": "tunnel",
|
||||
"escapedName": "tunnel",
|
||||
"rawSpec": "0.0.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.0.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/typed-rest-client"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz",
|
||||
"_shasum": "2d3785a158c174c9a16dc2c046ec5fc5f1742213",
|
||||
"_spec": "tunnel@0.0.4",
|
||||
"_where": "/Users/iris/Documents/repos/github.com/peaceiris/actions-hugo/node_modules/typed-rest-client",
|
||||
"author": {
|
||||
"name": "Koichi Kobayashi",
|
||||
"email": "koichik@improvement.jp"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/koichik/node-tunnel/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"name": "tunnel",
|
||||
"version": "0.0.4",
|
||||
"description": "Node HTTP/HTTPS Agents for tunneling proxies",
|
||||
"devDependencies": {
|
||||
"mocha": "*",
|
||||
"should": "*"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "./lib"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
|
||||
},
|
||||
"homepage": "https://github.com/koichik/node-tunnel/",
|
||||
"keywords": [
|
||||
"http",
|
||||
"https",
|
||||
|
@ -50,15 +9,30 @@
|
|||
"proxy",
|
||||
"tunnel"
|
||||
],
|
||||
"homepage": "https://github.com/koichik/node-tunnel/",
|
||||
"bugs": "https://github.com/koichik/node-tunnel/issues",
|
||||
"license": "MIT",
|
||||
"author": "Koichi Kobayashi <koichik@improvement.jp>",
|
||||
"main": "./index.js",
|
||||
"name": "tunnel",
|
||||
"directories": {
|
||||
"lib": "./lib"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/koichik/node-tunnel.git"
|
||||
"url": "https://github.com/koichik/node-tunnel.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "./node_modules/mocha/bin/mocha"
|
||||
},
|
||||
"version": "0.0.4"
|
||||
"devDependencies": {
|
||||
"mocha": "*",
|
||||
"should": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz"
|
||||
,"_integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM="
|
||||
,"_from": "tunnel@0.0.4"
|
||||
}
|
|
@ -1,52 +1,20 @@
|
|||
{
|
||||
"_from": "typed-rest-client@^1.4.0",
|
||||
"_id": "typed-rest-client@1.5.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-DVZRlmsfnTjp6ZJaatcdyvvwYwbWvR4YDNFDqb+qdTxpvaVP99YCpBkA8rxsLtAPjBVoDe4fNsnMIdZTiPuKWg==",
|
||||
"_location": "/typed-rest-client",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "typed-rest-client@^1.4.0",
|
||||
"name": "typed-rest-client",
|
||||
"escapedName": "typed-rest-client",
|
||||
"rawSpec": "^1.4.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.4.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.5.0.tgz",
|
||||
"_shasum": "c0dda6e775b942fd46a2d99f2160a94953206fc2",
|
||||
"_spec": "typed-rest-client@^1.4.0",
|
||||
"_where": "/Users/iris/Documents/repos/github.com/peaceiris/actions-hugo/node_modules/@actions/tool-cache",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/typed-rest-client/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"tunnel": "0.0.4",
|
||||
"underscore": "1.8.3"
|
||||
},
|
||||
"deprecated": false,
|
||||
"name": "typed-rest-client",
|
||||
"version": "1.5.0",
|
||||
"description": "Node Rest and Http Clients for use with TypeScript",
|
||||
"devDependencies": {
|
||||
"@types/mocha": "^2.2.44",
|
||||
"@types/node": "^6.0.92",
|
||||
"@types/shelljs": "0.7.4",
|
||||
"mocha": "^3.5.3",
|
||||
"nock": "9.6.1",
|
||||
"react-scripts": "1.1.5",
|
||||
"semver": "4.3.3",
|
||||
"shelljs": "0.7.6",
|
||||
"typescript": "3.1.5"
|
||||
"main": "./RestClient.js",
|
||||
"scripts": {
|
||||
"build": "node make.js build",
|
||||
"test": "node make.js test",
|
||||
"bt": "node make.js buildtest",
|
||||
"samples": "node make.js samples",
|
||||
"units": "node make.js units",
|
||||
"validate": "node make.js validate"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Microsoft/typed-rest-client.git"
|
||||
},
|
||||
"homepage": "https://github.com/Microsoft/typed-rest-client#readme",
|
||||
"keywords": [
|
||||
"rest",
|
||||
"http",
|
||||
|
@ -54,20 +22,29 @@
|
|||
"typescript",
|
||||
"node"
|
||||
],
|
||||
"author": "Microsoft Corporation",
|
||||
"license": "MIT",
|
||||
"main": "./RestClient.js",
|
||||
"name": "typed-rest-client",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Microsoft/typed-rest-client.git"
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/typed-rest-client/issues"
|
||||
},
|
||||
"scripts": {
|
||||
"bt": "node make.js buildtest",
|
||||
"build": "node make.js build",
|
||||
"samples": "node make.js samples",
|
||||
"test": "node make.js test",
|
||||
"units": "node make.js units",
|
||||
"validate": "node make.js validate"
|
||||
"homepage": "https://github.com/Microsoft/typed-rest-client#readme",
|
||||
"devDependencies": {
|
||||
"@types/mocha": "^2.2.44",
|
||||
"@types/node": "^6.0.92",
|
||||
"@types/shelljs": "0.7.4",
|
||||
"mocha": "^3.5.3",
|
||||
"nock": "9.6.1",
|
||||
"react-scripts": "1.1.5",
|
||||
"shelljs": "0.7.6",
|
||||
"semver": "4.3.3",
|
||||
"typescript": "3.1.5"
|
||||
},
|
||||
"version": "1.5.0"
|
||||
"dependencies": {
|
||||
"tunnel": "0.0.4",
|
||||
"underscore": "1.8.3"
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.5.0.tgz"
|
||||
,"_integrity": "sha512-DVZRlmsfnTjp6ZJaatcdyvvwYwbWvR4YDNFDqb+qdTxpvaVP99YCpBkA8rxsLtAPjBVoDe4fNsnMIdZTiPuKWg=="
|
||||
,"_from": "typed-rest-client@1.5.0"
|
||||
}
|
|
@ -1,51 +1,6 @@
|
|||
{
|
||||
"_from": "underscore@1.8.3",
|
||||
"_id": "underscore@1.8.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=",
|
||||
"_location": "/underscore",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "underscore@1.8.3",
|
||||
"name": "underscore",
|
||||
"escapedName": "underscore",
|
||||
"rawSpec": "1.8.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.8.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/typed-rest-client"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz",
|
||||
"_shasum": "4f3fb53b106e6097fcf9cb4109f2a5e9bdfa5022",
|
||||
"_spec": "underscore@1.8.3",
|
||||
"_where": "/Users/iris/Documents/repos/github.com/peaceiris/actions-hugo/node_modules/typed-rest-client",
|
||||
"author": {
|
||||
"name": "Jeremy Ashkenas",
|
||||
"email": "jeremy@documentcloud.org"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jashkenas/underscore/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"name": "underscore",
|
||||
"description": "JavaScript's functional programming helper library.",
|
||||
"devDependencies": {
|
||||
"docco": "*",
|
||||
"eslint": "0.6.x",
|
||||
"karma": "~0.12.31",
|
||||
"karma-qunit": "~0.1.4",
|
||||
"qunit-cli": "~0.2.0",
|
||||
"uglify-js": "2.4.x"
|
||||
},
|
||||
"files": [
|
||||
"underscore.js",
|
||||
"underscore-min.js",
|
||||
"underscore-min.map",
|
||||
"LICENSE"
|
||||
],
|
||||
"homepage": "http://underscorejs.org",
|
||||
"keywords": [
|
||||
"util",
|
||||
|
@ -54,20 +9,38 @@
|
|||
"client",
|
||||
"browser"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "underscore.js",
|
||||
"name": "underscore",
|
||||
"author": "Jeremy Ashkenas <jeremy@documentcloud.org>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/jashkenas/underscore.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "uglifyjs underscore.js -c \"evaluate=false\" --comments \"/ .*/\" -m --source-map underscore-min.map -o underscore-min.js",
|
||||
"doc": "docco underscore.js",
|
||||
"lint": "eslint underscore.js test/*.js",
|
||||
"test": "npm run test-node && npm run lint",
|
||||
"test-browser": "npm i karma-phantomjs-launcher && ./node_modules/karma/bin/karma start",
|
||||
"test-node": "qunit-cli test/*.js"
|
||||
"main": "underscore.js",
|
||||
"version": "1.8.3",
|
||||
"devDependencies": {
|
||||
"docco": "*",
|
||||
"eslint": "0.6.x",
|
||||
"karma": "~0.12.31",
|
||||
"karma-qunit": "~0.1.4",
|
||||
"qunit-cli": "~0.2.0",
|
||||
"uglify-js": "2.4.x"
|
||||
},
|
||||
"version": "1.8.3"
|
||||
"scripts": {
|
||||
"test": "npm run test-node && npm run lint",
|
||||
"lint": "eslint underscore.js test/*.js",
|
||||
"test-node": "qunit-cli test/*.js",
|
||||
"test-browser": "npm i karma-phantomjs-launcher && ./node_modules/karma/bin/karma start",
|
||||
"build": "uglifyjs underscore.js -c \"evaluate=false\" --comments \"/ .*/\" -m --source-map underscore-min.map -o underscore-min.js",
|
||||
"doc": "docco underscore.js"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"underscore.js",
|
||||
"underscore-min.js",
|
||||
"underscore-min.map",
|
||||
"LICENSE"
|
||||
]
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz"
|
||||
,"_integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI="
|
||||
,"_from": "underscore@1.8.3"
|
||||
}
|
|
@ -1,72 +1,21 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"uuid@3.3.3",
|
||||
"/Users/iris/Documents/repos/github.com/peaceiris/actions-hugo"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "uuid@3.3.3",
|
||||
"_id": "uuid@3.3.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==",
|
||||
"_location": "/uuid",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "uuid@3.3.3",
|
||||
"name": "uuid",
|
||||
"escapedName": "uuid",
|
||||
"rawSpec": "3.3.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.3.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/request"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
|
||||
"_spec": "3.3.3",
|
||||
"_where": "/Users/iris/Documents/repos/github.com/peaceiris/actions-hugo",
|
||||
"bin": {
|
||||
"uuid": "./bin/uuid"
|
||||
},
|
||||
"browser": {
|
||||
"./lib/rng.js": "./lib/rng-browser.js",
|
||||
"./lib/sha1.js": "./lib/sha1-browser.js",
|
||||
"./lib/md5.js": "./lib/md5-browser.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/kelektiv/node-uuid/issues"
|
||||
},
|
||||
"name": "uuid",
|
||||
"version": "3.3.3",
|
||||
"description": "RFC4122 (v1, v4, and v5) UUIDs",
|
||||
"commitlint": {
|
||||
"extends": [
|
||||
"@commitlint/config-conventional"
|
||||
]
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Robert Kieffer",
|
||||
"email": "robert@broofa.com"
|
||||
},
|
||||
{
|
||||
"name": "Christoph Tavan",
|
||||
"email": "dev@tavan.de"
|
||||
},
|
||||
{
|
||||
"name": "AJ ONeal",
|
||||
"email": "coolaj86@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Vincent Voyer",
|
||||
"email": "vincent@zeroload.net"
|
||||
},
|
||||
{
|
||||
"name": "Roman Shtylman",
|
||||
"email": "shtylman@gmail.com"
|
||||
}
|
||||
"keywords": [
|
||||
"uuid",
|
||||
"guid",
|
||||
"rfc4122"
|
||||
],
|
||||
"description": "RFC4122 (v1, v4, and v5) UUIDs",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "./bin/uuid"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "8.1.0",
|
||||
"@commitlint/config-conventional": "8.1.0",
|
||||
|
@ -76,24 +25,24 @@
|
|||
"runmd": "1.2.1",
|
||||
"standard-version": "7.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/kelektiv/node-uuid#readme",
|
||||
"keywords": [
|
||||
"uuid",
|
||||
"guid",
|
||||
"rfc4122"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "uuid",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/kelektiv/node-uuid.git"
|
||||
},
|
||||
"scripts": {
|
||||
"commitmsg": "commitlint -E HUSKY_GIT_PARAMS",
|
||||
"test": "mocha test/test.js",
|
||||
"md": "runmd --watch --output=README.md README_js.md",
|
||||
"prepare": "runmd --output=README.md README_js.md",
|
||||
"release": "standard-version",
|
||||
"test": "mocha test/test.js"
|
||||
"prepare": "runmd --output=README.md README_js.md"
|
||||
},
|
||||
"version": "3.3.3"
|
||||
"browser": {
|
||||
"./lib/rng.js": "./lib/rng-browser.js",
|
||||
"./lib/sha1.js": "./lib/sha1-browser.js",
|
||||
"./lib/md5.js": "./lib/md5-browser.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/kelektiv/node-uuid.git"
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz"
|
||||
,"_integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
|
||||
,"_from": "uuid@3.3.3"
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"node": true,
|
||||
"browser": false,
|
||||
"esnext": true,
|
||||
"bitwise": false,
|
||||
"camelcase": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"eqnull": true,
|
||||
"immed": true,
|
||||
"indent": 2,
|
||||
"latedef": true,
|
||||
"laxbreak": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"quotmark": "double",
|
||||
"regexp": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"strict": true,
|
||||
"trailing": true,
|
||||
"smarttabs": true,
|
||||
"globals": {
|
||||
"define": false
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
example
|
||||
tests
|
||||
|
||||
autotest.watchr
|
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) 2010 passive.ly LLC
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,55 @@
|
|||
# node-XMLHttpRequest #
|
||||
|
||||
node-XMLHttpRequest is a wrapper for the built-in http client to emulate the
|
||||
browser XMLHttpRequest object.
|
||||
|
||||
This can be used with JS designed for browsers to improve reuse of code and
|
||||
allow the use of existing libraries.
|
||||
|
||||
Note: This library currently conforms to [XMLHttpRequest 1](http://www.w3.org/TR/XMLHttpRequest/). Version 2.0 will target [XMLHttpRequest Level 2](http://www.w3.org/TR/XMLHttpRequest2/).
|
||||
|
||||
## Usage ##
|
||||
|
||||
Here's how to include the module in your project and use as the browser-based
|
||||
XHR object.
|
||||
|
||||
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
Note: use the lowercase string "xmlhttprequest" in your require(). On
|
||||
case-sensitive systems (eg Linux) using uppercase letters won't work.
|
||||
|
||||
## Versions ##
|
||||
|
||||
Prior to 1.4.0 version numbers were arbitrary. From 1.4.0 on they conform to
|
||||
the standard major.minor.bugfix. 1.x shouldn't necessarily be considered
|
||||
stable just because it's above 0.x.
|
||||
|
||||
Since the XMLHttpRequest API is stable this library's API is stable as
|
||||
well. Major version numbers indicate significant core code changes.
|
||||
Minor versions indicate minor core code changes or better conformity to
|
||||
the W3C spec.
|
||||
|
||||
## License ##
|
||||
|
||||
MIT license. See LICENSE for full details.
|
||||
|
||||
## Supports ##
|
||||
|
||||
* Async and synchronous requests
|
||||
* GET, POST, PUT, and DELETE requests
|
||||
* All spec methods (open, send, abort, getRequestHeader,
|
||||
getAllRequestHeaders, event methods)
|
||||
* Requests to all domains
|
||||
|
||||
## Known Issues / Missing Features ##
|
||||
|
||||
For a list of open issues or to report your own visit the [github issues
|
||||
page](https://github.com/driverdan/node-XMLHttpRequest/issues).
|
||||
|
||||
* Local file access may have unexpected results for non-UTF8 files
|
||||
* Synchronous requests don't set headers properly
|
||||
* Synchronous requests freeze node while waiting for response (But that's what you want, right? Stick with async!).
|
||||
* Some events are missing, such as abort
|
||||
* Cookies aren't persisted between requests
|
||||
* Missing XML support
|
|
@ -0,0 +1,620 @@
|
|||
/**
|
||||
* Wrapper for built-in http.js to emulate the browser XMLHttpRequest object.
|
||||
*
|
||||
* This can be used with JS designed for browsers to improve reuse of code and
|
||||
* allow the use of existing libraries.
|
||||
*
|
||||
* Usage: include("XMLHttpRequest.js") and use XMLHttpRequest per W3C specs.
|
||||
*
|
||||
* @author Dan DeFelippi <dan@driverdan.com>
|
||||
* @contributor David Ellis <d.f.ellis@ieee.org>
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
var Url = require("url");
|
||||
var spawn = require("child_process").spawn;
|
||||
var fs = require("fs");
|
||||
|
||||
exports.XMLHttpRequest = function() {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Private variables
|
||||
*/
|
||||
var self = this;
|
||||
var http = require("http");
|
||||
var https = require("https");
|
||||
|
||||
// Holds http.js objects
|
||||
var request;
|
||||
var response;
|
||||
|
||||
// Request settings
|
||||
var settings = {};
|
||||
|
||||
// Disable header blacklist.
|
||||
// Not part of XHR specs.
|
||||
var disableHeaderCheck = false;
|
||||
|
||||
// Set some default headers
|
||||
var defaultHeaders = {
|
||||
"User-Agent": "node-XMLHttpRequest",
|
||||
"Accept": "*/*",
|
||||
};
|
||||
|
||||
var headers = {};
|
||||
var headersCase = {};
|
||||
|
||||
// These headers are not user setable.
|
||||
// The following are allowed but banned in the spec:
|
||||
// * user-agent
|
||||
var forbiddenRequestHeaders = [
|
||||
"accept-charset",
|
||||
"accept-encoding",
|
||||
"access-control-request-headers",
|
||||
"access-control-request-method",
|
||||
"connection",
|
||||
"content-length",
|
||||
"content-transfer-encoding",
|
||||
"cookie",
|
||||
"cookie2",
|
||||
"date",
|
||||
"expect",
|
||||
"host",
|
||||
"keep-alive",
|
||||
"origin",
|
||||
"referer",
|
||||
"te",
|
||||
"trailer",
|
||||
"transfer-encoding",
|
||||
"upgrade",
|
||||
"via"
|
||||
];
|
||||
|
||||
// These request methods are not allowed
|
||||
var forbiddenRequestMethods = [
|
||||
"TRACE",
|
||||
"TRACK",
|
||||
"CONNECT"
|
||||
];
|
||||
|
||||
// Send flag
|
||||
var sendFlag = false;
|
||||
// Error flag, used when errors occur or abort is called
|
||||
var errorFlag = false;
|
||||
|
||||
// Event listeners
|
||||
var listeners = {};
|
||||
|
||||
/**
|
||||
* Constants
|
||||
*/
|
||||
|
||||
this.UNSENT = 0;
|
||||
this.OPENED = 1;
|
||||
this.HEADERS_RECEIVED = 2;
|
||||
this.LOADING = 3;
|
||||
this.DONE = 4;
|
||||
|
||||
/**
|
||||
* Public vars
|
||||
*/
|
||||
|
||||
// Current state
|
||||
this.readyState = this.UNSENT;
|
||||
|
||||
// default ready state change handler in case one is not set or is set late
|
||||
this.onreadystatechange = null;
|
||||
|
||||
// Result & response
|
||||
this.responseText = "";
|
||||
this.responseXML = "";
|
||||
this.status = null;
|
||||
this.statusText = null;
|
||||
|
||||
// Whether cross-site Access-Control requests should be made using
|
||||
// credentials such as cookies or authorization headers
|
||||
this.withCredentials = false;
|
||||
|
||||
/**
|
||||
* Private methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* Check if the specified header is allowed.
|
||||
*
|
||||
* @param string header Header to validate
|
||||
* @return boolean False if not allowed, otherwise true
|
||||
*/
|
||||
var isAllowedHttpHeader = function(header) {
|
||||
return disableHeaderCheck || (header && forbiddenRequestHeaders.indexOf(header.toLowerCase()) === -1);
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the specified method is allowed.
|
||||
*
|
||||
* @param string method Request method to validate
|
||||
* @return boolean False if not allowed, otherwise true
|
||||
*/
|
||||
var isAllowedHttpMethod = function(method) {
|
||||
return (method && forbiddenRequestMethods.indexOf(method) === -1);
|
||||
};
|
||||
|
||||
/**
|
||||
* Public methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* Open the connection. Currently supports local server requests.
|
||||
*
|
||||
* @param string method Connection method (eg GET, POST)
|
||||
* @param string url URL for the connection.
|
||||
* @param boolean async Asynchronous connection. Default is true.
|
||||
* @param string user Username for basic authentication (optional)
|
||||
* @param string password Password for basic authentication (optional)
|
||||
*/
|
||||
this.open = function(method, url, async, user, password) {
|
||||
this.abort();
|
||||
errorFlag = false;
|
||||
|
||||
// Check for valid request method
|
||||
if (!isAllowedHttpMethod(method)) {
|
||||
throw new Error("SecurityError: Request method not allowed");
|
||||
}
|
||||
|
||||
settings = {
|
||||
"method": method,
|
||||
"url": url.toString(),
|
||||
"async": (typeof async !== "boolean" ? true : async),
|
||||
"user": user || null,
|
||||
"password": password || null
|
||||
};
|
||||
|
||||
setState(this.OPENED);
|
||||
};
|
||||
|
||||
/**
|
||||
* Disables or enables isAllowedHttpHeader() check the request. Enabled by default.
|
||||
* This does not conform to the W3C spec.
|
||||
*
|
||||
* @param boolean state Enable or disable header checking.
|
||||
*/
|
||||
this.setDisableHeaderCheck = function(state) {
|
||||
disableHeaderCheck = state;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets a header for the request or appends the value if one is already set.
|
||||
*
|
||||
* @param string header Header name
|
||||
* @param string value Header value
|
||||
*/
|
||||
this.setRequestHeader = function(header, value) {
|
||||
if (this.readyState !== this.OPENED) {
|
||||
throw new Error("INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN");
|
||||
}
|
||||
if (!isAllowedHttpHeader(header)) {
|
||||
console.warn("Refused to set unsafe header \"" + header + "\"");
|
||||
return;
|
||||
}
|
||||
if (sendFlag) {
|
||||
throw new Error("INVALID_STATE_ERR: send flag is true");
|
||||
}
|
||||
header = headersCase[header.toLowerCase()] || header;
|
||||
headersCase[header.toLowerCase()] = header;
|
||||
headers[header] = headers[header] ? headers[header] + ', ' + value : value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets a header from the server response.
|
||||
*
|
||||
* @param string header Name of header to get.
|
||||
* @return string Text of the header or null if it doesn't exist.
|
||||
*/
|
||||
this.getResponseHeader = function(header) {
|
||||
if (typeof header === "string"
|
||||
&& this.readyState > this.OPENED
|
||||
&& response
|
||||
&& response.headers
|
||||
&& response.headers[header.toLowerCase()]
|
||||
&& !errorFlag
|
||||
) {
|
||||
return response.headers[header.toLowerCase()];
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets all the response headers.
|
||||
*
|
||||
* @return string A string with all response headers separated by CR+LF
|
||||
*/
|
||||
this.getAllResponseHeaders = function() {
|
||||
if (this.readyState < this.HEADERS_RECEIVED || errorFlag) {
|
||||
return "";
|
||||
}
|
||||
var result = "";
|
||||
|
||||
for (var i in response.headers) {
|
||||
// Cookie headers are excluded
|
||||
if (i !== "set-cookie" && i !== "set-cookie2") {
|
||||
result += i + ": " + response.headers[i] + "\r\n";
|
||||
}
|
||||
}
|
||||
return result.substr(0, result.length - 2);
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets a request header
|
||||
*
|
||||
* @param string name Name of header to get
|
||||
* @return string Returns the request header or empty string if not set
|
||||
*/
|
||||
this.getRequestHeader = function(name) {
|
||||
if (typeof name === "string" && headersCase[name.toLowerCase()]) {
|
||||
return headers[headersCase[name.toLowerCase()]];
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
/**
|
||||
* Sends the request to the server.
|
||||
*
|
||||
* @param string data Optional data to send as request body.
|
||||
*/
|
||||
this.send = function(data) {
|
||||
if (this.readyState !== this.OPENED) {
|
||||
throw new Error("INVALID_STATE_ERR: connection must be opened before send() is called");
|
||||
}
|
||||
|
||||
if (sendFlag) {
|
||||
throw new Error("INVALID_STATE_ERR: send has already been called");
|
||||
}
|
||||
|
||||
var ssl = false, local = false;
|
||||
var url = Url.parse(settings.url);
|
||||
var host;
|
||||
// Determine the server
|
||||
switch (url.protocol) {
|
||||
case "https:":
|
||||
ssl = true;
|
||||
// SSL & non-SSL both need host, no break here.
|
||||
case "http:":
|
||||
host = url.hostname;
|
||||
break;
|
||||
|
||||
case "file:":
|
||||
local = true;
|
||||
break;
|
||||
|
||||
case undefined:
|
||||
case null:
|
||||
case "":
|
||||
host = "localhost";
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error("Protocol not supported.");
|
||||
}
|
||||
|
||||
// Load files off the local filesystem (file://)
|
||||
if (local) {
|
||||
if (settings.method !== "GET") {
|
||||
throw new Error("XMLHttpRequest: Only GET method is supported");
|
||||
}
|
||||
|
||||
if (settings.async) {
|
||||
fs.readFile(url.pathname, "utf8", function(error, data) {
|
||||
if (error) {
|
||||
self.handleError(error);
|
||||
} else {
|
||||
self.status = 200;
|
||||
self.responseText = data;
|
||||
setState(self.DONE);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
try {
|
||||
this.responseText = fs.readFileSync(url.pathname, "utf8");
|
||||
this.status = 200;
|
||||
setState(self.DONE);
|
||||
} catch(e) {
|
||||
this.handleError(e);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Default to port 80. If accessing localhost on another port be sure
|
||||
// to use http://localhost:port/path
|
||||
var port = url.port || (ssl ? 443 : 80);
|
||||
// Add query string if one is used
|
||||
var uri = url.pathname + (url.search ? url.search : "");
|
||||
|
||||
// Set the defaults if they haven't been set
|
||||
for (var name in defaultHeaders) {
|
||||
if (!headersCase[name.toLowerCase()]) {
|
||||
headers[name] = defaultHeaders[name];
|
||||
}
|
||||
}
|
||||
|
||||
// Set the Host header or the server may reject the request
|
||||
headers.Host = host;
|
||||
if (!((ssl && port === 443) || port === 80)) {
|
||||
headers.Host += ":" + url.port;
|
||||
}
|
||||
|
||||
// Set Basic Auth if necessary
|
||||
if (settings.user) {
|
||||
if (typeof settings.password === "undefined") {
|
||||
settings.password = "";
|
||||
}
|
||||
var authBuf = new Buffer(settings.user + ":" + settings.password);
|
||||
headers.Authorization = "Basic " + authBuf.toString("base64");
|
||||
}
|
||||
|
||||
// Set content length header
|
||||
if (settings.method === "GET" || settings.method === "HEAD") {
|
||||
data = null;
|
||||
} else if (data) {
|
||||
headers["Content-Length"] = Buffer.isBuffer(data) ? data.length : Buffer.byteLength(data);
|
||||
|
||||
if (!headers["Content-Type"]) {
|
||||
headers["Content-Type"] = "text/plain;charset=UTF-8";
|
||||
}
|
||||
} else if (settings.method === "POST") {
|
||||
// For a post with no data set Content-Length: 0.
|
||||
// This is required by buggy servers that don't meet the specs.
|
||||
headers["Content-Length"] = 0;
|
||||
}
|
||||
|
||||
var options = {
|
||||
host: host,
|
||||
port: port,
|
||||
path: uri,
|
||||
method: settings.method,
|
||||
headers: headers,
|
||||
agent: false,
|
||||
withCredentials: self.withCredentials
|
||||
};
|
||||
|
||||
// Reset error flag
|
||||
errorFlag = false;
|
||||
|
||||
// Handle async requests
|
||||
if (settings.async) {
|
||||
// Use the proper protocol
|
||||
var doRequest = ssl ? https.request : http.request;
|
||||
|
||||
// Request is being sent, set send flag
|
||||
sendFlag = true;
|
||||
|
||||
// As per spec, this is called here for historical reasons.
|
||||
self.dispatchEvent("readystatechange");
|
||||
|
||||
// Handler for the response
|
||||
var responseHandler = function responseHandler(resp) {
|
||||
// Set response var to the response we got back
|
||||
// This is so it remains accessable outside this scope
|
||||
response = resp;
|
||||
// Check for redirect
|
||||
// @TODO Prevent looped redirects
|
||||
if (response.statusCode === 301 || response.statusCode === 302 || response.statusCode === 303 || response.statusCode === 307) {
|
||||
// Change URL to the redirect location
|
||||
settings.url = response.headers.location;
|
||||
var url = Url.parse(settings.url);
|
||||
// Set host var in case it's used later
|
||||
host = url.hostname;
|
||||
// Options for the new request
|
||||
var newOptions = {
|
||||
hostname: url.hostname,
|
||||
port: url.port,
|
||||
path: url.path,
|
||||
method: response.statusCode === 303 ? "GET" : settings.method,
|
||||
headers: headers,
|
||||
withCredentials: self.withCredentials
|
||||
};
|
||||
|
||||
// Issue the new request
|
||||
request = doRequest(newOptions, responseHandler).on("error", errorHandler);
|
||||
request.end();
|
||||
// @TODO Check if an XHR event needs to be fired here
|
||||
return;
|
||||
}
|
||||
|
||||
response.setEncoding("utf8");
|
||||
|
||||
setState(self.HEADERS_RECEIVED);
|
||||
self.status = response.statusCode;
|
||||
|
||||
response.on("data", function(chunk) {
|
||||
// Make sure there's some data
|
||||
if (chunk) {
|
||||
self.responseText += chunk;
|
||||
}
|
||||
// Don't emit state changes if the connection has been aborted.
|
||||
if (sendFlag) {
|
||||
setState(self.LOADING);
|
||||
}
|
||||
});
|
||||
|
||||
response.on("end", function() {
|
||||
if (sendFlag) {
|
||||
// Discard the end event if the connection has been aborted
|
||||
setState(self.DONE);
|
||||
sendFlag = false;
|
||||
}
|
||||
});
|
||||
|
||||
response.on("error", function(error) {
|
||||
self.handleError(error);
|
||||
});
|
||||
};
|
||||
|
||||
// Error handler for the request
|
||||
var errorHandler = function errorHandler(error) {
|
||||
self.handleError(error);
|
||||
};
|
||||
|
||||
// Create the request
|
||||
request = doRequest(options, responseHandler).on("error", errorHandler);
|
||||
|
||||
// Node 0.4 and later won't accept empty data. Make sure it's needed.
|
||||
if (data) {
|
||||
request.write(data);
|
||||
}
|
||||
|
||||
request.end();
|
||||
|
||||
self.dispatchEvent("loadstart");
|
||||
} else { // Synchronous
|
||||
// Create a temporary file for communication with the other Node process
|
||||
var contentFile = ".node-xmlhttprequest-content-" + process.pid;
|
||||
var syncFile = ".node-xmlhttprequest-sync-" + process.pid;
|
||||
fs.writeFileSync(syncFile, "", "utf8");
|
||||
// The async request the other Node process executes
|
||||
var execString = "var http = require('http'), https = require('https'), fs = require('fs');"
|
||||
+ "var doRequest = http" + (ssl ? "s" : "") + ".request;"
|
||||
+ "var options = " + JSON.stringify(options) + ";"
|
||||
+ "var responseText = '';"
|
||||
+ "var req = doRequest(options, function(response) {"
|
||||
+ "response.setEncoding('utf8');"
|
||||
+ "response.on('data', function(chunk) {"
|
||||
+ " responseText += chunk;"
|
||||
+ "});"
|
||||
+ "response.on('end', function() {"
|
||||
+ "fs.writeFileSync('" + contentFile + "', JSON.stringify({err: null, data: {statusCode: response.statusCode, headers: response.headers, text: responseText}}), 'utf8');"
|
||||
+ "fs.unlinkSync('" + syncFile + "');"
|
||||
+ "});"
|
||||
+ "response.on('error', function(error) {"
|
||||
+ "fs.writeFileSync('" + contentFile + "', JSON.stringify({err: error}), 'utf8');"
|
||||
+ "fs.unlinkSync('" + syncFile + "');"
|
||||
+ "});"
|
||||
+ "}).on('error', function(error) {"
|
||||
+ "fs.writeFileSync('" + contentFile + "', JSON.stringify({err: error}), 'utf8');"
|
||||
+ "fs.unlinkSync('" + syncFile + "');"
|
||||
+ "});"
|
||||
+ (data ? "req.write('" + JSON.stringify(data).slice(1,-1).replace(/'/g, "\\'") + "');":"")
|
||||
+ "req.end();";
|
||||
// Start the other Node Process, executing this string
|
||||
var syncProc = spawn(process.argv[0], ["-e", execString]);
|
||||
while(fs.existsSync(syncFile)) {
|
||||
// Wait while the sync file is empty
|
||||
}
|
||||
var resp = JSON.parse(fs.readFileSync(contentFile, 'utf8'));
|
||||
// Kill the child process once the file has data
|
||||
syncProc.stdin.end();
|
||||
// Remove the temporary file
|
||||
fs.unlinkSync(contentFile);
|
||||
|
||||
if (resp.err) {
|
||||
self.handleError(resp.err);
|
||||
} else {
|
||||
response = resp.data;
|
||||
self.status = resp.data.statusCode;
|
||||
self.responseText = resp.data.text;
|
||||
setState(self.DONE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Called when an error is encountered to deal with it.
|
||||
*/
|
||||
this.handleError = function(error) {
|
||||
this.status = 0;
|
||||
this.statusText = error;
|
||||
this.responseText = error.stack;
|
||||
errorFlag = true;
|
||||
setState(this.DONE);
|
||||
this.dispatchEvent('error');
|
||||
};
|
||||
|
||||
/**
|
||||
* Aborts a request.
|
||||
*/
|
||||
this.abort = function() {
|
||||
if (request) {
|
||||
request.abort();
|
||||
request = null;
|
||||
}
|
||||
|
||||
headers = defaultHeaders;
|
||||
this.status = 0;
|
||||
this.responseText = "";
|
||||
this.responseXML = "";
|
||||
|
||||
errorFlag = true;
|
||||
|
||||
if (this.readyState !== this.UNSENT
|
||||
&& (this.readyState !== this.OPENED || sendFlag)
|
||||
&& this.readyState !== this.DONE) {
|
||||
sendFlag = false;
|
||||
setState(this.DONE);
|
||||
}
|
||||
this.readyState = this.UNSENT;
|
||||
this.dispatchEvent('abort');
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds an event listener. Preferred method of binding to events.
|
||||
*/
|
||||
this.addEventListener = function(event, callback) {
|
||||
if (!(event in listeners)) {
|
||||
listeners[event] = [];
|
||||
}
|
||||
// Currently allows duplicate callbacks. Should it?
|
||||
listeners[event].push(callback);
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove an event callback that has already been bound.
|
||||
* Only works on the matching funciton, cannot be a copy.
|
||||
*/
|
||||
this.removeEventListener = function(event, callback) {
|
||||
if (event in listeners) {
|
||||
// Filter will return a new array with the callback removed
|
||||
listeners[event] = listeners[event].filter(function(ev) {
|
||||
return ev !== callback;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Dispatch any events, including both "on" methods and events attached using addEventListener.
|
||||
*/
|
||||
this.dispatchEvent = function(event) {
|
||||
if (typeof self["on" + event] === "function") {
|
||||
self["on" + event]();
|
||||
}
|
||||
if (event in listeners) {
|
||||
for (var i = 0, len = listeners[event].length; i < len; i++) {
|
||||
listeners[event][i].call(self);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Changes readyState and calls onreadystatechange.
|
||||
*
|
||||
* @param int state New state
|
||||
*/
|
||||
var setState = function(state) {
|
||||
if (state == self.LOADING || self.readyState !== state) {
|
||||
self.readyState = state;
|
||||
|
||||
if (settings.async || self.readyState < self.OPENED || self.readyState === self.DONE) {
|
||||
self.dispatchEvent("readystatechange");
|
||||
}
|
||||
|
||||
if (self.readyState === self.DONE && !errorFlag) {
|
||||
self.dispatchEvent("load");
|
||||
// @TODO figure out InspectorInstrumentation::didLoadXHR(cookie)
|
||||
self.dispatchEvent("loadend");
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "xmlhttprequest",
|
||||
"description": "XMLHttpRequest for Node",
|
||||
"version": "1.8.0",
|
||||
"author": {
|
||||
"name": "Dan DeFelippi",
|
||||
"url": "http://driverdan.com"
|
||||
},
|
||||
"keywords": ["xhr", "ajax"],
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/driverdan/node-XMLHttpRequest.git"
|
||||
},
|
||||
"bugs": "http://github.com/driverdan/node-XMLHttpRequest/issues",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "./lib",
|
||||
"example": "./example"
|
||||
},
|
||||
"main": "./lib/XMLHttpRequest.js"
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz"
|
||||
,"_integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw="
|
||||
,"_from": "xmlhttprequest@1.8.0"
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
"main": "index.js",
|
||||
"scripts": {
|
||||
"lint": "eslint index.js",
|
||||
"test": "eslint index.js && jest",
|
||||
"test": "jest",
|
||||
"build": "npm prune --production"
|
||||
},
|
||||
"repository": {
|
||||
|
|
Loading…
Reference in New Issue