@intlify/message-compiler 9.3.0-beta.2 → 9.3.0-beta.21
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/message-compiler.cjs +1462 -1409
- package/dist/message-compiler.d.ts +18 -10
- package/dist/message-compiler.esm-browser.js +1428 -1371
- package/dist/message-compiler.esm-browser.prod.js +3 -3
- package/dist/message-compiler.global.js +1429 -1373
- package/dist/message-compiler.global.prod.js +3 -3
- package/dist/message-compiler.mjs +1406 -1352
- package/dist/message-compiler.prod.cjs +1457 -1404
- package/package.json +7 -5
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { RawSourceMap } from 'source-map';
|
|
1
|
+
import type { RawSourceMap } from 'source-map-js';
|
|
2
2
|
|
|
3
|
-
export declare function baseCompile(source: string, options?: CompileOptions):
|
|
3
|
+
export declare function baseCompile(source: string, options?: CompileOptions): CompilerResult;
|
|
4
|
+
|
|
5
|
+
export declare type CacheKeyHandler = (source: string) => string;
|
|
4
6
|
|
|
5
7
|
export declare interface CodeGenOptions {
|
|
8
|
+
location?: boolean;
|
|
6
9
|
mode?: 'normal' | 'arrow';
|
|
7
10
|
breakLineCode?: '\n' | ';';
|
|
8
11
|
needIndent?: boolean;
|
|
@@ -17,8 +20,6 @@ declare interface CodeGenResult {
|
|
|
17
20
|
map?: RawSourceMap;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
export declare type CompileCacheKeyHandler = (source: string) => string;
|
|
21
|
-
|
|
22
23
|
export declare type CompileDomain = 'tokenizer' | 'parser' | 'generator' | 'transformer' | 'compiler';
|
|
23
24
|
|
|
24
25
|
export declare interface CompileError extends SyntaxError {
|
|
@@ -45,15 +46,17 @@ export declare const CompileErrorCodes: {
|
|
|
45
46
|
readonly __EXTEND_POINT__: 15;
|
|
46
47
|
};
|
|
47
48
|
|
|
48
|
-
export declare type CompileErrorCodes = typeof CompileErrorCodes[keyof typeof CompileErrorCodes];
|
|
49
|
+
export declare type CompileErrorCodes = (typeof CompileErrorCodes)[keyof typeof CompileErrorCodes];
|
|
49
50
|
|
|
50
51
|
export declare type CompileErrorHandler = (error: CompileError) => void;
|
|
51
52
|
|
|
52
53
|
export declare type CompileOptions = {
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
optimize?: boolean;
|
|
55
|
+
jit?: boolean;
|
|
55
56
|
} & TransformOptions & CodeGenOptions & ParserOptions & TokenizeOptions;
|
|
56
57
|
|
|
58
|
+
export declare type CompilerResult = CodeGenResult;
|
|
59
|
+
|
|
57
60
|
export declare function createCompileError<T extends number>(code: T, loc: SourceLocation | null, options?: CreateCompileErrorOptions): CompileError;
|
|
58
61
|
|
|
59
62
|
export declare interface CreateCompileErrorOptions {
|
|
@@ -72,6 +75,8 @@ export declare function createPosition(line: number, column: number, offset: num
|
|
|
72
75
|
|
|
73
76
|
/* Excluded from this release type: defaultOnError */
|
|
74
77
|
|
|
78
|
+
export declare const detectHtmlTag: (source: string) => boolean;
|
|
79
|
+
|
|
75
80
|
export declare const ERROR_DOMAIN = "parser";
|
|
76
81
|
|
|
77
82
|
/* Excluded from this release type: errorMessages */
|
|
@@ -115,12 +120,13 @@ export declare interface LiteralNode extends Node_2 {
|
|
|
115
120
|
value: string;
|
|
116
121
|
}
|
|
117
122
|
|
|
118
|
-
export declare const
|
|
123
|
+
export declare const LOCATION_STUB: SourceLocation;
|
|
119
124
|
|
|
120
125
|
declare type MessageElementNode = TextNode | NamedNode | ListNode | LiteralNode | LinkedNode;
|
|
121
126
|
|
|
122
127
|
export declare interface MessageNode extends Node_2 {
|
|
123
128
|
type: NodeTypes.Message;
|
|
129
|
+
static?: string;
|
|
124
130
|
items: MessageElementNode[];
|
|
125
131
|
}
|
|
126
132
|
|
|
@@ -131,8 +137,8 @@ export declare interface NamedNode extends Node_2 {
|
|
|
131
137
|
|
|
132
138
|
declare interface Node_2 {
|
|
133
139
|
type: NodeTypes;
|
|
134
|
-
start
|
|
135
|
-
end
|
|
140
|
+
start?: number;
|
|
141
|
+
end?: number;
|
|
136
142
|
loc?: SourceLocation;
|
|
137
143
|
}
|
|
138
144
|
export { Node_2 as Node }
|
|
@@ -156,6 +162,7 @@ export declare interface Parser {
|
|
|
156
162
|
|
|
157
163
|
export declare interface ParserOptions {
|
|
158
164
|
location?: boolean;
|
|
165
|
+
onCacheKey?: (source: string) => string;
|
|
159
166
|
onError?: CompileErrorHandler;
|
|
160
167
|
}
|
|
161
168
|
|
|
@@ -173,6 +180,7 @@ export declare interface Position {
|
|
|
173
180
|
export declare interface ResourceNode extends Node_2 {
|
|
174
181
|
type: NodeTypes.Resource;
|
|
175
182
|
body: MessageNode | PluralNode;
|
|
183
|
+
cacheKey?: string;
|
|
176
184
|
helpers?: string[];
|
|
177
185
|
}
|
|
178
186
|
|