@theia/dev-container 1.67.0-next.56 → 1.67.0-next.86

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.
Files changed (82) hide show
  1. package/lib/dev-container-server/dev-container-server.d.ts +2 -0
  2. package/lib/dev-container-server/dev-container-server.d.ts.map +1 -0
  3. package/lib/dev-container-server/dev-container-server.js +48 -0
  4. package/lib/dev-container-server/dev-container-server.js.map +1 -0
  5. package/lib/electron-browser/container-connection-contribution.d.ts +29 -0
  6. package/lib/electron-browser/container-connection-contribution.d.ts.map +1 -0
  7. package/lib/electron-browser/container-connection-contribution.js +156 -0
  8. package/lib/electron-browser/container-connection-contribution.js.map +1 -0
  9. package/lib/electron-browser/container-info-contribution.d.ts +20 -0
  10. package/lib/electron-browser/container-info-contribution.d.ts.map +1 -0
  11. package/lib/electron-browser/container-info-contribution.js +85 -0
  12. package/lib/electron-browser/container-info-contribution.js.map +1 -0
  13. package/lib/electron-browser/container-output-provider.d.ts +8 -0
  14. package/lib/electron-browser/container-output-provider.d.ts.map +1 -0
  15. package/lib/electron-browser/container-output-provider.js +41 -0
  16. package/lib/electron-browser/container-output-provider.js.map +1 -0
  17. package/lib/electron-browser/dev-container-frontend-module.d.ts +4 -0
  18. package/lib/electron-browser/dev-container-frontend-module.d.ts.map +1 -0
  19. package/lib/electron-browser/dev-container-frontend-module.js +42 -0
  20. package/lib/electron-browser/dev-container-frontend-module.js.map +1 -0
  21. package/lib/electron-common/container-output-provider.d.ts +4 -0
  22. package/lib/electron-common/container-output-provider.d.ts.map +1 -0
  23. package/lib/electron-common/container-output-provider.js +18 -0
  24. package/lib/electron-common/container-output-provider.js.map +1 -0
  25. package/lib/electron-common/dev-container-workspaces.d.ts +3 -0
  26. package/lib/electron-common/dev-container-workspaces.d.ts.map +1 -0
  27. package/lib/electron-common/dev-container-workspaces.js +21 -0
  28. package/lib/electron-common/dev-container-workspaces.js.map +1 -0
  29. package/lib/electron-common/remote-container-connection-provider.d.ts +30 -0
  30. package/lib/electron-common/remote-container-connection-provider.d.ts.map +1 -0
  31. package/lib/electron-common/remote-container-connection-provider.js +21 -0
  32. package/lib/electron-common/remote-container-connection-provider.js.map +1 -0
  33. package/lib/electron-node/dev-container-backend-module.d.ts +5 -0
  34. package/lib/electron-node/dev-container-backend-module.d.ts.map +1 -0
  35. package/lib/electron-node/dev-container-backend-module.js +63 -0
  36. package/lib/electron-node/dev-container-backend-module.js.map +1 -0
  37. package/lib/electron-node/dev-container-file-service.d.ts +15 -0
  38. package/lib/electron-node/dev-container-file-service.d.ts.map +1 -0
  39. package/lib/electron-node/dev-container-file-service.js +105 -0
  40. package/lib/electron-node/dev-container-file-service.js.map +1 -0
  41. package/lib/electron-node/dev-container-workspace-handler.d.ts +7 -0
  42. package/lib/electron-node/dev-container-workspace-handler.d.ts.map +1 -0
  43. package/lib/electron-node/dev-container-workspace-handler.js +21 -0
  44. package/lib/electron-node/dev-container-workspace-handler.js.map +1 -0
  45. package/lib/electron-node/devcontainer-contributions/cli-enhancing-creation-contributions.d.ts +17 -0
  46. package/lib/electron-node/devcontainer-contributions/cli-enhancing-creation-contributions.d.ts.map +1 -0
  47. package/lib/electron-node/devcontainer-contributions/cli-enhancing-creation-contributions.js +69 -0
  48. package/lib/electron-node/devcontainer-contributions/cli-enhancing-creation-contributions.js.map +1 -0
  49. package/lib/electron-node/devcontainer-contributions/main-container-creation-contributions.d.ts +41 -0
  50. package/lib/electron-node/devcontainer-contributions/main-container-creation-contributions.d.ts.map +1 -0
  51. package/lib/electron-node/devcontainer-contributions/main-container-creation-contributions.js +209 -0
  52. package/lib/electron-node/devcontainer-contributions/main-container-creation-contributions.js.map +1 -0
  53. package/lib/electron-node/devcontainer-contributions/profile-file-modification-contribution.d.ts +11 -0
  54. package/lib/electron-node/devcontainer-contributions/profile-file-modification-contribution.d.ts.map +1 -0
  55. package/lib/electron-node/devcontainer-contributions/profile-file-modification-contribution.js +37 -0
  56. package/lib/electron-node/devcontainer-contributions/profile-file-modification-contribution.js.map +1 -0
  57. package/lib/electron-node/devcontainer-contributions/variable-resolver-contribution.d.ts +18 -0
  58. package/lib/electron-node/devcontainer-contributions/variable-resolver-contribution.d.ts.map +1 -0
  59. package/lib/electron-node/devcontainer-contributions/variable-resolver-contribution.js +58 -0
  60. package/lib/electron-node/devcontainer-contributions/variable-resolver-contribution.js.map +1 -0
  61. package/lib/electron-node/devcontainer-file.d.ts +354 -0
  62. package/lib/electron-node/devcontainer-file.d.ts.map +1 -0
  63. package/lib/electron-node/devcontainer-file.js +18 -0
  64. package/lib/electron-node/devcontainer-file.js.map +1 -0
  65. package/lib/electron-node/docker-compose/compose-service.d.ts +9 -0
  66. package/lib/electron-node/docker-compose/compose-service.d.ts.map +1 -0
  67. package/lib/electron-node/docker-compose/compose-service.js +73 -0
  68. package/lib/electron-node/docker-compose/compose-service.js.map +1 -0
  69. package/lib/electron-node/docker-container-service.d.ts +32 -0
  70. package/lib/electron-node/docker-container-service.d.ts.map +1 -0
  71. package/lib/electron-node/docker-container-service.js +122 -0
  72. package/lib/electron-node/docker-container-service.js.map +1 -0
  73. package/lib/electron-node/remote-container-connection-provider.d.ts +88 -0
  74. package/lib/electron-node/remote-container-connection-provider.d.ts.map +1 -0
  75. package/lib/electron-node/remote-container-connection-provider.js +345 -0
  76. package/lib/electron-node/remote-container-connection-provider.js.map +1 -0
  77. package/lib/package.spec.d.ts +1 -0
  78. package/lib/package.spec.d.ts.map +1 -0
  79. package/lib/package.spec.js +26 -0
  80. package/lib/package.spec.js.map +1 -0
  81. package/package.json +6 -6
  82. package/src/electron-node/remote-container-connection-provider.ts +7 -4
@@ -0,0 +1,354 @@
1
+ /**
2
+ * Defines a dev container
3
+ * type generated from https://containers.dev/implementors/json_schema/ and modified
4
+ */
5
+ export type DevContainerConfiguration = (((DockerfileContainer | ImageContainer) & (NonComposeContainerBase)) | ComposeContainer) & DevContainerCommon & {
6
+ location?: string;
7
+ };
8
+ export type DockerfileContainer = {
9
+ /**
10
+ * Docker build-related options.
11
+ */
12
+ build: {
13
+ /**
14
+ * The location of the Dockerfile that defines the contents of the container. The path is relative to the folder containing the `devcontainer.json` file.
15
+ */
16
+ dockerfile: string;
17
+ /**
18
+ * The location of the context folder for building the Docker image. The path is relative to the folder containing the `devcontainer.json` file.
19
+ */
20
+ context?: string;
21
+ } & BuildOptions;
22
+ [k: string]: unknown;
23
+ } | {
24
+ /**
25
+ * The location of the Dockerfile that defines the contents of the container. The path is relative to the folder containing the `devcontainer.json` file.
26
+ */
27
+ dockerFile: string;
28
+ /**
29
+ * The location of the context folder for building the Docker image. The path is relative to the folder containing the `devcontainer.json` file.
30
+ */
31
+ context?: string;
32
+ /**
33
+ * Docker build-related options.
34
+ */
35
+ build?: {
36
+ /**
37
+ * Target stage in a multi-stage build.
38
+ */
39
+ target?: string;
40
+ /**
41
+ * Build arguments.
42
+ */
43
+ args?: {
44
+ [k: string]: string;
45
+ };
46
+ /**
47
+ * The image to consider as a cache. Use an array to specify multiple images.
48
+ */
49
+ cacheFrom?: string | string[];
50
+ [k: string]: unknown;
51
+ };
52
+ [k: string]: unknown;
53
+ };
54
+ export interface BuildOptions {
55
+ /**
56
+ * Target stage in a multi-stage build.
57
+ */
58
+ target?: string;
59
+ /**
60
+ * Build arguments.
61
+ */
62
+ args?: {
63
+ [k: string]: string;
64
+ };
65
+ /**
66
+ * The image to consider as a cache. Use an array to specify multiple images.
67
+ */
68
+ cacheFrom?: string | string[];
69
+ [k: string]: unknown;
70
+ }
71
+ export interface ImageContainer {
72
+ /**
73
+ * The docker image that will be used to create the container.
74
+ */
75
+ image: string;
76
+ [k: string]: unknown;
77
+ }
78
+ export interface NonComposeContainerBase {
79
+ /**
80
+ * Application ports that are exposed by the container. This can be a single port or an array of ports. Each port can be a number or a string. A number is mapped to
81
+ * the same port on the host. A string is passed to Docker unchanged and can be used to map ports differently, e.g. '8000:8010'.
82
+ */
83
+ appPort?: number | string | (number | string)[];
84
+ /**
85
+ * Container environment variables.
86
+ */
87
+ containerEnv?: {
88
+ [k: string]: string;
89
+ };
90
+ /**
91
+ * The user the container will be started with. The default is the user on the Docker image.
92
+ */
93
+ containerUser?: string;
94
+ /**
95
+ * Mount points to set up when creating the container. See Docker's documentation for the --mount option for the supported syntax.
96
+ */
97
+ mounts?: (string | MountConfig)[];
98
+ /**
99
+ * The arguments required when starting in the container.
100
+ */
101
+ runArgs?: string[];
102
+ /**
103
+ * Action to take when the user disconnects from the container in their editor. The default is to stop the container.
104
+ */
105
+ shutdownAction?: 'none' | 'stopContainer';
106
+ /**
107
+ * Whether to overwrite the command specified in the image. The default is true.
108
+ */
109
+ overrideCommand?: boolean;
110
+ /**
111
+ * The path of the workspace folder inside the container.
112
+ */
113
+ workspaceFolder?: string;
114
+ /**
115
+ * The --mount parameter for docker run. The default is to mount the project folder at /workspaces/$project.
116
+ */
117
+ workspaceMount?: string;
118
+ [k: string]: unknown;
119
+ }
120
+ export interface ComposeContainer {
121
+ /**
122
+ * The name of the docker-compose file(s) used to start the services.
123
+ */
124
+ dockerComposeFile: string | string[];
125
+ /**
126
+ * The service you want to work on. This is considered the primary container for your dev environment which your editor will connect to.
127
+ */
128
+ service: string;
129
+ /**
130
+ * An array of services that should be started and stopped.
131
+ */
132
+ runServices?: string[];
133
+ /**
134
+ * The path of the workspace folder inside the container. This is typically the target path of a volume mount in the docker-compose.yml.
135
+ */
136
+ workspaceFolder: string;
137
+ /**
138
+ * Action to take when the user disconnects from the primary container in their editor. The default is to stop all of the compose containers.
139
+ */
140
+ shutdownAction?: 'none' | 'stopCompose';
141
+ /**
142
+ * Whether to overwrite the command specified in the image. The default is false.
143
+ */
144
+ overrideCommand?: boolean;
145
+ /**
146
+ * Allows passing additional arguments to the 'docker compose up' command.
147
+ */
148
+ composeUpArgs?: string[];
149
+ [k: string]: unknown;
150
+ }
151
+ export interface DevContainerCommon {
152
+ /**
153
+ * A name for the dev container which can be displayed to the user.
154
+ */
155
+ name?: string;
156
+ /**
157
+ * Features to add to the dev container.
158
+ */
159
+ features?: {
160
+ [k: string]: unknown;
161
+ };
162
+ /**
163
+ * Array consisting of the Feature id (without the semantic version) of Features in the order the user wants them to be installed.
164
+ */
165
+ overrideFeatureInstallOrder?: string[];
166
+ /**
167
+ * Ports that are forwarded from the container to the local machine. Can be an integer port number, or a string of the format 'host:port_number'.
168
+ */
169
+ forwardPorts?: (number | string)[];
170
+ portsAttributes?: {
171
+ /**
172
+ * A port, range of ports (ex. '40000-55000'), or regular expression (ex. '.+\\/server.js').
173
+ * For a port number or range, the attributes will apply to that port number or range of port numbers.
174
+ * Attributes which use a regular expression will apply to ports whose associated process command line matches the expression.
175
+ *
176
+ * This interface was referenced by `undefined`'s JSON-Schema definition
177
+ * via the `patternProperty` '(^\d+(-\d+)?$)|(.+)'.
178
+ */
179
+ [k: string]: {
180
+ /**
181
+ * Defines the action that occurs when the port is discovered for automatic forwarding
182
+ */
183
+ onAutoForward?: 'notify' | 'openBrowser' | 'openBrowserOnce' | 'openPreview' | 'silent' | 'ignore';
184
+ /**
185
+ * Automatically prompt for elevation (if needed) when this port is forwarded. Elevate is required if the local port is a privileged port.
186
+ */
187
+ elevateIfNeeded?: boolean;
188
+ /**
189
+ * Label that will be shown in the UI for this port.
190
+ */
191
+ label?: string;
192
+ requireLocalPort?: boolean;
193
+ /**
194
+ * The protocol to use when forwarding this port.
195
+ */
196
+ protocol?: 'http' | 'https';
197
+ [k: string]: unknown;
198
+ };
199
+ };
200
+ otherPortsAttributes?: {
201
+ /**
202
+ * Defines the action that occurs when the port is discovered for automatic forwarding
203
+ */
204
+ onAutoForward?: 'notify' | 'openBrowser' | 'openPreview' | 'silent' | 'ignore';
205
+ /**
206
+ * Automatically prompt for elevation (if needed) when this port is forwarded. Elevate is required if the local port is a privileged port.
207
+ */
208
+ elevateIfNeeded?: boolean;
209
+ /**
210
+ * Label that will be shown in the UI for this port.
211
+ */
212
+ label?: string;
213
+ requireLocalPort?: boolean;
214
+ /**
215
+ * The protocol to use when forwarding this port.
216
+ */
217
+ protocol?: 'http' | 'https';
218
+ };
219
+ /**
220
+ * Controls whether on Linux the container's user should be updated with the local user's UID and GID. On by default when opening from a local folder.
221
+ */
222
+ updateRemoteUserUID?: boolean;
223
+ /**
224
+ * Remote environment variables to set for processes spawned in the container including lifecycle scripts and any remote editor/IDE server process.
225
+ */
226
+ remoteEnv?: {
227
+ [k: string]: string | null;
228
+ };
229
+ /**
230
+ * The username to use for spawning processes in the container including lifecycle scripts and any remote editor/IDE server process.
231
+ * The default is the same user as the container.
232
+ */
233
+ remoteUser?: string;
234
+ /**
235
+ * extensions to install in the container at launch. The expeceted format is publisher.name[@version].
236
+ * The default is no extensions being installed.
237
+ */
238
+ extensions?: string[];
239
+ /**
240
+ * settings to set in the container at launch in the settings.json. The expected format is key=value.
241
+ * The default is no preferences being set.
242
+ */
243
+ settings?: {
244
+ [k: string]: unknown;
245
+ };
246
+ /**
247
+ * A command to run locally before anything else. This command is run before 'onCreateCommand'.
248
+ * If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell.
249
+ */
250
+ initializeCommand?: string | string[];
251
+ /**
252
+ * A command to run when creating the container. This command is run after 'initializeCommand' and before 'updateContentCommand'.
253
+ * If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell.
254
+ */
255
+ onCreateCommand?: string | string[] | {
256
+ [k: string]: string | string[];
257
+ };
258
+ /**
259
+ * A command to run when creating the container and rerun when the workspace content was updated while creating the container.
260
+ * This command is run after 'onCreateCommand' and before 'postCreateCommand'. If this is a single string, it will be run in a shell.
261
+ * If this is an array of strings, it will be run as a single command without shell.
262
+ */
263
+ updateContentCommand?: string | string[] | {
264
+ [k: string]: string | string[];
265
+ };
266
+ /**
267
+ * A command to run after creating the container. This command is run after 'updateContentCommand' and before 'postStartCommand'.
268
+ * If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell.
269
+ */
270
+ postCreateCommand?: string | string[] | {
271
+ [k: string]: string | string[];
272
+ };
273
+ /**
274
+ * A command to run after starting the container. This command is run after 'postCreateCommand' and before 'postAttachCommand'.
275
+ * If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell.
276
+ */
277
+ postStartCommand?: string | string[] | {
278
+ [k: string]: string | string[];
279
+ };
280
+ /**
281
+ * A command to run when attaching to the container. This command is run after 'postStartCommand'. If this is a single string, it will be run in a shell.
282
+ * If this is an array of strings, it will be run as a single command without shell.
283
+ */
284
+ postAttachCommand?: string | string[] | {
285
+ [k: string]: string | string[];
286
+ };
287
+ /**
288
+ * The user command to wait for before continuing execution in the background while the UI is starting up. The default is 'updateContentCommand'.
289
+ */
290
+ waitFor?: 'initializeCommand' | 'onCreateCommand' | 'updateContentCommand' | 'postCreateCommand' | 'postStartCommand';
291
+ /**
292
+ * User environment probe to run. The default is 'loginInteractiveShell'.
293
+ */
294
+ userEnvProbe?: 'none' | 'loginShell' | 'loginInteractiveShell' | 'interactiveShell';
295
+ /**
296
+ * Host hardware requirements.
297
+ */
298
+ hostRequirements?: {
299
+ /**
300
+ * Number of required CPUs.
301
+ */
302
+ cpus?: number;
303
+ /**
304
+ * Amount of required RAM in bytes. Supports units tb, gb, mb and kb.
305
+ */
306
+ memory?: string;
307
+ /**
308
+ * Amount of required disk space in bytes. Supports units tb, gb, mb and kb.
309
+ */
310
+ storage?: string;
311
+ gpu?: (true | false | 'optional') | {
312
+ /**
313
+ * Number of required cores.
314
+ */
315
+ cores?: number;
316
+ /**
317
+ * Amount of required RAM in bytes. Supports units tb, gb, mb and kb.
318
+ */
319
+ memory?: string;
320
+ };
321
+ [k: string]: unknown;
322
+ };
323
+ /**
324
+ * Tool-specific configuration. Each tool should use a JSON object subproperty with a unique name to group its customizations.
325
+ */
326
+ customizations?: {
327
+ [k: string]: unknown;
328
+ vscode?: {
329
+ /**
330
+ * extensions to install in the container at launch. The expeceted format is publisher.name[@version].
331
+ * The default is no extensions being installed.
332
+ */
333
+ extensions?: string[];
334
+ /**
335
+ * settings to set in the container at launch in the settings.json. The expected format is key=value.
336
+ * The default is no preferences being set.
337
+ */
338
+ settings?: {
339
+ [k: string]: unknown;
340
+ };
341
+ [k: string]: unknown;
342
+ };
343
+ };
344
+ additionalProperties?: {
345
+ [k: string]: unknown;
346
+ };
347
+ [k: string]: unknown;
348
+ }
349
+ export interface MountConfig {
350
+ source: string;
351
+ target: string;
352
+ type: 'volume' | 'bind';
353
+ }
354
+ //# sourceMappingURL=devcontainer-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devcontainer-file.d.ts","sourceRoot":"","sources":["../../src/electron-node/devcontainer-file.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,CAAC,mBAAmB,GAAG,cAAc,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,GAAG,gBAAgB,CAAC,GAAG,kBAAkB,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/K,MAAM,MAAM,mBAAmB,GAAG;IAC9B;;OAEG;IACH,KAAK,EAAE;QACH;;WAEG;QACH,UAAU,EAAE,MAAM,CAAA;QAClB;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAA;KACnB,GAAG,YAAY,CAAA;IAChB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB,GAAG;IACA;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE;QACJ;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAA;QACf;;WAEG;QACH,IAAI,CAAC,EAAE;YACH,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;SACtB,CAAA;QACD;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;QAC7B,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KACvB,CAAA;IACD,CAA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AM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;CAC3B"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2024 Typefox and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ //# sourceMappingURL=devcontainer-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devcontainer-file.js","sourceRoot":"","sources":["../../src/electron-node/devcontainer-file.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF"}
@@ -0,0 +1,9 @@
1
+ import * as Docker from 'dockerode';
2
+ import { DevContainerConfiguration } from '../devcontainer-file';
3
+ import { ContainerOutputProvider } from '../../electron-common/container-output-provider';
4
+ export declare class DockerComposeService {
5
+ createContainers(devcontainerConfig: DevContainerConfiguration, containerCreateOptions: Docker.ContainerCreateOptions, outputProvider?: ContainerOutputProvider): Promise<string>;
6
+ protected executeComposeCommand(composeFilePath: string, command: string, args: string[], outputProvider?: ContainerOutputProvider): Promise<string>;
7
+ }
8
+ export declare function resolveComposeFilePath(devcontainerConfig: DevContainerConfiguration): string;
9
+ //# sourceMappingURL=compose-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose-service.d.ts","sourceRoot":"","sources":["../../../src/electron-node/docker-compose/compose-service.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,EAAoB,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AAI1F,qBACa,oBAAoB;IAEvB,gBAAgB,CAClB,kBAAkB,EAAE,yBAAyB,EAC7C,sBAAsB,EAAE,MAAM,CAAC,sBAAsB,EACrD,cAAc,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC;IAc9D,SAAS,CAAC,qBAAqB,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,cAAc,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC;CAmBvJ;AAED,wBAAgB,sBAAsB,CAAC,kBAAkB,EAAE,yBAAyB,GAAG,MAAM,CAc5F"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2025 Typefox and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.resolveComposeFilePath = exports.DockerComposeService = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const child_process_1 = require("child_process");
22
+ const path = require("path");
23
+ let DockerComposeService = class DockerComposeService {
24
+ async createContainers(devcontainerConfig, containerCreateOptions, outputProvider) {
25
+ if (!devcontainerConfig.dockerComposeFile || typeof devcontainerConfig.dockerComposeFile !== 'string') {
26
+ throw new Error('dockerComposeFile is not defined in devcontainer configuration. Multiple files are not supported currently');
27
+ }
28
+ const dockerComposeFilePath = resolveComposeFilePath(devcontainerConfig);
29
+ const composeUpArgs = Array.isArray(devcontainerConfig.composeUpArgs) ? devcontainerConfig.composeUpArgs : [];
30
+ await this.executeComposeCommand(dockerComposeFilePath, 'up', ['--detach', ...composeUpArgs], outputProvider);
31
+ return devcontainerConfig.service;
32
+ }
33
+ executeComposeCommand(composeFilePath, command, args, outputProvider) {
34
+ return new Promise((resolve, reject) => {
35
+ const process = (0, child_process_1.spawn)('docker', ['compose', '-f', composeFilePath, command, ...args]);
36
+ process.stdout.on('data', data => {
37
+ outputProvider === null || outputProvider === void 0 ? void 0 : outputProvider.onRemoteOutput(data.toString());
38
+ });
39
+ process.stderr.on('data', data => {
40
+ outputProvider === null || outputProvider === void 0 ? void 0 : outputProvider.onRemoteOutput(data.toString());
41
+ });
42
+ process.on('close', code => {
43
+ outputProvider === null || outputProvider === void 0 ? void 0 : outputProvider.onRemoteOutput(`docker compose process exited with code ${code}`);
44
+ if (code === 0) {
45
+ resolve(''); // TODO return real container ids
46
+ }
47
+ else {
48
+ reject(new Error(`docker compose process exited with code ${code}`));
49
+ }
50
+ });
51
+ });
52
+ }
53
+ };
54
+ exports.DockerComposeService = DockerComposeService;
55
+ exports.DockerComposeService = DockerComposeService = tslib_1.__decorate([
56
+ (0, inversify_1.injectable)()
57
+ ], DockerComposeService);
58
+ function resolveComposeFilePath(devcontainerConfig) {
59
+ if (!devcontainerConfig.dockerComposeFile) {
60
+ throw new Error('dockerComposeFile is not defined in devcontainer configuration.');
61
+ }
62
+ if (typeof devcontainerConfig.dockerComposeFile !== 'string') {
63
+ throw new Error('Multiple docker compose files are not supported currently.');
64
+ }
65
+ if (path.isAbsolute(devcontainerConfig.dockerComposeFile)) {
66
+ return devcontainerConfig.dockerComposeFile;
67
+ }
68
+ else {
69
+ return path.resolve(path.dirname(devcontainerConfig.location), devcontainerConfig.dockerComposeFile);
70
+ }
71
+ }
72
+ exports.resolveComposeFilePath = resolveComposeFilePath;
73
+ //# sourceMappingURL=compose-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose-service.js","sourceRoot":"","sources":["../../../src/electron-node/docker-compose/compose-service.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAA0D;AAI1D,iDAAsC;AACtC,6BAA8B;AAGvB,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAE7B,KAAK,CAAC,gBAAgB,CAClB,kBAA6C,EAC7C,sBAAqD,EACrD,cAAwC;QAExC,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,IAAI,OAAO,kBAAkB,CAAC,iBAAiB,KAAK,QAAQ,EAAE,CAAC;YACpG,MAAM,IAAI,KAAK,CAAC,4GAA4G,CAAC,CAAC;QAClI,CAAC;QAED,MAAM,qBAAqB,GAAG,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;QAEzE,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9G,MAAM,IAAI,CAAC,qBAAqB,CAAC,qBAAqB,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,G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GACA,oBAAoB,CAsChC;AAED,SAAgB,sBAAsB,CAAC,kBAA6C;IAChF,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;IACvF,CAAC;IAED,IAAI,OAAO,kBAAkB,CAAC,iBAAiB,KAAK,QAAQ,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAClF,CAAC;IAED,IAAI,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACxD,OAAO,kBAAkB,CAAC,iBAAiB,CAAC;IAChD,CAAC;SAAM,CAAC;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,QAAS,CAAC,EAAE,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;IAC1G,CAAC;AACL,CAAC;AAdD,wDAcC"}
@@ -0,0 +1,32 @@
1
+ import { ContributionProvider, MaybePromise, URI } from '@theia/core';
2
+ import { WorkspaceServer } from '@theia/workspace/lib/common';
3
+ import * as Docker from 'dockerode';
4
+ import { ContainerConnectionOptions } from '../electron-common/remote-container-connection-provider';
5
+ import { DevContainerConfiguration } from './devcontainer-file';
6
+ import { DevContainerFileService } from './dev-container-file-service';
7
+ import { ContainerOutputProvider } from '../electron-common/container-output-provider';
8
+ import { RemoteDockerContainerConnection } from './remote-container-connection-provider';
9
+ import { DockerComposeService } from './docker-compose/compose-service';
10
+ export declare const ContainerCreationContribution: unique symbol;
11
+ export interface ContainerCreationContribution {
12
+ handleContainerCreation?(createOptions: Docker.ContainerCreateOptions, containerConfig: DevContainerConfiguration, api: Docker, outputProvider?: ContainerOutputProvider): MaybePromise<void>;
13
+ /**
14
+ * executed after creating and starting the container
15
+ */
16
+ handlePostCreate?(containerConfig: DevContainerConfiguration, container: Docker.Container, api: Docker, outputProvider?: ContainerOutputProvider): MaybePromise<void>;
17
+ /**
18
+ * executed after a connection has been established with the container and theia has been setup
19
+ */
20
+ handlePostConnect?(containerConfig: DevContainerConfiguration, connection: RemoteDockerContainerConnection, outputProvider?: ContainerOutputProvider): MaybePromise<void>;
21
+ }
22
+ export declare class DockerContainerService {
23
+ protected readonly workspaceServer: WorkspaceServer;
24
+ protected readonly containerCreationContributions: ContributionProvider<ContainerCreationContribution>;
25
+ protected readonly devContainerFileService: DevContainerFileService;
26
+ protected readonly dockerComposeService: DockerComposeService;
27
+ container: Docker.Container | undefined;
28
+ getOrCreateContainer(docker: Docker, options: ContainerConnectionOptions, outputProvider?: ContainerOutputProvider): Promise<Docker.Container>;
29
+ postConnect(devcontainerFile: string, connection: RemoteDockerContainerConnection, outputProvider?: ContainerOutputProvider): Promise<void>;
30
+ protected buildContainer(docker: Docker, devcontainerFile: string, workspace: URI, outputProvider?: ContainerOutputProvider): Promise<Docker.Container>;
31
+ }
32
+ //# sourceMappingURL=docker-container-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docker-container-service.d.ts","sourceRoot":"","sources":["../../src/electron-node/docker-container-service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,0BAA0B,EAAE,MAAM,yDAAyD,CAAC;AACrG,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,eAAO,MAAM,6BAA6B,eAA2C,C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,SAAS,EAAE,GAAG,EAAE,cAAc,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;CA8ChK"}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2024 Typefox and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.DockerContainerService = exports.ContainerCreationContribution = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const core_1 = require("@theia/core");
21
+ const inversify_1 = require("@theia/core/shared/inversify");
22
+ const common_1 = require("@theia/workspace/lib/common");
23
+ const fs = require("@theia/core/shared/fs-extra");
24
+ const dev_container_file_service_1 = require("./dev-container-file-service");
25
+ const compose_service_1 = require("./docker-compose/compose-service");
26
+ exports.ContainerCreationContribution = Symbol('ContainerCreationContributions');
27
+ let DockerContainerService = class DockerContainerService {
28
+ async getOrCreateContainer(docker, options, outputProvider) {
29
+ var _a;
30
+ let container;
31
+ const workspace = new core_1.URI((_a = options.workspacePath) !== null && _a !== void 0 ? _a : await this.workspaceServer.getMostRecentlyUsedWorkspace());
32
+ if (options.lastContainerInfo && fs.statSync(options.devcontainerFile).mtimeMs < options.lastContainerInfo.lastUsed) {
33
+ try {
34
+ container = docker.getContainer(options.lastContainerInfo.id);
35
+ if ((await container.inspect()).State.Running) {
36
+ await container.restart();
37
+ }
38
+ else {
39
+ await container.start();
40
+ }
41
+ }
42
+ catch (e) {
43
+ container = undefined;
44
+ console.warn('DevContainer: could not find last used container');
45
+ }
46
+ }
47
+ if (!container) {
48
+ container = await this.buildContainer(docker, options.devcontainerFile, workspace, outputProvider);
49
+ }
50
+ this.container = container;
51
+ return container;
52
+ }
53
+ async postConnect(devcontainerFile, connection, outputProvider) {
54
+ var _a;
55
+ const devcontainerConfig = await this.devContainerFileService.getConfiguration(devcontainerFile);
56
+ for (const containerCreateContrib of this.containerCreationContributions.getContributions()) {
57
+ await ((_a = containerCreateContrib.handlePostConnect) === null || _a === void 0 ? void 0 : _a.call(containerCreateContrib, devcontainerConfig, connection, outputProvider));
58
+ }
59
+ }
60
+ async buildContainer(docker, devcontainerFile, workspace, outputProvider) {
61
+ var _a, _b;
62
+ const devcontainerConfig = await this.devContainerFileService.getConfiguration(devcontainerFile);
63
+ if (!devcontainerConfig) {
64
+ // TODO add ability for user to create new config
65
+ throw new Error('No devcontainer.json');
66
+ }
67
+ const containerCreateOptions = {
68
+ Tty: true,
69
+ ExposedPorts: {},
70
+ HostConfig: {
71
+ PortBindings: {},
72
+ Mounts: [{
73
+ Source: workspace.path.toString(),
74
+ Target: `/workspaces/${workspace.path.name}`,
75
+ Type: 'bind'
76
+ }],
77
+ },
78
+ };
79
+ for (const containerCreateContrib of this.containerCreationContributions.getContributions()) {
80
+ await ((_a = containerCreateContrib.handleContainerCreation) === null || _a === void 0 ? void 0 : _a.call(containerCreateContrib, containerCreateOptions, devcontainerConfig, docker, outputProvider));
81
+ }
82
+ let container;
83
+ if (devcontainerConfig.dockerComposeFile) {
84
+ const containerName = await this.dockerComposeService.createContainers(devcontainerConfig, containerCreateOptions, outputProvider);
85
+ const services = await docker.listContainers({ filters: { label: [`com.docker.compose.service=${containerName}`] } });
86
+ if (services.length === 0) {
87
+ throw new Error(`No running container found for docker compose service ${containerName}`);
88
+ }
89
+ container = docker.getContainer(services[0].Id);
90
+ }
91
+ else {
92
+ container = await docker.createContainer(containerCreateOptions);
93
+ await container.start();
94
+ }
95
+ for (const containerCreateContrib of this.containerCreationContributions.getContributions()) {
96
+ await ((_b = containerCreateContrib.handlePostCreate) === null || _b === void 0 ? void 0 : _b.call(containerCreateContrib, devcontainerConfig, container, docker, outputProvider));
97
+ }
98
+ return container;
99
+ }
100
+ };
101
+ exports.DockerContainerService = DockerContainerService;
102
+ tslib_1.__decorate([
103
+ (0, inversify_1.inject)(common_1.WorkspaceServer),
104
+ tslib_1.__metadata("design:type", Object)
105
+ ], DockerContainerService.prototype, "workspaceServer", void 0);
106
+ tslib_1.__decorate([
107
+ (0, inversify_1.inject)(core_1.ContributionProvider),
108
+ (0, inversify_1.named)(exports.ContainerCreationContribution),
109
+ tslib_1.__metadata("design:type", Object)
110
+ ], DockerContainerService.prototype, "containerCreationContributions", void 0);
111
+ tslib_1.__decorate([
112
+ (0, inversify_1.inject)(dev_container_file_service_1.DevContainerFileService),
113
+ tslib_1.__metadata("design:type", dev_container_file_service_1.DevContainerFileService)
114
+ ], DockerContainerService.prototype, "devContainerFileService", void 0);
115
+ tslib_1.__decorate([
116
+ (0, inversify_1.inject)(compose_service_1.DockerComposeService),
117
+ tslib_1.__metadata("design:type", compose_service_1.DockerComposeService)
118
+ ], DockerContainerService.prototype, "dockerComposeService", void 0);
119
+ exports.DockerContainerService = DockerContainerService = tslib_1.__decorate([
120
+ (0, inversify_1.injectable)()
121
+ ], DockerContainerService);
122
+ //# sourceMappingURL=docker-container-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docker-container-service.js","sourceRoot":"","sources":["../../src/electron-node/docker-container-service.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,sCAAsE;AACtE,4DAAyE;AACz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