@keymanapp/kmc-package 17.0.300-beta → 17.0.301-beta
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/cp1252.js +289 -288
- package/build/src/compiler/cp1252.js.map +1 -1
- package/build/src/compiler/kmp-compiler.js +494 -493
- package/build/src/compiler/kmp-compiler.js.map +1 -1
- package/build/src/compiler/kmp-inf-writer.js +145 -144
- package/build/src/compiler/kmp-inf-writer.js.map +1 -1
- package/build/src/compiler/kmx-keyboard-metadata.js +19 -18
- package/build/src/compiler/kmx-keyboard-metadata.js.map +1 -1
- package/build/src/compiler/markdown.js +49 -48
- package/build/src/compiler/markdown.js.map +1 -1
- package/build/src/compiler/package-compiler-messages.js +79 -78
- package/build/src/compiler/package-compiler-messages.js.map +1 -1
- package/build/src/compiler/package-keyboard-target-validator.js +45 -44
- package/build/src/compiler/package-keyboard-target-validator.js.map +1 -1
- package/build/src/compiler/package-metadata-collector.js +78 -77
- package/build/src/compiler/package-metadata-collector.js.map +1 -1
- package/build/src/compiler/package-metadata-updater.js +13 -12
- package/build/src/compiler/package-metadata-updater.js.map +1 -1
- package/build/src/compiler/package-validation.js +180 -179
- package/build/src/compiler/package-validation.js.map +1 -1
- package/build/src/compiler/package-version-validator.js +92 -91
- package/build/src/compiler/package-version-validator.js.map +1 -1
- package/build/src/compiler/redist-files.js +59 -58
- package/build/src/compiler/redist-files.js.map +1 -1
- package/build/src/compiler/web-keyboard-metadata.js +37 -36
- package/build/src/compiler/web-keyboard-metadata.js.map +1 -1
- package/build/src/compiler/windows-package-installer-compiler.js +180 -179
- package/build/src/compiler/windows-package-installer-compiler.js.map +1 -1
- package/build/src/main.js +7 -6
- package/build/src/main.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,59 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
'
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'keyman.
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'kmcomapi.
|
|
31
|
-
'
|
|
32
|
-
'kmrefresh.
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
'
|
|
37
|
-
'sentry.
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
'
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
'
|
|
53
|
-
'
|
|
54
|
-
'
|
|
55
|
-
'
|
|
56
|
-
'
|
|
57
|
-
|
|
58
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This is a set of known redistributable files for Keyman for Windows that
|
|
3
|
+
* should not be included in packages. It is not critical that this list matches
|
|
4
|
+
* the current deployment; it is just for warning against accidental inclusion
|
|
5
|
+
* of these files by package authors. Some redistributable files have been
|
|
6
|
+
* intentionally excluded because they could legitimately be a different file
|
|
7
|
+
* with the same name.
|
|
8
|
+
*
|
|
9
|
+
* This matches behaviour from the legacy package compiler; we may want to
|
|
10
|
+
* reconsider how this is done in the future.
|
|
11
|
+
*
|
|
12
|
+
* These lists have been constructed from 17.0.109 alpha build. Filenames
|
|
13
|
+
* intentionally in lower case.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
!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]="d8ba5b90-e7ad-5e6f-9e25-0eaeaae6f000")}catch(e){}}();
|
|
17
|
+
export const keymanForWindowsInstallerFiles = [
|
|
18
|
+
'keymandesktop.msi',
|
|
19
|
+
'keymanengine.msm'
|
|
20
|
+
];
|
|
21
|
+
export const keymanEngineForWindowsFiles = [
|
|
22
|
+
'base.xslt',
|
|
23
|
+
'crashpad_handler.exe',
|
|
24
|
+
'keyman-debug-etw.man',
|
|
25
|
+
'keyman.exe',
|
|
26
|
+
'keyman32.dll',
|
|
27
|
+
'keyman64.dll',
|
|
28
|
+
'keymanmc.dll',
|
|
29
|
+
'keymanx64.exe',
|
|
30
|
+
'kmcomapi.dll',
|
|
31
|
+
'kmcomapi.x64.dll',
|
|
32
|
+
'kmrefresh.x64.exe',
|
|
33
|
+
'kmrefresh.x86.exe',
|
|
34
|
+
'kmtip.dll',
|
|
35
|
+
'kmtip64.dll',
|
|
36
|
+
'mcompile.exe',
|
|
37
|
+
'sentry.dll',
|
|
38
|
+
'sentry.x64.dll',
|
|
39
|
+
'si_browsers.xslt',
|
|
40
|
+
'si_fonts.xslt',
|
|
41
|
+
'si_hookdlls.xslt',
|
|
42
|
+
'si_keyman.xslt',
|
|
43
|
+
'si_language.xslt',
|
|
44
|
+
'si_office.xslt',
|
|
45
|
+
'si_overview.xslt',
|
|
46
|
+
'si_processes.xslt',
|
|
47
|
+
'si_processes_x64.xslt',
|
|
48
|
+
'si_startup.xslt',
|
|
49
|
+
'tsysinfo.exe',
|
|
50
|
+
];
|
|
51
|
+
export const keymanForWindowsRedistFiles = [
|
|
52
|
+
'desktop_resources.dll',
|
|
53
|
+
'keymandesktop.chm',
|
|
54
|
+
'kmbrowserhost.exe',
|
|
55
|
+
'kmconfig.exe',
|
|
56
|
+
'kmshell.exe',
|
|
57
|
+
'unicodedata.mdb',
|
|
58
|
+
];
|
|
59
59
|
//# sourceMappingURL=redist-files.js.map
|
|
60
|
+
//# debugId=d8ba5b90-e7ad-5e6f-9e25-0eaeaae6f000
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"version":3,"file":"redist-files.js","sources":["../../../src/compiler/redist-files.ts"],"sourceRoot":"","names":[],"mappings":"AACA;;;;;;;;;;;;;GAaG;;;AAEH,MAAM,CAAC,MACL,8BAA8B,GAAa;IACzC,mBAAmB;IACnB,kBAAkB;CACnB,CAAC;AAGJ,MAAM,CAAC,MACL,2BAA2B,GAAa;IACtC,WAAW;IACX,sBAAsB;IACtB,sBAAsB;IACtB,YAAY;IACZ,cAAc;IACd,cAAc;IACd,cAAc;IACd,eAAe;IACf,cAAc;IACd,kBAAkB;IAClB,mBAAmB;IACnB,mBAAmB;IACnB,WAAW;IACX,aAAa;IACb,cAAc;IACd,YAAY;IACZ,gBAAgB;IAChB,kBAAkB;IAClB,eAAe;IACf,kBAAkB;IAClB,gBAAgB;IAChB,kBAAkB;IAClB,gBAAgB;IAChB,kBAAkB;IAClB,mBAAmB;IACnB,uBAAuB;IACvB,iBAAiB;IACjB,cAAc;CACf,CAAC;AAEJ,MAAM,CAAC,MACL,2BAA2B,GAAa;IACtC,uBAAuB;IACvB,mBAAmB;IACnB,mBAAmB;IACnB,cAAc;IACd,aAAa;IACb,iBAAiB;CAClB,CAAC","debug_id":"d8ba5b90-e7ad-5e6f-9e25-0eaeaae6f000"}
|
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
* It
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
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]="7be13b44-2b7e-5674-8439-331800382138")}catch(e){}}();
|
|
3
|
+
;
|
|
4
|
+
/**
|
|
5
|
+
* This function parses the JavaScript to do a best-effort retrieval of
|
|
6
|
+
* keyboard data. It assumes a format similar to what the compiler produces.
|
|
7
|
+
* It may be possible for it to miss something if the code is hand written and
|
|
8
|
+
* diverges enough from the compiler code (e.g. if there is a comment between
|
|
9
|
+
* a member variable and its value or something crazy like that).
|
|
10
|
+
*
|
|
11
|
+
* Long-term, we will require package to include .kmx so this kind of parsing
|
|
12
|
+
* won't be necessary.
|
|
13
|
+
*/
|
|
14
|
+
export function getCompiledWebKeyboardMetadata(js) {
|
|
15
|
+
const nameRegex = /this.KN\s*=\s*(['"])(.*?)\1/;
|
|
16
|
+
const kbverRegex = /this.KBVER\s*=\s*(['"])(.*?)\1/;
|
|
17
|
+
const minverRegex = /this.KMINVER\s*=\s*([''"])(.*?)\1/;
|
|
18
|
+
const rtlRegex = /this.KRTL\s*=\s*(.*?)\s*;/;
|
|
19
|
+
const mnemonicRegex = /this.KM\s*=\s*(.*?)\s*;/;
|
|
20
|
+
const touchLayoutRegex = /this.KVKL\s*=\s*{/;
|
|
21
|
+
const name = nameRegex.exec(js);
|
|
22
|
+
const kbver = kbverRegex.exec(js);
|
|
23
|
+
const minver = minverRegex.exec(js);
|
|
24
|
+
const rtl = rtlRegex.exec(js);
|
|
25
|
+
const mnemonic = mnemonicRegex.exec(js);
|
|
26
|
+
const touchLayout = touchLayoutRegex.exec(js);
|
|
27
|
+
const SKeymanVersion70 = '7.0';
|
|
28
|
+
return {
|
|
29
|
+
keyboardName: name ? name[2] : null,
|
|
30
|
+
keyboardVersion: kbver ? kbver[2] : null,
|
|
31
|
+
minKeymanVersion: minver ? minver[2] : SKeymanVersion70,
|
|
32
|
+
isRtl: !!(rtl && rtl[1].match(/^(1|true)$/)),
|
|
33
|
+
isMnemonic: !!(mnemonic && mnemonic[1].match(/^(1|true)$/)),
|
|
34
|
+
hasTouchLayout: !!touchLayout
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
37
|
//# sourceMappingURL=web-keyboard-metadata.js.map
|
|
38
|
+
//# debugId=7be13b44-2b7e-5674-8439-331800382138
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"version":3,"file":"web-keyboard-metadata.js","sources":["../../../src/compiler/web-keyboard-metadata.ts"],"sourceRoot":"","names":[],"mappings":";;AASC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,UAAU,8BAA8B,CAAC,EAAU;IACrD,MAAM,SAAS,GAAK,6BAA6B,CAAC;IAClD,MAAM,UAAU,GAAI,gCAAgC,CAAC;IACrD,MAAM,WAAW,GAAG,mCAAmC,CAAC;IACxD,MAAM,QAAQ,GAAM,2BAA2B,CAAC;IAChD,MAAM,aAAa,GAAG,yBAAyB,CAAC;IAChD,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;IAE7C,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpC,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9B,MAAM,QAAQ,GAAG,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxC,MAAM,WAAW,GAAG,gBAAgB,CAAC,IAAI,CAAC,EA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41
|
-
|
|
42
|
-
this.
|
|
43
|
-
this.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
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
|
-
const
|
|
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
|
-
const
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
//
|
|
127
|
-
//
|
|
128
|
-
|
|
129
|
-
zip
|
|
130
|
-
zip.file(
|
|
131
|
-
zip.file(
|
|
132
|
-
zip.file(this.callbacks.path.basename(sources.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
setupInf +=
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
buffer
|
|
175
|
-
buffer.set(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Create a .exe installer that bundles one or more .kmp files, together with
|
|
3
|
+
* setup.exe, keymandesktop.msi, and generates and includes a setup.inf also.
|
|
4
|
+
*
|
|
5
|
+
* This module is effectively deprecated, but is present to keep parity with the
|
|
6
|
+
* legacy kmcomp compiler. Thus, it is included as part of the package compiler,
|
|
7
|
+
* and will be removed in a future version.
|
|
8
|
+
*
|
|
9
|
+
* This tool assumes that the installer .msi is the same version as the
|
|
10
|
+
* compiler, unlike the legacy compiler which read this metadata from the .msi.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
!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]="416a1ac8-98e1-51e8-b77b-4b2a264f7ee6")}catch(e){}}();
|
|
14
|
+
import JSZip from 'jszip';
|
|
15
|
+
import KEYMAN_VERSION from "@keymanapp/keyman-version";
|
|
16
|
+
import { KmpCompiler } from "./kmp-compiler.js";
|
|
17
|
+
import { CompilerMessages } from "./package-compiler-messages.js";
|
|
18
|
+
const SETUP_INF_FILENAME = 'setup.inf';
|
|
19
|
+
const PRODUCT_NAME = 'Keyman';
|
|
20
|
+
;
|
|
21
|
+
;
|
|
22
|
+
;
|
|
23
|
+
/**
|
|
24
|
+
* @public
|
|
25
|
+
* Compiles a .kps file to a .exe installer. The compiler does not read or write
|
|
26
|
+
* from filesystem or network directly, but relies on callbacks for all external
|
|
27
|
+
* IO.
|
|
28
|
+
*/
|
|
29
|
+
export class WindowsPackageInstallerCompiler {
|
|
30
|
+
kmpCompiler;
|
|
31
|
+
callbacks;
|
|
32
|
+
options;
|
|
33
|
+
/**
|
|
34
|
+
* Initialize the compiler.
|
|
35
|
+
* Copies options.
|
|
36
|
+
* @param callbacks - Callbacks for external interfaces, including message
|
|
37
|
+
* reporting and file io
|
|
38
|
+
* @param options - Compiler options
|
|
39
|
+
* @returns false if initialization fails
|
|
40
|
+
*/
|
|
41
|
+
async init(callbacks, options) {
|
|
42
|
+
this.callbacks = callbacks;
|
|
43
|
+
this.options = { ...options };
|
|
44
|
+
this.kmpCompiler = new KmpCompiler();
|
|
45
|
+
return await this.kmpCompiler.init(callbacks, options);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Compiles a .kps file to .exe Windows package installer file. Returns an
|
|
49
|
+
* object containing binary artifacts on success. The files are passed in by
|
|
50
|
+
* name, and the compiler will use callbacks as passed to the
|
|
51
|
+
* {@link WindowsPackageInstallerCompiler.init} function to read any input
|
|
52
|
+
* files by disk.
|
|
53
|
+
* @param infile - Path to source file. Path will be parsed to find relative
|
|
54
|
+
* references in the .kmn file, such as icon or On Screen
|
|
55
|
+
* Keyboard file
|
|
56
|
+
* @param outfile - Path to output file. The file will not be written to, but
|
|
57
|
+
* will be included in the result for use by
|
|
58
|
+
* {@link WindowsPackageInstallerCompiler.write}.
|
|
59
|
+
* @returns Binary artifacts on success, null on failure.
|
|
60
|
+
*/
|
|
61
|
+
async run(inputFilename, outputFilename) {
|
|
62
|
+
const sources = this.options.sources;
|
|
63
|
+
const kps = this.kmpCompiler.loadKpsFile(inputFilename);
|
|
64
|
+
if (!kps) {
|
|
65
|
+
// errors will already have been reported by loadKpsFile
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
// Check existence of required files
|
|
69
|
+
for (const filename of [sources.licenseFilename, sources.msiFilename, sources.setupExeFilename]) {
|
|
70
|
+
if (!this.callbacks.fs.existsSync(filename)) {
|
|
71
|
+
this.callbacks.reportMessage(CompilerMessages.Error_FileDoesNotExist({ filename }));
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// Check existence of optional files
|
|
76
|
+
for (const filename of [sources.titleImageFilename]) {
|
|
77
|
+
if (filename && !this.callbacks.fs.existsSync(filename)) {
|
|
78
|
+
this.callbacks.reportMessage(CompilerMessages.Error_FileDoesNotExist({ filename }));
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// Note: we never use the MSIFileName field from the .kps any more
|
|
83
|
+
// Nor do we use the MSIOptions field.
|
|
84
|
+
// Build the zip
|
|
85
|
+
const zipBuffer = await this.buildZip(kps, inputFilename, sources);
|
|
86
|
+
if (!zipBuffer) {
|
|
87
|
+
// Error messages already reported by buildZip
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
// Build the sfx
|
|
91
|
+
const sfxBuffer = this.buildSfx(zipBuffer, sources);
|
|
92
|
+
const result = {
|
|
93
|
+
artifacts: {
|
|
94
|
+
exe: {
|
|
95
|
+
data: sfxBuffer,
|
|
96
|
+
filename: outputFilename ?? inputFilename.replace(/\.kps$/, '.exe')
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Write artifacts from a successful compile to disk, via callbacks methods.
|
|
104
|
+
* The artifacts written may include:
|
|
105
|
+
*
|
|
106
|
+
* - .exe file - binary Windows package installer executable file
|
|
107
|
+
*
|
|
108
|
+
* @param artifacts - object containing artifact binary data to write out
|
|
109
|
+
* @returns true on success
|
|
110
|
+
*/
|
|
111
|
+
async write(artifacts) {
|
|
112
|
+
this.callbacks.fs.writeFileSync(artifacts.exe.filename, artifacts.exe.data);
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
async buildZip(kps, kpsFilename, sources) {
|
|
116
|
+
const kmpJson = this.kmpCompiler.transformKpsFileToKmpObject(kpsFilename, kps);
|
|
117
|
+
if (!kmpJson.info?.name?.description) {
|
|
118
|
+
this.callbacks.reportMessage(CompilerMessages.Error_PackageNameCannotBeBlank());
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
const kmpFilename = this.callbacks.path.basename(kpsFilename, ".kps" /* KeymanFileTypes.Source.Package */) + ".kmp" /* KeymanFileTypes.Binary.Package */;
|
|
122
|
+
const setupInfBuffer = this.buildSetupInf(sources, kmpJson, kmpFilename, kps);
|
|
123
|
+
const kmpBuffer = await this.kmpCompiler.buildKmpFile(kpsFilename, kmpJson);
|
|
124
|
+
// Note that this does not technically generate a "valid" sfx according to
|
|
125
|
+
// the zip spec, because the offsets in the .zip are relative to the start
|
|
126
|
+
// of the zip, rather than to the start of the sfx. However, as Keyman's
|
|
127
|
+
// installer chops out the zip from the sfx and loads it in a new stream, it
|
|
128
|
+
// works as expected.
|
|
129
|
+
const zip = JSZip();
|
|
130
|
+
zip.file(SETUP_INF_FILENAME, setupInfBuffer);
|
|
131
|
+
zip.file(kmpFilename, kmpBuffer);
|
|
132
|
+
zip.file(this.callbacks.path.basename(sources.msiFilename), this.callbacks.loadFile(sources.msiFilename));
|
|
133
|
+
zip.file(this.callbacks.path.basename(sources.licenseFilename), this.callbacks.loadFile(sources.licenseFilename));
|
|
134
|
+
if (sources.titleImageFilename) {
|
|
135
|
+
zip.file(this.callbacks.path.basename(sources.titleImageFilename), this.callbacks.loadFile(sources.titleImageFilename));
|
|
136
|
+
}
|
|
137
|
+
return zip.generateAsync({ type: 'uint8array', compression: 'DEFLATE' });
|
|
138
|
+
}
|
|
139
|
+
buildSetupInf(sources, kmpJson, kmpFilename, kps) {
|
|
140
|
+
let setupInf = `[Setup]
|
|
141
|
+
Version=${KEYMAN_VERSION.VERSION}
|
|
142
|
+
MSIFileName=${this.callbacks.path.basename(sources.msiFilename)}
|
|
143
|
+
MSIOptions=
|
|
144
|
+
AppName=${sources.appName ?? PRODUCT_NAME}
|
|
145
|
+
License=${this.callbacks.path.basename(sources.licenseFilename)}
|
|
146
|
+
`;
|
|
147
|
+
if (sources.titleImageFilename) {
|
|
148
|
+
setupInf += `TitleImage=${this.callbacks.path.basename(sources.titleImageFilename)}\n`;
|
|
149
|
+
}
|
|
150
|
+
if (kmpJson.options.graphicFile) {
|
|
151
|
+
setupInf += `BitmapFileName=${this.callbacks.path.basename(kmpJson.options.graphicFile)}\n`;
|
|
152
|
+
}
|
|
153
|
+
if (sources.startDisabled) {
|
|
154
|
+
setupInf += `StartDisabled=True\n`;
|
|
155
|
+
}
|
|
156
|
+
if (sources.startWithConfiguration) {
|
|
157
|
+
setupInf += `StartWithConfiguration=True\n`;
|
|
158
|
+
}
|
|
159
|
+
setupInf += `\n[Packages]\n`;
|
|
160
|
+
setupInf += kmpFilename + '\n';
|
|
161
|
+
// TODO: multiple packages?
|
|
162
|
+
const strings = !kps.Strings?.String ? [] : (Array.isArray(kps.Strings.String) ? kps.Strings.String : [kps.Strings.String]);
|
|
163
|
+
if (strings.length) {
|
|
164
|
+
setupInf += `\n[Strings]\n`;
|
|
165
|
+
for (const str of strings) {
|
|
166
|
+
setupInf += `${str.$?.Name}=${str.$?.Value}\n`;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const setupInfBuffer = new TextEncoder().encode(setupInf);
|
|
170
|
+
return setupInfBuffer;
|
|
171
|
+
}
|
|
172
|
+
buildSfx(zipBuffer, sources) {
|
|
173
|
+
const setupRedistBuffer = this.callbacks.loadFile(sources.setupExeFilename);
|
|
174
|
+
const buffer = new Uint8Array(setupRedistBuffer.length + zipBuffer.length);
|
|
175
|
+
buffer.set(setupRedistBuffer, 0);
|
|
176
|
+
buffer.set(zipBuffer, setupRedistBuffer.length);
|
|
177
|
+
return buffer;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
180
|
//# sourceMappingURL=windows-package-installer-compiler.js.map
|
|
181
|
+
//# debugId=416a1ac8-98e1-51e8-b77b-4b2a264f7ee6
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"version":3,"file":"windows-package-installer-compiler.js","sources":["../../../src/compiler/windows-package-installer-compiler.ts"],"sourceRoot":"","names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,cAAc,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAsB,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,MAAM,kBAAkB,GAAG,WAAW,CAAC;AACvC,MAAM,YAAY,GAAG,QAAQ,CAAC;AAe7B,CAAC;AAuBD,CAAC;AAYD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,OAAO,+BAA+B;IAClC,WAAW,CAAc;IACzB,SAAS,CAAoB;IAC7B,OAAO,CAAyC;IAExD;;;;;;;OAOG;IACH,KAAK,CAAC,IAAI,CAAC,SAA4B,EAAE,OAA+C;QACtF,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,EAAC,GAAG,OAAO,EAAC,CAAC;QAC5B,IAAI,CAAC,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;QACrC,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED;;;;;;;;;;;;;OAaG;IACI,KAAK,CAA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