@teambit/bundler 0.0.639 → 0.0.640

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.
@@ -30,7 +30,18 @@ function devServerSchema(bundler) {
30
30
  `,
31
31
  resolvers: {
32
32
  Component: {
33
- server: component => {
33
+ server: (component, args, context) => {
34
+ // This is a bit of a hack to get the requested id. it assumes the variable name of
35
+ // the gotHost.get query is "id".
36
+ // see it in scopes/component/component/component.graphql.ts
37
+ const requestedId = context.body.variables.id; // if we ask for specific id with specific version it means we want to fetch if from scope
38
+ // so don't return the server url
39
+ // see https://github.com/teambit/bit/issues/5328
40
+
41
+ if (requestedId && requestedId.includes('@')) {
42
+ return {};
43
+ }
44
+
34
45
  const componentServer = bundler.getComponentServer(component);
35
46
  if (!componentServer) return {};
36
47
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["dev-server.graphql.ts"],"names":["devServerSchema","bundler","typeDefs","resolvers","Component","server","component","componentServer","getComponentServer","env","context","envRuntime","id","url"],"mappings":";;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAIA;AACO,SAASA,eAAT,CAAyBC,OAAzB,EAAuD;AAC5D,SAAO;AACLC,IAAAA,QAAQ,EAAE,kBAAI;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAVS;AAWLC,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAE;AACTC,QAAAA,MAAM,EAAGC,SAAD,IAA0B;AAChC,gBAAMC,eAAe,GAAGN,OAAO,CAACO,kBAAR,CAA2BF,SAA3B,CAAxB;AACA,cAAI,CAACC,eAAL,EAAsB,OAAO,EAAP;AAEtB,iBAAO;AACLE,YAAAA,GAAG,EAAEF,eAAe,CAACG,OAAhB,CAAwBC,UAAxB,CAAmCC,EADnC;AAELC,YAAAA,GAAG,EAAEN,eAAe,CAACM;AAFhB,WAAP;AAID;AATQ;AADF;AAXN,GAAP;AAyBD","sourcesContent":["import { Component } from '@teambit/component';\nimport { Schema } from '@teambit/graphql';\nimport { gql } from '@apollo/client';\n\nimport { BundlerMain } from './bundler.main.runtime';\n\n// TODO: this has to be refactored to the Preview aspect. with the entire preview logic here.\nexport function devServerSchema(bundler: BundlerMain): Schema {\n return {\n typeDefs: gql`\n extend type Component {\n server: ComponentServer\n }\n\n type ComponentServer {\n env: String\n url: String\n }\n `,\n resolvers: {\n Component: {\n server: (component: Component) => {\n const componentServer = bundler.getComponentServer(component);\n if (!componentServer) return {};\n\n return {\n env: componentServer.context.envRuntime.id,\n url: componentServer.url,\n };\n },\n },\n },\n };\n}\n"]}
1
+ {"version":3,"sources":["dev-server.graphql.ts"],"names":["devServerSchema","bundler","typeDefs","resolvers","Component","server","component","args","context","requestedId","body","variables","id","includes","componentServer","getComponentServer","env","envRuntime","url"],"mappings":";;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAIA;AACO,SAASA,eAAT,CAAyBC,OAAzB,EAAuD;AAC5D,SAAO;AACLC,IAAAA,QAAQ,EAAE,kBAAI;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAVS;AAWLC,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAE;AACTC,QAAAA,MAAM,EAAE,CAACC,SAAD,EAAuBC,IAAvB,EAA6BC,OAA7B,KAAyC;AAC/C;AACA;AACA;AACA,gBAAMC,WAAW,GAAGD,OAAO,CAACE,IAAR,CAAaC,SAAb,CAAuBC,EAA3C,CAJ+C,CAK/C;AACA;AACA;;AACA,cAAIH,WAAW,IAAIA,WAAW,CAACI,QAAZ,CAAqB,GAArB,CAAnB,EAA8C;AAC5C,mBAAO,EAAP;AACD;;AACD,gBAAMC,eAAe,GAAGb,OAAO,CAACc,kBAAR,CAA2BT,SAA3B,CAAxB;AACA,cAAI,CAACQ,eAAL,EAAsB,OAAO,EAAP;AAEtB,iBAAO;AACLE,YAAAA,GAAG,EAAEF,eAAe,CAACN,OAAhB,CAAwBS,UAAxB,CAAmCL,EADnC;AAELM,YAAAA,GAAG,EAAEJ,eAAe,CAACI;AAFhB,WAAP;AAID;AAnBQ;AADF;AAXN,GAAP;AAmCD","sourcesContent":["import { Component } from '@teambit/component';\nimport { Schema } from '@teambit/graphql';\nimport { gql } from '@apollo/client';\n\nimport { BundlerMain } from './bundler.main.runtime';\n\n// TODO: this has to be refactored to the Preview aspect. with the entire preview logic here.\nexport function devServerSchema(bundler: BundlerMain): Schema {\n return {\n typeDefs: gql`\n extend type Component {\n server: ComponentServer\n }\n\n type ComponentServer {\n env: String\n url: String\n }\n `,\n resolvers: {\n Component: {\n server: (component: Component, args, context) => {\n // This is a bit of a hack to get the requested id. it assumes the variable name of\n // the gotHost.get query is \"id\".\n // see it in scopes/component/component/component.graphql.ts\n const requestedId = context.body.variables.id;\n // if we ask for specific id with specific version it means we want to fetch if from scope\n // so don't return the server url\n // see https://github.com/teambit/bit/issues/5328\n if (requestedId && requestedId.includes('@')) {\n return {};\n }\n const componentServer = bundler.getComponentServer(component);\n if (!componentServer) return {};\n\n return {\n env: componentServer.context.envRuntime.id,\n url: componentServer.url,\n };\n },\n },\n },\n };\n}\n"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/bundler",
3
- "version": "0.0.639",
3
+ "version": "0.0.640",
4
4
  "homepage": "https://bit.dev/teambit/compilation/bundler",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.compilation",
8
8
  "name": "bundler",
9
- "version": "0.0.639"
9
+ "version": "0.0.640"
10
10
  },
11
11
  "dependencies": {
12
12
  "@teambit/harmony": "0.2.11",
@@ -15,12 +15,12 @@
15
15
  "lodash": "4.17.21",
16
16
  "@babel/runtime": "7.12.18",
17
17
  "core-js": "^3.0.0",
18
- "@teambit/envs": "0.0.639",
19
- "@teambit/builder": "0.0.639",
20
- "@teambit/component": "0.0.639",
21
- "@teambit/cli": "0.0.436",
22
- "@teambit/graphql": "0.0.639",
23
- "@teambit/pubsub": "0.0.639",
18
+ "@teambit/envs": "0.0.640",
19
+ "@teambit/builder": "0.0.640",
20
+ "@teambit/component": "0.0.640",
21
+ "@teambit/cli": "0.0.437",
22
+ "@teambit/graphql": "0.0.640",
23
+ "@teambit/pubsub": "0.0.640",
24
24
  "@teambit/toolbox.network.get-port": "0.0.112"
25
25
  },
26
26
  "devDependencies": {
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@apollo/client": "^3.0.0",
37
- "@teambit/legacy": "1.0.212",
37
+ "@teambit/legacy": "1.0.213",
38
38
  "react-dom": "^16.8.0 || ^17.0.0",
39
39
  "react": "^16.8.0 || ^17.0.0"
40
40
  },
@@ -62,7 +62,7 @@
62
62
  "react": "-"
63
63
  },
64
64
  "peerDependencies": {
65
- "@teambit/legacy": "1.0.212",
65
+ "@teambit/legacy": "1.0.213",
66
66
  "react-dom": "^16.8.0 || ^17.0.0",
67
67
  "react": "^16.8.0 || ^17.0.0"
68
68
  }