@teambit/semantics.entities.semantic-schema
Advanced tools
Comparing version 0.0.48 to 0.0.49
@@ -16,3 +16,3 @@ import { Transform, plainToInstance } from 'class-transformer'; | ||
import { Location, SchemaNode } from './schema-node'; | ||
import { schemaObjToInstance } from './class-transformers'; | ||
import { schemaObjArrayToInstances, schemaObjToInstance } from './class-transformers'; | ||
import { componentIdTransformer } from './class-transformers/comp-id-transformer'; | ||
@@ -22,10 +22,14 @@ | ||
@Transform(schemaObjToInstance) | ||
readonly module: ModuleSchema; | ||
readonly module: ModuleSchema; // index | ||
@Transform(schemaObjArrayToInstances) | ||
readonly internals: ModuleSchema[]; | ||
@Transform(componentIdTransformer) | ||
readonly componentId: ComponentID; | ||
constructor(readonly location: Location, module: ModuleSchema, componentId: ComponentID) { | ||
constructor(readonly location: Location, module: ModuleSchema, internals: ModuleSchema[], componentId: ComponentID) { | ||
super(); | ||
this.module = module; | ||
this.internals = internals; | ||
this.componentId = componentId; | ||
@@ -78,3 +82,4 @@ } | ||
{ filePath: '', line: 0, character: 0 }, | ||
new ModuleSchema({ filePath: '', line: 0, character: 0 }, []), | ||
new ModuleSchema({ filePath: '', line: 0, character: 0 }, [], []), | ||
[], | ||
componentId | ||
@@ -81,0 +86,0 @@ ); |
@@ -7,4 +7,5 @@ import { ComponentID } from '@teambit/component-id'; | ||
readonly module: ModuleSchema; | ||
readonly internals: ModuleSchema[]; | ||
readonly componentId: ComponentID; | ||
constructor(location: Location, module: ModuleSchema, componentId: ComponentID); | ||
constructor(location: Location, module: ModuleSchema, internals: ModuleSchema[], componentId: ComponentID); | ||
toString(): string; | ||
@@ -11,0 +12,0 @@ toStringPerType(): string; |
@@ -20,6 +20,7 @@ "use strict"; | ||
class APISchema extends schema_node_1.SchemaNode { | ||
constructor(location, module, componentId) { | ||
constructor(location, module, internals, componentId) { | ||
super(); | ||
this.location = location; | ||
this.module = module; | ||
this.internals = internals; | ||
this.componentId = componentId; | ||
@@ -57,3 +58,3 @@ } | ||
static empty(componentId) { | ||
return new APISchema({ filePath: '', line: 0, character: 0 }, new schemas_1.ModuleSchema({ filePath: '', line: 0, character: 0 }, []), componentId); | ||
return new APISchema({ filePath: '', line: 0, character: 0 }, new schemas_1.ModuleSchema({ filePath: '', line: 0, character: 0 }, [], []), [], componentId); | ||
} | ||
@@ -65,2 +66,5 @@ } | ||
__decorate([ | ||
(0, class_transformer_1.Transform)(class_transformers_1.schemaObjArrayToInstances) | ||
], APISchema.prototype, "internals", void 0); | ||
__decorate([ | ||
(0, class_transformer_1.Transform)(comp_id_transformer_1.componentIdTransformer) | ||
@@ -67,0 +71,0 @@ ], APISchema.prototype, "componentId", void 0); |
@@ -1,9 +0,8 @@ | ||
import { Location, SchemaNode } from '../schema-node'; | ||
import { Location } from '../schema-node'; | ||
import { ParameterSchema } from './parameter'; | ||
export declare class ConstructorSchema extends SchemaNode { | ||
readonly location: Location; | ||
readonly signature?: string; | ||
readonly params: ParameterSchema[]; | ||
constructor(location: Location, params: ParameterSchema[], signature?: string); | ||
toString(): string; | ||
import { FunctionLikeSchema, Modifier } from './function-like'; | ||
import { DocSchema } from './docs'; | ||
import { ThisTypeSchema } from './this-type'; | ||
export declare class ConstructorSchema extends FunctionLikeSchema { | ||
constructor(location: Location, params: ParameterSchema[], returns: ThisTypeSchema, signature: string, modifiers?: Modifier[], doc?: DocSchema); | ||
} |
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ConstructorSchema = void 0; | ||
const class_transformer_1 = require("class-transformer"); | ||
const chalk_1 = __importDefault(require("chalk")); | ||
const schema_node_1 = require("../schema-node"); | ||
const class_transformers_1 = require("../class-transformers"); | ||
class ConstructorSchema extends schema_node_1.SchemaNode { | ||
constructor(location, params, signature) { | ||
super(); | ||
this.location = location; | ||
this.signature = signature; | ||
this.params = params; | ||
const function_like_1 = require("./function-like"); | ||
class ConstructorSchema extends function_like_1.FunctionLikeSchema { | ||
constructor(location, params, returns, signature, modifiers = [], doc) { | ||
super(location, 'constructor', params, returns, signature, modifiers, doc, undefined); | ||
} | ||
toString() { | ||
const paramsStr = this.params.map((param) => param.toString()).join(', '); | ||
return `${chalk_1.default.bold('constructor')}(${paramsStr})`; | ||
} | ||
} | ||
__decorate([ | ||
(0, class_transformer_1.Transform)(class_transformers_1.schemaObjArrayToInstances) | ||
], ConstructorSchema.prototype, "params", void 0); | ||
exports.ConstructorSchema = ConstructorSchema; | ||
//# sourceMappingURL=constructor.js.map |
@@ -5,4 +5,5 @@ import { Location, SchemaNode } from '../schema-node'; | ||
exports: SchemaNode[]; | ||
internals: SchemaNode[]; | ||
namespace?: string; | ||
constructor(location: Location, exports: SchemaNode[]); | ||
constructor(location: Location, exports: SchemaNode[], internals: SchemaNode[]); | ||
toObject(): { | ||
@@ -9,0 +10,0 @@ constructorName: string; |
@@ -18,6 +18,7 @@ "use strict"; | ||
class ModuleSchema extends schema_node_1.SchemaNode { | ||
constructor(location, exports) { | ||
constructor(location, exports, internals) { | ||
super(); | ||
this.location = location; | ||
this.exports = exports; | ||
this.internals = internals; | ||
} | ||
@@ -52,3 +53,6 @@ toObject() { | ||
], ModuleSchema.prototype, "exports", void 0); | ||
__decorate([ | ||
(0, class_transformer_1.Transform)(class_transformers_1.schemaObjArrayToInstances) | ||
], ModuleSchema.prototype, "internals", void 0); | ||
exports.ModuleSchema = ModuleSchema; | ||
//# sourceMappingURL=module.js.map |
@@ -11,4 +11,5 @@ import { ComponentID } from '@teambit/component'; | ||
* 1. a reference to another "export" in the same component | ||
* 2. a reference to another component. | ||
* 3. a reference to a package. | ||
* 2 a reference to another declaration in the same file (internal) | ||
* 3. a reference to another component. | ||
* 4. a reference to a package. | ||
*/ | ||
@@ -25,2 +26,3 @@ export declare class TypeRefSchema extends SchemaNode { | ||
readonly packageName?: string; | ||
readonly internalFilePath?: string; | ||
/** | ||
@@ -43,3 +45,3 @@ * optional type arguments, e.g. type Foo = Bar<X, Y>. The X and Y are type arguments. | ||
*/ | ||
packageName?: string); | ||
packageName?: string, internalFilePath?: string); | ||
toString(): string; | ||
@@ -46,0 +48,0 @@ private nameToString; |
@@ -21,4 +21,5 @@ "use strict"; | ||
* 1. a reference to another "export" in the same component | ||
* 2. a reference to another component. | ||
* 3. a reference to a package. | ||
* 2 a reference to another declaration in the same file (internal) | ||
* 3. a reference to another component. | ||
* 4. a reference to a package. | ||
*/ | ||
@@ -38,3 +39,3 @@ class TypeRefSchema extends schema_node_1.SchemaNode { | ||
*/ | ||
packageName) { | ||
packageName, internalFilePath) { | ||
super(); | ||
@@ -44,2 +45,3 @@ this.location = location; | ||
this.packageName = packageName; | ||
this.internalFilePath = internalFilePath; | ||
this.componentId = componentId; | ||
@@ -46,0 +48,0 @@ } |
{ | ||
"name": "@teambit/semantics.entities.semantic-schema", | ||
"version": "0.0.48", | ||
"version": "0.0.49", | ||
"homepage": "https://bit.dev/teambit/semantics/entities/semantic-schema", | ||
@@ -9,3 +9,3 @@ "main": "dist/index.js", | ||
"name": "entities/semantic-schema", | ||
"version": "0.0.48" | ||
"version": "0.0.49" | ||
}, | ||
@@ -21,5 +21,5 @@ "dependencies": { | ||
"@types/mocha": "9.1.0", | ||
"@babel/runtime": "7.20.0", | ||
"@types/jest": "26.0.20", | ||
"@types/node": "12.20.4", | ||
"@types/jest": "26.0.20" | ||
"@babel/runtime": "7.20.0" | ||
}, | ||
@@ -26,0 +26,0 @@ "peerDependencies": {}, |
@@ -1,19 +0,18 @@ | ||
import { Transform } from 'class-transformer'; | ||
import chalk from 'chalk'; | ||
import { Location, SchemaNode } from '../schema-node'; | ||
import { Location } from '../schema-node'; | ||
import { ParameterSchema } from './parameter'; | ||
import { schemaObjArrayToInstances } from '../class-transformers'; | ||
import { FunctionLikeSchema, Modifier } from './function-like'; | ||
import { DocSchema } from './docs'; | ||
import { ThisTypeSchema } from './this-type'; | ||
export class ConstructorSchema extends SchemaNode { | ||
@Transform(schemaObjArrayToInstances) | ||
readonly params: ParameterSchema[]; | ||
constructor(readonly location: Location, params: ParameterSchema[], readonly signature?: string) { | ||
super(); | ||
this.params = params; | ||
export class ConstructorSchema extends FunctionLikeSchema { | ||
constructor( | ||
location: Location, | ||
params: ParameterSchema[], | ||
returns: ThisTypeSchema, | ||
signature: string, | ||
modifiers: Modifier[] = [], | ||
doc?: DocSchema | ||
) { | ||
super(location, 'constructor', params, returns, signature, modifiers, doc, undefined); | ||
} | ||
toString() { | ||
const paramsStr = this.params.map((param) => param.toString()).join(', '); | ||
return `${chalk.bold('constructor')}(${paramsStr})`; | ||
} | ||
} |
@@ -9,6 +9,12 @@ import chalk from 'chalk'; | ||
exports: SchemaNode[]; | ||
@Transform(schemaObjArrayToInstances) | ||
internals: SchemaNode[]; | ||
namespace?: string; | ||
constructor(readonly location: Location, exports: SchemaNode[]) { | ||
constructor(readonly location: Location, exports: SchemaNode[], internals: SchemaNode[]) { | ||
super(); | ||
this.exports = exports; | ||
this.internals = internals; | ||
} | ||
@@ -15,0 +21,0 @@ |
@@ -17,4 +17,5 @@ import { Transform } from 'class-transformer'; | ||
* 1. a reference to another "export" in the same component | ||
* 2. a reference to another component. | ||
* 3. a reference to a package. | ||
* 2 a reference to another declaration in the same file (internal) | ||
* 3. a reference to another component. | ||
* 4. a reference to a package. | ||
*/ | ||
@@ -46,3 +47,5 @@ export class TypeRefSchema extends SchemaNode { | ||
*/ | ||
readonly packageName?: string | ||
readonly packageName?: string, | ||
readonly internalFilePath?: string | ||
) { | ||
@@ -49,0 +52,0 @@ super(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
212509