@teambit/clear-cache 0.0.413 → 0.0.415
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 +1 -1
- package/dist/clear-cache.js +12 -5
- package/dist/clear-cache.js.map +1 -1
- package/dist/{preview-1727087093163.js → preview-1732332052659.js} +2 -2
- package/package.json +6 -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.415" 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={75218:(e,t,o)=>{var r={id:"teambit.workspace/clear-cache@0.0.415",homepage:"https://bit.cloud/teambit/workspace/clear-cache",exported:!0};function n(){const e=c(o(41594));return n=function(){return e},e}function c(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,n.__bit_component=r,c.__bit_component=r;const i=()=>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"}));i.__bit_component=r,t.Logo=i},41594:e=>{e.exports=React}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var c=t[r]={exports:{}};return e[r](c,c.exports,o),c.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 c=o(75218);o(41594);const i=MdxJsReact,a=TeambitMdxUiMdxScopeContext;var s=["components"];function p(){return p=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},p.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.includes(r))continue;o[r]=e[r]}return o}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r<c.length;r++)o=c[r],t.includes(o)||{}.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}(e,s);return(0,i.mdx)(u,p({},l,o,{components:t,mdxType:"MDXLayout"}),(0,i.mdx)(a.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"}))}d.isMDXComponent=!0;const f=[c],m=[n],v={compositions:[{displayName:"Logo",identifier:"Logo"}]};return r})()));
|
package/artifacts/schema.json
CHANGED
package/dist/clear-cache.js
CHANGED
|
@@ -25,9 +25,16 @@ function _consumer() {
|
|
|
25
25
|
};
|
|
26
26
|
return data;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
const data = require("@teambit/
|
|
30
|
-
|
|
28
|
+
function _workspaceModules() {
|
|
29
|
+
const data = require("@teambit/workspace.modules.workspace-locator");
|
|
30
|
+
_workspaceModules = function () {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
function _workspaceModules2() {
|
|
36
|
+
const data = require("@teambit/workspace.modules.fs-cache");
|
|
37
|
+
_workspaceModules2 = function () {
|
|
31
38
|
return data;
|
|
32
39
|
};
|
|
33
40
|
return data;
|
|
@@ -88,13 +95,13 @@ class CacheClearer {
|
|
|
88
95
|
if (consumer) {
|
|
89
96
|
return consumer.componentFsCache.basePath;
|
|
90
97
|
}
|
|
91
|
-
const consumerInfo = await (0,
|
|
98
|
+
const consumerInfo = await (0, _workspaceModules().getWorkspaceInfo)(process.cwd());
|
|
92
99
|
if (!consumerInfo) {
|
|
93
100
|
return null; // no workspace around, nothing to do.
|
|
94
101
|
}
|
|
95
102
|
const scopePath = (0, _scopeModules().findScopePath)(consumerInfo.path);
|
|
96
103
|
if (!scopePath) return null;
|
|
97
|
-
const componentFsCache = new (
|
|
104
|
+
const componentFsCache = new (_workspaceModules2().FsCache)(scopePath);
|
|
98
105
|
return componentFsCache.basePath;
|
|
99
106
|
}
|
|
100
107
|
async clearScopeIndex() {
|
package/dist/clear-cache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_v8CompileCache","_consumer","
|
|
1
|
+
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_v8CompileCache","_consumer","_workspaceModules","_workspaceModules2","_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","getWorkspaceInfo","process","cwd","scopePath","findScopePath","path","FsCache","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, loadConsumerIfExist } from '@teambit/legacy/dist/consumer';\nimport { getWorkspaceInfo } from '@teambit/workspace.modules.workspace-locator';\nimport { FsCache } from '@teambit/workspace.modules.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 getWorkspaceInfo(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 FsCache(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,IAAA,GAAAE,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,kBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,iBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,mBAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,kBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,cAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,aAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,YAAA;EAAA,MAAAR,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAM,WAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwE,SAAAC,uBAAAQ,CAAA,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AAMI,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
|
-
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.415/dist/clear-cache.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_clear-cache@0.0.415/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,24 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/clear-cache",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.415",
|
|
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.415"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
13
13
|
"fs-extra": "10.0.0",
|
|
14
14
|
"v8-compile-cache": "2.3.0",
|
|
15
15
|
"@teambit/harmony": "0.4.6",
|
|
16
|
-
"@teambit/scope.modules.find-scope-path": "0.0.1"
|
|
16
|
+
"@teambit/scope.modules.find-scope-path": "0.0.1",
|
|
17
|
+
"@teambit/workspace.modules.fs-cache": "0.0.1",
|
|
18
|
+
"@teambit/workspace.modules.workspace-locator": "0.0.1"
|
|
17
19
|
},
|
|
18
20
|
"devDependencies": {
|
|
19
21
|
"@types/fs-extra": "9.0.7",
|
|
20
22
|
"@types/mocha": "9.1.0",
|
|
21
|
-
"@teambit/harmony.envs.core-aspect-env": "0.0.
|
|
23
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.60"
|
|
22
24
|
},
|
|
23
25
|
"peerDependencies": {
|
|
24
26
|
"react": "^17.0.0 || ^18.0.0",
|