@siredvin/cc-types 1.0.0

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.
@@ -0,0 +1,8 @@
1
+ /** @noSelfInFile **/
2
+ /** @noResolution **/
3
+ declare module "cc.audio.dfpwm" {
4
+ export function make_encoder(): (pcm: number[]) => string;
5
+ export function encode(pcm: number[]): string;
6
+ export function make_decoder(): (dfpwm: string) => number[];
7
+ export function decode(dfpwm: string): number[];
8
+ }
@@ -0,0 +1,13 @@
1
+ /** @noSelfInFile **/
2
+ /** @noResolution **/
3
+ declare module "cc.completion" {
4
+ export function choice(
5
+ text: string,
6
+ choices: string[],
7
+ add_space?: boolean
8
+ ): string[];
9
+ export function peripheral(text: string, add_space?: boolean): string[];
10
+ export function side(text: string, add_space?: boolean): string[];
11
+ export function setting(text: string, add_space?: boolean): string[];
12
+ export function command(text: string, add_space?: boolean): string[];
13
+ }
package/expect.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ /** @noSelfInFile **/
2
+ /** @noResolution **/
3
+ declare module "cc/expect" {
4
+ namespace expect {
5
+ function expect(index: number, value: any, ...types: string[]): any;
6
+ function field(
7
+ tbl: Object | LuaTable,
8
+ index: string,
9
+ ...types: string[]
10
+ ): any;
11
+ function range(num: number, min?: number, max?: number): number;
12
+ }
13
+ function expect(index: number, value: any, ...types: string[]): any;
14
+ export = expect;
15
+ }
package/image/nft.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /** @noSelfInFile **/
2
+ /** @noResolution **/
3
+ declare module "cc.image.nft" {
4
+ type Image = { text: string; foreground: string; background: string }[];
5
+ export function parse(image: string): Image;
6
+ export function load(path: string): Image;
7
+ export function draw(
8
+ image: Image,
9
+ xPos: number,
10
+ yPos: number,
11
+ target?: ITerminal
12
+ );
13
+ }
package/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /// <reference path="audio/dfpwm.d.ts"/>
2
+ /// <reference path="completion.d.ts"/>
3
+ /// <reference path="expect.d.ts"/>
4
+ /// <reference path="image/nft.d.ts"/>
5
+ /// <reference path="pretty.d.ts"/>
6
+ /// <reference path="require.d.ts"/>
7
+ /// <reference path="shell/completion.d.ts"/>
8
+ /// <reference path="strings.d.ts"/>
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@siredvin/cc-types",
3
+ "version": "1.0.0",
4
+ "description": "TypeScript type definitions for CraftOS modules.",
5
+ "types": "index.d.ts",
6
+ "files": [
7
+ "./*.d.ts",
8
+ "./audio",
9
+ "./image",
10
+ "./shell"
11
+ ],
12
+ "author": "JackMacWindows",
13
+ "license": "MIT",
14
+ "scripts": {
15
+ "lint": "eslint . --ext .ts,.js",
16
+ "depcheck": "depcheck"
17
+ },
18
+ "nx": {
19
+ "targets": {
20
+ "lint": {
21
+ "executor": "@nx/linter:eslint",
22
+ "outputs": [
23
+ "{options.outputFile}"
24
+ ],
25
+ "options": {
26
+ "lintFilePatterns": [
27
+ "packages/cc/**/*.{ts,tsx,js,jsx}"
28
+ ]
29
+ }
30
+ },
31
+ "depcheck": {
32
+ "executor": "nx:run-commands",
33
+ "options": {
34
+ "command": "depcheck",
35
+ "cwd": "packages/cc"
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
package/pretty.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ /** @noSelfInFile **/
2
+ /** @noResolution **/
3
+ declare module "cc.pretty" {
4
+ type Doc = {};
5
+ export const empty: Doc;
6
+ export const space: Doc;
7
+ export const line: Doc;
8
+ export const space_line: Doc;
9
+ export function text(text: string, color?: number): Doc;
10
+ export function concat(...args: (Doc | string)[]): Doc;
11
+ export function nest(depth: number, doc: Doc): Doc;
12
+ export function group(doc: Doc): Doc;
13
+ export function write(doc: Doc, ribbon_frac?: number): void;
14
+ export function print(doc: Doc, ribbon_frac?: number): void;
15
+ export function render(
16
+ doc: Doc,
17
+ width?: number,
18
+ ribbon_frac?: number
19
+ ): string;
20
+ export function pretty(
21
+ obj: any,
22
+ options?: { function_args?: boolean; function_source: boolean }
23
+ ): Doc;
24
+ export function pretty_print(
25
+ obj: any,
26
+ options?: { function_args?: boolean; function_source: boolean },
27
+ ribbon_frac?: number
28
+ ): void;
29
+ }
package/require.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /** @noSelfInFile **/
2
+ /** @noResolution **/
3
+ declare module "cc.require" {
4
+ export function make(
5
+ env: Object | LuaTable,
6
+ dir: string
7
+ ): LuaMultiReturn<[(name: string) => any, Object | LuaTable]>;
8
+ }
@@ -0,0 +1,69 @@
1
+ /** @noSelfInFile **/
2
+ /** @noResolution **/
3
+ declare module "cc.shell.completion" {
4
+ export function file(shell: Object | LuaTable, text: string): string[];
5
+ export function dir(shell: Object | LuaTable, text: string): string[];
6
+ export function dirOrFile(
7
+ shell: Object | LuaTable,
8
+ text: string,
9
+ previous: string[],
10
+ add_space?: boolean
11
+ ): string[];
12
+ export function program(shell: Object | LuaTable, text: string): string[];
13
+ export function programWithArgs(
14
+ shell: Object | LuaTable,
15
+ text: string,
16
+ previous: string[],
17
+ starting: number
18
+ ): string[];
19
+ export function help(
20
+ shell: Object | LuaTable,
21
+ text: string,
22
+ previous: string[]
23
+ ): string[];
24
+ export function choice(
25
+ shell: Object | LuaTable,
26
+ text: string,
27
+ previous: string[],
28
+ choices: string[],
29
+ add_space?: boolean
30
+ ): string[];
31
+ export function peripheral(
32
+ shell: Object | LuaTable,
33
+ text: string,
34
+ previous: string[],
35
+ add_space?: boolean
36
+ ): string[];
37
+ export function side(
38
+ shell: Object | LuaTable,
39
+ text: string,
40
+ previous: string[],
41
+ add_space?: boolean
42
+ ): string[];
43
+ export function setting(
44
+ shell: Object | LuaTable,
45
+ text: string,
46
+ previous: string[],
47
+ add_space?: boolean
48
+ ): string[];
49
+ export function command(
50
+ shell: Object | LuaTable,
51
+ text: string,
52
+ previous: string[],
53
+ add_space?: boolean
54
+ ): string[];
55
+ export function build(
56
+ ...args: (
57
+ | null
58
+ | ((text: string, previous: string[]) => string[])
59
+ | [
60
+ (
61
+ text: string,
62
+ previous: string[],
63
+ ...args: any[]
64
+ ) => string[],
65
+ ...any[]
66
+ ]
67
+ )[]
68
+ ): (index: number, arg: string, previous: string[]) => string[];
69
+ }
package/strings.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ /** @noSelfInFile **/
2
+ /** @noResolution **/
3
+ declare module "cc.strings" {
4
+ export function wrap(text: string, width?: number): string[];
5
+ export function ensure_width(text: string, width?: number): string;
6
+ }