type-crafter 0.9.7 → 0.10.0

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.js CHANGED
@@ -3561,6 +3561,7 @@ function decodeTypeInfo(rawInput) {
3561
3561
  oneOf: decodeArray(rawInput.oneOf, decodeTypeInfo),
3562
3562
  allOf: decodeArray(rawInput.allOf, decodeTypeInfo),
3563
3563
  additionalProperties,
3564
+ customAttributes: isJSON(rawInput.customAttributes) ? rawInput.customAttributes : null,
3564
3565
  enum: _type === 'string'
3565
3566
  ? decodeArray(rawInput.enum, decodeString)
3566
3567
  : _type === 'number'
@@ -3636,7 +3637,11 @@ function decodeObjectTemplateInputProperty(rawInput) {
3636
3637
  const summary = decodeString(rawInput.summary);
3637
3638
  const example = decodeString(rawInput.example) ?? decodeNumber(rawInput.example);
3638
3639
  const description = decodeString(rawInput.description);
3639
- if (required !== null && _type !== null && referenced !== null && primitiveType !== null && optional !== null) {
3640
+ if (required !== null &&
3641
+ _type !== null &&
3642
+ referenced !== null &&
3643
+ primitiveType !== null &&
3644
+ optional !== null) {
3640
3645
  return {
3641
3646
  type: _type,
3642
3647
  required,
@@ -11900,202 +11905,6 @@ if (typeof commonjsRequire !== 'undefined' && commonjsRequire.extensions) {
11900
11905
 
11901
11906
  var Handlebars = /*@__PURE__*/getDefaultExportFromCjs(lib);
11902
11907
 
11903
- const isColorSupported = process.env.COLORTERM === 'truecolor';
11904
- function redLog(r) {
11905
- if (!isColorSupported) {
11906
- return r;
11907
- }
11908
- return `\x1b[41m\x1b[37m${r}\x1b[0m`;
11909
- }
11910
- function greenLog(r) {
11911
- if (!isColorSupported) {
11912
- return r;
11913
- }
11914
- return `\x1b[48;2;79;153;7m\x1b[30m${r}\x1b[0m`;
11915
- }
11916
- function darkBlue(r) {
11917
- if (!isColorSupported) {
11918
- return r;
11919
- }
11920
- return `\x1b[48;2;6;40;61m\x1b[37m${r}\x1b[0m`;
11921
- }
11922
- function logError(header, message = null) {
11923
- console.log(redLog(` Crafting failed: ${header}`));
11924
- if (message !== null) {
11925
- console.log(`${message}`);
11926
- }
11927
- }
11928
- function logSuccess(header, message) {
11929
- console.log(greenLog(` ${header} `));
11930
- console.log(`${message}`);
11931
- }
11932
- function greeting() {
11933
- console.log('\n' + darkBlue('|' + Array(50).join('‾') + '|'));
11934
- console.log(darkBlue('|' + Array(20).join(' ') + 'Type Crafter' + Array(19).join(' ') + '|'));
11935
- console.log(darkBlue('|' + Array(50).join('_') + '|') + '\n');
11936
- }
11937
-
11938
- class LanguageNotSupportedError extends Error {
11939
- constructor(language) {
11940
- super(`Language ${language} not supported`);
11941
- this.name = 'LanguageNotSupportedError';
11942
- }
11943
- }
11944
- class InvalidParamError extends Error {
11945
- constructor(key, value) {
11946
- super(`Invalid Param ${value} for ${key}`);
11947
- this.name = 'InvalidParamError';
11948
- }
11949
- }
11950
- class InvalidSpecFileError extends Error {
11951
- constructor(param) {
11952
- super(`Bad spec file \n${param ?? ''}`);
11953
- this.name = 'InvalidSpecFileError';
11954
- }
11955
- }
11956
- class RuntimeError extends Error {
11957
- constructor(message) {
11958
- super(message);
11959
- this.name = 'RuntimeError';
11960
- }
11961
- }
11962
- class UnsupportedFeatureError extends Error {
11963
- constructor(message) {
11964
- super(message);
11965
- this.name = 'UnsupportedFeatureError';
11966
- }
11967
- }
11968
- function handleErrors(error) {
11969
- if (error instanceof Error) {
11970
- if ('code' in error &&
11971
- 'path' in error &&
11972
- typeof error.path === 'string' &&
11973
- error.code === 'ENOENT') {
11974
- logError('File not found', 'Failed to read file on path: ' + error.path);
11975
- }
11976
- else {
11977
- logError(error.name, error.message);
11978
- }
11979
- }
11980
- }
11981
-
11982
- let config$2 = null;
11983
- let specFileData = null;
11984
- let objectSyntaxTemplate = null;
11985
- let exporterModuleSyntaxTemplate = null;
11986
- let typesFileSyntaxTemplate = null;
11987
- let oneOfSyntaxTemplate = null;
11988
- let enumSyntaxTemplate = null;
11989
- let allOfSyntaxTemplate = null;
11990
- const cachedReferencedTypes = new Map();
11991
- let expectedOutputFiles = null;
11992
- function setConfig(newConfig) {
11993
- config$2 = newConfig;
11994
- }
11995
- function getConfig() {
11996
- if (config$2 === null) {
11997
- throw new RuntimeError('Failed to load configuration!');
11998
- }
11999
- return config$2;
12000
- }
12001
- function setSpecFileData(newSpecFileData) {
12002
- specFileData = newSpecFileData;
12003
- }
12004
- function getSpecFileData() {
12005
- if (specFileData === null) {
12006
- throw new RuntimeError('Failed to load Spec file data!');
12007
- }
12008
- return specFileData;
12009
- }
12010
- function compileTemplates() {
12011
- const config = getConfig();
12012
- objectSyntaxTemplate = Handlebars.compile(config.template.objectSyntax);
12013
- exporterModuleSyntaxTemplate = Handlebars.compile(config.template.exporterModuleSyntax);
12014
- typesFileSyntaxTemplate = Handlebars.compile(config.template.typesFileSyntax);
12015
- enumSyntaxTemplate = Handlebars.compile(config.template.enumSyntax);
12016
- oneOfSyntaxTemplate = Handlebars.compile(config.template.oneOfSyntax);
12017
- allOfSyntaxTemplate = Handlebars.compile(config.template.allOfSyntax);
12018
- }
12019
- function getObjectTemplate() {
12020
- if (objectSyntaxTemplate === null) {
12021
- throw new RuntimeError('Object template not compiled!');
12022
- }
12023
- return objectSyntaxTemplate;
12024
- }
12025
- function getExporterModuleTemplate() {
12026
- if (exporterModuleSyntaxTemplate === null) {
12027
- throw new RuntimeError('Exporter module template not compiled!');
12028
- }
12029
- return exporterModuleSyntaxTemplate;
12030
- }
12031
- function getTypesFileTemplate() {
12032
- if (typesFileSyntaxTemplate === null) {
12033
- throw new RuntimeError('Types file template not compiled!');
12034
- }
12035
- return typesFileSyntaxTemplate;
12036
- }
12037
- function getEnumTemplate() {
12038
- if (enumSyntaxTemplate === null) {
12039
- throw new RuntimeError('Enum template not compiled!');
12040
- }
12041
- return enumSyntaxTemplate;
12042
- }
12043
- function getOneOfTemplate() {
12044
- if (oneOfSyntaxTemplate === null) {
12045
- throw new RuntimeError('OneOf template not compiled!');
12046
- }
12047
- return oneOfSyntaxTemplate;
12048
- }
12049
- function setExpectedOutputFiles(newExpectedOutputFiles) {
12050
- expectedOutputFiles = newExpectedOutputFiles;
12051
- }
12052
- function getExpectedOutputFiles() {
12053
- if (expectedOutputFiles === null) {
12054
- throw new RuntimeError('Expected output files not set!');
12055
- }
12056
- return expectedOutputFiles;
12057
- }
12058
- function getCachedReferencedTypes() {
12059
- return cachedReferencedTypes;
12060
- }
12061
- function getCachedReferenceType(referencePath) {
12062
- return cachedReferencedTypes.get(referencePath) ?? null;
12063
- }
12064
- function cacheReferenceType(referencePath, generatedData) {
12065
- cachedReferencedTypes.set(referencePath, generatedData);
12066
- }
12067
- function getInputFilePath(absolutePath = true) {
12068
- if (config$2 === null) {
12069
- throw new RuntimeError('Spec file path not set!');
12070
- }
12071
- return absolutePath ? resolveFilePath(config$2.input) : config$2.input;
12072
- }
12073
- function getAllOfTemplate() {
12074
- if (allOfSyntaxTemplate === null) {
12075
- throw new RuntimeError('AllOf template not compiled!');
12076
- }
12077
- return allOfSyntaxTemplate;
12078
- }
12079
- var Runtime = {
12080
- getConfig,
12081
- setConfig,
12082
- setSpecFileData,
12083
- setExpectedOutputFiles,
12084
- getSpecFileData,
12085
- getObjectTemplate,
12086
- getExporterModuleTemplate,
12087
- getTypesFileTemplate,
12088
- getEnumTemplate,
12089
- getExpectedOutputFiles,
12090
- compileTemplates,
12091
- getOneOfTemplate,
12092
- getCachedReferencedTypes,
12093
- getCachedReferenceType,
12094
- cacheReferenceType,
12095
- getInputFilePath,
12096
- getAllOfTemplate
12097
- };
12098
-
12099
11908
  const ALIAS = Symbol.for('yaml.alias');
12100
11909
  const DOC = Symbol.for('yaml.document');
12101
11910
  const MAP = Symbol.for('yaml.map');
@@ -19470,6 +19279,202 @@ async function readYaml(filePath) {
19470
19279
  return YAML.parse(fileData);
19471
19280
  }
19472
19281
 
19282
+ const isColorSupported = process.env.COLORTERM === 'truecolor';
19283
+ function redLog(r) {
19284
+ if (!isColorSupported) {
19285
+ return r;
19286
+ }
19287
+ return `\x1b[41m\x1b[37m${r}\x1b[0m`;
19288
+ }
19289
+ function greenLog(r) {
19290
+ if (!isColorSupported) {
19291
+ return r;
19292
+ }
19293
+ return `\x1b[48;2;79;153;7m\x1b[30m${r}\x1b[0m`;
19294
+ }
19295
+ function darkBlue(r) {
19296
+ if (!isColorSupported) {
19297
+ return r;
19298
+ }
19299
+ return `\x1b[48;2;6;40;61m\x1b[37m${r}\x1b[0m`;
19300
+ }
19301
+ function logError(header, message = null) {
19302
+ console.log(redLog(` Crafting failed: ${header}`));
19303
+ if (message !== null) {
19304
+ console.log(`${message}`);
19305
+ }
19306
+ }
19307
+ function logSuccess(header, message) {
19308
+ console.log(greenLog(` ${header} `));
19309
+ console.log(`${message}`);
19310
+ }
19311
+ function greeting() {
19312
+ console.log('\n' + darkBlue('|' + Array(50).join('‾') + '|'));
19313
+ console.log(darkBlue('|' + Array(20).join(' ') + 'Type Crafter' + Array(19).join(' ') + '|'));
19314
+ console.log(darkBlue('|' + Array(50).join('_') + '|') + '\n');
19315
+ }
19316
+
19317
+ class LanguageNotSupportedError extends Error {
19318
+ constructor(language) {
19319
+ super(`Language ${language} not supported`);
19320
+ this.name = 'LanguageNotSupportedError';
19321
+ }
19322
+ }
19323
+ class InvalidParamError extends Error {
19324
+ constructor(key, value) {
19325
+ super(`Invalid Param ${value} for ${key}`);
19326
+ this.name = 'InvalidParamError';
19327
+ }
19328
+ }
19329
+ class InvalidSpecFileError extends Error {
19330
+ constructor(param) {
19331
+ super(`Bad spec file \n${param ?? ''}`);
19332
+ this.name = 'InvalidSpecFileError';
19333
+ }
19334
+ }
19335
+ class RuntimeError extends Error {
19336
+ constructor(message) {
19337
+ super(message);
19338
+ this.name = 'RuntimeError';
19339
+ }
19340
+ }
19341
+ class UnsupportedFeatureError extends Error {
19342
+ constructor(message) {
19343
+ super(message);
19344
+ this.name = 'UnsupportedFeatureError';
19345
+ }
19346
+ }
19347
+ function handleErrors(error) {
19348
+ if (error instanceof Error) {
19349
+ if ('code' in error &&
19350
+ 'path' in error &&
19351
+ typeof error.path === 'string' &&
19352
+ error.code === 'ENOENT') {
19353
+ logError('File not found', 'Failed to read file on path: ' + error.path);
19354
+ }
19355
+ else {
19356
+ logError(error.name, error.message);
19357
+ }
19358
+ }
19359
+ }
19360
+
19361
+ let config$2 = null;
19362
+ let specFileData = null;
19363
+ let objectSyntaxTemplate = null;
19364
+ let exporterModuleSyntaxTemplate = null;
19365
+ let typesFileSyntaxTemplate = null;
19366
+ let oneOfSyntaxTemplate = null;
19367
+ let enumSyntaxTemplate = null;
19368
+ let allOfSyntaxTemplate = null;
19369
+ const cachedReferencedTypes = new Map();
19370
+ let expectedOutputFiles = null;
19371
+ function setConfig(newConfig) {
19372
+ config$2 = newConfig;
19373
+ }
19374
+ function getConfig() {
19375
+ if (config$2 === null) {
19376
+ throw new RuntimeError('Failed to load configuration!');
19377
+ }
19378
+ return config$2;
19379
+ }
19380
+ function setSpecFileData(newSpecFileData) {
19381
+ specFileData = newSpecFileData;
19382
+ }
19383
+ function getSpecFileData() {
19384
+ if (specFileData === null) {
19385
+ throw new RuntimeError('Failed to load Spec file data!');
19386
+ }
19387
+ return specFileData;
19388
+ }
19389
+ function compileTemplates() {
19390
+ const config = getConfig();
19391
+ objectSyntaxTemplate = Handlebars.compile(config.template.objectSyntax);
19392
+ exporterModuleSyntaxTemplate = Handlebars.compile(config.template.exporterModuleSyntax);
19393
+ typesFileSyntaxTemplate = Handlebars.compile(config.template.typesFileSyntax);
19394
+ enumSyntaxTemplate = Handlebars.compile(config.template.enumSyntax);
19395
+ oneOfSyntaxTemplate = Handlebars.compile(config.template.oneOfSyntax);
19396
+ allOfSyntaxTemplate = Handlebars.compile(config.template.allOfSyntax);
19397
+ }
19398
+ function getObjectTemplate() {
19399
+ if (objectSyntaxTemplate === null) {
19400
+ throw new RuntimeError('Object template not compiled!');
19401
+ }
19402
+ return objectSyntaxTemplate;
19403
+ }
19404
+ function getExporterModuleTemplate() {
19405
+ if (exporterModuleSyntaxTemplate === null) {
19406
+ throw new RuntimeError('Exporter module template not compiled!');
19407
+ }
19408
+ return exporterModuleSyntaxTemplate;
19409
+ }
19410
+ function getTypesFileTemplate() {
19411
+ if (typesFileSyntaxTemplate === null) {
19412
+ throw new RuntimeError('Types file template not compiled!');
19413
+ }
19414
+ return typesFileSyntaxTemplate;
19415
+ }
19416
+ function getEnumTemplate() {
19417
+ if (enumSyntaxTemplate === null) {
19418
+ throw new RuntimeError('Enum template not compiled!');
19419
+ }
19420
+ return enumSyntaxTemplate;
19421
+ }
19422
+ function getOneOfTemplate() {
19423
+ if (oneOfSyntaxTemplate === null) {
19424
+ throw new RuntimeError('OneOf template not compiled!');
19425
+ }
19426
+ return oneOfSyntaxTemplate;
19427
+ }
19428
+ function setExpectedOutputFiles(newExpectedOutputFiles) {
19429
+ expectedOutputFiles = newExpectedOutputFiles;
19430
+ }
19431
+ function getExpectedOutputFiles() {
19432
+ if (expectedOutputFiles === null) {
19433
+ throw new RuntimeError('Expected output files not set!');
19434
+ }
19435
+ return expectedOutputFiles;
19436
+ }
19437
+ function getCachedReferencedTypes() {
19438
+ return cachedReferencedTypes;
19439
+ }
19440
+ function getCachedReferenceType(referencePath) {
19441
+ return cachedReferencedTypes.get(referencePath) ?? null;
19442
+ }
19443
+ function cacheReferenceType(referencePath, generatedData) {
19444
+ cachedReferencedTypes.set(referencePath, generatedData);
19445
+ }
19446
+ function getInputFilePath(absolutePath = true) {
19447
+ if (config$2 === null) {
19448
+ throw new RuntimeError('Spec file path not set!');
19449
+ }
19450
+ return absolutePath ? resolveFilePath(config$2.input) : config$2.input;
19451
+ }
19452
+ function getAllOfTemplate() {
19453
+ if (allOfSyntaxTemplate === null) {
19454
+ throw new RuntimeError('AllOf template not compiled!');
19455
+ }
19456
+ return allOfSyntaxTemplate;
19457
+ }
19458
+ var Runtime = {
19459
+ getConfig,
19460
+ setConfig,
19461
+ setSpecFileData,
19462
+ setExpectedOutputFiles,
19463
+ getSpecFileData,
19464
+ getObjectTemplate,
19465
+ getExporterModuleTemplate,
19466
+ getTypesFileTemplate,
19467
+ getEnumTemplate,
19468
+ getExpectedOutputFiles,
19469
+ compileTemplates,
19470
+ getOneOfTemplate,
19471
+ getCachedReferencedTypes,
19472
+ getCachedReferenceType,
19473
+ cacheReferenceType,
19474
+ getInputFilePath,
19475
+ getAllOfTemplate
19476
+ };
19477
+
19473
19478
  function addValuesToMappedSet(map, key, values) {
19474
19479
  const existingValues = map.get(key);
19475
19480
  map.set(key, typeof existingValues === 'undefined'
@@ -19637,6 +19642,17 @@ function stripPrefix(value, prefix) {
19637
19642
  return value.startsWith(prefix) ? value.slice(prefix.length) : value;
19638
19643
  }
19639
19644
  // #endregion
19645
+ // #region type utils
19646
+ function isPrimitiveType(typeInfo) {
19647
+ return (typeInfo.type !== null &&
19648
+ typeInfo.type !== 'object' &&
19649
+ typeInfo.type !== 'array' &&
19650
+ typeInfo.$ref === null &&
19651
+ typeInfo.oneOf === null &&
19652
+ typeInfo.allOf === null &&
19653
+ typeInfo.enum === null);
19654
+ }
19655
+ // #endregion
19640
19656
 
19641
19657
  function getReferenceMeta(reference) {
19642
19658
  const slashedParts = reference.split('/');
@@ -19812,7 +19828,8 @@ async function generateObjectType(typeName, typeInfo, parentTypes) {
19812
19828
  description: typeInfo.description,
19813
19829
  example: typeInfo.example,
19814
19830
  summary: typeInfo.summary,
19815
- properties: {}
19831
+ properties: {},
19832
+ customAttributes: typeInfo.customAttributes
19816
19833
  };
19817
19834
  const compositions = [];
19818
19835
  let dynamicGeneratedType = '';
@@ -19855,6 +19872,7 @@ async function generateObjectType(typeName, typeInfo, parentTypes) {
19855
19872
  references.push(...arrayDataGenOutput.references);
19856
19873
  languageDataType = arrayDataGenOutput.templateInput.type;
19857
19874
  composerType = arrayDataGenOutput.templateInput.composerType ?? null;
19875
+ dynamicGeneratedType += arrayDataGenOutput.content;
19858
19876
  }
19859
19877
  else if (propertyType === 'object') {
19860
19878
  recursivePropertyName = typeName + toPascalCase(propertyName);
@@ -19937,7 +19955,23 @@ async function generateArrayType(typeName, typeInfo, parentTypes) {
19937
19955
  if (typeInfo.items === null) {
19938
19956
  throw new InvalidSpecFileError('Invalid array type for: ' + typeName);
19939
19957
  }
19940
- const arrayItemsType = await generateType(typeName + 'Item', typeInfo.items, parentTypes);
19958
+ const isPrimitiveItemType = isPrimitiveType(typeInfo.items);
19959
+ const isEnumItemType = typeInfo.items.enum !== null;
19960
+ let arrayItemsType;
19961
+ let itemTypeName = null;
19962
+ let dynamicGeneratedType = '';
19963
+ if (isPrimitiveItemType) {
19964
+ arrayItemsType = getPrimitiveType(typeName + 'Item', typeInfo.items);
19965
+ }
19966
+ else if (isEnumItemType) {
19967
+ itemTypeName = toPascalCase(typeName) + 'Item';
19968
+ arrayItemsType = generateEnumType(itemTypeName, typeInfo.items);
19969
+ dynamicGeneratedType += arrayItemsType.content;
19970
+ arrayItemsType.templateInput.type = itemTypeName;
19971
+ }
19972
+ else {
19973
+ arrayItemsType = await generateType(typeName + 'Item', typeInfo.items, parentTypes);
19974
+ }
19941
19975
  if (typeof arrayItemsType.templateInput?.type === 'undefined') {
19942
19976
  throw new InvalidSpecFileError('Invalid array type for: ' + typeName);
19943
19977
  }
@@ -19948,7 +19982,7 @@ async function generateArrayType(typeName, typeInfo, parentTypes) {
19948
19982
  }
19949
19983
  const dataType = fillPatterns(arrayTypeMap, fillerPatterns);
19950
19984
  const result = {
19951
- content: '',
19985
+ content: dynamicGeneratedType,
19952
19986
  references: arrayItemsType.references,
19953
19987
  primitives: new Set([...arrayItemsType.primitives, 'Array']),
19954
19988
  templateInput: {
@@ -19960,6 +19994,9 @@ async function generateArrayType(typeName, typeInfo, parentTypes) {
19960
19994
  summary: typeInfo.summary
19961
19995
  }
19962
19996
  };
19997
+ if (isEnumItemType && itemTypeName) {
19998
+ result.references.add(itemTypeName);
19999
+ }
19963
20000
  return result;
19964
20001
  }
19965
20002
  function generateVariableType(typeName, typeInfo) {
@@ -20513,7 +20550,7 @@ async function runner(language, inputFilePath, outputDirectory, _typesWriterMode
20513
20550
  }
20514
20551
  }
20515
20552
  greeting();
20516
- const program = new Command().version('0.9.7');
20553
+ const program = new Command().version('0.10.0');
20517
20554
  program
20518
20555
  .command('generate')
20519
20556
  .description('Generate types for your language from a type spec file')
@@ -72,6 +72,7 @@ export function decode{{typeName}}(rawInput: unknown): {{typeName}} | null {
72
72
  return null;
73
73
  }
74
74
 
75
+ {{#if customAttributes.generateOptionalDecoder}}
75
76
  export function _decode{{typeName}}(rawInput: unknown): {{typeName}} | undefined {
76
77
  if (isJSON(rawInput)) {
77
78
  {{#each properties}}
@@ -108,3 +109,4 @@ export function _decode{{typeName}}(rawInput: unknown): {{typeName}} | undefined
108
109
  }
109
110
  return;
110
111
  }
112
+ {{/if}}
@@ -83,6 +83,7 @@ export type TypeInfo = TypeDescriptors & {
83
83
  allOf: TypeInfo[] | null;
84
84
  enum: string[] | number[] | null;
85
85
  additionalProperties: AdditionalProperties | null;
86
+ customAttributes?: Record<string, unknown> | null;
86
87
  };
87
88
  export type AdditionalProperties = KeyedAdditionalProperties | TypeInfo | boolean;
88
89
  export type KeyedAdditionalProperties = {
@@ -103,6 +104,7 @@ export type ObjectTemplateInput = TypeDescriptors & {
103
104
  type: string;
104
105
  properties: ObjectTemplateInputProperties;
105
106
  additionalProperties?: AdditionalPropertiesTemplateInput;
107
+ customAttributes?: Record<string, unknown> | null;
106
108
  };
107
109
  export type ObjectTemplateInputProperties = Record<PropertyName, ObjectTemplateInputProperty>;
108
110
  export type ObjectTemplateInputProperty = TypeDescriptors & {
@@ -1,3 +1,4 @@
1
+ import { type TypeInfo, type TypeDataType } from '$types';
1
2
  import { type JSONObject } from 'type-decoder';
2
3
  export * from './file-system';
3
4
  export * from './logger';
@@ -15,3 +16,5 @@ export declare function registerTemplateHelpers(): void;
15
16
  export declare function readNestedValue(json: unknown, keyPath: string[]): JSONObject;
16
17
  export declare function generateRelativePath(fromPath: string, toPath: string): string;
17
18
  export declare function stripPrefix(value: string, prefix: string): string;
19
+ export declare function isPrimitiveType(typeInfo: TypeInfo): boolean;
20
+ export declare function isSimplePrimitiveType(type: TypeDataType | null): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "type-crafter",
3
- "version": "0.9.7",
3
+ "version": "0.10.0",
4
4
  "description": "A tool to generate types from a yaml schema for any language",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",
@@ -19,6 +19,7 @@
19
19
  "lint:all": "eslint . --ext .ts",
20
20
  "clean:output": "rm -rf dist",
21
21
  "build": "npm run clean:output && rollup --config rollup.config.js",
22
+ "build:version": "npm run clean:output && rollup --config rollup.config.js --environment",
22
23
  "publish": "node scripts/publish.js",
23
24
  "changeset:version": "changeset version && git add --all"
24
25
  },