electron-forge-maker-innosetup 0.2.9

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.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +360 -0
  3. package/dist/MakerInnosetup.d.ts +63 -0
  4. package/dist/MakerInnosetup.js +424 -0
  5. package/dist/generator.d.ts +82 -0
  6. package/dist/generator.js +495 -0
  7. package/dist/index.d.ts +5 -0
  8. package/dist/index.js +29 -0
  9. package/dist/parser.d.ts +83 -0
  10. package/dist/parser.js +494 -0
  11. package/dist/types.d.ts +607 -0
  12. package/dist/types.js +5 -0
  13. package/package.json +50 -0
  14. package/vendor/.gitkeep +2 -0
  15. package/vendor/innosetup/Default.isl +384 -0
  16. package/vendor/innosetup/ISCC.exe +0 -0
  17. package/vendor/innosetup/ISCmplr.dll +0 -0
  18. package/vendor/innosetup/ISPPBuiltins.iss +323 -0
  19. package/vendor/innosetup/Languages/Armenian.isl +376 -0
  20. package/vendor/innosetup/Languages/BrazilianPortuguese.isl +384 -0
  21. package/vendor/innosetup/Languages/Bulgarian.isl +382 -0
  22. package/vendor/innosetup/Languages/Catalan.isl +371 -0
  23. package/vendor/innosetup/Languages/ChineseSimplified.isl +420 -0
  24. package/vendor/innosetup/Languages/Corsican.isl +399 -0
  25. package/vendor/innosetup/Languages/Czech.isl +378 -0
  26. package/vendor/innosetup/Languages/Danish.isl +379 -0
  27. package/vendor/innosetup/Languages/Dutch.isl +359 -0
  28. package/vendor/innosetup/Languages/Finnish.isl +359 -0
  29. package/vendor/innosetup/Languages/French.isl +404 -0
  30. package/vendor/innosetup/Languages/German.isl +406 -0
  31. package/vendor/innosetup/Languages/Hebrew.isl +377 -0
  32. package/vendor/innosetup/Languages/Icelandic.isl +361 -0
  33. package/vendor/innosetup/Languages/Italian.isl +390 -0
  34. package/vendor/innosetup/Languages/Japanese.isl +367 -0
  35. package/vendor/innosetup/Languages/Norwegian.isl +378 -0
  36. package/vendor/innosetup/Languages/Polish.isl +377 -0
  37. package/vendor/innosetup/Languages/Portuguese.isl +366 -0
  38. package/vendor/innosetup/Languages/Russian.isl +370 -0
  39. package/vendor/innosetup/Languages/Slovak.isl +385 -0
  40. package/vendor/innosetup/Languages/Slovenian.isl +370 -0
  41. package/vendor/innosetup/Languages/Spanish.isl +383 -0
  42. package/vendor/innosetup/Languages/Turkish.isl +384 -0
  43. package/vendor/innosetup/Languages/Ukrainian.isl +385 -0
  44. package/vendor/innosetup/WizClassicImage-IS.bmp +0 -0
  45. package/vendor/innosetup/WizClassicImage.bmp +0 -0
  46. package/vendor/innosetup/WizClassicSmallImage-IS.bmp +0 -0
  47. package/vendor/innosetup/WizClassicSmallImage.bmp +0 -0
  48. package/vendor/innosetup/isbunzip.dll +0 -0
  49. package/vendor/innosetup/isbzip.dll +0 -0
  50. package/vendor/innosetup/islzma.dll +0 -0
  51. package/vendor/innosetup/islzma32.exe +0 -0
  52. package/vendor/innosetup/islzma64.exe +0 -0
  53. package/vendor/innosetup/isscint.dll +0 -0
  54. package/vendor/innosetup/isunzlib.dll +0 -0
  55. package/vendor/innosetup/iszlib.dll +0 -0
package/dist/parser.js ADDED
@@ -0,0 +1,494 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.InnoScriptParser = void 0;
37
+ const fs = __importStar(require("fs"));
38
+ /**
39
+ * Inno Setup 脚本解析器
40
+ * 将 .iss 文件解析为 InnoSetupConfig 对象
41
+ */
42
+ class InnoScriptParser {
43
+ /**
44
+ * 从文件路径解析 ISS 脚本
45
+ */
46
+ static parseFile(issFilePath) {
47
+ const content = fs.readFileSync(issFilePath, "utf-8");
48
+ return this.parse(content);
49
+ }
50
+ /**
51
+ * 解析 ISS 脚本内容
52
+ */
53
+ static parse(content) {
54
+ const config = {};
55
+ const lines = content.split(/\r?\n/);
56
+ let currentSection = null;
57
+ let codeSection = "";
58
+ let inCodeSection = false;
59
+ for (let i = 0; i < lines.length; i++) {
60
+ let line = lines[i].trim();
61
+ // 跳过空行和注释
62
+ if (!line || line.startsWith(";") || line.startsWith("//")) {
63
+ continue;
64
+ }
65
+ // 检测段落
66
+ const sectionMatch = line.match(/^\[(\w+)\]$/);
67
+ if (sectionMatch) {
68
+ currentSection = sectionMatch[1];
69
+ // 处理 Code 段落
70
+ if (currentSection === "Code") {
71
+ inCodeSection = true;
72
+ codeSection = "";
73
+ }
74
+ else {
75
+ inCodeSection = false;
76
+ }
77
+ continue;
78
+ }
79
+ // 如果在 Code 段落中,收集所有代码
80
+ if (inCodeSection) {
81
+ codeSection += lines[i] + "\n";
82
+ continue;
83
+ }
84
+ // 解析不同段落
85
+ if (currentSection === "Setup") {
86
+ this.parseSetupLine(line, config);
87
+ }
88
+ else if (currentSection === "Languages") {
89
+ this.parseLanguagesLine(line, config);
90
+ }
91
+ else if (currentSection === "Tasks") {
92
+ this.parseTasksLine(line, config);
93
+ }
94
+ else if (currentSection === "Types") {
95
+ this.parseTypesLine(line, config);
96
+ }
97
+ else if (currentSection === "Components") {
98
+ this.parseComponentsLine(line, config);
99
+ }
100
+ else if (currentSection === "Files") {
101
+ this.parseFilesLine(line, config);
102
+ }
103
+ else if (currentSection === "Dirs") {
104
+ this.parseDirsLine(line, config);
105
+ }
106
+ else if (currentSection === "Icons") {
107
+ this.parseIconsLine(line, config);
108
+ }
109
+ else if (currentSection === "INI") {
110
+ this.parseINILine(line, config);
111
+ }
112
+ else if (currentSection === "InstallDelete") {
113
+ this.parseInstallDeleteLine(line, config);
114
+ }
115
+ else if (currentSection === "UninstallDelete") {
116
+ this.parseUninstallDeleteLine(line, config);
117
+ }
118
+ else if (currentSection === "Registry") {
119
+ this.parseRegistryLine(line, config);
120
+ }
121
+ else if (currentSection === "Run") {
122
+ this.parseRunLine(line, config);
123
+ }
124
+ else if (currentSection === "UninstallRun") {
125
+ this.parseUninstallRunLine(line, config);
126
+ }
127
+ else if (currentSection === "Messages") {
128
+ this.parseMessagesLine(line, config);
129
+ }
130
+ else if (currentSection === "CustomMessages") {
131
+ this.parseCustomMessagesLine(line, config);
132
+ }
133
+ }
134
+ // 添加 Code 段落
135
+ if (codeSection.trim()) {
136
+ config.Code = codeSection.trim();
137
+ }
138
+ return config;
139
+ }
140
+ /**
141
+ * 解析 Setup 段落的一行
142
+ */
143
+ static parseSetupLine(line, config) {
144
+ const match = line.match(/^(\w+)\s*=\s*(.+)$/);
145
+ if (!match)
146
+ return;
147
+ const [, key, value] = match;
148
+ if (!config.Setup) {
149
+ config.Setup = {};
150
+ }
151
+ // 移除引号
152
+ let parsedValue = value.trim();
153
+ if (parsedValue.startsWith('"') && parsedValue.endsWith('"')) {
154
+ parsedValue = parsedValue.slice(1, -1);
155
+ }
156
+ // 转换布尔值
157
+ if (parsedValue === "yes" || parsedValue === "true") {
158
+ parsedValue = true;
159
+ }
160
+ else if (parsedValue === "no" || parsedValue === "false") {
161
+ parsedValue = false;
162
+ }
163
+ // 转换数字
164
+ if (/^\d+$/.test(parsedValue)) {
165
+ parsedValue = parseInt(parsedValue, 10);
166
+ }
167
+ config.Setup[key] = parsedValue;
168
+ }
169
+ /**
170
+ * 解析参数行(用于 Languages, Files, Icons 等段落)
171
+ */
172
+ static parseParams(line) {
173
+ const params = {};
174
+ const parts = line.split(";").map(p => p.trim());
175
+ for (const part of parts) {
176
+ const match = part.match(/^(\w+):\s*(.+)$/);
177
+ if (match) {
178
+ const [, key, value] = match;
179
+ // 移除引号
180
+ let parsedValue = value.trim();
181
+ if (parsedValue.startsWith('"') && parsedValue.endsWith('"')) {
182
+ parsedValue = parsedValue.slice(1, -1);
183
+ }
184
+ params[key] = parsedValue;
185
+ }
186
+ }
187
+ return params;
188
+ }
189
+ /**
190
+ * 解析 Languages 段落
191
+ */
192
+ static parseLanguagesLine(line, config) {
193
+ if (!config.Languages) {
194
+ config.Languages = [];
195
+ }
196
+ const params = this.parseParams(line);
197
+ if (params.Name && params.MessagesFile) {
198
+ config.Languages.push({
199
+ Name: params.Name,
200
+ MessagesFile: params.MessagesFile,
201
+ LicenseFile: params.LicenseFile,
202
+ InfoBeforeFile: params.InfoBeforeFile,
203
+ InfoAfterFile: params.InfoAfterFile,
204
+ });
205
+ }
206
+ }
207
+ /**
208
+ * 解析 Tasks 段落
209
+ */
210
+ static parseTasksLine(line, config) {
211
+ if (!config.Tasks) {
212
+ config.Tasks = [];
213
+ }
214
+ const params = this.parseParams(line);
215
+ if (params.Name && params.Description) {
216
+ config.Tasks.push({
217
+ Name: params.Name,
218
+ Description: params.Description,
219
+ GroupDescription: params.GroupDescription,
220
+ Flags: params.Flags,
221
+ Components: params.Components,
222
+ Check: params.Check,
223
+ });
224
+ }
225
+ }
226
+ /**
227
+ * 解析 Types 段落
228
+ */
229
+ static parseTypesLine(line, config) {
230
+ if (!config.Types) {
231
+ config.Types = [];
232
+ }
233
+ const params = this.parseParams(line);
234
+ if (params.Name && params.Description) {
235
+ config.Types.push({
236
+ Name: params.Name,
237
+ Description: params.Description,
238
+ Flags: params.Flags,
239
+ });
240
+ }
241
+ }
242
+ /**
243
+ * 解析 Components 段落
244
+ */
245
+ static parseComponentsLine(line, config) {
246
+ if (!config.Components) {
247
+ config.Components = [];
248
+ }
249
+ const params = this.parseParams(line);
250
+ if (params.Name && params.Description) {
251
+ config.Components.push({
252
+ Name: params.Name,
253
+ Description: params.Description,
254
+ Types: params.Types,
255
+ Flags: params.Flags,
256
+ ExtraDiskSpaceRequired: params.ExtraDiskSpaceRequired ? parseInt(params.ExtraDiskSpaceRequired) : undefined,
257
+ });
258
+ }
259
+ }
260
+ /**
261
+ * 解析 Files 段落
262
+ */
263
+ static parseFilesLine(line, config) {
264
+ if (!config.Files) {
265
+ config.Files = [];
266
+ }
267
+ const params = this.parseParams(line);
268
+ if (params.Source && params.DestDir) {
269
+ config.Files.push({
270
+ Source: params.Source,
271
+ DestDir: params.DestDir,
272
+ DestName: params.DestName,
273
+ Flags: params.Flags,
274
+ Permissions: params.Permissions,
275
+ StrongAssemblyName: params.StrongAssemblyName,
276
+ Components: params.Components,
277
+ Tasks: params.Tasks,
278
+ Languages: params.Languages,
279
+ Check: params.Check,
280
+ BeforeInstall: params.BeforeInstall,
281
+ AfterInstall: params.AfterInstall,
282
+ Attribs: params.Attribs,
283
+ FontInstall: params.FontInstall,
284
+ });
285
+ }
286
+ }
287
+ /**
288
+ * 解析 Dirs 段落
289
+ */
290
+ static parseDirsLine(line, config) {
291
+ if (!config.Dirs) {
292
+ config.Dirs = [];
293
+ }
294
+ const params = this.parseParams(line);
295
+ if (params.Name) {
296
+ config.Dirs.push({
297
+ Name: params.Name,
298
+ Permissions: params.Permissions,
299
+ Attribs: params.Attribs,
300
+ Flags: params.Flags,
301
+ Components: params.Components,
302
+ Tasks: params.Tasks,
303
+ Check: params.Check,
304
+ });
305
+ }
306
+ }
307
+ /**
308
+ * 解析 Icons 段落
309
+ */
310
+ static parseIconsLine(line, config) {
311
+ if (!config.Icons) {
312
+ config.Icons = [];
313
+ }
314
+ const params = this.parseParams(line);
315
+ if (params.Name && params.Filename) {
316
+ config.Icons.push({
317
+ Name: params.Name,
318
+ Filename: params.Filename,
319
+ Parameters: params.Parameters,
320
+ WorkingDir: params.WorkingDir,
321
+ HotKey: params.HotKey,
322
+ Comment: params.Comment,
323
+ IconFilename: params.IconFilename,
324
+ IconIndex: params.IconIndex ? parseInt(params.IconIndex) : undefined,
325
+ AppUserModelID: params.AppUserModelID,
326
+ Flags: params.Flags,
327
+ Components: params.Components,
328
+ Tasks: params.Tasks,
329
+ Languages: params.Languages,
330
+ Check: params.Check,
331
+ });
332
+ }
333
+ }
334
+ /**
335
+ * 解析 INI 段落
336
+ */
337
+ static parseINILine(line, config) {
338
+ if (!config.INI) {
339
+ config.INI = [];
340
+ }
341
+ const params = this.parseParams(line);
342
+ if (params.Filename && params.Section) {
343
+ config.INI.push({
344
+ Filename: params.Filename,
345
+ Section: params.Section,
346
+ Key: params.Key,
347
+ String: params.String,
348
+ Flags: params.Flags,
349
+ Components: params.Components,
350
+ Tasks: params.Tasks,
351
+ Check: params.Check,
352
+ });
353
+ }
354
+ }
355
+ /**
356
+ * 解析 InstallDelete 段落
357
+ */
358
+ static parseInstallDeleteLine(line, config) {
359
+ if (!config.InstallDelete) {
360
+ config.InstallDelete = [];
361
+ }
362
+ const params = this.parseParams(line);
363
+ if (params.Type && params.Name) {
364
+ config.InstallDelete.push({
365
+ Type: params.Type,
366
+ Name: params.Name,
367
+ Components: params.Components,
368
+ Tasks: params.Tasks,
369
+ Check: params.Check,
370
+ });
371
+ }
372
+ }
373
+ /**
374
+ * 解析 UninstallDelete 段落
375
+ */
376
+ static parseUninstallDeleteLine(line, config) {
377
+ if (!config.UninstallDelete) {
378
+ config.UninstallDelete = [];
379
+ }
380
+ const params = this.parseParams(line);
381
+ if (params.Type && params.Name) {
382
+ config.UninstallDelete.push({
383
+ Type: params.Type,
384
+ Name: params.Name,
385
+ Components: params.Components,
386
+ Tasks: params.Tasks,
387
+ Check: params.Check,
388
+ });
389
+ }
390
+ }
391
+ /**
392
+ * 解析 Registry 段落
393
+ */
394
+ static parseRegistryLine(line, config) {
395
+ if (!config.Registry) {
396
+ config.Registry = [];
397
+ }
398
+ const params = this.parseParams(line);
399
+ if (params.Root && params.Subkey) {
400
+ let valueData = params.ValueData;
401
+ // 尝试转换为数字
402
+ if (valueData && /^\d+$/.test(valueData)) {
403
+ valueData = parseInt(valueData, 10);
404
+ }
405
+ config.Registry.push({
406
+ Root: params.Root,
407
+ Subkey: params.Subkey,
408
+ ValueType: params.ValueType,
409
+ ValueName: params.ValueName,
410
+ ValueData: valueData,
411
+ Permissions: params.Permissions,
412
+ Flags: params.Flags,
413
+ Components: params.Components,
414
+ Tasks: params.Tasks,
415
+ Check: params.Check,
416
+ });
417
+ }
418
+ }
419
+ /**
420
+ * 解析 Run 段落
421
+ */
422
+ static parseRunLine(line, config) {
423
+ if (!config.Run) {
424
+ config.Run = [];
425
+ }
426
+ const params = this.parseParams(line);
427
+ if (params.Filename) {
428
+ config.Run.push({
429
+ Filename: params.Filename,
430
+ Parameters: params.Parameters,
431
+ WorkingDir: params.WorkingDir,
432
+ StatusMsg: params.StatusMsg,
433
+ Description: params.Description,
434
+ Flags: params.Flags,
435
+ RunOnceId: params.RunOnceId,
436
+ Verb: params.Verb,
437
+ Components: params.Components,
438
+ Tasks: params.Tasks,
439
+ Languages: params.Languages,
440
+ Check: params.Check,
441
+ });
442
+ }
443
+ }
444
+ /**
445
+ * 解析 UninstallRun 段落
446
+ */
447
+ static parseUninstallRunLine(line, config) {
448
+ if (!config.UninstallRun) {
449
+ config.UninstallRun = [];
450
+ }
451
+ const params = this.parseParams(line);
452
+ if (params.Filename) {
453
+ config.UninstallRun.push({
454
+ Filename: params.Filename,
455
+ Parameters: params.Parameters,
456
+ WorkingDir: params.WorkingDir,
457
+ StatusMsg: params.StatusMsg,
458
+ Description: params.Description,
459
+ Flags: params.Flags,
460
+ RunOnceId: params.RunOnceId,
461
+ Components: params.Components,
462
+ Tasks: params.Tasks,
463
+ Check: params.Check,
464
+ });
465
+ }
466
+ }
467
+ /**
468
+ * 解析 Messages 段落
469
+ */
470
+ static parseMessagesLine(line, config) {
471
+ const match = line.match(/^(\w+)\s*=\s*(.+)$/);
472
+ if (!match)
473
+ return;
474
+ const [, key, value] = match;
475
+ if (!config.Messages) {
476
+ config.Messages = {};
477
+ }
478
+ config.Messages[key] = value;
479
+ }
480
+ /**
481
+ * 解析 CustomMessages 段落
482
+ */
483
+ static parseCustomMessagesLine(line, config) {
484
+ const match = line.match(/^(\w+)\s*=\s*(.+)$/);
485
+ if (!match)
486
+ return;
487
+ const [, key, value] = match;
488
+ if (!config.CustomMessages) {
489
+ config.CustomMessages = {};
490
+ }
491
+ config.CustomMessages[key] = value;
492
+ }
493
+ }
494
+ exports.InnoScriptParser = InnoScriptParser;