@atscript/core 0.1.4 → 0.1.5
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 +10 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +10 -2
- 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) {
|
|
2767
2767
|
const token = t.parentNode.chain[t.parentNode.chain.length - 1] || t;
|
|
2768
2768
|
this._allMessages.push({
|
|
2769
2769
|
severity: 1,
|
|
@@ -2771,6 +2771,11 @@ else if (isStructure(def) || isInterface(def) || isPrimitive(def)) def = def.pro
|
|
|
2771
2771
|
range: token.range
|
|
2772
2772
|
});
|
|
2773
2773
|
}
|
|
2774
|
+
if (isPrimitive(def) && def.config.isContainer) this._allMessages.push({
|
|
2775
|
+
severity: 1,
|
|
2776
|
+
message: `"${t.parentNode.id}${t.parentNode.hasChain ? "." + t.parentNode.chain.map((c) => c.text).join(".") : ""}" is a container type — use one of its extensions`,
|
|
2777
|
+
range: t.range
|
|
2778
|
+
});
|
|
2774
2779
|
if (t.parentNode.hasChain) {
|
|
2775
2780
|
const length = t.parentNode.chain.length - 1;
|
|
2776
2781
|
for (let i = length; i >= 0; i--) {
|
|
@@ -3204,7 +3209,10 @@ const primitives = {
|
|
|
3204
3209
|
type: "void",
|
|
3205
3210
|
documentation: "Represents no value."
|
|
3206
3211
|
},
|
|
3207
|
-
phantom: {
|
|
3212
|
+
phantom: {
|
|
3213
|
+
type: "phantom",
|
|
3214
|
+
documentation: "Phantom type. Does not affect the data type, validation, or schema. Discoverable via runtime type traversal."
|
|
3215
|
+
}
|
|
3208
3216
|
};
|
|
3209
3217
|
|
|
3210
3218
|
//#endregion
|
package/dist/index.d.ts
CHANGED
|
@@ -231,6 +231,7 @@ interface TPrimitiveBaseConfig {
|
|
|
231
231
|
type?: TPrimitiveTypeDef;
|
|
232
232
|
documentation?: string;
|
|
233
233
|
tags?: string[];
|
|
234
|
+
isContainer?: boolean;
|
|
234
235
|
expect?: {
|
|
235
236
|
min?: number;
|
|
236
237
|
max?: number;
|
|
@@ -262,7 +263,7 @@ interface TPrimitiveTypeObject {
|
|
|
262
263
|
propsPatterns: Record<string, TPrimitiveTypeDef>;
|
|
263
264
|
optional?: boolean;
|
|
264
265
|
}
|
|
265
|
-
type TPrimitiveTypeFinal = 'string' | 'number' | 'boolean' | 'void' | 'null';
|
|
266
|
+
type TPrimitiveTypeFinal = 'string' | 'number' | 'boolean' | 'void' | 'null' | 'phantom';
|
|
266
267
|
type TPrimitiveTypeFinalOptional = {
|
|
267
268
|
kind: 'final';
|
|
268
269
|
value: TPrimitiveTypeFinal;
|
|
@@ -307,7 +308,7 @@ declare class SemanticPrimitiveNode extends SemanticNode {
|
|
|
307
308
|
private readonly parentKey;
|
|
308
309
|
constructor(_id: string, config: TPrimitiveConfig, parentKey?: string);
|
|
309
310
|
protected applyAnnotations(): void;
|
|
310
|
-
readonly type?: 'union' | 'intersection' | 'tuple' | 'array' | 'object' | 'string' | 'number' | 'boolean' | 'void' | 'null';
|
|
311
|
+
readonly type?: 'union' | 'intersection' | 'tuple' | 'array' | 'object' | 'string' | 'number' | 'boolean' | 'void' | 'null' | 'phantom';
|
|
311
312
|
get key(): string;
|
|
312
313
|
getAllTags(_processed?: Set<SemanticPrimitiveNode>): string[];
|
|
313
314
|
get id(): string;
|
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) {
|
|
2743
2743
|
const token = t.parentNode.chain[t.parentNode.chain.length - 1] || t;
|
|
2744
2744
|
this._allMessages.push({
|
|
2745
2745
|
severity: 1,
|
|
@@ -2747,6 +2747,11 @@ else if (isStructure(def) || isInterface(def) || isPrimitive(def)) def = def.pro
|
|
|
2747
2747
|
range: token.range
|
|
2748
2748
|
});
|
|
2749
2749
|
}
|
|
2750
|
+
if (isPrimitive(def) && def.config.isContainer) this._allMessages.push({
|
|
2751
|
+
severity: 1,
|
|
2752
|
+
message: `"${t.parentNode.id}${t.parentNode.hasChain ? "." + t.parentNode.chain.map((c) => c.text).join(".") : ""}" is a container type — use one of its extensions`,
|
|
2753
|
+
range: t.range
|
|
2754
|
+
});
|
|
2750
2755
|
if (t.parentNode.hasChain) {
|
|
2751
2756
|
const length = t.parentNode.chain.length - 1;
|
|
2752
2757
|
for (let i = length; i >= 0; i--) {
|
|
@@ -3180,7 +3185,10 @@ const primitives = {
|
|
|
3180
3185
|
type: "void",
|
|
3181
3186
|
documentation: "Represents no value."
|
|
3182
3187
|
},
|
|
3183
|
-
phantom: {
|
|
3188
|
+
phantom: {
|
|
3189
|
+
type: "phantom",
|
|
3190
|
+
documentation: "Phantom type. Does not affect the data type, validation, or schema. Discoverable via runtime type traversal."
|
|
3191
|
+
}
|
|
3184
3192
|
};
|
|
3185
3193
|
|
|
3186
3194
|
//#endregion
|