@teambit/git 0.0.0-03ba5ee5175a898e558c1938c18f396cdd131bb8
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/esm.mjs +7 -0
- package/dist/git.aspect.d.ts +2 -0
- package/dist/git.aspect.js +18 -0
- package/dist/git.aspect.js.map +1 -0
- package/dist/git.cmd.d.ts +10 -0
- package/dist/git.cmd.js +36 -0
- package/dist/git.cmd.js.map +1 -0
- package/dist/git.main.runtime.d.ts +31 -0
- package/dist/git.main.runtime.js +199 -0
- package/dist/git.main.runtime.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/merge-bitmaps.cmd.d.ts +14 -0
- package/dist/merge-bitmaps.cmd.js +47 -0
- package/dist/merge-bitmaps.cmd.js.map +1 -0
- package/dist/preview-1752188910074.js +7 -0
- package/dist/set-git-merge-driver.cmd.d.ts +17 -0
- package/dist/set-git-merge-driver.cmd.js +41 -0
- package/dist/set-git-merge-driver.cmd.js.map +1 -0
- package/esm.mjs +7 -0
- package/package.json +57 -0
- package/types/asset.d.ts +41 -0
- package/types/style.d.ts +42 -0
package/dist/esm.mjs
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.GitAspect = void 0;
|
7
|
+
function _harmony() {
|
8
|
+
const data = require("@teambit/harmony");
|
9
|
+
_harmony = function () {
|
10
|
+
return data;
|
11
|
+
};
|
12
|
+
return data;
|
13
|
+
}
|
14
|
+
const GitAspect = exports.GitAspect = _harmony().Aspect.create({
|
15
|
+
id: 'teambit.git/git'
|
16
|
+
});
|
17
|
+
|
18
|
+
//# sourceMappingURL=git.aspect.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_harmony","data","require","GitAspect","exports","Aspect","create","id"],"sources":["git.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const GitAspect = Aspect.create({\n id: 'teambit.git/git',\n});\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAGE,iBAAM,CAACC,MAAM,CAAC;EACrCC,EAAE,EAAE;AACN,CAAC,CAAC","ignoreList":[]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { Command } from '@teambit/cli';
|
2
|
+
export declare class GitCmd implements Command {
|
3
|
+
name: string;
|
4
|
+
alias: string;
|
5
|
+
description: string;
|
6
|
+
options: never[];
|
7
|
+
group: string;
|
8
|
+
commands: Command[];
|
9
|
+
report([unrecognizedSubcommand]: [string]): Promise<string>;
|
10
|
+
}
|
package/dist/git.cmd.js
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.GitCmd = void 0;
|
7
|
+
function _chalk() {
|
8
|
+
const data = _interopRequireDefault(require("chalk"));
|
9
|
+
_chalk = function () {
|
10
|
+
return data;
|
11
|
+
};
|
12
|
+
return data;
|
13
|
+
}
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
15
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
17
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
18
|
+
const COMMAND_NAME = 'git';
|
19
|
+
class GitCmd {
|
20
|
+
constructor() {
|
21
|
+
_defineProperty(this, "name", `${COMMAND_NAME} <sub-command>`);
|
22
|
+
_defineProperty(this, "alias", '');
|
23
|
+
_defineProperty(this, "description", 'perform git operations');
|
24
|
+
_defineProperty(this, "options", []);
|
25
|
+
_defineProperty(this, "group", 'workspace-tools');
|
26
|
+
_defineProperty(this, "commands", []);
|
27
|
+
}
|
28
|
+
// helpUrl = '';
|
29
|
+
|
30
|
+
async report([unrecognizedSubcommand]) {
|
31
|
+
return _chalk().default.red(`"${unrecognizedSubcommand}" is not a subcommand of "git", please run "bit git --help" to list the subcommands`);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
exports.GitCmd = GitCmd;
|
35
|
+
|
36
|
+
//# sourceMappingURL=git.cmd.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","COMMAND_NAME","GitCmd","constructor","report","unrecognizedSubcommand","chalk","red","exports"],"sources":["git.cmd.ts"],"sourcesContent":["import { Command } from '@teambit/cli';\nimport chalk from 'chalk';\n\nconst COMMAND_NAME = 'git';\n\nexport class GitCmd implements Command {\n name = `${COMMAND_NAME} <sub-command>`;\n alias = '';\n description = 'perform git operations';\n options = [];\n group = 'workspace-tools';\n commands: Command[] = [];\n // helpUrl = '';\n\n async report([unrecognizedSubcommand]: [string]) {\n return chalk.red(\n `\"${unrecognizedSubcommand}\" is not a subcommand of \"git\", please run \"bit git --help\" to list the subcommands`\n );\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,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IAAIF,sBAAsB,qFAC5B,CAAC;EACH;AACF;AAACG,OAAA,CAAAN,MAAA,GAAAA,MAAA","ignoreList":[]}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { CLIMain } from '@teambit/cli';
|
2
|
+
import { Workspace } from '@teambit/workspace';
|
3
|
+
type SetGitMergeDriverOpts = {
|
4
|
+
global?: boolean;
|
5
|
+
};
|
6
|
+
export interface GitExtWorkspaceConfig {
|
7
|
+
mergeStrategy: 'ours' | 'theirs' | 'manual';
|
8
|
+
}
|
9
|
+
export declare class GitMain {
|
10
|
+
private workspace;
|
11
|
+
/**
|
12
|
+
* Git extension configuration.
|
13
|
+
*/
|
14
|
+
readonly config: GitExtWorkspaceConfig;
|
15
|
+
constructor(workspace: Workspace,
|
16
|
+
/**
|
17
|
+
* Git extension configuration.
|
18
|
+
*/
|
19
|
+
config: GitExtWorkspaceConfig);
|
20
|
+
mergeBitmaps(ancestor: string, current: string, other: string): Promise<string>;
|
21
|
+
setGitMergeDriver(opts: SetGitMergeDriverOpts): Promise<boolean>;
|
22
|
+
private setGitConfig;
|
23
|
+
private setGitAttributes;
|
24
|
+
private getGitAttributesPath;
|
25
|
+
private stripBom;
|
26
|
+
static slots: never[];
|
27
|
+
static dependencies: import("@teambit/harmony").Aspect[];
|
28
|
+
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
29
|
+
static provider([cli, workspace]: [CLIMain, Workspace], config: GitExtWorkspaceConfig): Promise<GitMain>;
|
30
|
+
}
|
31
|
+
export default GitMain;
|
@@ -0,0 +1,199 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = exports.GitMain = void 0;
|
7
|
+
function _fsExtra() {
|
8
|
+
const data = _interopRequireDefault(require("fs-extra"));
|
9
|
+
_fsExtra = function () {
|
10
|
+
return data;
|
11
|
+
};
|
12
|
+
return data;
|
13
|
+
}
|
14
|
+
function _bitError() {
|
15
|
+
const data = require("@teambit/bit-error");
|
16
|
+
_bitError = function () {
|
17
|
+
return data;
|
18
|
+
};
|
19
|
+
return data;
|
20
|
+
}
|
21
|
+
function _os() {
|
22
|
+
const data = require("os");
|
23
|
+
_os = function () {
|
24
|
+
return data;
|
25
|
+
};
|
26
|
+
return data;
|
27
|
+
}
|
28
|
+
function _path() {
|
29
|
+
const data = require("path");
|
30
|
+
_path = function () {
|
31
|
+
return data;
|
32
|
+
};
|
33
|
+
return data;
|
34
|
+
}
|
35
|
+
function _gitconfig() {
|
36
|
+
const data = _interopRequireDefault(require("@teambit/gitconfig"));
|
37
|
+
_gitconfig = function () {
|
38
|
+
return data;
|
39
|
+
};
|
40
|
+
return data;
|
41
|
+
}
|
42
|
+
function _cli() {
|
43
|
+
const data = require("@teambit/cli");
|
44
|
+
_cli = function () {
|
45
|
+
return data;
|
46
|
+
};
|
47
|
+
return data;
|
48
|
+
}
|
49
|
+
function _workspace() {
|
50
|
+
const data = require("@teambit/workspace");
|
51
|
+
_workspace = function () {
|
52
|
+
return data;
|
53
|
+
};
|
54
|
+
return data;
|
55
|
+
}
|
56
|
+
function _git() {
|
57
|
+
const data = require("./git.aspect");
|
58
|
+
_git = function () {
|
59
|
+
return data;
|
60
|
+
};
|
61
|
+
return data;
|
62
|
+
}
|
63
|
+
function _mergeBitmaps() {
|
64
|
+
const data = require("./merge-bitmaps.cmd");
|
65
|
+
_mergeBitmaps = function () {
|
66
|
+
return data;
|
67
|
+
};
|
68
|
+
return data;
|
69
|
+
}
|
70
|
+
function _setGitMergeDriver() {
|
71
|
+
const data = require("./set-git-merge-driver.cmd");
|
72
|
+
_setGitMergeDriver = function () {
|
73
|
+
return data;
|
74
|
+
};
|
75
|
+
return data;
|
76
|
+
}
|
77
|
+
function _git2() {
|
78
|
+
const data = require("./git.cmd");
|
79
|
+
_git2 = function () {
|
80
|
+
return data;
|
81
|
+
};
|
82
|
+
return data;
|
83
|
+
}
|
84
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
85
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
86
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
87
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
88
|
+
const GIT_BASE_KEY = 'merge.bitmap-driver';
|
89
|
+
const GIT_NAME_KEY = `${GIT_BASE_KEY}.name`;
|
90
|
+
const GIT_DRIVER_KEY = `${GIT_BASE_KEY}.driver`;
|
91
|
+
const GIT_NAME_VALUE = 'A custom merge driver used to resolve conflicts in .bitmap files';
|
92
|
+
// const binName = process.argv[1];
|
93
|
+
const GIT_DRIVER_VALUE = 'bd git merge-bitmaps %O %A %B';
|
94
|
+
const GIT_ATTRIBUTES = '.bitmap merge=bitmap-driver';
|
95
|
+
class GitMain {
|
96
|
+
constructor(workspace,
|
97
|
+
/**
|
98
|
+
* Git extension configuration.
|
99
|
+
*/
|
100
|
+
config) {
|
101
|
+
this.workspace = workspace;
|
102
|
+
this.config = config;
|
103
|
+
}
|
104
|
+
async mergeBitmaps(ancestor, current, other) {
|
105
|
+
const encoding = 'utf-8';
|
106
|
+
// const ancestorContent = this.stripBom(fs.readFileSync(ancestor, encoding));
|
107
|
+
const currentContent = this.stripBom(_fsExtra().default.readFileSync(current, encoding));
|
108
|
+
const otherContent = this.stripBom(_fsExtra().default.readFileSync(other, encoding));
|
109
|
+
const opts = {
|
110
|
+
mergeStrategy: this.config.mergeStrategy || 'manual'
|
111
|
+
};
|
112
|
+
const merged = this.workspace.bitMap.mergeBitmaps(currentContent, otherContent, opts);
|
113
|
+
await _fsExtra().default.outputFile(current, merged);
|
114
|
+
return merged;
|
115
|
+
}
|
116
|
+
async setGitMergeDriver(opts) {
|
117
|
+
await this.setGitConfig(opts);
|
118
|
+
await this.setGitAttributes(opts);
|
119
|
+
return true;
|
120
|
+
}
|
121
|
+
async setGitConfig(opts) {
|
122
|
+
const isGit = await _fsExtra().default.pathExists('.git');
|
123
|
+
if (!isGit && !opts.global) {
|
124
|
+
throw new (_bitError().BitError)('This is not a git repository');
|
125
|
+
}
|
126
|
+
const location = opts.global ? 'global' : 'local';
|
127
|
+
let gitVal;
|
128
|
+
try {
|
129
|
+
gitVal = await _gitconfig().default.get(GIT_NAME_KEY, {
|
130
|
+
location
|
131
|
+
});
|
132
|
+
} catch {
|
133
|
+
// do nothing, it just means that there is no config yet which is fine
|
134
|
+
}
|
135
|
+
if (gitVal) {
|
136
|
+
return; // already set
|
137
|
+
}
|
138
|
+
await _gitconfig().default.set(GIT_NAME_KEY, GIT_NAME_VALUE, {
|
139
|
+
location
|
140
|
+
});
|
141
|
+
await _gitconfig().default.set(GIT_DRIVER_KEY, GIT_DRIVER_VALUE, {
|
142
|
+
location
|
143
|
+
});
|
144
|
+
}
|
145
|
+
async setGitAttributes(opts) {
|
146
|
+
const attributesPath = await this.getGitAttributesPath(opts.global);
|
147
|
+
const isGit = await _fsExtra().default.pathExists('.git');
|
148
|
+
if (!isGit && !opts.global) {
|
149
|
+
throw new (_bitError().BitError)('This is not a git repository');
|
150
|
+
}
|
151
|
+
const fileExist = await _fsExtra().default.pathExists(attributesPath);
|
152
|
+
if (!fileExist) {
|
153
|
+
await _fsExtra().default.writeFile(attributesPath, GIT_ATTRIBUTES);
|
154
|
+
} else {
|
155
|
+
const gitAttributes = await _fsExtra().default.readFile(attributesPath, 'utf8');
|
156
|
+
if (gitAttributes.includes(GIT_ATTRIBUTES)) {
|
157
|
+
return; // already set
|
158
|
+
}
|
159
|
+
await _fsExtra().default.appendFile(attributesPath, `\n${GIT_ATTRIBUTES}`);
|
160
|
+
}
|
161
|
+
}
|
162
|
+
async getGitAttributesPath(global = false) {
|
163
|
+
const fromConfig = await _gitconfig().default.get('core.attributesFile', {
|
164
|
+
location: global ? 'global' : 'local'
|
165
|
+
});
|
166
|
+
if (fromConfig) {
|
167
|
+
return fromConfig;
|
168
|
+
}
|
169
|
+
if (!global) {
|
170
|
+
return '.gitattributes';
|
171
|
+
}
|
172
|
+
const xdgConfigHome = process.env.XDG_CONFIG_HOME;
|
173
|
+
if (xdgConfigHome) {
|
174
|
+
return (0, _path().join)(xdgConfigHome, 'git', 'attributes');
|
175
|
+
}
|
176
|
+
return (0, _path().join)((0, _os().homedir)(), '.config', 'git', 'attributes');
|
177
|
+
}
|
178
|
+
stripBom(str) {
|
179
|
+
return str[0] === '\uFEFF' ? str.slice(1) : str;
|
180
|
+
}
|
181
|
+
static async provider([cli, workspace], config) {
|
182
|
+
const gitMain = new GitMain(workspace, config);
|
183
|
+
const gitCmd = new (_git2().GitCmd)();
|
184
|
+
gitCmd.commands = [new (_setGitMergeDriver().SetGitMergeDriverCmd)(gitMain), new (_mergeBitmaps().MergeBitmapsCmd)(gitMain)];
|
185
|
+
cli.register(gitCmd);
|
186
|
+
cli.registerGroup('git', 'Git');
|
187
|
+
return gitMain;
|
188
|
+
}
|
189
|
+
}
|
190
|
+
exports.GitMain = GitMain;
|
191
|
+
_defineProperty(GitMain, "slots", []);
|
192
|
+
// define your aspect dependencies here.
|
193
|
+
// in case you need to use another aspect API.
|
194
|
+
_defineProperty(GitMain, "dependencies", [_cli().CLIAspect, _workspace().WorkspaceAspect]);
|
195
|
+
_defineProperty(GitMain, "runtime", _cli().MainRuntime);
|
196
|
+
_git().GitAspect.addRuntime(GitMain);
|
197
|
+
var _default = exports.default = GitMain;
|
198
|
+
|
199
|
+
//# sourceMappingURL=git.main.runtime.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_bitError","_os","_path","_gitconfig","_cli","_workspace","_git","_mergeBitmaps","_setGitMergeDriver","_git2","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","GIT_BASE_KEY","GIT_NAME_KEY","GIT_DRIVER_KEY","GIT_NAME_VALUE","GIT_DRIVER_VALUE","GIT_ATTRIBUTES","GitMain","constructor","workspace","config","mergeBitmaps","ancestor","current","other","encoding","currentContent","stripBom","fs","readFileSync","otherContent","opts","mergeStrategy","merged","bitMap","outputFile","setGitMergeDriver","setGitConfig","setGitAttributes","isGit","pathExists","global","BitError","location","gitVal","gitconfig","get","set","attributesPath","getGitAttributesPath","fileExist","writeFile","gitAttributes","readFile","includes","appendFile","fromConfig","xdgConfigHome","process","env","XDG_CONFIG_HOME","join","homedir","str","slice","provider","cli","gitMain","gitCmd","GitCmd","commands","SetGitMergeDriverCmd","MergeBitmapsCmd","register","registerGroup","exports","CLIAspect","WorkspaceAspect","MainRuntime","GitAspect","addRuntime","_default"],"sources":["git.main.runtime.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport { BitError } from '@teambit/bit-error';\nimport { homedir } from 'os';\nimport { join } from 'path';\nimport gitconfig from '@teambit/gitconfig';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { WorkspaceAspect, Workspace, BitmapMergeOptions } from '@teambit/workspace';\nimport { GitAspect } from './git.aspect';\nimport { MergeBitmapsCmd } from './merge-bitmaps.cmd';\nimport { SetGitMergeDriverCmd } from './set-git-merge-driver.cmd';\nimport { GitCmd } from './git.cmd';\n\ntype SetGitMergeDriverOpts = {\n global?: boolean;\n};\n\nconst GIT_BASE_KEY = 'merge.bitmap-driver';\nconst GIT_NAME_KEY = `${GIT_BASE_KEY}.name`;\nconst GIT_DRIVER_KEY = `${GIT_BASE_KEY}.driver`;\n\nconst GIT_NAME_VALUE = 'A custom merge driver used to resolve conflicts in .bitmap files';\n// const binName = process.argv[1];\nconst GIT_DRIVER_VALUE = 'bd git merge-bitmaps %O %A %B';\n\nconst GIT_ATTRIBUTES = '.bitmap merge=bitmap-driver';\n\nexport interface GitExtWorkspaceConfig {\n mergeStrategy: 'ours' | 'theirs' | 'manual';\n}\nexport class GitMain {\n constructor(\n private workspace: Workspace,\n /**\n * Git extension configuration.\n */\n readonly config: GitExtWorkspaceConfig\n ) {}\n\n async mergeBitmaps(ancestor: string, current: string, other: string) {\n const encoding = 'utf-8';\n // const ancestorContent = this.stripBom(fs.readFileSync(ancestor, encoding));\n const currentContent = this.stripBom(fs.readFileSync(current, encoding));\n const otherContent = this.stripBom(fs.readFileSync(other, encoding));\n const opts: BitmapMergeOptions = {\n mergeStrategy: this.config.mergeStrategy || 'manual',\n };\n const merged = this.workspace.bitMap.mergeBitmaps(currentContent, otherContent, opts);\n await fs.outputFile(current, merged);\n return merged;\n }\n\n async setGitMergeDriver(opts: SetGitMergeDriverOpts) {\n await this.setGitConfig(opts);\n await this.setGitAttributes(opts);\n return true;\n }\n\n private async setGitConfig(opts: SetGitMergeDriverOpts) {\n const isGit = await fs.pathExists('.git');\n if (!isGit && !opts.global) {\n throw new BitError('This is not a git repository');\n }\n const location = opts.global ? 'global' : 'local';\n let gitVal;\n try {\n gitVal = await gitconfig.get(GIT_NAME_KEY, { location });\n } catch {\n // do nothing, it just means that there is no config yet which is fine\n }\n if (gitVal) {\n return; // already set\n }\n await gitconfig.set(GIT_NAME_KEY, GIT_NAME_VALUE, { location });\n await gitconfig.set(GIT_DRIVER_KEY, GIT_DRIVER_VALUE, { location });\n }\n\n private async setGitAttributes(opts: SetGitMergeDriverOpts) {\n const attributesPath = await this.getGitAttributesPath(opts.global);\n const isGit = await fs.pathExists('.git');\n if (!isGit && !opts.global) {\n throw new BitError('This is not a git repository');\n }\n const fileExist = await fs.pathExists(attributesPath);\n if (!fileExist) {\n await fs.writeFile(attributesPath, GIT_ATTRIBUTES);\n } else {\n const gitAttributes = await fs.readFile(attributesPath, 'utf8');\n if (gitAttributes.includes(GIT_ATTRIBUTES)) {\n return; // already set\n }\n await fs.appendFile(attributesPath, `\\n${GIT_ATTRIBUTES}`);\n }\n }\n\n private async getGitAttributesPath(global = false) {\n const fromConfig = await gitconfig.get('core.attributesFile', { location: global ? 'global' : 'local' });\n if (fromConfig) {\n return fromConfig;\n }\n if (!global) {\n return '.gitattributes';\n }\n const xdgConfigHome = process.env.XDG_CONFIG_HOME;\n if (xdgConfigHome) {\n return join(xdgConfigHome, 'git', 'attributes');\n }\n return join(homedir(), '.config', 'git', 'attributes');\n }\n\n private stripBom(str) {\n return str[0] === '\\uFEFF' ? str.slice(1) : str;\n }\n\n static slots = [];\n // define your aspect dependencies here.\n // in case you need to use another aspect API.\n static dependencies = [CLIAspect, WorkspaceAspect];\n\n static runtime = MainRuntime;\n\n static async provider([cli, workspace]: [CLIMain, Workspace], config: GitExtWorkspaceConfig) {\n const gitMain = new GitMain(workspace, config);\n const gitCmd = new GitCmd();\n gitCmd.commands = [new SetGitMergeDriverCmd(gitMain), new MergeBitmapsCmd(gitMain)];\n cli.register(gitCmd);\n cli.registerGroup('git', 'Git');\n return gitMain;\n }\n}\n\nGitAspect.addRuntime(GitMain);\n\nexport default GitMain;\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,IAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,GAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,KAAA,YAAAA,CAAA;IAAA,OAAA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K,EAAE,YAAY,CAAC;EACxD;EAEQnC,QAAQA,CAACoC,GAAG,EAAE;IACpB,OAAOA,GAAG,CAAC,CAAC,CAAC,KAAK,QAAQ,GAAGA,GAAG,CAACC,KAAK,CAAC,CAAC,CAAC,GAAGD,GAAG;EACjD;EASA,aAAaE,QAAQA,CAAC,CAACC,GAAG,EAAE/C,SAAS,CAAuB,EAAEC,MAA6B,EAAE;IAC3F,MAAM+C,OAAO,GAAG,IAAIlD,OAAO,CAACE,SAAS,EAAEC,MAAM,CAAC;IAC9C,MAAMgD,MAAM,GAAG,KAAIC,cAAM,EAAC,CAAC;IAC3BD,MAAM,CAACE,QAAQ,GAAG,CAAC,KAAIC,yCAAoB,EAACJ,OAAO,CAAC,EAAE,KAAIK,+BAAe,EAACL,OAAO,CAAC,CAAC;IACnFD,GAAG,CAACO,QAAQ,CAACL,MAAM,CAAC;IACpBF,GAAG,CAACQ,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC;IAC/B,OAAOP,OAAO;EAChB;AACF;AAACQ,OAAA,CAAA1D,OAAA,GAAAA,OAAA;AAAAxB,eAAA,CAnGYwB,OAAO,WAoFH,EAAE;AACjB;AACA;AAAAxB,eAAA,CAtFWwB,OAAO,kBAuFI,CAAC2D,gBAAS,EAAEC,4BAAe,CAAC;AAAApF,eAAA,CAvFvCwB,OAAO,aAyFD6D,kBAAW;AAY9BC,gBAAS,CAACC,UAAU,CAAC/D,OAAO,CAAC;AAAC,IAAAgE,QAAA,GAAAN,OAAA,CAAAnF,OAAA,GAEfyB,OAAO","ignoreList":[]}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "GitAspect", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function () {
|
9
|
+
return _git().GitAspect;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
exports.default = void 0;
|
13
|
+
function _git() {
|
14
|
+
const data = require("./git.aspect");
|
15
|
+
_git = function () {
|
16
|
+
return data;
|
17
|
+
};
|
18
|
+
return data;
|
19
|
+
}
|
20
|
+
var _default = exports.default = _git().GitAspect;
|
21
|
+
|
22
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_git","data","require","_default","exports","default","GitAspect"],"sources":["index.ts"],"sourcesContent":["import { GitAspect } from './git.aspect';\n\nexport type { GitMain } from './git.main.runtime';\nexport default GitAspect;\nexport { GitAspect };\n"],"mappings":";;;;;;;;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAG1BC,gBAAS","ignoreList":[]}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { Command, CommandOptions } from '@teambit/cli';
|
2
|
+
import { GitMain } from './git.main.runtime';
|
3
|
+
export declare class MergeBitmapsCmd implements Command {
|
4
|
+
private git;
|
5
|
+
name: string;
|
6
|
+
alias: string;
|
7
|
+
description: string;
|
8
|
+
options: CommandOptions;
|
9
|
+
group: string;
|
10
|
+
commands: Command[];
|
11
|
+
private: boolean;
|
12
|
+
constructor(git: GitMain);
|
13
|
+
report([ancestor, current, other]: string[]): Promise<string>;
|
14
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.MergeBitmapsCmd = void 0;
|
7
|
+
function _chalk() {
|
8
|
+
const data = _interopRequireDefault(require("chalk"));
|
9
|
+
_chalk = function () {
|
10
|
+
return data;
|
11
|
+
};
|
12
|
+
return data;
|
13
|
+
}
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
15
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
17
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
18
|
+
const COMMAND_NAME = 'merge-bitmaps';
|
19
|
+
|
20
|
+
// - `%O`: ancestor’s version of the conflicting file
|
21
|
+
// - `%A`: current version of the conflicting file
|
22
|
+
// - `%B`: other branch's version of the conflicting file
|
23
|
+
|
24
|
+
class MergeBitmapsCmd {
|
25
|
+
// helpUrl = '';
|
26
|
+
|
27
|
+
constructor(git) {
|
28
|
+
this.git = git;
|
29
|
+
_defineProperty(this, "name", `${COMMAND_NAME} <ancestor> <current> <other>`);
|
30
|
+
_defineProperty(this, "alias", '');
|
31
|
+
_defineProperty(this, "description", `a special command to merge conflicting bitmap files during git merge`);
|
32
|
+
_defineProperty(this, "options", []);
|
33
|
+
_defineProperty(this, "group", 'workspace-tools');
|
34
|
+
_defineProperty(this, "commands", []);
|
35
|
+
_defineProperty(this, "private", true);
|
36
|
+
}
|
37
|
+
async report([ancestor, current, other]) {
|
38
|
+
const res = await this.git.mergeBitmaps(ancestor, current, other);
|
39
|
+
if (res) {
|
40
|
+
return _chalk().default.green('git merge driver was successfully set');
|
41
|
+
}
|
42
|
+
return _chalk().default.red('git merge driver was not set');
|
43
|
+
}
|
44
|
+
}
|
45
|
+
exports.MergeBitmapsCmd = MergeBitmapsCmd;
|
46
|
+
|
47
|
+
//# sourceMappingURL=merge-bitmaps.cmd.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","COMMAND_NAME","MergeBitmapsCmd","constructor","git","report","ancestor","current","other","res","mergeBitmaps","chalk","green","red","exports"],"sources":["merge-bitmaps.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { GitMain } from './git.main.runtime';\n\nconst COMMAND_NAME = 'merge-bitmaps';\n\n// - `%O`: ancestor’s version of the conflicting file\n// - `%A`: current version of the conflicting file\n// - `%B`: other branch's version of the conflicting file\n\nexport class MergeBitmapsCmd implements Command {\n name = `${COMMAND_NAME} <ancestor> <current> <other>`;\n alias = '';\n description = `a special command to merge conflicting bitmap files during git merge`;\n options = [] as CommandOptions;\n group = 'workspace-tools';\n commands: Command[] = [];\n private = true;\n // helpUrl = '';\n\n constructor(private git: GitMain) {}\n\n async report([ancestor, current, other]: string[]) {\n const res = await this.git.mergeBitmaps(ancestor, current, other);\n if (res) {\n return chalk.green('git merge driver was successfully set');\n }\n return chalk.red('git merge driver was not set');\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAA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A","ignoreList":[]}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { Command, CommandOptions } from '@teambit/cli';
|
2
|
+
import { GitMain } from './git.main.runtime';
|
3
|
+
type SetGitMergeDriverFlags = {
|
4
|
+
global?: boolean;
|
5
|
+
};
|
6
|
+
export declare class SetGitMergeDriverCmd implements Command {
|
7
|
+
private git;
|
8
|
+
name: string;
|
9
|
+
alias: string;
|
10
|
+
description: string;
|
11
|
+
options: CommandOptions;
|
12
|
+
group: string;
|
13
|
+
commands: Command[];
|
14
|
+
constructor(git: GitMain);
|
15
|
+
report(_args: any, flags: SetGitMergeDriverFlags): Promise<string>;
|
16
|
+
}
|
17
|
+
export {};
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.SetGitMergeDriverCmd = void 0;
|
7
|
+
function _chalk() {
|
8
|
+
const data = _interopRequireDefault(require("chalk"));
|
9
|
+
_chalk = function () {
|
10
|
+
return data;
|
11
|
+
};
|
12
|
+
return data;
|
13
|
+
}
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
15
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
17
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
18
|
+
const COMMAND_NAME = 'set-merge-driver';
|
19
|
+
class SetGitMergeDriverCmd {
|
20
|
+
// helpUrl = '';
|
21
|
+
|
22
|
+
constructor(git) {
|
23
|
+
this.git = git;
|
24
|
+
_defineProperty(this, "name", COMMAND_NAME);
|
25
|
+
_defineProperty(this, "alias", 'smd');
|
26
|
+
_defineProperty(this, "description", `setup bit's git merge driver for bitmap files`);
|
27
|
+
_defineProperty(this, "options", [['g', 'global', 'set the git merge driver globally']]);
|
28
|
+
_defineProperty(this, "group", 'workspace-tools');
|
29
|
+
_defineProperty(this, "commands", []);
|
30
|
+
}
|
31
|
+
async report(_args, flags) {
|
32
|
+
const res = await this.git.setGitMergeDriver(flags);
|
33
|
+
if (res) {
|
34
|
+
return _chalk().default.green('git merge driver was successfully set');
|
35
|
+
}
|
36
|
+
return _chalk().default.red('git merge driver was not set');
|
37
|
+
}
|
38
|
+
}
|
39
|
+
exports.SetGitMergeDriverCmd = SetGitMergeDriverCmd;
|
40
|
+
|
41
|
+
//# sourceMappingURL=set-git-merge-driver.cmd.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","COMMAND_NAME","SetGitMergeDriverCmd","constructor","git","report","_args","flags","res","setGitMergeDriver","chalk","green","red","exports"],"sources":["set-git-merge-driver.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { GitMain } from './git.main.runtime';\n\nconst COMMAND_NAME = 'set-merge-driver';\n\ntype SetGitMergeDriverFlags = {\n global?: boolean;\n};\n\nexport class SetGitMergeDriverCmd implements Command {\n name = COMMAND_NAME;\n alias = 'smd';\n description = `setup bit's git merge driver for bitmap files`;\n options = [['g', 'global', 'set the git merge driver globally']] as CommandOptions;\n group = 'workspace-tools';\n commands: Command[] = [];\n // helpUrl = '';\n\n constructor(private git: GitMain) {}\n\n async report(_args, flags: SetGitMergeDriverFlags) {\n const res = await this.git.setGitMergeDriver(flags);\n if (res) {\n return chalk.green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,+CAA+C;IAAAA,eAAA,kBACnD,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,mCAAmC,CAAC,CAAC;IAAAA,eAAA,gBACxD,iBAAiB;IAAAA,eAAA,mBACH,EAAE;EAGW;EAEnC,MAAMsB,MAAMA,CAACC,KAAK,EAAEC,KAA6B,EAAE;IACjD,MAAMC,GAAG,GAAG,MAAM,IAAI,CAACJ,GAAG,CAACK,iBAAiB,CAACF,KAAK,CAAC;IACnD,IAAIC,GAAG,EAAE;MACP,OAAOE,gBAAK,CAACC,KAAK,CAAC,uCAAuC,CAAC;IAC7D;IACA,OAAOD,gBAAK,CAACE,GAAG,CAAC,8BAA8B,CAAC;EAClD;AACF;AAACC,OAAA,CAAAX,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
package/esm.mjs
ADDED
package/package.json
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
{
|
2
|
+
"name": "@teambit/git",
|
3
|
+
"version": "0.0.0-03ba5ee5175a898e558c1938c18f396cdd131bb8",
|
4
|
+
"homepage": "https://bit.cloud/teambit/git/git",
|
5
|
+
"main": "dist/index.js",
|
6
|
+
"componentId": {
|
7
|
+
"scope": "teambit.git",
|
8
|
+
"name": "git",
|
9
|
+
"version": "03ba5ee5175a898e558c1938c18f396cdd131bb8"
|
10
|
+
},
|
11
|
+
"dependencies": {
|
12
|
+
"chalk": "4.1.2",
|
13
|
+
"@teambit/gitconfig": "2.0.10",
|
14
|
+
"fs-extra": "10.0.0",
|
15
|
+
"@teambit/harmony": "0.4.7",
|
16
|
+
"@teambit/bit-error": "0.0.404",
|
17
|
+
"@teambit/cli": "0.0.0-488f076a7c57433b94373d42c763e18868925950",
|
18
|
+
"@teambit/workspace": "0.0.0-9b5f524530acdb7ad5d7c060142c45e73f16da21"
|
19
|
+
},
|
20
|
+
"devDependencies": {
|
21
|
+
"@types/fs-extra": "9.0.7",
|
22
|
+
"@types/mocha": "9.1.0",
|
23
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.69"
|
24
|
+
},
|
25
|
+
"peerDependencies": {},
|
26
|
+
"license": "Apache-2.0",
|
27
|
+
"optionalDependencies": {},
|
28
|
+
"peerDependenciesMeta": {},
|
29
|
+
"exports": {
|
30
|
+
".": {
|
31
|
+
"node": {
|
32
|
+
"require": "./dist/index.js",
|
33
|
+
"import": "./dist/esm.mjs"
|
34
|
+
},
|
35
|
+
"default": "./dist/index.js"
|
36
|
+
},
|
37
|
+
"./dist/*": "./dist/*",
|
38
|
+
"./artifacts/*": "./artifacts/*",
|
39
|
+
"./*": "./*.ts"
|
40
|
+
},
|
41
|
+
"private": false,
|
42
|
+
"engines": {
|
43
|
+
"node": ">=16.0.0"
|
44
|
+
},
|
45
|
+
"repository": {
|
46
|
+
"type": "git",
|
47
|
+
"url": "https://github.com/teambit/bit"
|
48
|
+
},
|
49
|
+
"keywords": [
|
50
|
+
"bit",
|
51
|
+
"bit-aspect",
|
52
|
+
"bit-core-aspect",
|
53
|
+
"components",
|
54
|
+
"collaboration",
|
55
|
+
"web"
|
56
|
+
]
|
57
|
+
}
|
package/types/asset.d.ts
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
declare module '*.png' {
|
2
|
+
const value: any;
|
3
|
+
export = value;
|
4
|
+
}
|
5
|
+
declare module '*.svg' {
|
6
|
+
import type { FunctionComponent, SVGProps } from 'react';
|
7
|
+
|
8
|
+
export const ReactComponent: FunctionComponent<
|
9
|
+
SVGProps<SVGSVGElement> & { title?: string }
|
10
|
+
>;
|
11
|
+
const src: string;
|
12
|
+
export default src;
|
13
|
+
}
|
14
|
+
declare module '*.jpg' {
|
15
|
+
const value: any;
|
16
|
+
export = value;
|
17
|
+
}
|
18
|
+
declare module '*.jpeg' {
|
19
|
+
const value: any;
|
20
|
+
export = value;
|
21
|
+
}
|
22
|
+
declare module '*.gif' {
|
23
|
+
const value: any;
|
24
|
+
export = value;
|
25
|
+
}
|
26
|
+
declare module '*.bmp' {
|
27
|
+
const value: any;
|
28
|
+
export = value;
|
29
|
+
}
|
30
|
+
declare module '*.otf' {
|
31
|
+
const value: any;
|
32
|
+
export = value;
|
33
|
+
}
|
34
|
+
declare module '*.woff' {
|
35
|
+
const value: any;
|
36
|
+
export = value;
|
37
|
+
}
|
38
|
+
declare module '*.woff2' {
|
39
|
+
const value: any;
|
40
|
+
export = value;
|
41
|
+
}
|
package/types/style.d.ts
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
declare module '*.module.css' {
|
2
|
+
const classes: { readonly [key: string]: string };
|
3
|
+
export default classes;
|
4
|
+
}
|
5
|
+
declare module '*.module.scss' {
|
6
|
+
const classes: { readonly [key: string]: string };
|
7
|
+
export default classes;
|
8
|
+
}
|
9
|
+
declare module '*.module.sass' {
|
10
|
+
const classes: { readonly [key: string]: string };
|
11
|
+
export default classes;
|
12
|
+
}
|
13
|
+
|
14
|
+
declare module '*.module.less' {
|
15
|
+
const classes: { readonly [key: string]: string };
|
16
|
+
export default classes;
|
17
|
+
}
|
18
|
+
|
19
|
+
declare module '*.less' {
|
20
|
+
const classes: { readonly [key: string]: string };
|
21
|
+
export default classes;
|
22
|
+
}
|
23
|
+
|
24
|
+
declare module '*.css' {
|
25
|
+
const classes: { readonly [key: string]: string };
|
26
|
+
export default classes;
|
27
|
+
}
|
28
|
+
|
29
|
+
declare module '*.sass' {
|
30
|
+
const classes: { readonly [key: string]: string };
|
31
|
+
export default classes;
|
32
|
+
}
|
33
|
+
|
34
|
+
declare module '*.scss' {
|
35
|
+
const classes: { readonly [key: string]: string };
|
36
|
+
export default classes;
|
37
|
+
}
|
38
|
+
|
39
|
+
declare module '*.mdx' {
|
40
|
+
const component: any;
|
41
|
+
export default component;
|
42
|
+
}
|