@fgv/ts-res 5.0.0-17 → 5.0.0-18

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.
@@ -133,15 +133,11 @@ class ZipArchiveLoader {
133
133
  }
134
134
  // Get the config path from the manifest
135
135
  const configPath = manifest.config.archivePath;
136
- const configResult = zipAccessors.getFileContents(configPath);
137
- if (configResult.isFailure()) {
138
- return (0, ts_utils_1.fail)(`Manifest specifies config file at '${configPath}' but it was not found in archive`);
139
- }
140
- const parseResult = (0, zipArchiveFormat_1.parseZipArchiveConfiguration)(configResult.value);
141
- if (parseResult.isFailure()) {
142
- return (0, ts_utils_1.fail)(`Failed to parse config file '${configPath}': ${parseResult.message}`);
143
- }
144
- return (0, ts_utils_1.succeed)(parseResult.value);
136
+ return zipAccessors
137
+ .getFileContents(configPath)
138
+ .withErrorFormat(() => `Manifest specifies config file at '${configPath}' but it was not found in archive`)
139
+ .onSuccess((configContent) => (0, zipArchiveFormat_1.parseZipArchiveConfiguration)(configContent))
140
+ .withErrorFormat((e) => `Failed to parse config file '${configPath}': ${e}`);
145
141
  }
146
142
  /**
147
143
  * Extract files and directory structure from ZIP
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fgv/ts-res",
3
- "version": "5.0.0-17",
3
+ "version": "5.0.0-18",
4
4
  "description": "Multi-dimensional Resource Runtime",
5
5
  "main": "lib/index.js",
6
6
  "types": "dist/ts-res.d.ts",
@@ -44,16 +44,16 @@
44
44
  "@rushstack/heft-node-rig": "~2.9.3",
45
45
  "@types/heft-jest": "1.0.6",
46
46
  "eslint-plugin-tsdoc": "~0.4.0",
47
- "@fgv/ts-utils-jest": "5.0.0-17",
48
- "@fgv/ts-extras": "5.0.0-17"
47
+ "@fgv/ts-utils-jest": "5.0.0-18",
48
+ "@fgv/ts-extras": "5.0.0-18"
49
49
  },
50
50
  "dependencies": {
51
51
  "luxon": "^3.7.1",
52
52
  "fflate": "~0.8.2",
53
- "@fgv/ts-utils": "5.0.0-17",
54
- "@fgv/ts-json-base": "5.0.0-17",
55
- "@fgv/ts-bcp47": "5.0.0-17",
56
- "@fgv/ts-json": "5.0.0-17"
53
+ "@fgv/ts-utils": "5.0.0-18",
54
+ "@fgv/ts-json-base": "5.0.0-18",
55
+ "@fgv/ts-json": "5.0.0-18",
56
+ "@fgv/ts-bcp47": "5.0.0-18"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "heft build --clean",
@@ -172,17 +172,13 @@ export class ZipArchiveLoader {
172
172
 
173
173
  // Get the config path from the manifest
174
174
  const configPath = manifest!.config!.archivePath;
175
- const configResult = zipAccessors.getFileContents(configPath);
176
- if (configResult.isFailure()) {
177
- return fail(`Manifest specifies config file at '${configPath}' but it was not found in archive`);
178
- }
179
-
180
- const parseResult = parseZipArchiveConfiguration(configResult.value);
181
- if (parseResult.isFailure()) {
182
- return fail(`Failed to parse config file '${configPath}': ${parseResult.message}`);
183
- }
184
-
185
- return succeed(parseResult.value);
175
+ return zipAccessors
176
+ .getFileContents(configPath)
177
+ .withErrorFormat(
178
+ () => `Manifest specifies config file at '${configPath}' but it was not found in archive`
179
+ )
180
+ .onSuccess((configContent) => parseZipArchiveConfiguration(configContent))
181
+ .withErrorFormat((e) => `Failed to parse config file '${configPath}': ${e}`);
186
182
  }
187
183
 
188
184
  /**