@teambit/component-sizer 1.0.106 → 1.0.108
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/component-sizer.aspect.ts +7 -0
- package/component-sizer.graphql.ts +46 -0
- package/component-sizer.main.runtime.ts +30 -0
- package/dist/component-sizer.composition.d.ts +2 -2
- package/dist/component-sizer.main.runtime.d.ts +1 -1
- package/dist/{preview-1703505948637.js → preview-1703647408454.js} +2 -2
- package/index.ts +5 -0
- package/package.json +17 -24
- package/tsconfig.json +16 -21
- package/types/asset.d.ts +15 -3
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Component } from '@teambit/component';
|
|
2
|
+
import { Schema } from '@teambit/graphql';
|
|
3
|
+
import gql from 'graphql-tag';
|
|
4
|
+
|
|
5
|
+
import { ComponentSizerMain } from './component-sizer.main.runtime';
|
|
6
|
+
|
|
7
|
+
export function componentSizerSchema(componentSizerMain: ComponentSizerMain): Schema {
|
|
8
|
+
return {
|
|
9
|
+
typeDefs: gql`
|
|
10
|
+
type ComponentSizedFile {
|
|
11
|
+
name: String
|
|
12
|
+
size: Int
|
|
13
|
+
compressedSize: Int
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type ComponentSize {
|
|
17
|
+
# breakdown for the component files sizes
|
|
18
|
+
files: [ComponentSizedFile]
|
|
19
|
+
# breakdown for the component assets sizes
|
|
20
|
+
assets: [ComponentSizedFile]
|
|
21
|
+
# total size of the component files (like js and css) (without assets)
|
|
22
|
+
totalFiles: Int
|
|
23
|
+
# total size of the component assets (like pngs) (without files)
|
|
24
|
+
totalAssets: Int
|
|
25
|
+
# total size of the component files and assets
|
|
26
|
+
total: Int
|
|
27
|
+
|
|
28
|
+
compressedTotalFiles: Int
|
|
29
|
+
compressedTotalAssets: Int
|
|
30
|
+
compressedTotal: Int
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
extend type Component {
|
|
34
|
+
# size of the component bundle
|
|
35
|
+
size: ComponentSize
|
|
36
|
+
}
|
|
37
|
+
`,
|
|
38
|
+
resolvers: {
|
|
39
|
+
Component: {
|
|
40
|
+
size: (component: Component) => {
|
|
41
|
+
return componentSizerMain.getComponentSize(component);
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { MainRuntime } from '@teambit/cli';
|
|
2
|
+
import ComponentAspect, { Component } from '@teambit/component';
|
|
3
|
+
import GraphqlAspect, { GraphqlMain } from '@teambit/graphql';
|
|
4
|
+
import PreviewAspect, { ComponentPreviewSize, PreviewMain } from '@teambit/preview';
|
|
5
|
+
import { ComponentSizerAspect } from './component-sizer.aspect';
|
|
6
|
+
import { componentSizerSchema } from './component-sizer.graphql';
|
|
7
|
+
|
|
8
|
+
export class ComponentSizerMain {
|
|
9
|
+
constructor(
|
|
10
|
+
/**
|
|
11
|
+
* preview aspect.
|
|
12
|
+
*/
|
|
13
|
+
private preview: PreviewMain
|
|
14
|
+
) {}
|
|
15
|
+
|
|
16
|
+
getComponentSize(component: Component): ComponentPreviewSize | undefined {
|
|
17
|
+
return this.preview.getComponentBundleSize(component);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static slots = [];
|
|
21
|
+
static dependencies = [PreviewAspect, GraphqlAspect, ComponentAspect];
|
|
22
|
+
static runtime = MainRuntime;
|
|
23
|
+
static async provider([preview, graphql]: [PreviewMain, GraphqlMain]) {
|
|
24
|
+
const componentSizer = new ComponentSizerMain(preview);
|
|
25
|
+
graphql.register(componentSizerSchema(componentSizer));
|
|
26
|
+
return componentSizer;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ComponentSizerAspect.addRuntime(ComponentSizerMain);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const Logo: () =>
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Logo: () => JSX.Element;
|
|
@@ -12,7 +12,7 @@ export declare class ComponentSizerMain {
|
|
|
12
12
|
*/
|
|
13
13
|
preview: PreviewMain);
|
|
14
14
|
getComponentSize(component: Component): ComponentPreviewSize | undefined;
|
|
15
|
-
static slots:
|
|
15
|
+
static slots: any[];
|
|
16
16
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
17
17
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
18
18
|
static provider([preview, graphql]: [PreviewMain, GraphqlMain]): Promise<ComponentSizerMain>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-sizer@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-sizer@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-sizer@1.0.108/dist/component-sizer.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-sizer@1.0.108/dist/component-sizer.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/index.ts
ADDED
package/package.json
CHANGED
|
@@ -1,38 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/component-sizer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.108",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/component/component-sizer",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "component-sizer",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.108"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"graphql-tag": "2.12.1",
|
|
13
|
-
"core-js": "^3.0.0",
|
|
14
|
-
"@babel/runtime": "7.20.0",
|
|
15
13
|
"@teambit/harmony": "0.4.6",
|
|
16
14
|
"@teambit/component.ui.component-size": "0.0.76",
|
|
17
|
-
"@teambit/component": "1.0.
|
|
18
|
-
"@teambit/graphql": "1.0.
|
|
19
|
-
"@teambit/cli": "0.0.
|
|
20
|
-
"@teambit/preview": "1.0.
|
|
21
|
-
"@teambit/docs": "1.0.
|
|
22
|
-
"@teambit/ui": "1.0.
|
|
15
|
+
"@teambit/component": "1.0.108",
|
|
16
|
+
"@teambit/graphql": "1.0.108",
|
|
17
|
+
"@teambit/cli": "0.0.840",
|
|
18
|
+
"@teambit/preview": "1.0.108",
|
|
19
|
+
"@teambit/docs": "1.0.108",
|
|
20
|
+
"@teambit/ui": "1.0.108"
|
|
23
21
|
},
|
|
24
22
|
"devDependencies": {
|
|
25
|
-
"@types/react": "^17.0.8",
|
|
26
23
|
"@types/mocha": "9.1.0",
|
|
27
|
-
"@types/
|
|
28
|
-
"@types/
|
|
29
|
-
"@
|
|
30
|
-
"@types/testing-library__jest-dom": "5.9.5"
|
|
24
|
+
"@types/jest": "^29.2.2",
|
|
25
|
+
"@types/testing-library__jest-dom": "^5.9.5",
|
|
26
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.13"
|
|
31
27
|
},
|
|
32
28
|
"peerDependencies": {
|
|
33
|
-
"
|
|
34
|
-
"react": "^
|
|
35
|
-
"
|
|
29
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
30
|
+
"@types/react": "^18.2.12",
|
|
31
|
+
"@teambit/legacy": "1.0.624"
|
|
36
32
|
},
|
|
37
33
|
"license": "Apache-2.0",
|
|
38
34
|
"optionalDependencies": {},
|
|
@@ -46,7 +42,7 @@
|
|
|
46
42
|
},
|
|
47
43
|
"private": false,
|
|
48
44
|
"engines": {
|
|
49
|
-
"node": ">=
|
|
45
|
+
"node": ">=16.0.0"
|
|
50
46
|
},
|
|
51
47
|
"repository": {
|
|
52
48
|
"type": "git",
|
|
@@ -55,12 +51,9 @@
|
|
|
55
51
|
"keywords": [
|
|
56
52
|
"bit",
|
|
57
53
|
"bit-aspect",
|
|
54
|
+
"bit-core-aspect",
|
|
58
55
|
"components",
|
|
59
56
|
"collaboration",
|
|
60
|
-
"web"
|
|
61
|
-
"react",
|
|
62
|
-
"react-components",
|
|
63
|
-
"angular",
|
|
64
|
-
"angular-components"
|
|
57
|
+
"web"
|
|
65
58
|
]
|
|
66
59
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"lib": [
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"DOM.Iterable",
|
|
8
|
-
"ScriptHost"
|
|
4
|
+
"esnext",
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.Iterable"
|
|
9
7
|
],
|
|
10
|
-
"target": "
|
|
11
|
-
"module": "
|
|
12
|
-
"jsx": "react",
|
|
13
|
-
"allowJs": true,
|
|
14
|
-
"composite": true,
|
|
8
|
+
"target": "es2020",
|
|
9
|
+
"module": "es2020",
|
|
10
|
+
"jsx": "react-jsx",
|
|
15
11
|
"declaration": true,
|
|
16
12
|
"sourceMap": true,
|
|
17
|
-
"skipLibCheck": true,
|
|
18
13
|
"experimentalDecorators": true,
|
|
19
|
-
"
|
|
14
|
+
"skipLibCheck": true,
|
|
20
15
|
"moduleResolution": "node",
|
|
21
16
|
"esModuleInterop": true,
|
|
22
|
-
"rootDir": ".",
|
|
23
17
|
"resolveJsonModule": true,
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"strictPropertyInitialization": false,
|
|
28
|
-
"strict": true,
|
|
29
|
-
"noImplicitAny": false,
|
|
30
|
-
"preserveConstEnums": true
|
|
18
|
+
"allowJs": true,
|
|
19
|
+
"outDir": "dist",
|
|
20
|
+
"emitDeclarationOnly": true
|
|
31
21
|
},
|
|
32
22
|
"exclude": [
|
|
23
|
+
"artifacts",
|
|
24
|
+
"public",
|
|
33
25
|
"dist",
|
|
26
|
+
"node_modules",
|
|
27
|
+
"package.json",
|
|
34
28
|
"esm.mjs",
|
|
35
|
-
"
|
|
29
|
+
"**/*.cjs",
|
|
30
|
+
"./dist"
|
|
36
31
|
],
|
|
37
32
|
"include": [
|
|
38
33
|
"**/*",
|
package/types/asset.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ declare module '*.png' {
|
|
|
5
5
|
declare module '*.svg' {
|
|
6
6
|
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
7
|
|
|
8
|
-
export const ReactComponent: FunctionComponent<
|
|
8
|
+
export const ReactComponent: FunctionComponent<
|
|
9
|
+
SVGProps<SVGSVGElement> & { title?: string }
|
|
10
|
+
>;
|
|
9
11
|
const src: string;
|
|
10
12
|
export default src;
|
|
11
13
|
}
|
|
12
|
-
|
|
13
|
-
// @TODO Gilad
|
|
14
14
|
declare module '*.jpg' {
|
|
15
15
|
const value: any;
|
|
16
16
|
export = value;
|
|
@@ -27,3 +27,15 @@ declare module '*.bmp' {
|
|
|
27
27
|
const value: any;
|
|
28
28
|
export = value;
|
|
29
29
|
}
|
|
30
|
+
declare module '*.otf' {
|
|
31
|
+
const value: any;
|
|
32
|
+
export = value;
|
|
33
|
+
}
|
|
34
|
+
declare module '*.woff' {
|
|
35
|
+
const value: any;
|
|
36
|
+
export = value;
|
|
37
|
+
}
|
|
38
|
+
declare module '*.woff2' {
|
|
39
|
+
const value: any;
|
|
40
|
+
export = value;
|
|
41
|
+
}
|