@teambit/clear-cache 0.0.409 → 0.0.411
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/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_workspace_clear_cache-preview.js +1 -1
- package/artifacts/schema.json +9 -17
- package/dist/clear-cache.d.ts +5 -0
- package/dist/clear-cache.js +115 -0
- package/dist/clear-cache.js.map +1 -0
- package/dist/clear-cache.main.runtime.d.ts +1 -1
- package/dist/clear-cache.main.runtime.js +10 -10
- package/dist/clear-cache.main.runtime.js.map +1 -1
- package/dist/{preview-1718594631308.js → preview-1720667996237.js} +2 -2
- package/package.json +8 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<testsuites tests="0" failures="0" errors="0" skipped="0">
|
|
3
|
-
<testsuite name="teambit.workspace/clear-cache@0.0.
|
|
3
|
+
<testsuite name="teambit.workspace/clear-cache@0.0.411" tests="0" failures="0" errors="0" skipped="0"/>
|
|
4
4
|
</testsuites>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.workspace/clear-cache-preview"]=t():e["teambit.workspace/clear-cache-preview"]=t()}(self,(()=>(()=>{"use strict";var e={
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.workspace/clear-cache-preview"]=t():e["teambit.workspace/clear-cache-preview"]=t()}(self,(()=>(()=>{"use strict";var e={85988:(e,t,o)=>{var r={id:"teambit.workspace/clear-cache@0.0.411",homepage:"https://bit.cloud/teambit/workspace/clear-cache",exported:!0};function n(){const e=i(o(41594));return n=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,n.__bit_component=r,i.__bit_component=r;const c=()=>n().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},n().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/clean-cache.svg"}));c.__bit_component=r,t.Logo=c},41594:e=>{e.exports=React}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};o.r(r),o.d(r,{compositions:()=>f,compositions_metadata:()=>v,overview:()=>m});var n={};o.r(n),o.d(n,{default:()=>d});var i=o(85988);o(41594);const c=MdxJsReact,a=TeambitMdxUiMdxScopeContext;var p=["components"];function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)({}).hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},s.apply(null,arguments)}var l={},u="wrapper";function d(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,r,n=function(e,t){if(null==e)return{};var o={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;o[r]=e[r]}return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)o=i[r],t.indexOf(o)>=0||{}.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}(e,p);return(0,c.mdx)(u,s({},l,o,{components:t,mdxType:"MDXLayout"}),(0,c.mdx)(a.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"}))}d.isMDXComponent=!0;const f=[i],m=[n],v={compositions:[{displayName:"Logo",identifier:"Logo"}]};return r})()));
|
package/artifacts/schema.json
CHANGED
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"character": 1
|
|
37
37
|
},
|
|
38
38
|
"raw": "/**\n * avoid adding `workspace` / `scope` aspects as dependencies to this aspect.\n * the clear-cache command is often being used when the workspace/scope is not working properly.\n */",
|
|
39
|
-
"comment": "avoid adding `workspace` / `scope` aspects as dependencies to this aspect.\nthe clear-cache command is often being used when the workspace/scope is not working properly."
|
|
39
|
+
"comment": "avoid adding `workspace` / `scope` aspects as dependencies to this aspect.\nthe clear-cache command is often being used when the workspace/scope is not working properly.",
|
|
40
|
+
"tags": []
|
|
40
41
|
},
|
|
41
42
|
"signature": "class ClearCacheMain",
|
|
42
43
|
"name": "ClearCacheMain",
|
|
@@ -67,8 +68,7 @@
|
|
|
67
68
|
"line": 13,
|
|
68
69
|
"character": 31
|
|
69
70
|
},
|
|
70
|
-
"name": "CacheClearResult"
|
|
71
|
-
"packageName": "@teambit/legacy/dist/api/consumer/lib/clear-cache"
|
|
71
|
+
"name": "CacheClearResult"
|
|
72
72
|
}
|
|
73
73
|
]
|
|
74
74
|
},
|
|
@@ -216,11 +216,7 @@
|
|
|
216
216
|
"line": 35,
|
|
217
217
|
"character": 33
|
|
218
218
|
},
|
|
219
|
-
"name": "CLIMain"
|
|
220
|
-
"componentId": {
|
|
221
|
-
"scope": "teambit.harmony",
|
|
222
|
-
"name": "cli"
|
|
223
|
-
}
|
|
219
|
+
"name": "CLIMain"
|
|
224
220
|
}
|
|
225
221
|
]
|
|
226
222
|
},
|
|
@@ -319,7 +315,8 @@
|
|
|
319
315
|
"character": 1
|
|
320
316
|
},
|
|
321
317
|
"raw": "/**\n * avoid adding `workspace` / `scope` aspects as dependencies to this aspect.\n * the clear-cache command is often being used when the workspace/scope is not working properly.\n */",
|
|
322
|
-
"comment": "avoid adding `workspace` / `scope` aspects as dependencies to this aspect.\nthe clear-cache command is often being used when the workspace/scope is not working properly."
|
|
318
|
+
"comment": "avoid adding `workspace` / `scope` aspects as dependencies to this aspect.\nthe clear-cache command is often being used when the workspace/scope is not working properly.",
|
|
319
|
+
"tags": []
|
|
323
320
|
},
|
|
324
321
|
"signature": "class ClearCacheMain",
|
|
325
322
|
"name": "ClearCacheMain",
|
|
@@ -350,8 +347,7 @@
|
|
|
350
347
|
"line": 13,
|
|
351
348
|
"character": 31
|
|
352
349
|
},
|
|
353
|
-
"name": "CacheClearResult"
|
|
354
|
-
"packageName": "@teambit/legacy/dist/api/consumer/lib/clear-cache"
|
|
350
|
+
"name": "CacheClearResult"
|
|
355
351
|
}
|
|
356
352
|
]
|
|
357
353
|
},
|
|
@@ -499,11 +495,7 @@
|
|
|
499
495
|
"line": 35,
|
|
500
496
|
"character": 33
|
|
501
497
|
},
|
|
502
|
-
"name": "CLIMain"
|
|
503
|
-
"componentId": {
|
|
504
|
-
"scope": "teambit.harmony",
|
|
505
|
-
"name": "cli"
|
|
506
|
-
}
|
|
498
|
+
"name": "CLIMain"
|
|
507
499
|
}
|
|
508
500
|
]
|
|
509
501
|
},
|
|
@@ -584,7 +576,7 @@
|
|
|
584
576
|
"componentId": {
|
|
585
577
|
"scope": "teambit.workspace",
|
|
586
578
|
"name": "clear-cache",
|
|
587
|
-
"version": "0.0.
|
|
579
|
+
"version": "0.0.411"
|
|
588
580
|
},
|
|
589
581
|
"taggedModuleExports": []
|
|
590
582
|
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.clearCache = clearCache;
|
|
7
|
+
function _fsExtra() {
|
|
8
|
+
const data = _interopRequireDefault(require("fs-extra"));
|
|
9
|
+
_fsExtra = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _v8CompileCache() {
|
|
15
|
+
const data = require("v8-compile-cache");
|
|
16
|
+
_v8CompileCache = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _consumer() {
|
|
22
|
+
const data = require("@teambit/legacy/dist/consumer");
|
|
23
|
+
_consumer = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _componentFsCache() {
|
|
29
|
+
const data = require("@teambit/legacy/dist/consumer/component/component-fs-cache");
|
|
30
|
+
_componentFsCache = function () {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
function _scopeModules() {
|
|
36
|
+
const data = require("@teambit/scope.modules.find-scope-path");
|
|
37
|
+
_scopeModules = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
function _scopeIndex() {
|
|
43
|
+
const data = _interopRequireDefault(require("@teambit/legacy/dist/scope/objects/scope-index"));
|
|
44
|
+
_scopeIndex = function () {
|
|
45
|
+
return data;
|
|
46
|
+
};
|
|
47
|
+
return data;
|
|
48
|
+
}
|
|
49
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
50
|
+
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; }
|
|
51
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
52
|
+
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); } // it's a hack, but I didn't find a better way to access the getCacheDir() function
|
|
53
|
+
class CacheClearer {
|
|
54
|
+
constructor() {
|
|
55
|
+
_defineProperty(this, "cacheCleared", []);
|
|
56
|
+
_defineProperty(this, "cacheClearedFailures", []);
|
|
57
|
+
}
|
|
58
|
+
async clear() {
|
|
59
|
+
this.clearV8CompiledCode();
|
|
60
|
+
await this.clearFSCache();
|
|
61
|
+
await this.clearScopeIndex();
|
|
62
|
+
return {
|
|
63
|
+
succeed: this.cacheCleared,
|
|
64
|
+
failed: this.cacheClearedFailures
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
clearV8CompiledCode() {
|
|
68
|
+
const cacheDir = _v8CompileCache().__TEST__.getCacheDir();
|
|
69
|
+
_fsExtra().default.removeSync(cacheDir);
|
|
70
|
+
this.cacheCleared.push('v8-compile-cache code');
|
|
71
|
+
}
|
|
72
|
+
async clearFSCache() {
|
|
73
|
+
const fsCachePath = await this.getFSCachePath();
|
|
74
|
+
if (fsCachePath) {
|
|
75
|
+
_fsExtra().default.removeSync(fsCachePath);
|
|
76
|
+
this.cacheCleared.push('components cache on the filesystem');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async getConsumerGracefully() {
|
|
80
|
+
try {
|
|
81
|
+
return await (0, _consumer().loadConsumerIfExist)();
|
|
82
|
+
} catch (err) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async getFSCachePath() {
|
|
87
|
+
const consumer = await this.getConsumerGracefully();
|
|
88
|
+
if (consumer) {
|
|
89
|
+
return consumer.componentFsCache.basePath;
|
|
90
|
+
}
|
|
91
|
+
const consumerInfo = await (0, _consumer().getConsumerInfo)(process.cwd());
|
|
92
|
+
if (!consumerInfo) {
|
|
93
|
+
return null; // no workspace around, nothing to do.
|
|
94
|
+
}
|
|
95
|
+
const scopePath = (0, _scopeModules().findScopePath)(consumerInfo.path);
|
|
96
|
+
if (!scopePath) return null;
|
|
97
|
+
const componentFsCache = new (_componentFsCache().ComponentFsCache)(scopePath);
|
|
98
|
+
return componentFsCache.basePath;
|
|
99
|
+
}
|
|
100
|
+
async clearScopeIndex() {
|
|
101
|
+
try {
|
|
102
|
+
const scopePath = (0, _scopeModules().findScopePath)(process.cwd());
|
|
103
|
+
if (!scopePath) return;
|
|
104
|
+
await _scopeIndex().default.reset(scopePath);
|
|
105
|
+
this.cacheCleared.push('scope-index file');
|
|
106
|
+
} catch (err) {
|
|
107
|
+
this.cacheClearedFailures.push(`scope-index file (err: ${err.message})`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async function clearCache() {
|
|
112
|
+
return new CacheClearer().clear();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
//# sourceMappingURL=clear-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_v8CompileCache","_consumer","_componentFsCache","_scopeModules","_scopeIndex","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CacheClearer","constructor","clear","clearV8CompiledCode","clearFSCache","clearScopeIndex","succeed","cacheCleared","failed","cacheClearedFailures","cacheDir","v8CompileCache","getCacheDir","fs","removeSync","push","fsCachePath","getFSCachePath","getConsumerGracefully","loadConsumerIfExist","err","undefined","consumer","componentFsCache","basePath","consumerInfo","getConsumerInfo","process","cwd","scopePath","findScopePath","path","ComponentFsCache","ScopeIndex","reset","message","clearCache"],"sources":["clear-cache.ts"],"sourcesContent":["import fs from 'fs-extra';\n// it's a hack, but I didn't find a better way to access the getCacheDir() function\nimport { __TEST__ as v8CompileCache } from 'v8-compile-cache';\nimport { Consumer, getConsumerInfo, loadConsumerIfExist } from '@teambit/legacy/dist/consumer';\nimport { ComponentFsCache } from '@teambit/legacy/dist/consumer/component/component-fs-cache';\nimport { findScopePath } from '@teambit/scope.modules.find-scope-path';\nimport ScopeIndex from '@teambit/legacy/dist/scope/objects/scope-index';\n\nexport type CacheClearResult = { succeed: string[]; failed: string[] };\n\nclass CacheClearer {\n private cacheCleared: string[] = [];\n private cacheClearedFailures: string[] = [];\n async clear(): Promise<CacheClearResult> {\n this.clearV8CompiledCode();\n await this.clearFSCache();\n await this.clearScopeIndex();\n\n return { succeed: this.cacheCleared, failed: this.cacheClearedFailures };\n }\n\n private clearV8CompiledCode() {\n const cacheDir = v8CompileCache.getCacheDir();\n fs.removeSync(cacheDir);\n this.cacheCleared.push('v8-compile-cache code');\n }\n\n private async clearFSCache() {\n const fsCachePath = await this.getFSCachePath();\n if (fsCachePath) {\n fs.removeSync(fsCachePath);\n this.cacheCleared.push('components cache on the filesystem');\n }\n }\n\n private async getConsumerGracefully(): Promise<Consumer | undefined> {\n try {\n return await loadConsumerIfExist();\n } catch (err: any) {\n return undefined;\n }\n }\n\n private async getFSCachePath(): Promise<string | null> {\n const consumer = await this.getConsumerGracefully();\n if (consumer) {\n return consumer.componentFsCache.basePath;\n }\n const consumerInfo = await getConsumerInfo(process.cwd());\n if (!consumerInfo) {\n return null; // no workspace around, nothing to do.\n }\n const scopePath = findScopePath(consumerInfo.path);\n if (!scopePath) return null;\n const componentFsCache = new ComponentFsCache(scopePath);\n return componentFsCache.basePath;\n }\n\n private async clearScopeIndex() {\n try {\n const scopePath = findScopePath(process.cwd());\n if (!scopePath) return;\n await ScopeIndex.reset(scopePath);\n this.cacheCleared.push('scope-index file');\n } catch (err: any) {\n this.cacheClearedFailures.push(`scope-index file (err: ${err.message})`);\n }\n }\n}\n\nexport async function clearCache(): Promise<CacheClearResult> {\n return new CacheClearer().clear();\n}\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,gBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,eAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,UAAA;EAAA,MAAAJ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AMC,YAAY,GAAG,MAAM,IAAAC,2BAAe,EAACC,OAAO,CAACC,GAAG,CAAC,CAAC,CAAC;IACzD,IAAI,CAACH,YAAY,EAAE;MACjB,OAAO,IAAI,CAAC,CAAC;IACf;IACA,MAAMI,SAAS,GAAG,IAAAC,6BAAa,EAACL,YAAY,CAACM,IAAI,CAAC;IAClD,IAAI,CAACF,SAAS,EAAE,OAAO,IAAI;IAC3B,MAAMN,gBAAgB,GAAG,KAAIS,oCAAgB,EAACH,SAAS,CAAC;IACxD,OAAON,gBAAgB,CAACC,QAAQ;EAClC;EAEA,MAAcnB,eAAeA,CAAA,EAAG;IAC9B,IAAI;MACF,MAAMwB,SAAS,GAAG,IAAAC,6BAAa,EAACH,OAAO,CAACC,GAAG,CAAC,CAAC,CAAC;MAC9C,IAAI,CAACC,SAAS,EAAE;MAChB,MAAMI,qBAAU,CAACC,KAAK,CAACL,SAAS,CAAC;MACjC,IAAI,CAACtB,YAAY,CAACQ,IAAI,CAAC,kBAAkB,CAAC;IAC5C,CAAC,CAAC,OAAOK,GAAQ,EAAE;MACjB,IAAI,CAACX,oBAAoB,CAACM,IAAI,CAAC,0BAA0BK,GAAG,CAACe,OAAO,GAAG,CAAC;IAC1E;EACF;AACF;AAEO,eAAeC,UAAUA,CAAA,EAA8B;EAC5D,OAAO,IAAIpC,YAAY,CAAC,CAAC,CAACE,KAAK,CAAC,CAAC;AACnC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CLIMain } from '@teambit/cli';
|
|
2
|
-
import { CacheClearResult } from '
|
|
2
|
+
import { CacheClearResult } from './clear-cache';
|
|
3
3
|
/**
|
|
4
4
|
* avoid adding `workspace` / `scope` aspects as dependencies to this aspect.
|
|
5
5
|
* the clear-cache command is often being used when the workspace/scope is not working properly.
|
|
@@ -11,13 +11,6 @@ function _cli() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function _clearCache() {
|
|
15
|
-
const data = require("@teambit/legacy/dist/api/consumer/lib/clear-cache");
|
|
16
|
-
_clearCache = function () {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
14
|
function _getRemoteByName() {
|
|
22
15
|
const data = _interopRequireDefault(require("@teambit/legacy/dist/remotes/get-remote-by-name"));
|
|
23
16
|
_getRemoteByName = function () {
|
|
@@ -39,8 +32,15 @@ function _clearCacheCmd() {
|
|
|
39
32
|
};
|
|
40
33
|
return data;
|
|
41
34
|
}
|
|
42
|
-
function
|
|
35
|
+
function _clearCache() {
|
|
43
36
|
const data = require("./clear-cache.aspect");
|
|
37
|
+
_clearCache = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
function _clearCache2() {
|
|
43
|
+
const data = require("./clear-cache");
|
|
44
44
|
_clearCache2 = function () {
|
|
45
45
|
return data;
|
|
46
46
|
};
|
|
@@ -56,7 +56,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
56
56
|
*/
|
|
57
57
|
class ClearCacheMain {
|
|
58
58
|
async clearCache() {
|
|
59
|
-
return (0,
|
|
59
|
+
return (0, _clearCache2().clearCache)();
|
|
60
60
|
}
|
|
61
61
|
async clearRemoteCache(remote) {
|
|
62
62
|
const maybeConsumer = await this.getConsumerGracefully();
|
|
@@ -81,6 +81,6 @@ exports.ClearCacheMain = ClearCacheMain;
|
|
|
81
81
|
_defineProperty(ClearCacheMain, "slots", []);
|
|
82
82
|
_defineProperty(ClearCacheMain, "dependencies", [_cli().CLIAspect]);
|
|
83
83
|
_defineProperty(ClearCacheMain, "runtime", _cli().MainRuntime);
|
|
84
|
-
|
|
84
|
+
_clearCache().ClearCacheAspect.addRuntime(ClearCacheMain);
|
|
85
85
|
|
|
86
86
|
//# sourceMappingURL=clear-cache.main.runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_cli","data","require","
|
|
1
|
+
{"version":3,"names":["_cli","data","require","_getRemoteByName","_interopRequireDefault","_consumer","_clearCacheCmd","_clearCache","_clearCache2","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ClearCacheMain","clearCache","clearRemoteCache","remote","maybeConsumer","getConsumerGracefully","remoteObj","getRemoteByName","result","action","loadConsumerIfExist","err","undefined","provider","cli","clearCacheMain","register","ClearCacheCmd","exports","CLIAspect","MainRuntime","ClearCacheAspect","addRuntime"],"sources":["clear-cache.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport getRemoteByName from '@teambit/legacy/dist/remotes/get-remote-by-name';\nimport { loadConsumerIfExist, Consumer } from '@teambit/legacy/dist/consumer';\nimport ClearCacheCmd from './clear-cache-cmd';\nimport { ClearCacheAspect } from './clear-cache.aspect';\nimport { clearCache, CacheClearResult } from './clear-cache';\n\n/**\n * avoid adding `workspace` / `scope` aspects as dependencies to this aspect.\n * the clear-cache command is often being used when the workspace/scope is not working properly.\n */\nexport class ClearCacheMain {\n async clearCache(): Promise<CacheClearResult> {\n return clearCache();\n }\n\n async clearRemoteCache(remote: string) {\n const maybeConsumer = await this.getConsumerGracefully();\n const remoteObj = await getRemoteByName(remote, maybeConsumer);\n const result = await remoteObj.action('ClearCacheAction', {});\n return result;\n }\n\n private async getConsumerGracefully(): Promise<Consumer | undefined> {\n try {\n return await loadConsumerIfExist();\n } catch (err: any) {\n return undefined;\n }\n }\n\n static slots = [];\n static dependencies = [CLIAspect];\n static runtime = MainRuntime;\n static async provider([cli]: [CLIMain]) {\n const clearCacheMain = new ClearCacheMain();\n cli.register(new ClearCacheCmd(clearCacheMain));\n return clearCacheMain;\n }\n}\n\nClearCacheAspect.addRuntime(ClearCacheMain);\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,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B,cAAc,kBAqBH,CAACmB,gBAAS,CAAC;AAAArC,eAAA,CArBtBkB,cAAc,aAsBRoB,kBAAW;AAQ9BC,8BAAgB,CAACC,UAAU,CAACtB,cAAc,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_clear-cache@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_clear-cache@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_clear-cache@0.0.411/dist/clear-cache.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_clear-cache@0.0.411/dist/clear-cache.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/clear-cache",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.411",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/workspace/clear-cache",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.workspace",
|
|
8
8
|
"name": "clear-cache",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.411"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
13
|
-
"
|
|
13
|
+
"fs-extra": "10.0.0",
|
|
14
|
+
"v8-compile-cache": "2.3.0",
|
|
15
|
+
"@teambit/harmony": "0.4.6",
|
|
16
|
+
"@teambit/scope.modules.find-scope-path": "0.0.1"
|
|
14
17
|
},
|
|
15
18
|
"devDependencies": {
|
|
19
|
+
"@types/fs-extra": "9.0.7",
|
|
16
20
|
"@types/mocha": "9.1.0",
|
|
17
21
|
"chai": "4.3.0",
|
|
18
|
-
"@teambit/harmony.envs.core-aspect-env": "0.0.
|
|
22
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.42"
|
|
19
23
|
},
|
|
20
24
|
"peerDependencies": {
|
|
21
25
|
"react": "^17.0.0 || ^18.0.0",
|