@faasjs/load 0.0.3-beta.85 → 0.0.3-beta.87
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/dist/index.d.mts +63 -0
- package/dist/index.js +6 -0
- package/dist/index.mjs +7 -1
- package/package.json +5 -5
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Config as Config$1, Func } from '@faasjs/func';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 配置类
|
|
5
|
+
*/
|
|
6
|
+
declare class Config {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
readonly root: string;
|
|
9
|
+
readonly filename: string;
|
|
10
|
+
readonly origin: {
|
|
11
|
+
[key: string]: Config$1;
|
|
12
|
+
defaults: Config$1;
|
|
13
|
+
};
|
|
14
|
+
readonly defaults: Config$1;
|
|
15
|
+
/**
|
|
16
|
+
* 创建配置类,并自动读取配置内容
|
|
17
|
+
*
|
|
18
|
+
* @param root {string} 根目录
|
|
19
|
+
* @param filename {filename} 目标文件,用于读取目录层级
|
|
20
|
+
*/
|
|
21
|
+
constructor(root: string, filename: string);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 加载配置
|
|
25
|
+
* @param root {string} 根目录
|
|
26
|
+
* @param filename {filename} 目标文件,用于读取目录层级
|
|
27
|
+
*/
|
|
28
|
+
declare function loadConfig(root: string, filename: string): Config;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 加载 ts 文件
|
|
32
|
+
*
|
|
33
|
+
* @param filename {string} 完整源文件路径
|
|
34
|
+
* @param options {object} 配置项
|
|
35
|
+
* @param options.input {object} 读取配置
|
|
36
|
+
* @param options.output {object} 写入配置
|
|
37
|
+
* @param options.tmp {boolean} 是否为临时文件,true 则生成的文件会被删除,默认为 false
|
|
38
|
+
* @param options.modules {object} 生成 modules 的配置
|
|
39
|
+
* @param options.modules.excludes {string[]} modules 中需排除的模块
|
|
40
|
+
*/
|
|
41
|
+
declare function loadTs(filename: string, options?: {
|
|
42
|
+
input?: {
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
output?: {
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
};
|
|
48
|
+
tmp?: boolean;
|
|
49
|
+
modules?: {
|
|
50
|
+
excludes?: string[];
|
|
51
|
+
additions?: string[];
|
|
52
|
+
};
|
|
53
|
+
}): Promise<{
|
|
54
|
+
module?: Func;
|
|
55
|
+
dependencies: {
|
|
56
|
+
[key: string]: string;
|
|
57
|
+
};
|
|
58
|
+
modules?: {
|
|
59
|
+
[key: string]: string;
|
|
60
|
+
};
|
|
61
|
+
}>;
|
|
62
|
+
|
|
63
|
+
export { loadConfig, loadTs };
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,12 @@ var import_fs = require("fs");
|
|
|
31
31
|
var import_path = require("path");
|
|
32
32
|
var import_js_yaml = require("js-yaml");
|
|
33
33
|
var Config = class {
|
|
34
|
+
/**
|
|
35
|
+
* 创建配置类,并自动读取配置内容
|
|
36
|
+
*
|
|
37
|
+
* @param root {string} 根目录
|
|
38
|
+
* @param filename {filename} 目标文件,用于读取目录层级
|
|
39
|
+
*/
|
|
34
40
|
constructor(root, filename) {
|
|
35
41
|
this.root = root;
|
|
36
42
|
if (!this.root.endsWith(import_path.sep))
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
3
3
|
}) : x)(function(x) {
|
|
4
4
|
if (typeof require !== "undefined")
|
|
5
5
|
return require.apply(this, arguments);
|
|
6
|
-
throw
|
|
6
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
// src/load_config.ts
|
|
@@ -16,6 +16,12 @@ import {
|
|
|
16
16
|
} from "path";
|
|
17
17
|
import { load } from "js-yaml";
|
|
18
18
|
var Config = class {
|
|
19
|
+
/**
|
|
20
|
+
* 创建配置类,并自动读取配置内容
|
|
21
|
+
*
|
|
22
|
+
* @param root {string} 根目录
|
|
23
|
+
* @param filename {filename} 目标文件,用于读取目录层级
|
|
24
|
+
*/
|
|
19
25
|
constructor(root, filename) {
|
|
20
26
|
this.root = root;
|
|
21
27
|
if (!this.root.endsWith(sep))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/load",
|
|
3
|
-
"version": "0.0.3-beta.
|
|
3
|
+
"version": "0.0.3-beta.87",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
},
|
|
16
16
|
"funding": "https://github.com/sponsors/faasjs",
|
|
17
17
|
"scripts": {
|
|
18
|
-
"build": "tsup-node src/index.ts --
|
|
18
|
+
"build": "tsup-node src/index.ts --config ../../tsup.config.json"
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@faasjs/deep_merge": "^0.0.3-beta.
|
|
25
|
-
"@faasjs/func": "^0.0.3-beta.
|
|
26
|
-
"@faasjs/ts-transform": "^0.0.3-beta.
|
|
24
|
+
"@faasjs/deep_merge": "^0.0.3-beta.87",
|
|
25
|
+
"@faasjs/func": "^0.0.3-beta.87",
|
|
26
|
+
"@faasjs/ts-transform": "^0.0.3-beta.87",
|
|
27
27
|
"js-yaml": "*",
|
|
28
28
|
"rollup": "*"
|
|
29
29
|
},
|