@atscript/typescript 0.1.15 → 0.1.17
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/cli.cjs +21 -3
- package/dist/index.cjs +21 -3
- package/dist/index.mjs +21 -3
- package/dist/utils.cjs +0 -1
- package/dist/utils.mjs +0 -1
- package/package.json +2 -2
package/dist/cli.cjs
CHANGED
|
@@ -957,7 +957,6 @@ else throw new Error(`Can't find prop ${typeName}${keys}`);
|
|
|
957
957
|
}
|
|
958
958
|
if (!newBase && keys) throw new Error(`Can't find prop ${typeName}${keys}`);
|
|
959
959
|
else if (!newBase) throw new Error(`"${typeName}" is not annotated type`);
|
|
960
|
-
for (const [k, v] of newBase.metadata.entries()) if (!metadata.has(k)) metadata.set(k, Array.isArray(v) ? [...v] : v);
|
|
961
960
|
this.$type = {
|
|
962
961
|
__is_atscript_annotated_type: true,
|
|
963
962
|
type: newBase.type,
|
|
@@ -1310,7 +1309,17 @@ else handle.prop(prop.id, propHandle.$type);
|
|
|
1310
1309
|
return this;
|
|
1311
1310
|
}
|
|
1312
1311
|
const chain = ref.hasChain ? `, [${ref.chain.map((c) => `"${escapeQuotes(c.text)}"`).join(", ")}]` : "";
|
|
1313
|
-
this.writeln(`$(${name ? `"", ${name}` : ""})`).indent().writeln(`.refTo(${ref.id}${chain})`)
|
|
1312
|
+
this.writeln(`$(${name ? `"", ${name}` : ""})`).indent().writeln(`.refTo(${ref.id}${chain})`);
|
|
1313
|
+
if (!ref.hasChain) {
|
|
1314
|
+
const ownerDecl = this.doc.getDeclarationOwnerNode(ref.id);
|
|
1315
|
+
if (ownerDecl?.node) {
|
|
1316
|
+
const typeAnnotations = ownerDecl.doc.evalAnnotationsForNode(ownerDecl.node);
|
|
1317
|
+
typeAnnotations?.forEach((an) => {
|
|
1318
|
+
this.resolveAnnotationValue(ownerDecl.node, an);
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
this.unindent();
|
|
1314
1323
|
return this;
|
|
1315
1324
|
}
|
|
1316
1325
|
case "primitive": {
|
|
@@ -1454,7 +1463,16 @@ else handle.prop(prop.id, propHandle.$type);
|
|
|
1454
1463
|
return this;
|
|
1455
1464
|
}
|
|
1456
1465
|
defineMetadata(node) {
|
|
1457
|
-
let annotations
|
|
1466
|
+
let annotations;
|
|
1467
|
+
const nodeDef = node.getDefinition?.();
|
|
1468
|
+
if (nodeDef && (0, __atscript_core.isRef)(nodeDef)) {
|
|
1469
|
+
const refNode = nodeDef;
|
|
1470
|
+
if (!refNode.hasChain) {
|
|
1471
|
+
const resolved = this.doc.unwindType(refNode.id, refNode.chain)?.def;
|
|
1472
|
+
if (resolved && !(0, __atscript_core.isPrimitive)(resolved)) annotations = node.annotations ?? [];
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
if (annotations === undefined) annotations = this.doc.evalAnnotationsForNode(node);
|
|
1458
1476
|
if (this._adHocAnnotations && this._propPath.length > 0) {
|
|
1459
1477
|
const path$3 = this._propPath.join(".");
|
|
1460
1478
|
const adHoc = this._adHocAnnotations.get(path$3);
|
package/dist/index.cjs
CHANGED
|
@@ -954,7 +954,6 @@ else throw new Error(`Can't find prop ${typeName}${keys}`);
|
|
|
954
954
|
}
|
|
955
955
|
if (!newBase && keys) throw new Error(`Can't find prop ${typeName}${keys}`);
|
|
956
956
|
else if (!newBase) throw new Error(`"${typeName}" is not annotated type`);
|
|
957
|
-
for (const [k, v] of newBase.metadata.entries()) if (!metadata.has(k)) metadata.set(k, Array.isArray(v) ? [...v] : v);
|
|
958
957
|
this.$type = {
|
|
959
958
|
__is_atscript_annotated_type: true,
|
|
960
959
|
type: newBase.type,
|
|
@@ -1307,7 +1306,17 @@ else handle.prop(prop.id, propHandle.$type);
|
|
|
1307
1306
|
return this;
|
|
1308
1307
|
}
|
|
1309
1308
|
const chain = ref.hasChain ? `, [${ref.chain.map((c) => `"${escapeQuotes(c.text)}"`).join(", ")}]` : "";
|
|
1310
|
-
this.writeln(`$(${name ? `"", ${name}` : ""})`).indent().writeln(`.refTo(${ref.id}${chain})`)
|
|
1309
|
+
this.writeln(`$(${name ? `"", ${name}` : ""})`).indent().writeln(`.refTo(${ref.id}${chain})`);
|
|
1310
|
+
if (!ref.hasChain) {
|
|
1311
|
+
const ownerDecl = this.doc.getDeclarationOwnerNode(ref.id);
|
|
1312
|
+
if (ownerDecl?.node) {
|
|
1313
|
+
const typeAnnotations = ownerDecl.doc.evalAnnotationsForNode(ownerDecl.node);
|
|
1314
|
+
typeAnnotations?.forEach((an) => {
|
|
1315
|
+
this.resolveAnnotationValue(ownerDecl.node, an);
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
this.unindent();
|
|
1311
1320
|
return this;
|
|
1312
1321
|
}
|
|
1313
1322
|
case "primitive": {
|
|
@@ -1451,7 +1460,16 @@ else handle.prop(prop.id, propHandle.$type);
|
|
|
1451
1460
|
return this;
|
|
1452
1461
|
}
|
|
1453
1462
|
defineMetadata(node) {
|
|
1454
|
-
let annotations
|
|
1463
|
+
let annotations;
|
|
1464
|
+
const nodeDef = node.getDefinition?.();
|
|
1465
|
+
if (nodeDef && (0, __atscript_core.isRef)(nodeDef)) {
|
|
1466
|
+
const refNode = nodeDef;
|
|
1467
|
+
if (!refNode.hasChain) {
|
|
1468
|
+
const resolved = this.doc.unwindType(refNode.id, refNode.chain)?.def;
|
|
1469
|
+
if (resolved && !(0, __atscript_core.isPrimitive)(resolved)) annotations = node.annotations ?? [];
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
if (annotations === undefined) annotations = this.doc.evalAnnotationsForNode(node);
|
|
1455
1473
|
if (this._adHocAnnotations && this._propPath.length > 0) {
|
|
1456
1474
|
const path$2 = this._propPath.join(".");
|
|
1457
1475
|
const adHoc = this._adHocAnnotations.get(path$2);
|
package/dist/index.mjs
CHANGED
|
@@ -930,7 +930,6 @@ else throw new Error(`Can't find prop ${typeName}${keys}`);
|
|
|
930
930
|
}
|
|
931
931
|
if (!newBase && keys) throw new Error(`Can't find prop ${typeName}${keys}`);
|
|
932
932
|
else if (!newBase) throw new Error(`"${typeName}" is not annotated type`);
|
|
933
|
-
for (const [k, v] of newBase.metadata.entries()) if (!metadata.has(k)) metadata.set(k, Array.isArray(v) ? [...v] : v);
|
|
934
933
|
this.$type = {
|
|
935
934
|
__is_atscript_annotated_type: true,
|
|
936
935
|
type: newBase.type,
|
|
@@ -1283,7 +1282,17 @@ else handle.prop(prop.id, propHandle.$type);
|
|
|
1283
1282
|
return this;
|
|
1284
1283
|
}
|
|
1285
1284
|
const chain = ref.hasChain ? `, [${ref.chain.map((c) => `"${escapeQuotes(c.text)}"`).join(", ")}]` : "";
|
|
1286
|
-
this.writeln(`$(${name ? `"", ${name}` : ""})`).indent().writeln(`.refTo(${ref.id}${chain})`)
|
|
1285
|
+
this.writeln(`$(${name ? `"", ${name}` : ""})`).indent().writeln(`.refTo(${ref.id}${chain})`);
|
|
1286
|
+
if (!ref.hasChain) {
|
|
1287
|
+
const ownerDecl = this.doc.getDeclarationOwnerNode(ref.id);
|
|
1288
|
+
if (ownerDecl?.node) {
|
|
1289
|
+
const typeAnnotations = ownerDecl.doc.evalAnnotationsForNode(ownerDecl.node);
|
|
1290
|
+
typeAnnotations?.forEach((an) => {
|
|
1291
|
+
this.resolveAnnotationValue(ownerDecl.node, an);
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
this.unindent();
|
|
1287
1296
|
return this;
|
|
1288
1297
|
}
|
|
1289
1298
|
case "primitive": {
|
|
@@ -1427,7 +1436,16 @@ else handle.prop(prop.id, propHandle.$type);
|
|
|
1427
1436
|
return this;
|
|
1428
1437
|
}
|
|
1429
1438
|
defineMetadata(node) {
|
|
1430
|
-
let annotations
|
|
1439
|
+
let annotations;
|
|
1440
|
+
const nodeDef = node.getDefinition?.();
|
|
1441
|
+
if (nodeDef && isRef(nodeDef)) {
|
|
1442
|
+
const refNode = nodeDef;
|
|
1443
|
+
if (!refNode.hasChain) {
|
|
1444
|
+
const resolved = this.doc.unwindType(refNode.id, refNode.chain)?.def;
|
|
1445
|
+
if (resolved && !isPrimitive(resolved)) annotations = node.annotations ?? [];
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
if (annotations === undefined) annotations = this.doc.evalAnnotationsForNode(node);
|
|
1431
1449
|
if (this._adHocAnnotations && this._propPath.length > 0) {
|
|
1432
1450
|
const path$1 = this._propPath.join(".");
|
|
1433
1451
|
const adHoc = this._adHocAnnotations.get(path$1);
|
package/dist/utils.cjs
CHANGED
|
@@ -509,7 +509,6 @@ else throw new Error(`Can't find prop ${typeName}${keys}`);
|
|
|
509
509
|
}
|
|
510
510
|
if (!newBase && keys) throw new Error(`Can't find prop ${typeName}${keys}`);
|
|
511
511
|
else if (!newBase) throw new Error(`"${typeName}" is not annotated type`);
|
|
512
|
-
for (const [k, v] of newBase.metadata.entries()) if (!metadata.has(k)) metadata.set(k, Array.isArray(v) ? [...v] : v);
|
|
513
512
|
this.$type = {
|
|
514
513
|
__is_atscript_annotated_type: true,
|
|
515
514
|
type: newBase.type,
|
package/dist/utils.mjs
CHANGED
|
@@ -508,7 +508,6 @@ else throw new Error(`Can't find prop ${typeName}${keys}`);
|
|
|
508
508
|
}
|
|
509
509
|
if (!newBase && keys) throw new Error(`Can't find prop ${typeName}${keys}`);
|
|
510
510
|
else if (!newBase) throw new Error(`"${typeName}" is not annotated type`);
|
|
511
|
-
for (const [k, v] of newBase.metadata.entries()) if (!metadata.has(k)) metadata.set(k, Array.isArray(v) ? [...v] : v);
|
|
512
511
|
this.$type = {
|
|
513
512
|
__is_atscript_annotated_type: true,
|
|
514
513
|
type: newBase.type,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/typescript",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "Atscript: typescript-gen support.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"homepage": "https://github.com/moostjs/atscript/tree/main/packages/typescript#readme",
|
|
71
71
|
"license": "ISC",
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@atscript/core": "^0.1.
|
|
73
|
+
"@atscript/core": "^0.1.17"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@moostjs/event-cli": "^0.5.32",
|