@theia/application-manager 1.45.0 → 1.46.0-next.72

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 (45) hide show
  1. package/README.md +25 -25
  2. package/lib/application-package-manager.d.ts +45 -39
  3. package/lib/application-package-manager.d.ts.map +1 -1
  4. package/lib/application-package-manager.js +225 -207
  5. package/lib/application-package-manager.js.map +1 -1
  6. package/lib/application-process.d.ts +19 -19
  7. package/lib/application-process.js +72 -72
  8. package/lib/expose-loader.d.ts +8 -8
  9. package/lib/expose-loader.js +69 -69
  10. package/lib/generator/abstract-generator.d.ts +17 -16
  11. package/lib/generator/abstract-generator.d.ts.map +1 -1
  12. package/lib/generator/abstract-generator.js +57 -54
  13. package/lib/generator/abstract-generator.js.map +1 -1
  14. package/lib/generator/backend-generator.d.ts +7 -7
  15. package/lib/generator/backend-generator.d.ts.map +1 -1
  16. package/lib/generator/backend-generator.js +196 -192
  17. package/lib/generator/backend-generator.js.map +1 -1
  18. package/lib/generator/frontend-generator.d.ts +13 -13
  19. package/lib/generator/frontend-generator.d.ts.map +1 -1
  20. package/lib/generator/frontend-generator.js +221 -205
  21. package/lib/generator/frontend-generator.js.map +1 -1
  22. package/lib/generator/index.d.ts +3 -3
  23. package/lib/generator/index.js +30 -30
  24. package/lib/generator/webpack-generator.d.ts +12 -12
  25. package/lib/generator/webpack-generator.d.ts.map +1 -1
  26. package/lib/generator/webpack-generator.js +506 -500
  27. package/lib/generator/webpack-generator.js.map +1 -1
  28. package/lib/index.d.ts +3 -3
  29. package/lib/index.js +30 -30
  30. package/lib/package.spec.js +25 -25
  31. package/lib/rebuild.d.ts +24 -24
  32. package/lib/rebuild.d.ts.map +1 -1
  33. package/lib/rebuild.js +309 -309
  34. package/package.json +7 -6
  35. package/src/application-package-manager.ts +263 -241
  36. package/src/application-process.ts +80 -80
  37. package/src/expose-loader.ts +80 -80
  38. package/src/generator/abstract-generator.ts +69 -65
  39. package/src/generator/backend-generator.ts +198 -194
  40. package/src/generator/frontend-generator.ts +231 -215
  41. package/src/generator/index.ts +19 -19
  42. package/src/generator/webpack-generator.ts +514 -508
  43. package/src/index.ts +19 -19
  44. package/src/package.spec.ts +28 -28
  45. package/src/rebuild.ts +345 -345
@@ -1,20 +1,20 @@
1
- /// <reference types="node" />
2
- import * as cp from 'child_process';
3
- import { ApplicationPackage } from '@theia/application-package';
4
- export declare class ApplicationProcess {
5
- protected readonly pck: ApplicationPackage;
6
- protected readonly binProjectPath: string;
7
- protected readonly defaultOptions: {
8
- cwd: string;
9
- env: NodeJS.ProcessEnv;
10
- };
11
- constructor(pck: ApplicationPackage, binProjectPath: string);
12
- spawn(command: string, args?: string[], options?: cp.SpawnOptions): cp.ChildProcess;
13
- fork(modulePath: string, args?: string[], options?: cp.ForkOptions): cp.ChildProcess;
14
- canRun(command: string): boolean;
15
- run(command: string, args: string[], options?: cp.SpawnOptions): Promise<void>;
16
- spawnBin(command: string, args: string[], options?: cp.SpawnOptions): cp.ChildProcess;
17
- protected resolveBin(command: string): string;
18
- protected promisify(command: string, p: cp.ChildProcess): Promise<void>;
19
- }
1
+ /// <reference types="node" />
2
+ import * as cp from 'child_process';
3
+ import { ApplicationPackage } from '@theia/application-package';
4
+ export declare class ApplicationProcess {
5
+ protected readonly pck: ApplicationPackage;
6
+ protected readonly binProjectPath: string;
7
+ protected readonly defaultOptions: {
8
+ cwd: string;
9
+ env: NodeJS.ProcessEnv;
10
+ };
11
+ constructor(pck: ApplicationPackage, binProjectPath: string);
12
+ spawn(command: string, args?: string[], options?: cp.SpawnOptions): cp.ChildProcess;
13
+ fork(modulePath: string, args?: string[], options?: cp.ForkOptions): cp.ChildProcess;
14
+ canRun(command: string): boolean;
15
+ run(command: string, args: string[], options?: cp.SpawnOptions): Promise<void>;
16
+ spawnBin(command: string, args: string[], options?: cp.SpawnOptions): cp.ChildProcess;
17
+ protected resolveBin(command: string): string;
18
+ protected promisify(command: string, p: cp.ChildProcess): Promise<void>;
19
+ }
20
20
  //# sourceMappingURL=application-process.d.ts.map
@@ -1,73 +1,73 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2017 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.ApplicationProcess = void 0;
19
- const path = require("path");
20
- const fs = require("fs-extra");
21
- const cp = require("child_process");
22
- class ApplicationProcess {
23
- constructor(pck, binProjectPath) {
24
- this.pck = pck;
25
- this.binProjectPath = binProjectPath;
26
- this.defaultOptions = {
27
- cwd: this.pck.projectPath,
28
- env: process.env
29
- };
30
- }
31
- spawn(command, args, options) {
32
- return cp.spawn(command, args || [], Object.assign({}, this.defaultOptions, options));
33
- }
34
- fork(modulePath, args, options) {
35
- return cp.fork(modulePath, args, Object.assign({}, this.defaultOptions, options));
36
- }
37
- canRun(command) {
38
- return fs.existsSync(this.resolveBin(command));
39
- }
40
- run(command, args, options) {
41
- const commandProcess = this.spawnBin(command, args, options);
42
- return this.promisify(command, commandProcess);
43
- }
44
- spawnBin(command, args, options) {
45
- const binPath = this.resolveBin(command);
46
- return this.spawn(binPath, args, options);
47
- }
48
- resolveBin(command) {
49
- const commandPath = path.resolve(this.binProjectPath, 'node_modules', '.bin', command);
50
- return process.platform === 'win32' ? commandPath + '.cmd' : commandPath;
51
- }
52
- promisify(command, p) {
53
- return new Promise((resolve, reject) => {
54
- p.stdout.on('data', data => this.pck.log(data.toString()));
55
- p.stderr.on('data', data => this.pck.error(data.toString()));
56
- p.on('error', reject);
57
- p.on('close', (code, signal) => {
58
- if (signal) {
59
- reject(new Error(`${command} exited with an unexpected signal: ${signal}.`));
60
- return;
61
- }
62
- if (code === 0) {
63
- resolve();
64
- }
65
- else {
66
- reject(new Error(`${command} exited with an unexpected code: ${code}.`));
67
- }
68
- });
69
- });
70
- }
71
- }
72
- exports.ApplicationProcess = ApplicationProcess;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2017 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.ApplicationProcess = void 0;
19
+ const path = require("path");
20
+ const fs = require("fs-extra");
21
+ const cp = require("child_process");
22
+ class ApplicationProcess {
23
+ constructor(pck, binProjectPath) {
24
+ this.pck = pck;
25
+ this.binProjectPath = binProjectPath;
26
+ this.defaultOptions = {
27
+ cwd: this.pck.projectPath,
28
+ env: process.env
29
+ };
30
+ }
31
+ spawn(command, args, options) {
32
+ return cp.spawn(command, args || [], Object.assign({}, this.defaultOptions, options));
33
+ }
34
+ fork(modulePath, args, options) {
35
+ return cp.fork(modulePath, args, Object.assign({}, this.defaultOptions, options));
36
+ }
37
+ canRun(command) {
38
+ return fs.existsSync(this.resolveBin(command));
39
+ }
40
+ run(command, args, options) {
41
+ const commandProcess = this.spawnBin(command, args, options);
42
+ return this.promisify(command, commandProcess);
43
+ }
44
+ spawnBin(command, args, options) {
45
+ const binPath = this.resolveBin(command);
46
+ return this.spawn(binPath, args, options);
47
+ }
48
+ resolveBin(command) {
49
+ const commandPath = path.resolve(this.binProjectPath, 'node_modules', '.bin', command);
50
+ return process.platform === 'win32' ? commandPath + '.cmd' : commandPath;
51
+ }
52
+ promisify(command, p) {
53
+ return new Promise((resolve, reject) => {
54
+ p.stdout.on('data', data => this.pck.log(data.toString()));
55
+ p.stderr.on('data', data => this.pck.error(data.toString()));
56
+ p.on('error', reject);
57
+ p.on('close', (code, signal) => {
58
+ if (signal) {
59
+ reject(new Error(`${command} exited with an unexpected signal: ${signal}.`));
60
+ return;
61
+ }
62
+ if (code === 0) {
63
+ resolve();
64
+ }
65
+ else {
66
+ reject(new Error(`${command} exited with an unexpected code: ${code}.`));
67
+ }
68
+ });
69
+ });
70
+ }
71
+ }
72
+ exports.ApplicationProcess = ApplicationProcess;
73
73
  //# sourceMappingURL=application-process.js.map
@@ -1,9 +1,9 @@
1
- import type { RawSourceMap } from 'source-map';
2
- declare const _default: (this: any, source: string, sourceMap?: RawSourceMap | undefined) => string | undefined;
3
- /**
4
- * Expose bundled modules on window.theia.moduleName namespace, e.g.
5
- * window['theia']['@theia/core/lib/common/uri'].
6
- * Such syntax can be used by external code, for instance, for testing.
7
- */
8
- export = _default;
1
+ import type { RawSourceMap } from 'source-map';
2
+ declare const _default: (this: any, source: string, sourceMap?: RawSourceMap | undefined) => string | undefined;
3
+ /**
4
+ * Expose bundled modules on window.theia.moduleName namespace, e.g.
5
+ * window['theia']['@theia/core/lib/common/uri'].
6
+ * Such syntax can be used by external code, for instance, for testing.
7
+ */
8
+ export = _default;
9
9
  //# sourceMappingURL=expose-loader.d.ts.map
@@ -1,70 +1,70 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2020 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
- const fs = require("fs-extra");
18
- const path = require("path");
19
- const application_package_1 = require("@theia/application-package/lib/application-package");
20
- const modulePackages = [];
21
- for (const extensionPackage of new application_package_1.ApplicationPackage({ projectPath: process.cwd() }).extensionPackages) {
22
- modulePackages.push({
23
- name: extensionPackage.name,
24
- dir: path.dirname(extensionPackage.raw.installed.packagePath)
25
- });
26
- }
27
- function exposeModule(modulePackage, resourcePath, source) {
28
- if (!modulePackage.name) {
29
- return source;
30
- }
31
- const { dir, name } = path.parse(resourcePath);
32
- let moduleName = path.join(modulePackage.name, dir.substring(modulePackage.dir.length));
33
- if (name !== 'index') {
34
- moduleName = path.join(moduleName, name);
35
- }
36
- if (path.sep !== '/') {
37
- moduleName = moduleName.split(path.sep).join('/');
38
- }
39
- return source + `\n;(globalThis['theia'] = globalThis['theia'] || {})['${moduleName}'] = this;\n`;
40
- }
41
- module.exports = function (source, sourceMap) {
42
- if (this.cacheable) {
43
- this.cacheable();
44
- }
45
- let modulePackage = modulePackages.find(({ dir }) => this.resourcePath.startsWith(dir + path.sep));
46
- if (modulePackage) {
47
- this.callback(undefined, exposeModule(modulePackage, this.resourcePath, source), sourceMap);
48
- return;
49
- }
50
- const searchString = path.sep + 'node_modules';
51
- const index = this.resourcePath.lastIndexOf(searchString);
52
- if (index !== -1) {
53
- const nodeModulesPath = this.resourcePath.substring(0, index + searchString.length);
54
- let dir = this.resourcePath;
55
- while ((dir = path.dirname(dir)) !== nodeModulesPath) {
56
- try {
57
- const { name } = fs.readJSONSync(path.join(dir, 'package.json'));
58
- modulePackage = { name, dir };
59
- modulePackages.push(modulePackage);
60
- this.callback(undefined, exposeModule(modulePackage, this.resourcePath, source), sourceMap);
61
- return;
62
- }
63
- catch {
64
- /** no-op */
65
- }
66
- }
67
- }
68
- this.callback(undefined, source, sourceMap);
69
- };
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2020 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
+ const fs = require("fs-extra");
18
+ const path = require("path");
19
+ const application_package_1 = require("@theia/application-package/lib/application-package");
20
+ const modulePackages = [];
21
+ for (const extensionPackage of new application_package_1.ApplicationPackage({ projectPath: process.cwd() }).extensionPackages) {
22
+ modulePackages.push({
23
+ name: extensionPackage.name,
24
+ dir: path.dirname(extensionPackage.raw.installed.packagePath)
25
+ });
26
+ }
27
+ function exposeModule(modulePackage, resourcePath, source) {
28
+ if (!modulePackage.name) {
29
+ return source;
30
+ }
31
+ const { dir, name } = path.parse(resourcePath);
32
+ let moduleName = path.join(modulePackage.name, dir.substring(modulePackage.dir.length));
33
+ if (name !== 'index') {
34
+ moduleName = path.join(moduleName, name);
35
+ }
36
+ if (path.sep !== '/') {
37
+ moduleName = moduleName.split(path.sep).join('/');
38
+ }
39
+ return source + `\n;(globalThis['theia'] = globalThis['theia'] || {})['${moduleName}'] = this;\n`;
40
+ }
41
+ module.exports = function (source, sourceMap) {
42
+ if (this.cacheable) {
43
+ this.cacheable();
44
+ }
45
+ let modulePackage = modulePackages.find(({ dir }) => this.resourcePath.startsWith(dir + path.sep));
46
+ if (modulePackage) {
47
+ this.callback(undefined, exposeModule(modulePackage, this.resourcePath, source), sourceMap);
48
+ return;
49
+ }
50
+ const searchString = path.sep + 'node_modules';
51
+ const index = this.resourcePath.lastIndexOf(searchString);
52
+ if (index !== -1) {
53
+ const nodeModulesPath = this.resourcePath.substring(0, index + searchString.length);
54
+ let dir = this.resourcePath;
55
+ while ((dir = path.dirname(dir)) !== nodeModulesPath) {
56
+ try {
57
+ const { name } = fs.readJSONSync(path.join(dir, 'package.json'));
58
+ modulePackage = { name, dir };
59
+ modulePackages.push(modulePackage);
60
+ this.callback(undefined, exposeModule(modulePackage, this.resourcePath, source), sourceMap);
61
+ return;
62
+ }
63
+ catch {
64
+ /** no-op */
65
+ }
66
+ }
67
+ }
68
+ this.callback(undefined, source, sourceMap);
69
+ };
70
70
  //# sourceMappingURL=expose-loader.js.map
@@ -1,17 +1,18 @@
1
- import { ApplicationPackage } from '@theia/application-package';
2
- export interface GeneratorOptions {
3
- mode?: 'development' | 'production';
4
- splitFrontend?: boolean;
5
- }
6
- export declare abstract class AbstractGenerator {
7
- protected readonly pck: ApplicationPackage;
8
- protected options: GeneratorOptions;
9
- constructor(pck: ApplicationPackage, options?: GeneratorOptions);
10
- protected ifBrowser(value: string, defaultValue?: string): string;
11
- protected ifElectron(value: string, defaultValue?: string): string;
12
- protected write(path: string, content: string): Promise<void>;
13
- protected ifMonaco(value: () => string, defaultValue?: () => string): string;
14
- protected ifPackage(packageName: string | string[], value: string | (() => string), defaultValue?: string | (() => string)): string;
15
- protected prettyStringify(object: object): string;
16
- }
1
+ import { ApplicationPackage } from '@theia/application-package';
2
+ export interface GeneratorOptions {
3
+ mode?: 'development' | 'production';
4
+ splitFrontend?: boolean;
5
+ }
6
+ export declare abstract class AbstractGenerator {
7
+ protected readonly pck: ApplicationPackage;
8
+ protected options: GeneratorOptions;
9
+ constructor(pck: ApplicationPackage, options?: GeneratorOptions);
10
+ protected ifBrowser(value: string, defaultValue?: string): string;
11
+ protected ifElectron(value: string, defaultValue?: string): string;
12
+ protected ifBrowserOnly(value: string, defaultValue?: string): string;
13
+ protected write(path: string, content: string): Promise<void>;
14
+ protected ifMonaco(value: () => string, defaultValue?: () => string): string;
15
+ protected ifPackage(packageName: string | string[], value: string | (() => string), defaultValue?: string | (() => string)): string;
16
+ protected prettyStringify(object: object): string;
17
+ }
17
18
  //# sourceMappingURL=abstract-generator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"abstract-generator.d.ts","sourceRoot":"","sources":["../../src/generator/abstract-generator.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,gBAAgB;IAC7B,IAAI,CAAC,EAAE,aAAa,GAAG,YAAY,CAAA;IACnC,aAAa,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED,8BAAsB,iBAAiB;IAG/B,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,kBAAkB;IAC1C,SAAS,CAAC,OAAO,EAAE,gBAAgB;gBADhB,GAAG,EAAE,kBAAkB,EAChC,OAAO,GAAE,gBAAqB;IAG5C,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,GAAE,MAAW,GAAG,MAAM;IAIrE,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,GAAE,MAAW,GAAG,MAAM;cAItD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKnE,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,MAAM,EAAE,YAAY,GAAE,MAAM,MAAiB,GAAG,MAAM;IAOtF,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,EAAE,YAAY,GAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAM,GAAG,MAAM;IASvI,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;CAIpD"}
1
+ {"version":3,"file":"abstract-generator.d.ts","sourceRoot":"","sources":["../../src/generator/abstract-generator.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,gBAAgB;IAC7B,IAAI,CAAC,EAAE,aAAa,GAAG,YAAY,CAAA;IACnC,aAAa,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED,8BAAsB,iBAAiB;IAG/B,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,kBAAkB;IAC1C,SAAS,CAAC,OAAO,EAAE,gBAAgB;gBADhB,GAAG,EAAE,kBAAkB,EAChC,OAAO,GAAE,gBAAqB;IAG5C,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,GAAE,MAAW,GAAG,MAAM;IAIrE,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,GAAE,MAAW,GAAG,MAAM;IAItE,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,GAAE,MAAW,GAAG,MAAM;cAIzD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKnE,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,MAAM,EAAE,YAAY,GAAE,MAAM,MAAiB,GAAG,MAAM;IAOtF,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,EAAE,YAAY,GAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAM,GAAG,MAAM;IASvI,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;CAIpD"}
@@ -1,55 +1,58 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2017 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.AbstractGenerator = void 0;
19
- const fs = require("fs-extra");
20
- class AbstractGenerator {
21
- constructor(pck, options = {}) {
22
- this.pck = pck;
23
- this.options = options;
24
- }
25
- ifBrowser(value, defaultValue = '') {
26
- return this.pck.ifBrowser(value, defaultValue);
27
- }
28
- ifElectron(value, defaultValue = '') {
29
- return this.pck.ifElectron(value, defaultValue);
30
- }
31
- async write(path, content) {
32
- await fs.ensureFile(path);
33
- await fs.writeFile(path, content);
34
- }
35
- ifMonaco(value, defaultValue = () => '') {
36
- return this.ifPackage([
37
- '@theia/monaco',
38
- '@theia/monaco-editor-core'
39
- ], value, defaultValue);
40
- }
41
- ifPackage(packageName, value, defaultValue = '') {
42
- const packages = Array.isArray(packageName) ? packageName : [packageName];
43
- if (this.pck.extensionPackages.some(e => packages.includes(e.name))) {
44
- return typeof value === 'string' ? value : value();
45
- }
46
- else {
47
- return typeof defaultValue === 'string' ? defaultValue : defaultValue();
48
- }
49
- }
50
- prettyStringify(object) {
51
- return JSON.stringify(object, undefined, 4);
52
- }
53
- }
54
- exports.AbstractGenerator = AbstractGenerator;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2017 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.AbstractGenerator = void 0;
19
+ const fs = require("fs-extra");
20
+ class AbstractGenerator {
21
+ constructor(pck, options = {}) {
22
+ this.pck = pck;
23
+ this.options = options;
24
+ }
25
+ ifBrowser(value, defaultValue = '') {
26
+ return this.pck.ifBrowser(value, defaultValue);
27
+ }
28
+ ifElectron(value, defaultValue = '') {
29
+ return this.pck.ifElectron(value, defaultValue);
30
+ }
31
+ ifBrowserOnly(value, defaultValue = '') {
32
+ return this.pck.ifBrowserOnly(value, defaultValue);
33
+ }
34
+ async write(path, content) {
35
+ await fs.ensureFile(path);
36
+ await fs.writeFile(path, content);
37
+ }
38
+ ifMonaco(value, defaultValue = () => '') {
39
+ return this.ifPackage([
40
+ '@theia/monaco',
41
+ '@theia/monaco-editor-core'
42
+ ], value, defaultValue);
43
+ }
44
+ ifPackage(packageName, value, defaultValue = '') {
45
+ const packages = Array.isArray(packageName) ? packageName : [packageName];
46
+ if (this.pck.extensionPackages.some(e => packages.includes(e.name))) {
47
+ return typeof value === 'string' ? value : value();
48
+ }
49
+ else {
50
+ return typeof defaultValue === 'string' ? defaultValue : defaultValue();
51
+ }
52
+ }
53
+ prettyStringify(object) {
54
+ return JSON.stringify(object, undefined, 4);
55
+ }
56
+ }
57
+ exports.AbstractGenerator = AbstractGenerator;
55
58
  //# sourceMappingURL=abstract-generator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"abstract-generator.js","sourceRoot":"","sources":["../../src/generator/abstract-generator.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yC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a,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IACvD,CAAC;IAES,KAAK,CAAC,KAAK,CAAC,IAAY,EAAE,OAAe;QAC/C,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAES,QAAQ,CAAC,KAAmB,EAAE,eAA6B,GAAG,EAAE,CAAC,EAAE;QACzE,OAAO,IAAI,CAAC,SAAS,CAAC;YAClB,eAAe;YACf,2BAA2B;SAC9B,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IAC5B,CAAC;IAES,SAAS,CAAC,WAA8B,EAAE,KAA8B,EAAE,eAAwC,EAAE;QAC1H,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QAC1E,IAAI,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE;YACjE,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;SACtD;aAAM;YACH,OAAO,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;SAC3E;IACL,CAAC;IAES,eAAe,CAAC,MAAc;QACpC,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IAChD,CAAC;CAEJ;AA5CD,8CA4CC"}
@@ -1,8 +1,8 @@
1
- import { AbstractGenerator } from './abstract-generator';
2
- export declare class BackendGenerator extends AbstractGenerator {
3
- generate(): Promise<void>;
4
- protected compileElectronMain(electronMainModules?: Map<string, string>): string;
5
- protected compileServer(backendModules: Map<string, string>): string;
6
- protected compileMain(backendModules: Map<string, string>): string;
7
- }
1
+ import { AbstractGenerator } from './abstract-generator';
2
+ export declare class BackendGenerator extends AbstractGenerator {
3
+ generate(): Promise<void>;
4
+ protected compileElectronMain(electronMainModules?: Map<string, string>): string;
5
+ protected compileServer(backendModules: Map<string, string>): string;
6
+ protected compileMain(backendModules: Map<string, string>): string;
7
+ }
8
8
  //# sourceMappingURL=backend-generator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"backend-generator.d.ts","sourceRoot":"","sources":["../../src/generator/backend-generator.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,qBAAa,gBAAiB,SAAQ,iBAAiB;IAE7C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAS/B,SAAS,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;IAwEhF,SAAS,CAAC,aAAa,CAAC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;IAuEpE,SAAS,CAAC,WAAW,CAAC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;CAoBrE"}
1
+ {"version":3,"file":"backend-generator.d.ts","sourceRoot":"","sources":["../../src/generator/backend-generator.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,qBAAa,gBAAiB,SAAQ,iBAAiB;IAE7C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAa/B,SAAS,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;IAwEhF,SAAS,CAAC,aAAa,CAAC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;IAuEpE,SAAS,CAAC,WAAW,CAAC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;CAoBrE"}