@teambit/semantics.entities.semantic-schema
Advanced tools
Comparing version 0.0.51 to 0.0.53
@@ -18,2 +18,3 @@ import { Transform, plainToInstance } from 'class-transformer'; | ||
import { componentIdTransformer } from './class-transformers/comp-id-transformer'; | ||
import { TagName } from './schemas/docs/tag'; | ||
@@ -30,2 +31,5 @@ export class APISchema extends SchemaNode { | ||
@Transform(schemaObjArrayToInstances) | ||
readonly taggedModuleExports: SchemaNode[]; | ||
constructor(readonly location: Location, module: ModuleSchema, internals: ModuleSchema[], componentId: ComponentID) { | ||
@@ -36,4 +40,10 @@ super(); | ||
this.componentId = componentId; | ||
this.taggedModuleExports = this.listTaggedExports(module); | ||
} | ||
listTaggedExports(module?: ModuleSchema) { | ||
if (!module) return []; | ||
return module.exports.filter((e) => e.doc?.hasTag(TagName.exports)); | ||
} | ||
toString() { | ||
@@ -40,0 +50,0 @@ return JSON.stringify( |
@@ -9,3 +9,5 @@ import { ComponentID } from '@teambit/component-id'; | ||
readonly componentId: ComponentID; | ||
readonly taggedModuleExports: SchemaNode[]; | ||
constructor(location: Location, module: ModuleSchema, internals: ModuleSchema[], componentId: ComponentID); | ||
listTaggedExports(module?: ModuleSchema): SchemaNode[]; | ||
toString(): string; | ||
@@ -12,0 +14,0 @@ toStringPerType(): string; |
@@ -19,2 +19,3 @@ "use strict"; | ||
const comp_id_transformer_1 = require("./class-transformers/comp-id-transformer"); | ||
const tag_1 = require("./schemas/docs/tag"); | ||
class APISchema extends schema_node_1.SchemaNode { | ||
@@ -27,3 +28,9 @@ constructor(location, module, internals, componentId) { | ||
this.componentId = componentId; | ||
this.taggedModuleExports = this.listTaggedExports(module); | ||
} | ||
listTaggedExports(module) { | ||
if (!module) | ||
return []; | ||
return module.exports.filter((e) => { var _a; return (_a = e.doc) === null || _a === void 0 ? void 0 : _a.hasTag(tag_1.TagName.exports); }); | ||
} | ||
toString() { | ||
@@ -71,3 +78,6 @@ return JSON.stringify(this.module.exports.map((exp) => exp.toObject()), undefined, 2); | ||
], APISchema.prototype, "componentId", void 0); | ||
__decorate([ | ||
(0, class_transformer_1.Transform)(class_transformers_1.schemaObjArrayToInstances) | ||
], APISchema.prototype, "taggedModuleExports", void 0); | ||
exports.APISchema = APISchema; | ||
//# sourceMappingURL=api-schema.js.map |
@@ -32,3 +32,4 @@ import { Location, SchemaNode } from '../../schema-node'; | ||
return = "return", | ||
deprecated = "deprecated" | ||
deprecated = "deprecated", | ||
exports = "exports" | ||
} |
@@ -43,3 +43,4 @@ "use strict"; | ||
TagName["deprecated"] = "deprecated"; | ||
TagName["exports"] = "exports"; | ||
})(TagName = exports.TagName || (exports.TagName = {})); | ||
//# sourceMappingURL=tag.js.map |
{ | ||
"name": "@teambit/semantics.entities.semantic-schema", | ||
"version": "0.0.51", | ||
"version": "0.0.53", | ||
"homepage": "https://bit.dev/teambit/semantics/entities/semantic-schema", | ||
@@ -9,3 +9,3 @@ "main": "dist/index.js", | ||
"name": "entities/semantic-schema", | ||
"version": "0.0.51" | ||
"version": "0.0.53" | ||
}, | ||
@@ -12,0 +12,0 @@ "dependencies": { |
@@ -38,2 +38,3 @@ import { Location, SchemaNode } from '../../schema-node'; | ||
deprecated = 'deprecated', | ||
exports = 'exports', | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
214204
3585