@teambit/code.ui.queries.get-file-content 0.0.486 → 0.0.489

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.
@@ -12,7 +12,7 @@ declare type FileResult = {
12
12
  };
13
13
  };
14
14
  };
15
- export declare function useFileContent(componentId: ComponentID, filePath?: string): {
15
+ export declare function useFileContent(componentId?: ComponentID, filePath?: string): {
16
16
  client: import("@apollo/client").ApolloClient<any>;
17
17
  previousData?: FileResult;
18
18
  error?: import("@apollo/client").ApolloError;
@@ -32,10 +32,10 @@ const getFile = (0, client_1.gql) `
32
32
  `;
33
33
  function useFileContent(componentId, filePath) {
34
34
  var _a;
35
- const id = componentId.toString();
35
+ const id = componentId === null || componentId === void 0 ? void 0 : componentId.toString();
36
36
  const _b = (0, ui_foundation_ui_hooks_use_data_query_1.useDataQuery)(getFile, {
37
37
  variables: { id, path: filePath },
38
- skip: filePath === undefined,
38
+ skip: !componentId || filePath === undefined,
39
39
  }), { data } = _b, rest = __rest(_b, ["data"]);
40
40
  const fileContent = (_a = data === null || data === void 0 ? void 0 : data.getHost) === null || _a === void 0 ? void 0 : _a.get.getFile;
41
41
  return Object.assign({ fileContent }, rest);
@@ -1 +1 @@
1
- {"version":3,"file":"get-file-content.js","sourceRoot":"","sources":["../get-file-content.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,2CAAqC;AACrC,0GAA8E;AAG9E,MAAM,OAAO,GAAG,IAAA,YAAG,EAAA;;;;;;;;;;;;;;;CAelB,CAAC;AAgBF,SAAgB,cAAc,CAAC,WAAwB,EAAE,QAAiB;;IACxE,MAAM,EAAE,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;IAClC,MAAM,KAAoB,IAAA,oDAAY,EAAa,OAAO,EAAE;QAC1D,SAAS,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACjC,IAAI,EAAE,QAAQ,KAAK,SAAS;KAC7B,CAAC,EAHI,EAAE,IAAI,OAGV,EAHe,IAAI,cAAf,QAAiB,CAGrB,CAAC;IAEH,MAAM,WAAW,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,0CAAE,GAAG,CAAC,OAAO,CAAC;IAE/C,uBAAS,WAAW,IAAK,IAAI,EAAG;AAClC,CAAC;AAVD,wCAUC"}
1
+ {"version":3,"file":"get-file-content.js","sourceRoot":"","sources":["../get-file-content.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,2CAAqC;AACrC,0GAA8E;AAG9E,MAAM,OAAO,GAAG,IAAA,YAAG,EAAA;;;;;;;;;;;;;;;CAelB,CAAC;AAgBF,SAAgB,cAAc,CAAC,WAAyB,EAAE,QAAiB;;IACzE,MAAM,EAAE,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,EAAE,CAAC;IACnC,MAAM,KAAoB,IAAA,oDAAY,EAAa,OAAO,EAAE;QAC1D,SAAS,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACjC,IAAI,EAAE,CAAC,WAAW,IAAI,QAAQ,KAAK,SAAS;KAC7C,CAAC,EAHI,EAAE,IAAI,OAGV,EAHe,IAAI,cAAf,QAAiB,CAGrB,CAAC;IAEH,MAAM,WAAW,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,0CAAE,GAAG,CAAC,OAAO,CAAC;IAE/C,uBAAS,WAAW,IAAK,IAAI,EAAG;AAClC,CAAC;AAVD,wCAUC"}
@@ -0,0 +1,32 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": [
4
+ "es2019",
5
+ "DOM",
6
+ "ES6",
7
+ "DOM.Iterable"
8
+ ],
9
+ "target": "es2015",
10
+ "module": "CommonJS",
11
+ "jsx": "react",
12
+ "allowJs": true,
13
+ "composite": true,
14
+ "declaration": true,
15
+ "sourceMap": true,
16
+ "skipLibCheck": true,
17
+ "experimentalDecorators": true,
18
+ "outDir": "dist",
19
+ "moduleResolution": "node",
20
+ "esModuleInterop": true,
21
+ "rootDir": ".",
22
+ "resolveJsonModule": true
23
+ },
24
+ "exclude": [
25
+ "dist",
26
+ "package.json"
27
+ ],
28
+ "include": [
29
+ "**/*",
30
+ "**/*.json"
31
+ ]
32
+ }
@@ -33,11 +33,11 @@ type FileResult = {
33
33
  };
34
34
  };
35
35
 
36
- export function useFileContent(componentId: ComponentID, filePath?: string) {
37
- const id = componentId.toString();
36
+ export function useFileContent(componentId?: ComponentID, filePath?: string) {
37
+ const id = componentId?.toString();
38
38
  const { data, ...rest } = useDataQuery<FileResult>(getFile, {
39
39
  variables: { id, path: filePath },
40
- skip: filePath === undefined,
40
+ skip: !componentId || filePath === undefined,
41
41
  });
42
42
 
43
43
  const fileContent = data?.getHost?.get.getFile;
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@teambit/code.ui.queries.get-file-content",
3
- "version": "0.0.486",
3
+ "version": "0.0.489",
4
4
  "homepage": "https://bit.dev/teambit/code/ui/queries/get-file-content",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.code",
8
8
  "name": "ui/queries/get-file-content",
9
- "version": "0.0.486"
9
+ "version": "0.0.489"
10
10
  },
11
11
  "dependencies": {
12
12
  "core-js": "^3.0.0",
13
- "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.486"
13
+ "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.488"
14
14
  },
15
15
  "devDependencies": {
16
- "@types/mocha": "5.2.7",
16
+ "@types/mocha": "9.1.0",
17
17
  "@types/testing-library__jest-dom": "5.9.5",
18
18
  "@babel/runtime": "7.12.18",
19
19
  "@types/jest": "^26.0.0",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@teambit/legacy": "-",
42
- "@types/mocha": "5.2.7",
42
+ "@types/mocha": "9.1.0",
43
43
  "@types/testing-library__jest-dom": "5.9.5",
44
44
  "@babel/runtime": "7.12.18",
45
45
  "@types/jest": "^26.0.0",
@@ -0,0 +1,5 @@
1
+
2
+
3
+
4
+ export const compositions = [];
5
+ export const overview = []
package/tsconfig.json CHANGED
@@ -7,13 +7,14 @@
7
7
  "DOM.Iterable"
8
8
  ],
9
9
  "target": "es2015",
10
- "module": "commonjs",
10
+ "module": "CommonJS",
11
11
  "jsx": "react",
12
12
  "allowJs": true,
13
13
  "composite": true,
14
14
  "declaration": true,
15
15
  "sourceMap": true,
16
16
  "skipLibCheck": true,
17
+ "experimentalDecorators": true,
17
18
  "outDir": "dist",
18
19
  "moduleResolution": "node",
19
20
  "esModuleInterop": true,
@@ -21,6 +22,11 @@
21
22
  "resolveJsonModule": true
22
23
  },
23
24
  "exclude": [
24
- "dist"
25
+ "dist",
26
+ "package.json"
27
+ ],
28
+ "include": [
29
+ "**/*",
30
+ "**/*.json"
25
31
  ]
26
32
  }