UNPKG

@kubiklabs/wasmkit

Version:

Wasmkit is a development environment to compile, deploy, test, run cosmwasm contracts on different networks.

82 lines (81 loc) 3.16 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.usePlugin = exports.extendConfig = exports.extendEnvironment = exports.types = exports.internalTask = exports.task = void 0; const context_1 = require("../../context"); const argumentTypes = __importStar(require("../params/argument-types")); const plugins_1 = require("../plugins"); function task(name, descriptionOrAction, action) { const ctx = context_1.WasmkitContext.getWasmkitContext(); const dsl = ctx.tasksDSL; if (descriptionOrAction === undefined) { return dsl.task(name); } if (typeof descriptionOrAction !== "string") { return dsl.task(name, descriptionOrAction); } return dsl.task(name, descriptionOrAction, action); } exports.task = task; function internalTask(name, descriptionOrAction, action) { const ctx = context_1.WasmkitContext.getWasmkitContext(); const dsl = ctx.tasksDSL; if (descriptionOrAction === undefined) { return dsl.internalTask(name); } if (typeof descriptionOrAction !== "string") { return dsl.internalTask(name, descriptionOrAction); } return dsl.internalTask(name, descriptionOrAction, action); } exports.internalTask = internalTask; exports.types = argumentTypes; /** * Register an environment extender what will be run after the * WasmKit Runtime Environment is initialized. * * @param extender A function that receives the WasmKit Runtime * Environment. */ function extendEnvironment(extender) { const ctx = context_1.WasmkitContext.getWasmkitContext(); const extenderManager = ctx.extendersManager; extenderManager.add(extender); } exports.extendEnvironment = extendEnvironment; function extendConfig(extender) { const ctx = context_1.WasmkitContext.getWasmkitContext(); ctx.configExtenders.push(extender); } exports.extendConfig = extendConfig; /** * Loads a WasmKit plugin * @param pluginName The plugin name. */ function usePlugin(pluginName) { const ctx = context_1.WasmkitContext.getWasmkitContext(); (0, plugins_1.usePlugin)(ctx, pluginName); } exports.usePlugin = usePlugin;