@ue-shed/uasset 0.1.0-rc.1
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 +18 -0
- package/bin/uasset.js +23 -0
- package/package.json +45 -0
- package/src/index.d.ts +25 -0
- package/src/index.js +80 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 UE Shed contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# `@ue-shed/uasset`
|
|
2
|
+
|
|
3
|
+
The platform-selecting `uasset` command for UE Shed's read-only saved-asset parser. Version
|
|
4
|
+
`0.1.0-rc.1` supports Windows x64 and installs the matching native artifact through an exact optional
|
|
5
|
+
dependency.
|
|
6
|
+
|
|
7
|
+
```powershell
|
|
8
|
+
pnpm add --save-exact @ue-shed/uasset@0.1.0-rc.1
|
|
9
|
+
pnpm exec uasset --version
|
|
10
|
+
pnpm exec uasset inspect ./Content/Example.uasset --format json
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The launcher resolves only the executable contained in `@ue-shed/uasset-win32-x64`. It never builds
|
|
14
|
+
Cargo sources, searches a sibling checkout, probes `target`, or downloads an executable at runtime.
|
|
15
|
+
Unsupported platforms fail with `UnsupportedPlatformError`; a missing optional dependency fails with
|
|
16
|
+
`PlatformPackageUnavailableError` and reinstall guidance.
|
|
17
|
+
|
|
18
|
+
Node.js 22.14 or later is required. The package and native parser are MIT licensed.
|
package/bin/uasset.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { resolveUassetExecutable } from "../src/index.js";
|
|
5
|
+
|
|
6
|
+
try {
|
|
7
|
+
const executable = resolveUassetExecutable();
|
|
8
|
+
const result = spawnSync(executable, process.argv.slice(2), {
|
|
9
|
+
stdio: "inherit",
|
|
10
|
+
windowsHide: true
|
|
11
|
+
});
|
|
12
|
+
if (result.error !== undefined) throw result.error;
|
|
13
|
+
if (result.signal !== null) {
|
|
14
|
+
process.stderr.write(`uasset terminated by signal ${result.signal}\n`);
|
|
15
|
+
process.exitCode = 1;
|
|
16
|
+
} else {
|
|
17
|
+
process.exitCode = result.status ?? 1;
|
|
18
|
+
}
|
|
19
|
+
} catch (cause) {
|
|
20
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
21
|
+
process.stderr.write(`uasset: ${message}\n`);
|
|
22
|
+
process.exitCode = 1;
|
|
23
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ue-shed/uasset",
|
|
3
|
+
"version": "0.1.0-rc.1",
|
|
4
|
+
"description": "Platform-selecting launcher for the UE Shed saved-asset parser",
|
|
5
|
+
"homepage": "https://github.com/ue-shed/ue-shed#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/ue-shed/ue-shed/issues"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/ue-shed/ue-shed.git",
|
|
13
|
+
"directory": "packages/uasset"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"uasset": "./bin/uasset.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"bin",
|
|
20
|
+
"src/index.d.ts",
|
|
21
|
+
"src/index.js",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"type": "module",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./src/index.d.ts",
|
|
29
|
+
"default": "./src/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"optionalDependencies": {
|
|
36
|
+
"@ue-shed/uasset-win32-x64": "0.1.0-rc.1"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=22.14.0"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"test": "node --test",
|
|
43
|
+
"typecheck": "tsc --noEmit"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type UassetLauncherErrorCode =
|
|
2
|
+
| "UE_SHED_UASSET_PLATFORM_PACKAGE_UNAVAILABLE"
|
|
3
|
+
| "UE_SHED_UASSET_UNSUPPORTED_PLATFORM";
|
|
4
|
+
|
|
5
|
+
export declare class UnsupportedPlatformError extends Error {
|
|
6
|
+
readonly name: "UnsupportedPlatformError";
|
|
7
|
+
readonly code: "UE_SHED_UASSET_UNSUPPORTED_PLATFORM";
|
|
8
|
+
readonly platform: string;
|
|
9
|
+
readonly arch: string;
|
|
10
|
+
constructor(platform: string, arch: string);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export declare class PlatformPackageUnavailableError extends Error {
|
|
14
|
+
readonly name: "PlatformPackageUnavailableError";
|
|
15
|
+
readonly code: "UE_SHED_UASSET_PLATFORM_PACKAGE_UNAVAILABLE";
|
|
16
|
+
readonly packageName: string;
|
|
17
|
+
constructor(packageName: string, cause?: unknown);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export declare function platformPackageName(
|
|
21
|
+
platform?: string,
|
|
22
|
+
arch?: string
|
|
23
|
+
): "@ue-shed/uasset-win32-x64";
|
|
24
|
+
|
|
25
|
+
export declare function resolveUassetExecutable(platform?: string, arch?: string): string;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { accessSync, constants } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
const VERSION = "0.1.0-rc.1";
|
|
7
|
+
const WINDOWS_X64_PACKAGE = "@ue-shed/uasset-win32-x64";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* An operating-system and CPU combination for which no parser artifact is published.
|
|
11
|
+
*/
|
|
12
|
+
export class UnsupportedPlatformError extends Error {
|
|
13
|
+
/**
|
|
14
|
+
* @param {string} platform
|
|
15
|
+
* @param {string} arch
|
|
16
|
+
*/
|
|
17
|
+
constructor(platform, arch) {
|
|
18
|
+
super(
|
|
19
|
+
`@ue-shed/uasset ${VERSION} does not support ${platform}/${arch}. ` +
|
|
20
|
+
"This release supports Windows x64 only. Run the parser on a Windows x64 host " +
|
|
21
|
+
"or install a later @ue-shed/uasset release that lists your platform."
|
|
22
|
+
);
|
|
23
|
+
this.name = "UnsupportedPlatformError";
|
|
24
|
+
this.code = "UE_SHED_UASSET_UNSUPPORTED_PLATFORM";
|
|
25
|
+
this.platform = platform;
|
|
26
|
+
this.arch = arch;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The selected platform package was not installed or does not contain its executable.
|
|
32
|
+
*/
|
|
33
|
+
export class PlatformPackageUnavailableError extends Error {
|
|
34
|
+
/**
|
|
35
|
+
* @param {string} packageName
|
|
36
|
+
* @param {unknown} [cause]
|
|
37
|
+
*/
|
|
38
|
+
constructor(packageName, cause) {
|
|
39
|
+
super(
|
|
40
|
+
`The required ${packageName}@${VERSION} parser artifact is unavailable. ` +
|
|
41
|
+
`Reinstall @ue-shed/uasset@${VERSION} with optional dependencies enabled.`,
|
|
42
|
+
{ cause }
|
|
43
|
+
);
|
|
44
|
+
this.name = "PlatformPackageUnavailableError";
|
|
45
|
+
this.code = "UE_SHED_UASSET_PLATFORM_PACKAGE_UNAVAILABLE";
|
|
46
|
+
this.packageName = packageName;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Select the one published package for a platform. This function never probes the filesystem.
|
|
52
|
+
*
|
|
53
|
+
* @param {string} [platform]
|
|
54
|
+
* @param {string} [arch]
|
|
55
|
+
* @returns {string}
|
|
56
|
+
*/
|
|
57
|
+
export function platformPackageName(platform = process.platform, arch = process.arch) {
|
|
58
|
+
if (platform === "win32" && arch === "x64") return WINDOWS_X64_PACKAGE;
|
|
59
|
+
throw new UnsupportedPlatformError(platform, arch);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Resolve the executable shipped in the installed platform package. There is intentionally no
|
|
64
|
+
* source-checkout, Cargo target, PATH, or runtime-download fallback.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} [platform]
|
|
67
|
+
* @param {string} [arch]
|
|
68
|
+
* @returns {string}
|
|
69
|
+
*/
|
|
70
|
+
export function resolveUassetExecutable(platform = process.platform, arch = process.arch) {
|
|
71
|
+
const packageName = platformPackageName(platform, arch);
|
|
72
|
+
try {
|
|
73
|
+
const packageJson = require.resolve(`${packageName}/package.json`);
|
|
74
|
+
const executable = join(dirname(packageJson), "bin", "uasset.exe");
|
|
75
|
+
accessSync(executable, constants.R_OK);
|
|
76
|
+
return executable;
|
|
77
|
+
} catch (cause) {
|
|
78
|
+
throw new PlatformPackageUnavailableError(packageName, cause);
|
|
79
|
+
}
|
|
80
|
+
}
|