@travetto/pack 3.4.0-rc.9 → 3.4.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.4.0
|
|
3
|
+
"version": "3.4.0",
|
|
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": {
|
|
@@ -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/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';
|
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 {
|