Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vinodotdev/codegen

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vinodotdev/codegen - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

dist/src/languages/rust/provider-components.d.ts

6

dist/src/common.d.ts
import DEBUG from 'debug';
import { AbstractNode } from '@wapc/widl/ast';
import yargs from 'yargs';
import { ProviderSignature } from './types';
export declare const debug: DEBUG.Debugger;

@@ -11,7 +12,7 @@ export declare enum LANGUAGE {

export declare enum CODEGEN_TYPE {
ProviderComponent = "provider-component",
ProviderComponents = "provider-components",
ProviderIntegration = "provider-integration",
WellKnownImplementer = "wellknown-implementer",
Interface = "interface",
WapcComponent = "wapc-component",
WapcComponents = "wapc-components",
WapcIntegration = "wapc-integration",

@@ -70,2 +71,3 @@ WapcLib = "wapc-lib"

export declare function commitOutput(src: string, path?: string, options?: CommitOptions): void;
export declare function readInterface(interfacePath: string): ProviderSignature;
export {};

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.commitOutput = exports.widlOpts = exports.outputOpts = exports.codegen = exports.registerCommonPartials = exports.registerLanguageHelpers = exports.registerTypePartials = exports.registerPartial = exports.getTemplate = exports.normalizeFilename = exports.readFile = exports.DEFAULT_CODEGEN_TYPE = exports.LANGUAGE_OFFERS = exports.JSON_TYPE = exports.WIDL_TYPE = exports.CODEGEN_TYPE = exports.LANGUAGE = exports.debug = void 0;
exports.readInterface = exports.commitOutput = exports.widlOpts = exports.outputOpts = exports.codegen = exports.registerCommonPartials = exports.registerLanguageHelpers = exports.registerTypePartials = exports.registerPartial = exports.getTemplate = exports.normalizeFilename = exports.readFile = exports.DEFAULT_CODEGEN_TYPE = exports.LANGUAGE_OFFERS = exports.JSON_TYPE = exports.WIDL_TYPE = exports.CODEGEN_TYPE = exports.LANGUAGE = exports.debug = void 0;
const fs_1 = __importDefault(require("fs"));

@@ -23,7 +23,7 @@ const path_1 = __importDefault(require("path"));

(function (CODEGEN_TYPE) {
CODEGEN_TYPE["ProviderComponent"] = "provider-component";
CODEGEN_TYPE["ProviderComponents"] = "provider-components";
CODEGEN_TYPE["ProviderIntegration"] = "provider-integration";
CODEGEN_TYPE["WellKnownImplementer"] = "wellknown-implementer";
CODEGEN_TYPE["Interface"] = "interface";
CODEGEN_TYPE["WapcComponent"] = "wapc-component";
CODEGEN_TYPE["WapcComponents"] = "wapc-components";
CODEGEN_TYPE["WapcIntegration"] = "wapc-integration";

@@ -194,3 +194,3 @@ CODEGEN_TYPE["WapcLib"] = "wapc-lib";

alias: 'output',
describe: 'The output destination (defaults to STDOUT)',
describe: 'The output destination (defaults to STDOUT for text)',
default: undefined,

@@ -247,2 +247,8 @@ type: 'string',

exports.commitOutput = commitOutput;
function readInterface(interfacePath) {
const ifaceJson = fs_1.default.readFileSync(interfacePath, 'utf-8');
const iface = JSON.parse(ifaceJson);
return iface;
}
exports.readInterface = readInterface;
//# sourceMappingURL=common.js.map

@@ -7,5 +7,5 @@ import yargs from 'yargs';

interface Arguments extends CommonWidlOptions, CommonOutputOptions {
schema_dir: string;
interface: string;
}
export declare function handler(args: Arguments): void;
export {};

@@ -6,10 +6,9 @@ "use strict";

const common_1 = require("../../common");
const process_widl_dir_1 = require("../../process-widl-dir");
const LANG = common_1.LANGUAGE.Rust;
const TYPE = common_1.CODEGEN_TYPE.ProviderIntegration;
exports.command = `${TYPE} <schema_dir> [options]`;
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,

@@ -20,3 +19,3 @@ type: 'string',

.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');
};

@@ -32,3 +31,3 @@ exports.builder = builder;

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 iface = (0, common_1.readInterface)(args.interface);
const generated = template({ interface: iface });

@@ -35,0 +34,0 @@ (0, common_1.commitOutput)(generated, args.output, { force: args.force, silent: args.silent });

@@ -7,5 +7,5 @@ import yargs from 'yargs';

interface Arguments extends CommonWidlOptions, CommonOutputOptions {
schema_dir: string;
interface: string;
}
export declare function handler(args: Arguments): void;
export {};

@@ -6,16 +6,15 @@ "use strict";

const common_1 = require("../../common");
const process_widl_dir_1 = require("../../process-widl-dir");
const LANG = common_1.LANGUAGE.Rust;
const TYPE = common_1.CODEGEN_TYPE.WapcIntegration;
exports.command = `${TYPE} <schema_dir> [options]`;
exports.command = `${TYPE} <interface> [options]`;
exports.desc = 'Generate the Vino & WaPC 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(`${LANG} ${TYPE} schemas/`, 'Prints integration boilerplate code to STDOUT');
.example(`${LANG} ${TYPE} interface.json`, 'Prints integration boilerplate code to STDOUT');
};

@@ -31,3 +30,3 @@ exports.builder = builder;

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 iface = (0, common_1.readInterface)(args.interface);
const generated = template({ interface: iface });

@@ -34,0 +33,0 @@ (0, common_1.commitOutput)(generated, args.output, { force: args.force, silent: args.silent });

@@ -5,3 +5,3 @@ {

"author": "jsoverson@gmail.com",
"version": "3.0.0",
"version": "3.0.1",
"main": "dist/src/index.js",

@@ -8,0 +8,0 @@ "types": "dist/src/index.d.ts",

@@ -8,2 +8,3 @@ import fs from 'fs';

import yargs from 'yargs';
import { ProviderSignature } from './types';
export const debug = DEBUG('vino-codegen');

@@ -18,7 +19,7 @@

export enum CODEGEN_TYPE {
ProviderComponent = 'provider-component',
ProviderComponents = 'provider-components',
ProviderIntegration = 'provider-integration',
WellKnownImplementer = 'wellknown-implementer',
Interface = 'interface',
WapcComponent = 'wapc-component',
WapcComponents = 'wapc-components',
WapcIntegration = 'wapc-integration',

@@ -208,3 +209,3 @@ WapcLib = 'wapc-lib',

alias: 'output',
describe: 'The output destination (defaults to STDOUT)',
describe: 'The output destination (defaults to STDOUT for text)',
default: undefined,

@@ -260,1 +261,7 @@ type: 'string',

}
export function readInterface(interfacePath: string): ProviderSignature {
const ifaceJson = fs.readFileSync(interfacePath, 'utf-8');
const iface = JSON.parse(ifaceJson) as ProviderSignature;
return iface;
}

@@ -14,5 +14,7 @@ import yargs from 'yargs';

registerLanguageHelpers,
readInterface,
} from '../../common';
import { processDir } from '../../process-widl-dir';
import { debug } from '../../common';

@@ -22,3 +24,3 @@ const LANG = LANGUAGE.Rust;

export const command = `${TYPE} <schema_dir> [options]`;
export const command = `${TYPE} <interface> [options]`;
export const desc = 'Generate the Vino integration code for all component schemas';

@@ -28,3 +30,3 @@

return yargs
.positional('schema_dir', {
.positional('interface', {
demandOption: true,

@@ -35,7 +37,7 @@ type: 'string',

.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;
}

@@ -51,4 +53,6 @@

registerHelpers(options);
const template = handlebars.compile(getTemplate(LANG, TYPE));
const iface = processDir('', args.schema_dir);
const iface = readInterface(args.interface);
const generated = template({ interface: iface });

@@ -55,0 +59,0 @@

@@ -14,2 +14,3 @@ import yargs from 'yargs';

registerLanguageHelpers,
readInterface,
} from '../../common';

@@ -22,3 +23,3 @@

export const command = `${TYPE} <schema_dir> [options]`;
export const command = `${TYPE} <interface> [options]`;
export const desc = 'Generate the Vino & WaPC integration code for all component schemas';

@@ -28,13 +29,13 @@

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(`${LANG} ${TYPE} schemas/`, 'Prints integration boilerplate code to STDOUT');
.example(`${LANG} ${TYPE} interface.json`, 'Prints integration boilerplate code to STDOUT');
};
interface Arguments extends CommonWidlOptions, CommonOutputOptions {
schema_dir: string;
interface: string;
}

@@ -52,3 +53,4 @@

const template = handlebars.compile(getTemplate(LANG, TYPE));
const iface = processDir('', args.schema_dir);
const iface = readInterface(args.interface);
const generated = template({ interface: iface });

@@ -55,0 +57,0 @@

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc