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

aspida

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aspida - npm Package Compare versions

Comparing version 0.9.0 to 0.10.0

0

dist/build/template.d.ts

@@ -0,0 +0,0 @@ export interface Template {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=template.js.map

3

dist/buildTemplate.d.ts

@@ -0,4 +1,5 @@

import { BaseConfig } from './getConfig';
import { Template } from './build/template';
declare const _default: (input: string, baseURL?: string) => Template;
declare const _default: ({ input, baseURL }: BaseConfig) => Template;
export default _default;
//# sourceMappingURL=buildTemplate.d.ts.map

@@ -30,5 +30,5 @@ "use strict";

var createTemplateValues_1 = __importDefault(require("./createTemplateValues"));
exports.default = (function (input, baseURL) {
if (baseURL === void 0) { baseURL = ''; }
var _a = createTemplateValues_1.default(input), api = _a.api, imports = _a.imports;
exports.default = (function (_a) {
var input = _a.input, baseURL = _a.baseURL;
var _b = createTemplateValues_1.default(input), 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'));

@@ -35,0 +35,0 @@ var hasUtils = fs_1.default.existsSync(path_1.default.join(input, '@utils')) || fs_1.default.existsSync(path_1.default.join(input, '@utils.ts'));

@@ -0,2 +1,4 @@

import minimist from 'minimist';
export declare const options: minimist.Opts;
export declare const run: (args: string[]) => void;
//# sourceMappingURL=cli.d.ts.map

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

var version_1 = require("./cli/version");
var options = {
exports.options = {
string: ['version', 'config', 'build', 'watch'],

@@ -23,6 +23,2 @@ alias: { v: 'version', c: 'config', b: 'build', w: 'watch' }

watch: watchInputDir_1.default,
read: function (_a) {
var input = _a.input;
return (Array.isArray(input) ? input : [input]);
},
remove: function (filePath, callback) { return fs_1.default.unlink(filePath, callback); }

@@ -32,3 +28,3 @@ });

exports.run = function (args) {
var argv = minimist_1.default(args, options);
var argv = minimist_1.default(args, exports.options);
var commands = [

@@ -35,0 +31,0 @@ argv.version !== undefined ? version_1.version : command_1.nullCommand,

@@ -1,2 +0,2 @@

import { Config } from '../getConfig';
import { BaseConfig } from '../getConfig';
import { Template } from '../build/template';

@@ -6,5 +6,5 @@ import { Command } from './command';

private readonly command;
private readonly config;
private readonly configs;
private readonly io;
static getFactory(config: Config, io: BuildIO): {
static getFactory(configs: BaseConfig[], io: BuildIO): {
create(command: BuildCommand): Command;

@@ -16,6 +16,5 @@ };

interface BuildCommand {
run(input: string, io: BuildIO): void;
run(config: BaseConfig, io: BuildIO): void;
}
export interface BuildIO {
read(config: Config): string[];
write(template: Template): void;

@@ -26,3 +25,3 @@ remove(filePath: string, callback: () => void): void;

export declare class Build implements BuildCommand {
run(input: string, io: BuildIO): void;
run(config: BaseConfig, io: BuildIO): void;
}

@@ -32,5 +31,5 @@ export declare class Watch implements BuildCommand {

constructor(build?: Build);
run(input: string, io: BuildIO): void;
run(config: BaseConfig, io: BuildIO): void;
}
export {};
//# sourceMappingURL=build.d.ts.map

@@ -9,11 +9,11 @@ "use strict";

// eslint-disable-next-line no-useless-constructor
function CommandToBuild(command, config, io) {
function CommandToBuild(command, configs, io) {
this.command = command;
this.config = config;
this.configs = configs;
this.io = io;
}
CommandToBuild.getFactory = function (config, io) {
CommandToBuild.getFactory = function (configs, io) {
return {
create: function (command) {
return new CommandToBuild(command, config, io);
return new CommandToBuild(command, configs, io);
}

@@ -24,4 +24,4 @@ };

var _this = this;
this.io.read(this.config).forEach(function (input) {
_this.command.run(input, _this.io);
this.configs.forEach(function (config) {
_this.command.run(config, _this.io);
});

@@ -35,4 +35,4 @@ };

}
Build.prototype.run = function (input, io) {
var template = buildTemplate_1.default(input);
Build.prototype.run = function (config, io) {
var template = buildTemplate_1.default(config);
io.remove(template.filePath, function () { return io.write(template); });

@@ -49,6 +49,6 @@ };

}
Watch.prototype.run = function (input, io) {
Watch.prototype.run = function (config, io) {
var _this = this;
this.build.run(input, io);
io.watch(input, function () { return _this.build.run(input, io); });
this.build.run(config, io);
io.watch(config.input, function () { return _this.build.run(config, io); });
};

@@ -55,0 +55,0 @@ return Watch;

@@ -0,0 +0,0 @@ export interface Command {

@@ -0,0 +0,0 @@ "use strict";

import { Command } from './command';
export declare const version: Command;
//# sourceMappingURL=version.d.ts.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var path_1 = __importDefault(require("path"));
exports.version = {
exec: function () {
console.log("v" + require('../../package.json').version);
console.log("v" + require(path_1.default.join(process.cwd(), 'package.json')).version);
}
};
//# sourceMappingURL=version.js.map
declare const _default: (target: string, indent: string, importName: string, newUrl: string) => string;
export default _default;
//# sourceMappingURL=createMethodsString.d.ts.map

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ declare const _default: (input: string) => {

@@ -0,0 +0,0 @@ "use strict";

@@ -1,6 +0,7 @@

export declare type Config = {
input: string | string[];
};
declare const _default: (configPath?: string) => Config;
export interface BaseConfig {
input: string;
baseURL: string;
}
declare const _default: (configPath?: string) => BaseConfig[];
export default _default;
//# sourceMappingURL=getConfig.d.ts.map
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -8,9 +19,14 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

var path_1 = __importDefault(require("path"));
var defaultConfig = { input: 'apis' };
var defaultConfig = { input: 'apis', baseURL: '' };
exports.default = (function (configPath) {
if (configPath === void 0) { configPath = 'aspida.config.js'; }
return (fs_1.default.existsSync(configPath) &&
require(path_1.default.join(process.cwd(), configPath))[require('../package.json').name]) ||
defaultConfig;
if (fs_1.default.existsSync(configPath)) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
var config = require(path_1.default.join(process.cwd(), configPath));
return Array.isArray(config)
? config.map(function (c) { return (__assign(__assign({}, defaultConfig), c)); })
: [__assign(__assign({}, defaultConfig), config)];
}
return [__assign({}, defaultConfig)];
});
//# sourceMappingURL=getConfig.js.map

@@ -0,0 +0,0 @@ export declare type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'PATCH' | 'OPTIONS';

@@ -0,0 +0,0 @@ "use strict";

declare const _default: "/* eslint-disable */\nimport { AspidaClient, optionToRequest } from 'aspida'\n<% types %><% utils %><% imports %>\n\nconst api = (client: AspidaClient, baseURL?: string) => {\n const prefix = (baseURL === undefined ? '<% baseURL %>' : baseURL).replace(/\\/$/, '')\n\n return <% api %>\n}\n<% exports %>\nexport type ApiInstance = ReturnType<typeof api>\nexport default api\n";
export default _default;
//# sourceMappingURL=template.d.ts.map

@@ -0,0 +0,0 @@ "use strict";

declare const _default: (input: string, callback: (...args: any) => void) => void;
export default _default;
//# sourceMappingURL=watchInputDir.d.ts.map

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Template } from './build/template';

@@ -0,0 +0,0 @@ "use strict";

{
"name": "aspida",
"version": "0.9.0",
"version": "0.10.0",
"description": "Type safe HTTP client wrapper for the browser and node.js",

@@ -5,0 +5,0 @@ "author": "m-mitsuhide <m.mitsuhide@amatelus.com>",

@@ -180,13 +180,18 @@ <p align="right">

```javascript
module.exports = {
aspida: { input: 'src' }
}
module.exports = { input: 'src' }
```
Specify baseURL in configuration file
```javascript
module.exports = { input: 'apis', baseURL: 'https://example.com/api' }
```
If you want to define multiple API endpoints, specify them in an array
```javascript
module.exports = {
aspida: { input: ['api1', 'api2'] }
}
module.exports = [
{ input: 'api1' },
{ input: 'api2', baseURL: 'https://example.com/api' }
]
```

@@ -193,0 +198,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

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