@teambit/semantics.entities.semantic-schema 0.0.93 → 0.0.95
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/schemas/module.d.ts +1 -0
- package/dist/schemas/module.js +3 -0
- package/dist/schemas/module.js.map +1 -1
- package/dist/schemas/type-ref.d.ts +11 -1
- package/dist/schemas/type-ref.js +12 -2
- package/dist/schemas/type-ref.js.map +1 -1
- package/package.json +3 -3
- package/schemas/module.ts +4 -0
- package/schemas/type-ref.ts +15 -2
package/dist/schemas/module.d.ts
CHANGED
package/dist/schemas/module.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_schemaNode","_schemaRegistry","e","__esModule","default","ModuleSchema","SchemaNode","constructor","location","exports","internals","getNodes","flatExportsRecursively","reduce","acc","exp","namespace","toString","options","Error","boldUnderline","color","chalk","bold","underline","str","exportsStr","map","m","join","toFullSignature","exportsSignatures","signature","showDocs","doc","docString","toObject","member","fromObject","obj","exportNodes","SchemaRegistry","module"],"sources":["module.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { SchemaLocation } from '../schema-node';\nimport { SchemaNode } from '../schema-node';\nimport { SchemaRegistry } from '../schema-registry';\nimport type { ExportSchema } from './export';\n\nexport class ModuleSchema extends SchemaNode {\n // exports could either be re exports (export declarations) or nodes with export modifier\n exports: SchemaNode[];\n internals: SchemaNode[];\n namespace?: string;\n\n constructor(\n readonly location: SchemaLocation,\n exports: SchemaNode[],\n internals: SchemaNode[]\n ) {\n super();\n this.exports = exports;\n this.internals = internals;\n }\n\n getNodes() {\n return [...this.exports, ...this.internals];\n }\n\n flatExportsRecursively() {\n this.exports = this.exports.reduce(\n (acc, exp) => {\n if (exp instanceof ModuleSchema) {\n exp.flatExportsRecursively();\n if (exp.namespace) return [...acc, exp];\n return [...acc, ...exp.exports];\n }\n return [...acc, exp];\n },\n [] as (ExportSchema | SchemaNode)[]\n );\n }\n\n toString(options?: { color?: boolean }) {\n if (!this.namespace)\n throw new Error(\n 'toString() should not be called on a module without namespace, make sure this.flatExportsRecursively() is called'\n );\n const boldUnderline = options?.color ? chalk.bold.underline : (str: string) => str;\n\n const exportsStr = this.exports.map((m) => `* ${m.toString(options)}`).join('\\n');\n return `${boldUnderline(this.namespace)}\\n${exportsStr}`;\n }\n\n toFullSignature(options?: { showDocs?: boolean }): string {\n if (!this.namespace)\n throw new Error(\n 'toFullSignature() should not be called on a module without namespace; make sure this.flatExportsRecursively() is called'\n );\n\n const exportsSignatures = this.exports.map((m) => m.toFullSignature(options)).join('\\n');\n\n let signature = `${this.namespace}\\n${exportsSignatures}`;\n\n if (options?.showDocs && this.doc) {\n const docString = this.doc.toFullSignature();\n signature = `${docString}\\n${signature}`;\n }\n\n return signature;\n }\n\n toObject() {\n return {\n ...super.toObject(),\n exports: this.exports.map((member) => member.toObject()),\n internals: this.internals.map((member) => member.toObject()),\n namespace: this.namespace,\n };\n }\n\n static fromObject(obj: Record<string, any>): ModuleSchema {\n const location = obj.location;\n const exportNodes = (obj.exports || []).map((member: any) => SchemaRegistry.fromObject(member));\n const internals = (obj.internals || []).map((member: any) => SchemaRegistry.fromObject(member));\n const namespace = obj.namespace;\n const module = new ModuleSchema(location, exportNodes, internals);\n module.namespace = namespace;\n return module;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,gBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,eAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA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I,EAAE,EAAEkB,GAAG,CAAEU,MAAW,IAAKI,gCAAc,CAACH,UAAU,CAACD,MAAM,CAAC,CAAC;IAC/F,MAAM3B,SAAS,GAAG,CAAC6B,GAAG,CAAC7B,SAAS,IAAI,EAAE,EAAEiB,GAAG,CAAEU,MAAW,IAAKI,gCAAc,CAACH,UAAU,CAACD,MAAM,CAAC,CAAC;IAC/F,MAAMrB,SAAS,GAAGuB,GAAG,CAACvB,SAAS;IAC/B,MAAM0B,MAAM,GAAG,IAAIrC,YAAY,CAACG,QAAQ,EAAEgC,WAAW,EAAE9B,SAAS,CAAC;IACjEgC,MAAM,CAAC1B,SAAS,GAAGA,SAAS;IAC5B,OAAO0B,MAAM;EACf;AACF;
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_schemaNode","_schemaRegistry","e","__esModule","default","ModuleSchema","SchemaNode","constructor","location","exports","internals","getNodes","flatExportsRecursively","reduce","acc","exp","namespace","toString","options","Error","boldUnderline","color","chalk","bold","underline","str","exportsStr","map","m","join","toFullSignature","exportsSignatures","signature","showDocs","doc","docString","toObject","member","fromObject","obj","exportNodes","SchemaRegistry","module","isModuleSchema","node"],"sources":["module.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { SchemaLocation } from '../schema-node';\nimport { SchemaNode } from '../schema-node';\nimport { SchemaRegistry } from '../schema-registry';\nimport type { ExportSchema } from './export';\n\nexport class ModuleSchema extends SchemaNode {\n // exports could either be re exports (export declarations) or nodes with export modifier\n exports: SchemaNode[];\n internals: SchemaNode[];\n namespace?: string;\n\n constructor(\n readonly location: SchemaLocation,\n exports: SchemaNode[],\n internals: SchemaNode[]\n ) {\n super();\n this.exports = exports;\n this.internals = internals;\n }\n\n getNodes() {\n return [...this.exports, ...this.internals];\n }\n\n flatExportsRecursively() {\n this.exports = this.exports.reduce(\n (acc, exp) => {\n if (exp instanceof ModuleSchema) {\n exp.flatExportsRecursively();\n if (exp.namespace) return [...acc, exp];\n return [...acc, ...exp.exports];\n }\n return [...acc, exp];\n },\n [] as (ExportSchema | SchemaNode)[]\n );\n }\n\n toString(options?: { color?: boolean }) {\n if (!this.namespace)\n throw new Error(\n 'toString() should not be called on a module without namespace, make sure this.flatExportsRecursively() is called'\n );\n const boldUnderline = options?.color ? chalk.bold.underline : (str: string) => str;\n\n const exportsStr = this.exports.map((m) => `* ${m.toString(options)}`).join('\\n');\n return `${boldUnderline(this.namespace)}\\n${exportsStr}`;\n }\n\n toFullSignature(options?: { showDocs?: boolean }): string {\n if (!this.namespace)\n throw new Error(\n 'toFullSignature() should not be called on a module without namespace; make sure this.flatExportsRecursively() is called'\n );\n\n const exportsSignatures = this.exports.map((m) => m.toFullSignature(options)).join('\\n');\n\n let signature = `${this.namespace}\\n${exportsSignatures}`;\n\n if (options?.showDocs && this.doc) {\n const docString = this.doc.toFullSignature();\n signature = `${docString}\\n${signature}`;\n }\n\n return signature;\n }\n\n toObject() {\n return {\n ...super.toObject(),\n exports: this.exports.map((member) => member.toObject()),\n internals: this.internals.map((member) => member.toObject()),\n namespace: this.namespace,\n };\n }\n\n static fromObject(obj: Record<string, any>): ModuleSchema {\n const location = obj.location;\n const exportNodes = (obj.exports || []).map((member: any) => SchemaRegistry.fromObject(member));\n const internals = (obj.internals || []).map((member: any) => SchemaRegistry.fromObject(member));\n const namespace = obj.namespace;\n const module = new ModuleSchema(location, exportNodes, internals);\n module.namespace = namespace;\n return module;\n }\n\n static isModuleSchema(node: SchemaNode): node is ModuleSchema {\n return 'exports' in node && 'internals' in node;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AA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AgB;IACxD,MAAM/B,QAAQ,GAAG+B,GAAG,CAAC/B,QAAQ;IAC7B,MAAMgC,WAAW,GAAG,CAACD,GAAG,CAAC9B,OAAO,IAAI,EAAE,EAAEkB,GAAG,CAAEU,MAAW,IAAKI,gCAAc,CAACH,UAAU,CAACD,MAAM,CAAC,CAAC;IAC/F,MAAM3B,SAAS,GAAG,CAAC6B,GAAG,CAAC7B,SAAS,IAAI,EAAE,EAAEiB,GAAG,CAAEU,MAAW,IAAKI,gCAAc,CAACH,UAAU,CAACD,MAAM,CAAC,CAAC;IAC/F,MAAMrB,SAAS,GAAGuB,GAAG,CAACvB,SAAS;IAC/B,MAAM0B,MAAM,GAAG,IAAIrC,YAAY,CAACG,QAAQ,EAAEgC,WAAW,EAAE9B,SAAS,CAAC;IACjEgC,MAAM,CAAC1B,SAAS,GAAGA,SAAS;IAC5B,OAAO0B,MAAM;EACf;EAEA,OAAOC,cAAcA,CAACC,IAAgB,EAAwB;IAC5D,OAAO,SAAS,IAAIA,IAAI,IAAI,WAAW,IAAIA,IAAI;EACjD;AACF;AAACnC,OAAA,CAAAJ,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -27,6 +27,10 @@ export declare class TypeRefSchema extends SchemaNode {
|
|
|
27
27
|
* if the reference is not exported from the component, it can be internal to the file.
|
|
28
28
|
*/
|
|
29
29
|
readonly internalFilePath?: string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* source file path where the type ref is defined
|
|
32
|
+
*/
|
|
33
|
+
readonly sourceFilePath?: string | undefined;
|
|
30
34
|
/**
|
|
31
35
|
* optional type arguments, e.g. type Foo = Bar<X, Y>. The X and Y are type arguments.
|
|
32
36
|
*/
|
|
@@ -48,7 +52,11 @@ export declare class TypeRefSchema extends SchemaNode {
|
|
|
48
52
|
/**
|
|
49
53
|
* if the reference is not exported from the component, it can be internal to the file.
|
|
50
54
|
*/
|
|
51
|
-
internalFilePath?: string | undefined
|
|
55
|
+
internalFilePath?: string | undefined,
|
|
56
|
+
/**
|
|
57
|
+
* source file path where the type ref is defined
|
|
58
|
+
*/
|
|
59
|
+
sourceFilePath?: string | undefined);
|
|
52
60
|
getNodes(): SchemaNode[];
|
|
53
61
|
withTypeArgs(typeArgs: SchemaNode[]): this;
|
|
54
62
|
toString(options?: {
|
|
@@ -75,7 +83,9 @@ export declare class TypeRefSchema extends SchemaNode {
|
|
|
75
83
|
componentId: import("@teambit/component-id").ComponentIdObj | undefined;
|
|
76
84
|
packageName: string | undefined;
|
|
77
85
|
internalFilePath: string | undefined;
|
|
86
|
+
sourceFilePath: string | undefined;
|
|
78
87
|
typeArgs: Record<string, any>[] | undefined;
|
|
79
88
|
};
|
|
80
89
|
static fromObject(obj: Record<string, any>): TypeRefSchema;
|
|
90
|
+
static isTypeRefSchema(node: SchemaNode): node is TypeRefSchema;
|
|
81
91
|
}
|
package/dist/schemas/type-ref.js
CHANGED
|
@@ -61,12 +61,17 @@ class TypeRefSchema extends _schemaNode().SchemaNode {
|
|
|
61
61
|
/**
|
|
62
62
|
* if the reference is not exported from the component, it can be internal to the file.
|
|
63
63
|
*/
|
|
64
|
-
internalFilePath
|
|
64
|
+
internalFilePath,
|
|
65
|
+
/**
|
|
66
|
+
* source file path where the type ref is defined
|
|
67
|
+
*/
|
|
68
|
+
sourceFilePath) {
|
|
65
69
|
super();
|
|
66
70
|
this.location = location;
|
|
67
71
|
this.name = name;
|
|
68
72
|
this.packageName = packageName;
|
|
69
73
|
this.internalFilePath = internalFilePath;
|
|
74
|
+
this.sourceFilePath = sourceFilePath;
|
|
70
75
|
this.componentId = componentId;
|
|
71
76
|
}
|
|
72
77
|
getNodes() {
|
|
@@ -136,6 +141,7 @@ class TypeRefSchema extends _schemaNode().SchemaNode {
|
|
|
136
141
|
componentId: this.componentId ? this.componentId.toObject() : undefined,
|
|
137
142
|
packageName: this.packageName,
|
|
138
143
|
internalFilePath: this.internalFilePath,
|
|
144
|
+
sourceFilePath: this.sourceFilePath,
|
|
139
145
|
typeArgs: this.typeArgs?.map(type => type.toObject())
|
|
140
146
|
};
|
|
141
147
|
}
|
|
@@ -150,8 +156,12 @@ class TypeRefSchema extends _schemaNode().SchemaNode {
|
|
|
150
156
|
}
|
|
151
157
|
const packageName = obj.packageName;
|
|
152
158
|
const internalFilePath = obj.internalFilePath;
|
|
159
|
+
const sourceFilePath = obj.sourceFilePath;
|
|
153
160
|
const typeArgs = obj.typeArgs?.map(type => _schemaRegistry().SchemaRegistry.fromObject(type));
|
|
154
|
-
return new TypeRefSchema(location, name, componentId, packageName, internalFilePath).withTypeArgs(typeArgs);
|
|
161
|
+
return new TypeRefSchema(location, name, componentId, packageName, internalFilePath, sourceFilePath).withTypeArgs(typeArgs);
|
|
162
|
+
}
|
|
163
|
+
static isTypeRefSchema(node) {
|
|
164
|
+
return node.__schema === 'TypeRefSchema';
|
|
155
165
|
}
|
|
156
166
|
}
|
|
157
167
|
exports.TypeRefSchema = TypeRefSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_component","data","require","_chalk","_interopRequireDefault","_schemaNode","_schemaRegistry","e","__esModule","default","TypeRefSchema","SchemaNode","constructor","location","name","componentId","packageName","internalFilePath","getNodes","typeArgs","withTypeArgs","toString","options","nameToString","args","map","arg","join","dim","color","chalk","str","compStr","toStringWithoutVersion","pkgStr","toFullSignature","signature","length","argsSignatures","showDocs","doc","docString","isFromThisComponent","isInternalReference","isExported","toObject","undefined","type","fromObject","obj","ComponentID","SchemaRegistry","exports"],"sources":["type-ref.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component';\nimport chalk from 'chalk';\nimport type { SchemaLocation } from '../schema-node';\nimport { SchemaNode } from '../schema-node';\nimport { SchemaRegistry } from '../schema-registry';\n\nexport type PlainTypeRefSchema = {\n name: string;\n componentId?: string;\n packageName?: string;\n};\n\n/**\n * can be one of the following:\n * 1. a reference to another \"export\" in the same component\n * 2 a reference to another declaration in the same file (internal)\n * 3. a reference to another component.\n * 4. a reference to a package.\n */\nexport class TypeRefSchema extends SchemaNode {\n /**\n * optional type arguments, e.g. type Foo = Bar<X, Y>. The X and Y are type arguments.\n */\n typeArgs?: SchemaNode[];\n\n readonly componentId?: ComponentID;\n\n constructor(\n readonly location: SchemaLocation,\n /**\n * name of the reference to type.\n */\n readonly name: string,\n /**\n * target component id. existing if the type is defined in another component.\n */\n componentId?: ComponentID,\n /**\n * target package name. existing if type is defined in different package.\n */\n readonly packageName?: string,\n /**\n * if the reference is not exported from the component, it can be internal to the file.\n */\n readonly internalFilePath?: string\n ) {\n super();\n this.componentId = componentId;\n }\n\n getNodes(): SchemaNode[] {\n return this.typeArgs || [];\n }\n\n withTypeArgs(typeArgs: SchemaNode[]) {\n this.typeArgs = typeArgs;\n return this;\n }\n\n toString(options?: { color?: boolean }) {\n const name = this.nameToString(options);\n if (!this.typeArgs) {\n return name;\n }\n const args = this.typeArgs.map((arg) => arg.toString(options)).join(', ');\n return `${name}<${args}>`;\n }\n\n private nameToString(options?: { color?: boolean }) {\n const dim = options?.color ? chalk.dim : (str: string) => str;\n if (this.componentId) {\n const compStr = dim(`(component: ${this.componentId.toStringWithoutVersion()})`);\n return `${compStr} ${this.name}`;\n }\n if (this.packageName) {\n const pkgStr = dim(`(package: ${this.packageName})`);\n return `${pkgStr} ${this.name}`;\n }\n return this.name;\n }\n\n toFullSignature(options?: { showDocs?: boolean }): string {\n let signature = this.name;\n\n if (this.typeArgs && this.typeArgs.length > 0) {\n const argsSignatures = this.typeArgs.map((arg) => arg.toFullSignature(options)).join(', ');\n signature += `<${argsSignatures}>`;\n }\n\n if (options?.showDocs && this.doc) {\n const docString = this.doc.toFullSignature();\n signature = `${docString}\\n${signature}`;\n }\n\n return signature;\n }\n\n /**\n * whether this type was already exported in this component\n */\n isFromThisComponent() {\n return !this.componentId && !this.packageName;\n }\n\n /**\n * whether this type is internal to the file.\n */\n isInternalReference() {\n return !!this.internalFilePath && this.isFromThisComponent();\n }\n\n /**\n * whether this type is exported from this component.\n */\n isExported() {\n return this.isFromThisComponent() && !this.isInternalReference();\n }\n\n toObject() {\n return {\n ...super.toObject(),\n name: this.name,\n componentId: this.componentId ? this.componentId.toObject() : undefined,\n packageName: this.packageName,\n internalFilePath: this.internalFilePath,\n typeArgs: this.typeArgs?.map((type) => type.toObject()),\n };\n }\n\n static fromObject(obj: Record<string, any>): TypeRefSchema {\n const location = obj.location;\n const name = obj.name;\n let componentId;\n try {\n componentId = obj.componentId ? ComponentID.fromObject(obj.componentId) : undefined;\n } catch {\n componentId = undefined;\n }\n const packageName = obj.packageName;\n const internalFilePath = obj.internalFilePath;\n const typeArgs = obj.typeArgs?.map((type: any) => SchemaRegistry.fromObject(type));\n return new TypeRefSchema(location, name, componentId, packageName, internalFilePath).withTypeArgs(typeArgs);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,gBAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,eAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAoD,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAQpD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,aAAa,SAASC,wBAAU,CAAC;EAC5C;AACF;AACA;;EAKEC,WAAWA,CACAC,QAAwB;EACjC;AACJ;AACA;EACaC,IAAY;EACrB;AACJ;AACA;EACIC,WAAyB;EACzB;AACJ;AACA;EACaC,WAAoB;EAC7B;AACJ;AACA;EACaC,gBAAyB,
|
|
1
|
+
{"version":3,"names":["_component","data","require","_chalk","_interopRequireDefault","_schemaNode","_schemaRegistry","e","__esModule","default","TypeRefSchema","SchemaNode","constructor","location","name","componentId","packageName","internalFilePath","sourceFilePath","getNodes","typeArgs","withTypeArgs","toString","options","nameToString","args","map","arg","join","dim","color","chalk","str","compStr","toStringWithoutVersion","pkgStr","toFullSignature","signature","length","argsSignatures","showDocs","doc","docString","isFromThisComponent","isInternalReference","isExported","toObject","undefined","type","fromObject","obj","ComponentID","SchemaRegistry","isTypeRefSchema","node","__schema","exports"],"sources":["type-ref.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component';\nimport chalk from 'chalk';\nimport type { SchemaLocation } from '../schema-node';\nimport { SchemaNode } from '../schema-node';\nimport { SchemaRegistry } from '../schema-registry';\n\nexport type PlainTypeRefSchema = {\n name: string;\n componentId?: string;\n packageName?: string;\n};\n\n/**\n * can be one of the following:\n * 1. a reference to another \"export\" in the same component\n * 2 a reference to another declaration in the same file (internal)\n * 3. a reference to another component.\n * 4. a reference to a package.\n */\nexport class TypeRefSchema extends SchemaNode {\n /**\n * optional type arguments, e.g. type Foo = Bar<X, Y>. The X and Y are type arguments.\n */\n typeArgs?: SchemaNode[];\n\n readonly componentId?: ComponentID;\n\n constructor(\n readonly location: SchemaLocation,\n /**\n * name of the reference to type.\n */\n readonly name: string,\n /**\n * target component id. existing if the type is defined in another component.\n */\n componentId?: ComponentID,\n /**\n * target package name. existing if type is defined in different package.\n */\n readonly packageName?: string,\n /**\n * if the reference is not exported from the component, it can be internal to the file.\n */\n readonly internalFilePath?: string,\n\n /**\n * source file path where the type ref is defined\n */\n readonly sourceFilePath?: string\n ) {\n super();\n this.componentId = componentId;\n }\n\n getNodes(): SchemaNode[] {\n return this.typeArgs || [];\n }\n\n withTypeArgs(typeArgs: SchemaNode[]) {\n this.typeArgs = typeArgs;\n return this;\n }\n\n toString(options?: { color?: boolean }) {\n const name = this.nameToString(options);\n if (!this.typeArgs) {\n return name;\n }\n const args = this.typeArgs.map((arg) => arg.toString(options)).join(', ');\n return `${name}<${args}>`;\n }\n\n private nameToString(options?: { color?: boolean }) {\n const dim = options?.color ? chalk.dim : (str: string) => str;\n if (this.componentId) {\n const compStr = dim(`(component: ${this.componentId.toStringWithoutVersion()})`);\n return `${compStr} ${this.name}`;\n }\n if (this.packageName) {\n const pkgStr = dim(`(package: ${this.packageName})`);\n return `${pkgStr} ${this.name}`;\n }\n return this.name;\n }\n\n toFullSignature(options?: { showDocs?: boolean }): string {\n let signature = this.name;\n\n if (this.typeArgs && this.typeArgs.length > 0) {\n const argsSignatures = this.typeArgs.map((arg) => arg.toFullSignature(options)).join(', ');\n signature += `<${argsSignatures}>`;\n }\n\n if (options?.showDocs && this.doc) {\n const docString = this.doc.toFullSignature();\n signature = `${docString}\\n${signature}`;\n }\n\n return signature;\n }\n\n /**\n * whether this type was already exported in this component\n */\n isFromThisComponent() {\n return !this.componentId && !this.packageName;\n }\n\n /**\n * whether this type is internal to the file.\n */\n isInternalReference() {\n return !!this.internalFilePath && this.isFromThisComponent();\n }\n\n /**\n * whether this type is exported from this component.\n */\n isExported() {\n return this.isFromThisComponent() && !this.isInternalReference();\n }\n\n toObject() {\n return {\n ...super.toObject(),\n name: this.name,\n componentId: this.componentId ? this.componentId.toObject() : undefined,\n packageName: this.packageName,\n internalFilePath: this.internalFilePath,\n sourceFilePath: this.sourceFilePath,\n typeArgs: this.typeArgs?.map((type) => type.toObject()),\n };\n }\n\n static fromObject(obj: Record<string, any>): TypeRefSchema {\n const location = obj.location;\n const name = obj.name;\n let componentId;\n try {\n componentId = obj.componentId ? ComponentID.fromObject(obj.componentId) : undefined;\n } catch {\n componentId = undefined;\n }\n const packageName = obj.packageName;\n const internalFilePath = obj.internalFilePath;\n const sourceFilePath = obj.sourceFilePath;\n const typeArgs = obj.typeArgs?.map((type: any) => SchemaRegistry.fromObject(type));\n return new TypeRefSchema(location, name, componentId, packageName, internalFilePath, sourceFilePath).withTypeArgs(\n typeArgs\n );\n }\n\n static isTypeRefSchema(node: SchemaNode): node is TypeRefSchema {\n return node.__schema === 'TypeRefSchema';\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,gBAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,eAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAoD,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAQpD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,aAAa,SAASC,wBAAU,CAAC;EAC5C;AACF;AACA;;EAKEC,WAAWA,CACAC,QAAwB;EACjC;AACJ;AACA;EACaC,IAAY;EACrB;AACJ;AACA;EACIC,WAAyB;EACzB;AACJ;AACA;EACaC,WAAoB;EAC7B;AACJ;AACA;EACaC,gBAAyB;EAElC;AACJ;AACA;EACaC,cAAuB,EAChC;IACA,KAAK,CAAC,CAAC;IAAC,KAvBCL,QAAwB,GAAxBA,QAAwB;IAAA,KAIxBC,IAAY,GAA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antic-schema",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.95",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/semantics/entities/semantic-schema",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.semantics",
|
|
8
8
|
"name": "entities/semantic-schema",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.95"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "4.1.2",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@types/pluralize": "0.0.29",
|
|
20
20
|
"@types/mocha": "9.1.0",
|
|
21
21
|
"chai": "4.3.0",
|
|
22
|
-
"@teambit/node.envs.node-babel-mocha": "0.1.
|
|
22
|
+
"@teambit/node.envs.node-babel-mocha": "0.1.22"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {},
|
|
25
25
|
"license": "Apache-2.0",
|
package/schemas/module.ts
CHANGED
package/schemas/type-ref.ts
CHANGED
|
@@ -42,7 +42,12 @@ export class TypeRefSchema extends SchemaNode {
|
|
|
42
42
|
/**
|
|
43
43
|
* if the reference is not exported from the component, it can be internal to the file.
|
|
44
44
|
*/
|
|
45
|
-
readonly internalFilePath?: string
|
|
45
|
+
readonly internalFilePath?: string,
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* source file path where the type ref is defined
|
|
49
|
+
*/
|
|
50
|
+
readonly sourceFilePath?: string
|
|
46
51
|
) {
|
|
47
52
|
super();
|
|
48
53
|
this.componentId = componentId;
|
|
@@ -123,6 +128,7 @@ export class TypeRefSchema extends SchemaNode {
|
|
|
123
128
|
componentId: this.componentId ? this.componentId.toObject() : undefined,
|
|
124
129
|
packageName: this.packageName,
|
|
125
130
|
internalFilePath: this.internalFilePath,
|
|
131
|
+
sourceFilePath: this.sourceFilePath,
|
|
126
132
|
typeArgs: this.typeArgs?.map((type) => type.toObject()),
|
|
127
133
|
};
|
|
128
134
|
}
|
|
@@ -138,7 +144,14 @@ export class TypeRefSchema extends SchemaNode {
|
|
|
138
144
|
}
|
|
139
145
|
const packageName = obj.packageName;
|
|
140
146
|
const internalFilePath = obj.internalFilePath;
|
|
147
|
+
const sourceFilePath = obj.sourceFilePath;
|
|
141
148
|
const typeArgs = obj.typeArgs?.map((type: any) => SchemaRegistry.fromObject(type));
|
|
142
|
-
return new TypeRefSchema(location, name, componentId, packageName, internalFilePath).withTypeArgs(
|
|
149
|
+
return new TypeRefSchema(location, name, componentId, packageName, internalFilePath, sourceFilePath).withTypeArgs(
|
|
150
|
+
typeArgs
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
static isTypeRefSchema(node: SchemaNode): node is TypeRefSchema {
|
|
155
|
+
return node.__schema === 'TypeRefSchema';
|
|
143
156
|
}
|
|
144
157
|
}
|