@srvkit/common 0.1.1 → 0.2.0
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/README.md +1 -1
- package/dist/@types/env.d.ts +5 -0
- package/dist/@types/env.js +0 -0
- package/dist/@types/env.mjs +1 -0
- package/dist/@types/node.d.ts +0 -2
- package/dist/@types/node.js +0 -8
- package/dist/@types/node.mjs +0 -8
- package/dist/@types/options/complete/build.d.ts +4 -5
- package/dist/@types/options/complete/build.js +0 -8
- package/dist/@types/options/complete/build.mjs +0 -8
- package/dist/@types/options/complete/dev.d.ts +5 -22
- package/dist/@types/options/complete/dev.js +0 -8
- package/dist/@types/options/complete/dev.mjs +0 -8
- package/dist/@types/options/complete/https/index.d.ts +20 -0
- package/dist/@types/options/complete/https/index.js +0 -0
- package/dist/@types/options/complete/https/index.mjs +1 -0
- package/dist/@types/options/complete/index.d.ts +1 -3
- package/dist/@types/options/complete/index.js +0 -8
- package/dist/@types/options/complete/index.mjs +0 -8
- package/dist/@types/options/default.d.ts +2 -3
- package/dist/@types/options/default.js +0 -8
- package/dist/@types/options/default.mjs +0 -8
- package/dist/@types/options/resolved.d.ts +1 -3
- package/dist/@types/options/resolved.js +0 -8
- package/dist/@types/options/resolved.mjs +0 -8
- package/dist/@types/server.d.ts +0 -2
- package/dist/@types/server.js +0 -8
- package/dist/@types/server.mjs +0 -8
- package/dist/_virtual/_rolldown/runtime.js +0 -8
- package/dist/configs/log.d.ts +0 -2
- package/dist/configs/log.js +0 -8
- package/dist/configs/log.js.map +1 -1
- package/dist/configs/log.mjs +0 -8
- package/dist/configs/log.mjs.map +1 -1
- package/dist/consts/options.d.ts +14 -0
- package/dist/consts/options.js +40 -0
- package/dist/consts/options.js.map +1 -0
- package/dist/consts/options.mjs +34 -0
- package/dist/consts/options.mjs.map +1 -0
- package/dist/functions/build/virtual-entry.d.ts +0 -2
- package/dist/functions/build/virtual-entry.js +11 -13
- package/dist/functions/build/virtual-entry.js.map +1 -1
- package/dist/functions/build/virtual-entry.mjs +11 -13
- package/dist/functions/build/virtual-entry.mjs.map +1 -1
- package/dist/functions/env/inject.d.ts +20 -0
- package/dist/functions/env/inject.js +30 -0
- package/dist/functions/env/inject.js.map +1 -0
- package/dist/functions/env/inject.mjs +28 -0
- package/dist/functions/env/inject.mjs.map +1 -0
- package/dist/functions/env/resolve.d.ts +19 -0
- package/dist/functions/env/resolve.js +19 -0
- package/dist/functions/env/resolve.js.map +1 -0
- package/dist/functions/env/resolve.mjs +17 -0
- package/dist/functions/env/resolve.mjs.map +1 -0
- package/dist/functions/http/request/header.d.ts +0 -2
- package/dist/functions/http/request/header.js +0 -8
- package/dist/functions/http/request/header.js.map +1 -1
- package/dist/functions/http/request/header.mjs +0 -8
- package/dist/functions/http/request/header.mjs.map +1 -1
- package/dist/functions/http/response/write.d.ts +0 -2
- package/dist/functions/http/response/write.js +0 -8
- package/dist/functions/http/response/write.js.map +1 -1
- package/dist/functions/http/response/write.mjs +0 -8
- package/dist/functions/http/response/write.mjs.map +1 -1
- package/dist/functions/options/resolve.d.ts +0 -2
- package/dist/functions/options/resolve.js +3 -37
- package/dist/functions/options/resolve.js.map +1 -1
- package/dist/functions/options/resolve.mjs +1 -35
- package/dist/functions/options/resolve.mjs.map +1 -1
- package/dist/functions/package/package-json.d.ts +0 -2
- package/dist/functions/package/package-json.js +0 -8
- package/dist/functions/package/package-json.js.map +1 -1
- package/dist/functions/package/package-json.mjs +0 -8
- package/dist/functions/package/package-json.mjs.map +1 -1
- package/dist/functions/path/posix.d.ts +0 -2
- package/dist/functions/path/posix.js +0 -8
- package/dist/functions/path/posix.js.map +1 -1
- package/dist/functions/path/posix.mjs +0 -8
- package/dist/functions/path/posix.mjs.map +1 -1
- package/dist/functions/server/define.d.ts +0 -2
- package/dist/functions/server/define.js +0 -8
- package/dist/functions/server/define.js.map +1 -1
- package/dist/functions/server/define.mjs +0 -8
- package/dist/functions/server/define.mjs.map +1 -1
- package/dist/functions/server/live.d.ts +0 -2
- package/dist/functions/server/live.js +0 -8
- package/dist/functions/server/live.js.map +1 -1
- package/dist/functions/server/live.mjs +0 -8
- package/dist/functions/server/live.mjs.map +1 -1
- package/dist/node.d.ts +0 -2
- package/dist/node.js +0 -8
- package/dist/node.mjs +0 -8
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.js +15 -0
- package/dist/plugin.mjs +3 -0
- package/dist/runtime.d.ts +0 -2
- package/dist/runtime.js +0 -8
- package/dist/runtime.mjs +0 -8
- package/package.json +8 -2
package/README.md
CHANGED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/@types/node.d.ts
CHANGED
package/dist/@types/node.js
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
package/dist/@types/node.mjs
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
export { };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { CompleteHttpsOptions } from "./dev.js";
|
|
1
|
+
import { ResolvableNumber, ResolvableString } from "../../env.js";
|
|
2
|
+
import { CompleteHttpsOptions } from "./https/index.js";
|
|
4
3
|
/**
|
|
5
4
|
* Build target.
|
|
6
5
|
*
|
|
@@ -65,13 +64,13 @@ type CompleteBuildServerOptions = CompleteBuildBaseOptions<"server"> & {
|
|
|
65
64
|
*
|
|
66
65
|
* By default, it is `localhost`.
|
|
67
66
|
*/
|
|
68
|
-
host:
|
|
67
|
+
host: ResolvableString;
|
|
69
68
|
/**
|
|
70
69
|
* The port number for the production server.
|
|
71
70
|
*
|
|
72
71
|
* By default, it is `3000`.
|
|
73
72
|
*/
|
|
74
|
-
port:
|
|
73
|
+
port: ResolvableNumber;
|
|
75
74
|
/**
|
|
76
75
|
* HTTPS server options.
|
|
77
76
|
*/
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
export { };
|
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
/**
|
|
4
|
-
* Complete HTTPS server options.
|
|
5
|
-
*/
|
|
6
|
-
type CompleteHttpsOptions = {
|
|
7
|
-
/**
|
|
8
|
-
* File path or inlined TLS certificate in PEM format (required).
|
|
9
|
-
*/
|
|
10
|
-
cert: string;
|
|
11
|
-
/**
|
|
12
|
-
* File path or inlined TLS private key in PEM format (required).
|
|
13
|
-
*/
|
|
14
|
-
key: string;
|
|
15
|
-
/**
|
|
16
|
-
* Passphrase for the private key (optional).
|
|
17
|
-
*/
|
|
18
|
-
passphrase: string;
|
|
19
|
-
};
|
|
1
|
+
import { ResolvableNumber, ResolvableString } from "../../env.js";
|
|
2
|
+
import { CompleteHttpsOptions } from "./https/index.js";
|
|
20
3
|
/**
|
|
21
4
|
* Complete development server options.
|
|
22
5
|
*/
|
|
@@ -26,17 +9,17 @@ type CompleteDevOptions = {
|
|
|
26
9
|
*
|
|
27
10
|
* By default, it is `localhost`.
|
|
28
11
|
*/
|
|
29
|
-
host:
|
|
12
|
+
host: ResolvableString;
|
|
30
13
|
/**
|
|
31
14
|
* The port number for the development server.
|
|
32
15
|
*
|
|
33
16
|
* By default, it is `3001`.
|
|
34
17
|
*/
|
|
35
|
-
port:
|
|
18
|
+
port: ResolvableNumber;
|
|
36
19
|
/**
|
|
37
20
|
* HTTPS server options.
|
|
38
21
|
*/
|
|
39
22
|
https: CompleteHttpsOptions;
|
|
40
23
|
};
|
|
41
|
-
export type { CompleteDevOptions
|
|
24
|
+
export type { CompleteDevOptions };
|
|
42
25
|
//# sourceMappingURL=dev.d.ts.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
export { };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ResolvableString } from "../../../env.js";
|
|
2
|
+
/**
|
|
3
|
+
* Complete HTTPS server options.
|
|
4
|
+
*/
|
|
5
|
+
type CompleteHttpsOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* File path or inlined TLS certificate in PEM format (required).
|
|
8
|
+
*/
|
|
9
|
+
cert: ResolvableString;
|
|
10
|
+
/**
|
|
11
|
+
* File path or inlined TLS private key in PEM format (required).
|
|
12
|
+
*/
|
|
13
|
+
key: ResolvableString;
|
|
14
|
+
/**
|
|
15
|
+
* Passphrase for the private key (optional).
|
|
16
|
+
*/
|
|
17
|
+
passphrase: ResolvableString;
|
|
18
|
+
};
|
|
19
|
+
export type { CompleteHttpsOptions };
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import __tsdown_shims_path from 'node:path';
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
|
-
import { CompleteDevOptions } from "./dev.js";
|
|
4
1
|
import { CompleteBuildOptions } from "./build.js";
|
|
2
|
+
import { CompleteDevOptions } from "./dev.js";
|
|
5
3
|
/**
|
|
6
4
|
* Runtime target for the application.
|
|
7
5
|
*
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
export { };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
|
-
import { CompleteDevOptions, CompleteHttpsOptions } from "./complete/dev.js";
|
|
1
|
+
import { CompleteHttpsOptions } from "./complete/https/index.js";
|
|
4
2
|
import { CompleteBuildHandlerOptions, CompleteBuildServerOptions } from "./complete/build.js";
|
|
3
|
+
import { CompleteDevOptions } from "./complete/dev.js";
|
|
5
4
|
import { CompleteOptions } from "./complete/index.js";
|
|
6
5
|
import { Format, Omit, Partial } from "ts-vista";
|
|
7
6
|
/**
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
export { };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import __tsdown_shims_path from 'node:path';
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
|
-
import { CompleteDevOptions } from "./complete/dev.js";
|
|
4
1
|
import { CompleteBuildHandlerOptions, CompleteBuildServerOptions } from "./complete/build.js";
|
|
2
|
+
import { CompleteDevOptions } from "./complete/dev.js";
|
|
5
3
|
import { CompleteOptions } from "./complete/index.js";
|
|
6
4
|
import { HttpsOptions } from "./default.js";
|
|
7
5
|
import { Format, Omit } from "ts-vista";
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
export { };
|
package/dist/@types/server.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import __tsdown_shims_path from 'node:path';
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
1
|
import { ErrorHandler as ErrorHandler$1, Server as Server$1, ServerHandler as ServerHandler$1, ServerMiddleware as ServerMiddleware$1, ServerOptions as ServerOptions$1, ServerPlugin as ServerPlugin$1, ServerRequest as ServerRequest$1 } from "srvx";
|
|
4
2
|
import { Format, Omit } from "ts-vista";
|
|
5
3
|
/**
|
package/dist/@types/server.js
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
package/dist/@types/server.mjs
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
export { };
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
var __create = Object.create;
|
|
10
2
|
var __defProp = Object.defineProperty;
|
|
11
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/dist/configs/log.d.ts
CHANGED
package/dist/configs/log.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
10
2
|
let consola = require("consola");
|
|
11
3
|
|
package/dist/configs/log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","names":[],"sources":["../../src/configs/log.ts"],"sourcesContent":["import type { ConsolaInstance } from \"consola\";\n\nimport { createConsola } from \"consola\";\n\nconst log: ConsolaInstance = createConsola({\n formatOptions: {\n date: false,\n },\n});\n\nexport { log };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"log.js","names":[],"sources":["../../src/configs/log.ts"],"sourcesContent":["import type { ConsolaInstance } from \"consola\";\n\nimport { createConsola } from \"consola\";\n\nconst log: ConsolaInstance = createConsola({\n formatOptions: {\n date: false,\n },\n});\n\nexport { log };\n"],"mappings":";;;AAIA,MAAM,iCAAqC,EACvC,eAAe,EACX,MAAM,MACV,EACJ,CAAC"}
|
package/dist/configs/log.mjs
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
import { createConsola } from "consola";
|
|
10
2
|
|
|
11
3
|
const log = createConsola({ formatOptions: { date: false } });
|
package/dist/configs/log.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.mjs","names":[],"sources":["../../src/configs/log.ts"],"sourcesContent":["import type { ConsolaInstance } from \"consola\";\n\nimport { createConsola } from \"consola\";\n\nconst log: ConsolaInstance = createConsola({\n formatOptions: {\n date: false,\n },\n});\n\nexport { log };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"log.mjs","names":[],"sources":["../../src/configs/log.ts"],"sourcesContent":["import type { ConsolaInstance } from \"consola\";\n\nimport { createConsola } from \"consola\";\n\nconst log: ConsolaInstance = createConsola({\n formatOptions: {\n date: false,\n },\n});\n\nexport { log };\n"],"mappings":";;AAIA,MAAM,MAAuB,cAAc,EACvC,eAAe,EACX,MAAM,MACV,EACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ResolvedBuildHandlerOptions, ResolvedBuildServerOptions, ResolvedOptions } from "../@types/options/resolved.js";
|
|
2
|
+
declare const OPTIONS_DEV: {
|
|
3
|
+
readonly host: "localhost";
|
|
4
|
+
readonly port: 3001;
|
|
5
|
+
};
|
|
6
|
+
declare const OPTIONS_BUILD_SERVER_BASE: {
|
|
7
|
+
readonly host: "localhost";
|
|
8
|
+
readonly port: 3000;
|
|
9
|
+
};
|
|
10
|
+
declare const OPTIONS_BUILD_SERVER: ResolvedBuildServerOptions;
|
|
11
|
+
declare const OPTIONS_BUILD_HANDLER: ResolvedBuildHandlerOptions;
|
|
12
|
+
declare const OPTIONS_DEFAULT: Omit<ResolvedOptions, "entry" | "build">;
|
|
13
|
+
export { OPTIONS_BUILD_HANDLER, OPTIONS_BUILD_SERVER, OPTIONS_BUILD_SERVER_BASE, OPTIONS_DEFAULT, OPTIONS_DEV };
|
|
14
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const OPTIONS_DEV = {
|
|
4
|
+
host: "localhost",
|
|
5
|
+
port: 3001
|
|
6
|
+
};
|
|
7
|
+
const OPTIONS_BUILD_SERVER_BASE = {
|
|
8
|
+
host: "localhost",
|
|
9
|
+
port: 3e3
|
|
10
|
+
};
|
|
11
|
+
const OPTIONS_BUILD_SERVER = {
|
|
12
|
+
...OPTIONS_BUILD_SERVER_BASE,
|
|
13
|
+
target: "server",
|
|
14
|
+
bundle: "external",
|
|
15
|
+
outputDir: "./dist",
|
|
16
|
+
outputFile: "index.js",
|
|
17
|
+
minify: false,
|
|
18
|
+
publicDir: "./public",
|
|
19
|
+
copyPublicDir: false
|
|
20
|
+
};
|
|
21
|
+
const OPTIONS_BUILD_HANDLER = {
|
|
22
|
+
target: "handler",
|
|
23
|
+
bundle: "external",
|
|
24
|
+
outputDir: "./dist",
|
|
25
|
+
outputFile: "index.js",
|
|
26
|
+
minify: false
|
|
27
|
+
};
|
|
28
|
+
const OPTIONS_DEFAULT = {
|
|
29
|
+
cwd: process.cwd(),
|
|
30
|
+
runtime: "node",
|
|
31
|
+
dev: OPTIONS_DEV,
|
|
32
|
+
verbose: false
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
exports.OPTIONS_BUILD_HANDLER = OPTIONS_BUILD_HANDLER;
|
|
36
|
+
exports.OPTIONS_BUILD_SERVER = OPTIONS_BUILD_SERVER;
|
|
37
|
+
exports.OPTIONS_BUILD_SERVER_BASE = OPTIONS_BUILD_SERVER_BASE;
|
|
38
|
+
exports.OPTIONS_DEFAULT = OPTIONS_DEFAULT;
|
|
39
|
+
exports.OPTIONS_DEV = OPTIONS_DEV;
|
|
40
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","names":[],"sources":["../../src/consts/options.ts"],"sourcesContent":["import type {\n ResolvedBuildHandlerOptions,\n ResolvedBuildServerOptions,\n ResolvedOptions,\n} from \"#/@types/options/resolved\";\n\nconst OPTIONS_DEV = {\n host: \"localhost\",\n port: 3001,\n} as const;\n\nconst OPTIONS_BUILD_SERVER_BASE = {\n host: \"localhost\",\n port: 3000,\n} as const;\n\nconst OPTIONS_BUILD_SERVER: ResolvedBuildServerOptions = {\n ...OPTIONS_BUILD_SERVER_BASE,\n target: \"server\",\n bundle: \"external\",\n outputDir: \"./dist\",\n outputFile: \"index.js\",\n minify: false,\n publicDir: \"./public\",\n copyPublicDir: false,\n};\n\nconst OPTIONS_BUILD_HANDLER: ResolvedBuildHandlerOptions = {\n target: \"handler\",\n bundle: \"external\",\n outputDir: \"./dist\",\n outputFile: \"index.js\",\n minify: false,\n};\n\nconst OPTIONS_DEFAULT: Omit<ResolvedOptions, \"entry\" | \"build\"> = {\n cwd: process.cwd(),\n runtime: \"node\",\n dev: OPTIONS_DEV,\n verbose: false,\n};\n\nexport {\n OPTIONS_BUILD_HANDLER,\n OPTIONS_BUILD_SERVER,\n OPTIONS_BUILD_SERVER_BASE,\n OPTIONS_DEFAULT,\n OPTIONS_DEV,\n};\n"],"mappings":";;AAMA,MAAM,cAAc;CAChB,MAAM;CACN,MAAM;AACV;AAEA,MAAM,4BAA4B;CAC9B,MAAM;CACN,MAAM;AACV;AAEA,MAAM,uBAAmD;CACrD,GAAG;CACH,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,QAAQ;CACR,WAAW;CACX,eAAe;AACnB;AAEA,MAAM,wBAAqD;CACvD,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,QAAQ;AACZ;AAEA,MAAM,kBAA4D;CAC9D,KAAK,QAAQ,IAAI;CACjB,SAAS;CACT,KAAK;CACL,SAAS;AACb"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const OPTIONS_DEV = {
|
|
2
|
+
host: "localhost",
|
|
3
|
+
port: 3001
|
|
4
|
+
};
|
|
5
|
+
const OPTIONS_BUILD_SERVER_BASE = {
|
|
6
|
+
host: "localhost",
|
|
7
|
+
port: 3e3
|
|
8
|
+
};
|
|
9
|
+
const OPTIONS_BUILD_SERVER = {
|
|
10
|
+
...OPTIONS_BUILD_SERVER_BASE,
|
|
11
|
+
target: "server",
|
|
12
|
+
bundle: "external",
|
|
13
|
+
outputDir: "./dist",
|
|
14
|
+
outputFile: "index.js",
|
|
15
|
+
minify: false,
|
|
16
|
+
publicDir: "./public",
|
|
17
|
+
copyPublicDir: false
|
|
18
|
+
};
|
|
19
|
+
const OPTIONS_BUILD_HANDLER = {
|
|
20
|
+
target: "handler",
|
|
21
|
+
bundle: "external",
|
|
22
|
+
outputDir: "./dist",
|
|
23
|
+
outputFile: "index.js",
|
|
24
|
+
minify: false
|
|
25
|
+
};
|
|
26
|
+
const OPTIONS_DEFAULT = {
|
|
27
|
+
cwd: process.cwd(),
|
|
28
|
+
runtime: "node",
|
|
29
|
+
dev: OPTIONS_DEV,
|
|
30
|
+
verbose: false
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { OPTIONS_BUILD_HANDLER, OPTIONS_BUILD_SERVER, OPTIONS_BUILD_SERVER_BASE, OPTIONS_DEFAULT, OPTIONS_DEV };
|
|
34
|
+
//# sourceMappingURL=options.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.mjs","names":[],"sources":["../../src/consts/options.ts"],"sourcesContent":["import type {\n ResolvedBuildHandlerOptions,\n ResolvedBuildServerOptions,\n ResolvedOptions,\n} from \"#/@types/options/resolved\";\n\nconst OPTIONS_DEV = {\n host: \"localhost\",\n port: 3001,\n} as const;\n\nconst OPTIONS_BUILD_SERVER_BASE = {\n host: \"localhost\",\n port: 3000,\n} as const;\n\nconst OPTIONS_BUILD_SERVER: ResolvedBuildServerOptions = {\n ...OPTIONS_BUILD_SERVER_BASE,\n target: \"server\",\n bundle: \"external\",\n outputDir: \"./dist\",\n outputFile: \"index.js\",\n minify: false,\n publicDir: \"./public\",\n copyPublicDir: false,\n};\n\nconst OPTIONS_BUILD_HANDLER: ResolvedBuildHandlerOptions = {\n target: \"handler\",\n bundle: \"external\",\n outputDir: \"./dist\",\n outputFile: \"index.js\",\n minify: false,\n};\n\nconst OPTIONS_DEFAULT: Omit<ResolvedOptions, \"entry\" | \"build\"> = {\n cwd: process.cwd(),\n runtime: \"node\",\n dev: OPTIONS_DEV,\n verbose: false,\n};\n\nexport {\n OPTIONS_BUILD_HANDLER,\n OPTIONS_BUILD_SERVER,\n OPTIONS_BUILD_SERVER_BASE,\n OPTIONS_DEFAULT,\n OPTIONS_DEV,\n};\n"],"mappings":"AAMA,MAAM,cAAc;CAChB,MAAM;CACN,MAAM;AACV;AAEA,MAAM,4BAA4B;CAC9B,MAAM;CACN,MAAM;AACV;AAEA,MAAM,uBAAmD;CACrD,GAAG;CACH,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,QAAQ;CACR,WAAW;CACX,eAAe;AACnB;AAEA,MAAM,wBAAqD;CACvD,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,QAAQ;AACZ;AAEA,MAAM,kBAA4D;CAC9D,KAAK,QAAQ,IAAI;CACjB,SAAS;CACT,KAAK;CACL,SAAS;AACb"}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_consts_options = require('../../consts/options.js');
|
|
3
|
+
const require_functions_env_inject = require('../env/inject.js');
|
|
10
4
|
const require_functions_path_posix = require('../path/posix.js');
|
|
11
5
|
|
|
12
6
|
const createVirtualEntryCode = (opts) => {
|
|
13
7
|
const build = opts.build;
|
|
14
8
|
let code = "";
|
|
9
|
+
if (opts.runtime === "workerd") code += `import { env } from "cloudflare:workers";`;
|
|
15
10
|
code += `import options from "${require_functions_path_posix.toPosix(opts.entry)}";`;
|
|
16
11
|
code += `import { serve } from "${opts.packageName}/runtime";`;
|
|
17
12
|
if (build.target === "handler") {
|
|
@@ -21,13 +16,16 @@ const createVirtualEntryCode = (opts) => {
|
|
|
21
16
|
}
|
|
22
17
|
code += `serve({`;
|
|
23
18
|
code += `...options,`;
|
|
24
|
-
if (build.host !==
|
|
25
|
-
if (build.port !==
|
|
19
|
+
if (build.host !== require_consts_options.OPTIONS_BUILD_SERVER_BASE.host) code += `hostname: ${require_functions_env_inject.injectString(opts.runtime, build.host, require_consts_options.OPTIONS_BUILD_SERVER_BASE.host)},`;
|
|
20
|
+
if (build.port !== require_consts_options.OPTIONS_BUILD_SERVER_BASE.port) code += `port: ${require_functions_env_inject.injectNumber(opts.runtime, build.port, require_consts_options.OPTIONS_BUILD_SERVER_BASE.port)},`;
|
|
26
21
|
if (build.https) {
|
|
22
|
+
const cert = build.https.cert;
|
|
23
|
+
const key = build.https.key;
|
|
24
|
+
const passphrase = build.https.passphrase;
|
|
27
25
|
code += `tls: {`;
|
|
28
|
-
if (
|
|
29
|
-
if (
|
|
30
|
-
if (
|
|
26
|
+
if (cert !== void 0) code += `cert: ${require_functions_env_inject.injectString(opts.runtime, typeof cert === "string" ? require_functions_path_posix.toPosix(cert) : cert)},`;
|
|
27
|
+
if (key !== void 0) code += `key: ${require_functions_env_inject.injectString(opts.runtime, typeof key === "string" ? require_functions_path_posix.toPosix(key) : key)},`;
|
|
28
|
+
if (passphrase !== void 0) code += `passphrase: ${require_functions_env_inject.injectString(opts.runtime, passphrase)},`;
|
|
31
29
|
code += `},`;
|
|
32
30
|
}
|
|
33
31
|
code += `});`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-entry.js","names":["toPosix"],"sources":["../../../src/functions/build/virtual-entry.ts"],"sourcesContent":["import type {\n ResolvedBuildOptions,\n ResolvedOptions,\n} from \"#/@types/options/resolved\";\n\nimport { toPosix } from \"#/functions/path/posix\";\n\ntype VirtualEntryOptions = ResolvedOptions & {\n packageName: string;\n};\n\nconst createVirtualEntryCode = (opts: VirtualEntryOptions): string => {\n const build: ResolvedBuildOptions = opts.build;\n\n let code: string = \"\";\n\n code += `import options from \"${toPosix(opts.entry)}\";`;\n code += `import { serve } from \"${opts.packageName}/runtime\";`;\n\n // Handler targets run on platforms that manage their own server lifecycle,\n // add `manual: true` prevents serve() from auto-listening\n if (build.target === \"handler\") {\n code += `const server = serve({ ...options, manual: true });`;\n code += `export default server;`;\n\n return code;\n }\n\n code += `serve({`;\n code += `...options,`;\n\n if (build.host !==
|
|
1
|
+
{"version":3,"file":"virtual-entry.js","names":["toPosix","OPTIONS_BUILD_SERVER_BASE","injectString","injectNumber"],"sources":["../../../src/functions/build/virtual-entry.ts"],"sourcesContent":["import type { ResolvableString } from \"#/@types/env\";\nimport type {\n ResolvedBuildOptions,\n ResolvedOptions,\n} from \"#/@types/options/resolved\";\n\nimport { OPTIONS_BUILD_SERVER_BASE } from \"#/consts/options\";\nimport { injectNumber, injectString } from \"#/functions/env/inject\";\nimport { toPosix } from \"#/functions/path/posix\";\n\ntype VirtualEntryOptions = ResolvedOptions & {\n packageName: string;\n};\n\nconst createVirtualEntryCode = (opts: VirtualEntryOptions): string => {\n const build: ResolvedBuildOptions = opts.build;\n\n let code: string = \"\";\n\n // Inject the env import for Cloudflare Workers\n if (opts.runtime === \"workerd\")\n code += `import { env } from \"cloudflare:workers\";`;\n\n code += `import options from \"${toPosix(opts.entry)}\";`;\n code += `import { serve } from \"${opts.packageName}/runtime\";`;\n\n // Handler targets run on platforms that manage their own server lifecycle,\n // add `manual: true` prevents serve() from auto-listening\n if (build.target === \"handler\") {\n code += `const server = serve({ ...options, manual: true });`;\n code += `export default server;`;\n\n return code;\n }\n\n code += `serve({`;\n code += `...options,`;\n\n if (build.host !== OPTIONS_BUILD_SERVER_BASE.host) {\n code += `hostname: ${injectString(opts.runtime, build.host, OPTIONS_BUILD_SERVER_BASE.host)},`;\n }\n if (build.port !== OPTIONS_BUILD_SERVER_BASE.port) {\n code += `port: ${injectNumber(opts.runtime, build.port, OPTIONS_BUILD_SERVER_BASE.port)},`;\n }\n\n if (build.https) {\n const cert: ResolvableString | undefined = build.https.cert;\n const key: ResolvableString | undefined = build.https.key;\n const passphrase: ResolvableString | undefined = build.https.passphrase;\n\n code += `tls: {`;\n if (cert !== void 0)\n code += `cert: ${injectString(opts.runtime, typeof cert === \"string\" ? toPosix(cert) : cert)},`;\n if (key !== void 0)\n code += `key: ${injectString(opts.runtime, typeof key === \"string\" ? toPosix(key) : key)},`;\n if (passphrase !== void 0)\n code += `passphrase: ${injectString(opts.runtime, passphrase)},`;\n code += `},`;\n }\n\n code += `});`;\n\n return code;\n};\n\nexport type { VirtualEntryOptions };\nexport { createVirtualEntryCode };\n"],"mappings":";;;;;AAcA,MAAM,0BAA0B,SAAsC;CAClE,MAAM,QAA8B,KAAK;CAEzC,IAAI,OAAe;CAGnB,IAAI,KAAK,YAAY,WACjB,QAAQ;CAEZ,QAAQ,wBAAwBA,qCAAQ,KAAK,KAAK,EAAE;CACpD,QAAQ,0BAA0B,KAAK,YAAY;CAInD,IAAI,MAAM,WAAW,WAAW;EAC5B,QAAQ;EACR,QAAQ;EAER,OAAO;CACX;CAEA,QAAQ;CACR,QAAQ;CAER,IAAI,MAAM,SAASC,iDAA0B,MACzC,QAAQ,aAAaC,0CAAa,KAAK,SAAS,MAAM,MAAMD,iDAA0B,IAAI,EAAE;CAEhG,IAAI,MAAM,SAASA,iDAA0B,MACzC,QAAQ,SAASE,0CAAa,KAAK,SAAS,MAAM,MAAMF,iDAA0B,IAAI,EAAE;CAG5F,IAAI,MAAM,OAAO;EACb,MAAM,OAAqC,MAAM,MAAM;EACvD,MAAM,MAAoC,MAAM,MAAM;EACtD,MAAM,aAA2C,MAAM,MAAM;EAE7D,QAAQ;EACR,IAAI,SAAS,KAAK,GACd,QAAQ,SAASC,0CAAa,KAAK,SAAS,OAAO,SAAS,WAAWF,qCAAQ,IAAI,IAAI,IAAI,EAAE;EACjG,IAAI,QAAQ,KAAK,GACb,QAAQ,QAAQE,0CAAa,KAAK,SAAS,OAAO,QAAQ,WAAWF,qCAAQ,GAAG,IAAI,GAAG,EAAE;EAC7F,IAAI,eAAe,KAAK,GACpB,QAAQ,eAAeE,0CAAa,KAAK,SAAS,UAAU,EAAE;EAClE,QAAQ;CACZ;CAEA,QAAQ;CAER,OAAO;AACX"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
1
|
+
import { OPTIONS_BUILD_SERVER_BASE } from "../../consts/options.mjs";
|
|
2
|
+
import { injectNumber, injectString } from "../env/inject.mjs";
|
|
9
3
|
import { toPosix } from "../path/posix.mjs";
|
|
10
4
|
|
|
11
5
|
const createVirtualEntryCode = (opts) => {
|
|
12
6
|
const build = opts.build;
|
|
13
7
|
let code = "";
|
|
8
|
+
if (opts.runtime === "workerd") code += `import { env } from "cloudflare:workers";`;
|
|
14
9
|
code += `import options from "${toPosix(opts.entry)}";`;
|
|
15
10
|
code += `import { serve } from "${opts.packageName}/runtime";`;
|
|
16
11
|
if (build.target === "handler") {
|
|
@@ -20,13 +15,16 @@ const createVirtualEntryCode = (opts) => {
|
|
|
20
15
|
}
|
|
21
16
|
code += `serve({`;
|
|
22
17
|
code += `...options,`;
|
|
23
|
-
if (build.host !==
|
|
24
|
-
if (build.port !==
|
|
18
|
+
if (build.host !== OPTIONS_BUILD_SERVER_BASE.host) code += `hostname: ${injectString(opts.runtime, build.host, OPTIONS_BUILD_SERVER_BASE.host)},`;
|
|
19
|
+
if (build.port !== OPTIONS_BUILD_SERVER_BASE.port) code += `port: ${injectNumber(opts.runtime, build.port, OPTIONS_BUILD_SERVER_BASE.port)},`;
|
|
25
20
|
if (build.https) {
|
|
21
|
+
const cert = build.https.cert;
|
|
22
|
+
const key = build.https.key;
|
|
23
|
+
const passphrase = build.https.passphrase;
|
|
26
24
|
code += `tls: {`;
|
|
27
|
-
if (
|
|
28
|
-
if (
|
|
29
|
-
if (
|
|
25
|
+
if (cert !== void 0) code += `cert: ${injectString(opts.runtime, typeof cert === "string" ? toPosix(cert) : cert)},`;
|
|
26
|
+
if (key !== void 0) code += `key: ${injectString(opts.runtime, typeof key === "string" ? toPosix(key) : key)},`;
|
|
27
|
+
if (passphrase !== void 0) code += `passphrase: ${injectString(opts.runtime, passphrase)},`;
|
|
30
28
|
code += `},`;
|
|
31
29
|
}
|
|
32
30
|
code += `});`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-entry.mjs","names":[],"sources":["../../../src/functions/build/virtual-entry.ts"],"sourcesContent":["import type {\n ResolvedBuildOptions,\n ResolvedOptions,\n} from \"#/@types/options/resolved\";\n\nimport { toPosix } from \"#/functions/path/posix\";\n\ntype VirtualEntryOptions = ResolvedOptions & {\n packageName: string;\n};\n\nconst createVirtualEntryCode = (opts: VirtualEntryOptions): string => {\n const build: ResolvedBuildOptions = opts.build;\n\n let code: string = \"\";\n\n code += `import options from \"${toPosix(opts.entry)}\";`;\n code += `import { serve } from \"${opts.packageName}/runtime\";`;\n\n // Handler targets run on platforms that manage their own server lifecycle,\n // add `manual: true` prevents serve() from auto-listening\n if (build.target === \"handler\") {\n code += `const server = serve({ ...options, manual: true });`;\n code += `export default server;`;\n\n return code;\n }\n\n code += `serve({`;\n code += `...options,`;\n\n if (build.host !==
|
|
1
|
+
{"version":3,"file":"virtual-entry.mjs","names":[],"sources":["../../../src/functions/build/virtual-entry.ts"],"sourcesContent":["import type { ResolvableString } from \"#/@types/env\";\nimport type {\n ResolvedBuildOptions,\n ResolvedOptions,\n} from \"#/@types/options/resolved\";\n\nimport { OPTIONS_BUILD_SERVER_BASE } from \"#/consts/options\";\nimport { injectNumber, injectString } from \"#/functions/env/inject\";\nimport { toPosix } from \"#/functions/path/posix\";\n\ntype VirtualEntryOptions = ResolvedOptions & {\n packageName: string;\n};\n\nconst createVirtualEntryCode = (opts: VirtualEntryOptions): string => {\n const build: ResolvedBuildOptions = opts.build;\n\n let code: string = \"\";\n\n // Inject the env import for Cloudflare Workers\n if (opts.runtime === \"workerd\")\n code += `import { env } from \"cloudflare:workers\";`;\n\n code += `import options from \"${toPosix(opts.entry)}\";`;\n code += `import { serve } from \"${opts.packageName}/runtime\";`;\n\n // Handler targets run on platforms that manage their own server lifecycle,\n // add `manual: true` prevents serve() from auto-listening\n if (build.target === \"handler\") {\n code += `const server = serve({ ...options, manual: true });`;\n code += `export default server;`;\n\n return code;\n }\n\n code += `serve({`;\n code += `...options,`;\n\n if (build.host !== OPTIONS_BUILD_SERVER_BASE.host) {\n code += `hostname: ${injectString(opts.runtime, build.host, OPTIONS_BUILD_SERVER_BASE.host)},`;\n }\n if (build.port !== OPTIONS_BUILD_SERVER_BASE.port) {\n code += `port: ${injectNumber(opts.runtime, build.port, OPTIONS_BUILD_SERVER_BASE.port)},`;\n }\n\n if (build.https) {\n const cert: ResolvableString | undefined = build.https.cert;\n const key: ResolvableString | undefined = build.https.key;\n const passphrase: ResolvableString | undefined = build.https.passphrase;\n\n code += `tls: {`;\n if (cert !== void 0)\n code += `cert: ${injectString(opts.runtime, typeof cert === \"string\" ? toPosix(cert) : cert)},`;\n if (key !== void 0)\n code += `key: ${injectString(opts.runtime, typeof key === \"string\" ? toPosix(key) : key)},`;\n if (passphrase !== void 0)\n code += `passphrase: ${injectString(opts.runtime, passphrase)},`;\n code += `},`;\n }\n\n code += `});`;\n\n return code;\n};\n\nexport type { VirtualEntryOptions };\nexport { createVirtualEntryCode };\n"],"mappings":";;;;AAcA,MAAM,0BAA0B,SAAsC;CAClE,MAAM,QAA8B,KAAK;CAEzC,IAAI,OAAe;CAGnB,IAAI,KAAK,YAAY,WACjB,QAAQ;CAEZ,QAAQ,wBAAwB,QAAQ,KAAK,KAAK,EAAE;CACpD,QAAQ,0BAA0B,KAAK,YAAY;CAInD,IAAI,MAAM,WAAW,WAAW;EAC5B,QAAQ;EACR,QAAQ;EAER,OAAO;CACX;CAEA,QAAQ;CACR,QAAQ;CAER,IAAI,MAAM,SAAS,0BAA0B,MACzC,QAAQ,aAAa,aAAa,KAAK,SAAS,MAAM,MAAM,0BAA0B,IAAI,EAAE;CAEhG,IAAI,MAAM,SAAS,0BAA0B,MACzC,QAAQ,SAAS,aAAa,KAAK,SAAS,MAAM,MAAM,0BAA0B,IAAI,EAAE;CAG5F,IAAI,MAAM,OAAO;EACb,MAAM,OAAqC,MAAM,MAAM;EACvD,MAAM,MAAoC,MAAM,MAAM;EACtD,MAAM,aAA2C,MAAM,MAAM;EAE7D,QAAQ;EACR,IAAI,SAAS,KAAK,GACd,QAAQ,SAAS,aAAa,KAAK,SAAS,OAAO,SAAS,WAAW,QAAQ,IAAI,IAAI,IAAI,EAAE;EACjG,IAAI,QAAQ,KAAK,GACb,QAAQ,QAAQ,aAAa,KAAK,SAAS,OAAO,QAAQ,WAAW,QAAQ,GAAG,IAAI,GAAG,EAAE;EAC7F,IAAI,eAAe,KAAK,GACpB,QAAQ,eAAe,aAAa,KAAK,SAAS,UAAU,EAAE;EAClE,QAAQ;CACZ;CAEA,QAAQ;CAER,OAAO;AACX"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ResolvableNumber, ResolvableString } from "../../@types/env.js";
|
|
2
|
+
import { Runtime } from "../../@types/options/complete/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Inject resolvable string.
|
|
5
|
+
*/
|
|
6
|
+
declare function injectString(runtime: Runtime, value: ResolvableString): string;
|
|
7
|
+
/**
|
|
8
|
+
* Inject resolvable string with fallback value.
|
|
9
|
+
*/
|
|
10
|
+
declare function injectString(runtime: Runtime, value: ResolvableString, fallback: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Inject resolvable number.
|
|
13
|
+
*/
|
|
14
|
+
declare function injectNumber(runtime: Runtime, value: ResolvableNumber): string;
|
|
15
|
+
/**
|
|
16
|
+
* Inject resolvable number with fallback value.
|
|
17
|
+
*/
|
|
18
|
+
declare function injectNumber(runtime: Runtime, value: ResolvableNumber, fallback: number): string;
|
|
19
|
+
export { injectNumber, injectString };
|
|
20
|
+
//# sourceMappingURL=inject.d.ts.map
|