@atscript/core 0.1.3 → 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 CHANGED
@@ -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--) {
@@ -3203,6 +3208,10 @@ const primitives = {
3203
3208
  undefined: {
3204
3209
  type: "void",
3205
3210
  documentation: "Represents no value."
3211
+ },
3212
+ phantom: {
3213
+ type: "phantom",
3214
+ documentation: "Phantom type. Does not affect the data type, validation, or schema. Discoverable via runtime type traversal."
3206
3215
  }
3207
3216
  };
3208
3217
 
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
@@ -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--) {
@@ -3179,6 +3184,10 @@ const primitives = {
3179
3184
  undefined: {
3180
3185
  type: "void",
3181
3186
  documentation: "Represents no value."
3187
+ },
3188
+ phantom: {
3189
+ type: "phantom",
3190
+ documentation: "Phantom type. Does not affect the data type, validation, or schema. Discoverable via runtime type traversal."
3182
3191
  }
3183
3192
  };
3184
3193
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atscript/core",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Core library for Atscript parsing and file generation.",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",