@travetto/pack 3.0.1-rc.1 → 3.0.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/package.json +3 -3
- package/support/bin/config.ts +3 -1
- package/support/bin/operation.ts +2 -1
- package/support/bin/types.ts +0 -1
- package/support/pack.base.ts +0 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/pack",
|
|
3
|
-
"version": "3.0.1
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Code packing utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"travetto",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"@rollup/plugin-json": "^6.0.0",
|
|
29
29
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
30
30
|
"@rollup/plugin-terser": "^0.4.0",
|
|
31
|
-
"@travetto/base": "^3.0.1
|
|
31
|
+
"@travetto/base": "^3.0.1",
|
|
32
32
|
"rollup": "^3.17.2",
|
|
33
33
|
"rollup-plugin-sourcemaps": "^0.6.3"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@travetto/cli": "^3.0.1
|
|
36
|
+
"@travetto/cli": "^3.0.1"
|
|
37
37
|
},
|
|
38
38
|
"peerDependenciesMeta": {
|
|
39
39
|
"@travetto/cli": {
|
package/support/bin/config.ts
CHANGED
|
@@ -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
|
-
|
|
53
|
+
file: path.resolve(dir, `${entryName}.js`),
|
|
52
54
|
...(format === 'commonjs' ? {} : {
|
|
53
55
|
inlineDynamicImports: true
|
|
54
56
|
}),
|
package/support/bin/operation.ts
CHANGED
|
@@ -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.
|
|
152
|
+
ShellCommands[type].callCommandWithAllArgs('node', `${cfg.entryCommand}.js`, ...cfg.entryArguments),
|
|
152
153
|
].map(x => x.join(' '))
|
|
153
154
|
}));
|
|
154
155
|
|
package/support/bin/types.ts
CHANGED
package/support/pack.base.ts
CHANGED
|
@@ -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;
|