@makano/rew 1.2.46 → 1.2.51
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/jsconfig.json +13 -0
- package/lib/rew/cli/utils.js +45 -24
- package/lib/rew/const/opt.js +1 -1
- package/lib/rew/functions/import.js +19 -3
- package/lib/rew/modules/compiler.js +12 -1
- package/lib/rew/pkgs/conf.js +1 -1
- package/package.json +3 -1
- package/runtime.d.ts +374 -0
package/jsconfig.json
ADDED
package/lib/rew/cli/utils.js
CHANGED
|
@@ -64,15 +64,19 @@ module.exports = {
|
|
|
64
64
|
if (!fullPath || fullPath == 'list') {
|
|
65
65
|
return fs.readdirSync(con.CONFIG_PATH).join('\n');
|
|
66
66
|
} else {
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
let name = fullPath.indexOf('/') ? fullPath.split('/')[0] : fullPath;
|
|
68
|
+
let dpath = fullPath.indexOf('/') ? fullPath.split('/').slice(1).join('/') : '';
|
|
69
|
+
if(fullPath.startsWith('/')){
|
|
70
|
+
dpath = name;
|
|
71
|
+
name = '';
|
|
72
|
+
}
|
|
69
73
|
const root = con.create(name);
|
|
70
74
|
if (dpath) {
|
|
71
75
|
const fp = path.join(root.root, dpath);
|
|
72
|
-
if (fs.existsSync(fp) && fs.statSync(fp).isDirectory()) {
|
|
76
|
+
if (!fullPath.startsWith('/') && fs.existsSync(fp) && fs.statSync(fp).isDirectory()) {
|
|
73
77
|
return fs.readdirSync(fp).join('\n');
|
|
74
78
|
} else {
|
|
75
|
-
const o =
|
|
79
|
+
const o = dpath && dpath !== '/' ? root.optionCenter(dpath) : root.optionCenter('_default');
|
|
76
80
|
return key ? o.get(key) : o.getAll(true);
|
|
77
81
|
}
|
|
78
82
|
} else {
|
|
@@ -80,14 +84,18 @@ module.exports = {
|
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
86
|
} else {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if
|
|
87
|
+
let name = fullPath.indexOf('/') ? fullPath.split('/')[0] : fullPath;
|
|
88
|
+
let dpath = fullPath.indexOf('/') ? fullPath.split('/')[1] : '';
|
|
89
|
+
if(fullPath.startsWith('/')){
|
|
90
|
+
dpath = name == '/' ? '_default' : name;
|
|
91
|
+
name = '';
|
|
92
|
+
}
|
|
93
|
+
if (key) {
|
|
86
94
|
const root = con.create(name);
|
|
87
95
|
const o = dpath ? root.optionCenter(dpath) : root;
|
|
88
96
|
if (command == 'set') {
|
|
89
97
|
if (value) {
|
|
90
|
-
o.set(key, value);
|
|
98
|
+
o.set(key, value == 'false' || value == 'true' ? (value == 'true' ? true : false) : !isNaN(parseFloat(value)) ? parseFloat(value) : value);
|
|
91
99
|
} else {
|
|
92
100
|
log('Value not specified', ':end');
|
|
93
101
|
}
|
|
@@ -95,7 +103,7 @@ module.exports = {
|
|
|
95
103
|
o.remove(key);
|
|
96
104
|
}
|
|
97
105
|
} else {
|
|
98
|
-
log(
|
|
106
|
+
log('Key not specified', ':end');
|
|
99
107
|
}
|
|
100
108
|
}
|
|
101
109
|
},
|
|
@@ -118,6 +126,10 @@ module.exports = {
|
|
|
118
126
|
fs.writeFileSync(path.join(projectPath, '.gitignore'), `node_modules/\npackage-lock.json`);
|
|
119
127
|
execSync('cd ' + projectPath + ' && git init . && git branch -m main', { stdio: 'ignore' });
|
|
120
128
|
}
|
|
129
|
+
if(project.intellisense){
|
|
130
|
+
fs.copyFileSync(path.join(__dirname, '../../../jsconfig.json'), path.join(projectPath, 'jsconfig.json'));
|
|
131
|
+
fs.copyFileSync(path.join(__dirname, '../../../runtime.d.ts'), path.join(projectPath, 'runtime.d.ts'));
|
|
132
|
+
}
|
|
121
133
|
execSync('cd ' + projectPath + ' && npm init -y', { stdio: 'ignore' });
|
|
122
134
|
// log('Installing '+npm_package_name);
|
|
123
135
|
// exec('cd '+projectPath+' && npm i '+npm_package_name, (err) => {
|
|
@@ -135,9 +147,12 @@ module.exports = {
|
|
|
135
147
|
rl.question(logget(' Package Name: '.blue), (pkg) => {
|
|
136
148
|
if (pkg.trim()) {
|
|
137
149
|
project.package = pkg.trim();
|
|
138
|
-
rl.question(logget('
|
|
139
|
-
project.
|
|
140
|
-
|
|
150
|
+
rl.question(logget(' Use intellisense declarations ? (y/N): '.magenta.bold), (inteli) => {
|
|
151
|
+
project.intellisense = inteli.toLowerCase() == 'y' || inteli.toLowerCase() == 'yes';
|
|
152
|
+
rl.question(logget(' Use git ? (y/N): '.yellow.bold), (use_git) => {
|
|
153
|
+
project.git = use_git.toLowerCase() == 'y' || use_git.toLowerCase() == 'yes';
|
|
154
|
+
create();
|
|
155
|
+
});
|
|
141
156
|
});
|
|
142
157
|
} else {
|
|
143
158
|
rl.close();
|
|
@@ -222,7 +237,6 @@ module.exports = {
|
|
|
222
237
|
}
|
|
223
238
|
execSync(`cp -r ${apppath} ${installPath}`);
|
|
224
239
|
execSync(`chmod 444 ${installPath}/app.yaml`);
|
|
225
|
-
log(' Installed '.green + pname.cyan.bold, ':end');
|
|
226
240
|
if (c.install) {
|
|
227
241
|
if (c.install.commands) {
|
|
228
242
|
for (let command of c.install.commands) {
|
|
@@ -231,7 +245,7 @@ module.exports = {
|
|
|
231
245
|
} catch(e){
|
|
232
246
|
const logFile = path.join(logspath, 'logs-'+Date.now()+'.log');
|
|
233
247
|
fs.writeFileSync(logFile, e.toString() +'\n'+ e.stack);
|
|
234
|
-
log(` Command Failed: ${command}, check logs at ${logFile}
|
|
248
|
+
log(` Command Failed: ${command}, check logs at ${logFile}`);
|
|
235
249
|
}
|
|
236
250
|
}
|
|
237
251
|
}
|
|
@@ -243,18 +257,25 @@ module.exports = {
|
|
|
243
257
|
}
|
|
244
258
|
if (c.install.exec) {
|
|
245
259
|
// this.installReq(c);
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
260
|
+
if(conf({}).create('').get('executables') == false){
|
|
261
|
+
log(' Ignoring executables'.blue);
|
|
262
|
+
} else {
|
|
263
|
+
for (let i in c.install.exec) {
|
|
264
|
+
let iff = c.install.exec[i];
|
|
265
|
+
if (iff in c.exec) iff = c.exec[iff];
|
|
266
|
+
const file = path.join(installPath, iff);
|
|
267
|
+
const filepath = path.join(binpath, i);
|
|
268
|
+
const binfp = path.join(localBinPath, i);
|
|
269
|
+
if (!fs.existsSync(localBinPath)) fs.mkdirSync(localBinPath, { recursive: true });
|
|
270
|
+
fs.writeFileSync(filepath, `#!/usr/bin/env bash\n#@app.${pname}\nrew ${file} $*`);
|
|
271
|
+
fs.chmodSync(filepath, '755');
|
|
272
|
+
if(fs.existsSync(binfp)) fs.unlinkSync(binfp);
|
|
273
|
+
fs.linkSync(filepath, binfp);
|
|
274
|
+
}
|
|
256
275
|
}
|
|
257
276
|
}
|
|
277
|
+
|
|
278
|
+
log(' Installed '.green + pname.cyan.bold, ':end');
|
|
258
279
|
}
|
|
259
280
|
rl.close();
|
|
260
281
|
} else {
|
package/lib/rew/const/opt.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const execOptions = {
|
|
2
2
|
sharedContext: true,
|
|
3
|
-
resolveExtensions: [{ ext: '.js', options: { type: 'js' } }, { ext: '.qrew', options: { qrew: true } }
|
|
3
|
+
resolveExtensions: ['.coffee', { ext: '.js', options: { type: 'js' } }, { ext: '.qrew', options: { qrew: true } }],
|
|
4
4
|
nativeRequire: false,
|
|
5
5
|
cwdAlias: '$',
|
|
6
6
|
jsxPragma: 'createElement',
|
|
@@ -57,7 +57,7 @@ module.exports.imp = function (runPath, context) {
|
|
|
57
57
|
exports = foundCache.exports;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
if (!ispkg && !existsSync(filepath)) {
|
|
60
|
+
if (!ispkg && !existsSync(filepath) && !foundCache) {
|
|
61
61
|
if (Array.isArray(execOptions.resolveExtensions) && execOptions.resolveExtensions.length) {
|
|
62
62
|
const resolve = execOptions.resolveExtensions.find((ext) =>
|
|
63
63
|
typeof ext == 'string' ? existsSync(filepath + ext) : existsSync(filepath + (ext.ext || '')),
|
|
@@ -119,8 +119,24 @@ module.exports.imp = function (runPath, context) {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
// Hehe, i just had an idea for a
|
|
123
|
+
// descriptive code
|
|
124
|
+
// you put them in comment blocks
|
|
125
|
+
// and name it something
|
|
126
|
+
// then you can simple see
|
|
127
|
+
// which part of a code contains a certain
|
|
128
|
+
// task. cool right?
|
|
129
|
+
|
|
130
|
+
//** If is not package, post exec section
|
|
131
|
+
/**/ if (!ispkg) context.module.imports.push(filepath);
|
|
132
|
+
/**/ if (!ispkg) cachedFiles.push({ filepath, exports });
|
|
133
|
+
//**
|
|
134
|
+
|
|
135
|
+
//** Mock imports section
|
|
136
|
+
/**/ if(!exports) exports = options.mock;
|
|
137
|
+
/**/ if(options.mock == null) return null;
|
|
138
|
+
/**/ if(!exports) throw new Error('Import '+filename+' does not export anything. Use the "mock" option to mock a value.');
|
|
139
|
+
//**
|
|
124
140
|
|
|
125
141
|
return exports;
|
|
126
142
|
};
|
|
@@ -154,6 +154,10 @@ function compileRewStuff(content, options) {
|
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
if (token.type === 'IDENTIFIER' && token.value === 'export') {
|
|
158
|
+
token.value = 'pub';
|
|
159
|
+
}
|
|
160
|
+
|
|
157
161
|
if (token.type === 'IDENTIFIER' && token.value === 'import') {
|
|
158
162
|
// console.log(nextToken.type);
|
|
159
163
|
let ind = i + n + 2;
|
|
@@ -222,9 +226,16 @@ function compileRewStuff(content, options) {
|
|
|
222
226
|
nextToken.value &&
|
|
223
227
|
nextToken.value !== 'undefined'
|
|
224
228
|
) {
|
|
229
|
+
let next = {...nextToken};
|
|
230
|
+
if(next.value == 'default'){
|
|
231
|
+
i += 2;
|
|
232
|
+
}
|
|
233
|
+
if(next.value == 'class'){
|
|
234
|
+
next.value = gnextToken(i, n + 1, tokens)?.token.value || "default";
|
|
235
|
+
}
|
|
225
236
|
hooks.push({
|
|
226
237
|
index: i + 1,
|
|
227
|
-
value: `"${
|
|
238
|
+
value: `"${next.value}", `,
|
|
228
239
|
});
|
|
229
240
|
}
|
|
230
241
|
|
package/lib/rew/pkgs/conf.js
CHANGED
|
@@ -82,7 +82,7 @@ module.exports = (context) => ({
|
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
return {
|
|
85
|
-
get: (key, defaultValue) => getData(optionCenter, key)
|
|
85
|
+
get: (key, defaultValue) => getData(optionCenter, key) ?? defaultValue,
|
|
86
86
|
set: (key, value) => setData(optionCenter, key, value),
|
|
87
87
|
remove: (key) => removeData(optionCenter, key),
|
|
88
88
|
reset: () => fs.writeFileSync(optionCenter.root, dumpYaml(defaults)) && (conf[name] = defaults),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makano/rew",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.51",
|
|
4
4
|
"description": "A simple coffescript runtime and app manager",
|
|
5
5
|
"main": "main.js",
|
|
6
6
|
"directories": {
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"lib/",
|
|
14
|
+
"runtime.d.ts",
|
|
15
|
+
"jsconfig.json",
|
|
14
16
|
"main.js",
|
|
15
17
|
"README.md"
|
|
16
18
|
],
|
package/runtime.d.ts
ADDED
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
|
|
2
|
+
interface ImportOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Determines how to import the given module
|
|
5
|
+
*/
|
|
6
|
+
type: 'js' | 'coffee' | 'yaml' | 'json' | 'qrew';
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface ModuleConfOptionCenter {
|
|
11
|
+
/**
|
|
12
|
+
* Get a config key
|
|
13
|
+
* @param key The key of the config to get
|
|
14
|
+
* @param defaultValue The default value ig null
|
|
15
|
+
* @returns The value of the key or the defaultValue if it's null.
|
|
16
|
+
*/
|
|
17
|
+
get: <T = any>(key: string, defaultValue?: T) => T
|
|
18
|
+
/**
|
|
19
|
+
* Set a config key
|
|
20
|
+
* @param key The key of the config to set
|
|
21
|
+
* @param value The value to set it to
|
|
22
|
+
* @returns true if it was a success
|
|
23
|
+
*/
|
|
24
|
+
set: <T = any>(key: string, value: T) => boolean
|
|
25
|
+
/**
|
|
26
|
+
* Removes a key from the config
|
|
27
|
+
* @param key The key of the config to remove
|
|
28
|
+
* @returns true if it was a success
|
|
29
|
+
*/
|
|
30
|
+
remove: (key: string) => boolean
|
|
31
|
+
/**
|
|
32
|
+
* Resets the entire config option center to it's default value
|
|
33
|
+
*/
|
|
34
|
+
reset: () => boolean
|
|
35
|
+
/**
|
|
36
|
+
* Get all values in an option center
|
|
37
|
+
* @param str
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
getAll: (() => string) | ((str?: false) => Record<string, any>)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface ModuleConf extends ModuleConfOptionCenter {
|
|
44
|
+
/**
|
|
45
|
+
* A separate options file for a related set of options
|
|
46
|
+
* @param name The option center full path
|
|
47
|
+
* @param defaults The default values
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* conf = imp 'conf'
|
|
51
|
+
*
|
|
52
|
+
* animations = conf.optionCenter 'animations', enable: false, speed: '1x'
|
|
53
|
+
*
|
|
54
|
+
* if animations.get 'enable'
|
|
55
|
+
* animate animations.get 'speed'
|
|
56
|
+
*/
|
|
57
|
+
optionCenter: (name: string, defaults?: any) => ModuleConfOptionCenter;
|
|
58
|
+
/**
|
|
59
|
+
* Manage Static files
|
|
60
|
+
*/
|
|
61
|
+
staticFile: (name: string, defaults?: any) => {
|
|
62
|
+
write: (value: any, ifExists?: boolean) => this,
|
|
63
|
+
read: (to?: string | object) => string | object | Buffer,
|
|
64
|
+
fileRoot: string,
|
|
65
|
+
exists: boolean
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface ModuleEnv {
|
|
70
|
+
has: (key: string) => boolean,
|
|
71
|
+
get: (key: string) => string,
|
|
72
|
+
set: (key: string, value: string) => boolean,
|
|
73
|
+
rm: (key: string) => boolean,
|
|
74
|
+
is: (key: string, value: string) => boolean,
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface ModuleRuneDBCollcetion {
|
|
78
|
+
insert(record: object): any;
|
|
79
|
+
read(id: string | object, evaluate?: boolean): any;
|
|
80
|
+
update(caseRecord: string | object, newRecord: object): any;
|
|
81
|
+
remove(id: string | object): boolean;
|
|
82
|
+
find(criteria: string | object): any;
|
|
83
|
+
map(cb: (data: any[]) => any[], mutate?: boolean): any[];
|
|
84
|
+
transform(cb: (data: any[]) => any[], mutate?: boolean): any[];
|
|
85
|
+
filter(cb: (data: any[]) => boolean, mutate?: boolean): any[];
|
|
86
|
+
sort(cb: (a: any, b: any) => number, mutate?: boolean): any[];
|
|
87
|
+
list(): any[];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface ModuleRuneDBMap {
|
|
91
|
+
set(key: string, value: any): void;
|
|
92
|
+
get(key: string): any | null;
|
|
93
|
+
remove(key: string): boolean;
|
|
94
|
+
transform(cb: (data: any) => any, mutate?: boolean): any;
|
|
95
|
+
list(): { [key: string]: any };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
interface ModuleRuneDB {
|
|
99
|
+
collection: (name: string) => ModuleRuneDBCollcetion
|
|
100
|
+
map: (name: string) => ModuleRuneDBMap
|
|
101
|
+
findRef: (ref: string) => any
|
|
102
|
+
setData: (data: Record<string, any>) => void
|
|
103
|
+
getData: () => Record<string, any>
|
|
104
|
+
makeRef(value: object, props?: string): string | null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
interface ModuleRune {
|
|
108
|
+
db(dbname: string, data?: object, encryptionKey?: string): ModuleRuneDB;
|
|
109
|
+
genKey(secret: string): string;
|
|
110
|
+
push(...values: any[]): PushChange;
|
|
111
|
+
pop(...values: any[]): PopChange;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
interface ModuleThreads {
|
|
115
|
+
thread: (cb: Function) => {
|
|
116
|
+
stopAll: () => void
|
|
117
|
+
start: (context: Record<string, any>) => {
|
|
118
|
+
on: (event: string, callback: (data) => void) => void;
|
|
119
|
+
off: (event: string, callback: (data) => void) => void;
|
|
120
|
+
emit: (event: string, data: any) => void;
|
|
121
|
+
get: () => Promise,
|
|
122
|
+
stop: () => void
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
declare function imp(path: "conf", options?: ImportOptions): ModuleConf;
|
|
128
|
+
declare function imp(path: "env", options?: ImportOptions): ModuleEnv;
|
|
129
|
+
declare function imp(path: "rune", options?: ImportOptions): ModuleRune;
|
|
130
|
+
declare function imp(path: "threads", options?: ImportOptions): ModuleThreads;
|
|
131
|
+
declare function imp(path: string, options?: ImportOptions): any;
|
|
132
|
+
|
|
133
|
+
declare const inc = imp;
|
|
134
|
+
|
|
135
|
+
declare function require(moduleName: string): any;
|
|
136
|
+
|
|
137
|
+
interface Module {
|
|
138
|
+
exports: any;
|
|
139
|
+
filepath: string;
|
|
140
|
+
main: boolean;
|
|
141
|
+
impots: string[];
|
|
142
|
+
compiled: string
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
declare const module: Module;
|
|
146
|
+
|
|
147
|
+
interface Imports {
|
|
148
|
+
meta: {},
|
|
149
|
+
assets: any
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
declare const imports: Imports;
|
|
153
|
+
|
|
154
|
+
declare const process: {
|
|
155
|
+
argv: string[],
|
|
156
|
+
target: ReturnType<typeof emitter>,
|
|
157
|
+
__execFile: string,
|
|
158
|
+
env: Record<string, any>,
|
|
159
|
+
cwd: () => string,
|
|
160
|
+
arch: string,
|
|
161
|
+
exit: () => void
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
interface AppConfig {
|
|
165
|
+
manifest: {
|
|
166
|
+
package: string
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
declare const app: {
|
|
171
|
+
path: string,
|
|
172
|
+
config: AppConfig
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
declare function read(filepath: string, options?: { encoding: string }): string;
|
|
177
|
+
|
|
178
|
+
declare function realpath(filepath: string, options?: { encoding: string }): string;
|
|
179
|
+
|
|
180
|
+
declare function write(filepath: string, content: any, options?: any): void;
|
|
181
|
+
|
|
182
|
+
declare function exists(filepath: string, options?: any): boolean;
|
|
183
|
+
|
|
184
|
+
declare function fstat(filepath: string, options?: any): any;
|
|
185
|
+
|
|
186
|
+
declare function rm(filepath: string, options?: any): void;
|
|
187
|
+
|
|
188
|
+
declare function chmod(filepath: string, mode: any, options?: any): void;
|
|
189
|
+
|
|
190
|
+
declare function mkdir(filepath: string, options?: any): void;
|
|
191
|
+
|
|
192
|
+
declare function ls(filepath: string, options?: any): string[];
|
|
193
|
+
|
|
194
|
+
declare function struct(template: { [key: string]: any }): (...args: any[]) => any;
|
|
195
|
+
|
|
196
|
+
declare function future(callback: (resolve: (data: any) => void, reject: (data: any) => void) => void, timeout?: number, defData?: any): {
|
|
197
|
+
pipe(callback: (data: any) => any): Promise<any>;
|
|
198
|
+
last(callback: (data: any) => any): Promise<any>;
|
|
199
|
+
catch(callback: (data: any) => any): Promise<any>;
|
|
200
|
+
resolve(data: any): void;
|
|
201
|
+
reject(data: any): void;
|
|
202
|
+
wait(): Promise<any>;
|
|
203
|
+
};
|
|
204
|
+
declare namespace future {
|
|
205
|
+
function promise(promse: Promise<any>, timeout?: number, defData?: any): ReturnType<typeof future>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
declare function emitter(): {
|
|
209
|
+
on(event: string | string[], callback: (...args: any[]) => void, props?: {}): ReturnType<typeof emitter>;
|
|
210
|
+
off(event: string | string[], callback: (...args: any[]) => void, removable?: (event: any) => void): ReturnType<typeof emitter>;
|
|
211
|
+
emit(event: string | string[], ...data: any[]): ReturnType<typeof emitter>;
|
|
212
|
+
};
|
|
213
|
+
declare function exec(command: string, options?: { output?: boolean }): any;
|
|
214
|
+
declare namespace exec {
|
|
215
|
+
function background(command: string, options?: any, callback?: (...args: any[]) => void): any;
|
|
216
|
+
}
|
|
217
|
+
declare function spawn(command: string, ...args: any[]): any;
|
|
218
|
+
|
|
219
|
+
declare function typedef(value: any, strict?: boolean): { strict: boolean; defaultValue: any; class: Function; type: string; isConstucted: boolean; isEmpty: boolean };
|
|
220
|
+
|
|
221
|
+
declare function typeis(obj: any, typeDef: any): boolean;
|
|
222
|
+
|
|
223
|
+
declare function typex(child: any, parent: any): boolean;
|
|
224
|
+
|
|
225
|
+
declare function typei(child: any, parent: any): boolean;
|
|
226
|
+
|
|
227
|
+
declare function int(str: string): number;
|
|
228
|
+
|
|
229
|
+
declare namespace int {
|
|
230
|
+
const type: { strict: boolean; defaultValue: number; class: Function; type: string; isConstucted: boolean; isEmpty: boolean };
|
|
231
|
+
}
|
|
232
|
+
declare function float(str: string): number;
|
|
233
|
+
declare namespace float {
|
|
234
|
+
const type: { strict: boolean; defaultValue: number; class: Function; type: string; isConstucted: boolean; isEmpty: boolean };
|
|
235
|
+
}
|
|
236
|
+
declare function num(str: string): number;
|
|
237
|
+
declare namespace num {
|
|
238
|
+
const type: { strict: boolean; defaultValue: number; class: Function; type: string; isConstucted: boolean; isEmpty: boolean };
|
|
239
|
+
}
|
|
240
|
+
declare function str(str: any): string;
|
|
241
|
+
declare namespace str {
|
|
242
|
+
const type: { strict: boolean; defaultValue: string; class: Function; type: string; isConstucted: boolean; isEmpty: boolean };
|
|
243
|
+
}
|
|
244
|
+
declare function bool(value: any): boolean;
|
|
245
|
+
declare namespace bool {
|
|
246
|
+
const type: { strict: boolean; defaultValue: boolean; class: Function; type: string; isConstucted: boolean; isEmpty: boolean };
|
|
247
|
+
}
|
|
248
|
+
declare function isEmpty(value: any): boolean;
|
|
249
|
+
declare function clone(value: any): any;
|
|
250
|
+
declare function deepClone(value: any): any;
|
|
251
|
+
declare function merge(obj1: any, obj2: any): any;
|
|
252
|
+
declare const uniqueId: () => string;
|
|
253
|
+
declare function filter(arr: any[], fn: (value: any) => boolean): any[];
|
|
254
|
+
declare function reduce(arr: any[], fn: (acc: any, value: any) => any, initial: any): any;
|
|
255
|
+
declare function compose(...fns: Function[]): (initialValue: any) => any;
|
|
256
|
+
declare function curry(fn: Function): (...args: any[]) => any;
|
|
257
|
+
declare function json(thing: string): any;
|
|
258
|
+
declare function jsons(thing: any): string;
|
|
259
|
+
declare function yaml(thing: any): any;
|
|
260
|
+
declare function yamls(thing: any): string;
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Makes a HTTP request to the specified URL.
|
|
265
|
+
* @param url The URL to request.
|
|
266
|
+
* @param options The options for the request.
|
|
267
|
+
* @returns A promise resolving to the response or other specified output based on the options.
|
|
268
|
+
*/
|
|
269
|
+
declare function curl(url: string, options: {
|
|
270
|
+
/**
|
|
271
|
+
* Indicates whether to return a promise.
|
|
272
|
+
*/
|
|
273
|
+
a: true,
|
|
274
|
+
/**
|
|
275
|
+
* Indicates whether to return the response as plain text.
|
|
276
|
+
*/
|
|
277
|
+
text: true,
|
|
278
|
+
o?: string
|
|
279
|
+
}): Promise<string>;
|
|
280
|
+
/**
|
|
281
|
+
* Makes a HTTP request to the specified URL.
|
|
282
|
+
* @param url The URL to request.
|
|
283
|
+
* @param options The options for the request.
|
|
284
|
+
* @returns A promise resolving to the response or other specified output based on the options.
|
|
285
|
+
*/
|
|
286
|
+
declare function curl(url: string, options: {
|
|
287
|
+
/**
|
|
288
|
+
* Indicates whether to return a promise.
|
|
289
|
+
*/
|
|
290
|
+
a: true,
|
|
291
|
+
/**
|
|
292
|
+
* Indicates whether to return the response as JSON.
|
|
293
|
+
*/
|
|
294
|
+
json: true,
|
|
295
|
+
/**
|
|
296
|
+
* The file path to output the response.
|
|
297
|
+
*/
|
|
298
|
+
o?: string
|
|
299
|
+
}): Promise<object>;
|
|
300
|
+
/**
|
|
301
|
+
* Makes a HTTP request to the specified URL.
|
|
302
|
+
* @param url The URL to request.
|
|
303
|
+
* @param options The options for the request.
|
|
304
|
+
* @returns A promise resolving to the response or other specified output based on the options.
|
|
305
|
+
*/
|
|
306
|
+
declare function curl(url: string, options: {
|
|
307
|
+
/**
|
|
308
|
+
* Indicates whether to return a promise.
|
|
309
|
+
*/
|
|
310
|
+
a: true,
|
|
311
|
+
/**
|
|
312
|
+
* The file path to output the response.
|
|
313
|
+
*/
|
|
314
|
+
o?: string
|
|
315
|
+
}): Promise<Response>;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Makes a HTTP request to the specified URL.
|
|
319
|
+
* @param url The URL to request.
|
|
320
|
+
* @param options The options for the request.
|
|
321
|
+
* @returns A promise resolving to the response or other specified output based on the options.
|
|
322
|
+
*/
|
|
323
|
+
declare function curl(url: string, options?: {
|
|
324
|
+
/**
|
|
325
|
+
* Indicates whether to return a promise.
|
|
326
|
+
*/
|
|
327
|
+
a?: boolean,
|
|
328
|
+
/**
|
|
329
|
+
* The file path to output the response.
|
|
330
|
+
*/
|
|
331
|
+
o?: string,
|
|
332
|
+
/**
|
|
333
|
+
* Indicates whether to return the response as JSON.
|
|
334
|
+
*/
|
|
335
|
+
json?: boolean,
|
|
336
|
+
/**
|
|
337
|
+
* Indicates whether to return the response as plain text.
|
|
338
|
+
*/
|
|
339
|
+
text?: boolean
|
|
340
|
+
}): ReturnType<typeof future>;
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
declare function print(...args: any[]): void;
|
|
346
|
+
declare namespace print {
|
|
347
|
+
const stdout: WriteStream;
|
|
348
|
+
const stdin: ReadStream;
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
declare function input(prompt: string): string;
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
declare const basename: (path: string) => string;
|
|
355
|
+
declare const dirname: (path: string) => string;
|
|
356
|
+
declare const extname: (path: string) => string;
|
|
357
|
+
declare const pjoin: (...paths: string[]) => string;
|
|
358
|
+
declare const presolve: (...paths: string[]) => string;
|
|
359
|
+
|
|
360
|
+
declare function exports(value: any) : any;
|
|
361
|
+
|
|
362
|
+
declare function clear() : void;
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
declare function pub(value: any) : any;
|
|
366
|
+
declare function pub(name: string, value: any) : any;
|
|
367
|
+
|
|
368
|
+
declare const opt: {
|
|
369
|
+
set: (key: string, value: any) => void;
|
|
370
|
+
get: (key: string) => any,
|
|
371
|
+
push: (key: string, value: any) => any,
|
|
372
|
+
pop: (key: string) => any,
|
|
373
|
+
}
|
|
374
|
+
|