@travetto/runtime 5.0.0 → 5.0.2
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/README.md +2 -3
- package/package.json +4 -4
- package/src/binary.ts +2 -1
- package/src/exec.ts +1 -0
- package/src/types.ts +3 -0
package/README.md
CHANGED
|
@@ -34,7 +34,6 @@ While running any code within the framework, there are common patterns/goals for
|
|
|
34
34
|
```typescript
|
|
35
35
|
class $Runtime {
|
|
36
36
|
constructor(idx: ManifestIndex, resourceOverrides?: Record<string, string>);
|
|
37
|
-
get #moduleAliases(): Record<string, string>;
|
|
38
37
|
/** Get env name, with support for the default env */
|
|
39
38
|
get env(): string | undefined;
|
|
40
39
|
/** Are we in development mode */
|
|
@@ -320,7 +319,7 @@ export class TimeUtil {
|
|
|
320
319
|
```
|
|
321
320
|
|
|
322
321
|
## Process Execution
|
|
323
|
-
[ExecUtil](https://github.com/travetto/travetto/tree/main/module/runtime/src/exec.ts#
|
|
322
|
+
[ExecUtil](https://github.com/travetto/travetto/tree/main/module/runtime/src/exec.ts#L43) exposes `getResult` as a means to wrap [child_process](https://nodejs.org/api/child_process.html)'s process object. This wrapper allows for a promise-based resolution of the subprocess with the ability to capture the stderr/stdout.
|
|
324
323
|
|
|
325
324
|
A simple example would be:
|
|
326
325
|
|
|
@@ -353,4 +352,4 @@ export function registerShutdownHandler() {
|
|
|
353
352
|
```
|
|
354
353
|
|
|
355
354
|
## Path Behavior
|
|
356
|
-
To ensure consistency in path usage throughout the framework, imports pointing at
|
|
355
|
+
To ensure consistency in path usage throughout the framework, imports pointing at `node:path` and `path` are rewritten at compile time. These imports are pointing towards [Manifest](https://github.com/travetto/travetto/tree/main/module/manifest#readme "Support for project indexing, manifesting, along with file watching")'s `path` implementation. This allows for seamless import/usage patterns with the reliability needed for cross platform support.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/runtime",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "Runtime for travetto applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"console-manager",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"node": ">=22.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@travetto/manifest": "^5.0.
|
|
31
|
+
"@travetto/manifest": "^5.0.1",
|
|
32
32
|
"@types/debug": "^4.1.12",
|
|
33
|
-
"@types/node": "^22.
|
|
33
|
+
"@types/node": "^22.5.1",
|
|
34
34
|
"debug": "^4.3.6"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@travetto/transformer": "^5.0.
|
|
37
|
+
"@travetto/transformer": "^5.0.2"
|
|
38
38
|
},
|
|
39
39
|
"peerDependenciesMeta": {
|
|
40
40
|
"@travetto/transformer": {
|
package/src/binary.ts
CHANGED
|
@@ -59,7 +59,8 @@ export class BinaryUtil {
|
|
|
59
59
|
const temp = path.resolve(os.tmpdir(), `${process.hrtime()[1]}.${path.basename(file)}`);
|
|
60
60
|
await fs.writeFile(temp, content, 'utf8');
|
|
61
61
|
await fs.mkdir(path.dirname(file), { recursive: true });
|
|
62
|
-
await fs.
|
|
62
|
+
await fs.copyFile(temp, file);
|
|
63
|
+
await fs.rm(temp, { force: true });
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
/**
|
package/src/exec.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -46,6 +46,9 @@ export function classConstruct<T>(cls: Class<T>, args: unknown[] = []): ClassIns
|
|
|
46
46
|
return castTo(new cons(...args));
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
export const hasFunction = <T>(key: keyof T) => (o: unknown): o is T =>
|
|
50
|
+
typeof o === 'object' && o !== null && typeof o[castKey(key)] === 'function';
|
|
51
|
+
|
|
49
52
|
/**
|
|
50
53
|
* Range of bytes, inclusive
|
|
51
54
|
*/
|