@serverless-devs/load-component 0.0.1-beta.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/LICENSE +21 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +62 -0
- package/lib/index.js.map +1 -0
- package/lib/utils/index.d.ts +6 -0
- package/lib/utils/index.js +120 -0
- package/lib/utils/index.js.map +1 -0
- package/package.json +29 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Serverless Devs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
16
|
+
const utils_1 = require("./utils");
|
|
17
|
+
const downloads_1 = __importDefault(require("@serverless-devs/downloads"));
|
|
18
|
+
const debug = require('@serverless-cd/debug')('serverless-devs:load-component');
|
|
19
|
+
class Componet {
|
|
20
|
+
constructor(name, params) {
|
|
21
|
+
this.name = name;
|
|
22
|
+
this.params = params;
|
|
23
|
+
}
|
|
24
|
+
run() {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
// 本地路径
|
|
27
|
+
if (fs_extra_1.default.existsSync(this.name)) {
|
|
28
|
+
return yield (0, utils_1.buildComponentInstance)(this.name, this.params);
|
|
29
|
+
}
|
|
30
|
+
return yield this.getComponent();
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
// devs源
|
|
34
|
+
getComponent() {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const [provider, componentName, componentVersion] = (0, utils_1.getProvider)(this.name);
|
|
37
|
+
debug(`provider: ${provider}, componentName: ${componentName}, componentVersion: ${componentVersion}`);
|
|
38
|
+
const componentCachePath = (0, utils_1.getComponentCachePath)(provider, componentName, componentVersion);
|
|
39
|
+
debug(`componentCachePath: ${componentCachePath}`);
|
|
40
|
+
const lockPath = (0, utils_1.getLockFile)(componentCachePath);
|
|
41
|
+
if (fs_extra_1.default.existsSync(lockPath))
|
|
42
|
+
return yield (0, utils_1.buildComponentInstance)(componentCachePath, this.params);
|
|
43
|
+
const zipballUrl = yield (0, utils_1.getZipballUrl)(provider, componentName, componentVersion);
|
|
44
|
+
debug(`zipballUrl: ${zipballUrl}`);
|
|
45
|
+
yield (0, downloads_1.default)(zipballUrl, {
|
|
46
|
+
dest: componentCachePath,
|
|
47
|
+
filename: componentVersion
|
|
48
|
+
? `${provider}_${componentName}@${componentVersion}.zip`
|
|
49
|
+
: `${provider}_${componentName}.zip`,
|
|
50
|
+
extract: true,
|
|
51
|
+
strip: 1,
|
|
52
|
+
});
|
|
53
|
+
fs_extra_1.default.writeFileSync(lockPath, JSON.stringify({ version: componentVersion }, null, 2));
|
|
54
|
+
return yield (0, utils_1.buildComponentInstance)(componentCachePath, this.params);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const loadComponent = (name, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
return yield new Componet(name, params).run();
|
|
60
|
+
});
|
|
61
|
+
exports.default = loadComponent;
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,wDAA0B;AAC1B,mCAMiB;AACjB,2EAAkD;AAClD,MAAM,KAAK,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC,gCAAgC,CAAC,CAAC;AAEhF,MAAM,QAAQ;IACZ,YAAoB,IAAY,EAAU,MAA4B;QAAlD,SAAI,G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AAa,MAAM;gBACtC,OAAO,EAAE,IAAI;gBACb,KAAK,EAAE,CAAC;aACT,CAAC,CAAC;YACH,kBAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YACnF,OAAO,MAAM,IAAA,8BAAsB,EAAC,kBAAkB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACvE,CAAC;KAAA;CACF;AAED,MAAM,aAAa,GAAG,CAAO,IAAY,EAAE,MAA4B,EAAE,EAAE;IACzE,OAAO,MAAM,IAAI,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC;AAChD,CAAC,CAAA,CAAC;AAEF,kBAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function readJsonFile(filePath: string): any;
|
|
2
|
+
export declare const buildComponentInstance: (componentPath: string, params?: any) => Promise<any>;
|
|
3
|
+
export declare function getProvider(name: string): any[];
|
|
4
|
+
export declare const getZipballUrl: (provider: string, componentName: string, componentVersion: string) => Promise<any>;
|
|
5
|
+
export declare const getComponentCachePath: (provider: string, componentName: string, componentVersion: string) => string;
|
|
6
|
+
export declare const getLockFile: (basePath: string) => string;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getLockFile = exports.getComponentCachePath = exports.getZipballUrl = exports.getProvider = exports.buildComponentInstance = exports.readJsonFile = void 0;
|
|
16
|
+
const path_1 = __importDefault(require("path"));
|
|
17
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
18
|
+
const lodash_1 = require("lodash");
|
|
19
|
+
const axios_1 = __importDefault(require("axios"));
|
|
20
|
+
const utils_1 = require("@serverless-devs/utils");
|
|
21
|
+
const debug = require('@serverless-cd/debug')('serverless-devs:load-component');
|
|
22
|
+
function readJsonFile(filePath) {
|
|
23
|
+
if (fs_extra_1.default.existsSync(filePath)) {
|
|
24
|
+
const data = fs_extra_1.default.readFileSync(filePath, 'utf8');
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(data);
|
|
27
|
+
}
|
|
28
|
+
catch (error) { }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.readJsonFile = readJsonFile;
|
|
32
|
+
const getEntryFile = (componentPath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
const fsStat = yield fs_extra_1.default.stat(componentPath);
|
|
34
|
+
if (fsStat.isFile() || !fsStat.isDirectory())
|
|
35
|
+
return componentPath;
|
|
36
|
+
const packageInfo = readJsonFile(path_1.default.resolve(componentPath, 'package.json'));
|
|
37
|
+
// First look for main under the package json file
|
|
38
|
+
let entry = (0, lodash_1.get)(packageInfo, 'main');
|
|
39
|
+
if (entry)
|
|
40
|
+
return path_1.default.resolve(componentPath, entry);
|
|
41
|
+
// Second check the out dir under the tsconfig json file
|
|
42
|
+
const tsconfigPath = path_1.default.resolve(componentPath, 'tsconfig.json');
|
|
43
|
+
const tsconfigInfo = readJsonFile(tsconfigPath);
|
|
44
|
+
entry = (0, lodash_1.get)(tsconfigInfo, 'compilerOptions.outDir');
|
|
45
|
+
if (entry)
|
|
46
|
+
return path_1.default.resolve(componentPath, entry);
|
|
47
|
+
// Third look for src index js
|
|
48
|
+
const srcIndexPath = path_1.default.resolve(componentPath, './src/index.js');
|
|
49
|
+
if (fs_extra_1.default.existsSync(srcIndexPath))
|
|
50
|
+
return srcIndexPath;
|
|
51
|
+
const indexPath = path_1.default.resolve(componentPath, './index.js');
|
|
52
|
+
if (fs_extra_1.default.existsSync(indexPath))
|
|
53
|
+
return indexPath;
|
|
54
|
+
throw new Error('The component cannot be required. Please check whether the setting of the component entry file is correct. In the current directory, first look for main under the package json file, secondly look for compiler options out dir under the tsconfig json file, thirdly look for src index js, and finally look for index js');
|
|
55
|
+
});
|
|
56
|
+
const buildComponentInstance = (componentPath, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
+
const requirePath = yield getEntryFile(componentPath);
|
|
58
|
+
const baseChildComponent = yield require(requirePath);
|
|
59
|
+
const ChildComponent = baseChildComponent.default || baseChildComponent;
|
|
60
|
+
try {
|
|
61
|
+
const componentInstance = new ChildComponent(params);
|
|
62
|
+
if (componentInstance) {
|
|
63
|
+
componentInstance.__path = componentPath;
|
|
64
|
+
}
|
|
65
|
+
return componentInstance;
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
return ChildComponent;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
exports.buildComponentInstance = buildComponentInstance;
|
|
72
|
+
function getProvider(name) {
|
|
73
|
+
const [provider, component] = (0, lodash_1.includes)(name, '/') ? (0, lodash_1.split)(name, '/') : [null, name];
|
|
74
|
+
const [componentName, componentVersion] = (0, lodash_1.split)(component, '@');
|
|
75
|
+
const { core_load_serverless_devs_component } = process.env;
|
|
76
|
+
if (core_load_serverless_devs_component) {
|
|
77
|
+
const componentList = (0, lodash_1.filter)((0, lodash_1.split)(core_load_serverless_devs_component, ';'), (v) => (0, lodash_1.includes)(v, '@'));
|
|
78
|
+
const componentNames = [];
|
|
79
|
+
const obj = {};
|
|
80
|
+
for (const item of componentList) {
|
|
81
|
+
const [n, v] = (0, lodash_1.split)(item, '@');
|
|
82
|
+
componentNames.push(n);
|
|
83
|
+
obj[n] = v;
|
|
84
|
+
}
|
|
85
|
+
const key = provider ? `${provider}/${componentName}` : componentName;
|
|
86
|
+
if ((0, lodash_1.find)(componentNames, (v) => v === key)) {
|
|
87
|
+
return [provider, componentName, obj[key]];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return [provider, componentName, componentVersion];
|
|
91
|
+
}
|
|
92
|
+
exports.getProvider = getProvider;
|
|
93
|
+
const getZipballUrl = (provider, componentName, componentVersion) => __awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
+
const base = provider
|
|
95
|
+
? `http://registry.devsapp.cn/simple/${provider}/${componentName}/releases`
|
|
96
|
+
: `http://registry.devsapp.cn/simple/${componentName}/releases`;
|
|
97
|
+
const url = componentVersion ? base : `${base}/latest`;
|
|
98
|
+
debug(`url: ${url}`);
|
|
99
|
+
const response = yield axios_1.default.get(url);
|
|
100
|
+
const data = (0, lodash_1.get)(response, 'data.Response');
|
|
101
|
+
let zipball_url = (0, lodash_1.get)(data, 'zipball_url');
|
|
102
|
+
if (componentVersion) {
|
|
103
|
+
const obj = (0, lodash_1.find)(data, (v) => v.tag_name === componentVersion);
|
|
104
|
+
zipball_url = (0, lodash_1.get)(obj, 'zipball_url');
|
|
105
|
+
}
|
|
106
|
+
if ((0, lodash_1.isEmpty)(zipball_url))
|
|
107
|
+
throw new Error(`url: ${url} is not found`);
|
|
108
|
+
return zipball_url;
|
|
109
|
+
});
|
|
110
|
+
exports.getZipballUrl = getZipballUrl;
|
|
111
|
+
const getComponentCachePath = (provider, componentName, componentVersion) => {
|
|
112
|
+
if (provider) {
|
|
113
|
+
return path_1.default.join((0, utils_1.getRootHome)(), 'components', 'devsapp.cn', provider, componentVersion ? `${componentName}@${componentVersion}` : componentName);
|
|
114
|
+
}
|
|
115
|
+
return path_1.default.join((0, utils_1.getRootHome)(), 'components', 'devsapp.cn', componentVersion ? `${componentName}@${componentVersion}` : componentName);
|
|
116
|
+
};
|
|
117
|
+
exports.getComponentCachePath = getComponentCachePath;
|
|
118
|
+
const getLockFile = (basePath) => path_1.default.join(basePath, '.s.lock');
|
|
119
|
+
exports.getLockFile = getLockFile;
|
|
120
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AACxB,wDAA0B;AAC1B,mCAA0E;AAC1E,kDAA0B;AAC1B,kDAAqD;AAErD,MAAM,KAAK,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC,gCAAgC,CAAC,CAAC;AAEhF,SAAgB,YAAY,CAAC,QAAgB;IAC3C,IAAI,kBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC3B,MAAM,IAAI,GAAG,kBAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC/C,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SACzB;QAAC,OAAO,KAAK,EAAE,GAAE;KACnB;AACH,CAAC;AAPD,oCAOC;AAED,MAAM,YAAY,GAAG,CAAO,aAAqB,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,MAAM,kBAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC5C,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE;QAAE,OAAO,aAAa,CAAC;IACnE,MAAM,WAAW,GAAQ,YAAY,CAAC,cAAI,CAAC,OAAO,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC;IACnF,kDAAkD;IAClD,IAAI,KAAK,GAAG,IAAA,Y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,QAAgB,EAChB,aAAqB,EACrB,gBAAwB,EACxB,EAAE;IACF,IAAI,QAAQ,EAAE;QACZ,OAAO,cAAI,CAAC,IAAI,CACd,IAAA,mBAAW,GAAE,EACb,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,gBAAgB,CAAC,CAAC,CAAC,GAAG,aAAa,IAAI,gBAAgB,EAAE,CAAC,CAAC,CAAC,aAAa,CAC1E,CAAC;KACH;IACD,OAAO,cAAI,CAAC,IAAI,CACd,IAAA,mBAAW,GAAE,EACb,YAAY,EACZ,YAAY,EACZ,gBAAgB,CAAC,CAAC,CAAC,GAAG,aAAa,IAAI,gBAAgB,EAAE,CAAC,CAAC,CAAC,aAAa,CAC1E,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,qBAAqB,yBAoBhC;AAEK,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAAnE,QAAA,WAAW,eAAwD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@serverless-devs/load-component",
|
|
3
|
+
"version": "0.0.1-beta.1",
|
|
4
|
+
"description": "request for serverless-devs",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"author": "xsahxl",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"registry": "https://registry.npmjs.org",
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@serverless-cd/debug": "^4.3.4",
|
|
14
|
+
"axios": "^1.4.0",
|
|
15
|
+
"fs-extra": "^11.1.0",
|
|
16
|
+
"lodash": "^4.17.21",
|
|
17
|
+
"@serverless-devs/downloads": "^0.0.1",
|
|
18
|
+
"@serverless-devs/utils": "^0.0.7"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/fs-extra": "^11.0.1",
|
|
22
|
+
"@types/lodash": "^4.14.195"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"clean": "rimraf lib node_modules",
|
|
26
|
+
"build": "tsc",
|
|
27
|
+
"watch": "tsc -w"
|
|
28
|
+
}
|
|
29
|
+
}
|