@teambit/snapping 1.0.1222 → 1.0.1224
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _chai() {
|
|
4
|
+
const data = require("chai");
|
|
5
|
+
_chai = function () {
|
|
6
|
+
return data;
|
|
7
|
+
};
|
|
8
|
+
return data;
|
|
9
|
+
}
|
|
10
|
+
function _v() {
|
|
11
|
+
const data = _interopRequireDefault(require("v8"));
|
|
12
|
+
_v = function () {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
function _vm() {
|
|
18
|
+
const data = _interopRequireDefault(require("vm"));
|
|
19
|
+
_vm = function () {
|
|
20
|
+
return data;
|
|
21
|
+
};
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
function _harmonyTesting() {
|
|
25
|
+
const data = require("@teambit/harmony.testing.load-aspect");
|
|
26
|
+
_harmonyTesting = function () {
|
|
27
|
+
return data;
|
|
28
|
+
};
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
function _workspaceTesting() {
|
|
32
|
+
const data = require("@teambit/workspace.testing.mock-workspace");
|
|
33
|
+
_workspaceTesting = function () {
|
|
34
|
+
return data;
|
|
35
|
+
};
|
|
36
|
+
return data;
|
|
37
|
+
}
|
|
38
|
+
function _export() {
|
|
39
|
+
const data = require("@teambit/export");
|
|
40
|
+
_export = function () {
|
|
41
|
+
return data;
|
|
42
|
+
};
|
|
43
|
+
return data;
|
|
44
|
+
}
|
|
45
|
+
function _componentTesting() {
|
|
46
|
+
const data = require("@teambit/component.testing.mock-components");
|
|
47
|
+
_componentTesting = function () {
|
|
48
|
+
return data;
|
|
49
|
+
};
|
|
50
|
+
return data;
|
|
51
|
+
}
|
|
52
|
+
function _workspace() {
|
|
53
|
+
const data = require("@teambit/workspace");
|
|
54
|
+
_workspace = function () {
|
|
55
|
+
return data;
|
|
56
|
+
};
|
|
57
|
+
return data;
|
|
58
|
+
}
|
|
59
|
+
function _snapping() {
|
|
60
|
+
const data = require("./snapping.aspect");
|
|
61
|
+
_snapping = function () {
|
|
62
|
+
return data;
|
|
63
|
+
};
|
|
64
|
+
return data;
|
|
65
|
+
}
|
|
66
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
67
|
+
/**
|
|
68
|
+
* a process that loads harmony more than once (specs, "bit new", "bit create --aspect") must be able to free the
|
|
69
|
+
* previous instances. process-wide state that keeps one alive, such as a registry that adds an entry per load or a
|
|
70
|
+
* cached legacy object that points back to the workspace, keeps every instance in memory. this flow (tag and export)
|
|
71
|
+
* goes through most of the registries that the aspects write to.
|
|
72
|
+
*/
|
|
73
|
+
describe('loading harmony more than once in a process', function () {
|
|
74
|
+
this.timeout(0);
|
|
75
|
+
_v().default.setFlagsFromString('--expose-gc');
|
|
76
|
+
const gc = _vm().default.runInNewContext('gc');
|
|
77
|
+
async function collectGarbage() {
|
|
78
|
+
// a WeakRef keeps its target alive until the end of the current job, so let each job end before collecting
|
|
79
|
+
for (let i = 0; i < 3; i += 1) {
|
|
80
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
81
|
+
gc();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async function loadTagAndExport() {
|
|
85
|
+
const workspaceData = (0, _workspaceTesting().mockWorkspace)();
|
|
86
|
+
const {
|
|
87
|
+
workspacePath
|
|
88
|
+
} = workspaceData;
|
|
89
|
+
try {
|
|
90
|
+
await (0, _componentTesting().mockComponents)(workspacePath);
|
|
91
|
+
const harmony = await (0, _harmonyTesting().loadManyAspects)([_workspace().WorkspaceAspect, _snapping().SnappingAspect, _export().ExportAspect], workspacePath);
|
|
92
|
+
await harmony.get(_snapping().SnappingAspect.id).tag({
|
|
93
|
+
build: false,
|
|
94
|
+
version: '0.0.1'
|
|
95
|
+
});
|
|
96
|
+
await harmony.get(_export().ExportAspect.id).export();
|
|
97
|
+
return new WeakRef(harmony);
|
|
98
|
+
} finally {
|
|
99
|
+
await (0, _workspaceTesting().destroyWorkspace)(workspaceData);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
it('should keep no more than the latest harmony instance in memory', async () => {
|
|
103
|
+
const instances = [];
|
|
104
|
+
for (let i = 0; i < 3; i += 1) {
|
|
105
|
+
instances.push(await loadTagAndExport());
|
|
106
|
+
}
|
|
107
|
+
await collectGarbage();
|
|
108
|
+
const alive = instances.filter(instance => instance.deref()).length;
|
|
109
|
+
(0, _chai().expect)(alive).to.be.at.most(1);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
//# sourceMappingURL=harmony-reload-retention.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_chai","data","require","_v","_interopRequireDefault","_vm","_harmonyTesting","_workspaceTesting","_export","_componentTesting","_workspace","_snapping","e","__esModule","default","describe","timeout","v8","setFlagsFromString","gc","vm","runInNewContext","collectGarbage","i","Promise","resolve","setTimeout","loadTagAndExport","workspaceData","mockWorkspace","workspacePath","mockComponents","harmony","loadManyAspects","WorkspaceAspect","SnappingAspect","ExportAspect","get","id","tag","build","version","export","WeakRef","destroyWorkspace","it","instances","push","alive","filter","instance","deref","length","expect","to","be","at","most"],"sources":["harmony-reload-retention.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport v8 from 'v8';\nimport vm from 'vm';\nimport { loadManyAspects } from '@teambit/harmony.testing.load-aspect';\nimport { mockWorkspace, destroyWorkspace } from '@teambit/workspace.testing.mock-workspace';\nimport type { ExportMain } from '@teambit/export';\nimport { ExportAspect } from '@teambit/export';\nimport { mockComponents } from '@teambit/component.testing.mock-components';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport type { SnappingMain } from './snapping.main.runtime';\nimport { SnappingAspect } from './snapping.aspect';\n\n/**\n * a process that loads harmony more than once (specs, \"bit new\", \"bit create --aspect\") must be able to free the\n * previous instances. process-wide state that keeps one alive, such as a registry that adds an entry per load or a\n * cached legacy object that points back to the workspace, keeps every instance in memory. this flow (tag and export)\n * goes through most of the registries that the aspects write to.\n */\ndescribe('loading harmony more than once in a process', function () {\n this.timeout(0);\n\n v8.setFlagsFromString('--expose-gc');\n const gc: () => void = vm.runInNewContext('gc');\n\n async function collectGarbage() {\n // a WeakRef keeps its target alive until the end of the current job, so let each job end before collecting\n for (let i = 0; i < 3; i += 1) {\n await new Promise((resolve) => setTimeout(resolve, 10));\n gc();\n }\n }\n\n async function loadTagAndExport(): Promise<WeakRef<object>> {\n const workspaceData = mockWorkspace();\n const { workspacePath } = workspaceData;\n try {\n await mockComponents(workspacePath);\n const harmony = await loadManyAspects([WorkspaceAspect, SnappingAspect, ExportAspect], workspacePath);\n await harmony.get<SnappingMain>(SnappingAspect.id).tag({ build: false, version: '0.0.1' });\n await harmony.get<ExportMain>(ExportAspect.id).export();\n return new WeakRef(harmony);\n } finally {\n await destroyWorkspace(workspaceData);\n }\n }\n\n it('should keep no more than the latest harmony instance in memory', async () => {\n const instances: WeakRef<object>[] = [];\n for (let i = 0; i < 3; i += 1) {\n instances.push(await loadTagAndExport());\n }\n await collectGarbage();\n const alive = instances.filter((instance) => instance.deref()).length;\n expect(alive).to.be.at.most(1);\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,GAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,EAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,IAAA;EAAA,MAAAJ,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAG,GAAA,YAAA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CAACC,MAAM;IACrE,IAAAC,cAAM,EAACL,KAAK,CAAC,CAACM,EAAE,CAACC,EAAE,CAACC,EAAE,CAACC,IAAI,CAAC,CAAC,CAAC;EAChC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/snapping",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1224",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/component/snapping",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "snapping",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.1224"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"graphlib": "2.1.8",
|
|
@@ -22,52 +22,52 @@
|
|
|
22
22
|
"@teambit/bit-error": "0.0.404",
|
|
23
23
|
"@teambit/component-id": "1.2.5",
|
|
24
24
|
"@teambit/graph.cleargraph": "0.0.11",
|
|
25
|
-
"@teambit/legacy.consumer-component": "0.0.
|
|
26
|
-
"@teambit/logger": "0.0.
|
|
27
|
-
"@teambit/objects": "0.0.
|
|
25
|
+
"@teambit/legacy.consumer-component": "0.0.184",
|
|
26
|
+
"@teambit/logger": "0.0.1499",
|
|
27
|
+
"@teambit/objects": "0.0.717",
|
|
28
28
|
"@teambit/toolbox.promise.map-pool": "0.0.24",
|
|
29
|
-
"@teambit/component.sources": "0.0.
|
|
30
|
-
"@teambit/
|
|
31
|
-
"@teambit/
|
|
29
|
+
"@teambit/component.sources": "0.0.235",
|
|
30
|
+
"@teambit/component": "1.0.1222",
|
|
31
|
+
"@teambit/dependency-resolver": "1.0.1222",
|
|
32
|
+
"@teambit/legacy.consumer-config": "0.0.183",
|
|
33
|
+
"@teambit/legacy.extension-data": "0.0.185",
|
|
32
34
|
"@teambit/legacy-bit-id": "1.1.4",
|
|
33
|
-
"@teambit/legacy.logger": "0.0.
|
|
34
|
-
"@teambit/legacy.scope": "0.0.
|
|
35
|
+
"@teambit/legacy.logger": "0.0.68",
|
|
36
|
+
"@teambit/legacy.scope": "0.0.183",
|
|
35
37
|
"@teambit/legacy.loader": "0.0.34",
|
|
36
38
|
"@teambit/harmony.modules.concurrency": "0.0.50",
|
|
37
39
|
"@teambit/pkg.entities.registry": "0.0.4",
|
|
38
|
-
"@teambit/scope.network": "0.0.
|
|
39
|
-
"@teambit/cli": "0.0.
|
|
40
|
+
"@teambit/scope.network": "0.0.183",
|
|
41
|
+
"@teambit/cli": "0.0.1414",
|
|
40
42
|
"@teambit/legacy.constants": "0.0.49",
|
|
41
|
-
"@teambit/legacy.component-list": "0.0.
|
|
42
|
-
"@teambit/legacy.consumer": "0.0.
|
|
43
|
-
"@teambit/legacy.dependency-graph": "0.0.
|
|
43
|
+
"@teambit/legacy.component-list": "0.0.237",
|
|
44
|
+
"@teambit/legacy.consumer": "0.0.183",
|
|
45
|
+
"@teambit/legacy.dependency-graph": "0.0.186",
|
|
44
46
|
"@teambit/component-issues": "0.0.192",
|
|
45
|
-
"@teambit/config-store": "0.0.
|
|
47
|
+
"@teambit/config-store": "0.0.295",
|
|
46
48
|
"@teambit/harmony": "0.4.12",
|
|
47
49
|
"@teambit/component-version": "1.0.4",
|
|
48
50
|
"@teambit/harmony.modules.feature-toggle": "0.0.63",
|
|
49
|
-
"@teambit/harmony.modules.get-basic-log": "0.0.
|
|
51
|
+
"@teambit/harmony.modules.get-basic-log": "0.0.184",
|
|
50
52
|
"@teambit/harmony.modules.runtimes": "0.0.4",
|
|
51
53
|
"@teambit/lane-id": "0.0.312",
|
|
52
|
-
"@teambit/lanes.modules.create-lane": "0.0.
|
|
53
|
-
"@teambit/legacy.scope-api": "0.0.
|
|
54
|
+
"@teambit/lanes.modules.create-lane": "0.0.219",
|
|
55
|
+
"@teambit/legacy.scope-api": "0.0.238",
|
|
54
56
|
"@teambit/pkg.modules.semver-helper": "0.0.38",
|
|
55
|
-
"@teambit/pkg.modules.component-package-name": "0.0.
|
|
57
|
+
"@teambit/pkg.modules.component-package-name": "0.0.190",
|
|
56
58
|
"@teambit/toolbox.crypto.sha1": "0.0.24",
|
|
57
|
-
"@teambit/workspace.modules.node-modules-linker": "0.0.
|
|
58
|
-
"@teambit/graph": "1.0.
|
|
59
|
-
"@teambit/scope": "1.0.
|
|
60
|
-
"@teambit/
|
|
61
|
-
"@teambit/
|
|
62
|
-
"@teambit/
|
|
63
|
-
"@teambit/
|
|
64
|
-
"@teambit/
|
|
65
|
-
"@teambit/
|
|
66
|
-
"@teambit/
|
|
67
|
-
"@teambit/
|
|
68
|
-
"@teambit/
|
|
69
|
-
"@teambit/workspace-root": "0.0.48",
|
|
70
|
-
"@teambit/pkg": "1.0.1222"
|
|
59
|
+
"@teambit/workspace.modules.node-modules-linker": "0.0.416",
|
|
60
|
+
"@teambit/graph": "1.0.1224",
|
|
61
|
+
"@teambit/scope": "1.0.1224",
|
|
62
|
+
"@teambit/dependencies": "1.0.1224",
|
|
63
|
+
"@teambit/remove": "1.0.1224",
|
|
64
|
+
"@teambit/workspace": "1.0.1224",
|
|
65
|
+
"@teambit/application": "1.0.1224",
|
|
66
|
+
"@teambit/builder": "1.0.1224",
|
|
67
|
+
"@teambit/export": "1.0.1224",
|
|
68
|
+
"@teambit/importer": "1.0.1224",
|
|
69
|
+
"@teambit/workspace-root": "0.0.50",
|
|
70
|
+
"@teambit/pkg": "1.0.1224"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@types/graphlib": "2.1.7",
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
"@types/semver": "7.5.8",
|
|
77
77
|
"@types/uuid": "8.3.4",
|
|
78
78
|
"@types/mocha": "9.1.0",
|
|
79
|
-
"@teambit/component.testing.mock-components": "0.0.
|
|
80
|
-
"@teambit/harmony.testing.load-aspect": "0.0.
|
|
81
|
-
"@teambit/workspace.testing.mock-workspace": "0.0.
|
|
79
|
+
"@teambit/component.testing.mock-components": "0.0.459",
|
|
80
|
+
"@teambit/harmony.testing.load-aspect": "0.0.453",
|
|
81
|
+
"@teambit/workspace.testing.mock-workspace": "0.0.267",
|
|
82
|
+
"@teambit/issues": "1.0.1222",
|
|
82
83
|
"@teambit/harmony.envs.core-aspect-env": "2.1.2",
|
|
83
|
-
"@teambit/compiler": "1.0.
|
|
84
|
-
"@teambit/issues": "1.0.1221"
|
|
84
|
+
"@teambit/compiler": "1.0.1224"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"chai": "5.2.1"
|
|
File without changes
|