Comparing version 0.12.2 to 0.13.0
"use strict"; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread = (this && this.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -26,3 +6,2 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var fs_1 = __importDefault(require("fs")); | ||
var path_1 = __importDefault(require("path")); | ||
@@ -33,10 +12,5 @@ var createTemplateValues_1 = __importDefault(require("./createTemplateValues")); | ||
var _b = createTemplateValues_1.default(input, trailingSlash), api = _b.api, imports = _b.imports; | ||
var hasTypes = fs_1.default.existsSync(path_1.default.join(input, '@types')) || fs_1.default.existsSync(path_1.default.join(input, '@types.ts')); | ||
var hasUtils = fs_1.default.existsSync(path_1.default.join(input, '@utils')) || fs_1.default.existsSync(path_1.default.join(input, '@utils.ts')); | ||
var exportsList = __spread((hasTypes ? ['ApiTypes'] : []), (hasUtils ? ['apiUtils'] : [])); | ||
var text = "/* eslint-disable */\nimport { AspidaClient } from 'aspida'\n<% types %><% utils %><% imports %>\n\nconst api = <U>(client: AspidaClient<U>) => {\n const prefix = (client.baseURL === undefined ? '<% baseURL %>' : client.baseURL).replace(/\\/$/, '')\n\n return <% api %>\n}\n<% exports %>\nexport type ApiInstance = ReturnType<typeof api>\nexport default api\n" | ||
.replace('<% types %>', hasTypes ? "import * as ApiTypes from './@types'\n" : '') | ||
.replace('<% utils %>', hasUtils ? "import * as apiUtils from './@utils'\n" : '') | ||
var text = "/* eslint-disable */\nimport { AspidaClient } from 'aspida'\n<% types %><% imports %>\n\nconst api = <T>(client: AspidaClient<T>) => {\n const prefix = (client.baseURL === undefined ? '<% baseURL %>' : client.baseURL).replace(/\\/$/, '')\n\n return <% api %>\n}\n\nexport type ApiInstance = ReturnType<typeof api>\nexport default api\n" | ||
.replace('<% types %>', api.includes(': ApiTypes.') ? "import * as ApiTypes from './@types'\n" : '') | ||
.replace('<% imports %>', imports.map(function (i) { return i.replace(input, '.'); }).join('\n')) | ||
.replace('<% exports %>', exportsList.length ? "\nexport { " + exportsList.join(', ') + " }" : '') | ||
.replace('<% api %>', api) | ||
@@ -43,0 +17,0 @@ .replace('<% baseURL %>', baseURL); |
@@ -44,3 +44,3 @@ "use strict"; | ||
var option = function (method) { | ||
return "option" + (isOptionRequired ? '' : '?') + ": {" + reqData(method) + query(method) + reqHeaders(method) + " config?: U }"; | ||
return "option" + (isOptionRequired ? '' : '?') + ": {" + reqData(method) + query(method) + reqHeaders(method) + " config?: T }"; | ||
}; | ||
@@ -47,0 +47,0 @@ var request = function () { |
{ | ||
"name": "aspida", | ||
"version": "0.12.2", | ||
"version": "0.13.0", | ||
"description": "Type safe HTTP client wrapper for the browser and node.js", | ||
@@ -5,0 +5,0 @@ "author": "m-mitsuhide <m.mitsuhide@amatelus.com>", |
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
6
51107
536