@travetto/pack 7.0.0-rc.2 → 7.0.0-rc.4

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": "7.0.0-rc.2",
3
+ "version": "7.0.0-rc.4",
4
4
  "description": "Code packing utilities",
5
5
  "keywords": [
6
6
  "travetto",
@@ -29,12 +29,12 @@
29
29
  "@rollup/plugin-json": "^6.1.0",
30
30
  "@rollup/plugin-node-resolve": "^16.0.3",
31
31
  "@rollup/plugin-terser": "^0.4.4",
32
- "@travetto/runtime": "^7.0.0-rc.2",
33
- "@travetto/terminal": "^7.0.0-rc.2",
32
+ "@travetto/runtime": "^7.0.0-rc.4",
33
+ "@travetto/terminal": "^7.0.0-rc.4",
34
34
  "rollup": "^4.53.3"
35
35
  },
36
36
  "peerDependencies": {
37
- "@travetto/cli": "^7.0.0-rc.2"
37
+ "@travetto/cli": "^7.0.0-rc.4"
38
38
  },
39
39
  "peerDependenciesMeta": {
40
40
  "@travetto/cli": {
@@ -1,7 +1,7 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
 
4
- import { Runtime } from '@travetto/runtime';
4
+ import { JSONUtil, Runtime } from '@travetto/runtime';
5
5
  import { cliTpl } from '@travetto/cli';
6
6
 
7
7
  import { ActiveShellCommand } from './shell.ts';
@@ -23,7 +23,7 @@ export class DockerPackOperation {
23
23
  config.dockerRuntime.os = await PackUtil.runCommand(
24
24
  ['docker', 'run', '--rm', '--entrypoint', '/bin/sh', config.dockerImage, '-c', 'cat /etc/*release*']
25
25
  ).then(out => {
26
- const found = out.match(/\b(?:debian|alpine|centos)\b/i)?.[0].toLowerCase();
26
+ const found = out.toLowerCase().match(/\b(?:debian|alpine|centos)\b/)?.[0];
27
27
  switch (found) {
28
28
  case 'debian': case 'alpine': case 'centos': return found;
29
29
  default: return 'unknown';
@@ -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]: [{ Size: number }] = JSON.parse(await PackUtil.runCommand(['docker', 'inspect', config.dockerImage]));
85
+ const [image]: [{ Size: number }] = JSONUtil.parseSafe(await PackUtil.runCommand(['docker', 'inspect', config.dockerImage]));
86
86
  yield [cliTpl`${{ title: 'Built Docker Container ' }} ${{ identifier: 'sizeMb' }}=${{ param: Math.trunc(image.Size / 2 ** 20) }}`];
87
87
  }
88
88
  }
@@ -1,7 +1,9 @@
1
1
  import path from 'node:path';
2
2
  import fs from 'node:fs/promises';
3
3
 
4
- import { LoadResult, Plugin, PluginContext } from 'rollup';
4
+ import { LoadResult, Plugin, PluginContext, type SourceMapInput } from 'rollup';
5
+
6
+ import { FileLoader } from '@travetto/runtime';
5
7
 
6
8
  import { CoreRollupConfig } from '../../src/types.ts';
7
9
 
@@ -27,9 +29,8 @@ export function travettoSourcemaps(config: CoreRollupConfig): Plugin {
27
29
  this.warn({ message: `Could not find map path in file ${id}`, id });
28
30
  return null;
29
31
  }
30
- const basePath = path.dirname(id);
31
- const absoluteMapPath = path.join(basePath, mapPath);
32
- const map = JSON.parse(await fs.readFile(absoluteMapPath, 'utf8'));
32
+ const loader = new FileLoader([path.dirname(id)]);
33
+ const map: SourceMapInput = await loader.readJSON(mapPath);
33
34
  return { code, map };
34
35
  }
35
36
  return { code, map: null };