@etothepii/satisfactory-file-parser 0.0.3
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/.eslintrc.json +28 -0
- package/build/parser/blueprint-reader.d.ts +18 -0
- package/build/parser/blueprint-reader.js +137 -0
- package/build/parser/blueprint-reader.js.map +1 -0
- package/build/parser/blueprint-writer.d.ts +21 -0
- package/build/parser/blueprint-writer.js +70 -0
- package/build/parser/blueprint-writer.js.map +1 -0
- package/build/parser/byte/alignment.enum.d.ts +4 -0
- package/build/parser/byte/alignment.enum.js +9 -0
- package/build/parser/byte/alignment.enum.js.map +1 -0
- package/build/parser/byte/byte-reader.class.d.ts +38 -0
- package/build/parser/byte/byte-reader.class.js +133 -0
- package/build/parser/byte/byte-reader.class.js.map +1 -0
- package/build/parser/byte/byte-writer.class.d.ts +38 -0
- package/build/parser/byte/byte-writer.class.js +150 -0
- package/build/parser/byte/byte-writer.class.js.map +1 -0
- package/build/parser/error/parser.error.d.ts +12 -0
- package/build/parser/error/parser.error.js +29 -0
- package/build/parser/error/parser.error.js.map +1 -0
- package/build/parser/parser.class.d.ts +52 -0
- package/build/parser/parser.class.js +85 -0
- package/build/parser/parser.class.js.map +1 -0
- package/build/parser/satisfactory/blueprint/blueprint.interface.d.ts +20 -0
- package/build/parser/satisfactory/blueprint/blueprint.interface.js +3 -0
- package/build/parser/satisfactory/blueprint/blueprint.interface.js.map +1 -0
- package/build/parser/satisfactory/level.class.d.ts +21 -0
- package/build/parser/satisfactory/level.class.js +149 -0
- package/build/parser/satisfactory/level.class.js.map +1 -0
- package/build/parser/satisfactory/objects/DataFields.d.ts +13 -0
- package/build/parser/satisfactory/objects/DataFields.js +250 -0
- package/build/parser/satisfactory/objects/DataFields.js.map +1 -0
- package/build/parser/satisfactory/objects/ObjectReference.d.ts +9 -0
- package/build/parser/satisfactory/objects/ObjectReference.js +18 -0
- package/build/parser/satisfactory/objects/ObjectReference.js.map +1 -0
- package/build/parser/satisfactory/objects/Property.d.ts +270 -0
- package/build/parser/satisfactory/objects/Property.js +1151 -0
- package/build/parser/satisfactory/objects/Property.js.map +1 -0
- package/build/parser/satisfactory/objects/SaveComponent.d.ts +16 -0
- package/build/parser/satisfactory/objects/SaveComponent.js +32 -0
- package/build/parser/satisfactory/objects/SaveComponent.js.map +1 -0
- package/build/parser/satisfactory/objects/SaveEntity.d.ts +25 -0
- package/build/parser/satisfactory/objects/SaveEntity.js +71 -0
- package/build/parser/satisfactory/objects/SaveEntity.js.map +1 -0
- package/build/parser/satisfactory/objects/SaveObject.d.ts +14 -0
- package/build/parser/satisfactory/objects/SaveObject.js +30 -0
- package/build/parser/satisfactory/objects/SaveObject.js.map +1 -0
- package/build/parser/satisfactory/satisfactory-save.class.d.ts +57 -0
- package/build/parser/satisfactory/satisfactory-save.class.js +12 -0
- package/build/parser/satisfactory/satisfactory-save.class.js.map +1 -0
- package/build/parser/satisfactory/structs/util.types.d.ts +40 -0
- package/build/parser/satisfactory/structs/util.types.js +96 -0
- package/build/parser/satisfactory/structs/util.types.js.map +1 -0
- package/build/parser/save-reader.d.ts +43 -0
- package/build/parser/save-reader.js +252 -0
- package/build/parser/save-reader.js.map +1 -0
- package/build/parser/save-writer.class.d.ts +22 -0
- package/build/parser/save-writer.class.js +122 -0
- package/build/parser/save-writer.class.js.map +1 -0
- package/build/parser/static-data.d.ts +7 -0
- package/build/parser/static-data.js +3 -0
- package/build/parser/static-data.js.map +1 -0
- package/jest.config.json +12 -0
- package/package.json +40 -0
- package/tsconfig.json +105 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Conveyor = exports.SaveReader = exports.projectionFilterApplies = void 0;
|
|
7
|
+
const pako_1 = __importDefault(require("pako"));
|
|
8
|
+
const alignment_enum_1 = require("./byte/alignment.enum");
|
|
9
|
+
const byte_reader_class_1 = require("./byte/byte-reader.class");
|
|
10
|
+
const level_class_1 = require("./satisfactory/level.class");
|
|
11
|
+
const SaveComponent_1 = require("./satisfactory/objects/SaveComponent");
|
|
12
|
+
const SaveEntity_1 = require("./satisfactory/objects/SaveEntity");
|
|
13
|
+
const parser_error_1 = require("./error/parser.error");
|
|
14
|
+
const projectionFilterApplies = (config, object) => {
|
|
15
|
+
let cond1 = false;
|
|
16
|
+
if ((0, SaveEntity_1.isSaveEntity)(object) || (config.includeComponents && (0, SaveComponent_1.isSaveComponent)(object))) {
|
|
17
|
+
cond1 = true;
|
|
18
|
+
}
|
|
19
|
+
let cond2 = true;
|
|
20
|
+
if ((0, SaveEntity_1.isSaveEntity)(object)) {
|
|
21
|
+
cond2 = false;
|
|
22
|
+
if (config.entityPathFilter.behavior === 'whitelist') {
|
|
23
|
+
cond2 = config.entityPathFilter.list.find(en => object.typePath.startsWith(en)) !== undefined;
|
|
24
|
+
}
|
|
25
|
+
else if (config.entityPathFilter.behavior === 'blacklist') {
|
|
26
|
+
cond2 = config.entityPathFilter.list.find(en => object.typePath.startsWith(en)) === undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return cond1 && cond2;
|
|
30
|
+
};
|
|
31
|
+
exports.projectionFilterApplies = projectionFilterApplies;
|
|
32
|
+
class SaveReader extends byte_reader_class_1.ByteReader {
|
|
33
|
+
constructor(fileBuffer, onProgressCallback = () => { }) {
|
|
34
|
+
super(fileBuffer, alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
35
|
+
this.onProgressCallback = onProgressCallback;
|
|
36
|
+
this.levels = [];
|
|
37
|
+
this.trailingCollectedObjects = [];
|
|
38
|
+
this.compressionInfo = {
|
|
39
|
+
packageFileTag: 0,
|
|
40
|
+
maxChunkContentSize: 0,
|
|
41
|
+
chunkHeaderSize: 48
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
readHeader() {
|
|
45
|
+
this.header = {
|
|
46
|
+
saveHeaderType: 0,
|
|
47
|
+
saveVersion: 0,
|
|
48
|
+
buildVersion: 0,
|
|
49
|
+
mapName: "DEFAULT",
|
|
50
|
+
mapOptions: "",
|
|
51
|
+
sessionName: "",
|
|
52
|
+
playDurationSeconds: 0,
|
|
53
|
+
saveDateTime: "0",
|
|
54
|
+
sessionVisibility: 0
|
|
55
|
+
};
|
|
56
|
+
this.header.saveHeaderType = this.readInt32();
|
|
57
|
+
this.header.saveVersion = this.readInt32();
|
|
58
|
+
this.header.buildVersion = this.readInt32();
|
|
59
|
+
this.header.mapName = this.readString();
|
|
60
|
+
this.header.mapOptions = this.readString();
|
|
61
|
+
this.header.sessionName = this.readString();
|
|
62
|
+
this.header.playDurationSeconds = this.readInt32();
|
|
63
|
+
const rawSaveDateTimeInTicks = this.readLong();
|
|
64
|
+
const unixMilliseconds = (rawSaveDateTimeInTicks - SaveReader.EPOCH_TICKS) / 10000n;
|
|
65
|
+
this.header.saveDateTime = unixMilliseconds.toString();
|
|
66
|
+
this.header.sessionVisibility = this.readByte();
|
|
67
|
+
if (this.header.saveHeaderType >= 7) {
|
|
68
|
+
this.header.fEditorObjectVersion = this.readInt32();
|
|
69
|
+
}
|
|
70
|
+
if (this.header.saveHeaderType >= 8) {
|
|
71
|
+
this.header.rawModMetadataString = this.readString();
|
|
72
|
+
try {
|
|
73
|
+
this.header.modMetadata = JSON.parse(this.header.rawModMetadataString);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
//
|
|
77
|
+
}
|
|
78
|
+
this.header.isModdedSave = this.readInt32();
|
|
79
|
+
}
|
|
80
|
+
if (this.header.saveHeaderType >= 10) {
|
|
81
|
+
this.header.saveIdentifier = this.readString();
|
|
82
|
+
}
|
|
83
|
+
if (this.header.saveVersion >= 21) {
|
|
84
|
+
// all good, ready to read chunks now.
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
throw new parser_error_1.UnsupportedVersionError("The save version is too old to support encoding currently. Save in newer game version.");
|
|
88
|
+
}
|
|
89
|
+
return this.header;
|
|
90
|
+
}
|
|
91
|
+
inflateChunks() {
|
|
92
|
+
// free memory
|
|
93
|
+
this.fileBuffer = this.fileBuffer.slice(this.currentByte);
|
|
94
|
+
this.handledByte = 0;
|
|
95
|
+
this.currentByte = 0;
|
|
96
|
+
this.maxByte = this.fileBuffer.byteLength;
|
|
97
|
+
let currentChunks = [];
|
|
98
|
+
let totalUncompressedBodySize = 0;
|
|
99
|
+
// read while we can handle
|
|
100
|
+
while (this.handledByte < this.maxByte) {
|
|
101
|
+
// Read chunk info size...
|
|
102
|
+
let chunkHeader = new DataView(this.fileBuffer.slice(0, this.compressionInfo.chunkHeaderSize));
|
|
103
|
+
this.currentByte = this.compressionInfo.chunkHeaderSize;
|
|
104
|
+
this.handledByte += this.compressionInfo.chunkHeaderSize;
|
|
105
|
+
if (this.compressionInfo.packageFileTag <= 0) {
|
|
106
|
+
this.compressionInfo.packageFileTag = chunkHeader.getInt32(0, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
107
|
+
}
|
|
108
|
+
if (this.compressionInfo.maxChunkContentSize <= 0) {
|
|
109
|
+
this.compressionInfo.maxChunkContentSize = chunkHeader.getInt32(8, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
110
|
+
}
|
|
111
|
+
const chunkCompressedLength = chunkHeader.getInt32(32, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
112
|
+
const chunkUncompressedLength = chunkHeader.getInt32(40, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
113
|
+
totalUncompressedBodySize += chunkUncompressedLength;
|
|
114
|
+
const currentChunkSize = chunkCompressedLength;
|
|
115
|
+
let currentChunk = this.fileBuffer.slice(this.currentByte, this.currentByte + currentChunkSize);
|
|
116
|
+
this.handledByte += currentChunkSize;
|
|
117
|
+
this.currentByte += currentChunkSize;
|
|
118
|
+
// Free memory from previous chunk...
|
|
119
|
+
this.fileBuffer = this.fileBuffer.slice(this.currentByte);
|
|
120
|
+
this.currentByte = 0;
|
|
121
|
+
// Unzip!
|
|
122
|
+
try {
|
|
123
|
+
// Inflate current chunk
|
|
124
|
+
let currentInflatedChunk = null;
|
|
125
|
+
currentInflatedChunk = pako_1.default.inflate(currentChunk);
|
|
126
|
+
currentChunks.push(currentInflatedChunk);
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
throw new parser_error_1.CompressionLibraryError("Failed to inflate compressed save data. " + err);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
//TODO we can get rid of file buffer here.
|
|
133
|
+
// Create one big chunk out of the little chunks
|
|
134
|
+
let newChunkLength = currentChunks.map(cc => cc.length).reduce((prev, cur) => prev + cur);
|
|
135
|
+
const bigWholeChunk = new Uint8Array(newChunkLength);
|
|
136
|
+
let currentLength = 0;
|
|
137
|
+
for (let i = 0; i < currentChunks.length; i++) {
|
|
138
|
+
bigWholeChunk.set(currentChunks[i], currentLength);
|
|
139
|
+
currentLength += currentChunks[i].length;
|
|
140
|
+
}
|
|
141
|
+
this.currentByte = 0;
|
|
142
|
+
this.maxByte = bigWholeChunk.buffer.byteLength;
|
|
143
|
+
this.bufferView = new DataView(bigWholeChunk.buffer);
|
|
144
|
+
const dataLength = this.readInt32();
|
|
145
|
+
if (totalUncompressedBodySize !== dataLength + 4) {
|
|
146
|
+
throw new parser_error_1.CorruptSaveError(`Possibly corrupt. Indicated size of total save body (${dataLength}) does not match the uncompressed real size of ${totalUncompressedBodySize}.`);
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
concatenatedChunkLength: newChunkLength,
|
|
150
|
+
numChunks: currentChunks.length
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
readLevels() {
|
|
154
|
+
if (!this.header) {
|
|
155
|
+
throw new parser_error_1.ParserError('ParserError', 'Header must be set before objects can be read.');
|
|
156
|
+
}
|
|
157
|
+
if (this.header.saveVersion < 29) {
|
|
158
|
+
throw new parser_error_1.UnsupportedVersionError('Support for < U6 is not yet implemented.');
|
|
159
|
+
}
|
|
160
|
+
const numSubLevels = this.readInt32();
|
|
161
|
+
this.levels = new Array(numSubLevels + 1);
|
|
162
|
+
// read levels
|
|
163
|
+
for (let j = 0; j <= numSubLevels; j++) {
|
|
164
|
+
let levelName = (j === numSubLevels) ? '' + this.header.mapName : this.readString();
|
|
165
|
+
this.onProgressCallback(this.getBufferProgress(), `reading level [${(j + 1)}/${(numSubLevels + 1)}] ${levelName}`);
|
|
166
|
+
this.levels[j] = level_class_1.Level.ReadLevel(this, levelName, this.header.buildVersion);
|
|
167
|
+
}
|
|
168
|
+
// in U6/U7 there were more collectibles added that do not belong to a particular level
|
|
169
|
+
if (this.getBufferPosition() < this.bufferView.byteLength) {
|
|
170
|
+
this.trailingCollectedObjects = level_class_1.Level.ReadCollectablesList(this);
|
|
171
|
+
}
|
|
172
|
+
return this.levels;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// the number of .net ticks at the unix epoch
|
|
176
|
+
SaveReader.EPOCH_TICKS = 621355968000000000n;
|
|
177
|
+
exports.SaveReader = SaveReader;
|
|
178
|
+
class Conveyor {
|
|
179
|
+
static getConveyorBeltRegex() {
|
|
180
|
+
return /\/Game\/FactoryGame\/Buildable\/Factory\/(ConveyorBeltMk[0-9]+)\/Build_(\1)\.Build_(\1)_C/g;
|
|
181
|
+
}
|
|
182
|
+
;
|
|
183
|
+
static getConveyorLiftRegex() {
|
|
184
|
+
return /\/Game\/FactoryGame\/Buildable\/Factory\/(ConveyorLiftMk[0-9]+)\/Build_(\1)\.Build_(\1)_C/g;
|
|
185
|
+
}
|
|
186
|
+
;
|
|
187
|
+
static isAConveyorBelt(obj) {
|
|
188
|
+
return obj.typePath.match(this.getConveyorBeltRegex()) !== null;
|
|
189
|
+
}
|
|
190
|
+
static isAConveyorLift(obj) {
|
|
191
|
+
return obj.typePath.match(this.getConveyorLiftRegex()) !== null;
|
|
192
|
+
}
|
|
193
|
+
static get availableConnections() { return ['.ConveyorAny0', '.ConveyorAny1', '.Input0', '.Input1', '.Input2', '.Input3', '.InPut3', '.Input4', '.Input5', '.Input6', '.Output0', '.Output1', '.Output2', '.Output3']; }
|
|
194
|
+
static get availableConveyorBelts() {
|
|
195
|
+
return [
|
|
196
|
+
'/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk1/Build_ConveyorBeltMk1.Build_ConveyorBeltMk1_C',
|
|
197
|
+
'/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk2/Build_ConveyorBeltMk2.Build_ConveyorBeltMk2_C',
|
|
198
|
+
'/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk3/Build_ConveyorBeltMk3.Build_ConveyorBeltMk3_C',
|
|
199
|
+
'/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk4/Build_ConveyorBeltMk4.Build_ConveyorBeltMk4_C',
|
|
200
|
+
'/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk5/Build_ConveyorBeltMk5.Build_ConveyorBeltMk5_C'
|
|
201
|
+
];
|
|
202
|
+
}
|
|
203
|
+
static get availableConveyorLifts() {
|
|
204
|
+
return [
|
|
205
|
+
'/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk1/Build_ConveyorLiftMk1.Build_ConveyorLiftMk1_C',
|
|
206
|
+
'/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk2/Build_ConveyorLiftMk2.Build_ConveyorLiftMk2_C',
|
|
207
|
+
'/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk3/Build_ConveyorLiftMk3.Build_ConveyorLiftMk3_C',
|
|
208
|
+
'/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk4/Build_ConveyorLiftMk4.Build_ConveyorLiftMk4_C',
|
|
209
|
+
'/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk5/Build_ConveyorLiftMk5.Build_ConveyorLiftMk5_C'
|
|
210
|
+
];
|
|
211
|
+
}
|
|
212
|
+
/*
|
|
213
|
+
* BELT/LIFT LOOKUP, includes mods to avoid finding them everywhere
|
|
214
|
+
*/
|
|
215
|
+
static isConveyor(currentObject) {
|
|
216
|
+
return Conveyor.isConveyorBelt(currentObject) || Conveyor.isConveyorLift(currentObject);
|
|
217
|
+
}
|
|
218
|
+
static isConveyorBelt(currentObject) {
|
|
219
|
+
if (Conveyor.availableConveyorBelts.includes(currentObject.className)) {
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
// Belts Mod
|
|
223
|
+
if (currentObject.className.startsWith('/Conveyors_Mod/Build_BeltMk')
|
|
224
|
+
|| currentObject.className.startsWith('/Game/Conveyors_Mod/Build_BeltMk')
|
|
225
|
+
|| currentObject.className.startsWith('/UltraFastLogistics/Buildable/build_conveyorbeltMK')
|
|
226
|
+
|| currentObject.className.startsWith('/FlexSplines/Conveyor/Build_Belt')
|
|
227
|
+
|| currentObject.className.startsWith('/conveyorbeltmod/Belt/mk')
|
|
228
|
+
|| currentObject.className.startsWith('/minerplus/content/buildable/Factory/belt_')
|
|
229
|
+
|| currentObject.className.startsWith('/bamfp/content/buildable/Factory/belt_')) {
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
static isConveyorLift(currentObject) {
|
|
235
|
+
if (Conveyor.availableConveyorLifts.includes(currentObject.className)) {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
// Lifts Mod
|
|
239
|
+
if (currentObject.className.startsWith('/minerplus/content/buildable/Factory/lift')
|
|
240
|
+
|| currentObject.className.startsWith('/bamfp/content/buildable/Factory/lift')
|
|
241
|
+
|| currentObject.className.startsWith('/Game/Conveyors_Mod/Build_LiftMk')
|
|
242
|
+
|| currentObject.className.startsWith('/Conveyors_Mod/Build_LiftMk')
|
|
243
|
+
|| currentObject.className.startsWith('/Game/CoveredConveyor')
|
|
244
|
+
|| currentObject.className.startsWith('/CoveredConveyor')
|
|
245
|
+
|| currentObject.className.startsWith('/conveyorbeltmod/lift/')) {
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
exports.Conveyor = Conveyor;
|
|
252
|
+
//# sourceMappingURL=save-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-reader.js","sourceRoot":"","sources":["../../src/parser/save-reader.ts"],"names":[],"mappings":";;;;;;AACA,gDAAwB;AACxB,0DAAkD;AAClD,gEAAsD;AACtD,4DAAmD;AAEnD,wEAAsF;AACtF,kEAA6E;AAG7E,uDAAuH;AAahH,MAAM,uBAAuB,GAAG,CAAC,MAA4B,EAAE,MAAkC,EAAE,EAAE;IAE3G,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,IAAA,yBAAY,EAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,IAAI,IAAA,+BAAe,EAAC,MAAM,CAAC,CAAC,EAAE;QAClF,KAAK,GAAG,IAAI,CAAC;KACb;IAED,IAAI,KAAK,GAAG,IAAI,CAAC;IACjB,IAAI,IAAA,yBAAY,EAAC,MAAM,CAAC,EAAE;QACzB,KAAK,GAAG,KAAK,CAAC;QACd,IAAI,MAAM,CAAC,gBAAgB,CAAC,QAAQ,KAAK,WAAW,EAAE;YACrD,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC;SAC9F;aAAM,IAAI,MAAM,CAAC,gBAAgB,CAAC,QAAQ,KAAK,WAAW,EAAE;YAC5D,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,CAA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I,QAAQ,CAAC,sBAAsB,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE;YACtE,OAAO,IAAI,CAAC;SACZ;QAED,YAAY;QACZ,IACC,aAAa,CAAC,SAAS,CAAC,UAAU,CAAC,2CAA2C,CAAC;eAC5E,aAAa,CAAC,SAAS,CAAC,UAAU,CAAC,uCAAuC,CAAC;eAC3E,aAAa,CAAC,SAAS,CAAC,UAAU,CAAC,kCAAkC,CAAC;eACtE,aAAa,CAAC,SAAS,CAAC,UAAU,CAAC,6BAA6B,CAAC;eACjE,aAAa,CAAC,SAAS,CAAC,UAAU,CAAC,uBAAuB,CAAC;eAC3D,aAAa,CAAC,SAAS,CAAC,UAAU,CAAC,kBAAkB,CAAC;eACtD,aAAa,CAAC,SAAS,CAAC,UAAU,CAAC,wBAAwB,CAAC,EAE9D;YACD,OAAO,IAAI,CAAC;SACZ;QAED,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AA7FD,4BA6FC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Alignment } from "./byte/alignment.enum";
|
|
2
|
+
import { ByteWriter } from "./byte/byte-writer.class";
|
|
3
|
+
import { SatisfactorySave, SatisfactorySaveHeader, ChunkCompressionInfo } from "./satisfactory/satisfactory-save.class";
|
|
4
|
+
export declare class SaveWriter extends ByteWriter {
|
|
5
|
+
constructor();
|
|
6
|
+
static WriteHeader(writer: ByteWriter, header: SatisfactorySaveHeader): void;
|
|
7
|
+
static WriteLevels(writer: ByteWriter, save: SatisfactorySave, buildVersion: number): void;
|
|
8
|
+
static GenerateCompressedChunksFromData(bufferArray: ArrayBuffer, compressionInfo: ChunkCompressionInfo, onBinaryBeforeCompressing: (binary: ArrayBuffer) => void, onChunk: (chunk: Uint8Array) => void, onFinish: (summary: {
|
|
9
|
+
errors: string[];
|
|
10
|
+
chunkSummary: {
|
|
11
|
+
uncompressedSize: number;
|
|
12
|
+
compressedSize: number;
|
|
13
|
+
}[];
|
|
14
|
+
}) => void, alignment?: Alignment): void;
|
|
15
|
+
generateChunks(compressionInfo: ChunkCompressionInfo, posAfterHeader: number, onBinaryBeforeCompressing: (binary: ArrayBuffer) => void, onHeader: (header: Uint8Array) => void, onChunk: (chunk: Uint8Array) => void, onFinish: (summary: {
|
|
16
|
+
errors: string[];
|
|
17
|
+
chunkSummary: {
|
|
18
|
+
uncompressedSize: number;
|
|
19
|
+
compressedSize: number;
|
|
20
|
+
}[];
|
|
21
|
+
}) => void): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SaveWriter = void 0;
|
|
7
|
+
const pako_1 = __importDefault(require("pako"));
|
|
8
|
+
const alignment_enum_1 = require("./byte/alignment.enum");
|
|
9
|
+
const byte_writer_class_1 = require("./byte/byte-writer.class");
|
|
10
|
+
const level_class_1 = require("./satisfactory/level.class");
|
|
11
|
+
const parser_error_1 = require("./error/parser.error");
|
|
12
|
+
class SaveWriter extends byte_writer_class_1.ByteWriter {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
15
|
+
}
|
|
16
|
+
static WriteHeader(writer, header) {
|
|
17
|
+
writer.writeInt32(header.saveHeaderType);
|
|
18
|
+
writer.writeInt32(header.saveVersion);
|
|
19
|
+
writer.writeInt32(header.buildVersion);
|
|
20
|
+
writer.writeString(header.mapName);
|
|
21
|
+
writer.writeString(header.mapOptions);
|
|
22
|
+
writer.writeString(header.sessionName);
|
|
23
|
+
writer.writeInt32(header.playDurationSeconds);
|
|
24
|
+
writer.writeInt64(BigInt(header.saveDateTime));
|
|
25
|
+
writer.writeByte(header.sessionVisibility);
|
|
26
|
+
if (header.saveHeaderType >= 7) {
|
|
27
|
+
writer.writeInt32(header.fEditorObjectVersion);
|
|
28
|
+
}
|
|
29
|
+
if (header.saveHeaderType >= 8) {
|
|
30
|
+
if (header.modMetadata) {
|
|
31
|
+
writer.writeString(JSON.stringify(header.modMetadata));
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
writer.writeString(header.rawModMetadataString);
|
|
35
|
+
}
|
|
36
|
+
writer.writeInt32(header.isModdedSave);
|
|
37
|
+
}
|
|
38
|
+
if (header.saveHeaderType >= 10) {
|
|
39
|
+
writer.writeString(header.saveIdentifier);
|
|
40
|
+
}
|
|
41
|
+
if (header.saveVersion >= 21) {
|
|
42
|
+
// ready to write levels now.
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
throw new parser_error_1.UnsupportedVersionError("The save version is too old to be supported currently.");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
static WriteLevels(writer, save, buildVersion) {
|
|
49
|
+
writer.writeInt32(save.levels.length - 1);
|
|
50
|
+
for (const level of save.levels) {
|
|
51
|
+
if (level.name !== save.header.mapName) {
|
|
52
|
+
writer.writeString(level.name);
|
|
53
|
+
}
|
|
54
|
+
level_class_1.Level.WriteLevel(writer, level, buildVersion);
|
|
55
|
+
}
|
|
56
|
+
level_class_1.Level.SerializeCollectablesList(writer, save.trailingCollectedObjects);
|
|
57
|
+
}
|
|
58
|
+
static GenerateCompressedChunksFromData(bufferArray, compressionInfo, onBinaryBeforeCompressing, onChunk, onFinish, alignment = alignment_enum_1.Alignment.LITTLE_ENDIAN) {
|
|
59
|
+
const errors = [];
|
|
60
|
+
const totalUncompressedSize = bufferArray.byteLength;
|
|
61
|
+
const saveBody = new Uint8Array(bufferArray.byteLength + 4);
|
|
62
|
+
saveBody.set(new Uint8Array(bufferArray), 4);
|
|
63
|
+
const miniView = new DataView(saveBody.buffer);
|
|
64
|
+
miniView.setInt32(0, totalUncompressedSize, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
65
|
+
onBinaryBeforeCompressing(saveBody.buffer);
|
|
66
|
+
// collect slices of chunks with help of compression info for max chunk size
|
|
67
|
+
let handledByte = 0;
|
|
68
|
+
const chunkSummary = [];
|
|
69
|
+
while (handledByte < saveBody.byteLength) {
|
|
70
|
+
// create uncompressed chunk.
|
|
71
|
+
const uncompressedContentSize = Math.min(compressionInfo.maxChunkContentSize, saveBody.byteLength - handledByte);
|
|
72
|
+
const uncompressedChunk = saveBody.buffer.slice(handledByte, handledByte + uncompressedContentSize);
|
|
73
|
+
// deflate chunk while we're at it.
|
|
74
|
+
let compressedChunk = new Uint8Array(0);
|
|
75
|
+
try {
|
|
76
|
+
compressedChunk = pako_1.default.deflate(uncompressedChunk);
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
errors.push("An error occurred while calling pako deflate. -> " + err);
|
|
80
|
+
}
|
|
81
|
+
const chunk = new Uint8Array(compressionInfo.chunkHeaderSize + compressedChunk.byteLength);
|
|
82
|
+
chunk.set(compressedChunk, compressionInfo.chunkHeaderSize);
|
|
83
|
+
// write header
|
|
84
|
+
const view = new DataView(chunk.buffer);
|
|
85
|
+
view.setInt32(0, compressionInfo.packageFileTag, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
86
|
+
view.setInt32(4, 0, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
87
|
+
view.setInt32(8, compressionInfo.maxChunkContentSize, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
88
|
+
view.setInt32(12, 0, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
89
|
+
view.setInt32(16, compressedChunk.byteLength, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
90
|
+
view.setInt32(20, 0, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
91
|
+
view.setInt32(24, uncompressedContentSize, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
92
|
+
view.setInt32(28, 0, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
93
|
+
view.setInt32(32, compressedChunk.byteLength, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
94
|
+
view.setInt32(36, 0, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
95
|
+
view.setInt32(40, uncompressedContentSize, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
96
|
+
view.setInt32(44, 0, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
97
|
+
onChunk(chunk);
|
|
98
|
+
chunkSummary.push({
|
|
99
|
+
uncompressedSize: uncompressedContentSize + compressionInfo.chunkHeaderSize,
|
|
100
|
+
compressedSize: compressedChunk.byteLength + compressionInfo.chunkHeaderSize
|
|
101
|
+
});
|
|
102
|
+
handledByte += uncompressedContentSize;
|
|
103
|
+
}
|
|
104
|
+
onFinish({
|
|
105
|
+
errors,
|
|
106
|
+
chunkSummary
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
generateChunks(compressionInfo, posAfterHeader, onBinaryBeforeCompressing, onHeader, onChunk, onFinish) {
|
|
110
|
+
if (posAfterHeader <= 0) {
|
|
111
|
+
throw new parser_error_1.ParserError('ParserError', 'Seems like this buffer has no header. Please write the header first before you can generate chunks.');
|
|
112
|
+
}
|
|
113
|
+
// send plain header first.
|
|
114
|
+
const header = new Uint8Array(this.bufferArray.slice(0, posAfterHeader));
|
|
115
|
+
onHeader(header);
|
|
116
|
+
// create save body
|
|
117
|
+
this.bufferArray = this.bufferArray.slice(posAfterHeader);
|
|
118
|
+
SaveWriter.GenerateCompressedChunksFromData(this.bufferArray, compressionInfo, onBinaryBeforeCompressing, onChunk, onFinish, this.alignment);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.SaveWriter = SaveWriter;
|
|
122
|
+
//# sourceMappingURL=save-writer.class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-writer.class.js","sourceRoot":"","sources":["../../src/parser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EAAE,eAAe,CAAC,UAAU,GAAG,eAAe,CAAC,eAAe;aAC5E,CAAC,CAAC;YACH,WAAW,IAAI,uBAAuB,CAAC;SACvC;QAED,QAAQ,CAAC;YACR,MAAM;YACN,YAAY;SACZ,CAAC,CAAC;IACJ,CAAC;IAEM,cAAc,CACpB,eAAqC,EACrC,cAAsB,EAEtB,yBAAwD,EACxD,QAAsC,EACtC,OAAoC,EACpC,QAAuH;QAGvH,IAAI,cAAc,IAAI,CAAC,EAAE;YACxB,MAAM,IAAI,0BAAW,CAAC,aAAa,EAAE,qGAAqG,CAAC,CAAC;SAC5I;QAED,2BAA2B;QAC3B,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC;QACzE,QAAQ,CAAC,MAAM,CAAC,CAAC;QAEjB,mBAAmB;QACnB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAC1D,UAAU,CAAC,gCAAgC,CAAC,IAAI,CAAC,WAAW,EAAE,eAAe,EAAE,yBAAyB,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC9I,CAAC;CACD;AAjJD,gCAiJC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static-data.js","sourceRoot":"","sources":["../../src/parser/static-data.ts"],"names":[],"mappings":""}
|
package/jest.config.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"collectCoverage": true,
|
|
3
|
+
"collectCoverageFrom": ["**/src/parser/**"],
|
|
4
|
+
"testTimeout": 60000,
|
|
5
|
+
"testEnvironment": "node",
|
|
6
|
+
"roots": ["<rootDir>/src/test"],
|
|
7
|
+
"preset": "ts-jest",
|
|
8
|
+
"transform": {
|
|
9
|
+
"^.+\\.ts?$": "ts-jest"
|
|
10
|
+
},
|
|
11
|
+
"verbose": true
|
|
12
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@etothepii/satisfactory-file-parser",
|
|
3
|
+
"author": "etothepii",
|
|
4
|
+
"version": "0.0.3",
|
|
5
|
+
"description": "A file parser for satisfactory files. Includes save files and blueprint files.",
|
|
6
|
+
"main": "build/parser/parser.class.js",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"satisfactory",
|
|
9
|
+
"save",
|
|
10
|
+
"parser",
|
|
11
|
+
"blueprint",
|
|
12
|
+
"unreal engine",
|
|
13
|
+
"typescript"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "jest --config=jest.config.json",
|
|
17
|
+
"build": "npm version patch && tsc"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+ssh://git@gitlab.com/satisfactory-modding/satisfactory-file-parser.git"
|
|
22
|
+
},
|
|
23
|
+
"license": "ISC",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://gitlab.com/satisfactory-modding/satisfactory-file-parser/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://gitlab.com/satisfactory-modding/satisfactory-file-parser#readme",
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/jest": "^29.5.0",
|
|
30
|
+
"@types/node": "^18.15.10",
|
|
31
|
+
"@types/pako": "^2.0.0",
|
|
32
|
+
"jest": "^29.5.0",
|
|
33
|
+
"ts-jest": "^29.0.5",
|
|
34
|
+
"typescript": "^5.0.2"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"pako": "^2.1.0",
|
|
38
|
+
"ts-node": "^10.9.1"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "es2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
+
"lib": ["ES2020"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
+
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
18
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
20
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
22
|
+
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
23
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
+
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
+
|
|
27
|
+
/* Modules */
|
|
28
|
+
"module": "commonjs", /* Specify what module code is generated. */
|
|
29
|
+
"rootDir": "src", /* Specify the root folder within your source files. */
|
|
30
|
+
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
+
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
36
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
|
+
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
|
+
"resolveJsonModule": true, /* Enable importing .json files. */
|
|
39
|
+
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
40
|
+
|
|
41
|
+
/* JavaScript Support */
|
|
42
|
+
"allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
43
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
44
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
45
|
+
|
|
46
|
+
/* Emit */
|
|
47
|
+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
48
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
49
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
50
|
+
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
51
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
52
|
+
"outDir": "build", /* Specify an output folder for all emitted files. */
|
|
53
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
54
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
55
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
56
|
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
57
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
58
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
59
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
60
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
61
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
62
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
63
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
64
|
+
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
65
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
66
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
67
|
+
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
68
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
69
|
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
70
|
+
|
|
71
|
+
/* Interop Constraints */
|
|
72
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
73
|
+
"allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
74
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
75
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
76
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
77
|
+
|
|
78
|
+
/* Type Checking */
|
|
79
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
80
|
+
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
81
|
+
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
82
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
83
|
+
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
84
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
85
|
+
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
86
|
+
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
87
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
88
|
+
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
89
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
90
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
91
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
92
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
93
|
+
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
94
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
95
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
96
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
97
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
98
|
+
|
|
99
|
+
/* Completeness */
|
|
100
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
101
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
102
|
+
},
|
|
103
|
+
"exclude": ["node_modules", "coverage", "logs", "build", "**/test/*"],
|
|
104
|
+
"include": ["src"]
|
|
105
|
+
}
|