@travetto/pack 3.4.0-rc.9 → 3.4.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/docker-operation.ts +1 -1
- package/support/bin/rollup-esm-dynamic-import.ts +6 -6
- package/support/bin/types.ts +1 -0
- package/support/bin/util.ts +1 -1
- package/support/cli.pack.ts +1 -1
- package/support/cli.pack_docker.ts +3 -1
- package/support/cli.pack_zip.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/pack",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "Code packing utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"travetto",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"@rollup/plugin-json": "^6.0.1",
|
|
29
29
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
30
30
|
"@rollup/plugin-terser": "^0.4.4",
|
|
31
|
-
"@travetto/base": "^3.4.0
|
|
31
|
+
"@travetto/base": "^3.4.0",
|
|
32
32
|
"rollup": "^4.3.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@travetto/cli": "^3.4.0
|
|
35
|
+
"@travetto/cli": "^3.4.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependenciesMeta": {
|
|
38
38
|
"@travetto/cli": {
|
|
@@ -55,7 +55,7 @@ export class DockerPackOperation {
|
|
|
55
55
|
* Building Docker Container
|
|
56
56
|
*/
|
|
57
57
|
static async* buildDockerContainer(cfg: DockerPackConfig): AsyncIterable<string[]> {
|
|
58
|
-
const cmd = ['docker', 'build', ...DockerPackOperation.getDockerTags(cfg).flatMap(x => ['-t', x]), '.'];
|
|
58
|
+
const cmd = ['docker', 'build', cfg.dockerBuildFlags, ...DockerPackOperation.getDockerTags(cfg).flatMap(x => ['-t', x]), '.'].filter((x): x is string => !!x);
|
|
59
59
|
|
|
60
60
|
yield* PackOperation.title(cfg, cliTpl`${{ title: 'Building Docker Container' }} ${{ param: cfg.dockerTag?.join(',') }}`);
|
|
61
61
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AstNode, Plugin } from 'rollup';
|
|
2
2
|
import { walk } from 'estree-walker';
|
|
3
|
-
import
|
|
3
|
+
import magicString from 'magic-string';
|
|
4
4
|
|
|
5
5
|
const BRAND = '__imp';
|
|
6
6
|
|
|
@@ -23,20 +23,20 @@ export function travettoImportPlugin(entry: string, files: string[]): Plugin {
|
|
|
23
23
|
transform(code, id) {
|
|
24
24
|
const parsed = this.parse(code);
|
|
25
25
|
|
|
26
|
-
let ms:
|
|
26
|
+
let ms: magicString | undefined;
|
|
27
27
|
|
|
28
28
|
if (id.includes(entry)) {
|
|
29
|
-
(ms ??= new
|
|
29
|
+
(ms ??= new magicString(code).append(DYNAMIC_IMPORT(imports)));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
walk(parsed, {
|
|
33
33
|
enter: (node) => {
|
|
34
34
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
35
|
-
const impNode = node as
|
|
35
|
+
const impNode = node as AstNode & { source?: { type: string } };
|
|
36
36
|
if (impNode.type !== 'ImportExpression' || impNode.source?.type === 'Literal') {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
(ms ??= new
|
|
39
|
+
(ms ??= new magicString(code)).overwrite(impNode.start, impNode.start + 6, BRAND);
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
|
package/support/bin/types.ts
CHANGED
package/support/bin/util.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
2
|
|
|
3
3
|
import { path, RootIndex } from '@travetto/manifest';
|
|
4
|
-
import { AppError, ExecUtil, ExecutionOptions
|
|
4
|
+
import { AppError, ExecUtil, ExecutionOptions } from '@travetto/base';
|
|
5
5
|
|
|
6
6
|
import { ActiveShellCommand } from './shell';
|
|
7
7
|
|
package/support/cli.pack.ts
CHANGED
|
@@ -13,7 +13,7 @@ const DEFAULT_USER = 'app';
|
|
|
13
13
|
/**
|
|
14
14
|
* Standard docker support for pack
|
|
15
15
|
*/
|
|
16
|
-
@CliCommand({
|
|
16
|
+
@CliCommand({ addModule: true })
|
|
17
17
|
export class PackDockerCommand extends BasePackCommand {
|
|
18
18
|
@CliFlag({ desc: 'Docker Factory source ', short: 'df', envVars: ['PACK_DOCKER_FACTORY'] })
|
|
19
19
|
dockerFactory = '@travetto/pack/support/pack.dockerfile';
|
|
@@ -27,6 +27,8 @@ export class PackDockerCommand extends BasePackCommand {
|
|
|
27
27
|
dockerPort: number[] = [];
|
|
28
28
|
@CliFlag({ desc: 'Docker Push Tags ', short: 'dx', envVars: ['PACK_DOCKER_PUSH'] })
|
|
29
29
|
dockerPush = false;
|
|
30
|
+
@CliFlag({ desc: 'Docker Build Flags ', short: 'dr', envVars: ['PACK_DOCKER_BUILD_FLAGS'] })
|
|
31
|
+
dockerBuildFlags?: string;
|
|
30
32
|
@CliFlag({ desc: 'Docker Registry ', short: 'dr', envVars: ['PACK_DOCKER_REGISTRY'] })
|
|
31
33
|
dockerRegistry?: string;
|
|
32
34
|
@CliFlag({ desc: 'Docker Runtime user ', short: 'du', name: 'docker-runtime-user', envVars: ['PACK_DOCKER_RUNTIME_USER'] })
|
package/support/cli.pack_zip.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { BasePackCommand, PackOperationShape } from './pack.base';
|
|
|
6
6
|
/**
|
|
7
7
|
* Standard zip support for pack
|
|
8
8
|
*/
|
|
9
|
-
@CliCommand({
|
|
9
|
+
@CliCommand({ addModule: true })
|
|
10
10
|
export class PackZipCommand extends BasePackCommand {
|
|
11
11
|
|
|
12
12
|
initialize(): void {
|