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