@vinodotdev/codegen
Advanced tools
Comparing version 3.0.1 to 4.0.0
@@ -12,8 +12,5 @@ import DEBUG from 'debug'; | ||
export declare enum CODEGEN_TYPE { | ||
ProviderComponents = "provider-components", | ||
ProviderIntegration = "provider-integration", | ||
WellKnownImplementer = "wellknown-implementer", | ||
Component = "component", | ||
Integration = "integration", | ||
Interface = "interface", | ||
WapcComponents = "wapc-components", | ||
WapcIntegration = "wapc-integration", | ||
WapcLib = "wapc-lib" | ||
@@ -33,3 +30,3 @@ } | ||
}; | ||
export declare const DEFAULT_CODEGEN_TYPE = CODEGEN_TYPE.WapcIntegration; | ||
export declare const DEFAULT_CODEGEN_TYPE = CODEGEN_TYPE.Integration; | ||
export declare function readFile(path: string): string; | ||
@@ -44,3 +41,3 @@ export interface NormalizedFilename { | ||
export declare function normalizeFilename(filename: string): NormalizedFilename; | ||
export declare function getTemplate(language: LANGUAGE, type: CODEGEN_TYPE | WIDL_TYPE | JSON_TYPE): string; | ||
export declare function getTemplate(language: LANGUAGE, type: CODEGEN_TYPE | WIDL_TYPE | JSON_TYPE): (data: any) => string; | ||
export declare function registerPartial(language: LANGUAGE, partial: string): void; | ||
@@ -72,4 +69,4 @@ export declare function registerTypePartials(language: LANGUAGE, type: CODEGEN_TYPE | WIDL_TYPE | JSON_TYPE): void; | ||
} | ||
export declare function commitOutput(src: string, path?: string, options?: CommitOptions): void; | ||
export declare function commitOutput(src: string, filePath?: string, options?: CommitOptions): void; | ||
export declare function readInterface(interfacePath: string): ProviderSignature; | ||
export {}; |
@@ -22,8 +22,5 @@ "use strict"; | ||
(function (CODEGEN_TYPE) { | ||
CODEGEN_TYPE["ProviderComponents"] = "provider-components"; | ||
CODEGEN_TYPE["ProviderIntegration"] = "provider-integration"; | ||
CODEGEN_TYPE["WellKnownImplementer"] = "wellknown-implementer"; | ||
CODEGEN_TYPE["Component"] = "component"; | ||
CODEGEN_TYPE["Integration"] = "integration"; | ||
CODEGEN_TYPE["Interface"] = "interface"; | ||
CODEGEN_TYPE["WapcComponents"] = "wapc-components"; | ||
CODEGEN_TYPE["WapcIntegration"] = "wapc-integration"; | ||
CODEGEN_TYPE["WapcLib"] = "wapc-lib"; | ||
@@ -45,3 +42,3 @@ })(CODEGEN_TYPE = exports.CODEGEN_TYPE || (exports.CODEGEN_TYPE = {})); | ||
}; | ||
exports.DEFAULT_CODEGEN_TYPE = CODEGEN_TYPE.WapcIntegration; | ||
exports.DEFAULT_CODEGEN_TYPE = CODEGEN_TYPE.Integration; | ||
function readFile(path) { | ||
@@ -69,6 +66,19 @@ try { | ||
exports.normalizeFilename = normalizeFilename; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function getTemplate(language, type) { | ||
const templatePath = path_1.default.join((0, find_root_1.default)(__dirname), 'templates', language, `${type}.hbs`); | ||
(0, exports.debug)('Reading template %o->%o located at %o', language, type, templatePath); | ||
return readFile(templatePath); | ||
(0, exports.debug)('Compiling template from %o', templatePath); | ||
const template = widl_template_1.handlebars.compile(readFile(templatePath)); | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return (data) => { | ||
try { | ||
exports.debug.extend('trace')('Rendering template %o with data %o', path_1.default.basename(templatePath), data); | ||
return template(data); | ||
} | ||
catch (e) { | ||
console.error(`Error rendering template: ${e}`); | ||
throw e; | ||
} | ||
}; | ||
} | ||
@@ -87,3 +97,3 @@ exports.getTemplate = getTemplate; | ||
const dir = path_1.default.join((0, find_root_1.default)(__dirname), 'templates', relativeDir); | ||
(0, exports.debug)(`Looking for partials in ${dir}`); | ||
(0, exports.debug)(`Looking for partials in %o`, dir); | ||
if (!fs_1.default.existsSync(dir)) | ||
@@ -95,6 +105,6 @@ return; | ||
const partialPath = path_1.default.join(dir, file); | ||
(0, exports.debug)(`Loading partial ${partialPath}`); | ||
(0, exports.debug)(`Loading partial %o`, partialPath); | ||
const exists = fs_1.default.existsSync(partialPath); | ||
if (exists) { | ||
(0, exports.debug)(`Registering partial for ${language}.${type}`); | ||
(0, exports.debug)(`Registering partial for %o:%o`, language, type); | ||
const partialSource = readFile(partialPath); | ||
@@ -107,2 +117,3 @@ widl_template_1.handlebars.registerPartial(name, partialSource); | ||
function registerLanguageHelpers(lang) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
widl_template_1.handlebars.registerHelper('ifEmpty', function (context, options) { | ||
@@ -147,3 +158,3 @@ let isEmpty = false; | ||
const dir = path_1.default.join((0, find_root_1.default)(__dirname), 'templates', relativeDir); | ||
(0, exports.debug)(`Looking for partials in ${dir}`); | ||
(0, exports.debug)(`Looking for partials in %o`, dir); | ||
if (!fs_1.default.existsSync(dir)) | ||
@@ -155,6 +166,6 @@ return; | ||
const partialPath = path_1.default.join(dir, file); | ||
(0, exports.debug)(`Loading partial ${partialPath}`); | ||
(0, exports.debug)(`Loading partial %o`, partialPath); | ||
const exists = fs_1.default.existsSync(partialPath); | ||
if (exists) { | ||
(0, exports.debug)(`Registering common partial for ${language}: ${name}`); | ||
(0, exports.debug)(`Registering common partial for %o: %o`, language, name); | ||
const partialSource = readFile(partialPath); | ||
@@ -200,3 +211,3 @@ widl_template_1.handlebars.registerPartial(name, partialSource); | ||
alias: 'output', | ||
describe: 'The output destination (defaults to STDOUT for text)', | ||
describe: 'The output file or directory (defaults to STDOUT for text)', | ||
default: undefined, | ||
@@ -223,19 +234,24 @@ type: 'string', | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
function commitOutput(src, path, options = {}) { | ||
if (path) { | ||
if (fs_1.default.existsSync(path)) { | ||
function commitOutput(src, filePath, options = {}) { | ||
if (filePath) { | ||
const basedir = path_1.default.dirname(filePath); | ||
if (!fs_1.default.existsSync(basedir)) { | ||
(0, exports.debug)('Directory "%o" does not exist, creating it.', basedir); | ||
fs_1.default.mkdirSync(basedir); | ||
} | ||
if (fs_1.default.existsSync(filePath)) { | ||
if (options.force) { | ||
(0, exports.debug)(`${path} exists, overwriting anyway because of --force`); | ||
(0, exports.debug)(`%o exists, overwriting anyway because of --force`, filePath); | ||
} | ||
else { | ||
const contents = fs_1.default.readFileSync(path, 'utf-8'); | ||
const contents = fs_1.default.readFileSync(filePath, 'utf-8'); | ||
if (contents.startsWith('/* stub */')) { | ||
(0, exports.debug)(`${path} exists but is a stub file, overwriting`); | ||
(0, exports.debug)(`%o exists but is a stub file, overwriting`, filePath); | ||
} | ||
else { | ||
(0, exports.debug)(`Refusing to overwrite ${path}`); | ||
(0, exports.debug)(`Refusing to overwrite %o`, filePath); | ||
if (options.silent) | ||
return; | ||
else { | ||
(0, exports.debug)(`${path} exists, to overwrite pass --force to the codegen or delete the file`); | ||
(0, exports.debug)(`%o exists, to overwrite pass --force to the codegen or delete the file`, filePath); | ||
return; | ||
@@ -246,4 +262,10 @@ } | ||
} | ||
(0, exports.debug)(`Attempting to write to ${path}`); | ||
fs_1.default.writeFileSync(path, src); | ||
(0, exports.debug)(`Write to %o`, filePath); | ||
try { | ||
fs_1.default.writeFileSync(filePath, src); | ||
} | ||
catch (e) { | ||
console.error(`Error writing output to ${filePath}: `, e); | ||
throw e; | ||
} | ||
} | ||
@@ -256,2 +278,3 @@ else { | ||
function readInterface(interfacePath) { | ||
(0, exports.debug)('Reading interface JSON at %o', interfacePath); | ||
const ifaceJson = fs_1.default.readFileSync(interfacePath, 'utf-8'); | ||
@@ -258,0 +281,0 @@ const iface = JSON.parse(ifaceJson); |
import yargs from 'yargs'; | ||
import { CommonWidlOptions, CommonOutputOptions } from '../../common'; | ||
export declare const command: string; | ||
export declare const desc = "Generate source code for well-known interfaces"; | ||
export declare const desc = "Generate the Vino integration code for all component schemas"; | ||
export declare const builder: (yargs: yargs.Argv<{}>) => yargs.Argv<{}>; | ||
interface Arguments extends CommonWidlOptions, CommonOutputOptions { | ||
schema_dir: string; | ||
interface: string; | ||
} | ||
export declare function handler(args: Arguments): void; | ||
export {}; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -9,18 +6,15 @@ exports.handler = exports.builder = exports.desc = exports.command = void 0; | ||
const common_1 = require("../../common"); | ||
const path_1 = __importDefault(require("path")); | ||
const fs_1 = __importDefault(require("fs")); | ||
const process_widl_dir_1 = require("../../process-widl-dir"); | ||
const LANG = common_1.LANGUAGE.Rust; | ||
const TYPE = common_1.CODEGEN_TYPE.Interface; | ||
exports.command = `${TYPE} <schema_dir> [options]`; | ||
exports.desc = 'Generate source code for well-known interfaces'; | ||
exports.command = `${TYPE} <interface> [options]`; | ||
exports.desc = 'Generate the Vino integration code for all component schemas'; | ||
const builder = (yargs) => { | ||
return yargs | ||
.positional('schema_dir', { | ||
.positional('interface', { | ||
demandOption: true, | ||
type: 'string', | ||
description: 'Path to WIDL schema directory', | ||
description: 'Path to interface JSON', | ||
}) | ||
.options((0, common_1.outputOpts)((0, common_1.widlOpts)({}))) | ||
.example(`rust ${TYPE} schemas/`, 'Prints generated code to STDOUT'); | ||
.example(`rust ${TYPE} interface.json`, 'Prints generated code to STDOUT'); | ||
}; | ||
@@ -34,11 +28,5 @@ exports.builder = builder; | ||
(0, widl_template_1.registerHelpers)(options); | ||
const files = fs_1.default.readdirSync(args.schema_dir).filter(path => path.endsWith('.widl')); | ||
const schemas = files.map(file => { | ||
const widlSrc = (0, common_1.readFile)(path_1.default.join(args.schema_dir, file)); | ||
const tree = (0, widl_template_1.parseWidl)(widlSrc); | ||
return { file: (0, common_1.normalizeFilename)(file), document: tree }; | ||
}); | ||
const template = widl_template_1.handlebars.compile((0, common_1.getTemplate)(LANG, TYPE)); | ||
const iface = (0, process_widl_dir_1.processDir)('', args.schema_dir); | ||
const generated = template({ schemas, interface: iface }); | ||
const template = (0, common_1.getTemplate)(LANG, TYPE); | ||
const iface = (0, common_1.readInterface)(args.interface); | ||
const generated = template({ interface: iface }); | ||
(0, common_1.commitOutput)(generated, args.output, { force: args.force, silent: args.silent }); | ||
@@ -45,0 +33,0 @@ } |
@@ -21,3 +21,3 @@ "use strict"; | ||
(0, widl_template_1.registerHelpers)(options); | ||
const template = widl_template_1.handlebars.compile((0, common_1.getTemplate)(LANG, TYPE)); | ||
const template = (0, common_1.getTemplate)(LANG, TYPE); | ||
const generated = template({}); | ||
@@ -24,0 +24,0 @@ (0, common_1.commitOutput)(generated, args.output, { force: args.force, silent: args.silent }); |
@@ -17,3 +17,3 @@ "use strict"; | ||
(0, widl_template_1.registerHelpers)(); | ||
const template = widl_template_1.handlebars.compile((0, common_1.getTemplate)(LANG, TYPE)); | ||
const template = (0, common_1.getTemplate)(LANG, TYPE); | ||
const generated = template({}); | ||
@@ -20,0 +20,0 @@ (0, common_1.commitOutput)(generated, args.output, { force: args.force, silent: args.silent }); |
@@ -66,2 +66,6 @@ "use strict"; | ||
} | ||
else if (name.value === 'struct') { | ||
// TODO: convert this to core WIDL type once widl can represent it (see also: https://github.com/wapc/cli/issues/8) | ||
return { type: 'struct' }; | ||
} | ||
else { | ||
@@ -68,0 +72,0 @@ return { type: 'ref', ref: `#/types/${name.value}` }; |
export declare type WIDL_TYPE = 'i8' | 'u8' | 'i16' | 'u16' | 'i32' | 'u32' | 'i64' | 'u64' | 'f32' | 'f64' | 'bool' | 'string' | 'datetime' | 'bytes' | 'raw' | 'value'; | ||
export declare const WIDL_TYPE_LIST: string[]; | ||
export declare type TypeMap = Record<string, TypeSignature>; | ||
export declare type TypeSignature = SimpleType | RefType | ListType | OptionalType | MapType | LinkType; | ||
export declare type TypeSignature = SimpleType | StructType | RefType | ListType | OptionalType | MapType | LinkType; | ||
export interface ProviderSignature { | ||
@@ -22,2 +22,5 @@ name: string; | ||
} | ||
export interface StructType { | ||
type: 'struct'; | ||
} | ||
export interface RefType { | ||
@@ -24,0 +27,0 @@ type: 'ref'; |
@@ -5,3 +5,3 @@ { | ||
"author": "jsoverson@gmail.com", | ||
"version": "3.0.1", | ||
"version": "4.0.0", | ||
"main": "dist/src/index.js", | ||
@@ -8,0 +8,0 @@ "types": "dist/src/index.d.ts", |
@@ -18,8 +18,5 @@ import fs from 'fs'; | ||
export enum CODEGEN_TYPE { | ||
ProviderComponents = 'provider-components', | ||
ProviderIntegration = 'provider-integration', | ||
WellKnownImplementer = 'wellknown-implementer', | ||
Component = 'component', | ||
Integration = 'integration', | ||
Interface = 'interface', | ||
WapcComponents = 'wapc-components', | ||
WapcIntegration = 'wapc-integration', | ||
WapcLib = 'wapc-lib', | ||
@@ -43,3 +40,3 @@ } | ||
export const DEFAULT_CODEGEN_TYPE = CODEGEN_TYPE.WapcIntegration; | ||
export const DEFAULT_CODEGEN_TYPE = CODEGEN_TYPE.Integration; | ||
@@ -76,6 +73,18 @@ export function readFile(path: string): string { | ||
export function getTemplate(language: LANGUAGE, type: CODEGEN_TYPE | WIDL_TYPE | JSON_TYPE): string { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export function getTemplate(language: LANGUAGE, type: CODEGEN_TYPE | WIDL_TYPE | JSON_TYPE): (data: any) => string { | ||
const templatePath = path.join(findroot(__dirname), 'templates', language, `${type}.hbs`); | ||
debug('Reading template %o->%o located at %o', language, type, templatePath); | ||
return readFile(templatePath); | ||
debug('Compiling template from %o', templatePath); | ||
const template = handlebars.compile(readFile(templatePath)); | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return (data: any) => { | ||
try { | ||
debug.extend('trace')('Rendering template %o with data %o', path.basename(templatePath), data); | ||
return template(data); | ||
} catch (e) { | ||
console.error(`Error rendering template: ${e}`); | ||
throw e; | ||
} | ||
}; | ||
} | ||
@@ -94,3 +103,3 @@ | ||
const dir = path.join(findroot(__dirname), 'templates', relativeDir); | ||
debug(`Looking for partials in ${dir}`); | ||
debug(`Looking for partials in %o`, dir); | ||
if (!fs.existsSync(dir)) return; | ||
@@ -101,6 +110,6 @@ const files = fs.readdirSync(dir); | ||
const partialPath = path.join(dir, file); | ||
debug(`Loading partial ${partialPath}`); | ||
debug(`Loading partial %o`, partialPath); | ||
const exists = fs.existsSync(partialPath); | ||
if (exists) { | ||
debug(`Registering partial for ${language}.${type}`); | ||
debug(`Registering partial for %o:%o`, language, type); | ||
const partialSource = readFile(partialPath); | ||
@@ -117,2 +126,3 @@ handlebars.registerPartial(name, partialSource); | ||
export function registerLanguageHelpers(lang: LANGUAGE): void { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
handlebars.registerHelper('ifEmpty', function (this: any, context: unknown, options): string { | ||
@@ -152,3 +162,3 @@ let isEmpty = false; | ||
const dir = path.join(findroot(__dirname), 'templates', relativeDir); | ||
debug(`Looking for partials in ${dir}`); | ||
debug(`Looking for partials in %o`, dir); | ||
if (!fs.existsSync(dir)) return; | ||
@@ -159,6 +169,6 @@ const files = fs.readdirSync(dir); | ||
const partialPath = path.join(dir, file); | ||
debug(`Loading partial ${partialPath}`); | ||
debug(`Loading partial %o`, partialPath); | ||
const exists = fs.existsSync(partialPath); | ||
if (exists) { | ||
debug(`Registering common partial for ${language}: ${name}`); | ||
debug(`Registering common partial for %o: %o`, language, name); | ||
const partialSource = readFile(partialPath); | ||
@@ -215,3 +225,3 @@ handlebars.registerPartial(name, partialSource); | ||
alias: 'output', | ||
describe: 'The output destination (defaults to STDOUT for text)', | ||
describe: 'The output file or directory (defaults to STDOUT for text)', | ||
default: undefined, | ||
@@ -242,16 +252,21 @@ type: 'string', | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
export function commitOutput(src: string, path?: string, options: CommitOptions = {}): void { | ||
if (path) { | ||
if (fs.existsSync(path)) { | ||
export function commitOutput(src: string, filePath?: string, options: CommitOptions = {}): void { | ||
if (filePath) { | ||
const basedir = path.dirname(filePath); | ||
if (!fs.existsSync(basedir)) { | ||
debug('Directory "%o" does not exist, creating it.', basedir); | ||
fs.mkdirSync(basedir); | ||
} | ||
if (fs.existsSync(filePath)) { | ||
if (options.force) { | ||
debug(`${path} exists, overwriting anyway because of --force`); | ||
debug(`%o exists, overwriting anyway because of --force`, filePath); | ||
} else { | ||
const contents = fs.readFileSync(path, 'utf-8'); | ||
const contents = fs.readFileSync(filePath, 'utf-8'); | ||
if (contents.startsWith('/* stub */')) { | ||
debug(`${path} exists but is a stub file, overwriting`); | ||
debug(`%o exists but is a stub file, overwriting`, filePath); | ||
} else { | ||
debug(`Refusing to overwrite ${path}`); | ||
debug(`Refusing to overwrite %o`, filePath); | ||
if (options.silent) return; | ||
else { | ||
debug(`${path} exists, to overwrite pass --force to the codegen or delete the file`); | ||
debug(`%o exists, to overwrite pass --force to the codegen or delete the file`, filePath); | ||
return; | ||
@@ -262,4 +277,9 @@ } | ||
} | ||
debug(`Attempting to write to ${path}`); | ||
fs.writeFileSync(path, src); | ||
debug(`Write to %o`, filePath); | ||
try { | ||
fs.writeFileSync(filePath, src); | ||
} catch (e) { | ||
console.error(`Error writing output to ${filePath}: `, e); | ||
throw e; | ||
} | ||
} else { | ||
@@ -271,2 +291,3 @@ console.log(src); | ||
export function readInterface(interfacePath: string): ProviderSignature { | ||
debug('Reading interface JSON at %o', interfacePath); | ||
const ifaceJson = fs.readFileSync(interfacePath, 'utf-8'); | ||
@@ -273,0 +294,0 @@ const iface = JSON.parse(ifaceJson) as ProviderSignature; |
import yargs from 'yargs'; | ||
import { handlebars, parseWidl, registerHelpers } from 'widl-template'; | ||
import { registerHelpers } from 'widl-template'; | ||
import { | ||
@@ -8,3 +8,2 @@ CODEGEN_TYPE, | ||
LANGUAGE, | ||
readFile, | ||
registerTypePartials, | ||
@@ -15,7 +14,4 @@ widlOpts, | ||
outputOpts, | ||
normalizeFilename, | ||
readInterface, | ||
} from '../../common'; | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
import { processDir } from '../../process-widl-dir'; | ||
@@ -25,18 +21,18 @@ const LANG = LANGUAGE.Rust; | ||
export const command = `${TYPE} <schema_dir> [options]`; | ||
export const desc = 'Generate source code for well-known interfaces'; | ||
export const command = `${TYPE} <interface> [options]`; | ||
export const desc = 'Generate the Vino integration code for all component schemas'; | ||
export const builder = (yargs: yargs.Argv): yargs.Argv => { | ||
return yargs | ||
.positional('schema_dir', { | ||
.positional('interface', { | ||
demandOption: true, | ||
type: 'string', | ||
description: 'Path to WIDL schema directory', | ||
description: 'Path to interface JSON', | ||
}) | ||
.options(outputOpts(widlOpts({}))) | ||
.example(`rust ${TYPE} schemas/`, 'Prints generated code to STDOUT'); | ||
.example(`rust ${TYPE} interface.json`, 'Prints generated code to STDOUT'); | ||
}; | ||
interface Arguments extends CommonWidlOptions, CommonOutputOptions { | ||
schema_dir: string; | ||
interface: string; | ||
} | ||
@@ -52,14 +48,8 @@ | ||
const files = fs.readdirSync(args.schema_dir).filter(path => path.endsWith('.widl')); | ||
const template = getTemplate(LANG, TYPE); | ||
const iface = readInterface(args.interface); | ||
const schemas = files.map(file => { | ||
const widlSrc = readFile(path.join(args.schema_dir, file)); | ||
const tree = parseWidl(widlSrc); | ||
return { file: normalizeFilename(file), document: tree }; | ||
}); | ||
const generated = template({ interface: iface }); | ||
const template = handlebars.compile(getTemplate(LANG, TYPE)); | ||
const iface = processDir('', args.schema_dir); | ||
const generated = template({ schemas, interface: iface }); | ||
commitOutput(generated, args.output, { force: args.force, silent: args.silent }); | ||
} |
import yargs from 'yargs'; | ||
import { handlebars, registerHelpers } from 'widl-template'; | ||
import { registerHelpers } from 'widl-template'; | ||
import { | ||
@@ -36,3 +36,3 @@ CODEGEN_TYPE, | ||
const template = handlebars.compile(getTemplate(LANG, TYPE)); | ||
const template = getTemplate(LANG, TYPE); | ||
const generated = template({}); | ||
@@ -39,0 +39,0 @@ |
@@ -12,3 +12,3 @@ import yargs from 'yargs'; | ||
import { handlebars, registerHelpers } from 'widl-template'; | ||
import { registerHelpers } from 'widl-template'; | ||
@@ -30,5 +30,5 @@ const LANG = LANGUAGE.WIDL; | ||
const template = handlebars.compile(getTemplate(LANG, TYPE)); | ||
const template = getTemplate(LANG, TYPE); | ||
const generated = template({}); | ||
commitOutput(generated, args.output, { force: args.force, silent: args.silent }); | ||
} |
@@ -78,2 +78,5 @@ import { readFile } from './common'; | ||
} | ||
} else if (name.value === 'struct') { | ||
// TODO: convert this to core WIDL type once widl can represent it (see also: https://github.com/wapc/cli/issues/8) | ||
return { type: 'struct' }; | ||
} else { | ||
@@ -80,0 +83,0 @@ return { type: 'ref', ref: `#/types/${name.value}` }; |
@@ -40,3 +40,3 @@ export type WIDL_TYPE = | ||
export type TypeSignature = SimpleType | RefType | ListType | OptionalType | MapType | LinkType; | ||
export type TypeSignature = SimpleType | StructType | RefType | ListType | OptionalType | MapType | LinkType; | ||
@@ -64,2 +64,6 @@ export interface ProviderSignature { | ||
export interface StructType { | ||
type: 'struct'; | ||
} | ||
export interface RefType { | ||
@@ -66,0 +70,0 @@ type: 'ref'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
107506
81
1759