-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.d.ts
131 lines (117 loc) · 3.4 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
Type definitions for jscc v1.1.1
@license MIT
*/
export = Jscc
/**
* Preprocessor for conditional comments and replacement of compile-time
* variables in text files (asynchronous version).
*
* @param source String to be preprocessed, encoded in utf8.
* @param filename Absolute or relative path to the current directory.
* @param options User options.
* @param callback NodeJS style callback that receives the error and result as parameters.
*/
declare function Jscc (
source: string,
filename: string | null | undefined,
options: Jscc.Options | null | undefined,
callback: Jscc.Callback
): void
/**
* Preprocessor for conditional comments and replacement of compile-time
* variables in text files (synchronous version).
*
* @param source String to be preprocessed, encoded in utf8.
* @param filename Absolute or relative path to the current directory.
* @param options User options.
* @returns Object with `code` and `map` properties.
*/
declare function Jscc (
source: string,
filename?: string | null,
options?: Jscc.Options | null
): Jscc.Result
// tslint:disable:no-namespace
declare namespace Jscc {
type QuoteType = 'single' | 'double' | 'both'
interface Options {
/**
* String with the type of quotes to escape in the output of strings:
* 'single', 'double' or 'both'.
*
* It does not affects the strings contained in the JSON output of
* objects.
*/
escapeQuotes?: QuoteType
/**
* Allows to preserve the empty lines of directives and blocks that
* were removed.
*
* Use this option with `sourceMap:false` if you are interested only in
* preserve the line count.
*
* @default false
*/
keepLines?: boolean
/**
* Include the original source in the sourcemap.
*
* @default false
*/
mapContent?: boolean
/**
* Makes a hi-res sourcemap.
*
* @default true
*/
mapHires?: boolean
/**
* String, regex or array of strings or regex matching the start of a directive.
* That is, the characters before the '#', usually the start of comments.
*
* @default ['//','/*','<!--']
*/
prefixes?: string | RegExp | Array<string | RegExp>
/**
* Set this option to `false` to suppress the creation of the sourcemap.
*
* _Note:_ In plugins such as jscc-brunch, this option will take the value
* given by the main tool, unless it is explicity defined as `false`
* @default true
*/
sourceMap?: boolean
/**
* Plain object defining the variables used by jscc during the preprocessing.
*
* Each key is a varname matching the regex `_[0-9A-Z][_0-9A-Z]*`, the value
* can have any type.
*
* It has two predefined, readonly properties:
* - `_FILE` : Name of the source file, relative to the current directory
* - `_VERSION` : The version property in the package.json
*/
values?: { [k: string]: any }
}
/**
* The result
*/
interface Result {
/**
* Processed source text.
*/
code: string
/**
* Raw sourcemap object, or `null` if the buffer did not change.
*/
map?: import('magic-string').SourceMap | null
}
/** Callback for async operation */
type Callback = (error: Error | null, data?: Jscc.Result) => void
/** jscc varnames and values */
interface Values {
[k: string]: any
_VERSION: string
_FILE: string
}
}