soonjs 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/one.d.ts CHANGED
@@ -14,4 +14,7 @@ export declare function getCode({ filename, code, alias, moduleName }: {
14
14
  code: any;
15
15
  alias?: string;
16
16
  moduleName?: string;
17
- }): void;
17
+ }): {
18
+ srcCode: any;
19
+ serverCodes: any[];
20
+ };
@@ -1,4 +1,4 @@
1
- export declare function usePazuIdGen({ workerId, isFixedLength, prefix }?: {
1
+ export declare function useSoonIdGen({ workerId, isFixedLength, prefix }?: {
2
2
  workerId?: number;
3
3
  isFixedLength?: boolean;
4
4
  prefix?: string;
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Config, defineApi, defineConfig, Meta, Platform, PazuApp, UserContext } from '.';
1
+ import { Config, defineApi, defineConfig, Meta, Platform, ServiceContext, SoonApp, UserContext } from '.';
2
2
  import { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http';
3
3
 
4
- type Method = 'get' | 'head' | 'post' | 'put' | 'delete' | 'connect' | 'options' | 'trace' | 'patch' | 'all';
4
+ type Method = 'get' | 'head' | 'post' | 'put' | 'delete' | 'options' | 'patch' | 'all';
5
5
  export type APIOptionsBase = {
6
6
  /**
7
7
  * 访问路径,/开头是绝对路径,非绝对路径则仅是替换访问名称而不改变路径层级,可为''
@@ -62,11 +62,12 @@ export type Context<APIBodySchema = {}> = {
62
62
  requestId: string;
63
63
  platform?: Platform;
64
64
  currentAPI: APIOptionsBase & APIBodySchema;
65
- app: PazuApp;
65
+ app: SoonApp;
66
66
  config: Config;
67
67
  meta: Meta;
68
+ service: ServiceContext;
68
69
  } & UserContext;
69
- export type PazuFetchOptions = {
70
+ export type SoonFetchOptions = {
70
71
  headers?: IncomingHttpHeaders;
71
72
  method?: Exclude<Method, 'all'>;
72
73
  body?: unknown;
@@ -76,10 +77,11 @@ export type PazuFetchOptions = {
76
77
  platform?: Context['platform'];
77
78
  };
78
79
  export type Middleware = (context: Context, next: () => any) => Promise<void> | void;
79
- export type PazuAppOptions = {
80
+ export type SoonAppOptions = {
80
81
  baseUrl?: string;
81
82
  defaultMethod?: Method;
82
- onInit?: (app: PazuApp) => void | Promise<void>;
83
+ onInit?: (app: SoonApp) => void | Promise<void>;
84
+ onReady?: (app: SoonApp) => void | Promise<void>;
83
85
  middlewares?: Middleware[];
84
86
  apis?: APIOptions[];
85
87
  workId?: number;
@@ -0,0 +1,7 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ export declare function vitePluginSoonClient(options: {
4
+ projectName: string;
5
+ serverDir: string;
6
+ clientAlias: string;
7
+ }): Plugin;
@@ -1,6 +1,6 @@
1
1
  import { Plugin } from 'vite';
2
2
 
3
- export declare function vitePluginPazuServer(options?: {
3
+ export declare function vitePluginSoonServer(options?: {
4
4
  removeEntry?: boolean;
5
5
  entryPath?: string;
6
6
  disableApis?: boolean;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "soonjs",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
- "type": "module",
8
7
  "main1": "./src/index.ts",
8
+ "type": "module",
9
9
  "scripts": {
10
10
  "dev": "vite-node examples/index.ts",
11
11
  "build": "vite build --ssr ./src/index.ts",
@@ -1,3 +0,0 @@
1
- import { Plugin } from 'vite';
2
-
3
- export declare function vitePluginPazuClient(options?: {}): Plugin;