@atscript/core 0.1.2 → 0.1.4
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 +12 -3
- package/dist/index.mjs +12 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2763,7 +2763,7 @@ else if (isStructure(def) || isInterface(def) || isPrimitive(def)) def = def.pro
|
|
|
2763
2763
|
}
|
|
2764
2764
|
if (isRef(t.parentNode)) {
|
|
2765
2765
|
const def = this.unwindType(t.parentNode.id, t.parentNode.chain)?.def;
|
|
2766
|
-
if (isPrimitive(def) && !def.config.type) {
|
|
2766
|
+
if (isPrimitive(def) && !def.config.type && def.id !== "phantom") {
|
|
2767
2767
|
const token = t.parentNode.chain[t.parentNode.chain.length - 1] || t;
|
|
2768
2768
|
this._allMessages.push({
|
|
2769
2769
|
severity: 1,
|
|
@@ -3203,7 +3203,8 @@ const primitives = {
|
|
|
3203
3203
|
undefined: {
|
|
3204
3204
|
type: "void",
|
|
3205
3205
|
documentation: "Represents no value."
|
|
3206
|
-
}
|
|
3206
|
+
},
|
|
3207
|
+
phantom: { documentation: "Phantom type. Does not affect the data type, validation, or schema. Discoverable via runtime type traversal." }
|
|
3207
3208
|
};
|
|
3208
3209
|
|
|
3209
3210
|
//#endregion
|
|
@@ -3354,6 +3355,13 @@ const expectAnnotations = {
|
|
|
3354
3355
|
})
|
|
3355
3356
|
};
|
|
3356
3357
|
|
|
3358
|
+
//#endregion
|
|
3359
|
+
//#region packages/core/src/defaults/emit-annotations.ts
|
|
3360
|
+
const emitAnnotations = { jsonSchema: new AnnotationSpec({
|
|
3361
|
+
nodeType: ["interface"],
|
|
3362
|
+
description: "Pre-compute and embed JSON Schema at build time for this interface, regardless of the global jsonSchema plugin option."
|
|
3363
|
+
}) };
|
|
3364
|
+
|
|
3357
3365
|
//#endregion
|
|
3358
3366
|
//#region packages/core/src/default-atscript-config.ts
|
|
3359
3367
|
function getDefaultAtscriptConfig() {
|
|
@@ -3361,7 +3369,8 @@ function getDefaultAtscriptConfig() {
|
|
|
3361
3369
|
primitives,
|
|
3362
3370
|
annotations: {
|
|
3363
3371
|
meta: { ...metaAnnotations },
|
|
3364
|
-
expect: { ...expectAnnotations }
|
|
3372
|
+
expect: { ...expectAnnotations },
|
|
3373
|
+
emit: { ...emitAnnotations }
|
|
3365
3374
|
}
|
|
3366
3375
|
};
|
|
3367
3376
|
return defaulTAtscriptConfig;
|
package/dist/index.mjs
CHANGED
|
@@ -2739,7 +2739,7 @@ else if (isStructure(def) || isInterface(def) || isPrimitive(def)) def = def.pro
|
|
|
2739
2739
|
}
|
|
2740
2740
|
if (isRef(t.parentNode)) {
|
|
2741
2741
|
const def = this.unwindType(t.parentNode.id, t.parentNode.chain)?.def;
|
|
2742
|
-
if (isPrimitive(def) && !def.config.type) {
|
|
2742
|
+
if (isPrimitive(def) && !def.config.type && def.id !== "phantom") {
|
|
2743
2743
|
const token = t.parentNode.chain[t.parentNode.chain.length - 1] || t;
|
|
2744
2744
|
this._allMessages.push({
|
|
2745
2745
|
severity: 1,
|
|
@@ -3179,7 +3179,8 @@ const primitives = {
|
|
|
3179
3179
|
undefined: {
|
|
3180
3180
|
type: "void",
|
|
3181
3181
|
documentation: "Represents no value."
|
|
3182
|
-
}
|
|
3182
|
+
},
|
|
3183
|
+
phantom: { documentation: "Phantom type. Does not affect the data type, validation, or schema. Discoverable via runtime type traversal." }
|
|
3183
3184
|
};
|
|
3184
3185
|
|
|
3185
3186
|
//#endregion
|
|
@@ -3330,6 +3331,13 @@ const expectAnnotations = {
|
|
|
3330
3331
|
})
|
|
3331
3332
|
};
|
|
3332
3333
|
|
|
3334
|
+
//#endregion
|
|
3335
|
+
//#region packages/core/src/defaults/emit-annotations.ts
|
|
3336
|
+
const emitAnnotations = { jsonSchema: new AnnotationSpec({
|
|
3337
|
+
nodeType: ["interface"],
|
|
3338
|
+
description: "Pre-compute and embed JSON Schema at build time for this interface, regardless of the global jsonSchema plugin option."
|
|
3339
|
+
}) };
|
|
3340
|
+
|
|
3333
3341
|
//#endregion
|
|
3334
3342
|
//#region packages/core/src/default-atscript-config.ts
|
|
3335
3343
|
function getDefaultAtscriptConfig() {
|
|
@@ -3337,7 +3345,8 @@ function getDefaultAtscriptConfig() {
|
|
|
3337
3345
|
primitives,
|
|
3338
3346
|
annotations: {
|
|
3339
3347
|
meta: { ...metaAnnotations },
|
|
3340
|
-
expect: { ...expectAnnotations }
|
|
3348
|
+
expect: { ...expectAnnotations },
|
|
3349
|
+
emit: { ...emitAnnotations }
|
|
3341
3350
|
}
|
|
3342
3351
|
};
|
|
3343
3352
|
return defaulTAtscriptConfig;
|