@travetto/pack 3.0.1-rc.1 → 3.0.1-rc.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/pack",
3
- "version": "3.0.1-rc.1",
3
+ "version": "3.0.1-rc.2",
4
4
  "description": "Code packing utilities",
5
5
  "keywords": [
6
6
  "travetto",
@@ -37,6 +37,8 @@ function getFilesFromModule(m: ManifestModule): string[] {
37
37
 
38
38
  export function getOutput(): OutputOptions {
39
39
  const format: Package['type'] = Env.get('BUNDLE_FORMAT', 'commonjs');
40
+ const dir = Env.get('BUNDLE_OUTPUT')!;
41
+ const entryName = Env.get('BUNDLE_ENTRY_COMMAND')!;
40
42
  return {
41
43
  format,
42
44
  intro: INTRO[format],
@@ -48,7 +50,7 @@ export function getOutput(): OutputOptions {
48
50
  !(Env.getBoolean('BUNDLE_SOURCES') ?? false),
49
51
  compact:
50
52
  Env.getBoolean('BUNDLE_COMPRESS') ?? true,
51
- dir: Env.get('BUNDLE_OUTPUT')!,
53
+ file: path.resolve(dir, `${entryName}.js`),
52
54
  ...(format === 'commonjs' ? {} : {
53
55
  inlineDynamicImports: true
54
56
  }),
@@ -60,6 +60,7 @@ export class PackOperation {
60
60
 
61
61
  const env = Object.fromEntries(([
62
62
  ['BUNDLE_ENTRY', entryPointFile],
63
+ ['BUNDLE_ENTRY_COMMAND', cfg.entryCommand],
63
64
  ['BUNDLE_COMPRESS', cfg.minify],
64
65
  ['BUNDLE_SOURCEMAP', cfg.sourcemap],
65
66
  ['BUNDLE_SOURCES', cfg.includeSources],
@@ -148,7 +149,7 @@ export class PackOperation {
148
149
  text: [
149
150
  ShellCommands[type].scriptOpen(),
150
151
  ShellCommands[type].chdirScript(),
151
- ShellCommands[type].callCommandWithAllArgs('node', cfg.entrySource, ...cfg.entryArguments),
152
+ ShellCommands[type].callCommandWithAllArgs('node', `${cfg.entryCommand}.js`, ...cfg.entryArguments),
152
153
  ].map(x => x.join(' '))
153
154
  }));
154
155
 
@@ -10,7 +10,6 @@ export type CommonPackConfig = {
10
10
  // Bundle
11
11
  entryPoint: string;
12
12
  entryCommand: string;
13
- entrySource: string;
14
13
  entryArguments: string[];
15
14
  minify: boolean;
16
15
  sourcemap: boolean;
@@ -33,16 +33,6 @@ export abstract class BasePackCommand<T extends CommonPackOptions, S extends Com
33
33
  .map(x => x.import.replace(/[.][^.]+s$/, ''));
34
34
  }
35
35
 
36
- /**
37
- * Add help output
38
- */
39
- async help(): Promise<string> {
40
- const entryPoints = this.entries.map(x => cliTpl`${{ subtitle: '*' }} ${{ identifier: x }}`);
41
-
42
- return ['', cliTpl`${{ title: 'Available Entry Points:' }}`, '', ...entryPoints, ''].join('\n');
43
- }
44
-
45
-
46
36
  getArgs(): string | undefined {
47
37
  return this.monoRoot ? '<module> [args...]' : '[args...]';
48
38
  }
@@ -104,7 +94,6 @@ export abstract class BasePackCommand<T extends CommonPackOptions, S extends Com
104
94
 
105
95
  async buildConfig(): Promise<S> {
106
96
  this.cmd.workspace ??= path.resolve(os.tmpdir(), RootIndex.mainModule.sourcePath.replace(/[\/\\: ]/g, '_'));
107
- this.cmd.entrySource = `${path.basename(this.cmd.entryPoint)}.js`;
108
97
  this.cmd.entryCommand = path.basename(this.cmd.entryPoint).replace(/entry[.]/, '');
109
98
  this.cmd.module = RootIndex.mainModule.name;
110
99
  return this.cmd;