@teambit/schema 0.0.736 → 0.0.737
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/parser.d.ts +2 -2
- package/dist/schema.cmd.d.ts +1 -11
- package/dist/schema.main.runtime.d.ts +2 -2
- package/dist/schema.main.runtime.js.map +1 -1
- package/package-tar/teambit-schema-0.0.737.tgz +0 -0
- package/package.json +8 -8
- package/{preview-1652844422371.js → preview-1652930732694.js} +2 -2
- package/tsconfig.json +1 -1
- package/package-tar/teambit-schema-0.0.736.tgz +0 -0
package/dist/parser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Export } from '@teambit/semantics.entities.semantic-schema';
|
|
2
2
|
export interface Parser {
|
|
3
3
|
/**
|
|
4
4
|
* regex to apply on which components compiler applies.
|
|
@@ -7,5 +7,5 @@ export interface Parser {
|
|
|
7
7
|
/**
|
|
8
8
|
* parse a module.
|
|
9
9
|
*/
|
|
10
|
-
parseModule(modulePath: string):
|
|
10
|
+
parseModule(modulePath: string): Export[];
|
|
11
11
|
}
|
package/dist/schema.cmd.d.ts
CHANGED
|
@@ -10,16 +10,6 @@ export declare class SchemaCommand implements Command {
|
|
|
10
10
|
options: CommandOptions;
|
|
11
11
|
constructor(schema: SchemaMain, component: ComponentMain);
|
|
12
12
|
report([idStr]: [any]): Promise<string>;
|
|
13
|
-
json([idStr]: [any]): Promise<
|
|
14
|
-
constructorName: string;
|
|
15
|
-
module: {
|
|
16
|
-
constructorName: string;
|
|
17
|
-
namespace: string | undefined;
|
|
18
|
-
exports: (Record<string, any> & {
|
|
19
|
-
constructorName: string;
|
|
20
|
-
})[];
|
|
21
|
-
};
|
|
22
|
-
filename: string;
|
|
23
|
-
}>;
|
|
13
|
+
json([idStr]: [any]): Promise<Record<string, any>>;
|
|
24
14
|
private getSchema;
|
|
25
15
|
}
|
|
@@ -3,7 +3,7 @@ import { Component, ComponentMain } from '@teambit/component';
|
|
|
3
3
|
import { SlotRegistry } from '@teambit/harmony';
|
|
4
4
|
import { GraphqlMain } from '@teambit/graphql';
|
|
5
5
|
import { EnvsMain } from '@teambit/envs';
|
|
6
|
-
import {
|
|
6
|
+
import { APISchema, Export } from '@teambit/semantics.entities.semantic-schema';
|
|
7
7
|
import { Parser } from './parser';
|
|
8
8
|
import { SchemaExtractor } from './schema-extractor';
|
|
9
9
|
export declare type ParserSlot = SlotRegistry<Parser>;
|
|
@@ -35,7 +35,7 @@ export declare class SchemaMain {
|
|
|
35
35
|
/**
|
|
36
36
|
* parse a module into a component schema.
|
|
37
37
|
*/
|
|
38
|
-
parseModule(path: string):
|
|
38
|
+
parseModule(path: string): Export[];
|
|
39
39
|
getSchemaExtractor(component: Component): SchemaExtractor;
|
|
40
40
|
/**
|
|
41
41
|
* get a schema of a component.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["schema.main.runtime.ts"],"names":["SchemaMain","constructor","parserSlot","envs","config","getDefaultParser","get","defaultParser","parseModule","path","parsers","toArray","maybeParser","find","parser","match","extension","getSchemaExtractor","component","env","getEnv","Error","name","getSchema","schemaExtractor","extract","registerParser","register","provider","cli","graphql","schema","SchemaCommand","MainRuntime","EnvsAspect","CLIAspect","ComponentAspect","GraphqlAspect","Slot","withType","SchemaAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAWA;AACA;AACA;AACO,MAAMA,UAAN,CAAiB;AACtBC,EAAAA,WAAW;AACT;AACJ;AACA;AACYC,EAAAA,UAJC,EAMDC,IANC,EAQDC,MARC,EAST;AAAA,SALQF,UAKR,GALQA,UAKR;AAAA,SAHQC,IAGR,GAHQA,IAGR;AAAA,SADQC,MACR,GADQA,MACR;AAAE;AAEJ;AACF;AACA;;;AACEC,EAAAA,gBAAgB,GAAW;AACzB,WAAO,KAAKH,UAAL,CAAgBI,GAAhB,CAAoB,KAAKF,MAAL,CAAYG,aAAhC,CAAP;AACD;AAED;AACF;AACA;;;AACEC,EAAAA,WAAW,CAACC,IAAD,
|
|
1
|
+
{"version":3,"sources":["schema.main.runtime.ts"],"names":["SchemaMain","constructor","parserSlot","envs","config","getDefaultParser","get","defaultParser","parseModule","path","parsers","toArray","maybeParser","find","parser","match","extension","getSchemaExtractor","component","env","getEnv","Error","name","getSchema","schemaExtractor","extract","registerParser","register","provider","cli","graphql","schema","SchemaCommand","MainRuntime","EnvsAspect","CLIAspect","ComponentAspect","GraphqlAspect","Slot","withType","SchemaAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAWA;AACA;AACA;AACO,MAAMA,UAAN,CAAiB;AACtBC,EAAAA,WAAW;AACT;AACJ;AACA;AACYC,EAAAA,UAJC,EAMDC,IANC,EAQDC,MARC,EAST;AAAA,SALQF,UAKR,GALQA,UA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BAAX,KAAkC,WAAtC,EAAmD;AACjD,YAAM,IAAII,KAAJ,CAAW,kCAAiCF,GAAG,CAACG,IAAK,EAArD,CAAN;AACD;;AACD,UAAME,eAAgC,GAAGL,GAAG,CAACF,kBAAJ,EAAzC;AACA,WAAOO,eAAe,CAACC,OAAhB,CAAwBP,SAAxB,CAAP;AACD;AAED;AACF;AACA;;;AACEQ,EAAAA,cAAc,CAACZ,MAAD,EAA6B;AACzC,SAAKZ,UAAL,CAAgByB,QAAhB,CAAyBb,MAAzB;AACA,WAAO,IAAP;AACD;;AAUoB,eAARc,QAAQ,CACnB,CAACzB,IAAD,EAAO0B,GAAP,EAAYX,SAAZ,EAAuBY,OAAvB,CADmB,EAEnB1B,MAFmB,EAGnB,CAACF,UAAD,CAHmB,EAInB;AACA,UAAM6B,MAAM,GAAG,IAAI/B,UAAJ,CAAeE,UAAf,EAA2BC,IAA3B,EAAiCC,MAAjC,CAAf;AACAyB,IAAAA,GAAG,CAACF,QAAJ,CAAa,KAAIK,wBAAJ,EAAkBD,MAAlB,EAA0Bb,SAA1B,CAAb;AACAY,IAAAA,OAAO,CAACH,QAAR,CAAiB,6BAAaI,MAAb,CAAjB,EAHA,CAKA;AACA;AACA;AACA;;AAEA,WAAOA,MAAP;AACD;;AA1FqB;;;gCAAX/B,U,aAmEMiC,kB;gCAnENjC,U,kBAoEW,CAACkC,kBAAD,EAAaC,gBAAb,EAAwBC,oBAAxB,EAAyCC,kBAAzC,C;gCApEXrC,U,WAqEI,CAACsC,gBAAKC,QAAL,EAAD,C;gCArEJvC,U,mBAuEY;AACrBO,EAAAA,aAAa,EAAE;AADM,C;;AAsBzBiC,uBAAaC,UAAb,CAAwBzC,UAAxB","sourcesContent":["import { MainRuntime, CLIMain, CLIAspect } from '@teambit/cli';\nimport ComponentAspect, { Component, ComponentMain } from '@teambit/component';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport GraphqlAspect, { GraphqlMain } from '@teambit/graphql';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { APISchema, Export } from '@teambit/semantics.entities.semantic-schema';\nimport { Parser } from './parser';\nimport { SchemaAspect } from './schema.aspect';\nimport { SchemaExtractor } from './schema-extractor';\nimport { SchemaCommand } from './schema.cmd';\nimport { schemaSchema } from './schema.graphql';\n\nexport type ParserSlot = SlotRegistry<Parser>;\n\nexport type SchemaConfig = {\n /**\n * default parser\n */\n defaultParser: string;\n};\n\n/**\n * extension for extracting component schemas.\n */\nexport class SchemaMain {\n constructor(\n /**\n * parsers slot.\n */\n private parserSlot: ParserSlot,\n\n private envs: EnvsMain,\n\n private config: SchemaConfig\n ) {}\n\n /**\n * get the default parser.\n */\n getDefaultParser(): Parser {\n return this.parserSlot.get(this.config.defaultParser) as Parser;\n }\n\n /**\n * parse a module into a component schema.\n */\n parseModule(path: string): Export[] {\n const parsers = this.parserSlot.toArray();\n let maybeParser = parsers.find(([, parser]) => {\n const match = path.match(parser.extension);\n return match;\n });\n\n if (!maybeParser) {\n maybeParser = [this.config.defaultParser, this.getDefaultParser()];\n }\n\n const [, parser] = maybeParser;\n return parser.parseModule(path);\n }\n\n getSchemaExtractor(component: Component) {\n const env = this.envs.getEnv(component).env;\n if (typeof env.getSchemaExtractor === 'undefined') {\n throw new Error(`No SchemaExtractor defined for ${env.name}`);\n }\n\n return env.getSchemaExtractor();\n }\n\n /**\n * get a schema of a component.\n * @param component target component.\n */\n async getSchema(component: Component): Promise<APISchema> {\n const env = this.envs.getEnv(component).env;\n if (typeof env.getSchemaExtractor === 'undefined') {\n throw new Error(`No SchemaExtractor defined for ${env.name}`);\n }\n const schemaExtractor: SchemaExtractor = env.getSchemaExtractor();\n return schemaExtractor.extract(component);\n }\n\n /**\n * register a new parser.\n */\n registerParser(parser: Parser): SchemaMain {\n this.parserSlot.register(parser);\n return this;\n }\n\n static runtime = MainRuntime;\n static dependencies = [EnvsAspect, CLIAspect, ComponentAspect, GraphqlAspect];\n static slots = [Slot.withType<Parser>()];\n\n static defaultConfig = {\n defaultParser: 'teambit.typescript/typescript',\n };\n\n static async provider(\n [envs, cli, component, graphql]: [EnvsMain, CLIMain, ComponentMain, GraphqlMain],\n config: SchemaConfig,\n [parserSlot]: [ParserSlot]\n ) {\n const schema = new SchemaMain(parserSlot, envs, config);\n cli.register(new SchemaCommand(schema, component));\n graphql.register(schemaSchema(schema));\n\n // workspace.onComponentLoad(async (component) => {\n // const apiSchema = await schema.getSchema(component);\n // return {};\n // });\n\n return schema;\n }\n}\n\nSchemaAspect.addRuntime(SchemaMain);\n"]}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/schema",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.737",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/semantics/schema",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.semantics",
|
|
8
8
|
"name": "schema",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.737"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"graphql-tag": "2.12.1",
|
|
13
13
|
"@babel/runtime": "7.12.18",
|
|
14
14
|
"core-js": "^3.0.0",
|
|
15
15
|
"@teambit/harmony": "0.3.3",
|
|
16
|
-
"@teambit/semantics.entities.semantic-schema": "0.0.
|
|
17
|
-
"@teambit/builder": "0.0.
|
|
18
|
-
"@teambit/component": "0.0.
|
|
16
|
+
"@teambit/semantics.entities.semantic-schema": "0.0.11",
|
|
17
|
+
"@teambit/builder": "0.0.737",
|
|
18
|
+
"@teambit/component": "0.0.737",
|
|
19
19
|
"@teambit/cli": "0.0.491",
|
|
20
|
-
"@teambit/scope": "0.0.
|
|
21
|
-
"@teambit/envs": "0.0.
|
|
22
|
-
"@teambit/graphql": "0.0.
|
|
20
|
+
"@teambit/scope": "0.0.737",
|
|
21
|
+
"@teambit/envs": "0.0.737",
|
|
22
|
+
"@teambit/graphql": "0.0.737"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/react": "^17.0.8",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.semantics_schema@0.0.
|
|
2
|
-
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.semantics_schema@0.0.
|
|
1
|
+
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.semantics_schema@0.0.737/dist/schema.composition.js')]
|
|
2
|
+
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.semantics_schema@0.0.737/dist/schema.docs.mdx')]
|
package/tsconfig.json
CHANGED
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
"declaration": true,
|
|
16
16
|
"sourceMap": true,
|
|
17
17
|
"skipLibCheck": true,
|
|
18
|
+
"experimentalDecorators": true,
|
|
18
19
|
"outDir": "dist",
|
|
19
20
|
"moduleResolution": "node",
|
|
20
21
|
"esModuleInterop": true,
|
|
21
22
|
"rootDir": ".",
|
|
22
23
|
"resolveJsonModule": true,
|
|
23
24
|
"emitDeclarationOnly": true,
|
|
24
|
-
"experimentalDecorators": true,
|
|
25
25
|
"emitDecoratorMetadata": true,
|
|
26
26
|
"allowSyntheticDefaultImports": true,
|
|
27
27
|
"strictPropertyInitialization": false,
|
|
Binary file
|