@teambit/code.ui.queries.get-file-content 0.0.504 → 0.0.505
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.
- package/dist/get-file-content.d.ts +2 -35
- package/dist/get-file-content.js +8 -20
- package/dist/get-file-content.js.map +1 -1
- package/get-file-content.ts +13 -7
- package/package.json +13 -11
- package/dist/preview-1670470092710.js +0 -7
- package/dist/tsconfig.json +0 -32
- package/package-tar/teambit-code.ui.queries.get-file-content-0.0.504.tgz +0 -0
- package/tsconfig.json +0 -32
- package/types/asset.d.ts +0 -29
- package/types/style.d.ts +0 -42
|
@@ -1,38 +1,5 @@
|
|
|
1
1
|
import { ComponentID } from '@teambit/component';
|
|
2
|
-
declare
|
|
3
|
-
getHost: {
|
|
4
|
-
id: string;
|
|
5
|
-
get: {
|
|
6
|
-
id: {
|
|
7
|
-
name: string;
|
|
8
|
-
version: string;
|
|
9
|
-
scope: string;
|
|
10
|
-
};
|
|
11
|
-
getFile?: string;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export declare function useFileContent(componentId?: ComponentID, filePath?: string, skip?: boolean): {
|
|
16
|
-
client: import("@apollo/client").ApolloClient<any>;
|
|
17
|
-
observable: import("@apollo/client").ObservableQuery<FileResult, import("@apollo/client").OperationVariables>;
|
|
18
|
-
previousData?: FileResult;
|
|
19
|
-
error?: import("@apollo/client").ApolloError;
|
|
20
|
-
loading: boolean;
|
|
21
|
-
networkStatus: import("@apollo/client").NetworkStatus;
|
|
22
|
-
called: boolean;
|
|
23
|
-
variables: import("@apollo/client").OperationVariables;
|
|
24
|
-
startPolling: (pollInterval: number) => void;
|
|
25
|
-
stopPolling: () => void;
|
|
26
|
-
subscribeToMore: <TSubscriptionData = FileResult, TSubscriptionVariables = import("@apollo/client").OperationVariables>(options: import("@apollo/client").SubscribeToMoreOptions<FileResult, TSubscriptionVariables, TSubscriptionData>) => () => void;
|
|
27
|
-
updateQuery: <TVars = import("@apollo/client").OperationVariables>(mapFn: (previousQueryResult: FileResult, options: Pick<import("@apollo/client").WatchQueryOptions<TVars, FileResult>, "variables">) => FileResult) => void;
|
|
28
|
-
refetch: (variables?: Partial<import("@apollo/client").OperationVariables>) => Promise<import("@apollo/client").ApolloQueryResult<FileResult>>;
|
|
29
|
-
reobserve: (newOptions?: Partial<import("@apollo/client").WatchQueryOptions<import("@apollo/client").OperationVariables, FileResult>>, newNetworkStatus?: import("@apollo/client").NetworkStatus) => Promise<import("@apollo/client").ApolloQueryResult<FileResult>>;
|
|
30
|
-
fetchMore: <TFetchData = FileResult, TFetchVars = import("@apollo/client").OperationVariables>(fetchMoreOptions: import("@apollo/client").FetchMoreQueryOptions<TFetchVars, TFetchData> & {
|
|
31
|
-
updateQuery?: (previousQueryResult: FileResult, options: {
|
|
32
|
-
fetchMoreResult: TFetchData;
|
|
33
|
-
variables: TFetchVars;
|
|
34
|
-
}) => FileResult;
|
|
35
|
-
}) => Promise<import("@apollo/client").ApolloQueryResult<TFetchData>>;
|
|
2
|
+
export declare function useFileContent(componentId?: ComponentID, filePath?: string, skip?: boolean, host?: string): {
|
|
36
3
|
fileContent: string;
|
|
4
|
+
loading: boolean;
|
|
37
5
|
};
|
|
38
|
-
export {};
|
package/dist/get-file-content.js
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.useFileContent =
|
|
3
|
+
exports.useFileContent = useFileContent;
|
|
15
4
|
const client_1 = require("@apollo/client");
|
|
16
5
|
const ui_foundation_ui_hooks_use_data_query_1 = require("@teambit/ui-foundation.ui.hooks.use-data-query");
|
|
17
6
|
const getFile = (0, client_1.gql) `
|
|
18
|
-
query getFile($id: String!, $path: String) {
|
|
19
|
-
getHost {
|
|
7
|
+
query getFile($id: String!, $extensionId: String, $path: String) {
|
|
8
|
+
getHost(id: $extensionId) {
|
|
20
9
|
id # used for GQL caching
|
|
21
10
|
get(id: $id) {
|
|
22
11
|
id {
|
|
@@ -30,15 +19,14 @@ const getFile = (0, client_1.gql) `
|
|
|
30
19
|
}
|
|
31
20
|
}
|
|
32
21
|
`;
|
|
33
|
-
function useFileContent(componentId, filePath, skip) {
|
|
22
|
+
function useFileContent(componentId, filePath, skip, host) {
|
|
34
23
|
var _a, _b;
|
|
35
24
|
const id = componentId === null || componentId === void 0 ? void 0 : componentId.toString();
|
|
36
|
-
const
|
|
37
|
-
variables: { id, path: filePath },
|
|
25
|
+
const { data, loading } = (0, ui_foundation_ui_hooks_use_data_query_1.useDataQuery)(getFile, {
|
|
26
|
+
variables: { id, path: filePath, extensionId: host },
|
|
38
27
|
skip: skip || !componentId || filePath === undefined,
|
|
39
|
-
})
|
|
28
|
+
});
|
|
40
29
|
const fileContent = (_b = (_a = data === null || data === void 0 ? void 0 : data.getHost) === null || _a === void 0 ? void 0 : _a.get) === null || _b === void 0 ? void 0 : _b.getFile;
|
|
41
|
-
return
|
|
30
|
+
return { fileContent, loading };
|
|
42
31
|
}
|
|
43
|
-
exports.useFileContent = useFileContent;
|
|
44
32
|
//# sourceMappingURL=get-file-content.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-file-content.js","sourceRoot":"","sources":["../get-file-content.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-file-content.js","sourceRoot":"","sources":["../get-file-content.ts"],"names":[],"mappings":";;AAmCA,wCAgBC;AAnDD,2CAAqC;AACrC,0GAA8E;AAG9E,MAAM,OAAO,GAAG,IAAA,YAAG,EAAA;;;;;;;;;;;;;;;CAelB,CAAC;AAgBF,SAAgB,cAAc,CAC5B,WAAyB,EACzB,QAAiB,EACjB,IAAc,EACd,IAAa;;IAEb,MAAM,EAAE,GAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,EAAE,CAAC;IAEpC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAA,oDAAY,EAAa,OAAO,EAAE;QAC1D,SAAS,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAG;QACrD,IAAI,EAAE,IAAI,IAAI,CAAC,WAAW,IAAI,QAAQ,KAAK,SAAS;KACrD,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,0CAAE,GAAG,0CAAE,OAAO,CAAC;IAEhD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AAClC,CAAC"}
|
package/get-file-content.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';
|
|
|
3
3
|
import { ComponentID } from '@teambit/component';
|
|
4
4
|
|
|
5
5
|
const getFile = gql`
|
|
6
|
-
query getFile($id: String!, $path: String) {
|
|
7
|
-
getHost {
|
|
6
|
+
query getFile($id: String!, $extensionId: String, $path: String) {
|
|
7
|
+
getHost(id: $extensionId) {
|
|
8
8
|
id # used for GQL caching
|
|
9
9
|
get(id: $id) {
|
|
10
10
|
id {
|
|
@@ -33,14 +33,20 @@ type FileResult = {
|
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
export function useFileContent(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
export function useFileContent(
|
|
37
|
+
componentId?: ComponentID,
|
|
38
|
+
filePath?: string,
|
|
39
|
+
skip?: boolean,
|
|
40
|
+
host?: string,
|
|
41
|
+
) {
|
|
42
|
+
const id = componentId?.toString();
|
|
43
|
+
|
|
44
|
+
const { data, loading } = useDataQuery<FileResult>(getFile, {
|
|
45
|
+
variables: { id, path: filePath, extensionId: host },
|
|
40
46
|
skip: skip || !componentId || filePath === undefined,
|
|
41
47
|
});
|
|
42
48
|
|
|
43
49
|
const fileContent = data?.getHost?.get?.getFile;
|
|
44
50
|
|
|
45
|
-
return { fileContent,
|
|
51
|
+
return { fileContent, loading };
|
|
46
52
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/code.ui.queries.get-file-content",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"homepage": "https://bit.
|
|
3
|
+
"version": "0.0.505",
|
|
4
|
+
"homepage": "https://bit.cloud/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.
|
|
9
|
+
"version": "0.0.505"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"core-js": "^3.0.0",
|
|
@@ -14,19 +14,21 @@
|
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/mocha": "9.1.0",
|
|
17
|
-
"@types/
|
|
18
|
-
"@babel/runtime": "7.20.0",
|
|
19
|
-
"@types/jest": "^26.0.0",
|
|
20
|
-
"@types/react-dom": "^17.0.5",
|
|
17
|
+
"@types/node": "12.20.4",
|
|
21
18
|
"@types/react": "^17.0.8",
|
|
22
|
-
"@types/
|
|
19
|
+
"@types/react-dom": "^17.0.5",
|
|
20
|
+
"@types/jest": "^26.0.0",
|
|
21
|
+
"@babel/runtime": "7.20.0",
|
|
22
|
+
"@types/testing-library__jest-dom": "5.9.5"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@apollo/client": "^3.6.0",
|
|
26
|
-
"react
|
|
27
|
-
"react": "^16.8.0 || ^17.0.0"
|
|
26
|
+
"react": "^16.8.0 || ^17.0.0",
|
|
27
|
+
"react-dom": "^16.8.0 || ^17.0.0"
|
|
28
28
|
},
|
|
29
29
|
"license": "Apache-2.0",
|
|
30
|
+
"optionalDependencies": {},
|
|
31
|
+
"peerDependenciesMeta": {},
|
|
30
32
|
"private": false,
|
|
31
33
|
"engines": {
|
|
32
34
|
"node": ">=12.22.0"
|
|
@@ -45,4 +47,4 @@
|
|
|
45
47
|
"angular",
|
|
46
48
|
"angular-components"
|
|
47
49
|
]
|
|
48
|
-
}
|
|
50
|
+
}
|
package/dist/tsconfig.json
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
}
|
|
Binary file
|
package/tsconfig.json
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
}
|
package/types/asset.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
declare module '*.png' {
|
|
2
|
-
const value: any;
|
|
3
|
-
export = value;
|
|
4
|
-
}
|
|
5
|
-
declare module '*.svg' {
|
|
6
|
-
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
|
-
|
|
8
|
-
export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
|
|
9
|
-
const src: string;
|
|
10
|
-
export default src;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// @TODO Gilad
|
|
14
|
-
declare module '*.jpg' {
|
|
15
|
-
const value: any;
|
|
16
|
-
export = value;
|
|
17
|
-
}
|
|
18
|
-
declare module '*.jpeg' {
|
|
19
|
-
const value: any;
|
|
20
|
-
export = value;
|
|
21
|
-
}
|
|
22
|
-
declare module '*.gif' {
|
|
23
|
-
const value: any;
|
|
24
|
-
export = value;
|
|
25
|
-
}
|
|
26
|
-
declare module '*.bmp' {
|
|
27
|
-
const value: any;
|
|
28
|
-
export = value;
|
|
29
|
-
}
|
package/types/style.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
declare module '*.module.css' {
|
|
2
|
-
const classes: { readonly [key: string]: string };
|
|
3
|
-
export default classes;
|
|
4
|
-
}
|
|
5
|
-
declare module '*.module.scss' {
|
|
6
|
-
const classes: { readonly [key: string]: string };
|
|
7
|
-
export default classes;
|
|
8
|
-
}
|
|
9
|
-
declare module '*.module.sass' {
|
|
10
|
-
const classes: { readonly [key: string]: string };
|
|
11
|
-
export default classes;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
declare module '*.module.less' {
|
|
15
|
-
const classes: { readonly [key: string]: string };
|
|
16
|
-
export default classes;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
declare module '*.less' {
|
|
20
|
-
const classes: { readonly [key: string]: string };
|
|
21
|
-
export default classes;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
declare module '*.css' {
|
|
25
|
-
const classes: { readonly [key: string]: string };
|
|
26
|
-
export default classes;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
declare module '*.sass' {
|
|
30
|
-
const classes: { readonly [key: string]: string };
|
|
31
|
-
export default classes;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
declare module '*.scss' {
|
|
35
|
-
const classes: { readonly [key: string]: string };
|
|
36
|
-
export default classes;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
declare module '*.mdx' {
|
|
40
|
-
const component: any;
|
|
41
|
-
export default component;
|
|
42
|
-
}
|