@teambit/deprecation 0.0.0-050a8296fce41c6a9e875e38a8dbb1102bf4e75f

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 (38) hide show
  1. package/deprecation.composition.tsx +7 -0
  2. package/deprecation.docs.mdx +4 -0
  3. package/deprecation.ui.runtime.tsx +24 -0
  4. package/dist/deprecate-cmd.d.ts +24 -0
  5. package/dist/deprecate-cmd.js +51 -0
  6. package/dist/deprecate-cmd.js.map +1 -0
  7. package/dist/deprecation.aspect.d.ts +3 -0
  8. package/dist/deprecation.aspect.js +21 -0
  9. package/dist/deprecation.aspect.js.map +1 -0
  10. package/dist/deprecation.composition.d.ts +1 -0
  11. package/dist/deprecation.composition.js +29 -0
  12. package/dist/deprecation.composition.js.map +1 -0
  13. package/dist/deprecation.docs.mdx +4 -0
  14. package/dist/deprecation.fragment.d.ts +16 -0
  15. package/dist/deprecation.fragment.js +35 -0
  16. package/dist/deprecation.fragment.js.map +1 -0
  17. package/dist/deprecation.graphql.d.ts +3 -0
  18. package/dist/deprecation.graphql.js +60 -0
  19. package/dist/deprecation.graphql.js.map +1 -0
  20. package/dist/deprecation.main.runtime.d.ts +65 -0
  21. package/dist/deprecation.main.runtime.js +232 -0
  22. package/dist/deprecation.main.runtime.js.map +1 -0
  23. package/dist/deprecation.ui.runtime.d.ts +6 -0
  24. package/dist/deprecation.ui.runtime.js +65 -0
  25. package/dist/deprecation.ui.runtime.js.map +1 -0
  26. package/dist/esm.d.mts +3 -0
  27. package/dist/esm.mjs +7 -0
  28. package/dist/index.d.ts +2 -0
  29. package/dist/index.js +26 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/preview-1754998460308.js +7 -0
  32. package/dist/undeprecate-cmd.d.ts +15 -0
  33. package/dist/undeprecate-cmd.js +40 -0
  34. package/dist/undeprecate-cmd.js.map +1 -0
  35. package/esm.mjs +7 -0
  36. package/package.json +72 -0
  37. package/types/asset.d.ts +41 -0
  38. package/types/style.d.ts +42 -0
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+
3
+ export const Logo = () => (
4
+ <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>
5
+ <img style={{ width: 70 }} src="https://static.bit.dev/extensions-icons/deprecation.svg" />
6
+ </div>
7
+ );
@@ -0,0 +1,4 @@
1
+ ---
2
+ description: 'Deprecate components in Scopes and Workspaces'
3
+ labels: ['core aspect', 'deprecation']
4
+ ---
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { UIRuntime } from '@teambit/ui';
3
+ import type { ComponentModel } from '@teambit/component';
4
+ import type { DocsUI } from '@teambit/docs';
5
+ import { DocsAspect } from '@teambit/docs';
6
+ import { ComponentDeprecated } from '@teambit/component.ui.component-deprecated';
7
+ import { DeprecationAspect } from './deprecation.aspect';
8
+
9
+ export class DeprecationUIRuntime {
10
+ static dependencies = [DocsAspect];
11
+
12
+ static runtime = UIRuntime;
13
+
14
+ static async provider([docsUI]: [DocsUI]) {
15
+ docsUI.registerTitleBadge({
16
+ component: function Badge({ legacyComponentModel }: { legacyComponentModel: ComponentModel }) {
17
+ return <ComponentDeprecated deprecation={legacyComponentModel.deprecation} />;
18
+ },
19
+ weight: 40,
20
+ });
21
+ }
22
+ }
23
+
24
+ DeprecationAspect.addRuntime(DeprecationUIRuntime);
@@ -0,0 +1,24 @@
1
+ import type { Command, CommandOptions } from '@teambit/cli';
2
+ import type { DeprecationMain } from './deprecation.main.runtime';
3
+ export declare class DeprecateCmd implements Command {
4
+ private deprecation;
5
+ name: string;
6
+ arguments: {
7
+ name: string;
8
+ description: string;
9
+ }[];
10
+ description: string;
11
+ group: string;
12
+ skipWorkspace: boolean;
13
+ alias: string;
14
+ options: CommandOptions;
15
+ loader: boolean;
16
+ remoteOp: boolean;
17
+ helpUrl: string;
18
+ constructor(deprecation: DeprecationMain);
19
+ report([id]: [string], { newId, range }: {
20
+ newId?: string;
21
+ range?: string;
22
+ }): Promise<string>;
23
+ private deprecate;
24
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DeprecateCmd = 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
+ class DeprecateCmd {
19
+ constructor(deprecation) {
20
+ this.deprecation = deprecation;
21
+ _defineProperty(this, "name", 'deprecate <component-name>');
22
+ _defineProperty(this, "arguments", [{
23
+ name: 'component-name',
24
+ description: 'component name or component id'
25
+ }]);
26
+ _defineProperty(this, "description", 'deprecate a component');
27
+ _defineProperty(this, "group", 'collaborate');
28
+ _defineProperty(this, "skipWorkspace", true);
29
+ _defineProperty(this, "alias", 'd');
30
+ _defineProperty(this, "options", [['', 'new-id <string>', 'if replaced by another component, enter the new component id. alternatively use "bit rename --deprecate" to do this automatically'], ['', 'range <string>', 'enter a Semver range to deprecate specific versions. see https://www.npmjs.com/package/semver#ranges for the range syntax']]);
31
+ _defineProperty(this, "loader", true);
32
+ _defineProperty(this, "remoteOp", true);
33
+ _defineProperty(this, "helpUrl", 'reference/components/removing-components');
34
+ }
35
+ async report([id], {
36
+ newId,
37
+ range
38
+ }) {
39
+ const result = await this.deprecate(id, newId, range);
40
+ if (result) {
41
+ return _chalk().default.green(`the component "${id}" has been deprecated successfully`);
42
+ }
43
+ return _chalk().default.bold(`the component "${id}" is already deprecated. no changes have been made`);
44
+ }
45
+ async deprecate(id, newId, range) {
46
+ return this.deprecation.deprecateByCLIValues(id, newId, range);
47
+ }
48
+ }
49
+ exports.DeprecateCmd = DeprecateCmd;
50
+
51
+ //# sourceMappingURL=deprecate-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","DeprecateCmd","constructor","deprecation","name","description","report","id","newId","range","result","deprecate","chalk","green","bold","deprecateByCLIValues","exports"],"sources":["deprecate-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { Command, CommandOptions } from '@teambit/cli';\nimport type { DeprecationMain } from './deprecation.main.runtime';\n\nexport class DeprecateCmd implements Command {\n name = 'deprecate <component-name>';\n arguments = [{ name: 'component-name', description: 'component name or component id' }];\n description = 'deprecate a component';\n group = 'collaborate';\n skipWorkspace = true;\n alias = 'd';\n options = [\n [\n '',\n 'new-id <string>',\n 'if replaced by another component, enter the new component id. alternatively use \"bit rename --deprecate\" to do this automatically',\n ],\n [\n '',\n 'range <string>',\n 'enter a Semver range to deprecate specific versions. see https://www.npmjs.com/package/semver#ranges for the range syntax',\n ],\n ] as CommandOptions;\n loader = true;\n remoteOp = true;\n helpUrl = 'reference/components/removing-components';\n\n constructor(private deprecation: DeprecationMain) {}\n\n async report([id]: [string], { newId, range }: { newId?: string; range?: string }): Promise<string> {\n const result = await this.deprecate(id, newId, range);\n if (result) {\n return chalk.green(`the component \"${id}\" has been deprecated successfully`);\n }\n return chalk.bold(`the component \"${id}\" is already deprecated. no changes have been made`);\n }\n\n private async deprecate(id: string, newId?: string, range?: string): Promise<boolean> {\n return this.deprecation.deprecateByCLIValues(id, newId, range);\n }\n}\n"],"mappings":";;;;;;AAAA,S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IAAAA,eAAA,wBACL,IAAI;IAAAA,eAAA,gBACZ,GAAG;IAAAA,eAAA,kBACD,CACR,CACE,EAAE,EACF,iBAAiB,EACjB,mIAAmI,CACpI,EACD,CACE,EAAE,EACF,gBAAgB,EAChB,2HAA2H,CAC5H,CACF;IAAAA,eAAA,iBACQ,IAAI;IAAAA,eAAA,mBACF,IAAI;IAAAA,eAAA,kBACL,0CAA0C;EAED;EAEnD,MAAMuB,MAAMA,CAAC,CAACC,EAAE,CAAW,EAAE;IAAEC,KAAK;IAAEC;EAA0C,CAAC,EAAmB;IAClG,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACC,SAAS,CAACJ,EAAE,EAAEC,KAAK,EAAEC,KAAK,CAAC;IACrD,IAAIC,MAAM,EAAE;MACV,OAAOE,gBAAK,CAACC,KAAK,CAAC,kBAAkBN,EAAE,oCAAoC,CAAC;IAC9E;IACA,OAAOK,gBAAK,CAACE,IAAI,CAAC,kBAAkBP,EAAE,oDAAoD,CAAC;EAC7F;EAEA,MAAcI,SAASA,CAACJ,EAAU,EAAEC,KAAc,EAAEC,KAAc,EAAoB;IACpF,OAAO,IAAI,CAACN,WAAW,CAACY,oBAAoB,CAACR,EAAE,EAAEC,KAAK,EAAEC,KAAK,CAAC;EAChE;AACF;AAACO,OAAA,CAAAf,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import { Aspect } from '@teambit/harmony';
2
+ export declare const DeprecationAspect: Aspect;
3
+ export default DeprecationAspect;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.DeprecationAspect = void 0;
7
+ function _harmony() {
8
+ const data = require("@teambit/harmony");
9
+ _harmony = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ const DeprecationAspect = exports.DeprecationAspect = _harmony().Aspect.create({
15
+ id: 'teambit.component/deprecation',
16
+ dependencies: [],
17
+ defaultConfig: {}
18
+ });
19
+ var _default = exports.default = DeprecationAspect;
20
+
21
+ //# sourceMappingURL=deprecation.aspect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_harmony","data","require","DeprecationAspect","exports","Aspect","create","id","dependencies","defaultConfig","_default","default"],"sources":["deprecation.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const DeprecationAspect = Aspect.create({\n id: 'teambit.component/deprecation',\n dependencies: [],\n defaultConfig: {},\n});\n\nexport default DeprecationAspect;\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAGE,iBAAM,CAACC,MAAM,CAAC;EAC7CC,EAAE,EAAE,+BAA+B;EACnCC,YAAY,EAAE,EAAE;EAChBC,aAAa,EAAE,CAAC;AAClB,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAN,OAAA,CAAAO,OAAA,GAEYR,iBAAiB","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare const Logo: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Logo = void 0;
7
+ function _react() {
8
+ const data = _interopRequireDefault(require("react"));
9
+ _react = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
16
+ style: {
17
+ height: '100%',
18
+ display: 'flex',
19
+ justifyContent: 'center'
20
+ }
21
+ }, /*#__PURE__*/_react().default.createElement("img", {
22
+ style: {
23
+ width: 70
24
+ },
25
+ src: "https://static.bit.dev/extensions-icons/deprecation.svg"
26
+ }));
27
+ exports.Logo = Logo;
28
+
29
+ //# sourceMappingURL=deprecation.composition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","data","_interopRequireDefault","require","e","__esModule","default","Logo","createElement","style","height","display","justifyContent","width","src","exports"],"sources":["deprecation.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/deprecation.svg\" />\n </div>\n);\n"],"mappings":";;;;;;AAAA,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;AAEnB,MAAMG,IAAI,GAAGA,CAAA,kBAClBP,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxEZ,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEI,KAAK,EAAE;EAAG,CAAE;EAACC,GAAG,EAAC;AAAyD,CAAE,CACvF,CACN;AAACC,OAAA,CAAAR,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ ---
2
+ description: 'Deprecate components in Scopes and Workspaces'
3
+ labels: ['core aspect', 'deprecation']
4
+ ---
@@ -0,0 +1,16 @@
1
+ import type { Component, ShowFragment } from '@teambit/component';
2
+ import type { DeprecationMain } from './deprecation.main.runtime';
3
+ export declare class DeprecationFragment implements ShowFragment {
4
+ private deprecation;
5
+ constructor(deprecation: DeprecationMain);
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("./deprecation.main.runtime").DeprecationInfo;
14
+ }>;
15
+ weight: number;
16
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DeprecationFragment = void 0;
7
+ 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; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
9
+ 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); }
10
+ class DeprecationFragment {
11
+ constructor(deprecation) {
12
+ this.deprecation = deprecation;
13
+ _defineProperty(this, "title", 'deprecated');
14
+ _defineProperty(this, "weight", 3);
15
+ }
16
+ async renderRow(component) {
17
+ const deprecationInfo = await this.deprecation.getDeprecationInfo(component);
18
+ const isDeprecate = deprecationInfo.isDeprecate.toString();
19
+ const newId = deprecationInfo.newId ? ` (new-id: ${deprecationInfo.newId})` : '';
20
+ const range = deprecationInfo.range ? ` (range: ${deprecationInfo.range})` : '';
21
+ return {
22
+ title: this.title,
23
+ content: isDeprecate + newId + range
24
+ };
25
+ }
26
+ async json(component) {
27
+ return {
28
+ title: this.title,
29
+ json: await this.deprecation.getDeprecationInfo(component)
30
+ };
31
+ }
32
+ }
33
+ exports.DeprecationFragment = DeprecationFragment;
34
+
35
+ //# sourceMappingURL=deprecation.fragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DeprecationFragment","constructor","deprecation","_defineProperty","renderRow","component","deprecationInfo","getDeprecationInfo","isDeprecate","toString","newId","range","title","content","json","exports"],"sources":["deprecation.fragment.ts"],"sourcesContent":["import type { Component, ShowFragment } from '@teambit/component';\nimport type { DeprecationMain } from './deprecation.main.runtime';\n\nexport class DeprecationFragment implements ShowFragment {\n constructor(private deprecation: DeprecationMain) {}\n\n title = 'deprecated';\n\n async renderRow(component: Component) {\n const deprecationInfo = await this.deprecation.getDeprecationInfo(component);\n const isDeprecate = deprecationInfo.isDeprecate.toString();\n const newId = deprecationInfo.newId ? ` (new-id: ${deprecationInfo.newId})` : '';\n const range = deprecationInfo.range ? ` (range: ${deprecationInfo.range})` : '';\n return {\n title: this.title,\n content: isDeprecate + newId + range,\n };\n }\n\n async json(component: Component) {\n return {\n title: this.title,\n json: await this.deprecation.getDeprecationInfo(component),\n };\n }\n\n weight = 3;\n}\n"],"mappings":";;;;;;;;;AAGO,MAAMA,mBAAmB,CAAyB;EACvDC,WAAWA,CAASC,WAA4B,EAAE;IAAA,KAA9BA,WAA4B,GAA5BA,WAA4B;IAAAC,eAAA,gBAExC,YAAY;IAAAA,eAAA,iBAoBX,CAAC;EAtByC;EAInD,MAAMC,SAASA,CAACC,SAAoB,EAAE;IACpC,MAAMC,eAAe,GAAG,MAAM,IAAI,CAACJ,WAAW,CAACK,kBAAkB,CAACF,SAAS,CAAC;IAC5E,MAAMG,WAAW,GAAGF,eAAe,CAACE,WAAW,CAACC,QAAQ,CAAC,CAAC;IAC1D,MAAMC,KAAK,GAAGJ,eAAe,CAACI,KAAK,GAAG,aAAaJ,eAAe,CAACI,KAAK,GAAG,GAAG,EAAE;IAChF,MAAMC,KAAK,GAAGL,eAAe,CAACK,KAAK,GAAG,YAAYL,eAAe,CAACK,KAAK,GAAG,GAAG,EAAE;IAC/E,OAAO;MACLC,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBC,OAAO,EAAEL,WAAW,GAAGE,KAAK,GAAGC;IACjC,CAAC;EACH;EAEA,MAAMG,IAAIA,CAACT,SAAoB,EAAE;IAC/B,OAAO;MACLO,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBE,IAAI,EAAE,MAAM,IAAI,CAACZ,WAAW,CAACK,kBAAkB,CAACF,SAAS;IAC3D,CAAC;EACH;AAGF;AAACU,OAAA,CAAAf,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import type { Schema } from '@teambit/graphql';
2
+ import type { DeprecationMain } from './deprecation.main.runtime';
3
+ export declare function deprecationSchema(deprecation: DeprecationMain): Schema;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.deprecationSchema = deprecationSchema;
7
+ function _graphqlTag() {
8
+ const data = require("graphql-tag");
9
+ _graphqlTag = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function deprecationSchema(deprecation) {
15
+ return {
16
+ typeDefs: (0, _graphqlTag().gql)`
17
+ extend type Component {
18
+ deprecation: DeprecationInfo
19
+ }
20
+
21
+ type DeprecationInfo {
22
+ isDeprecate: Boolean
23
+ newId: String
24
+ }
25
+
26
+ type DeprecationResult {
27
+ bitIds: [String]
28
+ missingComponents: [String]
29
+ }
30
+
31
+ type Mutation {
32
+ # deprecate components
33
+ deprecate(bitIds: [String!]!): DeprecationResult
34
+
35
+ # undo deprecate to components
36
+ undeprecate(bitIds: [String!]!): DeprecationResult
37
+ }
38
+ `,
39
+ resolvers: {
40
+ // Mutation: {
41
+ // deprecate: (req: any, { bitIds }: { bitIds: string[] }, context: { verb: string }) => {
42
+ // if (context.verb !== 'write') throw new Error('You are not authorized');
43
+ // return deprecation.deprecate(bitIds);
44
+ // },
45
+
46
+ // undeprecate: (req: any, { bitIds }: { bitIds: string[] }, context: { verb: string }) => {
47
+ // if (context.verb !== 'write') throw new Error('You are not authorized');
48
+ // return deprecation.unDeprecate(bitIds);
49
+ // },
50
+ // },
51
+ Component: {
52
+ deprecation: component => {
53
+ return deprecation.getDeprecationInfo(component);
54
+ }
55
+ }
56
+ }
57
+ };
58
+ }
59
+
60
+ //# sourceMappingURL=deprecation.graphql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_graphqlTag","data","require","deprecationSchema","deprecation","typeDefs","gql","resolvers","Component","component","getDeprecationInfo"],"sources":["deprecation.graphql.ts"],"sourcesContent":["import type { Component } from '@teambit/component';\nimport type { Schema } from '@teambit/graphql';\nimport { gql } from 'graphql-tag';\n\nimport type { DeprecationMain } from './deprecation.main.runtime';\n\nexport function deprecationSchema(deprecation: DeprecationMain): Schema {\n return {\n typeDefs: gql`\n extend type Component {\n deprecation: DeprecationInfo\n }\n\n type DeprecationInfo {\n isDeprecate: Boolean\n newId: String\n }\n\n type DeprecationResult {\n bitIds: [String]\n missingComponents: [String]\n }\n\n type Mutation {\n # deprecate components\n deprecate(bitIds: [String!]!): DeprecationResult\n\n # undo deprecate to components\n undeprecate(bitIds: [String!]!): DeprecationResult\n }\n `,\n resolvers: {\n // Mutation: {\n // deprecate: (req: any, { bitIds }: { bitIds: string[] }, context: { verb: string }) => {\n // if (context.verb !== 'write') throw new Error('You are not authorized');\n // return deprecation.deprecate(bitIds);\n // },\n\n // undeprecate: (req: any, { bitIds }: { bitIds: string[] }, context: { verb: string }) => {\n // if (context.verb !== 'write') throw new Error('You are not authorized');\n // return deprecation.unDeprecate(bitIds);\n // },\n // },\n Component: {\n deprecation: (component: Component) => {\n return deprecation.getDeprecationInfo(component);\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;AAEA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIO,SAASE,iBAAiBA,CAACC,WAA4B,EAAU;EACtE,OAAO;IACLC,QAAQ,EAAE,IAAAC,iBAAG;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;IACDC,SAAS,EAAE;MACT;MACA;MACA;MACA;MACA;;MAEA;MACA;MACA;MACA;MACA;MACAC,SAAS,EAAE;QACTJ,WAAW,EAAGK,SAAoB,IAAK;UACrC,OAAOL,WAAW,CAACM,kBAAkB,CAACD,SAAS,CAAC;QAClD;MACF;IACF;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,65 @@
1
+ import type { CLIMain } from '@teambit/cli';
2
+ import type { ComponentMain, Component } from '@teambit/component';
3
+ import { ComponentID } from '@teambit/component';
4
+ import type { ScopeMain } from '@teambit/scope';
5
+ import type { Workspace } from '@teambit/workspace';
6
+ import type { GraphqlMain } from '@teambit/graphql';
7
+ import type { ComponentIdObj } from '@teambit/component-id';
8
+ import type { IssuesMain } from '@teambit/issues';
9
+ import type { DependencyResolverMain } from '@teambit/dependency-resolver';
10
+ export type DeprecationInfo = {
11
+ isDeprecate: boolean;
12
+ newId?: string;
13
+ range?: string;
14
+ };
15
+ export type DeprecationMetadata = {
16
+ /**
17
+ * whether the head is deprecated
18
+ */
19
+ deprecate?: boolean;
20
+ /**
21
+ * the new id to use instead of the current one
22
+ */
23
+ newId?: ComponentIdObj;
24
+ /**
25
+ * Semver range to deprecate previous versions
26
+ */
27
+ range?: string;
28
+ };
29
+ export declare class DeprecationMain {
30
+ private scope;
31
+ private workspace;
32
+ private depsResolver;
33
+ constructor(scope: ScopeMain, workspace: Workspace, depsResolver: DependencyResolverMain);
34
+ getDeprecationInfo(component: Component): Promise<DeprecationInfo>;
35
+ private getHeadComponent;
36
+ /**
37
+ * mark a component as deprecated. after this change, the component will be modified.
38
+ * tag and export the component to have it deprecated on the remote.
39
+ *
40
+ * @param componentId
41
+ * @param newId
42
+ * @returns boolean whether or not the component has been deprecated
43
+ */
44
+ deprecate(componentId: ComponentID, newId?: ComponentID, range?: string): Promise<boolean>;
45
+ deprecateByCLIValues(id: string, newId?: string, range?: string): Promise<boolean>;
46
+ unDeprecateByCLIValues(id: string): Promise<boolean>;
47
+ unDeprecate(componentId: ComponentID): Promise<boolean>;
48
+ addDeprecatedDependenciesIssues(components: Component[]): Promise<void>;
49
+ private addDeprecatedDepIssue;
50
+ /**
51
+ * performant version of isDeprecated() in case the component object is not available and loading it is expensive.
52
+ */
53
+ private isDeprecatedByIdWithoutLoadingComponent;
54
+ static runtime: import("@teambit/harmony").RuntimeDefinition;
55
+ static dependencies: import("@teambit/harmony").Aspect[];
56
+ static provider([graphql, scope, componentAspect, workspace, cli, depsResolver, issues]: [
57
+ GraphqlMain,
58
+ ScopeMain,
59
+ ComponentMain,
60
+ Workspace,
61
+ CLIMain,
62
+ DependencyResolverMain,
63
+ IssuesMain
64
+ ]): Promise<DeprecationMain>;
65
+ }
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DeprecationMain = void 0;
7
+ function _cli() {
8
+ const data = require("@teambit/cli");
9
+ _cli = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _semver() {
15
+ const data = _interopRequireDefault(require("semver"));
16
+ _semver = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _component() {
22
+ const data = require("@teambit/component");
23
+ _component = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ function _scope() {
29
+ const data = require("@teambit/scope");
30
+ _scope = function () {
31
+ return data;
32
+ };
33
+ return data;
34
+ }
35
+ function _workspace() {
36
+ const data = require("@teambit/workspace");
37
+ _workspace = function () {
38
+ return data;
39
+ };
40
+ return data;
41
+ }
42
+ function _graphql() {
43
+ const data = require("@teambit/graphql");
44
+ _graphql = function () {
45
+ return data;
46
+ };
47
+ return data;
48
+ }
49
+ function _deprecation() {
50
+ const data = require("./deprecation.aspect");
51
+ _deprecation = function () {
52
+ return data;
53
+ };
54
+ return data;
55
+ }
56
+ function _deprecation2() {
57
+ const data = require("./deprecation.graphql");
58
+ _deprecation2 = function () {
59
+ return data;
60
+ };
61
+ return data;
62
+ }
63
+ function _deprecation3() {
64
+ const data = require("./deprecation.fragment");
65
+ _deprecation3 = function () {
66
+ return data;
67
+ };
68
+ return data;
69
+ }
70
+ function _deprecateCmd() {
71
+ const data = require("./deprecate-cmd");
72
+ _deprecateCmd = function () {
73
+ return data;
74
+ };
75
+ return data;
76
+ }
77
+ function _undeprecateCmd() {
78
+ const data = require("./undeprecate-cmd");
79
+ _undeprecateCmd = function () {
80
+ return data;
81
+ };
82
+ return data;
83
+ }
84
+ function _issues() {
85
+ const data = require("@teambit/issues");
86
+ _issues = function () {
87
+ return data;
88
+ };
89
+ return data;
90
+ }
91
+ function _pMapSeries() {
92
+ const data = _interopRequireDefault(require("p-map-series"));
93
+ _pMapSeries = function () {
94
+ return data;
95
+ };
96
+ return data;
97
+ }
98
+ function _dependencyResolver() {
99
+ const data = require("@teambit/dependency-resolver");
100
+ _dependencyResolver = function () {
101
+ return data;
102
+ };
103
+ return data;
104
+ }
105
+ function _lodash() {
106
+ const data = require("lodash");
107
+ _lodash = function () {
108
+ return data;
109
+ };
110
+ return data;
111
+ }
112
+ function _componentIssues() {
113
+ const data = require("@teambit/component-issues");
114
+ _componentIssues = function () {
115
+ return data;
116
+ };
117
+ return data;
118
+ }
119
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
120
+ 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; }
121
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
122
+ 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); }
123
+ class DeprecationMain {
124
+ constructor(scope, workspace, depsResolver) {
125
+ this.scope = scope;
126
+ this.workspace = workspace;
127
+ this.depsResolver = depsResolver;
128
+ }
129
+ async getDeprecationInfo(component) {
130
+ const headComponent = await this.getHeadComponent(component);
131
+ const data = headComponent.config.extensions.findExtension(_deprecation().DeprecationAspect.id)?.config;
132
+ const deprecatedBackwardCompatibility = component.state._consumer.deprecated;
133
+ const isDeprecate = Boolean(data?.deprecate || deprecatedBackwardCompatibility);
134
+ const currentTag = component.getTag();
135
+ const isDeprecateByRange = Boolean(data?.range && currentTag && _semver().default.satisfies(currentTag.version, data.range));
136
+ const newId = data?.newId ? _component().ComponentID.fromObject(data?.newId).toString() : undefined;
137
+ return {
138
+ isDeprecate: isDeprecate || isDeprecateByRange,
139
+ newId,
140
+ range: data?.range
141
+ };
142
+ }
143
+ async getHeadComponent(component) {
144
+ if (component.id.version && component.head && component.id.version !== component.head?.hash && component.id.version !== component.headTag?.version.version) {
145
+ const headComp = this.workspace // if workspace exits, prefer using the workspace as it may be modified
146
+ ? await this.workspace.get(component.id.changeVersion(undefined)) : await this.scope.get(component.id.changeVersion(component.head.hash));
147
+ if (!headComp) throw new Error(`unable to get the head of ${component.id.toString()}`);
148
+ return headComp;
149
+ }
150
+ return component;
151
+ }
152
+
153
+ /**
154
+ * mark a component as deprecated. after this change, the component will be modified.
155
+ * tag and export the component to have it deprecated on the remote.
156
+ *
157
+ * @param componentId
158
+ * @param newId
159
+ * @returns boolean whether or not the component has been deprecated
160
+ */
161
+ async deprecate(componentId, newId, range) {
162
+ const results = this.workspace.bitMap.addComponentConfig(componentId, _deprecation().DeprecationAspect.id, {
163
+ deprecate: !range,
164
+ newId: newId?.toObject(),
165
+ range
166
+ });
167
+ await this.workspace.bitMap.write(`deprecate ${componentId.toString()}`);
168
+ return results;
169
+ }
170
+ async deprecateByCLIValues(id, newId, range) {
171
+ const componentId = await this.workspace.resolveComponentId(id);
172
+ const newComponentId = newId ? await this.workspace.resolveComponentId(newId) : undefined;
173
+ return this.deprecate(componentId, newComponentId, range);
174
+ }
175
+ async unDeprecateByCLIValues(id) {
176
+ const componentId = await this.workspace.resolveComponentId(id);
177
+ return this.unDeprecate(componentId);
178
+ }
179
+ async unDeprecate(componentId) {
180
+ const results = this.workspace.bitMap.addComponentConfig(componentId, _deprecation().DeprecationAspect.id, {
181
+ deprecate: false,
182
+ newId: ''
183
+ });
184
+ await this.workspace.bitMap.write(`undeprecate ${componentId.toString()}`);
185
+ return results;
186
+ }
187
+ async addDeprecatedDependenciesIssues(components) {
188
+ await (0, _pMapSeries().default)(components, async component => {
189
+ await this.addDeprecatedDepIssue(component);
190
+ });
191
+ }
192
+ async addDeprecatedDepIssue(component) {
193
+ const dependencies = this.depsResolver.getComponentDependencies(component);
194
+ const removedWithUndefined = await Promise.all(dependencies.map(async dep => {
195
+ const isRemoved = await this.isDeprecatedByIdWithoutLoadingComponent(dep.componentId);
196
+ if (isRemoved) return dep.componentId;
197
+ return undefined;
198
+ }));
199
+ const removed = (0, _lodash().compact)(removedWithUndefined).map(id => id.toString());
200
+ if (removed.length) {
201
+ component.state.issues.getOrCreate(_componentIssues().IssuesClasses.DeprecatedDependencies).data = removed;
202
+ }
203
+ }
204
+
205
+ /**
206
+ * performant version of isDeprecated() in case the component object is not available and loading it is expensive.
207
+ */
208
+ async isDeprecatedByIdWithoutLoadingComponent(componentId) {
209
+ if (!componentId.hasVersion()) return false;
210
+ const bitmapEntry = this.workspace.bitMap.getBitmapEntryIfExist(componentId);
211
+ if (bitmapEntry && bitmapEntry.isDeprecated()) return true;
212
+ if (bitmapEntry && bitmapEntry.isUndeprecated()) return false;
213
+ const modelComp = await this.workspace.scope.getBitObjectModelComponent(componentId);
214
+ if (!modelComp) return false;
215
+ const isDeprecated = await modelComp.isDeprecated(this.workspace.scope.legacyScope.objects, componentId.version);
216
+ return Boolean(isDeprecated);
217
+ }
218
+ static async provider([graphql, scope, componentAspect, workspace, cli, depsResolver, issues]) {
219
+ const deprecation = new DeprecationMain(scope, workspace, depsResolver);
220
+ issues.registerAddComponentsIssues(deprecation.addDeprecatedDependenciesIssues.bind(deprecation));
221
+ cli.register(new (_deprecateCmd().DeprecateCmd)(deprecation), new (_undeprecateCmd().UndeprecateCmd)(deprecation));
222
+ componentAspect.registerShowFragments([new (_deprecation3().DeprecationFragment)(deprecation)]);
223
+ graphql.register(() => (0, _deprecation2().deprecationSchema)(deprecation));
224
+ return deprecation;
225
+ }
226
+ }
227
+ exports.DeprecationMain = DeprecationMain;
228
+ _defineProperty(DeprecationMain, "runtime", _cli().MainRuntime);
229
+ _defineProperty(DeprecationMain, "dependencies", [_graphql().GraphqlAspect, _scope().ScopeAspect, _component().ComponentAspect, _workspace().WorkspaceAspect, _cli().CLIAspect, _dependencyResolver().DependencyResolverAspect, _issues().IssuesAspect]);
230
+ _deprecation().DeprecationAspect.addRuntime(DeprecationMain);
231
+
232
+ //# sourceMappingURL=deprecation.main.runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_cli","data","require","_semver","_interopRequireDefault","_component","_scope","_workspace","_graphql","_deprecation","_deprecation2","_deprecation3","_deprecateCmd","_undeprecateCmd","_issues","_pMapSeries","_dependencyResolver","_lodash","_componentIssues","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DeprecationMain","constructor","scope","workspace","depsResolver","getDeprecationInfo","component","headComponent","getHeadComponent","config","extensions","findExtension","DeprecationAspect","id","deprecatedBackwardCompatibility","state","_consumer","deprecated","isDeprecate","Boolean","deprecate","currentTag","getTag","isDeprecateByRange","range","semver","satisfies","version","newId","ComponentID","fromObject","toString","undefined","head","hash","headTag","headComp","get","changeVersion","Error","componentId","results","bitMap","addComponentConfig","toObject","write","deprecateByCLIValues","resolveComponentId","newComponentId","unDeprecateByCLIValues","unDeprecate","addDeprecatedDependenciesIssues","components","pMapSeries","addDeprecatedDepIssue","dependencies","getComponentDependencies","removedWithUndefined","Promise","all","map","dep","isRemoved","isDeprecatedByIdWithoutLoadingComponent","removed","compact","length","issues","getOrCreate","IssuesClasses","DeprecatedDependencies","hasVersion","bitmapEntry","getBitmapEntryIfExist","isDeprecated","isUndeprecated","modelComp","getBitObjectModelComponent","legacyScope","objects","provider","graphql","componentAspect","cli","deprecation","registerAddComponentsIssues","bind","register","DeprecateCmd","UndeprecateCmd","registerShowFragments","DeprecationFragment","deprecationSchema","exports","MainRuntime","GraphqlAspect","ScopeAspect","ComponentAspect","WorkspaceAspect","CLIAspect","DependencyResolverAspect","IssuesAspect","addRuntime"],"sources":["deprecation.main.runtime.ts"],"sourcesContent":["import type { CLIMain } from '@teambit/cli';\nimport { CLIAspect, MainRuntime } from '@teambit/cli';\nimport semver from 'semver';\nimport type { ComponentMain, Component } from '@teambit/component';\nimport { ComponentAspect, ComponentID } from '@teambit/component';\nimport type { ScopeMain } from '@teambit/scope';\nimport { ScopeAspect } from '@teambit/scope';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport type { GraphqlMain } from '@teambit/graphql';\nimport { GraphqlAspect } from '@teambit/graphql';\nimport type { ComponentIdObj } from '@teambit/component-id';\nimport { DeprecationAspect } from './deprecation.aspect';\nimport { deprecationSchema } from './deprecation.graphql';\nimport { DeprecationFragment } from './deprecation.fragment';\nimport { DeprecateCmd } from './deprecate-cmd';\nimport { UndeprecateCmd } from './undeprecate-cmd';\nimport type { IssuesMain } from '@teambit/issues';\nimport { IssuesAspect } from '@teambit/issues';\nimport pMapSeries from 'p-map-series';\nimport type { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport { compact } from 'lodash';\nimport { IssuesClasses } from '@teambit/component-issues';\n\nexport type DeprecationInfo = {\n isDeprecate: boolean;\n newId?: string;\n range?: string;\n};\n\nexport type DeprecationMetadata = {\n /**\n * whether the head is deprecated\n */\n deprecate?: boolean;\n /**\n * the new id to use instead of the current one\n */\n newId?: ComponentIdObj;\n /**\n * Semver range to deprecate previous versions\n */\n range?: string;\n};\n\nexport class DeprecationMain {\n constructor(\n private scope: ScopeMain,\n private workspace: Workspace,\n private depsResolver: DependencyResolverMain\n ) {}\n\n async getDeprecationInfo(component: Component): Promise<DeprecationInfo> {\n const headComponent = await this.getHeadComponent(component);\n\n const data = headComponent.config.extensions.findExtension(DeprecationAspect.id)?.config as\n | DeprecationMetadata\n | undefined;\n const deprecatedBackwardCompatibility = component.state._consumer.deprecated;\n const isDeprecate = Boolean(data?.deprecate || deprecatedBackwardCompatibility);\n const currentTag = component.getTag();\n const isDeprecateByRange = Boolean(data?.range && currentTag && semver.satisfies(currentTag.version, data.range));\n const newId = data?.newId ? ComponentID.fromObject(data?.newId).toString() : undefined;\n return {\n isDeprecate: isDeprecate || isDeprecateByRange,\n newId,\n range: data?.range,\n };\n }\n\n private async getHeadComponent(component: Component): Promise<Component> {\n if (\n component.id.version &&\n component.head &&\n component.id.version !== component.head?.hash &&\n component.id.version !== component.headTag?.version.version\n ) {\n const headComp = this.workspace // if workspace exits, prefer using the workspace as it may be modified\n ? await this.workspace.get(component.id.changeVersion(undefined))\n : await this.scope.get(component.id.changeVersion(component.head.hash));\n if (!headComp) throw new Error(`unable to get the head of ${component.id.toString()}`);\n return headComp;\n }\n return component;\n }\n\n /**\n * mark a component as deprecated. after this change, the component will be modified.\n * tag and export the component to have it deprecated on the remote.\n *\n * @param componentId\n * @param newId\n * @returns boolean whether or not the component has been deprecated\n */\n async deprecate(componentId: ComponentID, newId?: ComponentID, range?: string): Promise<boolean> {\n const results = this.workspace.bitMap.addComponentConfig(componentId, DeprecationAspect.id, {\n deprecate: !range,\n newId: newId?.toObject(),\n range,\n });\n await this.workspace.bitMap.write(`deprecate ${componentId.toString()}`);\n\n return results;\n }\n\n async deprecateByCLIValues(id: string, newId?: string, range?: string): Promise<boolean> {\n const componentId = await this.workspace.resolveComponentId(id);\n const newComponentId = newId ? await this.workspace.resolveComponentId(newId) : undefined;\n return this.deprecate(componentId, newComponentId, range);\n }\n\n async unDeprecateByCLIValues(id: string): Promise<boolean> {\n const componentId = await this.workspace.resolveComponentId(id);\n return this.unDeprecate(componentId);\n }\n\n async unDeprecate(componentId: ComponentID) {\n const results = this.workspace.bitMap.addComponentConfig(componentId, DeprecationAspect.id, {\n deprecate: false,\n newId: '',\n });\n await this.workspace.bitMap.write(`undeprecate ${componentId.toString()}`);\n\n return results;\n }\n\n async addDeprecatedDependenciesIssues(components: Component[]) {\n await pMapSeries(components, async (component) => {\n await this.addDeprecatedDepIssue(component);\n });\n }\n\n private async addDeprecatedDepIssue(component: Component) {\n const dependencies = this.depsResolver.getComponentDependencies(component);\n const removedWithUndefined = await Promise.all(\n dependencies.map(async (dep) => {\n const isRemoved = await this.isDeprecatedByIdWithoutLoadingComponent(dep.componentId);\n if (isRemoved) return dep.componentId;\n return undefined;\n })\n );\n const removed = compact(removedWithUndefined).map((id) => id.toString());\n if (removed.length) {\n component.state.issues.getOrCreate(IssuesClasses.DeprecatedDependencies).data = removed;\n }\n }\n\n /**\n * performant version of isDeprecated() in case the component object is not available and loading it is expensive.\n */\n private async isDeprecatedByIdWithoutLoadingComponent(componentId: ComponentID): Promise<boolean> {\n if (!componentId.hasVersion()) return false;\n const bitmapEntry = this.workspace.bitMap.getBitmapEntryIfExist(componentId);\n if (bitmapEntry && bitmapEntry.isDeprecated()) return true;\n if (bitmapEntry && bitmapEntry.isUndeprecated()) return false;\n const modelComp = await this.workspace.scope.getBitObjectModelComponent(componentId);\n if (!modelComp) return false;\n const isDeprecated = await modelComp.isDeprecated(\n this.workspace.scope.legacyScope.objects,\n componentId.version as string\n );\n return Boolean(isDeprecated);\n }\n\n static runtime = MainRuntime;\n static dependencies = [\n GraphqlAspect,\n ScopeAspect,\n ComponentAspect,\n WorkspaceAspect,\n CLIAspect,\n DependencyResolverAspect,\n IssuesAspect,\n ];\n static async provider([graphql, scope, componentAspect, workspace, cli, depsResolver, issues]: [\n GraphqlMain,\n ScopeMain,\n ComponentMain,\n Workspace,\n CLIMain,\n DependencyResolverMain,\n IssuesMain,\n ]) {\n const deprecation = new DeprecationMain(scope, workspace, depsResolver);\n issues.registerAddComponentsIssues(deprecation.addDeprecatedDependenciesIssues.bind(deprecation));\n cli.register(new DeprecateCmd(deprecation), new UndeprecateCmd(deprecation));\n componentAspect.registerShowFragments([new DeprecationFragment(deprecation)]);\n graphql.register(() => deprecationSchema(deprecation));\n\n return deprecation;\n }\n}\n\nDeprecationAspect.addRuntime(DeprecationMain);\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,OAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,MAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAQ,aAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,YAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,cAAA;EAAA,MAAAT,IAAA,GAA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AAW,CAAC,CAAC;IAEtD,OAAOA,WAAW;EACpB;AACF;AAACS,OAAA,CAAA7F,eAAA,GAAAA,eAAA;AAAAlB,eAAA,CAlJYkB,eAAe,aAuHT8F,kBAAW;AAAAhH,eAAA,CAvHjBkB,eAAe,kBAwHJ,CACpB+F,wBAAa,EACbC,oBAAW,EACXC,4BAAe,EACfC,4BAAe,EACfC,gBAAS,EACTC,8CAAwB,EACxBC,sBAAY,CACb;AAoBHzF,gCAAiB,CAAC0F,UAAU,CAACtG,eAAe,CAAC","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ import type { DocsUI } from '@teambit/docs';
2
+ export declare class DeprecationUIRuntime {
3
+ static dependencies: import("@teambit/harmony").Aspect[];
4
+ static runtime: import("@teambit/harmony").RuntimeDefinition;
5
+ static provider([docsUI]: [DocsUI]): Promise<void>;
6
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DeprecationUIRuntime = void 0;
7
+ function _react() {
8
+ const data = _interopRequireDefault(require("react"));
9
+ _react = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _ui() {
15
+ const data = require("@teambit/ui");
16
+ _ui = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _docs() {
22
+ const data = require("@teambit/docs");
23
+ _docs = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ function _componentUi() {
29
+ const data = require("@teambit/component.ui.component-deprecated");
30
+ _componentUi = function () {
31
+ return data;
32
+ };
33
+ return data;
34
+ }
35
+ function _deprecation() {
36
+ const data = require("./deprecation.aspect");
37
+ _deprecation = function () {
38
+ return data;
39
+ };
40
+ return data;
41
+ }
42
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
43
+ 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; }
44
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
45
+ 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); }
46
+ class DeprecationUIRuntime {
47
+ static async provider([docsUI]) {
48
+ docsUI.registerTitleBadge({
49
+ component: function Badge({
50
+ legacyComponentModel
51
+ }) {
52
+ return /*#__PURE__*/_react().default.createElement(_componentUi().ComponentDeprecated, {
53
+ deprecation: legacyComponentModel.deprecation
54
+ });
55
+ },
56
+ weight: 40
57
+ });
58
+ }
59
+ }
60
+ exports.DeprecationUIRuntime = DeprecationUIRuntime;
61
+ _defineProperty(DeprecationUIRuntime, "dependencies", [_docs().DocsAspect]);
62
+ _defineProperty(DeprecationUIRuntime, "runtime", _ui().UIRuntime);
63
+ _deprecation().DeprecationAspect.addRuntime(DeprecationUIRuntime);
64
+
65
+ //# sourceMappingURL=deprecation.ui.runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","data","_interopRequireDefault","require","_ui","_docs","_componentUi","_deprecation","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DeprecationUIRuntime","provider","docsUI","registerTitleBadge","component","Badge","legacyComponentModel","createElement","ComponentDeprecated","deprecation","weight","exports","DocsAspect","UIRuntime","DeprecationAspect","addRuntime"],"sources":["deprecation.ui.runtime.tsx"],"sourcesContent":["import React from 'react';\nimport { UIRuntime } from '@teambit/ui';\nimport type { ComponentModel } from '@teambit/component';\nimport type { DocsUI } from '@teambit/docs';\nimport { DocsAspect } from '@teambit/docs';\nimport { ComponentDeprecated } from '@teambit/component.ui.component-deprecated';\nimport { DeprecationAspect } from './deprecation.aspect';\n\nexport class DeprecationUIRuntime {\n static dependencies = [DocsAspect];\n\n static runtime = UIRuntime;\n\n static async provider([docsUI]: [DocsUI]) {\n docsUI.registerTitleBadge({\n component: function Badge({ legacyComponentModel }: { legacyComponentModel: ComponentModel }) {\n return <ComponentDeprecated deprecation={legacyComponentModel.deprecation} />;\n },\n weight: 40,\n });\n }\n}\n\nDeprecationAspect.addRuntime(DeprecationUIRuntime);\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,IAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,GAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,aAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,YAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,aAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,YAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyD,SAAAC,uBAAAM,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,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAElD,MAAMgB,oBAAoB,CAAC;EAKhC,aAAaC,QAAQA,CAAC,CAACC,MAAM,CAAW,EAAE;IACxCA,MAAM,CAACC,kBAAkB,CAAC;MACxBC,SAAS,EAAE,SAASC,KAAKA,CAAC;QAAEC;MAA+D,CAAC,EAAE;QAC5F,oBAAOnC,MAAA,GAAAU,OAAA,CAAA0B,aAAA,CAAC9B,YAAA,GAAA+B,mBAAmB;UAACC,WAAW,EAAEH,oBAAoB,CAACG;QAAY,CAAE,CAAC;MAC/E,CAAC;MACDC,MAAM,EAAE;IACV,CAAC,CAAC;EACJ;AACF;AAACC,OAAA,CAAAX,oBAAA,GAAAA,oBAAA;AAAAlB,eAAA,CAbYkB,oBAAoB,kBACT,CAACY,kBAAU,CAAC;AAAA9B,eAAA,CADvBkB,oBAAoB,aAGda,eAAS;AAY5BC,gCAAiB,CAACC,UAAU,CAACf,oBAAoB,CAAC","ignoreList":[]}
package/dist/esm.d.mts ADDED
@@ -0,0 +1,3 @@
1
+ export const DeprecationAspect: any;
2
+ export default cjsModule;
3
+ import cjsModule from './index.js';
package/dist/esm.mjs ADDED
@@ -0,0 +1,7 @@
1
+ // eslint-disable-next-line import/no-unresolved
2
+ import cjsModule from './index.js';
3
+
4
+ export const DeprecationAspect = cjsModule.DeprecationAspect;
5
+
6
+ export default cjsModule;
7
+
@@ -0,0 +1,2 @@
1
+ export type { DeprecationMain, DeprecationInfo, DeprecationMetadata } from './deprecation.main.runtime';
2
+ export { DeprecationAspect, DeprecationAspect as default } from './deprecation.aspect';
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "DeprecationAspect", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _deprecation().DeprecationAspect;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "default", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _deprecation().DeprecationAspect;
16
+ }
17
+ });
18
+ function _deprecation() {
19
+ const data = require("./deprecation.aspect");
20
+ _deprecation = function () {
21
+ return data;
22
+ };
23
+ return data;
24
+ }
25
+
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_deprecation","data","require"],"sources":["index.ts"],"sourcesContent":["export type { DeprecationMain, DeprecationInfo, DeprecationMetadata } from './deprecation.main.runtime';\nexport { DeprecationAspect, DeprecationAspect as default } from './deprecation.aspect';\n"],"mappings":";;;;;;;;;;;;;;;;;AACA,SAAAA,aAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,YAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_deprecation@050a8296fce41c6a9e875e38a8dbb1102bf4e75f/dist/deprecation.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_deprecation@050a8296fce41c6a9e875e38a8dbb1102bf4e75f/dist/deprecation.docs.mdx';
3
+
4
+ export const compositions = [compositions_0];
5
+ export const overview = [overview_0];
6
+
7
+ export const compositions_metadata = {"compositions":[{"displayName":"Logo","identifier":"Logo"}]};
@@ -0,0 +1,15 @@
1
+ import type { Command, CommandOptions } from '@teambit/cli';
2
+ import type { DeprecationMain } from './deprecation.main.runtime';
3
+ export declare class UndeprecateCmd implements Command {
4
+ private deprecation;
5
+ name: string;
6
+ group: string;
7
+ description: string;
8
+ alias: string;
9
+ options: CommandOptions;
10
+ loader: boolean;
11
+ skipWorkspace: boolean;
12
+ remoteOp: boolean;
13
+ constructor(deprecation: DeprecationMain);
14
+ report([id]: [string]): Promise<string>;
15
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.UndeprecateCmd = 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
+ class UndeprecateCmd {
19
+ constructor(deprecation) {
20
+ this.deprecation = deprecation;
21
+ _defineProperty(this, "name", 'undeprecate <id>');
22
+ _defineProperty(this, "group", 'collaborate');
23
+ _defineProperty(this, "description", 'undeprecate a deprecated component (local/remote)');
24
+ _defineProperty(this, "alias", '');
25
+ _defineProperty(this, "options", []);
26
+ _defineProperty(this, "loader", true);
27
+ _defineProperty(this, "skipWorkspace", true);
28
+ _defineProperty(this, "remoteOp", true);
29
+ }
30
+ async report([id]) {
31
+ const result = await this.deprecation.unDeprecateByCLIValues(id);
32
+ if (result) {
33
+ return _chalk().default.green(`the component "${id}" has been undeprecated successfully`);
34
+ }
35
+ return _chalk().default.bold(`the component "${id}" is not currently deprecated. no changes have been made`);
36
+ }
37
+ }
38
+ exports.UndeprecateCmd = UndeprecateCmd;
39
+
40
+ //# sourceMappingURL=undeprecate-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","UndeprecateCmd","constructor","deprecation","report","id","result","unDeprecateByCLIValues","chalk","green","bold","exports"],"sources":["undeprecate-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { Command, CommandOptions } from '@teambit/cli';\nimport type { DeprecationMain } from './deprecation.main.runtime';\n\nexport class UndeprecateCmd implements Command {\n name = 'undeprecate <id>';\n group = 'collaborate';\n description = 'undeprecate a deprecated component (local/remote)';\n alias = '';\n options = [] as CommandOptions;\n loader = true;\n skipWorkspace = true;\n remoteOp = true;\n\n constructor(private deprecation: DeprecationMain) {}\n\n async report([id]: [string]): Promise<string> {\n const result = await this.deprecation.unDeprecateByCLIValues(id);\n if (result) {\n return chalk.green(`the component \"${id}\" has been undeprecated successfully`);\n }\n return chalk.bold(`the component \"${id}\" is not currently deprecated. no changes have been made`);\n }\n}\n"],"mappings":";;;;;;AAAA,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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AC,kBAAkBJ,EAAE,sCAAsC,CAAC;IAChF;IACA,OAAOG,gBAAK,CAACE,IAAI,CAAC,kBAAkBL,EAAE,0DAA0D,CAAC;EACnG;AACF;AAACM,OAAA,CAAAV,cAAA,GAAAA,cAAA","ignoreList":[]}
package/esm.mjs ADDED
@@ -0,0 +1,7 @@
1
+ // eslint-disable-next-line import/no-unresolved
2
+ import cjsModule from './index.js';
3
+
4
+ export const DeprecationAspect = cjsModule.DeprecationAspect;
5
+
6
+ export default cjsModule;
7
+
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@teambit/deprecation",
3
+ "version": "0.0.0-050a8296fce41c6a9e875e38a8dbb1102bf4e75f",
4
+ "homepage": "https://bit.cloud/teambit/component/deprecation",
5
+ "main": "dist/index.js",
6
+ "componentId": {
7
+ "scope": "teambit.component",
8
+ "name": "deprecation",
9
+ "version": "050a8296fce41c6a9e875e38a8dbb1102bf4e75f"
10
+ },
11
+ "dependencies": {
12
+ "chalk": "4.1.2",
13
+ "graphql-tag": "2.12.1",
14
+ "lodash": "4.17.21",
15
+ "p-map-series": "2.1.0",
16
+ "semver": "7.7.1",
17
+ "@teambit/cli": "0.0.1258",
18
+ "@teambit/harmony": "0.4.7",
19
+ "@teambit/component-id": "1.2.4",
20
+ "@teambit/component-issues": "0.0.161",
21
+ "@teambit/component.ui.component-deprecated": "0.0.41",
22
+ "@teambit/component": "0.0.0-bd5f4e6bd071c5ee387cba345ab34e18b16bdac2",
23
+ "@teambit/graphql": "0.0.0-7a00a5273c2d44b2c7fb2671fc23d536002485f7",
24
+ "@teambit/dependency-resolver": "0.0.0-c739e0803ea3a9eacfb12550f2c51247adbca700",
25
+ "@teambit/issues": "0.0.0-0064ea51155ffe503544472968d624d9a70fdb36",
26
+ "@teambit/scope": "0.0.0-bdcee3fcf47de47e176b1a1e822aeaff27c576ac",
27
+ "@teambit/workspace": "0.0.0-d3bf61b9572ce258cc803303481c1682b9b5c31a",
28
+ "@teambit/docs": "0.0.0-d51f73b874527b8c1974fd36a02c98df6f1bfe56",
29
+ "@teambit/ui": "0.0.0-6de52ac67dc8c24b129bc469e49d79d85f4fba25"
30
+ },
31
+ "devDependencies": {
32
+ "@types/lodash": "4.14.165",
33
+ "@types/semver": "7.5.8",
34
+ "@types/mocha": "9.1.0",
35
+ "@teambit/harmony.envs.core-aspect-env": "0.0.75"
36
+ },
37
+ "peerDependencies": {
38
+ "react": "^17.0.0 || ^18.0.0",
39
+ "@types/react": "^17.0.73"
40
+ },
41
+ "license": "Apache-2.0",
42
+ "optionalDependencies": {},
43
+ "peerDependenciesMeta": {},
44
+ "exports": {
45
+ ".": {
46
+ "node": {
47
+ "require": "./dist/index.js",
48
+ "import": "./dist/esm.mjs"
49
+ },
50
+ "default": "./dist/index.js"
51
+ },
52
+ "./dist/*": "./dist/*",
53
+ "./artifacts/*": "./artifacts/*",
54
+ "./*": "./*.ts"
55
+ },
56
+ "private": false,
57
+ "engines": {
58
+ "node": ">=16.0.0"
59
+ },
60
+ "repository": {
61
+ "type": "git",
62
+ "url": "https://github.com/teambit/bit"
63
+ },
64
+ "keywords": [
65
+ "bit",
66
+ "bit-aspect",
67
+ "bit-core-aspect",
68
+ "components",
69
+ "collaboration",
70
+ "web"
71
+ ]
72
+ }
@@ -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
+ }
@@ -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
+ }