@atscript/core 0.1.24 → 0.1.26
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/index.cjs +14 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +14 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -151,6 +151,7 @@ else this.annotationsCounter.set(name, 1);
|
|
|
151
151
|
_define_property$14(this, "definition", void 0);
|
|
152
152
|
_define_property$14(this, "annotations", void 0);
|
|
153
153
|
_define_property$14(this, "annotationsCounter", void 0);
|
|
154
|
+
_define_property$14(this, "__typeId", void 0);
|
|
154
155
|
_define_property$14(this, "_documentation", void 0);
|
|
155
156
|
this.entity = entity;
|
|
156
157
|
this.isGroup = false;
|
|
@@ -182,6 +183,7 @@ var SemanticAnnotateNode = class extends SemanticNode {
|
|
|
182
183
|
doc.tokensIndex.add(targetToken);
|
|
183
184
|
const identifierToken = this.token("identifier");
|
|
184
185
|
if (identifierToken) {
|
|
186
|
+
this.__typeId = doc.nextTypeId();
|
|
185
187
|
doc.registerDefinition(identifierToken);
|
|
186
188
|
if (this.token("export")) {
|
|
187
189
|
identifierToken.exported = true;
|
|
@@ -317,6 +319,7 @@ var SemanticImportNode = class extends SemanticNode {
|
|
|
317
319
|
var SemanticInterfaceNode = class extends SemanticNode {
|
|
318
320
|
registerAtDocument(doc) {
|
|
319
321
|
super.registerAtDocument(doc);
|
|
322
|
+
this.__typeId = doc.nextTypeId();
|
|
320
323
|
const token = this.token("identifier");
|
|
321
324
|
doc.registerDefinition(token);
|
|
322
325
|
if (token && this.token("export")) {
|
|
@@ -752,6 +755,7 @@ var SemanticTupleNode = class extends SemanticGroup {
|
|
|
752
755
|
var SemanticTypeNode = class extends SemanticNode {
|
|
753
756
|
registerAtDocument(doc) {
|
|
754
757
|
super.registerAtDocument(doc);
|
|
758
|
+
this.__typeId = doc.nextTypeId();
|
|
755
759
|
const token = this.token("identifier");
|
|
756
760
|
doc.registerDefinition(token);
|
|
757
761
|
if (token && this.token("export")) {
|
|
@@ -2610,6 +2614,9 @@ else if (isStructure(def) || isInterface(def) || isPrimitive(def)) def = def.pro
|
|
|
2610
2614
|
from.fromPath = from.text;
|
|
2611
2615
|
});
|
|
2612
2616
|
}
|
|
2617
|
+
nextTypeId() {
|
|
2618
|
+
return this._nextTypeId++;
|
|
2619
|
+
}
|
|
2613
2620
|
registerDefinition(token, asImport = false) {
|
|
2614
2621
|
if (token) {
|
|
2615
2622
|
token.isDefinition = !asImport;
|
|
@@ -3005,6 +3012,7 @@ else if (isStructure(def) || isInterface(def) || isPrimitive(def)) def = def.pro
|
|
|
3005
3012
|
_define_property$3(this, "_text", void 0);
|
|
3006
3013
|
_define_property$3(this, "resolvedAnnotations", void 0);
|
|
3007
3014
|
_define_property$3(this, "annotations", void 0);
|
|
3015
|
+
_define_property$3(this, "_nextTypeId", void 0);
|
|
3008
3016
|
_define_property$3(this, "_allMessages", void 0);
|
|
3009
3017
|
this.id = id;
|
|
3010
3018
|
this.config = config;
|
|
@@ -3024,6 +3032,7 @@ else if (isStructure(def) || isInterface(def) || isPrimitive(def)) def = def.pro
|
|
|
3024
3032
|
this._text = "";
|
|
3025
3033
|
this.resolvedAnnotations = [];
|
|
3026
3034
|
this.annotations = [];
|
|
3035
|
+
this._nextTypeId = 0;
|
|
3027
3036
|
this._allMessages = undefined;
|
|
3028
3037
|
this.registry = new IdRegistry(Array.from(config.primitives?.keys() || []));
|
|
3029
3038
|
}
|
|
@@ -3042,7 +3051,11 @@ const zeroRange = {
|
|
|
3042
3051
|
//#endregion
|
|
3043
3052
|
//#region packages/core/src/defaults/emit-annotations.ts
|
|
3044
3053
|
const emitAnnotations = { jsonSchema: new AnnotationSpec({
|
|
3045
|
-
nodeType: [
|
|
3054
|
+
nodeType: [
|
|
3055
|
+
"interface",
|
|
3056
|
+
"type",
|
|
3057
|
+
"annotate"
|
|
3058
|
+
],
|
|
3046
3059
|
description: "Pre-compute and embed JSON Schema at build time for this interface, regardless of the global jsonSchema plugin option."
|
|
3047
3060
|
}) };
|
|
3048
3061
|
|
package/dist/index.d.ts
CHANGED
|
@@ -297,6 +297,7 @@ declare class SemanticNode {
|
|
|
297
297
|
protected definition?: SemanticNode;
|
|
298
298
|
annotations?: TAnnotationTokens[];
|
|
299
299
|
annotationsCounter?: Map<string, number>;
|
|
300
|
+
__typeId?: number;
|
|
300
301
|
registerAtDocument(doc: AtscriptDoc): void;
|
|
301
302
|
protected _documentation?: string;
|
|
302
303
|
setDocumentation(s: string): void;
|
|
@@ -530,6 +531,8 @@ declare class AtscriptDoc {
|
|
|
530
531
|
imports: Token[];
|
|
531
532
|
block: Token;
|
|
532
533
|
}): void;
|
|
534
|
+
private _nextTypeId;
|
|
535
|
+
nextTypeId(): number;
|
|
533
536
|
registerDefinition(token?: Token, asImport?: boolean): void;
|
|
534
537
|
/**
|
|
535
538
|
* Finds the owning document and semantic node responsible for declaring a given identifier.
|
package/dist/index.mjs
CHANGED
|
@@ -127,6 +127,7 @@ else this.annotationsCounter.set(name, 1);
|
|
|
127
127
|
_define_property$14(this, "definition", void 0);
|
|
128
128
|
_define_property$14(this, "annotations", void 0);
|
|
129
129
|
_define_property$14(this, "annotationsCounter", void 0);
|
|
130
|
+
_define_property$14(this, "__typeId", void 0);
|
|
130
131
|
_define_property$14(this, "_documentation", void 0);
|
|
131
132
|
this.entity = entity;
|
|
132
133
|
this.isGroup = false;
|
|
@@ -158,6 +159,7 @@ var SemanticAnnotateNode = class extends SemanticNode {
|
|
|
158
159
|
doc.tokensIndex.add(targetToken);
|
|
159
160
|
const identifierToken = this.token("identifier");
|
|
160
161
|
if (identifierToken) {
|
|
162
|
+
this.__typeId = doc.nextTypeId();
|
|
161
163
|
doc.registerDefinition(identifierToken);
|
|
162
164
|
if (this.token("export")) {
|
|
163
165
|
identifierToken.exported = true;
|
|
@@ -293,6 +295,7 @@ var SemanticImportNode = class extends SemanticNode {
|
|
|
293
295
|
var SemanticInterfaceNode = class extends SemanticNode {
|
|
294
296
|
registerAtDocument(doc) {
|
|
295
297
|
super.registerAtDocument(doc);
|
|
298
|
+
this.__typeId = doc.nextTypeId();
|
|
296
299
|
const token = this.token("identifier");
|
|
297
300
|
doc.registerDefinition(token);
|
|
298
301
|
if (token && this.token("export")) {
|
|
@@ -728,6 +731,7 @@ var SemanticTupleNode = class extends SemanticGroup {
|
|
|
728
731
|
var SemanticTypeNode = class extends SemanticNode {
|
|
729
732
|
registerAtDocument(doc) {
|
|
730
733
|
super.registerAtDocument(doc);
|
|
734
|
+
this.__typeId = doc.nextTypeId();
|
|
731
735
|
const token = this.token("identifier");
|
|
732
736
|
doc.registerDefinition(token);
|
|
733
737
|
if (token && this.token("export")) {
|
|
@@ -2586,6 +2590,9 @@ else if (isStructure(def) || isInterface(def) || isPrimitive(def)) def = def.pro
|
|
|
2586
2590
|
from.fromPath = from.text;
|
|
2587
2591
|
});
|
|
2588
2592
|
}
|
|
2593
|
+
nextTypeId() {
|
|
2594
|
+
return this._nextTypeId++;
|
|
2595
|
+
}
|
|
2589
2596
|
registerDefinition(token, asImport = false) {
|
|
2590
2597
|
if (token) {
|
|
2591
2598
|
token.isDefinition = !asImport;
|
|
@@ -2981,6 +2988,7 @@ else if (isStructure(def) || isInterface(def) || isPrimitive(def)) def = def.pro
|
|
|
2981
2988
|
_define_property$3(this, "_text", void 0);
|
|
2982
2989
|
_define_property$3(this, "resolvedAnnotations", void 0);
|
|
2983
2990
|
_define_property$3(this, "annotations", void 0);
|
|
2991
|
+
_define_property$3(this, "_nextTypeId", void 0);
|
|
2984
2992
|
_define_property$3(this, "_allMessages", void 0);
|
|
2985
2993
|
this.id = id;
|
|
2986
2994
|
this.config = config;
|
|
@@ -3000,6 +3008,7 @@ else if (isStructure(def) || isInterface(def) || isPrimitive(def)) def = def.pro
|
|
|
3000
3008
|
this._text = "";
|
|
3001
3009
|
this.resolvedAnnotations = [];
|
|
3002
3010
|
this.annotations = [];
|
|
3011
|
+
this._nextTypeId = 0;
|
|
3003
3012
|
this._allMessages = undefined;
|
|
3004
3013
|
this.registry = new IdRegistry(Array.from(config.primitives?.keys() || []));
|
|
3005
3014
|
}
|
|
@@ -3018,7 +3027,11 @@ const zeroRange = {
|
|
|
3018
3027
|
//#endregion
|
|
3019
3028
|
//#region packages/core/src/defaults/emit-annotations.ts
|
|
3020
3029
|
const emitAnnotations = { jsonSchema: new AnnotationSpec({
|
|
3021
|
-
nodeType: [
|
|
3030
|
+
nodeType: [
|
|
3031
|
+
"interface",
|
|
3032
|
+
"type",
|
|
3033
|
+
"annotate"
|
|
3034
|
+
],
|
|
3022
3035
|
description: "Pre-compute and embed JSON Schema at build time for this interface, regardless of the global jsonSchema plugin option."
|
|
3023
3036
|
}) };
|
|
3024
3037
|
|