@abtnode/docker-utils 1.16.44-beta-20250520-104453-912ed737 → 1.16.44-beta-20250523-232943-369d21c5
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/dist/index.cjs +25 -7
- package/dist/index.d.cts +3 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +24 -8
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -270,15 +270,26 @@ const notAllowUseCustomDockerArgs = {
|
|
|
270
270
|
};
|
|
271
271
|
|
|
272
272
|
const needValueKeys = /* @__PURE__ */ new Set(["--publish", "--volume"]);
|
|
273
|
+
const isVolumePath = (volume) => {
|
|
274
|
+
const [hostPart] = volume.split(":");
|
|
275
|
+
return hostPart?.startsWith("/") || hostPart?.startsWith("./") || hostPart?.startsWith("../") || hostPart?.startsWith("~") || hostPart?.startsWith("$BLOCKLET");
|
|
276
|
+
};
|
|
273
277
|
function addBlockletPrefixVolume(args) {
|
|
274
278
|
return args.map((arg) => {
|
|
275
|
-
if (arg.key
|
|
276
|
-
return
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
};
|
|
279
|
+
if (arg.key !== "--volume")
|
|
280
|
+
return arg;
|
|
281
|
+
if (arg.value.startsWith("$BLOCKLET_APP_DIR/") || arg.value.startsWith("$BLOCKLET_DATA_DIR/")) {
|
|
282
|
+
return arg;
|
|
280
283
|
}
|
|
281
|
-
|
|
284
|
+
const [hostPart, ...rest] = arg.value.split(":");
|
|
285
|
+
if (!hostPart) {
|
|
286
|
+
return arg;
|
|
287
|
+
}
|
|
288
|
+
if (!isVolumePath(arg.value)) {
|
|
289
|
+
return arg;
|
|
290
|
+
}
|
|
291
|
+
const newHostPart = hostPart.startsWith("/") ? `$BLOCKLET_DATA_DIR${hostPart}` : `$BLOCKLET_DATA_DIR/${hostPart}`;
|
|
292
|
+
return { ...arg, value: [newHostPart, ...rest].join(":") };
|
|
282
293
|
});
|
|
283
294
|
}
|
|
284
295
|
function parseFirstPublishWeb(args) {
|
|
@@ -493,7 +504,12 @@ function dockerBuildCommand({
|
|
|
493
504
|
|
|
494
505
|
const dockerArgsValidator = {
|
|
495
506
|
"--volume": (volume) => {
|
|
496
|
-
|
|
507
|
+
const [hostPart] = volume.split(":");
|
|
508
|
+
if (!hostPart) {
|
|
509
|
+
return "Volume must start with key:value";
|
|
510
|
+
}
|
|
511
|
+
const isPath = isVolumePath(volume);
|
|
512
|
+
if (isPath && !volume.startsWith("$BLOCKLET_APP_DIR/") && !volume.startsWith("$BLOCKLET_DATA_DIR/")) {
|
|
497
513
|
return "Volume must start with $BLOCKLET_APP_DIR or $BLOCKLET_DATA_DIR";
|
|
498
514
|
}
|
|
499
515
|
if (volume.indexOf("..") > -1) {
|
|
@@ -715,6 +731,7 @@ function getObjByPath(data, path) {
|
|
|
715
731
|
}, obj);
|
|
716
732
|
}
|
|
717
733
|
|
|
734
|
+
exports.addBlockletPrefixVolume = addBlockletPrefixVolume;
|
|
718
735
|
exports.allowDockerArgs = allowDockerArgs;
|
|
719
736
|
exports.autoSetDockerArgs = autoSetDockerArgs;
|
|
720
737
|
exports.dockerArgsToCamelCase = dockerArgsToCamelCase;
|
|
@@ -727,6 +744,7 @@ exports.dockerParseEnvironments = dockerParseEnvironments;
|
|
|
727
744
|
exports.dockerParsePublishPorts = dockerParsePublishPorts;
|
|
728
745
|
exports.dockerSchema = dockerSchema;
|
|
729
746
|
exports.getObjByPath = getObjByPath;
|
|
747
|
+
exports.isVolumePath = isVolumePath;
|
|
730
748
|
exports.multiValueArgs = multiValueArgs;
|
|
731
749
|
exports.notAllowUseCustomDockerArgs = notAllowUseCustomDockerArgs;
|
|
732
750
|
exports.parseDockerArgsToSchema = parseDockerArgsToSchema;
|
package/dist/index.d.cts
CHANGED
|
@@ -24,6 +24,8 @@ type DockerEnvs = {
|
|
|
24
24
|
required?: boolean;
|
|
25
25
|
custom?: string;
|
|
26
26
|
}[];
|
|
27
|
+
declare const isVolumePath: (volume: string) => boolean | undefined;
|
|
28
|
+
declare function addBlockletPrefixVolume(args: DockerArgs): DockerArgs;
|
|
27
29
|
declare function dockerParseCommand(command: string): {
|
|
28
30
|
dockerArgs: DockerArgs;
|
|
29
31
|
dockerEnvs: DockerEnvs;
|
|
@@ -97,4 +99,4 @@ declare function getObjByPath(data: Record<string, unknown>, path: string): any;
|
|
|
97
99
|
|
|
98
100
|
declare function dockerCmdValidator(dockerCommand: string): void;
|
|
99
101
|
|
|
100
|
-
export { type DockerArgs, type DockerEnvs, allowDockerArgs, autoSetDockerArgs, dockerArgsToCamelCase, dockerArgsValidator, dockerBuildCommand, dockerCamelCaseToDash, dockerCmdValidator, dockerParseCommand, dockerParseEnvironments, dockerParsePublishPorts, dockerSchema, getObjByPath, multiValueArgs, notAllowUseCustomDockerArgs, parseDockerArgsToSchema, whiteDockerArgs };
|
|
102
|
+
export { type DockerArgs, type DockerEnvs, addBlockletPrefixVolume, allowDockerArgs, autoSetDockerArgs, dockerArgsToCamelCase, dockerArgsValidator, dockerBuildCommand, dockerCamelCaseToDash, dockerCmdValidator, dockerParseCommand, dockerParseEnvironments, dockerParsePublishPorts, dockerSchema, getObjByPath, isVolumePath, multiValueArgs, notAllowUseCustomDockerArgs, parseDockerArgsToSchema, whiteDockerArgs };
|
package/dist/index.d.mts
CHANGED
|
@@ -24,6 +24,8 @@ type DockerEnvs = {
|
|
|
24
24
|
required?: boolean;
|
|
25
25
|
custom?: string;
|
|
26
26
|
}[];
|
|
27
|
+
declare const isVolumePath: (volume: string) => boolean | undefined;
|
|
28
|
+
declare function addBlockletPrefixVolume(args: DockerArgs): DockerArgs;
|
|
27
29
|
declare function dockerParseCommand(command: string): {
|
|
28
30
|
dockerArgs: DockerArgs;
|
|
29
31
|
dockerEnvs: DockerEnvs;
|
|
@@ -97,4 +99,4 @@ declare function getObjByPath(data: Record<string, unknown>, path: string): any;
|
|
|
97
99
|
|
|
98
100
|
declare function dockerCmdValidator(dockerCommand: string): void;
|
|
99
101
|
|
|
100
|
-
export { type DockerArgs, type DockerEnvs, allowDockerArgs, autoSetDockerArgs, dockerArgsToCamelCase, dockerArgsValidator, dockerBuildCommand, dockerCamelCaseToDash, dockerCmdValidator, dockerParseCommand, dockerParseEnvironments, dockerParsePublishPorts, dockerSchema, getObjByPath, multiValueArgs, notAllowUseCustomDockerArgs, parseDockerArgsToSchema, whiteDockerArgs };
|
|
102
|
+
export { type DockerArgs, type DockerEnvs, addBlockletPrefixVolume, allowDockerArgs, autoSetDockerArgs, dockerArgsToCamelCase, dockerArgsValidator, dockerBuildCommand, dockerCamelCaseToDash, dockerCmdValidator, dockerParseCommand, dockerParseEnvironments, dockerParsePublishPorts, dockerSchema, getObjByPath, isVolumePath, multiValueArgs, notAllowUseCustomDockerArgs, parseDockerArgsToSchema, whiteDockerArgs };
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ type DockerEnvs = {
|
|
|
24
24
|
required?: boolean;
|
|
25
25
|
custom?: string;
|
|
26
26
|
}[];
|
|
27
|
+
declare const isVolumePath: (volume: string) => boolean | undefined;
|
|
28
|
+
declare function addBlockletPrefixVolume(args: DockerArgs): DockerArgs;
|
|
27
29
|
declare function dockerParseCommand(command: string): {
|
|
28
30
|
dockerArgs: DockerArgs;
|
|
29
31
|
dockerEnvs: DockerEnvs;
|
|
@@ -97,4 +99,4 @@ declare function getObjByPath(data: Record<string, unknown>, path: string): any;
|
|
|
97
99
|
|
|
98
100
|
declare function dockerCmdValidator(dockerCommand: string): void;
|
|
99
101
|
|
|
100
|
-
export { type DockerArgs, type DockerEnvs, allowDockerArgs, autoSetDockerArgs, dockerArgsToCamelCase, dockerArgsValidator, dockerBuildCommand, dockerCamelCaseToDash, dockerCmdValidator, dockerParseCommand, dockerParseEnvironments, dockerParsePublishPorts, dockerSchema, getObjByPath, multiValueArgs, notAllowUseCustomDockerArgs, parseDockerArgsToSchema, whiteDockerArgs };
|
|
102
|
+
export { type DockerArgs, type DockerEnvs, addBlockletPrefixVolume, allowDockerArgs, autoSetDockerArgs, dockerArgsToCamelCase, dockerArgsValidator, dockerBuildCommand, dockerCamelCaseToDash, dockerCmdValidator, dockerParseCommand, dockerParseEnvironments, dockerParsePublishPorts, dockerSchema, getObjByPath, isVolumePath, multiValueArgs, notAllowUseCustomDockerArgs, parseDockerArgsToSchema, whiteDockerArgs };
|
package/dist/index.mjs
CHANGED
|
@@ -264,15 +264,26 @@ const notAllowUseCustomDockerArgs = {
|
|
|
264
264
|
};
|
|
265
265
|
|
|
266
266
|
const needValueKeys = /* @__PURE__ */ new Set(["--publish", "--volume"]);
|
|
267
|
+
const isVolumePath = (volume) => {
|
|
268
|
+
const [hostPart] = volume.split(":");
|
|
269
|
+
return hostPart?.startsWith("/") || hostPart?.startsWith("./") || hostPart?.startsWith("../") || hostPart?.startsWith("~") || hostPart?.startsWith("$BLOCKLET");
|
|
270
|
+
};
|
|
267
271
|
function addBlockletPrefixVolume(args) {
|
|
268
272
|
return args.map((arg) => {
|
|
269
|
-
if (arg.key
|
|
270
|
-
return
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
};
|
|
273
|
+
if (arg.key !== "--volume")
|
|
274
|
+
return arg;
|
|
275
|
+
if (arg.value.startsWith("$BLOCKLET_APP_DIR/") || arg.value.startsWith("$BLOCKLET_DATA_DIR/")) {
|
|
276
|
+
return arg;
|
|
274
277
|
}
|
|
275
|
-
|
|
278
|
+
const [hostPart, ...rest] = arg.value.split(":");
|
|
279
|
+
if (!hostPart) {
|
|
280
|
+
return arg;
|
|
281
|
+
}
|
|
282
|
+
if (!isVolumePath(arg.value)) {
|
|
283
|
+
return arg;
|
|
284
|
+
}
|
|
285
|
+
const newHostPart = hostPart.startsWith("/") ? `$BLOCKLET_DATA_DIR${hostPart}` : `$BLOCKLET_DATA_DIR/${hostPart}`;
|
|
286
|
+
return { ...arg, value: [newHostPart, ...rest].join(":") };
|
|
276
287
|
});
|
|
277
288
|
}
|
|
278
289
|
function parseFirstPublishWeb(args) {
|
|
@@ -487,7 +498,12 @@ function dockerBuildCommand({
|
|
|
487
498
|
|
|
488
499
|
const dockerArgsValidator = {
|
|
489
500
|
"--volume": (volume) => {
|
|
490
|
-
|
|
501
|
+
const [hostPart] = volume.split(":");
|
|
502
|
+
if (!hostPart) {
|
|
503
|
+
return "Volume must start with key:value";
|
|
504
|
+
}
|
|
505
|
+
const isPath = isVolumePath(volume);
|
|
506
|
+
if (isPath && !volume.startsWith("$BLOCKLET_APP_DIR/") && !volume.startsWith("$BLOCKLET_DATA_DIR/")) {
|
|
491
507
|
return "Volume must start with $BLOCKLET_APP_DIR or $BLOCKLET_DATA_DIR";
|
|
492
508
|
}
|
|
493
509
|
if (volume.indexOf("..") > -1) {
|
|
@@ -709,4 +725,4 @@ function getObjByPath(data, path) {
|
|
|
709
725
|
}, obj);
|
|
710
726
|
}
|
|
711
727
|
|
|
712
|
-
export { allowDockerArgs, autoSetDockerArgs, dockerArgsToCamelCase, dockerArgsValidator, dockerBuildCommand, dockerCamelCaseToDash, dockerCmdValidator, dockerParseCommand, dockerParseEnvironments, dockerParsePublishPorts, dockerSchema, getObjByPath, multiValueArgs, notAllowUseCustomDockerArgs, parseDockerArgsToSchema, whiteDockerArgs };
|
|
728
|
+
export { addBlockletPrefixVolume, allowDockerArgs, autoSetDockerArgs, dockerArgsToCamelCase, dockerArgsValidator, dockerBuildCommand, dockerCamelCaseToDash, dockerCmdValidator, dockerParseCommand, dockerParseEnvironments, dockerParsePublishPorts, dockerSchema, getObjByPath, isVolumePath, multiValueArgs, notAllowUseCustomDockerArgs, parseDockerArgsToSchema, whiteDockerArgs };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abtnode/docker-utils",
|
|
3
|
-
"version": "1.16.44-beta-
|
|
3
|
+
"version": "1.16.44-beta-20250523-232943-369d21c5",
|
|
4
4
|
"description": "Docker utils",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"typescript": "^5.6.3",
|
|
46
46
|
"unbuild": "^2.0.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "979ad200c41b355039a856a356c3b2bdd573e5ba"
|
|
49
49
|
}
|