@zeltjs/adapter-bun 0.0.1 → 0.4.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/LICENSE +21 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +117 -0
- package/dist/index.js.map +1 -0
- package/package.json +35 -8
- package/README.md +0 -45
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 9wick / Kohei Kido
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CommandApp, EnvConfig, HttpApp, ReadyResult } from "@zeltjs/core";
|
|
2
|
+
|
|
3
|
+
//#region src/bun-env.config.d.ts
|
|
4
|
+
declare class BunEnvConfig extends EnvConfig {
|
|
5
|
+
get(key: string): string | undefined;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/on-bun.d.ts
|
|
9
|
+
type ServeOptions = {
|
|
10
|
+
readonly port?: number;
|
|
11
|
+
readonly hostname?: string;
|
|
12
|
+
};
|
|
13
|
+
type ServerHandle = {
|
|
14
|
+
readonly address: {
|
|
15
|
+
port: number;
|
|
16
|
+
hostname: string;
|
|
17
|
+
};
|
|
18
|
+
readonly shutdown: () => Promise<void>;
|
|
19
|
+
};
|
|
20
|
+
type BunAppOptions = {
|
|
21
|
+
readonly warmup?: boolean;
|
|
22
|
+
};
|
|
23
|
+
type ExecResult = {
|
|
24
|
+
readonly exitCode: 0 | 1;
|
|
25
|
+
};
|
|
26
|
+
type BunAppBase = {
|
|
27
|
+
readonly args: readonly string[];
|
|
28
|
+
};
|
|
29
|
+
type HttpBunApp = ReadyResult & BunAppBase & {
|
|
30
|
+
readonly serve: (options?: ServeOptions) => ServerHandle;
|
|
31
|
+
readonly shutdown: () => Promise<void>;
|
|
32
|
+
};
|
|
33
|
+
type CommandBunApp = ReadyResult & BunAppBase & {
|
|
34
|
+
readonly execCommand: (argv: string[]) => Promise<ExecResult>;
|
|
35
|
+
readonly shutdown: () => Promise<void>;
|
|
36
|
+
};
|
|
37
|
+
type FullBunApp = HttpBunApp & CommandBunApp;
|
|
38
|
+
type BunApp = HttpBunApp | CommandBunApp | FullBunApp;
|
|
39
|
+
/** @throws {ZeltLifecycleStateError} */
|
|
40
|
+
declare function onBun(app: HttpApp & CommandApp, options?: BunAppOptions): Promise<FullBunApp>;
|
|
41
|
+
/** @throws {ZeltLifecycleStateError} */
|
|
42
|
+
declare function onBun(app: HttpApp, options?: BunAppOptions): Promise<HttpBunApp>;
|
|
43
|
+
/** @throws {ZeltLifecycleStateError} */
|
|
44
|
+
declare function onBun(app: CommandApp, options?: BunAppOptions): Promise<CommandBunApp>;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { type BunApp, type BunAppOptions, BunEnvConfig, type CommandBunApp, type ExecResult, type FullBunApp, type HttpBunApp, type ServerHandle, onBun };
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/bun-env.config.ts","../src/on-bun.ts"],"mappings":";;;cAGa,YAAA,SAAqB,SAAA;EACvB,GAAA,CAAI,GAAA;AAAA;;;KCAV,YAAA;EAAA,SACM,IAAA;EAAA,SACA,QAAA;AAAA;AAAA,KAGC,YAAA;EAAA,SACD,OAAA;IAAW,IAAA;IAAc,QAAA;EAAA;EAAA,SACzB,QAAA,QAAgB,OAAA;AAAA;AAAA,KAGf,aAAA;EAAA,SACD,MAAA;AAAA;AAAA,KAGC,UAAA;EAAA,SACD,QAAA;AAAA;AAAA,KAGN,UAAA;EAAA,SACM,IAAA;AAAA;AAAA,KAGC,UAAA,GAAa,WAAA,GACvB,UAAA;EAAA,SACW,KAAA,GAAQ,OAAA,GAAU,YAAA,KAAiB,YAAA;EAAA,SACnC,QAAA,QAAgB,OAAA;AAAA;AAAA,KAGjB,aAAA,GAAgB,WAAA,GAC1B,UAAA;EAAA,SACW,WAAA,GAAc,IAAA,eAAmB,OAAA,CAAQ,UAAA;EAAA,SACzC,QAAA,QAAgB,OAAA;AAAA;AAAA,KAGjB,UAAA,GAAa,UAAA,GAAa,aAAA;AAAA,KAE1B,MAAA,GAAS,UAAA,GAAa,aAAA,GAAgB,UAAA;AA1BlD;AAAA,iBAoLgB,KAAA,CAAM,GAAA,EAAK,OAAA,GAAU,UAAA,EAAY,OAAA,GAAU,aAAA,GAAgB,OAAA,CAAQ,UAAA;;iBAEnE,KAAA,CAAM,GAAA,EAAK,OAAA,EAAS,OAAA,GAAU,aAAA,GAAgB,OAAA,CAAQ,UAAA;;iBAEtD,KAAA,CAAM,GAAA,EAAK,UAAA,EAAY,OAAA,GAAU,aAAA,GAAgB,OAAA,CAAQ,aAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Config, EnvConfig } from "@zeltjs/core";
|
|
2
|
+
//#region src/bun-env.config.ts
|
|
3
|
+
var BunEnvConfig = @Config class extends EnvConfig {
|
|
4
|
+
get(key) {
|
|
5
|
+
return Bun.env[key];
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/on-bun.ts
|
|
10
|
+
const successResult = { exitCode: 0 };
|
|
11
|
+
const failureResult = { exitCode: 1 };
|
|
12
|
+
const createServeForHttp = (appFetch, appShutdown) => {
|
|
13
|
+
return (options) => {
|
|
14
|
+
const port = options?.port ?? 3e3;
|
|
15
|
+
const hostname = options?.hostname ?? "0.0.0.0";
|
|
16
|
+
const server = Bun.serve({
|
|
17
|
+
fetch: appFetch,
|
|
18
|
+
port,
|
|
19
|
+
hostname
|
|
20
|
+
});
|
|
21
|
+
const shutdown = async () => {
|
|
22
|
+
await server.stop();
|
|
23
|
+
await appShutdown();
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
address: {
|
|
27
|
+
port: server.port ?? port,
|
|
28
|
+
hostname: server.hostname ?? hostname
|
|
29
|
+
},
|
|
30
|
+
shutdown
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/** @throws {ZeltLifecycleStateError} */
|
|
35
|
+
const runCommand = (CommandClass, get) => {
|
|
36
|
+
const instance = get(CommandClass);
|
|
37
|
+
return Promise.resolve().then(() => instance.run()).then(() => successResult).catch(() => failureResult);
|
|
38
|
+
};
|
|
39
|
+
/** @throws {ZeltLifecycleStateError} */
|
|
40
|
+
const createExecForCommands = (hasCommand, getCommands, get, stderr) => {
|
|
41
|
+
return async (argv) => {
|
|
42
|
+
const commandName = argv[0];
|
|
43
|
+
if (!commandName) {
|
|
44
|
+
stderr.write("No command specified\n");
|
|
45
|
+
return failureResult;
|
|
46
|
+
}
|
|
47
|
+
if (!hasCommand(commandName)) {
|
|
48
|
+
stderr.write(`Command not found: ${commandName}\n`);
|
|
49
|
+
return failureResult;
|
|
50
|
+
}
|
|
51
|
+
const CommandClass = getCommands().get(commandName);
|
|
52
|
+
if (!CommandClass) return failureResult;
|
|
53
|
+
return runCommand(CommandClass, get);
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
const getStderr = () => globalThis.process.stderr;
|
|
57
|
+
const getArgs = () => Bun.argv.slice(2);
|
|
58
|
+
const extractCapabilities = (app) => app;
|
|
59
|
+
const buildHttpBunApp = (caps, resolver, shutdown, args) => {
|
|
60
|
+
if (typeof caps.fetch !== "function") return void 0;
|
|
61
|
+
return {
|
|
62
|
+
...resolver,
|
|
63
|
+
args,
|
|
64
|
+
serve: createServeForHttp(caps.fetch, shutdown),
|
|
65
|
+
shutdown
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
/** @throws {ZeltLifecycleStateError} */
|
|
69
|
+
const buildCommandBunApp = (caps, resolver, shutdown, stderr, args) => {
|
|
70
|
+
if (typeof caps.hasCommand !== "function" || typeof caps.getCommands !== "function") return void 0;
|
|
71
|
+
return {
|
|
72
|
+
...resolver,
|
|
73
|
+
args,
|
|
74
|
+
execCommand: createExecForCommands(caps.hasCommand, caps.getCommands, resolver.get, stderr),
|
|
75
|
+
shutdown
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
/** @throws {ZeltLifecycleStateError} */
|
|
79
|
+
const buildBunApps = (caps, resolver, shutdown, stderr, args) => ({
|
|
80
|
+
httpResult: buildHttpBunApp(caps, resolver, shutdown, args),
|
|
81
|
+
commandResult: buildCommandBunApp(caps, resolver, shutdown, stderr, args)
|
|
82
|
+
});
|
|
83
|
+
const mergeBunApps = (result, resolver, shutdown, args) => {
|
|
84
|
+
const { httpResult, commandResult } = result;
|
|
85
|
+
if (httpResult && commandResult) return {
|
|
86
|
+
...httpResult,
|
|
87
|
+
execCommand: commandResult.execCommand
|
|
88
|
+
};
|
|
89
|
+
if (httpResult) return httpResult;
|
|
90
|
+
if (commandResult) return commandResult;
|
|
91
|
+
return {
|
|
92
|
+
...resolver,
|
|
93
|
+
args,
|
|
94
|
+
shutdown,
|
|
95
|
+
serve: () => ({
|
|
96
|
+
address: {
|
|
97
|
+
port: 0,
|
|
98
|
+
hostname: ""
|
|
99
|
+
},
|
|
100
|
+
shutdown
|
|
101
|
+
})
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
/** @throws {ZeltLifecycleStateError} */
|
|
105
|
+
async function onBun(app, options = {}) {
|
|
106
|
+
app.addFallbackConfig(BunEnvConfig);
|
|
107
|
+
const readyOptions = { warmup: options.warmup ?? true };
|
|
108
|
+
const resolver = await app.ready(readyOptions);
|
|
109
|
+
const caps = extractCapabilities(app);
|
|
110
|
+
const stderr = getStderr();
|
|
111
|
+
const args = getArgs();
|
|
112
|
+
return mergeBunApps(buildBunApps(caps, resolver, app.shutdown, stderr, args), resolver, app.shutdown, args);
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
export { BunEnvConfig, onBun };
|
|
116
|
+
|
|
117
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/bun-env.config.ts","../src/on-bun.ts"],"sourcesContent":["import { Config, EnvConfig } from '@zeltjs/core';\n\n@Config\nexport class BunEnvConfig extends EnvConfig {\n override get(key: string): string | undefined {\n return Bun.env[key];\n }\n}\n","import type { CommandApp, CommandClass, HttpApp, ReadyOptions, ReadyResult } from '@zeltjs/core';\n\nimport { BunEnvConfig } from './bun-env.config';\n\ntype ServeOptions = {\n readonly port?: number;\n readonly hostname?: string;\n};\n\nexport type ServerHandle = {\n readonly address: { port: number; hostname: string };\n readonly shutdown: () => Promise<void>;\n};\n\nexport type BunAppOptions = {\n readonly warmup?: boolean;\n};\n\nexport type ExecResult = {\n readonly exitCode: 0 | 1;\n};\n\ntype BunAppBase = {\n readonly args: readonly string[];\n};\n\nexport type HttpBunApp = ReadyResult &\n BunAppBase & {\n readonly serve: (options?: ServeOptions) => ServerHandle;\n readonly shutdown: () => Promise<void>;\n };\n\nexport type CommandBunApp = ReadyResult &\n BunAppBase & {\n readonly execCommand: (argv: string[]) => Promise<ExecResult>;\n readonly shutdown: () => Promise<void>;\n };\n\nexport type FullBunApp = HttpBunApp & CommandBunApp;\n\nexport type BunApp = HttpBunApp | CommandBunApp | FullBunApp;\n\ntype Stderr = { write: (s: string) => void };\n\nconst successResult: ExecResult = { exitCode: 0 };\nconst failureResult: ExecResult = { exitCode: 1 };\n\nconst createServeForHttp = (\n appFetch: (request: Request) => Promise<Response>,\n appShutdown: () => Promise<void>,\n): ((options?: ServeOptions) => ServerHandle) => {\n return (options?: ServeOptions): ServerHandle => {\n const port = options?.port ?? 3000;\n const hostname = options?.hostname ?? '0.0.0.0';\n\n const server = Bun.serve({\n fetch: appFetch,\n port,\n hostname,\n });\n\n const shutdown = async (): Promise<void> => {\n await server.stop();\n await appShutdown();\n };\n\n return {\n address: { port: server.port ?? port, hostname: server.hostname ?? hostname },\n shutdown,\n };\n };\n};\n\n/** @throws {ZeltLifecycleStateError} */\nconst runCommand = (\n CommandClass: CommandClass,\n get: <T extends object>(cls: new (...args: never[]) => T) => T,\n): Promise<ExecResult> => {\n const instance = get(CommandClass);\n return Promise.resolve()\n .then(() => instance.run())\n .then(() => successResult)\n .catch(() => failureResult);\n};\n\n/** @throws {ZeltLifecycleStateError} */\nconst createExecForCommands = (\n hasCommand: (name: string) => boolean,\n getCommands: () => ReadonlyMap<string, CommandClass>,\n get: <T extends object>(cls: new (...args: never[]) => T) => T,\n stderr: Stderr,\n): ((argv: string[]) => Promise<ExecResult>) => {\n return async (argv: string[]): Promise<ExecResult> => {\n const commandName = argv[0];\n if (!commandName) {\n stderr.write('No command specified\\n');\n return failureResult;\n }\n\n if (!hasCommand(commandName)) {\n stderr.write(`Command not found: ${commandName}\\n`);\n return failureResult;\n }\n\n const commandMap = getCommands();\n const CommandClass = commandMap.get(commandName);\n if (!CommandClass) {\n return failureResult;\n }\n\n return runCommand(CommandClass, get);\n };\n};\n\nconst getStderr = (): Stderr => globalThis.process.stderr;\n\nconst getArgs = (): readonly string[] => Bun.argv.slice(2);\n\ntype AppCapabilities = {\n fetch?: (request: Request) => Promise<Response>;\n hasCommand?: (name: string) => boolean;\n getCommands?: () => ReadonlyMap<string, CommandClass>;\n};\n\nconst extractCapabilities = (app: HttpApp | CommandApp | (HttpApp & CommandApp)): AppCapabilities =>\n app;\n\ntype BuildResult = {\n httpResult: HttpBunApp | undefined;\n commandResult: CommandBunApp | undefined;\n};\n\nconst buildHttpBunApp = (\n caps: AppCapabilities,\n resolver: ReadyResult,\n shutdown: () => Promise<void>,\n args: readonly string[],\n): HttpBunApp | undefined => {\n if (typeof caps.fetch !== 'function') return undefined;\n return { ...resolver, args, serve: createServeForHttp(caps.fetch, shutdown), shutdown };\n};\n\n/** @throws {ZeltLifecycleStateError} */\nconst buildCommandBunApp = (\n caps: AppCapabilities,\n resolver: ReadyResult,\n shutdown: () => Promise<void>,\n stderr: Stderr,\n args: readonly string[],\n): CommandBunApp | undefined => {\n if (typeof caps.hasCommand !== 'function' || typeof caps.getCommands !== 'function')\n return undefined;\n return {\n ...resolver,\n args,\n execCommand: createExecForCommands(caps.hasCommand, caps.getCommands, resolver.get, stderr),\n shutdown,\n };\n};\n\n/** @throws {ZeltLifecycleStateError} */\nconst buildBunApps = (\n caps: AppCapabilities,\n resolver: ReadyResult,\n shutdown: () => Promise<void>,\n stderr: Stderr,\n args: readonly string[],\n): BuildResult => ({\n httpResult: buildHttpBunApp(caps, resolver, shutdown, args),\n commandResult: buildCommandBunApp(caps, resolver, shutdown, stderr, args),\n});\n\nconst mergeBunApps = (\n result: BuildResult,\n resolver: ReadyResult,\n shutdown: () => Promise<void>,\n args: readonly string[],\n): BunApp => {\n const { httpResult, commandResult } = result;\n if (httpResult && commandResult) {\n const fullApp: FullBunApp = { ...httpResult, execCommand: commandResult.execCommand };\n return fullApp;\n }\n if (httpResult) return httpResult;\n if (commandResult) return commandResult;\n return {\n ...resolver,\n args,\n shutdown,\n serve: () => ({ address: { port: 0, hostname: '' }, shutdown }),\n };\n};\n\n/** @throws {ZeltLifecycleStateError} */\nexport function onBun(app: HttpApp & CommandApp, options?: BunAppOptions): Promise<FullBunApp>;\n/** @throws {ZeltLifecycleStateError} */\nexport function onBun(app: HttpApp, options?: BunAppOptions): Promise<HttpBunApp>;\n/** @throws {ZeltLifecycleStateError} */\nexport function onBun(app: CommandApp, options?: BunAppOptions): Promise<CommandBunApp>;\n/** @throws {ZeltLifecycleStateError} */\nexport async function onBun(\n app: HttpApp | CommandApp | (HttpApp & CommandApp),\n options: BunAppOptions = {},\n): Promise<BunApp> {\n app.addFallbackConfig(BunEnvConfig);\n\n const readyOptions: ReadyOptions = { warmup: options.warmup ?? true };\n const resolver = await app.ready(readyOptions);\n\n const caps = extractCapabilities(app);\n const stderr = getStderr();\n const args = getArgs();\n const result = buildBunApps(caps, resolver, app.shutdown, stderr, args);\n\n return mergeBunApps(result, resolver, app.shutdown, args);\n}\n"],"mappings":";;AAGA,IAAa,eADb,CAAC,OAAD,cACkC,UAAU;CAC1C,IAAa,KAAiC;AAC5C,SAAO,IAAI,IAAI;;;;;ACuCnB,MAAM,gBAA4B,EAAE,UAAU,GAAG;AACjD,MAAM,gBAA4B,EAAE,UAAU,GAAG;AAEjD,MAAM,sBACJ,UACA,gBAC+C;AAC/C,SAAQ,YAAyC;EAC/C,MAAM,OAAO,SAAS,QAAQ;EAC9B,MAAM,WAAW,SAAS,YAAY;EAEtC,MAAM,SAAS,IAAI,MAAM;GACvB,OAAO;GACP;GACA;GACD,CAAC;EAEF,MAAM,WAAW,YAA2B;AAC1C,SAAM,OAAO,MAAM;AACnB,SAAM,aAAa;;AAGrB,SAAO;GACL,SAAS;IAAE,MAAM,OAAO,QAAQ;IAAM,UAAU,OAAO,YAAY;IAAU;GAC7E;GACD;;;;AAKL,MAAM,cACJ,cACA,QACwB;CACxB,MAAM,WAAW,IAAI,aAAa;AAClC,QAAO,QAAQ,SAAS,CACrB,WAAW,SAAS,KAAK,CAAC,CAC1B,WAAW,cAAc,CACzB,YAAY,cAAc;;;AAI/B,MAAM,yBACJ,YACA,aACA,KACA,WAC8C;AAC9C,QAAO,OAAO,SAAwC;EACpD,MAAM,cAAc,KAAK;AACzB,MAAI,CAAC,aAAa;AAChB,UAAO,MAAM,yBAAyB;AACtC,UAAO;;AAGT,MAAI,CAAC,WAAW,YAAY,EAAE;AAC5B,UAAO,MAAM,sBAAsB,YAAY,IAAI;AACnD,UAAO;;EAIT,MAAM,eADa,aACY,CAAC,IAAI,YAAY;AAChD,MAAI,CAAC,aACH,QAAO;AAGT,SAAO,WAAW,cAAc,IAAI;;;AAIxC,MAAM,kBAA0B,WAAW,QAAQ;AAEnD,MAAM,gBAAmC,IAAI,KAAK,MAAM,EAAE;AAQ1D,MAAM,uBAAuB,QAC3B;AAOF,MAAM,mBACJ,MACA,UACA,UACA,SAC2B;AAC3B,KAAI,OAAO,KAAK,UAAU,WAAY,QAAO,KAAA;AAC7C,QAAO;EAAE,GAAG;EAAU;EAAM,OAAO,mBAAmB,KAAK,OAAO,SAAS;EAAE;EAAU;;;AAIzF,MAAM,sBACJ,MACA,UACA,UACA,QACA,SAC8B;AAC9B,KAAI,OAAO,KAAK,eAAe,cAAc,OAAO,KAAK,gBAAgB,WACvE,QAAO,KAAA;AACT,QAAO;EACL,GAAG;EACH;EACA,aAAa,sBAAsB,KAAK,YAAY,KAAK,aAAa,SAAS,KAAK,OAAO;EAC3F;EACD;;;AAIH,MAAM,gBACJ,MACA,UACA,UACA,QACA,UACiB;CACjB,YAAY,gBAAgB,MAAM,UAAU,UAAU,KAAK;CAC3D,eAAe,mBAAmB,MAAM,UAAU,UAAU,QAAQ,KAAK;CAC1E;AAED,MAAM,gBACJ,QACA,UACA,UACA,SACW;CACX,MAAM,EAAE,YAAY,kBAAkB;AACtC,KAAI,cAAc,cAEhB,QAAO;EADuB,GAAG;EAAY,aAAa,cAAc;EAC1D;AAEhB,KAAI,WAAY,QAAO;AACvB,KAAI,cAAe,QAAO;AAC1B,QAAO;EACL,GAAG;EACH;EACA;EACA,cAAc;GAAE,SAAS;IAAE,MAAM;IAAG,UAAU;IAAI;GAAE;GAAU;EAC/D;;;AAUH,eAAsB,MACpB,KACA,UAAyB,EAAE,EACV;AACjB,KAAI,kBAAkB,aAAa;CAEnC,MAAM,eAA6B,EAAE,QAAQ,QAAQ,UAAU,MAAM;CACrE,MAAM,WAAW,MAAM,IAAI,MAAM,aAAa;CAE9C,MAAM,OAAO,oBAAoB,IAAI;CACrC,MAAM,SAAS,WAAW;CAC1B,MAAM,OAAO,SAAS;AAGtB,QAAO,aAFQ,aAAa,MAAM,UAAU,IAAI,UAAU,QAAQ,KAExC,EAAE,UAAU,IAAI,UAAU,KAAK"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeltjs/adapter-bun",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
}
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/zeltjs/zelt.git",
|
|
9
|
+
"directory": "packages/adapter-bun"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@zeltjs/core": "0.4.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/bun": "1.2.17"
|
|
28
|
+
},
|
|
29
|
+
"volta": {
|
|
30
|
+
"extends": "../../package.json"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsdown",
|
|
34
|
+
"test": "vitest run",
|
|
35
|
+
"typecheck": "tsc -b"
|
|
36
|
+
}
|
|
37
|
+
}
|
package/README.md
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# @zeltjs/adapter-bun
|
|
2
|
-
|
|
3
|
-
## ⚠️ IMPORTANT NOTICE ⚠️
|
|
4
|
-
|
|
5
|
-
**This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
|
|
6
|
-
|
|
7
|
-
This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
|
|
8
|
-
|
|
9
|
-
## Purpose
|
|
10
|
-
|
|
11
|
-
This package exists to:
|
|
12
|
-
1. Configure OIDC trusted publishing for the package name `@zeltjs/adapter-bun`
|
|
13
|
-
2. Enable secure, token-less publishing from CI/CD workflows
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
15
|
-
|
|
16
|
-
## What is OIDC Trusted Publishing?
|
|
17
|
-
|
|
18
|
-
OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
|
|
19
|
-
|
|
20
|
-
## Setup Instructions
|
|
21
|
-
|
|
22
|
-
To properly configure OIDC trusted publishing for this package:
|
|
23
|
-
|
|
24
|
-
1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
|
|
25
|
-
2. Configure the trusted publisher (e.g., GitHub Actions)
|
|
26
|
-
3. Specify the repository and workflow that should be allowed to publish
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
28
|
-
|
|
29
|
-
## DO NOT USE THIS PACKAGE
|
|
30
|
-
|
|
31
|
-
This package is a placeholder for OIDC configuration only. It:
|
|
32
|
-
- Contains no executable code
|
|
33
|
-
- Provides no functionality
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
36
|
-
|
|
37
|
-
## More Information
|
|
38
|
-
|
|
39
|
-
For more details about npm's trusted publishing feature, see:
|
|
40
|
-
- [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
|
|
41
|
-
- [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
**Maintained for OIDC setup purposes only**
|