@teambit/dependencies 1.0.785 → 1.0.787

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 (26) hide show
  1. package/dist/files-dependency-builder/build-tree.js +1 -1
  2. package/dist/files-dependency-builder/build-tree.js.map +1 -1
  3. package/dist/files-dependency-builder/dependency-tree/index.d.ts +1 -1
  4. package/dist/files-dependency-builder/dependency-tree/index.js +7 -7
  5. package/dist/files-dependency-builder/dependency-tree/index.js.map +1 -1
  6. package/dist/files-dependency-builder/dependency-tree/index.spec.js +73 -73
  7. package/dist/files-dependency-builder/dependency-tree/index.spec.js.map +1 -1
  8. package/dist/files-dependency-builder/filing-cabinet/index.spec.js +1 -1
  9. package/dist/files-dependency-builder/filing-cabinet/index.spec.js.map +1 -1
  10. package/dist/files-dependency-builder/generate-tree-madge.d.ts +1 -1
  11. package/dist/files-dependency-builder/generate-tree-madge.js +5 -5
  12. package/dist/files-dependency-builder/generate-tree-madge.js.map +1 -1
  13. package/dist/files-dependency-builder/precinct/index.d.ts +1 -1
  14. package/dist/files-dependency-builder/precinct/index.js +2 -2
  15. package/dist/files-dependency-builder/precinct/index.js.map +1 -1
  16. package/dist/files-dependency-builder/precinct/index.spec.js +19 -19
  17. package/dist/files-dependency-builder/precinct/index.spec.js.map +1 -1
  18. package/files-dependency-builder/build-tree.ts +1 -1
  19. package/files-dependency-builder/dependency-tree/index.spec.ts +73 -73
  20. package/files-dependency-builder/dependency-tree/index.ts +7 -7
  21. package/files-dependency-builder/filing-cabinet/index.spec.ts +1 -1
  22. package/files-dependency-builder/generate-tree-madge.ts +5 -5
  23. package/files-dependency-builder/precinct/index.spec.ts +19 -19
  24. package/files-dependency-builder/precinct/index.ts +2 -2
  25. package/package.json +8 -8
  26. /package/dist/{preview-1760566720786.js → preview-1760636469189.js} +0 -0
@@ -14,22 +14,22 @@ const precinct = precinctNonWired.default;
14
14
  describe('node-precinct', () => {
15
15
  describe('paperwork', () => {
16
16
  // todo: currently it doesn't work because we set it with bit-no-check
17
- it.skip('returns the dependencies for the given filepath', () => {
18
- assert.ok(Object.keys(precinct.paperwork(`${fixturesFullPath}/es6.js`)).length);
19
- assert.ok(Object.keys(precinct.paperwork(`${fixturesFullPath}/styles.scss`)).length);
17
+ it.skip('returns the dependencies for the given filepath', async () => {
18
+ assert.ok(Object.keys(await precinct.paperwork(`${fixturesFullPath}/es6.js`)).length);
19
+ assert.ok(Object.keys(await precinct.paperwork(`${fixturesFullPath}/styles.scss`)).length);
20
20
  // todo: uncomment the next line and typescript.ts file once we have a way to ignore some component files from compiling/parsing altogether
21
- // assert.ok(Object.keys(precinct.paperwork(`${fixturesFullPath}/typescript.ts`)).length);
22
- assert.ok(Object.keys(precinct.paperwork(`${fixturesFullPath}/styles.css`)).length);
21
+ // assert.ok(Object.keys(await precinct.paperwork(`${fixturesFullPath}/typescript.ts`)).length);
22
+ assert.ok(Object.keys(await precinct.paperwork(`${fixturesFullPath}/styles.css`)).length);
23
23
  });
24
24
 
25
- it('throws if the file cannot be found', () => {
26
- assert.throws(() => {
27
- precinct.paperwork('foo');
25
+ it('throws if the file cannot be found', async () => {
26
+ await assert.rejects(async () => {
27
+ await precinct.paperwork('foo');
28
28
  });
29
29
  });
30
30
 
31
- it('filters out core modules if options.includeCore is false', () => {
32
- const deps = precinct.paperwork(`${fixturesFullPath}/coreModules.js`, {
31
+ it('filters out core modules if options.includeCore is false', async () => {
32
+ const deps = await precinct.paperwork(`${fixturesFullPath}/coreModules.js`, {
33
33
  includeCore: false,
34
34
  });
35
35
 
@@ -37,27 +37,27 @@ describe('node-precinct', () => {
37
37
  });
38
38
 
39
39
  // todo: currently it doesn't work because we set it with bit-no-check
40
- it.skip('does not filter out core modules by default', () => {
41
- const deps = precinct.paperwork(`${fixturesFullPath}/coreModules.js`);
40
+ it.skip('does not filter out core modules by default', async () => {
41
+ const deps = await precinct.paperwork(`${fixturesFullPath}/coreModules.js`);
42
42
  assert(Object.keys(deps).length);
43
43
  });
44
44
 
45
45
  // todo: currently it doesn't work because we set it with bit-no-check
46
- it.skip('supports passing detective configuration', () => {
46
+ it.skip('supports passing detective configuration', async () => {
47
47
  const config = {
48
48
  amd: {
49
49
  skipLazyLoaded: true,
50
50
  },
51
51
  };
52
52
 
53
- const deps = precinct.paperwork(`${fixturesFullPath}/amd.js`, {
53
+ const deps = await precinct.paperwork(`${fixturesFullPath}/amd.js`, {
54
54
  includeCore: false,
55
55
  amd: config.amd,
56
56
  });
57
57
  assert.deepEqual(deps, ['./a', './b']);
58
58
  });
59
59
 
60
- it('supports passing env detectors', () => {
60
+ it('supports passing env detectors', async () => {
61
61
  const detector: DependencyDetector = {
62
62
  detect: (fileContent: string) => {
63
63
  return fileContent.indexOf('foo') === -1 ? [] : ['foo'];
@@ -67,12 +67,12 @@ describe('node-precinct', () => {
67
67
  },
68
68
  type: 'foo',
69
69
  };
70
- const result = precinct.paperwork(`${fixturesFullPath}/foo.foo`, {
70
+ const result = await precinct.paperwork(`${fixturesFullPath}/foo.foo`, {
71
71
  envDetectors: [detector],
72
72
  });
73
73
  assert.deepEqual(result, []);
74
74
 
75
- const result2 = precinct.paperwork(`${fixturesFullPath}/bar.foo`, {
75
+ const result2 = await precinct.paperwork(`${fixturesFullPath}/bar.foo`, {
76
76
  envDetectors: [detector],
77
77
  });
78
78
  assert.deepEqual(result2, ['foo']);
@@ -80,11 +80,11 @@ describe('node-precinct', () => {
80
80
 
81
81
  describe('when given detective configuration', () => {
82
82
  // This test case doesn't fit the current implementation of precinct.
83
- it.skip('still does not filter out core module by default', () => {
83
+ it.skip('still does not filter out core module by default', async () => {
84
84
  const stub = sinon.stub().returns([]);
85
85
  const revert = precinctNonWired.__set__('precinct', stub);
86
86
 
87
- precinct.paperwork(`${fixturesFullPath}/amd.js`, {
87
+ await precinct.paperwork(`${fixturesFullPath}/amd.js`, {
88
88
  amd: {
89
89
  skipLazyLoaded: true,
90
90
  },
@@ -189,7 +189,7 @@ const normalizeDeps = (deps: BuiltinDeps, includeCore?: boolean): string[] => {
189
189
  return includeCore ? normalizedDeps : normalizedDeps.filter((d) => !isBuiltin(d));
190
190
  };
191
191
 
192
- const getDepsFromFile = (filename: string, options?: Options): string[] => {
192
+ const getDepsFromFile = async (filename: string, options?: Options): Promise<string[]> => {
193
193
  const normalizedOptions: Options = assign({ includeCore: true }, options || {});
194
194
  const fileInfo = getFileInfo(filename);
195
195
  if (
@@ -207,7 +207,7 @@ const getDepsFromFile = (filename: string, options?: Options): string[] => {
207
207
  }
208
208
  debug('module type: ', fileInfo.type);
209
209
 
210
- const deps = detective(fileInfo.ast, normalizedOptions[fileInfo.type]);
210
+ const deps = await detective(fileInfo.ast, normalizedOptions[fileInfo.type]);
211
211
 
212
212
  return normalizeDeps(deps, normalizedOptions?.includeCore);
213
213
  };
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/dependencies",
3
- "version": "1.0.785",
3
+ "version": "1.0.787",
4
4
  "homepage": "https://bit.cloud/teambit/dependencies/dependencies",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.dependencies",
8
8
  "name": "dependencies",
9
- "version": "1.0.785"
9
+ "version": "1.0.787"
10
10
  },
11
11
  "dependencies": {
12
12
  "archy": "1.0.0",
@@ -55,12 +55,12 @@
55
55
  "@teambit/styling.deps-detectors.detective-sass": "0.0.9",
56
56
  "@teambit/styling.deps-detectors.detective-scss": "0.0.9",
57
57
  "@teambit/typescript.deps-detectors.detective-typescript": "0.0.10",
58
- "@teambit/graph": "1.0.785",
59
- "@teambit/workspace": "1.0.785",
60
- "@teambit/aspect-loader": "1.0.785",
61
- "@teambit/dependency-resolver": "1.0.785",
62
- "@teambit/dev-files": "1.0.785",
63
- "@teambit/scope": "1.0.785"
58
+ "@teambit/graph": "1.0.787",
59
+ "@teambit/workspace": "1.0.787",
60
+ "@teambit/aspect-loader": "1.0.787",
61
+ "@teambit/dependency-resolver": "1.0.787",
62
+ "@teambit/dev-files": "1.0.787",
63
+ "@teambit/scope": "1.0.787"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@types/cli-table": "^0.3.0",