@travetto/pack 7.1.3 → 8.0.0-alpha.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/pack",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-alpha.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Code packing utilities",
|
|
6
6
|
"keywords": [
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"@rollup/plugin-json": "^6.1.0",
|
|
31
31
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
32
32
|
"@rollup/plugin-terser": "^0.4.4",
|
|
33
|
-
"@travetto/runtime": "^
|
|
34
|
-
"@travetto/terminal": "^
|
|
35
|
-
"rollup": "^4.
|
|
33
|
+
"@travetto/runtime": "^8.0.0-alpha.0",
|
|
34
|
+
"@travetto/terminal": "^8.0.0-alpha.0",
|
|
35
|
+
"rollup": "^4.59.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@travetto/cli": "^
|
|
38
|
+
"@travetto/cli": "^8.0.0-alpha.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependenciesMeta": {
|
|
41
41
|
"@travetto/cli": {
|
|
@@ -82,7 +82,7 @@ export class DockerPackOperation {
|
|
|
82
82
|
yield ActiveShellCommand.chdir(path.resolve());
|
|
83
83
|
} else {
|
|
84
84
|
await PackUtil.runCommand(cmd, { cwd: config.buildDirectory, stdio: [0, 'pipe', 2] });
|
|
85
|
-
const [image]
|
|
85
|
+
const [image] = await PackUtil.runCommand(['docker', 'inspect', config.dockerImage]).then(JSONUtil.fromUTF8<[{ Size: number }]>);
|
|
86
86
|
yield [cliTpl`${{ title: 'Built Docker Container ' }} ${{ identifier: 'sizeMb' }}=${{ param: Math.trunc(image.Size / 2 ** 20) }}`];
|
|
87
87
|
}
|
|
88
88
|
}
|
package/support/bin/operation.ts
CHANGED
|
@@ -2,7 +2,7 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
4
|
import { cliTpl } from '@travetto/cli';
|
|
5
|
-
import { Env, Runtime, RuntimeIndex } from '@travetto/runtime';
|
|
5
|
+
import { JSONUtil, Env, Runtime, RuntimeIndex } from '@travetto/runtime';
|
|
6
6
|
|
|
7
7
|
import type { CommonPackConfig } from '../../src/types.ts';
|
|
8
8
|
import { PackUtil } from './util.ts';
|
|
@@ -107,12 +107,12 @@ export class PackOperation {
|
|
|
107
107
|
if (config.ejectFile) {
|
|
108
108
|
yield* ActiveShellCommand.createFile(
|
|
109
109
|
path.resolve(config.buildDirectory, file),
|
|
110
|
-
[
|
|
110
|
+
[JSONUtil.toUTF8(pkg)]
|
|
111
111
|
);
|
|
112
112
|
} else {
|
|
113
113
|
await PackUtil.writeRawFile(
|
|
114
114
|
path.resolve(config.buildDirectory, file),
|
|
115
|
-
[
|
|
115
|
+
[JSONUtil.toUTF8Pretty(pkg)]
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -245,7 +245,7 @@ export class PackOperation {
|
|
|
245
245
|
yield* PackOperation.title(config, cliTpl`${{ title: 'Compressing' }} ${{ path: config.output }}`);
|
|
246
246
|
|
|
247
247
|
if (config.ejectFile) {
|
|
248
|
-
|
|
248
|
+
yield ActiveShellCommand.mkdir(path.dirname(config.output));
|
|
249
249
|
yield ActiveShellCommand.chdir(config.buildDirectory);
|
|
250
250
|
yield ActiveShellCommand.zip(config.output);
|
|
251
251
|
yield ActiveShellCommand.chdir(path.resolve());
|
package/support/bin/util.ts
CHANGED
|
@@ -2,7 +2,7 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import { spawn, type SpawnOptions } from 'node:child_process';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { RuntimeError, ExecUtil, Runtime, RuntimeIndex } from '@travetto/runtime';
|
|
6
6
|
|
|
7
7
|
import { ActiveShellCommand } from './shell.ts';
|
|
8
8
|
|
|
@@ -82,7 +82,7 @@ export class PackUtil {
|
|
|
82
82
|
|
|
83
83
|
if (!valid) {
|
|
84
84
|
process.exitCode = code;
|
|
85
|
-
throw new
|
|
85
|
+
throw new RuntimeError(stderr || message || 'An unexpected error has occurred');
|
|
86
86
|
}
|
|
87
87
|
return stdout;
|
|
88
88
|
}
|
package/support/pack.base.ts
CHANGED
|
@@ -150,7 +150,7 @@ export abstract class BasePackCommand implements CliCommandShape {
|
|
|
150
150
|
this.mainFile = `${this.mainName}.js`;
|
|
151
151
|
|
|
152
152
|
// Collect binary dependencies
|
|
153
|
-
const dependencies =
|
|
153
|
+
const dependencies = this.getBinaryDependencies();
|
|
154
154
|
this.externalDependencies = [...this.externalDependencies, ...dependencies];
|
|
155
155
|
|
|
156
156
|
const stream = this.runOperations();
|
|
@@ -3,12 +3,12 @@ import fs from 'node:fs/promises';
|
|
|
3
3
|
|
|
4
4
|
import type { LoadResult, Plugin, PluginContext, SourceMapInput } from 'rollup';
|
|
5
5
|
|
|
6
|
-
import { FileLoader } from '@travetto/runtime';
|
|
6
|
+
import { JSONUtil, FileLoader } from '@travetto/runtime';
|
|
7
7
|
|
|
8
8
|
import type { CoreRollupConfig } from '../../src/types.ts';
|
|
9
9
|
|
|
10
10
|
function toString(error: unknown): string {
|
|
11
|
-
return error instanceof Error ? error.stack ?? error.toString() :
|
|
11
|
+
return error instanceof Error ? error.stack ?? error.toString() : JSONUtil.toUTF8(error);
|
|
12
12
|
}
|
|
13
13
|
// Pulled from https://github.com/Azure/azure-sdk-for-js/blob/main/common/tools/dev-tool/src/config/rollup.base.config.ts#L128
|
|
14
14
|
export function travettoSourcemaps(config: CoreRollupConfig): Plugin {
|
|
@@ -30,7 +30,8 @@ export function travettoSourcemaps(config: CoreRollupConfig): Plugin {
|
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
const loader = new FileLoader([path.dirname(id)]);
|
|
33
|
-
const map
|
|
33
|
+
const map = await loader.readText(mapPath)
|
|
34
|
+
.then(JSONUtil.fromBase64<SourceMapInput>);
|
|
34
35
|
return { code, map };
|
|
35
36
|
}
|
|
36
37
|
return { code, map: null };
|