@gasket/plugin-https-proxy 7.4.2 → 8.0.0-next.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/lib/index.js +2 -7
- package/package.json +7 -13
- package/cjs/actions.cjs +0 -39
- package/cjs/create.cjs +0 -19
- package/cjs/index.cjs +0 -64
- package/cjs/package.json +0 -1
- package/lib/create.js +0 -12
package/lib/index.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
/// <reference types="create-gasket-app" />
|
|
2
1
|
/// <reference types="@gasket/plugin-metadata" />
|
|
3
2
|
|
|
4
|
-
import create from './create.js';
|
|
5
3
|
import { actions } from './actions.js';
|
|
6
|
-
import
|
|
7
|
-
const
|
|
8
|
-
const pkgJson = require('../package.json');
|
|
9
|
-
const { name, version, description } = pkgJson;
|
|
4
|
+
import packageJson from '../package.json' with { type: 'json' };
|
|
5
|
+
const { name, version, description } = packageJson;
|
|
10
6
|
|
|
11
7
|
/** @type {import('@gasket/core').Plugin} */
|
|
12
8
|
export default {
|
|
@@ -15,7 +11,6 @@ export default {
|
|
|
15
11
|
description,
|
|
16
12
|
actions,
|
|
17
13
|
hooks: {
|
|
18
|
-
create,
|
|
19
14
|
metadata(gasket, meta) {
|
|
20
15
|
return {
|
|
21
16
|
...meta,
|
package/package.json
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gasket/plugin-https-proxy",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-next.1",
|
|
4
4
|
"description": "Adds support for running an https proxy",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"lib",
|
|
9
|
-
"cjs",
|
|
10
9
|
"EXAMPLES.md"
|
|
11
10
|
],
|
|
12
11
|
"exports": {
|
|
13
12
|
".": {
|
|
14
13
|
"types": "./lib/index.d.ts",
|
|
15
|
-
"import": "./lib/index.js"
|
|
16
|
-
"require": "./cjs/index.cjs",
|
|
17
|
-
"default": "./cjs/index.cjs"
|
|
14
|
+
"import": "./lib/index.js"
|
|
18
15
|
},
|
|
19
16
|
"./package.json": "./package.json"
|
|
20
17
|
},
|
|
@@ -37,16 +34,13 @@
|
|
|
37
34
|
},
|
|
38
35
|
"devDependencies": {
|
|
39
36
|
"vitest": "^3.2.0",
|
|
40
|
-
"@gasket/
|
|
41
|
-
"@gasket/
|
|
42
|
-
"@gasket/plugin-
|
|
43
|
-
"@gasket/plugin-
|
|
44
|
-
"
|
|
45
|
-
"create-gasket-app": "^7.4.13"
|
|
37
|
+
"@gasket/core": "^8.0.0-next.1",
|
|
38
|
+
"@gasket/plugin-https": "^8.0.0-next.1",
|
|
39
|
+
"@gasket/plugin-logger": "^8.0.0-next.1",
|
|
40
|
+
"@gasket/plugin-metadata": "^8.0.0-next.1",
|
|
41
|
+
"create-gasket-app": "^8.0.0-next.1"
|
|
46
42
|
},
|
|
47
43
|
"scripts": {
|
|
48
|
-
"build": "gasket-cjs ./lib",
|
|
49
|
-
"build:watch": "pnpm run build --watch",
|
|
50
44
|
"lint": "eslint .",
|
|
51
45
|
"lint:fix": "pnpm run lint --fix",
|
|
52
46
|
"posttest": "pnpm run lint && pnpm run typecheck",
|
package/cjs/actions.cjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2
|
-
value: true
|
|
3
|
-
});
|
|
4
|
-
function _export(target, all) {
|
|
5
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: all[name]
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
_export(exports, {
|
|
11
|
-
actions: function() {
|
|
12
|
-
return actions;
|
|
13
|
-
},
|
|
14
|
-
startProxyServer: function() {
|
|
15
|
-
return startProxyServer;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
const _httpproxy = /*#__PURE__*/ _interop_require_default(require("http-proxy"));
|
|
19
|
-
function _interop_require_default(obj) {
|
|
20
|
-
return obj && obj.__esModule ? obj : {
|
|
21
|
-
default: obj
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
async function startProxyServer(gasket) {
|
|
25
|
-
await gasket.isReady;
|
|
26
|
-
await gasket.exec('prebootHttpsProxy');
|
|
27
|
-
const { httpsProxy } = gasket.config;
|
|
28
|
-
const { logger } = gasket;
|
|
29
|
-
const opts = await gasket.execWaterfall('httpsProxy', httpsProxy);
|
|
30
|
-
const { protocol = 'http', hostname = 'localhost', port = 8080, ...proxyOpts } = opts;
|
|
31
|
-
const server = _httpproxy.default.createServer(proxyOpts).on('error', (err)=>{
|
|
32
|
-
logger.error('Request failed to proxy:', err);
|
|
33
|
-
}).listen(port);
|
|
34
|
-
logger.info(`Proxy server started: ${protocol}://${hostname}:${port}`);
|
|
35
|
-
return server;
|
|
36
|
-
}
|
|
37
|
-
const actions = {
|
|
38
|
-
startProxyServer
|
|
39
|
-
};
|
package/cjs/create.cjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2
|
-
value: true
|
|
3
|
-
});
|
|
4
|
-
Object.defineProperty(exports, /** @type {import('@gasket/core').HookHandler<'create'>} */ "default", {
|
|
5
|
-
enumerable: true,
|
|
6
|
-
get: function() {
|
|
7
|
-
return create;
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
const _module = require("module");
|
|
11
|
-
const require1 = (0, _module.createRequire)(require("url").pathToFileURL(__filename).toString());
|
|
12
|
-
const pkgJson = require1('../package.json');
|
|
13
|
-
const { name, version } = pkgJson;
|
|
14
|
-
function create(gasket, { pkg, gasketConfig }) {
|
|
15
|
-
gasketConfig.addPlugin('pluginHttpsProxy', name);
|
|
16
|
-
pkg.add('dependencies', {
|
|
17
|
-
[name]: `^${version}`
|
|
18
|
-
});
|
|
19
|
-
}
|
package/cjs/index.cjs
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/// <reference types="create-gasket-app" />
|
|
2
|
-
/// <reference types="@gasket/plugin-metadata" />
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, /** @type {import('@gasket/core').Plugin} */ "default", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function() {
|
|
9
|
-
return _default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
const _create = /*#__PURE__*/ _interop_require_default(require("./create.cjs"));
|
|
13
|
-
const _actions = require("./actions.cjs");
|
|
14
|
-
const _module = require("module");
|
|
15
|
-
function _interop_require_default(obj) {
|
|
16
|
-
return obj && obj.__esModule ? obj : {
|
|
17
|
-
default: obj
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
const require1 = (0, _module.createRequire)(require("url").pathToFileURL(__filename).toString());
|
|
21
|
-
const pkgJson = require1('../package.json');
|
|
22
|
-
const { name, version, description } = pkgJson;
|
|
23
|
-
const _default = {
|
|
24
|
-
name,
|
|
25
|
-
version,
|
|
26
|
-
description,
|
|
27
|
-
actions: _actions.actions,
|
|
28
|
-
hooks: {
|
|
29
|
-
create: _create.default,
|
|
30
|
-
metadata (gasket, meta) {
|
|
31
|
-
return {
|
|
32
|
-
...meta,
|
|
33
|
-
actions: [
|
|
34
|
-
{
|
|
35
|
-
name: 'startProxyServer',
|
|
36
|
-
description: 'Start the proxy server',
|
|
37
|
-
link: 'README.md#startProxyServer'
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
lifecycles: [
|
|
41
|
-
{
|
|
42
|
-
name: 'prebootHttpsProxy',
|
|
43
|
-
description: 'Executed before the proxy server is started.',
|
|
44
|
-
link: 'README.md#prebootHttpsProxy'
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: 'httpsProxy',
|
|
48
|
-
method: 'execWaterfall',
|
|
49
|
-
description: 'Setup the httpsProxy options',
|
|
50
|
-
link: 'README.md#httpsProxy'
|
|
51
|
-
}
|
|
52
|
-
],
|
|
53
|
-
configurations: [
|
|
54
|
-
{
|
|
55
|
-
name: 'httpsProxy',
|
|
56
|
-
link: 'README.md#configuration',
|
|
57
|
-
description: 'http-proxy config object',
|
|
58
|
-
type: 'object'
|
|
59
|
-
}
|
|
60
|
-
]
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
};
|
package/cjs/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
package/lib/create.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module';
|
|
2
|
-
const require = createRequire(import.meta.url);
|
|
3
|
-
const pkgJson = require('../package.json');
|
|
4
|
-
const { name, version } = pkgJson;
|
|
5
|
-
|
|
6
|
-
/** @type {import('@gasket/core').HookHandler<'create'>} */
|
|
7
|
-
export default function create(gasket, { pkg, gasketConfig }) {
|
|
8
|
-
gasketConfig.addPlugin('pluginHttpsProxy', name);
|
|
9
|
-
pkg.add('dependencies', {
|
|
10
|
-
[name]: `^${version}`
|
|
11
|
-
});
|
|
12
|
-
}
|