@teambit/forking 0.0.1
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/fork.cmd.d.ts +20 -0
- package/dist/fork.cmd.js +58 -0
- package/dist/fork.cmd.js.map +1 -0
- package/dist/forking.aspect.d.ts +2 -0
- package/dist/forking.aspect.js +24 -0
- package/dist/forking.aspect.js.map +1 -0
- package/dist/forking.fragment.d.ts +16 -0
- package/dist/forking.fragment.js +49 -0
- package/dist/forking.fragment.js.map +1 -0
- package/dist/forking.main.runtime.d.ts +34 -0
- package/dist/forking.main.runtime.js +223 -0
- package/dist/forking.main.runtime.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/package-tar/teambit-forking-0.0.1.tgz +0 -0
- package/package.json +87 -0
- package/tsconfig.json +34 -0
- package/types/asset.d.ts +29 -0
- package/types/style.d.ts +42 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
+
import { ForkingMain } from '.';
|
|
3
|
+
export declare type ForkOptions = {
|
|
4
|
+
scope?: string;
|
|
5
|
+
path?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare class ForkCmd implements Command {
|
|
8
|
+
private forking;
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
group: string;
|
|
12
|
+
skipWorkspace: boolean;
|
|
13
|
+
alias: string;
|
|
14
|
+
options: CommandOptions;
|
|
15
|
+
loader: boolean;
|
|
16
|
+
migration: boolean;
|
|
17
|
+
remoteOp: boolean;
|
|
18
|
+
constructor(forking: ForkingMain);
|
|
19
|
+
report([sourceId, targetId]: [string, string], options: ForkOptions): Promise<string>;
|
|
20
|
+
}
|
package/dist/fork.cmd.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.array.iterator.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.promise.js");
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
exports.ForkCmd = void 0;
|
|
13
|
+
|
|
14
|
+
function _defineProperty2() {
|
|
15
|
+
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
|
|
17
|
+
_defineProperty2 = function () {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function _chalk() {
|
|
25
|
+
const data = _interopRequireDefault(require("chalk"));
|
|
26
|
+
|
|
27
|
+
_chalk = function () {
|
|
28
|
+
return data;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
class ForkCmd {
|
|
35
|
+
constructor(forking) {
|
|
36
|
+
this.forking = forking;
|
|
37
|
+
(0, _defineProperty2().default)(this, "name", 'fork <source-id> [target-id]');
|
|
38
|
+
(0, _defineProperty2().default)(this, "description", 'EXPERIMENTAL. create a new component out of an existing one');
|
|
39
|
+
(0, _defineProperty2().default)(this, "group", 'collaborate');
|
|
40
|
+
(0, _defineProperty2().default)(this, "skipWorkspace", true);
|
|
41
|
+
(0, _defineProperty2().default)(this, "alias", '');
|
|
42
|
+
(0, _defineProperty2().default)(this, "options", [['s', 'scope', 'default scope for the newly created component'], ['p', 'path <string>', 'relative path in the workspace. by default the path is `<scope>/<namespace>/<name>`']]);
|
|
43
|
+
(0, _defineProperty2().default)(this, "loader", true);
|
|
44
|
+
(0, _defineProperty2().default)(this, "migration", true);
|
|
45
|
+
(0, _defineProperty2().default)(this, "remoteOp", true);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async report([sourceId, targetId], options) {
|
|
49
|
+
const results = await this.forking.fork(sourceId, targetId, options);
|
|
50
|
+
const targetIdStr = results.toString();
|
|
51
|
+
return _chalk().default.green(`successfully forked ${_chalk().default.bold(targetIdStr)} from ${_chalk().default.bold(sourceId)}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
exports.ForkCmd = ForkCmd;
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=fork.cmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["fork.cmd.ts"],"names":["ForkCmd","constructor","forking","report","sourceId","targetId","options","results","fork","targetIdStr","toString","chalk","green","bold"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AASO,MAAMA,OAAN,CAAiC;AActCC,EAAAA,WAAW,CAASC,OAAT,EAA+B;AAAA,SAAtBA,OAAsB,GAAtBA,OAAsB;AAAA,kDAbnC,8BAamC;AAAA,yDAZ5B,6DAY4B;AAAA,mDAXlC,aAWkC;AAAA,2DAV1B,IAU0B;AAAA,mDATlC,EASkC;AAAA,qDARhC,CACR,CAAC,GAAD,EAAM,OAAN,EAAe,+CAAf,CADQ,EAER,CAAC,GAAD,EAAM,eAAN,EAAuB,qFAAvB,CAFQ,CAQgC;AAAA,oDAJjC,IAIiC;AAAA,uDAH9B,IAG8B;AAAA,sDAF/B,IAE+B;AAAE;;AAEhC,QAANC,MAAM,CAAC,CAACC,QAAD,EAAWC,QAAX,CAAD,EAAyCC,OAAzC,EAAgF;AAC1F,UAAMC,OAAO,GAAG,MAAM,KAAKL,OAAL,CAAaM,IAAb,CAAkBJ,QAAlB,EAA4BC,QAA5B,EAAsCC,OAAtC,CAAtB;AACA,UAAMG,WAAW,GAAGF,OAAO,CAACG,QAAR,EAApB;AACA,WAAOC,iBAAMC,KAAN,CAAa,uBAAsBD,iBAAME,IAAN,CAAWJ,WAAX,CAAwB,SAAQE,iBAAME,IAAN,CAAWT,QAAX,CAAqB,EAAxF,CAAP;AACD;;AApBqC","sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { ForkingMain } from '.';\n\nexport type ForkOptions = {\n scope?: string;\n path?: string;\n};\n\nexport class ForkCmd implements Command {\n name = 'fork <source-id> [target-id]';\n description = 'EXPERIMENTAL. create a new component out of an existing one';\n group = 'collaborate';\n skipWorkspace = true;\n alias = '';\n options = [\n ['s', 'scope', 'default scope for the newly created component'],\n ['p', 'path <string>', 'relative path in the workspace. by default the path is `<scope>/<namespace>/<name>`'],\n ] as CommandOptions;\n loader = true;\n migration = true;\n remoteOp = true;\n\n constructor(private forking: ForkingMain) {}\n\n async report([sourceId, targetId]: [string, string], options: ForkOptions): Promise<string> {\n const results = await this.forking.fork(sourceId, targetId, options);\n const targetIdStr = results.toString();\n return chalk.green(`successfully forked ${chalk.bold(targetIdStr)} from ${chalk.bold(sourceId)}`);\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ForkingAspect = void 0;
|
|
7
|
+
|
|
8
|
+
function _harmony() {
|
|
9
|
+
const data = require("@teambit/harmony");
|
|
10
|
+
|
|
11
|
+
_harmony = function () {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const ForkingAspect = _harmony().Aspect.create({
|
|
19
|
+
id: 'teambit.component/forking'
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
exports.ForkingAspect = ForkingAspect;
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=forking.aspect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["forking.aspect.ts"],"names":["ForkingAspect","Aspect","create","id"],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,aAAa,GAAGC,kBAAOC,MAAP,CAAc;AACzCC,EAAAA,EAAE,EAAE;AADqC,CAAd,CAAtB","sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const ForkingAspect = Aspect.create({\n id: 'teambit.component/forking',\n});\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Component, ShowFragment } from '@teambit/component';
|
|
2
|
+
import { ForkingMain } from './forking.main.runtime';
|
|
3
|
+
export declare class ForkingFragment implements ShowFragment {
|
|
4
|
+
private forking;
|
|
5
|
+
constructor(forking: ForkingMain);
|
|
6
|
+
title: string;
|
|
7
|
+
renderRow(component: Component): Promise<{
|
|
8
|
+
title: string;
|
|
9
|
+
content: string;
|
|
10
|
+
}>;
|
|
11
|
+
json(component: Component): Promise<{
|
|
12
|
+
title: string;
|
|
13
|
+
json: import("./forking.main.runtime").ForkInfo | null;
|
|
14
|
+
}>;
|
|
15
|
+
weight: number;
|
|
16
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.promise.js");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.ForkingFragment = void 0;
|
|
11
|
+
|
|
12
|
+
function _defineProperty2() {
|
|
13
|
+
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
+
|
|
15
|
+
_defineProperty2 = function () {
|
|
16
|
+
return data;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
class ForkingFragment {
|
|
23
|
+
constructor(forking) {
|
|
24
|
+
this.forking = forking;
|
|
25
|
+
(0, _defineProperty2().default)(this, "title", 'forking');
|
|
26
|
+
(0, _defineProperty2().default)(this, "weight", 3);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async renderRow(component) {
|
|
30
|
+
const forkingInfo = this.forking.getForkInfo(component);
|
|
31
|
+
const content = forkingInfo ? `origin: ${forkingInfo.forkedFrom.toString()}` : '';
|
|
32
|
+
return {
|
|
33
|
+
title: this.title,
|
|
34
|
+
content
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async json(component) {
|
|
39
|
+
return {
|
|
40
|
+
title: this.title,
|
|
41
|
+
json: this.forking.getForkInfo(component)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
exports.ForkingFragment = ForkingFragment;
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=forking.fragment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["forking.fragment.ts"],"names":["ForkingFragment","constructor","forking","renderRow","component","forkingInfo","getForkInfo","content","forkedFrom","toString","title","json"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGO,MAAMA,eAAN,CAA8C;AACnDC,EAAAA,WAAW,CAASC,OAAT,EAA+B;AAAA,SAAtBA,OAAsB,GAAtBA,OAAsB;AAAA,mDAElC,SAFkC;AAAA,oDAoBjC,CApBiC;AAAE;;AAI7B,QAATC,SAAS,CAACC,SAAD,EAAuB;AACpC,UAAMC,WAAW,GAAG,KAAKH,OAAL,CAAaI,WAAb,CAAyBF,SAAzB,CAApB;AACA,UAAMG,OAAO,GAAGF,WAAW,GAAI,WAAUA,WAAW,CAACG,UAAZ,CAAuBC,QAAvB,EAAkC,EAAhD,GAAoD,EAA/E;AACA,WAAO;AACLC,MAAAA,KAAK,EAAE,KAAKA,KADP;AAELH,MAAAA;AAFK,KAAP;AAID;;AAES,QAAJI,IAAI,CAACP,SAAD,EAAuB;AAC/B,WAAO;AACLM,MAAAA,KAAK,EAAE,KAAKA,KADP;AAELC,MAAAA,IAAI,EAAE,KAAKT,OAAL,CAAaI,WAAb,CAAyBF,SAAzB;AAFD,KAAP;AAID;;AAnBkD","sourcesContent":["import { Component, ShowFragment } from '@teambit/component';\nimport { ForkingMain } from './forking.main.runtime';\n\nexport class ForkingFragment implements ShowFragment {\n constructor(private forking: ForkingMain) {}\n\n title = 'forking';\n\n async renderRow(component: Component) {\n const forkingInfo = this.forking.getForkInfo(component);\n const content = forkingInfo ? `origin: ${forkingInfo.forkedFrom.toString()}` : '';\n return {\n title: this.title,\n content,\n };\n }\n\n async json(component: Component) {\n return {\n title: this.title,\n json: this.forking.getForkInfo(component),\n };\n }\n\n weight = 3;\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CLIMain } from '@teambit/cli';
|
|
2
|
+
import { DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
3
|
+
import { Workspace } from '@teambit/workspace';
|
|
4
|
+
import { Component, ComponentID, ComponentMain } from '@teambit/component';
|
|
5
|
+
import { ComponentIdObj } from '@teambit/component-id';
|
|
6
|
+
import { NewComponentHelperMain } from '@teambit/new-component-helper';
|
|
7
|
+
import { ForkOptions } from './fork.cmd';
|
|
8
|
+
export declare type ForkInfo = {
|
|
9
|
+
forkedFrom: ComponentID;
|
|
10
|
+
};
|
|
11
|
+
export declare class ForkingMain {
|
|
12
|
+
private workspace;
|
|
13
|
+
private dependencyResolver;
|
|
14
|
+
private newComponentHelper;
|
|
15
|
+
constructor(workspace: Workspace, dependencyResolver: DependencyResolverMain, newComponentHelper: NewComponentHelperMain);
|
|
16
|
+
fork(sourceIdStr: string, targetId?: string, options?: ForkOptions): Promise<ComponentID>;
|
|
17
|
+
getForkInfo(component: Component): ForkInfo | null;
|
|
18
|
+
private forkExistingInWorkspace;
|
|
19
|
+
private forkRemoteComponent;
|
|
20
|
+
private getConfig;
|
|
21
|
+
static slots: never[];
|
|
22
|
+
static dependencies: import("@teambit/harmony").Aspect[];
|
|
23
|
+
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
24
|
+
static provider([cli, workspace, dependencyResolver, componentMain, newComponentHelper]: [
|
|
25
|
+
CLIMain,
|
|
26
|
+
Workspace,
|
|
27
|
+
DependencyResolverMain,
|
|
28
|
+
ComponentMain,
|
|
29
|
+
NewComponentHelperMain
|
|
30
|
+
]): Promise<ForkingMain>;
|
|
31
|
+
}
|
|
32
|
+
export declare type ForkConfig = {
|
|
33
|
+
forkedFrom: ComponentIdObj;
|
|
34
|
+
};
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.array.iterator.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.promise.js");
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
exports.ForkingMain = void 0;
|
|
13
|
+
|
|
14
|
+
function _defineProperty2() {
|
|
15
|
+
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
|
|
17
|
+
_defineProperty2 = function () {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function _cli() {
|
|
25
|
+
const data = require("@teambit/cli");
|
|
26
|
+
|
|
27
|
+
_cli = function () {
|
|
28
|
+
return data;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function _dependencyResolver() {
|
|
35
|
+
const data = require("@teambit/dependency-resolver");
|
|
36
|
+
|
|
37
|
+
_dependencyResolver = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function _legacyBitId() {
|
|
45
|
+
const data = require("@teambit/legacy-bit-id");
|
|
46
|
+
|
|
47
|
+
_legacyBitId = function () {
|
|
48
|
+
return data;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return data;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function _workspace() {
|
|
55
|
+
const data = _interopRequireDefault(require("@teambit/workspace"));
|
|
56
|
+
|
|
57
|
+
_workspace = function () {
|
|
58
|
+
return data;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function _component() {
|
|
65
|
+
const data = _interopRequireWildcard(require("@teambit/component"));
|
|
66
|
+
|
|
67
|
+
_component = function () {
|
|
68
|
+
return data;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return data;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function _newComponentHelper() {
|
|
75
|
+
const data = _interopRequireDefault(require("@teambit/new-component-helper"));
|
|
76
|
+
|
|
77
|
+
_newComponentHelper = function () {
|
|
78
|
+
return data;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return data;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function _fork() {
|
|
85
|
+
const data = require("./fork.cmd");
|
|
86
|
+
|
|
87
|
+
_fork = function () {
|
|
88
|
+
return data;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return data;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function _forking() {
|
|
95
|
+
const data = require("./forking.aspect");
|
|
96
|
+
|
|
97
|
+
_forking = function () {
|
|
98
|
+
return data;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
return data;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function _forking2() {
|
|
105
|
+
const data = require("./forking.fragment");
|
|
106
|
+
|
|
107
|
+
_forking2 = function () {
|
|
108
|
+
return data;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return data;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
115
|
+
|
|
116
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
117
|
+
|
|
118
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
119
|
+
|
|
120
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
121
|
+
|
|
122
|
+
class ForkingMain {
|
|
123
|
+
constructor(workspace, dependencyResolver, newComponentHelper) {
|
|
124
|
+
this.workspace = workspace;
|
|
125
|
+
this.dependencyResolver = dependencyResolver;
|
|
126
|
+
this.newComponentHelper = newComponentHelper;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async fork(sourceIdStr, targetId, options) {
|
|
130
|
+
const sourceId = await this.workspace.resolveComponentId(sourceIdStr);
|
|
131
|
+
const existingInWorkspace = await this.workspace.getIfExist(sourceId);
|
|
132
|
+
|
|
133
|
+
if (existingInWorkspace) {
|
|
134
|
+
return this.forkExistingInWorkspace(existingInWorkspace, targetId, options);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const sourceIdWithScope = sourceId._legacy.scope ? sourceId : _component().ComponentID.fromLegacy(_legacyBitId().BitId.parse(sourceIdStr, true));
|
|
138
|
+
return this.forkRemoteComponent(sourceIdWithScope, targetId, options);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
getForkInfo(component) {
|
|
142
|
+
var _component$state$aspe;
|
|
143
|
+
|
|
144
|
+
const forkConfig = (_component$state$aspe = component.state.aspects.get(_forking().ForkingAspect.id)) === null || _component$state$aspe === void 0 ? void 0 : _component$state$aspe.config;
|
|
145
|
+
if (!forkConfig) return null;
|
|
146
|
+
return {
|
|
147
|
+
forkedFrom: _component().ComponentID.fromObject(forkConfig.forkedFrom)
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
async forkExistingInWorkspace(existing, targetId, options) {
|
|
152
|
+
if (!targetId) {
|
|
153
|
+
throw new Error(`error: unable to create "${existing.id.toStringWithoutVersion()}" component, a component with the same name already exists.
|
|
154
|
+
please specify the target-id arg`);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const targetCompId = this.newComponentHelper.getNewComponentId(targetId, undefined, options === null || options === void 0 ? void 0 : options.scope);
|
|
158
|
+
const targetPath = this.newComponentHelper.getNewComponentPath(targetCompId, options === null || options === void 0 ? void 0 : options.path);
|
|
159
|
+
const config = await this.getConfig(existing);
|
|
160
|
+
await this.newComponentHelper.writeAndAddNewComp(existing, targetPath, targetCompId, config);
|
|
161
|
+
return targetCompId;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async forkRemoteComponent(sourceId, targetId, options) {
|
|
165
|
+
const targetName = targetId || sourceId.fullName;
|
|
166
|
+
const targetCompId = this.newComponentHelper.getNewComponentId(targetName, undefined, options === null || options === void 0 ? void 0 : options.scope);
|
|
167
|
+
const targetPath = this.newComponentHelper.getNewComponentPath(targetCompId, options === null || options === void 0 ? void 0 : options.path);
|
|
168
|
+
const comp = await this.workspace.scope.getRemoteComponent(sourceId);
|
|
169
|
+
const deps = await this.dependencyResolver.getDependencies(comp); // only bring auto-resolved dependencies, others should be set in the workspace.jsonc template
|
|
170
|
+
|
|
171
|
+
const workspacePolicyEntries = deps.filter(dep => dep.source === 'auto').map(dep => {
|
|
172
|
+
var _dep$getPackageName;
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
dependencyId: ((_dep$getPackageName = dep.getPackageName) === null || _dep$getPackageName === void 0 ? void 0 : _dep$getPackageName.call(dep)) || dep.id,
|
|
176
|
+
lifecycleType: dep.lifecycle === 'dev' ? 'runtime' : dep.lifecycle,
|
|
177
|
+
value: {
|
|
178
|
+
version: dep.version
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
});
|
|
182
|
+
this.dependencyResolver.addToRootPolicy(workspacePolicyEntries, {
|
|
183
|
+
updateExisting: true
|
|
184
|
+
});
|
|
185
|
+
const config = await this.getConfig(comp);
|
|
186
|
+
await this.newComponentHelper.writeAndAddNewComp(comp, targetPath, targetCompId, config);
|
|
187
|
+
await this.dependencyResolver.persistConfig(this.workspace.path);
|
|
188
|
+
await this.workspace.install(undefined, {
|
|
189
|
+
dedupe: true,
|
|
190
|
+
import: false,
|
|
191
|
+
copyPeerToRuntimeOnRoot: true,
|
|
192
|
+
copyPeerToRuntimeOnComponents: false,
|
|
193
|
+
updateExisting: false
|
|
194
|
+
});
|
|
195
|
+
return targetCompId;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
async getConfig(comp) {
|
|
199
|
+
const fromExisting = await this.newComponentHelper.getConfigFromExistingToNewComponent(comp);
|
|
200
|
+
return _objectSpread(_objectSpread({}, fromExisting), {}, {
|
|
201
|
+
[_forking().ForkingAspect.id]: {
|
|
202
|
+
forkedFrom: comp.id.toObject()
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
static async provider([cli, workspace, dependencyResolver, componentMain, newComponentHelper]) {
|
|
208
|
+
const forkingMain = new ForkingMain(workspace, dependencyResolver, newComponentHelper);
|
|
209
|
+
cli.register(new (_fork().ForkCmd)(forkingMain));
|
|
210
|
+
componentMain.registerShowFragments([new (_forking2().ForkingFragment)(forkingMain)]);
|
|
211
|
+
return forkingMain;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
exports.ForkingMain = ForkingMain;
|
|
217
|
+
(0, _defineProperty2().default)(ForkingMain, "slots", []);
|
|
218
|
+
(0, _defineProperty2().default)(ForkingMain, "dependencies", [_cli().CLIAspect, _workspace().default, _dependencyResolver().DependencyResolverAspect, _component().default, _newComponentHelper().default]);
|
|
219
|
+
(0, _defineProperty2().default)(ForkingMain, "runtime", _cli().MainRuntime);
|
|
220
|
+
|
|
221
|
+
_forking().ForkingAspect.addRuntime(ForkingMain);
|
|
222
|
+
|
|
223
|
+
//# sourceMappingURL=forking.main.runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["forking.main.runtime.ts"],"names":["ForkingMain","constructor","workspace","dependencyResolver","newComponentHelper","fork","sourceIdStr","targetId","options","sourceId","resolveComponentId","existingInWorkspace","getIfExist","forkExistingInWorkspace","sourceIdWithScope","_legacy","scope","ComponentID","fromLegacy","BitId","parse","forkRemoteComponent","getForkInfo","component","forkConfig","state","aspects","get","ForkingAspect","id","config","forkedFrom","fromObject","existing","Error","toStringWithoutVersion","targetCompId","getNewComponentId","undefined","targetPath","getNewComponentPath","path","getConfig","writeAndAddNewComp","targetName","fullName","comp","getRemoteComponent","deps","getDependencies","workspacePolicyEntries","filter","dep","source","map","dependencyId","getPackageName","lifecycleType","lifecycle","value","version","addToRootPolicy","updateExisting","persistConfig","install","dedupe","import","copyPeerToRuntimeOnRoot","copyPeerToRuntimeOnComponents","fromExisting","getConfigFromExistingToNewComponent","toObject","provider","cli","componentMain","forkingMain","register","ForkCmd","registerShowFragments","ForkingFragment","CLIAspect","WorkspaceAspect","DependencyResolverAspect","ComponentAspect","NewComponentHelperAspect","MainRuntime","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;;AAMO,MAAMA,WAAN,CAAkB;AACvBC,EAAAA,WAAW,CACDC,SADC,EAEDC,kBAFC,EAGDC,kBAHC,EAIT;AAAA,SAHQF,SAGR,GAHQA,SAGR;AAAA,SAFQC,kBAER,GAFQA,kBAER;AAAA,SADQC,kBACR,GADQA,kBACR;AAAE;;AAEM,QAAJC,IAAI,CAACC,WAAD,EAAsBC,QAAtB,EAAyCC,OAAzC,EAAsF;AAC9F,UAAMC,QAAQ,GAAG,MAAM,KAAKP,SAAL,CAAeQ,kBAAf,CAAkCJ,WAAlC,CAAvB;AACA,UAAMK,mBAAmB,GAAG,MAAM,KAAKT,SAAL,CAAeU,UAA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AIC,eAAJ,EAAYF,WAAZ,CAAb;AACAD,IAAAA,aAAa,CAACI,qBAAd,CAAoC,CAAC,KAAIC,2BAAJ,EAAoBJ,WAApB,CAAD,CAApC;AACA,WAAOA,WAAP;AACD;;AArGsB;;;gCAAZ3E,W,WAiFI,E;gCAjFJA,W,kBAkFW,CACpBgF,gBADoB,EAEpBC,oBAFoB,EAGpBC,8CAHoB,EAIpBC,oBAJoB,EAKpBC,6BALoB,C;gCAlFXpF,W,aAyFMqF,kB;;AAenBzD,yBAAc0D,UAAd,CAAyBtF,WAAzB","sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport ComponentAspect, { Component, ComponentID, ComponentMain } from '@teambit/component';\nimport { ComponentIdObj } from '@teambit/component-id';\nimport NewComponentHelperAspect, { NewComponentHelperMain } from '@teambit/new-component-helper';\nimport { ForkCmd, ForkOptions } from './fork.cmd';\nimport { ForkingAspect } from './forking.aspect';\nimport { ForkingFragment } from './forking.fragment';\n\nexport type ForkInfo = {\n forkedFrom: ComponentID;\n};\n\nexport class ForkingMain {\n constructor(\n private workspace: Workspace,\n private dependencyResolver: DependencyResolverMain,\n private newComponentHelper: NewComponentHelperMain\n ) {}\n\n async fork(sourceIdStr: string, targetId?: string, options?: ForkOptions): Promise<ComponentID> {\n const sourceId = await this.workspace.resolveComponentId(sourceIdStr);\n const existingInWorkspace = await this.workspace.getIfExist(sourceId);\n if (existingInWorkspace) {\n return this.forkExistingInWorkspace(existingInWorkspace, targetId, options);\n }\n const sourceIdWithScope = sourceId._legacy.scope\n ? sourceId\n : ComponentID.fromLegacy(BitId.parse(sourceIdStr, true));\n return this.forkRemoteComponent(sourceIdWithScope, targetId, options);\n }\n\n getForkInfo(component: Component): ForkInfo | null {\n const forkConfig = component.state.aspects.get(ForkingAspect.id)?.config as ForkConfig | undefined;\n if (!forkConfig) return null;\n return {\n forkedFrom: ComponentID.fromObject(forkConfig.forkedFrom),\n };\n }\n\n private async forkExistingInWorkspace(existing: Component, targetId?: string, options?: ForkOptions) {\n if (!targetId) {\n throw new Error(`error: unable to create \"${existing.id.toStringWithoutVersion()}\" component, a component with the same name already exists.\nplease specify the target-id arg`);\n }\n const targetCompId = this.newComponentHelper.getNewComponentId(targetId, undefined, options?.scope);\n const targetPath = this.newComponentHelper.getNewComponentPath(targetCompId, options?.path);\n const config = await this.getConfig(existing);\n await this.newComponentHelper.writeAndAddNewComp(existing, targetPath, targetCompId, config);\n\n return targetCompId;\n }\n private async forkRemoteComponent(sourceId: ComponentID, targetId?: string, options?: ForkOptions) {\n const targetName = targetId || sourceId.fullName;\n const targetCompId = this.newComponentHelper.getNewComponentId(targetName, undefined, options?.scope);\n const targetPath = this.newComponentHelper.getNewComponentPath(targetCompId, options?.path);\n const comp = await this.workspace.scope.getRemoteComponent(sourceId);\n\n const deps = await this.dependencyResolver.getDependencies(comp);\n // only bring auto-resolved dependencies, others should be set in the workspace.jsonc template\n const workspacePolicyEntries = deps\n .filter((dep) => dep.source === 'auto')\n .map((dep) => ({\n dependencyId: dep.getPackageName?.() || dep.id,\n lifecycleType: dep.lifecycle === 'dev' ? 'runtime' : dep.lifecycle,\n value: {\n version: dep.version,\n },\n }));\n this.dependencyResolver.addToRootPolicy(workspacePolicyEntries, { updateExisting: true });\n const config = await this.getConfig(comp);\n await this.newComponentHelper.writeAndAddNewComp(comp, targetPath, targetCompId, config);\n await this.dependencyResolver.persistConfig(this.workspace.path);\n await this.workspace.install(undefined, {\n dedupe: true,\n import: false,\n copyPeerToRuntimeOnRoot: true,\n copyPeerToRuntimeOnComponents: false,\n updateExisting: false,\n });\n\n return targetCompId;\n }\n\n private async getConfig(comp: Component) {\n const fromExisting = await this.newComponentHelper.getConfigFromExistingToNewComponent(comp);\n return {\n ...fromExisting,\n [ForkingAspect.id]: {\n forkedFrom: comp.id.toObject(),\n },\n };\n }\n\n static slots = [];\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n DependencyResolverAspect,\n ComponentAspect,\n NewComponentHelperAspect,\n ];\n static runtime = MainRuntime;\n static async provider([cli, workspace, dependencyResolver, componentMain, newComponentHelper]: [\n CLIMain,\n Workspace,\n DependencyResolverMain,\n ComponentMain,\n NewComponentHelperMain\n ]) {\n const forkingMain = new ForkingMain(workspace, dependencyResolver, newComponentHelper);\n cli.register(new ForkCmd(forkingMain));\n componentMain.registerShowFragments([new ForkingFragment(forkingMain)]);\n return forkingMain;\n }\n}\n\nForkingAspect.addRuntime(ForkingMain);\n\nexport type ForkConfig = {\n forkedFrom: ComponentIdObj;\n};\n"]}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ForkingAspect", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _forking().ForkingAspect;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.default = void 0;
|
|
13
|
+
|
|
14
|
+
function _forking() {
|
|
15
|
+
const data = require("./forking.aspect");
|
|
16
|
+
|
|
17
|
+
_forking = function () {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var _default = _forking().ForkingAspect;
|
|
25
|
+
|
|
26
|
+
exports.default = _default;
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["ForkingAspect"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;eAGeA,wB","sourcesContent":["import { ForkingAspect } from './forking.aspect';\n\nexport type { ForkingMain } from './forking.main.runtime';\nexport default ForkingAspect;\nexport { ForkingAspect };\n"]}
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@teambit/forking",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"componentId": {
|
|
6
|
+
"scope": "teambit.component",
|
|
7
|
+
"name": "forking",
|
|
8
|
+
"version": "0.0.1"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"chalk": "2.4.2",
|
|
12
|
+
"@teambit/harmony": "0.2.11",
|
|
13
|
+
"@babel/runtime": "7.12.18",
|
|
14
|
+
"core-js": "^3.0.0",
|
|
15
|
+
"@teambit/cli": "0.0.410",
|
|
16
|
+
"@teambit/component": "0.0.597",
|
|
17
|
+
"@teambit/component-id": "0.0.398",
|
|
18
|
+
"@teambit/dependency-resolver": "0.0.597",
|
|
19
|
+
"@teambit/legacy-bit-id": "0.0.397",
|
|
20
|
+
"@teambit/new-component-helper": "0.0.1",
|
|
21
|
+
"@teambit/workspace": "0.0.597"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/mocha": "5.2.7",
|
|
25
|
+
"@types/testing-library__jest-dom": "5.9.5",
|
|
26
|
+
"@types/jest": "^26.0.0",
|
|
27
|
+
"@types/react-dom": "^17.0.5",
|
|
28
|
+
"@types/react": "^17.0.8",
|
|
29
|
+
"@types/node": "12.20.4"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@teambit/legacy": "1.0.197",
|
|
33
|
+
"react-dom": "^16.8.0 || ^17.0.0",
|
|
34
|
+
"react": "^16.8.0 || ^17.0.0"
|
|
35
|
+
},
|
|
36
|
+
"license": "Apache-2.0",
|
|
37
|
+
"bit": {
|
|
38
|
+
"bindingPrefix": "@teambit",
|
|
39
|
+
"env": {},
|
|
40
|
+
"overrides": {
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@teambit/legacy": "-",
|
|
43
|
+
"@babel/runtime": "7.12.18",
|
|
44
|
+
"core-js": "^3.0.0",
|
|
45
|
+
"react-dom": "-",
|
|
46
|
+
"react": "-"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@teambit/legacy": "-",
|
|
50
|
+
"@types/mocha": "5.2.7",
|
|
51
|
+
"@types/testing-library__jest-dom": "5.9.5",
|
|
52
|
+
"@types/jest": "^26.0.0",
|
|
53
|
+
"@types/react-dom": "^17.0.5",
|
|
54
|
+
"@types/react": "^17.0.8",
|
|
55
|
+
"@types/node": "12.20.4",
|
|
56
|
+
"react-dom": "-",
|
|
57
|
+
"react": "-"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"@teambit/legacy": "1.0.197",
|
|
61
|
+
"react-dom": "^16.8.0 || ^17.0.0",
|
|
62
|
+
"react": "^16.8.0 || ^17.0.0"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"private": false,
|
|
67
|
+
"engines": {
|
|
68
|
+
"node": ">=12.22.0"
|
|
69
|
+
},
|
|
70
|
+
"repository": {
|
|
71
|
+
"type": "git",
|
|
72
|
+
"url": "https://github.com/teambit/bit"
|
|
73
|
+
},
|
|
74
|
+
"keywords": [
|
|
75
|
+
"bit",
|
|
76
|
+
"bit-aspect",
|
|
77
|
+
"components",
|
|
78
|
+
"collaboration",
|
|
79
|
+
"web",
|
|
80
|
+
"react",
|
|
81
|
+
"react-components",
|
|
82
|
+
"angular",
|
|
83
|
+
"angular-components",
|
|
84
|
+
"vue",
|
|
85
|
+
"vue-components"
|
|
86
|
+
]
|
|
87
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": [
|
|
4
|
+
"es2019",
|
|
5
|
+
"DOM",
|
|
6
|
+
"ES6",
|
|
7
|
+
"DOM.Iterable",
|
|
8
|
+
"ScriptHost"
|
|
9
|
+
],
|
|
10
|
+
"target": "es2015",
|
|
11
|
+
"module": "commonjs",
|
|
12
|
+
"jsx": "react",
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"moduleResolution": "node",
|
|
17
|
+
"esModuleInterop": true,
|
|
18
|
+
"resolveJsonModule": true,
|
|
19
|
+
"composite": true,
|
|
20
|
+
"emitDeclarationOnly": true,
|
|
21
|
+
"outDir": "dist",
|
|
22
|
+
"experimentalDecorators": true,
|
|
23
|
+
"emitDecoratorMetadata": true,
|
|
24
|
+
"allowSyntheticDefaultImports": true,
|
|
25
|
+
"strictPropertyInitialization": false,
|
|
26
|
+
"strict": true,
|
|
27
|
+
"noImplicitAny": false,
|
|
28
|
+
"rootDir": ".",
|
|
29
|
+
"preserveConstEnums": true
|
|
30
|
+
},
|
|
31
|
+
"exclude": [
|
|
32
|
+
"dist"
|
|
33
|
+
]
|
|
34
|
+
}
|
package/types/asset.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
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<SVGProps<SVGSVGElement> & { title?: string }>;
|
|
9
|
+
const src: string;
|
|
10
|
+
export default src;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// @TODO Gilad
|
|
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
|
+
}
|
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
|
+
}
|