@keymanapp/kmc-ldml 18.0.16-alpha → 18.0.18-alpha
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/build/src/compiler/compiler.js +309 -308
- package/build/src/compiler/compiler.js.map +1 -1
- package/build/src/compiler/disp.js +84 -83
- package/build/src/compiler/disp.js.map +1 -1
- package/build/src/compiler/empty-compiler.js +116 -115
- package/build/src/compiler/empty-compiler.js.map +1 -1
- package/build/src/compiler/keymanweb-compiler.js +97 -96
- package/build/src/compiler/keymanweb-compiler.js.map +1 -1
- package/build/src/compiler/keys.d.ts.map +1 -1
- package/build/src/compiler/keys.js +419 -415
- package/build/src/compiler/keys.js.map +1 -1
- package/build/src/compiler/layr.d.ts.map +1 -1
- package/build/src/compiler/layr.js +83 -76
- package/build/src/compiler/layr.js.map +1 -1
- package/build/src/compiler/ldml-compiler-options.js +5 -4
- package/build/src/compiler/ldml-compiler-options.js.map +1 -1
- package/build/src/compiler/loca.js +61 -60
- package/build/src/compiler/loca.js.map +1 -1
- package/build/src/compiler/messages.d.ts +11 -3
- package/build/src/compiler/messages.d.ts.map +1 -1
- package/build/src/compiler/messages.js +120 -109
- package/build/src/compiler/messages.js.map +1 -1
- package/build/src/compiler/meta.js +57 -56
- package/build/src/compiler/meta.js.map +1 -1
- package/build/src/compiler/metadata-compiler.js +49 -48
- package/build/src/compiler/metadata-compiler.js.map +1 -1
- package/build/src/compiler/section-compiler.js +42 -41
- package/build/src/compiler/section-compiler.js.map +1 -1
- package/build/src/compiler/substitution-tracker.js +105 -104
- package/build/src/compiler/substitution-tracker.js.map +1 -1
- package/build/src/compiler/touch-layout-compiler.js +93 -92
- package/build/src/compiler/touch-layout-compiler.js.map +1 -1
- package/build/src/compiler/tran.d.ts +7 -0
- package/build/src/compiler/tran.d.ts.map +1 -1
- package/build/src/compiler/tran.js +382 -353
- package/build/src/compiler/tran.js.map +1 -1
- package/build/src/compiler/vars.d.ts.map +1 -1
- package/build/src/compiler/vars.js +236 -227
- package/build/src/compiler/vars.js.map +1 -1
- package/build/src/compiler/visual-keyboard-compiler.js +70 -69
- package/build/src/compiler/visual-keyboard-compiler.js.map +1 -1
- package/build/src/main.js +5 -4
- package/build/src/main.js.map +1 -1
- package/build/src/util/util.d.ts +2 -2
- package/build/src/util/util.d.ts.map +1 -1
- package/build/src/util/util.js +185 -179
- package/build/src/util/util.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.
|
|
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
|
-
constants.section.
|
|
35
|
-
constants.section.
|
|
36
|
-
constants.section.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="be26e017-8a6f-5472-899a-65c563654944")}catch(e){}}();
|
|
3
|
+
import { constants } from '@keymanapp/ldml-keyboard-constants';
|
|
4
|
+
export class SectionCompiler {
|
|
5
|
+
keyboard3;
|
|
6
|
+
callbacks;
|
|
7
|
+
constructor(source, callbacks) {
|
|
8
|
+
this.keyboard3 = source.keyboard3;
|
|
9
|
+
this.callbacks = callbacks;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* This is called before compile.
|
|
13
|
+
* @returns false if this compiler failed to validate.
|
|
14
|
+
*/
|
|
15
|
+
validate() {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* This is called after all other compile phases have completed,
|
|
20
|
+
* when being called by validate(), and provides an
|
|
21
|
+
* opportunity for late error reporting, for example for invalid strings.
|
|
22
|
+
* @param section the compiled section, if any.
|
|
23
|
+
* @returns false if validate fails
|
|
24
|
+
*/
|
|
25
|
+
postValidate(section) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get the dependencies for this compiler.
|
|
30
|
+
* @returns set of dependent sections
|
|
31
|
+
*/
|
|
32
|
+
get dependencies() {
|
|
33
|
+
const defaults = new Set([
|
|
34
|
+
constants.section.strs,
|
|
35
|
+
constants.section.list,
|
|
36
|
+
constants.section.elem,
|
|
37
|
+
constants.section.vars,
|
|
38
|
+
]);
|
|
39
|
+
return defaults;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
42
|
//# sourceMappingURL=section-compiler.js.map
|
|
43
|
+
//# debugId=be26e017-8a6f-5472-899a-65c563654944
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"version":3,"file":"section-compiler.js","sources":["../../../src/compiler/section-compiler.ts"],"sourceRoot":"","names":[],"mappings":";;AACA,OAAO,EAAgB,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAI7E,MAAM,OAAgB,eAAe;IAChB,SAAS,CAA0B;IACnC,SAAS,CAAoB;IAEhD,YAAY,MAA8C,EAAE,SAA4B;QACtF,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAID;;;OAGG;IACI,QAAQ;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAUD;;;;;;OAMG;IACI,YAAY,CAAC,OAAyB;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACH,IAAW,YAAY;QACrB,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAiB;YACvC,SAAS,CAAC,OAAO,CAAC,IAAI;YACtB,SAAS,CAAC,OAAO,CAAC,IAAI;YACtB,SAAS,CAAC,OAAO,CAAC,IAAI;YACtB,SAAS,CAAC,OAAO,CAAC,IAAI;SACvB,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF","debug_id":"be26e017-8a6f-5472-899a-65c563654944"}
|
|
@@ -1,105 +1,106 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
emitted
|
|
21
|
-
|
|
22
|
-
consumed
|
|
23
|
-
|
|
24
|
-
matched
|
|
25
|
-
|
|
26
|
-
all
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*
|
|
36
|
-
* @param
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
66
|
-
this.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
this.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
this.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
this.
|
|
100
|
-
this.
|
|
101
|
-
this.
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1fdfe3f8-d593-5e7f-9858-74311b2316dd")}catch(e){}}();
|
|
3
|
+
import { MarkerParser, VariableParser } from "@keymanapp/common-types";
|
|
4
|
+
/**
|
|
5
|
+
* Verb for SubstitutionTracker.add()
|
|
6
|
+
*/
|
|
7
|
+
export var SubstitutionUse;
|
|
8
|
+
(function (SubstitutionUse) {
|
|
9
|
+
/** outputs this marker into context (e.g. transform to= or key to=) */
|
|
10
|
+
SubstitutionUse[SubstitutionUse["emit"] = 0] = "emit";
|
|
11
|
+
/** consumes this marker out of the context (e.g. transform from=) */
|
|
12
|
+
SubstitutionUse[SubstitutionUse["consume"] = 1] = "consume";
|
|
13
|
+
/** matches the marker, but doesn't consume (e.g. display to=) */
|
|
14
|
+
SubstitutionUse[SubstitutionUse["match"] = 2] = "match";
|
|
15
|
+
/** variable definition: might consume, emit, or match. */
|
|
16
|
+
SubstitutionUse[SubstitutionUse["variable"] = 3] = "variable";
|
|
17
|
+
})(SubstitutionUse || (SubstitutionUse = {}));
|
|
18
|
+
/** Tracks usage of markers */
|
|
19
|
+
export class SubstitutionTracker {
|
|
20
|
+
/** markers that were emitted */
|
|
21
|
+
emitted;
|
|
22
|
+
/** markers that were consumed and removed from the context */
|
|
23
|
+
consumed;
|
|
24
|
+
/** markers that were matched, but not necessarily consumed */
|
|
25
|
+
matched;
|
|
26
|
+
/** all markers */
|
|
27
|
+
all;
|
|
28
|
+
constructor() {
|
|
29
|
+
this.emitted = new Set();
|
|
30
|
+
this.consumed = new Set();
|
|
31
|
+
this.matched = new Set();
|
|
32
|
+
this.all = new Set();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @param verb what kind of use we are adding
|
|
37
|
+
* @param markers list of substitutions to add
|
|
38
|
+
*/
|
|
39
|
+
add(verb, markers) {
|
|
40
|
+
if (!markers.length) {
|
|
41
|
+
return; // skip if empty
|
|
42
|
+
}
|
|
43
|
+
if (verb == SubstitutionUse.emit) {
|
|
44
|
+
markers.forEach((m) => {
|
|
45
|
+
this.emitted.add(m);
|
|
46
|
+
this.all.add(m);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else if (verb == SubstitutionUse.consume) {
|
|
50
|
+
markers.forEach((m) => {
|
|
51
|
+
this.consumed.add(m);
|
|
52
|
+
this.all.add(m);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
else if (verb == SubstitutionUse.match) {
|
|
56
|
+
markers.forEach((m) => {
|
|
57
|
+
this.matched.add(m);
|
|
58
|
+
this.all.add(m);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else if (verb == SubstitutionUse.variable) {
|
|
62
|
+
markers.forEach((m) => {
|
|
63
|
+
// we don't know, so add it to all three
|
|
64
|
+
this.matched.add(m);
|
|
65
|
+
this.emitted.add(m);
|
|
66
|
+
this.consumed.add(m);
|
|
67
|
+
this.all.add(m);
|
|
68
|
+
});
|
|
69
|
+
/* c8 skip next 3 */
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
throw Error(`Internal error: unsupported verb ${verb} for match`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/** rollup of several substitution types */
|
|
77
|
+
export class Substitutions {
|
|
78
|
+
addSetAndStringSubtitution(verb, str) {
|
|
79
|
+
this.set.add(verb, VariableParser.allSetReferences(str));
|
|
80
|
+
this.addStringAndMarkerSubstitution(verb, str);
|
|
81
|
+
}
|
|
82
|
+
/** add a string that can have string var substitutions or markers */
|
|
83
|
+
addStringAndMarkerSubstitution(verb, str) {
|
|
84
|
+
this.addMarkers(verb, str);
|
|
85
|
+
this.addStringSubstitution(verb, str);
|
|
86
|
+
}
|
|
87
|
+
addStringSubstitution(verb, str) {
|
|
88
|
+
this.string.add(verb, VariableParser.allStringReferences(str));
|
|
89
|
+
}
|
|
90
|
+
/** add a string that's just markers */
|
|
91
|
+
addMarkers(verb, str) {
|
|
92
|
+
this.markers.add(verb, MarkerParser.allReferences(str));
|
|
93
|
+
}
|
|
94
|
+
markers;
|
|
95
|
+
set;
|
|
96
|
+
string;
|
|
97
|
+
uset;
|
|
98
|
+
constructor() {
|
|
99
|
+
this.markers = new SubstitutionTracker();
|
|
100
|
+
this.set = new SubstitutionTracker();
|
|
101
|
+
this.string = new SubstitutionTracker();
|
|
102
|
+
this.uset = new SubstitutionTracker();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
105
|
//# sourceMappingURL=substitution-tracker.js.map
|
|
106
|
+
//# debugId=1fdfe3f8-d593-5e7f-9858-74311b2316dd
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"version":3,"file":"substitution-tracker.js","sources":["../../../src/compiler/substitution-tracker.ts"],"sourceRoot":"","names":[],"mappings":";;AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEvE;;GAEG;AACH,MAAM,CAAN,IAAY,eASX;AATD,WAAY,eAAe;IACzB,uEAAuE;I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
-
|
|
48
|
-
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
// rightalt
|
|
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
|
-
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="69297fc7-3014-5509-98ca-7d49188be130")}catch(e){}}();
|
|
3
|
+
export class TouchLayoutCompiler {
|
|
4
|
+
compileToJavascript(source) {
|
|
5
|
+
let result = {};
|
|
6
|
+
// start with desktop to mimic vk emit
|
|
7
|
+
result.desktop = {
|
|
8
|
+
defaultHint: "none",
|
|
9
|
+
layer: []
|
|
10
|
+
};
|
|
11
|
+
for (let layers of source.keyboard3.layers) {
|
|
12
|
+
for (let layer of layers.layer) {
|
|
13
|
+
const resultLayer = this.compileHardwareLayer(source, result, layer);
|
|
14
|
+
result.desktop.layer.push(resultLayer);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
compileHardwareLayer(source, file, layer) {
|
|
20
|
+
// TODO-LDML: consider consolidation with keys.ts?
|
|
21
|
+
let fileLayer = {
|
|
22
|
+
id: this.translateLayerIdToTouchLayoutLayerId(layer.id, layer.modifiers),
|
|
23
|
+
row: []
|
|
24
|
+
};
|
|
25
|
+
let y = -1;
|
|
26
|
+
for (let row of layer.row) {
|
|
27
|
+
y++;
|
|
28
|
+
let fileRow = { id: y, key: [] };
|
|
29
|
+
fileLayer.row.push(fileRow);
|
|
30
|
+
const keys = row.keys.split(' ');
|
|
31
|
+
for (let key of keys) {
|
|
32
|
+
const keydef = source.keyboard3.keys?.key?.find(x => x.id == key);
|
|
33
|
+
if (keydef) {
|
|
34
|
+
const fileKey = {
|
|
35
|
+
id: this.translateKeyIdentifierToTouch(keydef.id),
|
|
36
|
+
text: keydef.output || '',
|
|
37
|
+
// TODO-LDML: additional properties
|
|
38
|
+
};
|
|
39
|
+
fileRow.key.push(fileKey);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// TODO-LDML: consider logging missing keys
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return fileLayer;
|
|
47
|
+
}
|
|
48
|
+
translateLayerIdToTouchLayoutLayerId(id, modifier) {
|
|
49
|
+
// Touch layout layers have a set of reserved names that correspond to
|
|
50
|
+
// hardware modifiers. We want to map these identifiers first before falling
|
|
51
|
+
// back to the layer ids
|
|
52
|
+
// The set of recognized layer identifiers is:
|
|
53
|
+
//
|
|
54
|
+
// touch | LDML
|
|
55
|
+
// ---------------+-------------
|
|
56
|
+
// default | none
|
|
57
|
+
// shift | shift
|
|
58
|
+
// caps | caps
|
|
59
|
+
// rightalt | altR
|
|
60
|
+
// rightalt-shift | altR shift
|
|
61
|
+
//
|
|
62
|
+
const map = {
|
|
63
|
+
none: 'default',
|
|
64
|
+
shift: 'shift',
|
|
65
|
+
caps: 'caps',
|
|
66
|
+
altR: 'rightalt',
|
|
67
|
+
"altR shift": 'rightalt-shift'
|
|
68
|
+
};
|
|
69
|
+
// canonicalize modifier string, alphabetical
|
|
70
|
+
// TODO-LDML: need to support multiple here
|
|
71
|
+
if (modifier && modifier.indexOf(',') !== -1) {
|
|
72
|
+
throw Error(`Internal error: TODO-LDML: multiple modifiers ${modifier} not yet supported.`);
|
|
73
|
+
}
|
|
74
|
+
modifier = (modifier || '').split(/\b/).sort().join(' ').trim();
|
|
75
|
+
if (Object.hasOwn(map, modifier)) {
|
|
76
|
+
return map[modifier];
|
|
77
|
+
}
|
|
78
|
+
// TODO-LDML: Other layer names will be used unmodified, is this sufficient?
|
|
79
|
+
return id;
|
|
80
|
+
}
|
|
81
|
+
translateKeyIdentifierToTouch(id) {
|
|
82
|
+
// Note: keys identifiers in kmx were traditionally case-insensitive, but we
|
|
83
|
+
// are going to use them as case-insensitive for LDML keyboards. The set of
|
|
84
|
+
// standard key identifiers a-z, A-Z, 0-9 will be used, where possible, and
|
|
85
|
+
// all other keys will be mapped to `T_key`.
|
|
86
|
+
if (id.match(/^[0-9a-zA-Z]$/)) {
|
|
87
|
+
return 'K_' + id;
|
|
88
|
+
}
|
|
89
|
+
// Not a standard key
|
|
90
|
+
return 'T_' + id;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
93
|
//# sourceMappingURL=touch-layout-compiler.js.map
|
|
94
|
+
//# debugId=69297fc7-3014-5509-98ca-7d49188be130
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"version":3,"file":"touch-layout-compiler.js","sources":["../../../src/compiler/touch-layout-compiler.ts"],"sourceRoot":"","names":[],"mappings":";;AAEA,MAAM,OAAO,mBAAmB;IACvB,mBAAmB,CAAC,MAA8C;QACvE,IAAI,MAAM,GAAgC,EAAE,CAAC;QAE7C,sCAAsC;QACtC,MAAM,CAAC,OAAO,GAAG;YACf,WAAW,EAAE,MAAM;YACnB,KAAK,EAAE,EAAE;SACV,CAAC;QAEF,KAAI,IAAI,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE;YACzC,KAAI,IAAI,KAAK,IAAI,MAA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EAAE,CAAC;IACjB,CAAC;CACF","debug_id":"69297fc7-3014-5509-98ca-7d49188be130"}
|
|
@@ -18,6 +18,13 @@ export declare abstract class TransformCompiler<T extends TransformCompilerType,
|
|
|
18
18
|
private compileTransformGroup;
|
|
19
19
|
private compileTransformTranGroup;
|
|
20
20
|
private compileTransform;
|
|
21
|
+
/**
|
|
22
|
+
* Validate the final regex
|
|
23
|
+
* @param cookedFrom the regex to use, missing the trailing '$'
|
|
24
|
+
* @param from the original from - for error reporting
|
|
25
|
+
* @returns true if OK
|
|
26
|
+
*/
|
|
27
|
+
private isValidRegex;
|
|
21
28
|
private compileReorderTranGroup;
|
|
22
29
|
private compileReorder;
|
|
23
30
|
compile(sections: DependencySections): TranBase;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tran.d.ts","sourceRoot":"","sources":["../../../src/compiler/tran.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAsC,MAAM,yBAAyB,CAAC;AACvH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;AAC3B,OAAO,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;AACvD,OAAO,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;AAI3B,OAAO,yBAAyB,GAAG,YAAY,CAAC,yBAAyB,CAAC;AAO1E,OAAO,EAAE,aAAa,EAAmB,MAAM,2BAA2B,CAAC;AAE3E,KAAK,qBAAqB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEpD,8BAAsB,iBAAiB,CAAC,CAAC,SAAS,qBAAqB,EAAE,QAAQ,SAAS,IAAI,CAAE,SAAQ,eAAe;IAErH,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,YAAY,CAAC,UAAU,EAAE,EAAE,EAAE,aAAa,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