@theia/variable-resolver 1.48.1 → 1.48.2

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 (41) hide show
  1. package/README.md +114 -114
  2. package/lib/browser/common-variable-contribution.d.ts +16 -16
  3. package/lib/browser/common-variable-contribution.js +161 -161
  4. package/lib/browser/index.d.ts +3 -3
  5. package/lib/browser/index.js +21 -21
  6. package/lib/browser/variable-input-schema.d.ts +2 -2
  7. package/lib/browser/variable-input-schema.js +130 -130
  8. package/lib/browser/variable-input.d.ts +20 -20
  9. package/lib/browser/variable-input.js +2 -2
  10. package/lib/browser/variable-quick-open-service.d.ts +14 -14
  11. package/lib/browser/variable-quick-open-service.js +69 -69
  12. package/lib/browser/variable-resolver-frontend-contribution.d.ts +13 -13
  13. package/lib/browser/variable-resolver-frontend-contribution.js +53 -53
  14. package/lib/browser/variable-resolver-frontend-contribution.spec.d.ts +4 -4
  15. package/lib/browser/variable-resolver-frontend-contribution.spec.js +82 -82
  16. package/lib/browser/variable-resolver-frontend-module.d.ts +3 -3
  17. package/lib/browser/variable-resolver-frontend-module.js +37 -37
  18. package/lib/browser/variable-resolver-service.d.ts +50 -50
  19. package/lib/browser/variable-resolver-service.js +162 -162
  20. package/lib/browser/variable-resolver-service.spec.d.ts +1 -1
  21. package/lib/browser/variable-resolver-service.spec.js +75 -75
  22. package/lib/browser/variable.d.ts +55 -55
  23. package/lib/browser/variable.js +73 -73
  24. package/lib/browser/variable.spec.d.ts +1 -1
  25. package/lib/browser/variable.spec.js +90 -90
  26. package/lib/common/variable-types.d.ts +7 -7
  27. package/lib/common/variable-types.js +17 -17
  28. package/package.json +4 -4
  29. package/src/browser/common-variable-contribution.ts +151 -151
  30. package/src/browser/index.ts +19 -19
  31. package/src/browser/variable-input-schema.ts +131 -131
  32. package/src/browser/variable-input.ts +47 -47
  33. package/src/browser/variable-quick-open-service.ts +62 -62
  34. package/src/browser/variable-resolver-frontend-contribution.spec.ts +98 -98
  35. package/src/browser/variable-resolver-frontend-contribution.ts +50 -50
  36. package/src/browser/variable-resolver-frontend-module.ts +40 -40
  37. package/src/browser/variable-resolver-service.spec.ts +83 -83
  38. package/src/browser/variable-resolver-service.ts +185 -185
  39. package/src/browser/variable.spec.ts +106 -106
  40. package/src/browser/variable.ts +111 -111
  41. package/src/common/variable-types.ts +23 -23
@@ -1,74 +1,74 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2018 Red Hat, Inc. 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.VariableRegistry = exports.VariableContribution = void 0;
19
- const tslib_1 = require("tslib");
20
- const inversify_1 = require("@theia/core/shared/inversify");
21
- const core_1 = require("@theia/core");
22
- exports.VariableContribution = Symbol('VariableContribution');
23
- /**
24
- * The variable registry manages variables.
25
- */
26
- let VariableRegistry = class VariableRegistry {
27
- constructor() {
28
- this.variables = new Map();
29
- this.toDispose = new core_1.DisposableCollection();
30
- }
31
- dispose() {
32
- this.toDispose.dispose();
33
- }
34
- /**
35
- * Register the given variable.
36
- * Do nothing if a variable is already registered for the given variable name.
37
- */
38
- registerVariable(variable) {
39
- if (this.variables.has(variable.name)) {
40
- console.warn(`A variables with name ${variable.name} is already registered.`);
41
- return core_1.Disposable.NULL;
42
- }
43
- this.variables.set(variable.name, variable);
44
- const disposable = {
45
- dispose: () => this.variables.delete(variable.name)
46
- };
47
- this.toDispose.push(disposable);
48
- return disposable;
49
- }
50
- /**
51
- * Return all registered variables.
52
- */
53
- getVariables() {
54
- return [...this.variables.values()];
55
- }
56
- /**
57
- * Get a variable for the given name or `undefined` if none.
58
- */
59
- getVariable(name) {
60
- return this.variables.get(name);
61
- }
62
- /**
63
- * Register an array of variables.
64
- * Do nothing if a variable is already registered for the given variable name.
65
- */
66
- registerVariables(variables) {
67
- return variables.map(v => this.registerVariable(v));
68
- }
69
- };
70
- VariableRegistry = (0, tslib_1.__decorate)([
71
- (0, inversify_1.injectable)()
72
- ], VariableRegistry);
73
- exports.VariableRegistry = VariableRegistry;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 Red Hat, Inc. 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.VariableRegistry = exports.VariableContribution = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const core_1 = require("@theia/core");
22
+ exports.VariableContribution = Symbol('VariableContribution');
23
+ /**
24
+ * The variable registry manages variables.
25
+ */
26
+ let VariableRegistry = class VariableRegistry {
27
+ constructor() {
28
+ this.variables = new Map();
29
+ this.toDispose = new core_1.DisposableCollection();
30
+ }
31
+ dispose() {
32
+ this.toDispose.dispose();
33
+ }
34
+ /**
35
+ * Register the given variable.
36
+ * Do nothing if a variable is already registered for the given variable name.
37
+ */
38
+ registerVariable(variable) {
39
+ if (this.variables.has(variable.name)) {
40
+ console.warn(`A variables with name ${variable.name} is already registered.`);
41
+ return core_1.Disposable.NULL;
42
+ }
43
+ this.variables.set(variable.name, variable);
44
+ const disposable = {
45
+ dispose: () => this.variables.delete(variable.name)
46
+ };
47
+ this.toDispose.push(disposable);
48
+ return disposable;
49
+ }
50
+ /**
51
+ * Return all registered variables.
52
+ */
53
+ getVariables() {
54
+ return [...this.variables.values()];
55
+ }
56
+ /**
57
+ * Get a variable for the given name or `undefined` if none.
58
+ */
59
+ getVariable(name) {
60
+ return this.variables.get(name);
61
+ }
62
+ /**
63
+ * Register an array of variables.
64
+ * Do nothing if a variable is already registered for the given variable name.
65
+ */
66
+ registerVariables(variables) {
67
+ return variables.map(v => this.registerVariable(v));
68
+ }
69
+ };
70
+ VariableRegistry = (0, tslib_1.__decorate)([
71
+ (0, inversify_1.injectable)()
72
+ ], VariableRegistry);
73
+ exports.VariableRegistry = VariableRegistry;
74
74
  //# sourceMappingURL=variable.js.map
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=variable.spec.d.ts.map
@@ -1,91 +1,91 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2018 Red Hat, Inc. 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
- const chai = require("chai");
19
- const inversify_1 = require("@theia/core/shared/inversify");
20
- const common_1 = require("@theia/core/lib/common");
21
- const mock_logger_1 = require("@theia/core/lib/common/test/mock-logger");
22
- const variable_1 = require("./variable");
23
- const expect = chai.expect;
24
- let variableRegistry;
25
- before(() => {
26
- chai.config.showDiff = true;
27
- chai.config.includeStack = true;
28
- });
29
- describe('variable api', () => {
30
- let testContainer;
31
- before(() => {
32
- testContainer = new inversify_1.Container();
33
- const module = new inversify_1.ContainerModule((bind, unbind, isBound, rebind) => {
34
- bind(common_1.ILogger).to(mock_logger_1.MockLogger);
35
- bind(variable_1.VariableRegistry).toSelf();
36
- });
37
- testContainer.load(module);
38
- });
39
- beforeEach(() => {
40
- variableRegistry = testContainer.get(variable_1.VariableRegistry);
41
- });
42
- it('should register and return variable', () => {
43
- registerTestVariable();
44
- const variable = variableRegistry.getVariable(TEST_VARIABLE.name);
45
- expect(variable).is.not.undefined;
46
- if (variable) {
47
- expect(variable.name).is.equal(TEST_VARIABLE.name);
48
- }
49
- });
50
- it('should not register a variable for already existed name', () => {
51
- const variables = [
52
- {
53
- name: 'workspaceRoot',
54
- description: 'workspace root URI',
55
- resolve: () => Promise.resolve('')
56
- },
57
- {
58
- name: 'workspaceRoot',
59
- description: 'workspace root URI 2',
60
- resolve: () => Promise.resolve('')
61
- }
62
- ];
63
- variables.forEach(v => variableRegistry.registerVariable(v));
64
- const registeredVariables = variableRegistry.getVariables();
65
- expect(registeredVariables.length).to.be.equal(1);
66
- expect(registeredVariables[0].name).to.be.equal('workspaceRoot');
67
- expect(registeredVariables[0].description).to.be.equal('workspace root URI');
68
- });
69
- it('should dispose variable', () => {
70
- const disposable = registerTestVariable();
71
- disposable.dispose();
72
- const variable = variableRegistry.getVariable(TEST_VARIABLE.name);
73
- expect(variable).is.undefined;
74
- });
75
- it('should unregister variables on dispose', () => {
76
- registerTestVariable();
77
- let variables = variableRegistry.getVariables();
78
- expect(variables.length).to.be.equal(1);
79
- variableRegistry.dispose();
80
- variables = variableRegistry.getVariables();
81
- expect(variables.length).to.be.equal(0);
82
- });
83
- });
84
- const TEST_VARIABLE = {
85
- name: 'workspaceRoot',
86
- resolve: () => Promise.resolve('')
87
- };
88
- function registerTestVariable() {
89
- return variableRegistry.registerVariable(TEST_VARIABLE);
90
- }
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 Red Hat, Inc. 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
+ const chai = require("chai");
19
+ const inversify_1 = require("@theia/core/shared/inversify");
20
+ const common_1 = require("@theia/core/lib/common");
21
+ const mock_logger_1 = require("@theia/core/lib/common/test/mock-logger");
22
+ const variable_1 = require("./variable");
23
+ const expect = chai.expect;
24
+ let variableRegistry;
25
+ before(() => {
26
+ chai.config.showDiff = true;
27
+ chai.config.includeStack = true;
28
+ });
29
+ describe('variable api', () => {
30
+ let testContainer;
31
+ before(() => {
32
+ testContainer = new inversify_1.Container();
33
+ const module = new inversify_1.ContainerModule((bind, unbind, isBound, rebind) => {
34
+ bind(common_1.ILogger).to(mock_logger_1.MockLogger);
35
+ bind(variable_1.VariableRegistry).toSelf();
36
+ });
37
+ testContainer.load(module);
38
+ });
39
+ beforeEach(() => {
40
+ variableRegistry = testContainer.get(variable_1.VariableRegistry);
41
+ });
42
+ it('should register and return variable', () => {
43
+ registerTestVariable();
44
+ const variable = variableRegistry.getVariable(TEST_VARIABLE.name);
45
+ expect(variable).is.not.undefined;
46
+ if (variable) {
47
+ expect(variable.name).is.equal(TEST_VARIABLE.name);
48
+ }
49
+ });
50
+ it('should not register a variable for already existed name', () => {
51
+ const variables = [
52
+ {
53
+ name: 'workspaceRoot',
54
+ description: 'workspace root URI',
55
+ resolve: () => Promise.resolve('')
56
+ },
57
+ {
58
+ name: 'workspaceRoot',
59
+ description: 'workspace root URI 2',
60
+ resolve: () => Promise.resolve('')
61
+ }
62
+ ];
63
+ variables.forEach(v => variableRegistry.registerVariable(v));
64
+ const registeredVariables = variableRegistry.getVariables();
65
+ expect(registeredVariables.length).to.be.equal(1);
66
+ expect(registeredVariables[0].name).to.be.equal('workspaceRoot');
67
+ expect(registeredVariables[0].description).to.be.equal('workspace root URI');
68
+ });
69
+ it('should dispose variable', () => {
70
+ const disposable = registerTestVariable();
71
+ disposable.dispose();
72
+ const variable = variableRegistry.getVariable(TEST_VARIABLE.name);
73
+ expect(variable).is.undefined;
74
+ });
75
+ it('should unregister variables on dispose', () => {
76
+ registerTestVariable();
77
+ let variables = variableRegistry.getVariables();
78
+ expect(variables.length).to.be.equal(1);
79
+ variableRegistry.dispose();
80
+ variables = variableRegistry.getVariables();
81
+ expect(variables.length).to.be.equal(0);
82
+ });
83
+ });
84
+ const TEST_VARIABLE = {
85
+ name: 'workspaceRoot',
86
+ resolve: () => Promise.resolve('')
87
+ };
88
+ function registerTestVariable() {
89
+ return variableRegistry.registerVariable(TEST_VARIABLE);
90
+ }
91
91
  //# sourceMappingURL=variable.spec.js.map
@@ -1,8 +1,8 @@
1
- /**
2
- * Holds variable-names to command id mappings (e.g. Provided by specific plugins / extensions)
3
- * see "variables": https://code.visualstudio.com/api/references/contribution-points#contributes.debuggers
4
- */
5
- export interface CommandIdVariables {
6
- [id: string]: string;
7
- }
1
+ /**
2
+ * Holds variable-names to command id mappings (e.g. Provided by specific plugins / extensions)
3
+ * see "variables": https://code.visualstudio.com/api/references/contribution-points#contributes.debuggers
4
+ */
5
+ export interface CommandIdVariables {
6
+ [id: string]: string;
7
+ }
8
8
  //# sourceMappingURL=variable-types.d.ts.map
@@ -1,18 +1,18 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2022 Ericsson 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 });
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2022 Ericsson 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
18
  //# sourceMappingURL=variable-types.js.map
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@theia/variable-resolver",
3
- "version": "1.48.1",
3
+ "version": "1.48.2",
4
4
  "description": "Theia - Variable Resolver Extension",
5
5
  "dependencies": {
6
- "@theia/core": "1.48.1",
6
+ "@theia/core": "1.48.2",
7
7
  "tslib": "^2.6.2"
8
8
  },
9
9
  "publishConfig": {
@@ -45,10 +45,10 @@
45
45
  "watch": "theiaext watch"
46
46
  },
47
47
  "devDependencies": {
48
- "@theia/ext-scripts": "1.48.1"
48
+ "@theia/ext-scripts": "1.48.2"
49
49
  },
50
50
  "nyc": {
51
51
  "extends": "../../configs/nyc.json"
52
52
  },
53
- "gitHead": "04c631933dfd14f58d1df5b9b28dd5596c84ec04"
53
+ "gitHead": "0e9583d043dde303de7a0f86f68439659f8827b0"
54
54
  }