build: ncc transfrom esbuild

This commit is contained in:
wss-git 2021-12-23 14:07:27 +08:00
parent f0468eddf3
commit 0b9712838c
14 changed files with 59 additions and 153 deletions

51
dist/index.js vendored Normal file

File diff suppressed because one or more lines are too long

44
lib/common/help.d.ts vendored
View File

@ -1,44 +0,0 @@
declare const _default: ({
header: string;
content: string;
optionList?: undefined;
} | {
header: string;
optionList: ({
name: string;
description: string;
type: StringConstructor;
alias?: undefined;
} | {
name: string;
description: string;
alias: string;
type: StringConstructor;
} | {
name: string;
description: string;
type: BooleanConstructor;
alias?: undefined;
})[];
content?: undefined;
} | {
header: string;
optionList: {
name: string;
description: string;
alias: string;
type: BooleanConstructor;
}[];
content?: undefined;
} | {
header: string;
content: string[];
optionList?: undefined;
} | {
header: string;
content: {
example: string;
}[];
optionList?: undefined;
})[];
export default _default;

View File

@ -1,10 +0,0 @@
export default class ComponentLogger {
static CONTENT: string;
static setContent(content: any): void;
static log(m: any, color?: 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'whiteBright' | 'gray'): void;
static info(m: any): void;
static debug(m: any): void;
static error(m: any): void;
static warning(m: any): void;
static success(m: any): void;
}

View File

@ -1,4 +0,0 @@
export default class StdoutFormatter {
static stdoutFormatter: any;
static initStdout(): Promise<void>;
}

11
lib/index.d.ts vendored
View File

@ -1,11 +0,0 @@
import { InputProps } from './interface/entity';
export default class FcRemoteInvoke {
/**
* event
* @param inputs
* @returns
*/
invoke(inputs: InputProps): Promise<any>;
private report;
private handlerInputs;
}

File diff suppressed because one or more lines are too long

View File

@ -1,34 +0,0 @@
export interface ICredentials {
AccountID?: string;
AccessKeyID?: string;
AccessKeySecret?: string;
SecurityToken?: string;
}
export interface InputProps {
props?: IProperties;
credentials: ICredentials;
appName: string;
project: {
component: string;
access: string;
projectName: string;
};
command: string;
args: string;
path: {
configPath: string;
};
}
export interface IProperties {
region: string;
serviceName: string;
functionName: string;
qualifier?: string;
domainName?: string;
}
export declare function isProperties(args: any): args is IProperties;
export interface IEventPayload {
event?: string;
eventFile?: string;
eventStdin?: boolean;
}

4
lib/lib/event.d.ts vendored
View File

@ -1,4 +0,0 @@
export default class File {
static getEvent(eventFile: any): Promise<unknown>;
static eventPriority(eventPriority: any): Promise<any>;
}

View File

@ -1 +0,0 @@
export default function handlerBody(contentType: string, body: any): any;

View File

@ -1,32 +0,0 @@
import { IProperties, IEventPayload } from '../interface/entity';
export default class RemoteInvoke {
fcClient: any;
accountId: string;
constructor(fcClient: any, accountId: string);
invoke(props: IProperties, eventPayload: IEventPayload, { invocationType }: {
invocationType: any;
}): Promise<void>;
requestDomain(url: string, event: string): Promise<void>;
getHttpTrigger(serviceName: any, functionName: any): Promise<any>;
eventInvoke({ serviceName, functionName, event, qualifier, invocationType }: {
serviceName: any;
functionName: any;
event: any;
qualifier?: string;
invocationType: any;
}): Promise<void>;
httpInvoke({ region, serviceName, functionName, event, qualifier }: {
region: any;
serviceName: any;
functionName: any;
event: any;
qualifier: any;
}): Promise<void>;
/**
* @param event: { body, headers, method, queries, path }
* path /proxy/serviceName/functionName/path ,
*/
request(event: any): Promise<void>;
private showLog;
private getJsonEvent;
}

5
lib/lib/stdin.d.ts vendored
View File

@ -1,5 +0,0 @@
/// <reference types="node" />
export declare function getStdin(): Promise<string>;
export declare namespace getStdin {
var buffer: () => Promise<Buffer>;
}

View File

@ -13,7 +13,7 @@
"author": "Serverless-Devs", "author": "Serverless-Devs",
"contributors": [], "contributors": [],
"license": "MIT", "license": "MIT",
"main": "./lib/index.js", "main": "./dist/index.js",
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },
@ -24,11 +24,12 @@
"scripts": { "scripts": {
"start": "npm run watch", "start": "npm run watch",
"watch": "tsc -w", "watch": "tsc -w",
"prebuild": "rm -rf node_modules && rm -rf package-lock.json && npm i && rimraf lib", "prebuild": "rm -rf node_modules && rm -rf package-lock.json && npm i && rimraf dist",
"build": "ncc build src/index.ts -m -e @serverless-devs/core -o lib" "esbuild": "esbuild src/index.ts --bundle --log-level=error --minify --platform=node --format=cjs --target=node10.4 --external:@serverless-devs/core --outfile=dist/index.js",
"build": "npm run esbuild"
}, },
"dependencies": { "dependencies": {
"@serverless-devs/core": "^0.0.*", "@serverless-devs/core": "latest",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"fs-extra": "^10.0.0", "fs-extra": "^10.0.0",
"got": "^11.8.2", "got": "^11.8.2",
@ -46,6 +47,6 @@
"ts-node": "^8.10.2", "ts-node": "^8.10.2",
"typedoc": "^0.20.35", "typedoc": "^0.20.35",
"typescript": "^3.9.7", "typescript": "^3.9.7",
"@vercel/ncc": "^0.24.0" "esbuild": "^0.14.0"
} }
} }

View File

@ -2,7 +2,7 @@ Type: Component
Name: fc-remote-invoke Name: fc-remote-invoke
Provider: Provider:
- 其它 - 其它
Version: 0.0.20 Version: dev
Description: 初始化component模板 Description: 初始化component模板
HomePage: https://www.serverless-devs.com HomePage: https://www.serverless-devs.com
Tags: #标签详情 Tags: #标签详情

View File

@ -24,7 +24,7 @@
"./node_modules/@types" "./node_modules/@types"
], ],
"rootDir": "src", "rootDir": "src",
"outDir": "lib" "outDir": "dist"
}, },
"exclude": [ "exclude": [
"**/node_modules/**", "**/node_modules/**",