@teambit/envs 1.0.1079 → 1.0.1081

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.
@@ -11,6 +11,16 @@ function _graphqlTag() {
11
11
  };
12
12
  return data;
13
13
  }
14
+ /**
15
+ * Per-Component-instance cache for the env descriptor. `getDescriptor` is called once per GraphQL
16
+ * op that selects `Component.env { id icon }` — the lane-compare panel fires this for every visible
17
+ * component (10× per response in our profile). The descriptor only depends on the component's
18
+ * immutable aspect entries, so it's safe to cache for the lifetime of the underlying `Component`
19
+ * instance (WeakMap auto-evicts when the scope's componentsCache drops it).
20
+ *
21
+ * `null` sentinel distinguishes "computed and got undefined" from "not yet computed".
22
+ */
23
+ const envDescriptorCache = new WeakMap();
14
24
  function environmentsSchema(environments) {
15
25
  return {
16
26
  typeDefs: (0, _graphqlTag().gql)`
@@ -26,7 +36,12 @@ function environmentsSchema(environments) {
26
36
  resolvers: {
27
37
  Component: {
28
38
  env: component => {
29
- return environments.getDescriptor(component);
39
+ if (envDescriptorCache.has(component)) {
40
+ return envDescriptorCache.get(component) ?? undefined;
41
+ }
42
+ const descriptor = environments.getDescriptor(component);
43
+ envDescriptorCache.set(component, descriptor ?? null);
44
+ return descriptor;
30
45
  }
31
46
  }
32
47
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_graphqlTag","data","require","environmentsSchema","environments","typeDefs","gql","resolvers","Component","env","component","getDescriptor"],"sources":["environments.graphql.ts"],"sourcesContent":["import type { Component } from '@teambit/component';\nimport type { Schema } from '@teambit/graphql';\nimport { gql } from 'graphql-tag';\n\nimport type { EnvsMain } from './environments.main.runtime';\n\nexport function environmentsSchema(environments: EnvsMain): Schema {\n return {\n typeDefs: gql`\n extend type Component {\n env: ExtensionDescriptor\n }\n\n type ExtensionDescriptor {\n id: String\n icon: String\n }\n `,\n resolvers: {\n Component: {\n env: (component: Component) => {\n return environments.getDescriptor(component);\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;AAEA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIO,SAASE,kBAAkBA,CAACC,YAAsB,EAAU;EACjE,OAAO;IACLC,QAAQ,EAAE,IAAAC,iBAAG;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;IACDC,SAAS,EAAE;MACTC,SAAS,EAAE;QACTC,GAAG,EAAGC,SAAoB,IAAK;UAC7B,OAAON,YAAY,CAACO,aAAa,CAACD,SAAS,CAAC;QAC9C;MACF;IACF;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["_graphqlTag","data","require","envDescriptorCache","WeakMap","environmentsSchema","environments","typeDefs","gql","resolvers","Component","env","component","has","get","undefined","descriptor","getDescriptor","set"],"sources":["environments.graphql.ts"],"sourcesContent":["import type { Component } from '@teambit/component';\nimport type { Schema } from '@teambit/graphql';\nimport { gql } from 'graphql-tag';\n\nimport type { EnvsMain } from './environments.main.runtime';\n\n/**\n * Per-Component-instance cache for the env descriptor. `getDescriptor` is called once per GraphQL\n * op that selects `Component.env { id icon }` — the lane-compare panel fires this for every visible\n * component (10× per response in our profile). The descriptor only depends on the component's\n * immutable aspect entries, so it's safe to cache for the lifetime of the underlying `Component`\n * instance (WeakMap auto-evicts when the scope's componentsCache drops it).\n *\n * `null` sentinel distinguishes \"computed and got undefined\" from \"not yet computed\".\n */\nconst envDescriptorCache = new WeakMap<Component, ReturnType<EnvsMain['getDescriptor']> | null>();\n\nexport function environmentsSchema(environments: EnvsMain): Schema {\n return {\n typeDefs: gql`\n extend type Component {\n env: ExtensionDescriptor\n }\n\n type ExtensionDescriptor {\n id: String\n icon: String\n }\n `,\n resolvers: {\n Component: {\n env: (component: Component) => {\n if (envDescriptorCache.has(component)) {\n return envDescriptorCache.get(component) ?? undefined;\n }\n const descriptor = environments.getDescriptor(component);\n envDescriptorCache.set(component, descriptor ?? null);\n return descriptor;\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;AAEA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,kBAAkB,GAAG,IAAIC,OAAO,CAA0D,CAAC;AAE1F,SAASC,kBAAkBA,CAACC,YAAsB,EAAU;EACjE,OAAO;IACLC,QAAQ,EAAE,IAAAC,iBAAG;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;IACDC,SAAS,EAAE;MACTC,SAAS,EAAE;QACTC,GAAG,EAAGC,SAAoB,IAAK;UAC7B,IAAIT,kBAAkB,CAACU,GAAG,CAACD,SAAS,CAAC,EAAE;YACrC,OAAOT,kBAAkB,CAACW,GAAG,CAACF,SAAS,CAAC,IAAIG,SAAS;UACvD;UACA,MAAMC,UAAU,GAAGV,YAAY,CAACW,aAAa,CAACL,SAAS,CAAC;UACxDT,kBAAkB,CAACe,GAAG,CAACN,SAAS,EAAEI,UAAU,IAAI,IAAI,CAAC;UACrD,OAAOA,UAAU;QACnB;MACF;IACF;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.envs_envs@1.0.1079/dist/env.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.envs_envs@1.0.1079/dist/envs.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.envs_envs@1.0.1081/dist/env.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.envs_envs@1.0.1081/dist/envs.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/envs",
3
- "version": "1.0.1079",
3
+ "version": "1.0.1081",
4
4
  "homepage": "https://bit.cloud/teambit/envs/envs",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.envs",
8
8
  "name": "envs",
9
- "version": "1.0.1079"
9
+ "version": "1.0.1081"
10
10
  },
11
11
  "dependencies": {
12
12
  "comment-json": "4.2.5",
@@ -18,39 +18,39 @@
18
18
  "@teambit/harmony": "0.4.12",
19
19
  "@teambit/bit-error": "0.0.404",
20
20
  "@teambit/component-id": "1.2.4",
21
- "@teambit/dependency-resolver": "1.0.1079",
22
- "@teambit/component": "1.0.1079",
23
- "@teambit/aspect-loader": "1.0.1079",
24
- "@teambit/cli": "0.0.1357",
25
- "@teambit/logger": "0.0.1450",
26
- "@teambit/worker": "0.0.1661",
27
- "@teambit/builder": "1.0.1079",
28
- "@teambit/bundler": "1.0.1079",
29
- "@teambit/compiler": "1.0.1079",
30
- "@teambit/formatter": "1.0.1079",
31
- "@teambit/isolator": "1.0.1079",
32
- "@teambit/linter": "1.0.1079",
33
- "@teambit/pkg": "1.0.1079",
34
- "@teambit/preview": "1.0.1079",
35
- "@teambit/schema": "1.0.1079",
36
- "@teambit/tester": "1.0.1079",
37
- "@teambit/typescript": "1.0.1079",
38
- "@teambit/webpack": "1.0.1079",
39
- "@teambit/graphql": "1.0.1079",
40
- "@teambit/component-issues": "0.0.180",
41
- "@teambit/component.sources": "0.0.192",
42
- "@teambit/dev-files": "1.0.1079",
43
- "@teambit/issues": "1.0.1079",
44
- "@teambit/legacy.consumer-component": "0.0.141",
45
- "@teambit/legacy.extension-data": "0.0.142",
46
- "@teambit/toolbox.array.duplications-finder": "0.0.10",
47
- "@teambit/cli-table": "0.0.57"
21
+ "@teambit/dependency-resolver": "1.0.1081",
22
+ "@teambit/component": "1.0.1081",
23
+ "@teambit/aspect-loader": "1.0.1081",
24
+ "@teambit/cli": "0.0.1358",
25
+ "@teambit/logger": "0.0.1451",
26
+ "@teambit/worker": "0.0.1662",
27
+ "@teambit/builder": "1.0.1081",
28
+ "@teambit/bundler": "1.0.1081",
29
+ "@teambit/compiler": "1.0.1081",
30
+ "@teambit/formatter": "1.0.1081",
31
+ "@teambit/isolator": "1.0.1081",
32
+ "@teambit/linter": "1.0.1081",
33
+ "@teambit/pkg": "1.0.1081",
34
+ "@teambit/preview": "1.0.1081",
35
+ "@teambit/schema": "1.0.1081",
36
+ "@teambit/tester": "1.0.1081",
37
+ "@teambit/typescript": "1.0.1081",
38
+ "@teambit/webpack": "1.0.1081",
39
+ "@teambit/graphql": "1.0.1081",
40
+ "@teambit/component-issues": "0.0.181",
41
+ "@teambit/component.sources": "0.0.193",
42
+ "@teambit/dev-files": "1.0.1081",
43
+ "@teambit/issues": "1.0.1081",
44
+ "@teambit/legacy.consumer-component": "0.0.142",
45
+ "@teambit/legacy.extension-data": "0.0.143",
46
+ "@teambit/toolbox.array.duplications-finder": "0.0.11",
47
+ "@teambit/cli-table": "0.0.58"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/lodash": "4.14.165",
51
51
  "@types/mocha": "9.1.0",
52
- "@teambit/harmony.envs.core-aspect-env": "2.0.4",
53
- "@teambit/envs.aspect-docs.envs": "0.0.181"
52
+ "@teambit/envs.aspect-docs.envs": "0.0.181",
53
+ "@teambit/harmony.envs.core-aspect-env": "2.0.3"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "react": "^17.0.0 || ^18.0.0 || ^19.0.0"