@teambit/objects 0.0.738 → 0.0.739
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.
|
@@ -7,20 +7,6 @@ function _chai() {
|
|
|
7
7
|
};
|
|
8
8
|
return data;
|
|
9
9
|
}
|
|
10
|
-
function _zlib() {
|
|
11
|
-
const data = require("zlib");
|
|
12
|
-
_zlib = function () {
|
|
13
|
-
return data;
|
|
14
|
-
};
|
|
15
|
-
return data;
|
|
16
|
-
}
|
|
17
|
-
function _objects() {
|
|
18
|
-
const data = require("../objects");
|
|
19
|
-
_objects = function () {
|
|
20
|
-
return data;
|
|
21
|
-
};
|
|
22
|
-
return data;
|
|
23
|
-
}
|
|
24
10
|
function _source() {
|
|
25
11
|
const data = _interopRequireDefault(require("./source"));
|
|
26
12
|
_source = function () {
|
|
@@ -30,11 +16,14 @@ function _source() {
|
|
|
30
16
|
}
|
|
31
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
32
18
|
describe('Source', () => {
|
|
33
|
-
it('should not keep the whole
|
|
34
|
-
|
|
35
|
-
|
|
19
|
+
it('should not keep the whole buffer it was parsed from when the file is small', () => {
|
|
20
|
+
// a slice of a big buffer, like zlib returns for small results. built by hand since node 26, where zlib's small
|
|
21
|
+
// results come from the shared Buffer pool (as does the copy), so they can't show whether the copy happened.
|
|
22
|
+
const big = Buffer.alloc(16 * 1024);
|
|
23
|
+
big.write('const a = 1;');
|
|
24
|
+
const parsed = _source().default.parse(big.subarray(0, 12));
|
|
36
25
|
(0, _chai().expect)(parsed.contents.toString()).to.equal('const a = 1;');
|
|
37
|
-
(0, _chai().expect)(parsed.contents.buffer
|
|
26
|
+
(0, _chai().expect)(parsed.contents.buffer).to.not.equal(big.buffer);
|
|
38
27
|
});
|
|
39
28
|
});
|
|
40
29
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chai","data","require","
|
|
1
|
+
{"version":3,"names":["_chai","data","require","_source","_interopRequireDefault","e","__esModule","default","describe","it","big","Buffer","alloc","write","parsed","Source","parse","subarray","expect","contents","toString","to","equal","buffer","not"],"sources":["source.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport Source from './source';\n\ndescribe('Source', () => {\n it('should not keep the whole buffer it was parsed from when the file is small', () => {\n // a slice of a big buffer, like zlib returns for small results. built by hand since node 26, where zlib's small\n // results come from the shared Buffer pool (as does the copy), so they can't show whether the copy happened.\n const big = Buffer.alloc(16 * 1024);\n big.write('const a = 1;');\n const parsed = Source.parse(big.subarray(0, 12));\n expect(parsed.contents.toString()).to.equal('const a = 1;');\n expect(parsed.contents.buffer).to.not.equal(big.buffer);\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,QAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8B,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9BG,QAAQ,CAAC,QAAQ,EAAE,MAAM;EACvBC,EAAE,CAAC,4EAA4E,EAAE,MAAM;IACrF;IACA;IACA,MAAMC,GAAG,GAAGC,MAAM,CAACC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC;IACnCF,GAAG,CAACG,KAAK,CAAC,cAAc,CAAC;IACzB,MAAMC,MAAM,GAAGC,iBAAM,CAACC,KAAK,CAACN,GAAG,CAACO,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChD,IAAAC,cAAM,EAACJ,MAAM,CAACK,QAAQ,CAACC,QAAQ,CAAC,CAAC,CAAC,CAACC,EAAE,CAACC,KAAK,CAAC,cAAc,CAAC;IAC3D,IAAAJ,cAAM,EAACJ,MAAM,CAACK,QAAQ,CAACI,MAAM,CAAC,CAACF,EAAE,CAACG,GAAG,CAACF,KAAK,CAACZ,GAAG,CAACa,MAAM,CAAC;EACzD,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/models/source.spec.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { expect } from 'chai';
|
|
2
|
-
import { deflateSync } from 'zlib';
|
|
3
|
-
import { BitObject } from '../objects';
|
|
4
2
|
import Source from './source';
|
|
5
3
|
|
|
6
4
|
describe('Source', () => {
|
|
7
|
-
it('should not keep the whole
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
it('should not keep the whole buffer it was parsed from when the file is small', () => {
|
|
6
|
+
// a slice of a big buffer, like zlib returns for small results. built by hand since node 26, where zlib's small
|
|
7
|
+
// results come from the shared Buffer pool (as does the copy), so they can't show whether the copy happened.
|
|
8
|
+
const big = Buffer.alloc(16 * 1024);
|
|
9
|
+
big.write('const a = 1;');
|
|
10
|
+
const parsed = Source.parse(big.subarray(0, 12));
|
|
10
11
|
expect(parsed.contents.toString()).to.equal('const a = 1;');
|
|
11
|
-
expect(parsed.contents.buffer
|
|
12
|
+
expect(parsed.contents.buffer).to.not.equal(big.buffer);
|
|
12
13
|
});
|
|
13
14
|
});
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/objects",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.739",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/scope/objects",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.scope",
|
|
8
8
|
"name": "objects",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.739"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@pnpm/lockfile.types": "1100.0.19",
|
|
@@ -26,28 +26,28 @@
|
|
|
26
26
|
"@teambit/component-version": "1.0.4",
|
|
27
27
|
"@teambit/component.snap-distance": "0.0.194",
|
|
28
28
|
"@teambit/lane-id": "0.0.312",
|
|
29
|
-
"@teambit/legacy.cli.error": "0.0.72",
|
|
30
|
-
"@teambit/legacy.constants": "0.0.50",
|
|
31
|
-
"@teambit/legacy.logger": "0.0.71",
|
|
32
29
|
"@teambit/toolbox.crypto.sha1": "0.0.24",
|
|
33
|
-
"@teambit/component.sources": "0.0.246",
|
|
34
|
-
"@teambit/harmony.modules.concurrency": "0.0.51",
|
|
35
30
|
"@teambit/legacy-bit-id": "1.1.4",
|
|
36
31
|
"@teambit/legacy-component-log": "0.0.434",
|
|
37
|
-
"@teambit/legacy.consumer-component": "0.0.195",
|
|
38
|
-
"@teambit/legacy.consumer-config": "0.0.194",
|
|
39
|
-
"@teambit/legacy.extension-data": "0.0.196",
|
|
40
32
|
"@teambit/pkg.modules.semver-helper": "0.0.38",
|
|
41
33
|
"@teambit/toolbox.array.duplications-finder": "0.0.19",
|
|
42
34
|
"@teambit/toolbox.promise.map-pool": "0.0.24",
|
|
43
35
|
"@teambit/graph.cleargraph": "0.0.11",
|
|
44
36
|
"@teambit/bit.get-bit-version": "0.0.31",
|
|
45
|
-
"@teambit/semantics.doc-parser": "0.0.202",
|
|
46
|
-
"@teambit/harmony.modules.in-memory-cache": "0.0.55",
|
|
47
37
|
"@teambit/toolbox.fs.remove-empty-dir": "0.0.22",
|
|
48
|
-
"@teambit/harmony.modules.get-basic-log": "0.0.
|
|
49
|
-
"@teambit/config-store": "0.0.
|
|
50
|
-
"@teambit/legacy.
|
|
38
|
+
"@teambit/harmony.modules.get-basic-log": "0.0.203",
|
|
39
|
+
"@teambit/config-store": "0.0.314",
|
|
40
|
+
"@teambit/legacy.cli.error": "0.0.73",
|
|
41
|
+
"@teambit/legacy.constants": "0.0.51",
|
|
42
|
+
"@teambit/legacy.logger": "0.0.72",
|
|
43
|
+
"@teambit/legacy.scope": "0.0.202",
|
|
44
|
+
"@teambit/component.sources": "0.0.247",
|
|
45
|
+
"@teambit/harmony.modules.concurrency": "0.0.52",
|
|
46
|
+
"@teambit/legacy.consumer-component": "0.0.196",
|
|
47
|
+
"@teambit/legacy.consumer-config": "0.0.195",
|
|
48
|
+
"@teambit/legacy.extension-data": "0.0.197",
|
|
49
|
+
"@teambit/semantics.doc-parser": "0.0.203",
|
|
50
|
+
"@teambit/harmony.modules.in-memory-cache": "0.0.56"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/semver": "7.5.8",
|
|
File without changes
|