@teambit/pnpm 1.0.507 → 1.0.509

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.
@@ -1,8 +1,8 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <testsuites tests="4" failures="0" errors="0" skipped="0">
3
- <testsuite name="teambit.dependencies/pnpm@1.0.507" tests="4" failures="0" errors="0" skipped="0">
4
- <testcase classname="dist/lockfile-deps-graph-converter.spec.js" name="should convert the lockfile object to the graph object" time="0.002"/>
5
- <testcase classname="dist/lockfile-deps-graph-converter.spec.js" name="should convert the graph object to the lockfile object" time="0.185"/>
3
+ <testsuite name="teambit.dependencies/pnpm@1.0.509" tests="4" failures="0" errors="0" skipped="0">
4
+ <testcase classname="dist/lockfile-deps-graph-converter.spec.js" name="should convert the lockfile object to the graph object"/>
5
+ <testcase classname="dist/lockfile-deps-graph-converter.spec.js" name="should convert the graph object to the lockfile object" time="0.136"/>
6
6
  <testcase classname="dist/pnpm-error-to-bit-error.spec.js" name="the hint from the fetch error is used" time="0.004"/>
7
7
  <testcase classname="dist/pnpm-error-to-bit-error.spec.js" name="a regular error object is reported"/>
8
8
  </testsuite>
@@ -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.dependencies/pnpm-preview"]=t():e["teambit.dependencies/pnpm-preview"]=t()}(self,(()=>(()=>{"use strict";var e={462:(e,t,n)=>{Object.defineProperty(t,"U",{enumerable:!0,get:function(){return o.default}});var o=r(n(871));function r(e){return e&&e.__esModule?e:{default:e}}r.__bit_component={id:"teambit.dependencies/aspect-docs/pnpm@0.0.170",homepage:"https://bit.cloud/teambit/dependencies/aspect-docs/pnpm",exported:!0}},871:(e,t,n)=>{var o={id:"teambit.dependencies/aspect-docs/pnpm@0.0.170",homepage:"https://bit.cloud/teambit/dependencies/aspect-docs/pnpm",exported:!0};Object.defineProperty(t,"__esModule",{value:!0}),t.default=m,p(n(594));var r=n(16),a=["components"];function p(e){return e&&e.__esModule?e:{default:e}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},i.apply(null,arguments)}function s(e,t){if(null==e)return{};var n,o,r=c(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function c(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.includes(o))continue;n[o]=e[o]}return n}p.__bit_component=o,i.__bit_component=o,s.__bit_component=o,c.__bit_component=o;var d={},l="wrapper";function m(e){var t=e.components,n=s(e,a);return(0,r.mdx)(l,i({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)("p",null,"pnpm is a Bit aspect that enables the use of the pnpm package manager in a Bit workspace (the pnpm aspect utilizes pnpm's programmatic API)."),(0,r.mdx)("p",null,"The pnpm aspect is used ",(0,r.mdx)("strong",{parentName:"p"},"indirectly")," by the 'Dependency Resolver'."),(0,r.mdx)("h2",null,"Quickstart"),(0,r.mdx)("p",null,"To start using the pnpm aspect as a package manager for your workspace, set the Dependency Resolver ",(0,r.mdx)("inlineCode",{parentName:"p"},"packageManager")," property to 'pnpm'."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "teambit.dependencies/dependency-resolver": {\n "packageManager": "teambit.dependencies/pnpm"\n }\n}\n')),(0,r.mdx)("blockquote",null,(0,r.mdx)("p",{parentName:"blockquote"},"Package manager are only configurable at th workspace configuration root-level.\nThat means, different components in the same workspace cannot use different package manager.")),(0,r.mdx)("hr",null),(0,r.mdx)("blockquote",null,(0,r.mdx)("p",{parentName:"blockquote"},"Packages on NPM will be installed from Bit.dev's registry instead of NPM's. This will be done using the user's Bit credentials.")),(0,r.mdx)("blockquote",null,(0,r.mdx)("p",{parentName:"blockquote"},"The pnpm aspect uses Bit's deduping algorithm (not pnpm's).\nIt searches for a common version that satisfies ",(0,r.mdx)("em",{parentName:"p"},"most")," components using the same dependency (taking into consideration permitted version ranges configured for each component) and installs it at the workspace root directory,\nwhere it can be shared by multiple dependent components.\nVersions that are used by a minority of components will be installed nested in each component directory.")),(0,r.mdx)("blockquote",null,(0,r.mdx)("p",{parentName:"blockquote"},"pnpm cannot be used with the 'React Native environment'.")))}m.__bit_component=o,m.isMDXComponent=!0},441:(e,t,n)=>{var o={id:"teambit.dependencies/pnpm@1.0.507",homepage:"https://bit.cloud/teambit/dependencies/pnpm",exported:!0};function r(){const e=a(n(594));return r=function(){return e},e}function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=o,a.__bit_component=o;const p=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/brands/pnpm.svg"}));p.__bit_component=o,t.Logo=p},16:e=>{e.exports=MdxJsReact},594:e=>{e.exports=React}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};n.r(o),n.d(o,{compositions:()=>f,compositions_metadata:()=>y,overview:()=>b});var r={};n.r(r),n.d(r,{default:()=>u});var a=n(441),p=(n(594),n(16));const i=TeambitMdxUiMdxScopeContext;var s=n(462),c=["components"];function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},d.apply(null,arguments)}var l={},m="wrapper";function u(e){var t=e.components,n=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.includes(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,c);return(0,p.mdx)(m,d({},l,n,{components:t,mdxType:"MDXLayout"}),(0,p.mdx)(i.MDXScopeProvider,{components:{Pnpm:s.U},mdxType:"MDXScopeProvider"},(0,p.mdx)(s.U,{mdxType:"Pnpm"})))}u.isMDXComponent=!0;const f=[a],b=[r],y={compositions:[{displayName:"Logo",identifier:"Logo"}]};return o})()));
1
+ !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["teambit.dependencies/pnpm-preview"]=n():e["teambit.dependencies/pnpm-preview"]=n()}(self,(()=>(()=>{"use strict";var e={353:function(e,n,t){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.Pnpm=void 0;var r=t(409);Object.defineProperty(n,"Pnpm",{enumerable:!0,get:function(){return o(r).default}})},409:(e,n,t)=>{var o={id:"teambit.dependencies/aspect-docs/pnpm@0.0.171",homepage:"https://bit.cloud/teambit/dependencies/aspect-docs/pnpm",exported:!0};Object.defineProperty(n,"__esModule",{value:!0}),n.default=m,p(t(594));var r=t(16),a=["components"];function p(e){return e&&e.__esModule?e:{default:e}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)({}).hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},i.apply(null,arguments)}function s(e,n){if(null==e)return{};var t,o,r=c(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)t=a[o],n.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}function c(e,n){if(null==e)return{};var t={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(n.includes(o))continue;t[o]=e[o]}return t}p.__bit_component=o,i.__bit_component=o,s.__bit_component=o,c.__bit_component=o;var l={},d="wrapper";function m(e){var n=e.components,t=s(e,a);return(0,r.mdx)(d,i({},l,t,{components:n,mdxType:"MDXLayout"}),(0,r.mdx)("p",null,"pnpm is a Bit aspect that enables the use of the pnpm package manager in a Bit workspace (the pnpm aspect utilizes pnpm's programmatic API)."),(0,r.mdx)("p",null,"The pnpm aspect is used ",(0,r.mdx)("strong",{parentName:"p"},"indirectly")," by the 'Dependency Resolver'."),(0,r.mdx)("h2",null,"Quickstart"),(0,r.mdx)("p",null,"To start using the pnpm aspect as a package manager for your workspace, set the Dependency Resolver ",(0,r.mdx)("inlineCode",{parentName:"p"},"packageManager")," property to 'pnpm'."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "teambit.dependencies/dependency-resolver": {\n "packageManager": "teambit.dependencies/pnpm"\n }\n}\n')),(0,r.mdx)("blockquote",null,(0,r.mdx)("p",{parentName:"blockquote"},"Package manager are only configurable at th workspace configuration root-level.\nThat means, different components in the same workspace cannot use different package manager.")),(0,r.mdx)("hr",null),(0,r.mdx)("blockquote",null,(0,r.mdx)("p",{parentName:"blockquote"},"Packages on NPM will be installed from Bit.dev's registry instead of NPM's. This will be done using the user's Bit credentials.")),(0,r.mdx)("blockquote",null,(0,r.mdx)("p",{parentName:"blockquote"},"The pnpm aspect uses Bit's deduping algorithm (not pnpm's).\nIt searches for a common version that satisfies ",(0,r.mdx)("em",{parentName:"p"},"most")," components using the same dependency (taking into consideration permitted version ranges configured for each component) and installs it at the workspace root directory,\nwhere it can be shared by multiple dependent components.\nVersions that are used by a minority of components will be installed nested in each component directory.")),(0,r.mdx)("blockquote",null,(0,r.mdx)("p",{parentName:"blockquote"},"pnpm cannot be used with the 'React Native environment'.")))}m.__bit_component=o,m.isMDXComponent=!0},537:(e,n,t)=>{var o={id:"teambit.dependencies/pnpm@1.0.509",homepage:"https://bit.cloud/teambit/dependencies/pnpm",exported:!0};function r(){const e=a(t(594));return r=function(){return e},e}function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0}),n.Logo=void 0,r.__bit_component=o,a.__bit_component=o;const p=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/brands/pnpm.svg"}));p.__bit_component=o,n.Logo=p},16:e=>{e.exports=MdxJsReact},594:e=>{e.exports=React}},n={};function t(o){var r=n[o];if(void 0!==r)return r.exports;var a=n[o]={exports:{}};return e[o].call(a.exports,a,a.exports,t),a.exports}t.d=(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};t.r(o),t.d(o,{compositions:()=>f,compositions_metadata:()=>y,overview:()=>b});var r={};t.r(r),t.d(r,{default:()=>u});var a=t(537),p=(t(594),t(16));const i=TeambitMdxUiMdxScopeContext;var s=t(353),c=["components"];function l(){return l=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)({}).hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},l.apply(null,arguments)}var d={},m="wrapper";function u(e){var n=e.components,t=function(e,n){if(null==e)return{};var t,o,r=function(e,n){if(null==e)return{};var t={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(n.includes(o))continue;t[o]=e[o]}return t}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)t=a[o],n.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}(e,c);return(0,p.mdx)(m,l({},d,t,{components:n,mdxType:"MDXLayout"}),(0,p.mdx)(i.MDXScopeProvider,{components:{Pnpm:s.Pnpm},mdxType:"MDXScopeProvider"},(0,p.mdx)(s.Pnpm,{mdxType:"Pnpm"})))}u.isMDXComponent=!0;const f=[a],b=[r],y={compositions:[{displayName:"Logo",identifier:"Logo"}]};return o})()));
@@ -1692,7 +1692,7 @@
1692
1692
  "_legacy": {
1693
1693
  "scope": "teambit.dependencies",
1694
1694
  "name": "pnpm",
1695
- "version": "1.0.507"
1695
+ "version": "1.0.509"
1696
1696
  },
1697
1697
  "_scope": "teambit.dependencies"
1698
1698
  }
@@ -3831,7 +3831,7 @@
3831
3831
  "_legacy": {
3832
3832
  "scope": "teambit.dependencies",
3833
3833
  "name": "pnpm",
3834
- "version": "1.0.507"
3834
+ "version": "1.0.509"
3835
3835
  },
3836
3836
  "_scope": "teambit.dependencies"
3837
3837
  }
@@ -4210,7 +4210,7 @@
4210
4210
  "componentId": {
4211
4211
  "scope": "teambit.dependencies",
4212
4212
  "name": "pnpm",
4213
- "version": "1.0.507"
4213
+ "version": "1.0.509"
4214
4214
  },
4215
4215
  "taggedModuleExports": []
4216
4216
  }
@@ -5,6 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.convertGraphToLockfile = convertGraphToLockfile;
7
7
  exports.convertLockfileToGraph = convertLockfileToGraph;
8
+ function _path() {
9
+ const data = _interopRequireDefault(require("path"));
10
+ _path = function () {
11
+ return data;
12
+ };
13
+ return data;
14
+ }
8
15
  function dp() {
9
16
  const data = _interopRequireWildcard(require("@pnpm/dependency-path"));
10
17
  dp = function () {
@@ -33,8 +40,16 @@ function _lockfile() {
33
40
  };
34
41
  return data;
35
42
  }
43
+ function _normalizePath() {
44
+ const data = _interopRequireDefault(require("normalize-path"));
45
+ _normalizePath = function () {
46
+ return data;
47
+ };
48
+ return data;
49
+ }
36
50
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
37
51
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
52
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
38
53
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
39
54
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
40
55
  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; }
@@ -232,25 +247,33 @@ function convertGraphToLockfile(graph, manifests, rootDir) {
232
247
  snapshots,
233
248
  importers: {}
234
249
  };
235
- for (const [projectDir, manifest] of Object.entries(manifests)) {
236
- const projectId = (0, _lockfile().getLockfileImporterId)(rootDir, projectDir);
237
- lockfile.importers[projectId] = {
238
- dependencies: {},
239
- devDependencies: {},
240
- optionalDependencies: {}
241
- };
242
- const rootEdge = graph.findRootEdge();
243
- if (rootEdge) {
250
+ const rootEdge = graph.findRootEdge();
251
+ if (rootEdge) {
252
+ for (const [projectDir, manifest] of Object.entries(manifests)) {
253
+ const projectId = (0, _lockfile().getLockfileImporterId)(rootDir, projectDir);
254
+ lockfile.importers[projectId] = {
255
+ dependencies: {},
256
+ devDependencies: {},
257
+ optionalDependencies: {}
258
+ };
244
259
  for (const depType of ['dependencies', 'devDependencies', 'optionalDependencies']) {
245
260
  for (const [name, specifier] of Object.entries(manifest[depType] ?? {})) {
246
- const edgeId = rootEdge.neighbours.find(directDep => directDep.name === name && directDep.specifier === specifier)?.id;
247
- if (edgeId) {
248
- const parsed = dp().parse(edgeId);
249
- const ref = depPathToRef(parsed);
261
+ if (specifier.startsWith('link:')) {
262
+ const version = `link:${(0, _normalizePath().default)(_path().default.relative(projectDir, specifier.substring(5)))}`;
250
263
  lockfile.importers[projectId][depType][name] = {
251
- version: ref,
264
+ version,
252
265
  specifier
253
266
  };
267
+ } else {
268
+ const edgeId = rootEdge.neighbours.find(directDep => directDep.name === name && (directDep.specifier === specifier || directDep.id === `${name}@${specifier}`))?.id;
269
+ if (edgeId) {
270
+ const parsed = dp().parse(edgeId);
271
+ const ref = depPathToRef(parsed);
272
+ lockfile.importers[projectId][depType][name] = {
273
+ version: ref,
274
+ specifier
275
+ };
276
+ }
254
277
  }
255
278
  }
256
279
  }
@@ -1 +1 @@
1
- {"version":3,"names":["dp","data","_interopRequireWildcard","require","_lodash","_scope","_lockfile","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","convertLockfileToGraphFromCapsule","lockfile","componentRelativeDir","componentIdByPkgName","componentImporter","importers","directDependencies","depType","lifecycle","optional","importerDepsToNeighbours","_convertLockfileToGraph","importerDependencies","neighbours","name","version","specifier","entries","id","refToRelative","convertLockfileToGraph","pkgName","componentRootDir","componentDevImporter","devDependencies","lockedPkg","snapshots","dependencies","replaceFileVersionsWithPendingVersions","DependenciesGraph","edges","buildEdges","packages","buildPackages","depPath","snapshot","extractDependenciesFromSnapshot","edge","pkgId","removeSuffix","attr","transitivePeerDependencies","ROOT_EDGE_ID","depTypeField","ref","subDepPath","Map","pkg","graphPkg","pick","includes","parsed","parse","compId","component","fullName","scope","obj","JSON","stringify","replaceAll","convertGraphToLockfile","graph","manifests","rootDir","allEdgeIds","Set","map","optionalDeps","prodDeps","partition","dep","convertToDeps","optionalDependencies","assign","convertGraphPackageToLockfilePackage","lockfileVersion","projectDir","manifest","projectId","getLockfileImporterId","rootEdge","findRootEdge","edgeId","find","directDep","depPathToRef","deps","patchHash","peersSuffix","pkgAttr"],"sources":["lockfile-deps-graph-converter.ts"],"sourcesContent":["import { type ProjectManifest } from '@pnpm/types';\nimport { type LockfileFileV9, type InlineSpecifiersResolvedDependencies } from '@pnpm/lockfile.types';\nimport * as dp from '@pnpm/dependency-path';\nimport { pick, partition } from 'lodash';\nimport {\n DependenciesGraph,\n type PackagesMap,\n type PackageAttributes,\n type DependencyEdge,\n type DependencyNeighbour,\n} from '@teambit/scope.objects';\nimport { type CalcDepsGraphOptions, type ComponentIdByPkgName } from '@teambit/dependency-resolver';\nimport { getLockfileImporterId } from '@pnpm/lockfile.fs';\n\nfunction convertLockfileToGraphFromCapsule(\n lockfile: LockfileFileV9,\n {\n componentRelativeDir,\n componentIdByPkgName,\n }: Pick<CalcDepsGraphOptions, 'componentRelativeDir' | 'componentIdByPkgName'>\n): DependenciesGraph {\n const componentImporter = lockfile.importers![componentRelativeDir];\n const directDependencies: DependencyNeighbour[] = [];\n for (const depType of ['dependencies' as const, 'optionalDependencies' as const, 'devDependencies' as const]) {\n if (componentImporter[depType] != null) {\n const lifecycle = depType === 'devDependencies' ? 'dev' : 'runtime';\n const optional = depType === 'optionalDependencies';\n directDependencies.push(...importerDepsToNeighbours(componentImporter[depType]!, lifecycle, optional));\n }\n }\n return _convertLockfileToGraph(lockfile, { componentIdByPkgName, directDependencies });\n}\n\nfunction importerDepsToNeighbours(\n importerDependencies: InlineSpecifiersResolvedDependencies,\n lifecycle: 'dev' | 'runtime',\n optional: boolean\n): DependencyNeighbour[] {\n const neighbours: DependencyNeighbour[] = [];\n for (const [name, { version, specifier }] of Object.entries(importerDependencies) as any) {\n const id = dp.refToRelative(version, name)!;\n neighbours.push({ name, specifier, id, lifecycle, optional });\n }\n return neighbours;\n}\n\nexport function convertLockfileToGraph(\n lockfile: LockfileFileV9,\n { pkgName, componentRootDir, componentRelativeDir, componentIdByPkgName }: Omit<CalcDepsGraphOptions, 'rootDir'>\n): DependenciesGraph {\n if (componentRootDir == null || pkgName == null) {\n return convertLockfileToGraphFromCapsule(lockfile, { componentRelativeDir, componentIdByPkgName });\n }\n const componentDevImporter = lockfile.importers![componentRelativeDir];\n const directDependencies: DependencyNeighbour[] = [];\n if (componentDevImporter.devDependencies != null) {\n directDependencies.push(...importerDepsToNeighbours(componentDevImporter.devDependencies, 'dev', false));\n }\n const lockedPkg =\n lockfile.snapshots![`${pkgName}@${lockfile.importers![componentRootDir].dependencies![pkgName].version}`];\n for (const depType of ['dependencies' as const, 'optionalDependencies' as const]) {\n const optional = depType === 'optionalDependencies';\n for (const [name, version] of Object.entries(lockedPkg[depType] ?? {})) {\n const id = dp.refToRelative(version, name)!;\n directDependencies.push({\n name,\n specifier: componentDevImporter[depType]?.[name]?.specifier ?? '*',\n id,\n lifecycle: 'runtime',\n optional,\n });\n }\n }\n return _convertLockfileToGraph(lockfile, { componentIdByPkgName, directDependencies });\n}\n\nfunction _convertLockfileToGraph(\n lockfile: LockfileFileV9,\n {\n componentIdByPkgName,\n directDependencies,\n }: {\n componentIdByPkgName: ComponentIdByPkgName;\n directDependencies: DependencyNeighbour[];\n }\n): DependenciesGraph {\n lockfile = replaceFileVersionsWithPendingVersions(lockfile);\n return new DependenciesGraph({\n edges: buildEdges(lockfile, { directDependencies }),\n packages: buildPackages(lockfile, { componentIdByPkgName }),\n });\n}\n\nfunction buildEdges(\n lockfile: LockfileFileV9,\n { directDependencies }: { directDependencies: DependencyNeighbour[] }\n): DependencyEdge[] {\n const edges: DependencyEdge[] = [];\n for (const [depPath, snapshot] of Object.entries(lockfile.snapshots ?? {})) {\n const neighbours = extractDependenciesFromSnapshot(snapshot);\n const edge: DependencyEdge = {\n id: depPath,\n neighbours,\n };\n const pkgId = dp.removeSuffix(depPath);\n if (pkgId !== depPath) {\n edge.attr = { pkgId };\n }\n if (snapshot.transitivePeerDependencies) {\n edge.attr = {\n ...edge.attr,\n transitivePeerDependencies: snapshot.transitivePeerDependencies,\n };\n }\n if (edge.neighbours.length > 0 || edge.id !== pkgId) {\n edges.push(edge);\n }\n }\n edges.push({\n id: DependenciesGraph.ROOT_EDGE_ID,\n neighbours: replaceFileVersionsWithPendingVersions(directDependencies),\n });\n return edges;\n}\n\nfunction extractDependenciesFromSnapshot(snapshot: any): DependencyNeighbour[] {\n const dependencies: DependencyNeighbour[] = [];\n\n for (const { depTypeField, optional } of [\n { depTypeField: 'dependencies', optional: false },\n { depTypeField: 'optionalDependencies', optional: true },\n ]) {\n for (const [name, ref] of Object.entries((snapshot[depTypeField] ?? {}) as Record<string, string>)) {\n const subDepPath = dp.refToRelative(ref, name);\n if (subDepPath != null) {\n dependencies.push({ id: subDepPath, optional });\n }\n }\n }\n\n return dependencies;\n}\n\nfunction buildPackages(\n lockfile: LockfileFileV9,\n { componentIdByPkgName }: { componentIdByPkgName: ComponentIdByPkgName }\n): PackagesMap {\n const packages: PackagesMap = new Map();\n for (const [pkgId, pkg] of Object.entries(lockfile.packages ?? {})) {\n const graphPkg = pick(pkg, [\n 'bundledDependencies',\n 'cpu',\n 'deprecated',\n 'engines',\n 'hasBin',\n 'libc',\n 'name',\n 'os',\n 'peerDependencies',\n 'peerDependenciesMeta',\n 'resolution',\n 'version',\n ]) as any;\n if (pkgId.includes('@pending:')) {\n const parsed = dp.parse(pkgId);\n if (parsed.name && componentIdByPkgName.has(parsed.name)) {\n const compId = componentIdByPkgName.get(parsed.name)!;\n graphPkg.component = {\n name: compId.fullName,\n scope: compId.scope,\n };\n }\n }\n packages.set(pkgId, graphPkg);\n }\n return packages;\n}\n\nfunction replaceFileVersionsWithPendingVersions<T>(obj: T): T {\n return JSON.parse(JSON.stringify(obj).replaceAll(/file:[^'\"(]+/g, 'pending:'));\n}\n\nexport function convertGraphToLockfile(\n graph: DependenciesGraph,\n manifests: Record<string, ProjectManifest>,\n rootDir: string\n): LockfileFileV9 {\n const packages = {};\n const snapshots = {};\n const allEdgeIds = new Set(graph.edges.map(({ id }) => id));\n\n for (const edge of graph.edges) {\n if (edge.id === DependenciesGraph.ROOT_EDGE_ID) continue;\n const pkgId = edge.attr?.pkgId ?? edge.id;\n snapshots[edge.id] = {};\n packages[pkgId] = {};\n const [optionalDeps, prodDeps] = partition(edge.neighbours, (dep) => dep.optional);\n if (prodDeps.length) {\n snapshots[edge.id].dependencies = convertToDeps(prodDeps);\n }\n if (optionalDeps.length) {\n snapshots[edge.id].optionalDependencies = convertToDeps(optionalDeps);\n }\n const graphPkg = graph.packages.get(pkgId);\n if (graphPkg != null) {\n Object.assign(packages[pkgId], convertGraphPackageToLockfilePackage(graphPkg));\n }\n }\n const lockfile = {\n lockfileVersion: '9.0',\n packages,\n snapshots,\n importers: {},\n };\n for (const [projectDir, manifest] of Object.entries(manifests)) {\n const projectId = getLockfileImporterId(rootDir, projectDir);\n lockfile.importers![projectId] = {\n dependencies: {},\n devDependencies: {},\n optionalDependencies: {},\n };\n const rootEdge = graph.findRootEdge();\n if (rootEdge) {\n for (const depType of ['dependencies', 'devDependencies', 'optionalDependencies']) {\n for (const [name, specifier] of Object.entries(manifest[depType] ?? {})) {\n const edgeId = rootEdge.neighbours.find(\n (directDep) => directDep.name === name && directDep.specifier === specifier\n )?.id;\n if (edgeId) {\n const parsed = dp.parse(edgeId);\n const ref = depPathToRef(parsed);\n lockfile.importers![projectId][depType][name] = { version: ref, specifier };\n }\n }\n }\n }\n }\n return lockfile;\n\n function convertToDeps(neighbours: DependencyNeighbour[]) {\n const deps = {};\n for (const { id } of neighbours) {\n const parsed = dp.parse(id);\n deps[parsed.name!] = depPathToRef(parsed);\n if (!allEdgeIds.has(id)) {\n snapshots[id] = {};\n packages[id] = convertGraphPackageToLockfilePackage(graph.packages.get(id)!);\n }\n }\n return deps;\n }\n}\n\nfunction depPathToRef(depPath: dp.DependencyPath): string {\n return `${depPath.version}${depPath.patchHash ?? ''}${depPath.peersSuffix ?? ''}`;\n}\n\nfunction convertGraphPackageToLockfilePackage(pkgAttr: PackageAttributes) {\n return pick(pkgAttr, [\n 'bundledDependencies',\n 'cpu',\n 'deprecated',\n 'engines',\n 'hasBin',\n 'libc',\n 'name',\n 'os',\n 'peerDependencies',\n 'peerDependenciesMeta',\n 'resolution',\n 'version',\n ]);\n}\n"],"mappings":";;;;;;;AAEA,SAAAA,GAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,EAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,OAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQ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AAM,CAAC;YAChClD,QAAQ,CAACI,SAAS,CAAE0E,SAAS,CAAC,CAACxE,OAAO,CAAC,CAACO,IAAI,CAAC,GAAG;cAAEC,OAAO,EAAE6B,GAAG;cAAE5B;YAAU,CAAC;UAC7E;QACF;MACF;IACF;EACF;EACA,OAAOf,QAAQ;EAEf,SAASuE,aAAaA,CAAC3D,UAAiC,EAAE;IACxD,MAAM0E,IAAI,GAAG,CAAC,CAAC;IACf,KAAK,MAAM;MAAErE;IAAG,CAAC,IAAIL,UAAU,EAAE;MAC/B,MAAMsC,MAAM,GAAGvG,EAAE,CAAD,CAAC,CAACwG,KAAK,CAAClC,EAAE,CAAC;MAC3BqE,IAAI,CAACpC,MAAM,CAACrC,IAAI,CAAE,GAAGwE,YAAY,CAACnC,MAAM,CAAC;MACzC,IAAI,CAACc,UAAU,CAACvG,GAAG,CAACwD,EAAE,CAAC,EAAE;QACvBQ,SAAS,CAACR,EAAE,CAAC,GAAG,CAAC,CAAC;QAClBc,QAAQ,CAACd,EAAE,CAAC,GAAGyD,oCAAoC,CAACb,KAAK,CAAC9B,QAAQ,CAACrE,GAAG,CAACuD,EAAE,CAAE,CAAC;MAC9E;IACF;IACA,OAAOqE,IAAI;EACb;AACF;AAEA,SAASD,YAAYA,CAACpD,OAA0B,EAAU;EACxD,OAAO,GAAGA,OAAO,CAACnB,OAAO,GAAGmB,OAAO,CAACsD,SAAS,IAAI,EAAE,GAAGtD,OAAO,CAACuD,WAAW,IAAI,EAAE,EAAE;AACnF;AAEA,SAASd,oCAAoCA,CAACe,OAA0B,EAAE;EACxE,OAAO,IAAAzC,cAAI,EAACyC,OAAO,EAAE,CACnB,qBAAqB,EACrB,KAAK,EACL,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,MAAM,EACN,MAAM,EACN,IAAI,EACJ,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EACZ,SAAS,CACV,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["_path","data","_interopRequireDefault","require","dp","_interopRequireWildcard","_lodash","_scope","_lockfile","_normalizePath","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","convertLockfileToGraphFromCapsule","lockfile","componentRelativeDir","componentIdByPkgName","componentImporter","importers","directDependencies","depType","lifecycle","optional","importerDepsToNeighbours","_convertLockfileToGraph","importerDependencies","neighbours","name","version","specifier","entries","id","refToRelative","convertLockfileToGraph","pkgName","componentRootDir","componentDevImporter","devDependencies","lockedPkg","snapshots","dependencies","replaceFileVersionsWithPendingVersions","DependenciesGraph","edges","buildEdges","packages","buildPackages","depPath","snapshot","extractDependenciesFromSnapshot","edge","pkgId","removeSuffix","attr","transitivePeerDependencies","ROOT_EDGE_ID","depTypeField","ref","subDepPath","Map","pkg","graphPkg","pick","includes","parsed","parse","compId","component","fullName","scope","obj","JSON","stringify","replaceAll","convertGraphToLockfile","graph","manifests","rootDir","allEdgeIds","Set","map","optionalDeps","prodDeps","partition","dep","convertToDeps","optionalDependencies","assign","convertGraphPackageToLockfilePackage","lockfileVersion","rootEdge","findRootEdge","projectDir","manifest","projectId","getLockfileImporterId","startsWith","normalizePath","path","relative","substring","edgeId","find","directDep","depPathToRef","deps","patchHash","peersSuffix","pkgAttr"],"sources":["lockfile-deps-graph-converter.ts"],"sourcesContent":["import path from 'path';\nimport { type ProjectManifest } from '@pnpm/types';\nimport { type LockfileFileV9, type InlineSpecifiersResolvedDependencies } from '@pnpm/lockfile.types';\nimport * as dp from '@pnpm/dependency-path';\nimport { pick, partition } from 'lodash';\nimport {\n DependenciesGraph,\n type PackagesMap,\n type PackageAttributes,\n type DependencyEdge,\n type DependencyNeighbour,\n} from '@teambit/scope.objects';\nimport { type CalcDepsGraphOptions, type ComponentIdByPkgName } from '@teambit/dependency-resolver';\nimport { getLockfileImporterId } from '@pnpm/lockfile.fs';\nimport normalizePath from 'normalize-path';\n\nfunction convertLockfileToGraphFromCapsule(\n lockfile: LockfileFileV9,\n {\n componentRelativeDir,\n componentIdByPkgName,\n }: Pick<CalcDepsGraphOptions, 'componentRelativeDir' | 'componentIdByPkgName'>\n): DependenciesGraph {\n const componentImporter = lockfile.importers![componentRelativeDir];\n const directDependencies: DependencyNeighbour[] = [];\n for (const depType of ['dependencies' as const, 'optionalDependencies' as const, 'devDependencies' as const]) {\n if (componentImporter[depType] != null) {\n const lifecycle = depType === 'devDependencies' ? 'dev' : 'runtime';\n const optional = depType === 'optionalDependencies';\n directDependencies.push(...importerDepsToNeighbours(componentImporter[depType]!, lifecycle, optional));\n }\n }\n return _convertLockfileToGraph(lockfile, { componentIdByPkgName, directDependencies });\n}\n\nfunction importerDepsToNeighbours(\n importerDependencies: InlineSpecifiersResolvedDependencies,\n lifecycle: 'dev' | 'runtime',\n optional: boolean\n): DependencyNeighbour[] {\n const neighbours: DependencyNeighbour[] = [];\n for (const [name, { version, specifier }] of Object.entries(importerDependencies) as any) {\n const id = dp.refToRelative(version, name)!;\n neighbours.push({ name, specifier, id, lifecycle, optional });\n }\n return neighbours;\n}\n\nexport function convertLockfileToGraph(\n lockfile: LockfileFileV9,\n { pkgName, componentRootDir, componentRelativeDir, componentIdByPkgName }: Omit<CalcDepsGraphOptions, 'rootDir'>\n): DependenciesGraph {\n if (componentRootDir == null || pkgName == null) {\n return convertLockfileToGraphFromCapsule(lockfile, { componentRelativeDir, componentIdByPkgName });\n }\n const componentDevImporter = lockfile.importers![componentRelativeDir];\n const directDependencies: DependencyNeighbour[] = [];\n if (componentDevImporter.devDependencies != null) {\n directDependencies.push(...importerDepsToNeighbours(componentDevImporter.devDependencies, 'dev', false));\n }\n const lockedPkg =\n lockfile.snapshots![`${pkgName}@${lockfile.importers![componentRootDir].dependencies![pkgName].version}`];\n for (const depType of ['dependencies' as const, 'optionalDependencies' as const]) {\n const optional = depType === 'optionalDependencies';\n for (const [name, version] of Object.entries(lockedPkg[depType] ?? {})) {\n const id = dp.refToRelative(version, name)!;\n directDependencies.push({\n name,\n specifier: componentDevImporter[depType]?.[name]?.specifier ?? '*',\n id,\n lifecycle: 'runtime',\n optional,\n });\n }\n }\n return _convertLockfileToGraph(lockfile, { componentIdByPkgName, directDependencies });\n}\n\nfunction _convertLockfileToGraph(\n lockfile: LockfileFileV9,\n {\n componentIdByPkgName,\n directDependencies,\n }: {\n componentIdByPkgName: ComponentIdByPkgName;\n directDependencies: DependencyNeighbour[];\n }\n): DependenciesGraph {\n lockfile = replaceFileVersionsWithPendingVersions(lockfile);\n return new DependenciesGraph({\n edges: buildEdges(lockfile, { directDependencies }),\n packages: buildPackages(lockfile, { componentIdByPkgName }),\n });\n}\n\nfunction buildEdges(\n lockfile: LockfileFileV9,\n { directDependencies }: { directDependencies: DependencyNeighbour[] }\n): DependencyEdge[] {\n const edges: DependencyEdge[] = [];\n for (const [depPath, snapshot] of Object.entries(lockfile.snapshots ?? {})) {\n const neighbours = extractDependenciesFromSnapshot(snapshot);\n const edge: DependencyEdge = {\n id: depPath,\n neighbours,\n };\n const pkgId = dp.removeSuffix(depPath);\n if (pkgId !== depPath) {\n edge.attr = { pkgId };\n }\n if (snapshot.transitivePeerDependencies) {\n edge.attr = {\n ...edge.attr,\n transitivePeerDependencies: snapshot.transitivePeerDependencies,\n };\n }\n if (edge.neighbours.length > 0 || edge.id !== pkgId) {\n edges.push(edge);\n }\n }\n edges.push({\n id: DependenciesGraph.ROOT_EDGE_ID,\n neighbours: replaceFileVersionsWithPendingVersions(directDependencies),\n });\n return edges;\n}\n\nfunction extractDependenciesFromSnapshot(snapshot: any): DependencyNeighbour[] {\n const dependencies: DependencyNeighbour[] = [];\n\n for (const { depTypeField, optional } of [\n { depTypeField: 'dependencies', optional: false },\n { depTypeField: 'optionalDependencies', optional: true },\n ]) {\n for (const [name, ref] of Object.entries((snapshot[depTypeField] ?? {}) as Record<string, string>)) {\n const subDepPath = dp.refToRelative(ref, name);\n if (subDepPath != null) {\n dependencies.push({ id: subDepPath, optional });\n }\n }\n }\n\n return dependencies;\n}\n\nfunction buildPackages(\n lockfile: LockfileFileV9,\n { componentIdByPkgName }: { componentIdByPkgName: ComponentIdByPkgName }\n): PackagesMap {\n const packages: PackagesMap = new Map();\n for (const [pkgId, pkg] of Object.entries(lockfile.packages ?? {})) {\n const graphPkg = pick(pkg, [\n 'bundledDependencies',\n 'cpu',\n 'deprecated',\n 'engines',\n 'hasBin',\n 'libc',\n 'name',\n 'os',\n 'peerDependencies',\n 'peerDependenciesMeta',\n 'resolution',\n 'version',\n ]) as any;\n if (pkgId.includes('@pending:')) {\n const parsed = dp.parse(pkgId);\n if (parsed.name && componentIdByPkgName.has(parsed.name)) {\n const compId = componentIdByPkgName.get(parsed.name)!;\n graphPkg.component = {\n name: compId.fullName,\n scope: compId.scope,\n };\n }\n }\n packages.set(pkgId, graphPkg);\n }\n return packages;\n}\n\nfunction replaceFileVersionsWithPendingVersions<T>(obj: T): T {\n return JSON.parse(JSON.stringify(obj).replaceAll(/file:[^'\"(]+/g, 'pending:'));\n}\n\nexport function convertGraphToLockfile(\n graph: DependenciesGraph,\n manifests: Record<string, ProjectManifest>,\n rootDir: string\n): LockfileFileV9 {\n const packages = {};\n const snapshots = {};\n const allEdgeIds = new Set(graph.edges.map(({ id }) => id));\n\n for (const edge of graph.edges) {\n if (edge.id === DependenciesGraph.ROOT_EDGE_ID) continue;\n const pkgId = edge.attr?.pkgId ?? edge.id;\n snapshots[edge.id] = {};\n packages[pkgId] = {};\n const [optionalDeps, prodDeps] = partition(edge.neighbours, (dep) => dep.optional);\n if (prodDeps.length) {\n snapshots[edge.id].dependencies = convertToDeps(prodDeps);\n }\n if (optionalDeps.length) {\n snapshots[edge.id].optionalDependencies = convertToDeps(optionalDeps);\n }\n const graphPkg = graph.packages.get(pkgId);\n if (graphPkg != null) {\n Object.assign(packages[pkgId], convertGraphPackageToLockfilePackage(graphPkg));\n }\n }\n const lockfile = {\n lockfileVersion: '9.0',\n packages,\n snapshots,\n importers: {},\n };\n const rootEdge = graph.findRootEdge();\n if (rootEdge) {\n for (const [projectDir, manifest] of Object.entries(manifests)) {\n const projectId = getLockfileImporterId(rootDir, projectDir);\n lockfile.importers![projectId] = {\n dependencies: {},\n devDependencies: {},\n optionalDependencies: {},\n };\n for (const depType of ['dependencies', 'devDependencies', 'optionalDependencies']) {\n for (const [name, specifier] of Object.entries(manifest[depType] ?? {}) as Array<[string, string]>) {\n if (specifier.startsWith('link:')) {\n const version = `link:${normalizePath(path.relative(projectDir, specifier.substring(5)))}`;\n lockfile.importers![projectId][depType][name] = { version, specifier };\n } else {\n const edgeId = rootEdge.neighbours.find(\n (directDep) =>\n directDep.name === name &&\n (directDep.specifier === specifier || directDep.id === `${name}@${specifier}`)\n )?.id;\n if (edgeId) {\n const parsed = dp.parse(edgeId);\n const ref = depPathToRef(parsed);\n lockfile.importers![projectId][depType][name] = { version: ref, specifier };\n }\n }\n }\n }\n }\n }\n return lockfile;\n\n function convertToDeps(neighbours: DependencyNeighbour[]) {\n const deps = {};\n for (const { id } of neighbours) {\n const parsed = dp.parse(id);\n deps[parsed.name!] = depPathToRef(parsed);\n if (!allEdgeIds.has(id)) {\n snapshots[id] = {};\n packages[id] = convertGraphPackageToLockfilePackage(graph.packages.get(id)!);\n }\n }\n return deps;\n }\n}\n\nfunction depPathToRef(depPath: dp.DependencyPath): string {\n return `${depPath.version}${depPath.patchHash ?? ''}${depPath.peersSuffix ?? ''}`;\n}\n\nfunction convertGraphPackageToLockfilePackage(pkgAttr: PackageAttributes) {\n return pick(pkgAttr, [\n 'bundledDependencies',\n 'cpu',\n 'deprecated',\n 'engines',\n 'hasBin',\n 'libc',\n 'name',\n 'os',\n 'peerDependencies',\n 'peerDependenciesMeta',\n 'resolution',\n 'version',\n ]);\n}\n"],"mappings":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convertLockfileToGraph simple case', () => {
51
51
  foo: {
52
52
  version: '1.0.0(patch_hash=0000)',
53
53
  specifier: '^1.0.0'
54
+ },
55
+ qar: {
56
+ version: '1.1.0',
57
+ specifier: '^1.0.0'
54
58
  }
55
59
  }
56
60
  }
@@ -63,9 +67,11 @@ describe('convertLockfileToGraph simple case', () => {
63
67
  }
64
68
  },
65
69
  'bar@1.0.0': {},
70
+ 'qar@1.1.0': {},
66
71
  'comp1@file:comps/comp1': {
67
72
  dependencies: {
68
- foo: '1.0.0(patch_hash=0000)'
73
+ foo: '1.0.0(patch_hash=0000)',
74
+ qar: '1.1.0'
69
75
  }
70
76
  }
71
77
  },
@@ -92,6 +98,11 @@ describe('convertLockfileToGraph simple case', () => {
92
98
  resolution: {
93
99
  integrity: 'sha512-111'
94
100
  }
101
+ },
102
+ 'qar@1.1.0': {
103
+ resolution: {
104
+ integrity: 'sha512-222'
105
+ }
95
106
  }
96
107
  }
97
108
  };
@@ -117,6 +128,9 @@ describe('convertLockfileToGraph simple case', () => {
117
128
  neighbours: [{
118
129
  id: 'foo@1.0.0(patch_hash=0000)',
119
130
  optional: false
131
+ }, {
132
+ id: 'qar@1.1.0',
133
+ optional: false
120
134
  }]
121
135
  }, {
122
136
  id: '.',
@@ -126,6 +140,12 @@ describe('convertLockfileToGraph simple case', () => {
126
140
  specifier: '^1.0.0',
127
141
  lifecycle: 'runtime',
128
142
  optional: false
143
+ }, {
144
+ id: 'qar@1.1.0',
145
+ name: 'qar',
146
+ specifier: '^1.0.0',
147
+ lifecycle: 'runtime',
148
+ optional: false
129
149
  }]
130
150
  }],
131
151
  packages: {
@@ -146,6 +166,11 @@ describe('convertLockfileToGraph simple case', () => {
146
166
  integrity: 'sha512-111'
147
167
  }
148
168
  },
169
+ 'qar@1.1.0': {
170
+ resolution: {
171
+ integrity: 'sha512-222'
172
+ }
173
+ },
149
174
  'comp1@pending:': {
150
175
  resolution: {
151
176
  directory: 'comps/comp1',
@@ -163,7 +188,10 @@ describe('convertLockfileToGraph simple case', () => {
163
188
  (0, _chai().expect)((0, _lockfileDepsGraphConverter().convertGraphToLockfile)(new (_scope().DependenciesGraph)(graph), {
164
189
  [_path().default.resolve('comps/comp1')]: {
165
190
  dependencies: {
166
- foo: '^1.0.0'
191
+ foo: '^1.0.0',
192
+ bar: `link:${_path().default.resolve('comps/bar')}`,
193
+ // Links from the manifests are added to the lockfile
194
+ qar: '1.1.0'
167
195
  }
168
196
  }
169
197
  }, process.cwd())).to.eql({
@@ -173,6 +201,14 @@ describe('convertLockfileToGraph simple case', () => {
173
201
  foo: {
174
202
  version: '1.0.0(patch_hash=0000)',
175
203
  specifier: '^1.0.0'
204
+ },
205
+ bar: {
206
+ version: 'link:../bar',
207
+ specifier: `link:${_path().default.resolve('comps/bar')}`
208
+ },
209
+ qar: {
210
+ version: '1.1.0',
211
+ specifier: '1.1.0'
176
212
  }
177
213
  },
178
214
  devDependencies: {},
@@ -187,9 +223,11 @@ describe('convertLockfileToGraph simple case', () => {
187
223
  }
188
224
  },
189
225
  'bar@1.0.0': {},
226
+ 'qar@1.1.0': {},
190
227
  'comp1@pending:': {
191
228
  dependencies: {
192
- foo: '1.0.0(patch_hash=0000)'
229
+ foo: '1.0.0(patch_hash=0000)',
230
+ qar: '1.1.0'
193
231
  }
194
232
  }
195
233
  },
@@ -216,6 +254,11 @@ describe('convertLockfileToGraph simple case', () => {
216
254
  resolution: {
217
255
  integrity: 'sha512-111'
218
256
  }
257
+ },
258
+ 'qar@1.1.0': {
259
+ resolution: {
260
+ integrity: 'sha512-222'
261
+ }
219
262
  }
220
263
  }
221
264
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_path","data","_interopRequireDefault","require","_scope","_lockfileDepsGraphConverter","_chai","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","describe","lockfile","importers","dependencies","comp1","version","specifier","foo","lockfileVersion","snapshots","bar","packages","resolution","directory","type","engines","node","npm","hasBin","os","cpu","integrity","graph","convertLockfileToGraph","pkgName","componentRelativeDir","componentRootDir","componentIdByPkgName","Map","expected","schemaVersion","edges","id","neighbours","optional","attr","pkgId","name","lifecycle","it","expect","fromEntries","entries","to","eql","convertGraphToLockfile","DependenciesGraph","path","resolve","process","cwd","devDependencies","optionalDependencies"],"sources":["lockfile-deps-graph-converter.spec.ts"],"sourcesContent":["import path from 'path';\nimport { DependenciesGraph } from '@teambit/scope.objects';\nimport { type LockfileFileV9 } from '@pnpm/lockfile.types';\nimport { convertLockfileToGraph, convertGraphToLockfile } from './lockfile-deps-graph-converter';\nimport { expect } from 'chai';\n\ndescribe('convertLockfileToGraph simple case', () => {\n const lockfile: LockfileFileV9 = {\n importers: {\n '.': {},\n 'node_modules/.bit_roots/env': {\n dependencies: {\n comp1: {\n version: 'file:comps/comp1',\n specifier: '*',\n },\n },\n },\n 'comps/comp1': {\n dependencies: {\n foo: {\n version: '1.0.0(patch_hash=0000)',\n specifier: '^1.0.0',\n },\n },\n },\n },\n lockfileVersion: '9.0',\n snapshots: {\n 'foo@1.0.0(patch_hash=0000)': {\n dependencies: {\n bar: '1.0.0',\n },\n },\n 'bar@1.0.0': {},\n 'comp1@file:comps/comp1': {\n dependencies: {\n foo: '1.0.0(patch_hash=0000)',\n },\n },\n },\n packages: {\n 'comp1@file:comps/comp1': {\n resolution: {\n directory: 'comps/comp1',\n type: 'directory',\n },\n },\n 'foo@1.0.0': {\n engines: {\n node: '>=8',\n npm: '>=6',\n },\n hasBin: true,\n os: ['darwin'],\n cpu: ['arm64'],\n resolution: {\n integrity: 'sha512-000',\n },\n },\n 'bar@1.0.0': {\n resolution: {\n integrity: 'sha512-111',\n },\n },\n },\n };\n const graph = convertLockfileToGraph(lockfile, {\n pkgName: 'comp1',\n componentRelativeDir: 'comps/comp1',\n componentRootDir: 'node_modules/.bit_roots/env',\n componentIdByPkgName: new Map(),\n });\n const expected = {\n schemaVersion: '1.0',\n edges: [\n {\n id: 'foo@1.0.0(patch_hash=0000)',\n neighbours: [{ id: 'bar@1.0.0', optional: false }],\n attr: {\n pkgId: 'foo@1.0.0',\n },\n },\n {\n id: 'comp1@pending:',\n neighbours: [\n {\n id: 'foo@1.0.0(patch_hash=0000)',\n optional: false,\n },\n ],\n },\n {\n id: '.',\n neighbours: [\n {\n id: 'foo@1.0.0(patch_hash=0000)',\n name: 'foo',\n specifier: '^1.0.0',\n lifecycle: 'runtime',\n optional: false,\n },\n ],\n },\n ],\n packages: {\n 'foo@1.0.0': {\n engines: {\n node: '>=8',\n npm: '>=6',\n },\n hasBin: true,\n os: ['darwin'],\n cpu: ['arm64'],\n resolution: {\n integrity: 'sha512-000',\n },\n },\n 'bar@1.0.0': {\n resolution: {\n integrity: 'sha512-111',\n },\n },\n 'comp1@pending:': {\n resolution: {\n directory: 'comps/comp1',\n type: 'directory',\n },\n },\n },\n };\n it('should convert the lockfile object to the graph object', () => {\n expect({\n ...graph,\n packages: Object.fromEntries(graph.packages.entries()),\n }).to.eql(expected);\n });\n it('should convert the graph object to the lockfile object', () => {\n expect(\n convertGraphToLockfile(\n new DependenciesGraph(graph),\n {\n [path.resolve('comps/comp1')]: {\n dependencies: {\n foo: '^1.0.0',\n },\n },\n },\n process.cwd()\n )\n ).to.eql({\n importers: {\n 'comps/comp1': {\n dependencies: {\n foo: {\n version: '1.0.0(patch_hash=0000)',\n specifier: '^1.0.0',\n },\n },\n devDependencies: {},\n optionalDependencies: {},\n },\n },\n lockfileVersion: '9.0',\n snapshots: {\n 'foo@1.0.0(patch_hash=0000)': {\n dependencies: {\n bar: '1.0.0',\n },\n },\n 'bar@1.0.0': {},\n 'comp1@pending:': {\n dependencies: {\n foo: '1.0.0(patch_hash=0000)',\n },\n },\n },\n packages: {\n 'comp1@pending:': {\n resolution: {\n directory: 'comps/comp1',\n type: 'directory',\n },\n },\n 'foo@1.0.0': {\n engines: {\n node: '>=8',\n npm: '>=6',\n },\n hasBin: true,\n os: ['darwin'],\n cpu: ['arm64'],\n resolution: {\n integrity: 'sha512-000',\n },\n },\n 'bar@1.0.0': {\n resolution: {\n integrity: 'sha512-111',\n },\n },\n },\n });\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,4BAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,2BAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,KAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8B,SAAAC,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,QAAAH,CAAA,EAAAI,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAP,CAAA,OAAAM,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAR,CAAA,GAAAI,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAX,CAAA,EAAAI,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,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EAAE;YACVS,SAAS,EAAE;UACb;QACF,CAAC;QACD,WAAW,EAAE;UACXT,UAAU,EAAE;YACVS,SAAS,EAAE;UACb;QACF;MACF;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_path","data","_interopRequireDefault","require","_scope","_lockfileDepsGraphConverter","_chai","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","describe","lockfile","importers","dependencies","comp1","version","specifier","foo","qar","lockfileVersion","snapshots","bar","packages","resolution","directory","type","engines","node","npm","hasBin","os","cpu","integrity","graph","convertLockfileToGraph","pkgName","componentRelativeDir","componentRootDir","componentIdByPkgName","Map","expected","schemaVersion","edges","id","neighbours","optional","attr","pkgId","name","lifecycle","it","expect","fromEntries","entries","to","eql","convertGraphToLockfile","DependenciesGraph","path","resolve","process","cwd","devDependencies","optionalDependencies"],"sources":["lockfile-deps-graph-converter.spec.ts"],"sourcesContent":["import path from 'path';\nimport { DependenciesGraph } from '@teambit/scope.objects';\nimport { type LockfileFileV9 } from '@pnpm/lockfile.types';\nimport { convertLockfileToGraph, convertGraphToLockfile } from './lockfile-deps-graph-converter';\nimport { expect } from 'chai';\n\ndescribe('convertLockfileToGraph simple case', () => {\n const lockfile: LockfileFileV9 = {\n importers: {\n '.': {},\n 'node_modules/.bit_roots/env': {\n dependencies: {\n comp1: {\n version: 'file:comps/comp1',\n specifier: '*',\n },\n },\n },\n 'comps/comp1': {\n dependencies: {\n foo: {\n version: '1.0.0(patch_hash=0000)',\n specifier: '^1.0.0',\n },\n qar: {\n version: '1.1.0',\n specifier: '^1.0.0',\n },\n },\n },\n },\n lockfileVersion: '9.0',\n snapshots: {\n 'foo@1.0.0(patch_hash=0000)': {\n dependencies: {\n bar: '1.0.0',\n },\n },\n 'bar@1.0.0': {},\n 'qar@1.1.0': {},\n 'comp1@file:comps/comp1': {\n dependencies: {\n foo: '1.0.0(patch_hash=0000)',\n qar: '1.1.0',\n },\n },\n },\n packages: {\n 'comp1@file:comps/comp1': {\n resolution: {\n directory: 'comps/comp1',\n type: 'directory',\n },\n },\n 'foo@1.0.0': {\n engines: {\n node: '>=8',\n npm: '>=6',\n },\n hasBin: true,\n os: ['darwin'],\n cpu: ['arm64'],\n resolution: {\n integrity: 'sha512-000',\n },\n },\n 'bar@1.0.0': {\n resolution: {\n integrity: 'sha512-111',\n },\n },\n 'qar@1.1.0': {\n resolution: {\n integrity: 'sha512-222',\n },\n },\n },\n };\n const graph = convertLockfileToGraph(lockfile, {\n pkgName: 'comp1',\n componentRelativeDir: 'comps/comp1',\n componentRootDir: 'node_modules/.bit_roots/env',\n componentIdByPkgName: new Map(),\n });\n const expected = {\n schemaVersion: '1.0',\n edges: [\n {\n id: 'foo@1.0.0(patch_hash=0000)',\n neighbours: [{ id: 'bar@1.0.0', optional: false }],\n attr: {\n pkgId: 'foo@1.0.0',\n },\n },\n {\n id: 'comp1@pending:',\n neighbours: [\n {\n id: 'foo@1.0.0(patch_hash=0000)',\n optional: false,\n },\n {\n id: 'qar@1.1.0',\n optional: false,\n },\n ],\n },\n {\n id: '.',\n neighbours: [\n {\n id: 'foo@1.0.0(patch_hash=0000)',\n name: 'foo',\n specifier: '^1.0.0',\n lifecycle: 'runtime',\n optional: false,\n },\n {\n id: 'qar@1.1.0',\n name: 'qar',\n specifier: '^1.0.0',\n lifecycle: 'runtime',\n optional: false,\n },\n ],\n },\n ],\n packages: {\n 'foo@1.0.0': {\n engines: {\n node: '>=8',\n npm: '>=6',\n },\n hasBin: true,\n os: ['darwin'],\n cpu: ['arm64'],\n resolution: {\n integrity: 'sha512-000',\n },\n },\n 'bar@1.0.0': {\n resolution: {\n integrity: 'sha512-111',\n },\n },\n 'qar@1.1.0': {\n resolution: {\n integrity: 'sha512-222',\n },\n },\n 'comp1@pending:': {\n resolution: {\n directory: 'comps/comp1',\n type: 'directory',\n },\n },\n },\n };\n it('should convert the lockfile object to the graph object', () => {\n expect({\n ...graph,\n packages: Object.fromEntries(graph.packages.entries()),\n }).to.eql(expected);\n });\n it('should convert the graph object to the lockfile object', () => {\n expect(\n convertGraphToLockfile(\n new DependenciesGraph(graph),\n {\n [path.resolve('comps/comp1')]: {\n dependencies: {\n foo: '^1.0.0',\n bar: `link:${path.resolve('comps/bar')}`, // Links from the manifests are added to the lockfile\n qar: '1.1.0',\n },\n },\n },\n process.cwd()\n )\n ).to.eql({\n importers: {\n 'comps/comp1': {\n dependencies: {\n foo: {\n version: '1.0.0(patch_hash=0000)',\n specifier: '^1.0.0',\n },\n bar: {\n version: 'link:../bar',\n specifier: `link:${path.resolve('comps/bar')}`,\n },\n qar: {\n version: '1.1.0',\n specifier: '1.1.0',\n },\n },\n devDependencies: {},\n optionalDependencies: {},\n },\n },\n lockfileVersion: '9.0',\n snapshots: {\n 'foo@1.0.0(patch_hash=0000)': {\n dependencies: {\n bar: '1.0.0',\n },\n },\n 'bar@1.0.0': {},\n 'qar@1.1.0': {},\n 'comp1@pending:': {\n dependencies: {\n foo: '1.0.0(patch_hash=0000)',\n qar: '1.1.0',\n },\n },\n },\n packages: {\n 'comp1@pending:': {\n resolution: {\n directory: 'comps/comp1',\n type: 'directory',\n },\n },\n 'foo@1.0.0': {\n engines: {\n node: '>=8',\n npm: '>=6',\n },\n hasBin: true,\n os: ['darwin'],\n cpu: ['arm64'],\n resolution: {\n integrity: 'sha512-000',\n },\n },\n 'bar@1.0.0': {\n resolution: {\n integrity: 'sha512-111',\n },\n },\n 'qar@1.1.0': {\n resolution: {\n integrity: 'sha512-222',\n },\n },\n },\n });\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,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AAE;YACZQ,GAAG,EAAE;UACP;QACF,CAAC;QACD,WAAW,EAAE,CAAC,CAAC;QACf,WAAW,EAAE,CAAC,CAAC;QACf,gBAAgB,EAAE;UAChBR,YAAY,EAAE;YACZI,GAAG,EAAE,wBAAwB;YAC7BC,GAAG,EAAE;UACP;QACF;MACF,CAAC;MACDI,QAAQ,EAAE;QACR,gBAAgB,EAAE;UAChBC,UAAU,EAAE;YACVC,SAAS,EAAE,aAAa;YACxBC,IAAI,EAAE;UACR;QACF,CAAC;QACD,WAAW,EAAE;UACXC,OAAO,EAAE;YACPC,IAAI,EAAE,KAAK;YACXC,GAAG,EAAE;UACP,CAAC;UACDC,MAAM,EAAE,IAAI;UACZC,EAAE,EAAE,CAAC,QAAQ,CAAC;UACdC,GAAG,EAAE,CAAC,OAAO,CAAC;UACdR,UAAU,EAAE;YACVS,SAAS,EAAE;UACb;QACF,CAAC;QACD,WAAW,EAAE;UACXT,UAAU,EAAE;YACVS,SAAS,EAAE;UACb;QACF,CAAC;QACD,WAAW,EAAE;UACXT,UAAU,EAAE;YACVS,SAAS,EAAE;UACb;QACF;MACF;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.dependencies_pnpm@1.0.507/dist/pnpm.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.dependencies_pnpm@1.0.507/dist/pnpm.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.dependencies_pnpm@1.0.509/dist/pnpm.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.dependencies_pnpm@1.0.509/dist/pnpm.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/pnpm",
3
- "version": "1.0.507",
3
+ "version": "1.0.509",
4
4
  "homepage": "https://bit.cloud/teambit/dependencies/pnpm",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.dependencies",
8
8
  "name": "pnpm",
9
- "version": "1.0.507"
9
+ "version": "1.0.509"
10
10
  },
11
11
  "dependencies": {
12
12
  "@pnpm/config": "900.0.0",
@@ -17,6 +17,7 @@
17
17
  "@pnpm/lockfile.fs": "^900.0.0",
18
18
  "@pnpm/lockfile.types": "^900.0.0",
19
19
  "@pnpm/types": "900.0.0",
20
+ "normalize-path": "3.0.0",
20
21
  "@pnpm/logger": "900.0.0",
21
22
  "@pnpm/client": "900.0.1",
22
23
  "@pnpm/core": "900.0.1",
@@ -40,26 +41,27 @@
40
41
  "@teambit/dependencies.pnpm.dep-path": "0.0.2",
41
42
  "@teambit/harmony": "0.4.6",
42
43
  "@teambit/ui-foundation.ui.use-box.menu": "1.0.15",
43
- "@teambit/dependency-resolver": "1.0.506",
44
+ "@teambit/dependency-resolver": "1.0.508",
44
45
  "@teambit/toolbox.string.strip-trailing-char": "0.0.497",
45
- "@teambit/scope.objects": "0.0.13",
46
- "@teambit/logger": "0.0.1176",
46
+ "@teambit/scope.objects": "0.0.15",
47
+ "@teambit/logger": "0.0.1178",
47
48
  "@teambit/legacy.constants": "0.0.4",
48
- "@teambit/cli": "0.0.1083",
49
- "@teambit/cloud": "0.0.782",
49
+ "@teambit/cli": "0.0.1085",
50
+ "@teambit/cloud": "0.0.784",
50
51
  "@teambit/harmony.modules.feature-toggle": "0.0.12",
51
52
  "@teambit/legacy.logger": "0.0.6",
52
- "@teambit/component": "1.0.506",
53
- "@teambit/ui": "1.0.506"
53
+ "@teambit/component": "1.0.508",
54
+ "@teambit/ui": "1.0.508"
54
55
  },
55
56
  "devDependencies": {
56
57
  "@types/lodash": "4.14.165",
57
58
  "chai": "4.3.0",
59
+ "@types/normalize-path": "^3.0.0",
58
60
  "@types/semver": "7.3.4",
59
61
  "@types/fs-extra": "9.0.7",
60
62
  "@types/mocha": "9.1.0",
61
- "@teambit/harmony.envs.core-aspect-env": "0.0.63",
62
- "@teambit/dependencies.aspect-docs.pnpm": "0.0.170"
63
+ "@teambit/harmony.envs.core-aspect-env": "0.0.65",
64
+ "@teambit/dependencies.aspect-docs.pnpm": "0.0.171"
63
65
  },
64
66
  "peerDependencies": {
65
67
  "react": "^17.0.0 || ^18.0.0",