@buildplease/webkit 1.1.0 → 1.1.1
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 +39 -3
- package/dist/src/index.cjs +1 -1
- package/dist/src/index.d.cts +21 -4
- package/dist/src/index.d.ts +21 -4
- package/dist/src/index.js +1 -1
- package/dist/src-node/index.cjs +1 -1
- package/dist/src-node/index.d.cts +22 -1
- package/dist/src-node/index.d.mts +22 -1
- package/dist/src-node/index.mjs +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @buildplease/webkit
|
|
2
2
|
|
|
3
|
-
WebKit
|
|
3
|
+
WebKit provides shared runtime, dependency injection, networking, and application primitives for web applications.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -8,9 +8,9 @@ WebKit is the BuildPlease application kit for browser applications. It builds on
|
|
|
8
8
|
pnpm add @buildplease/webkit
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Configuration
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Define `environment.config.ts` with `@buildplease/webkit/node`:
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { defineConfig, defineEnvironments, defineSource } from '@buildplease/webkit/node';
|
|
@@ -29,6 +29,42 @@ export default defineConfig(environments, {
|
|
|
29
29
|
});
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
## Browser runtime
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { runWebKit } from '@buildplease/webkit';
|
|
36
|
+
|
|
37
|
+
await runWebKit({
|
|
38
|
+
hooks: {
|
|
39
|
+
assemblies: () => [...makeAssemblies()],
|
|
40
|
+
|
|
41
|
+
prepare: ({ scope }) => {
|
|
42
|
+
// optional app preparation
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Node / SSR runtime
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { runWebKit } from '@buildplease/webkit/node';
|
|
52
|
+
|
|
53
|
+
await runWebKit({
|
|
54
|
+
hooks: {
|
|
55
|
+
assemblies: () => [...makeAssemblies()],
|
|
56
|
+
|
|
57
|
+
prepare: ({ scope }) => {
|
|
58
|
+
// optional SSR preparation
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
close: ({ scope }) => {
|
|
62
|
+
// optional cleanup
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
32
68
|
## Features
|
|
33
69
|
|
|
34
70
|
- browser application architecture and dependency injection
|
package/dist/src/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("reflect-metadata");let e=require("@buildplease/core"),t=require("inversify")
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("reflect-metadata");let e=require("@buildplease/core"),t=require("inversify");`${{name:`buildplease`,displayName:`BuildPlease`,scope:`@buildplease`}.name}`;const n={DI:{}},r=e.CoreL10nResource;var i=class{mode;pendingEntries=[];activeEntries=new Set;interruption;isSerialOperationRunning=!1;constructor(e=`parallel`){this.mode=e}execute(t){if(this.interruption)return Promise.reject(new e.CanceledError);let n=this.createEntry(t);return this.mode===`serial`?(this.pendingEntries.push(n),this.startNextSerialOperation()):this.startEntry(n),n.promise}cancelAll(e){let t=this.pendingEntries.splice(0);for(let n of t)this.cancelEntry(n,e);for(let t of this.activeEntries)this.cancelEntry(t,e)}async interrupt(e){if(!this.interruption){let t=Promise.resolve().then(e).finally(()=>{this.interruption===t&&(this.interruption=void 0,this.startNextSerialOperation())});this.interruption=t,this.cancelAll()}await this.interruption}createEntry(e){let t,n;return{operation:e,promise:new Promise((e,r)=>{t=e,n=r}),resolve:e=>t?.(e),reject:e=>n?.(e),canceled:!1,settled:!1}}startEntry(e){if(e.canceled||this.interruption){this.cancelEntry(e);return}this.activeEntries.add(e),this.mode===`serial`&&(this.isSerialOperationRunning=!0),Promise.resolve().then(e.operation).then(t=>{e.canceled||this.resolveEntry(e,t)},t=>{e.canceled||this.rejectEntry(e,t)}).finally(()=>{this.activeEntries.delete(e),this.mode===`serial`&&(this.isSerialOperationRunning=!1,this.startNextSerialOperation())})}startNextSerialOperation(){if(this.mode!==`serial`||this.isSerialOperationRunning||this.interruption)return;let e=this.pendingEntries.shift();e&&this.startEntry(e)}cancelEntry(t,n){t.canceled||(t.canceled=!0,t.settled||this.rejectEntry(t,new e.CanceledError({cause:n})))}resolveEntry(e,t){e.settled||(e.settled=!0,e.resolve(t))}rejectEntry(e,t){e.settled||(e.settled=!0,e.reject(t))}},a=class extends Error{statusCode;code;details;constructor(e){super(e.message),this.name=`HttpError`,this.statusCode=e.statusCode,this.code=e.code,this.details=e.details,e.cause!==void 0&&(this.cause=e.cause)}},o=class{interceptors;constructor(e=[],t){this.interceptors=this.resolveInterceptors(e,t)}async intercept(e){let t=e;for(let e of this.interceptors)t=await e.intercept(t);return t}resolveInterceptors(e,t){let n=new Set,r=[];for(let i of e){if(n.has(i.identity)){t?.(`Duplicate HTTP request interceptor ignored: ${String(i.identity)}`);continue}n.add(i.identity),r.push(i)}return Object.freeze(r)}};const s={credentials:!0,headers:{}};var c=class{requestOptions;interceptorPipeline;asyncQueue;unauthorized;constructor(e={}){this.requestOptions=e.requestOptions??{},this.interceptorPipeline=e.interceptorPipeline??new o,this.asyncQueue=e.asyncQueue??new i,this.unauthorized=e.unauthorized}execute(e,t){return this.asyncQueue.execute(async()=>{let n=await this.makeRequestOptions(e,t);try{let t=this.createClient(n);return await e.execute(t)}catch(e){throw this.handleError(e)}})}handleError(t){return t instanceof a||t instanceof e.NetworkError||t instanceof e.TimeoutError||t instanceof e.CanceledError||t instanceof e.UnknownError?t:new e.UnknownError({message:t instanceof Error?t.message:void 0,cause:t})}async makeRequestOptions(e,t){let n=this.mergeRequestOptions(s,this.requestOptions);return n=await this.interceptorPipeline.intercept(n),n=this.mergeRequestOptions(n,e.options),n=this.mergeRequestOptions(n,t),n}mergeRequestOptions(e,t){return t?{credentials:t.credentials??e.credentials,headers:{...e.headers,...t.headers}}:e}};function l(e,t){return{execute:t=>e(t),options:t}}function u(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function d(e,t){return function(n,r){t(n,r,e)}}function f(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let p=class{endpoint;httpClient;constructor(e,t){this.endpoint=e,this.httpClient=t}async execute(e,t){let n=await this.convertOrThrow(()=>this.endpoint.convertInput(e)),r=this.endpoint.makeRequest(n),i=await this.httpClient.execute(r,t);return await this.convertOrThrow(()=>this.endpoint.convertOutput(i))}async convertOrThrow(t){try{return await t()}catch(t){throw new e.ConversionError({cause:t})}}};p=f([(0,t.injectable)(),d(0,(0,t.unmanaged)()),d(1,(0,t.unmanaged)()),u(`design:paramtypes`,[Object,Object])],p);let m=class extends p{constructor(e,t){super(e,t)}};m=f([(0,t.injectable)(),u(`design:paramtypes`,[Object,Object])],m);let h=class extends p{constructor(e,t){super(e,t)}async execute(t,n){try{return await super.execute(t,n)}catch(t){if(!(t instanceof a))throw t;let n=this.httpClient.unauthorized;throw!n||!n.statusCodes.includes(t.statusCode)?t:n.cancelAll?(await this.httpClient.asyncQueue.interrupt(()=>n.handler.handle(t)),new e.CanceledError({cause:t})):(await n.handler.handle(t),t)}}};h=f([(0,t.injectable)(),u(`design:paramtypes`,[Object,Object])],h);function g(){return[...(0,e.coreAssembly)()]}async function _(t){let n=new e.ScopeController,r=t.hooks?.assemblies?.()??[],i={scope:n};return await n.registerAssemblies([...g(),...r]),await t.hooks?.prepare?.(i),{scope:n,close:async()=>t.hooks?.close?.(i)}}async function v(e){return _(e)}exports.AsyncQueueImpl=i,exports.HttpClient=c,exports.HttpError=a,exports.HttpRequestInterceptorPipeline=o,Object.defineProperty(exports,"PublicRemoteResource",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"RemoteResource",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"SecuredRemoteResource",{enumerable:!0,get:function(){return h}}),exports.WebKitL10nResource=r,exports.WebKitSymbols=n,exports.defineHttpRequest=l,exports.runWebKit=v,Object.keys(e).forEach(function(t){t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
|
package/dist/src/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import { Assembly, AsyncOperation, Identity } from "@buildplease/core";
|
|
2
|
+
import { Assembly, AsyncOperation, Awaitable, Identity, ScopeController } from "@buildplease/core";
|
|
3
3
|
export * from "@buildplease/core";
|
|
4
4
|
//#region src/di/symbols.d.ts
|
|
5
5
|
declare const WebKitSymbols: {
|
|
@@ -530,7 +530,24 @@ declare class SecuredRemoteResource<Input, Output> extends RemoteResource<Input,
|
|
|
530
530
|
execute(input: Input, options?: HttpRequestOptions): Promise<Output>;
|
|
531
531
|
}
|
|
532
532
|
//#endregion
|
|
533
|
-
//#region src/
|
|
534
|
-
|
|
533
|
+
//#region src/runtime/types.d.ts
|
|
534
|
+
interface WebKitRuntimeHookContext {
|
|
535
|
+
readonly scope: ScopeController;
|
|
536
|
+
}
|
|
537
|
+
interface WebKitRuntimeHooks {
|
|
538
|
+
readonly assemblies?: () => Assembly[];
|
|
539
|
+
readonly prepare?: (context: WebKitRuntimeHookContext) => Awaitable<void>;
|
|
540
|
+
readonly close?: (context: WebKitRuntimeHookContext) => Awaitable<void>;
|
|
541
|
+
}
|
|
542
|
+
interface RunWebKitOptions {
|
|
543
|
+
readonly hooks?: WebKitRuntimeHooks;
|
|
544
|
+
}
|
|
545
|
+
interface WebKitRuntime {
|
|
546
|
+
readonly scope: ScopeController;
|
|
547
|
+
close(): Promise<void>;
|
|
548
|
+
}
|
|
549
|
+
//#endregion
|
|
550
|
+
//#region src/runtime/run-webkit.d.ts
|
|
551
|
+
declare function runWebKit(options: RunWebKitOptions): Promise<WebKitRuntime>;
|
|
535
552
|
//#endregion
|
|
536
|
-
export { AsyncQueue, AsyncQueueImpl, AsyncQueueMode, HttpClient, HttpClientOptions, HttpError, HttpErrorOptions, HttpRequest, HttpRequestInterceptor, HttpRequestInterceptorPipeline, HttpRequestOptions, PublicRemoteResource, RemoteEndpoint, RemoteResource, SecuredRemoteResource, TableDataModel, TablePaginationModel, UnauthorizedHandler, UnauthorizedOptions, WebKitL10nResource, WebKitSymbols, defineHttpRequest,
|
|
553
|
+
export { AsyncQueue, AsyncQueueImpl, AsyncQueueMode, HttpClient, HttpClientOptions, HttpError, HttpErrorOptions, HttpRequest, HttpRequestInterceptor, HttpRequestInterceptorPipeline, HttpRequestOptions, PublicRemoteResource, RemoteEndpoint, RemoteResource, RunWebKitOptions, SecuredRemoteResource, TableDataModel, TablePaginationModel, UnauthorizedHandler, UnauthorizedOptions, WebKitL10nResource, WebKitRuntime, WebKitRuntimeHookContext, WebKitRuntimeHooks, WebKitSymbols, defineHttpRequest, runWebKit };
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import { Assembly, AsyncOperation, Identity } from "@buildplease/core";
|
|
2
|
+
import { Assembly, AsyncOperation, Awaitable, Identity, ScopeController } from "@buildplease/core";
|
|
3
3
|
export * from "@buildplease/core";
|
|
4
4
|
//#region src/di/symbols.d.ts
|
|
5
5
|
declare const WebKitSymbols: {
|
|
@@ -530,7 +530,24 @@ declare class SecuredRemoteResource<Input, Output> extends RemoteResource<Input,
|
|
|
530
530
|
execute(input: Input, options?: HttpRequestOptions): Promise<Output>;
|
|
531
531
|
}
|
|
532
532
|
//#endregion
|
|
533
|
-
//#region src/
|
|
534
|
-
|
|
533
|
+
//#region src/runtime/types.d.ts
|
|
534
|
+
interface WebKitRuntimeHookContext {
|
|
535
|
+
readonly scope: ScopeController;
|
|
536
|
+
}
|
|
537
|
+
interface WebKitRuntimeHooks {
|
|
538
|
+
readonly assemblies?: () => Assembly[];
|
|
539
|
+
readonly prepare?: (context: WebKitRuntimeHookContext) => Awaitable<void>;
|
|
540
|
+
readonly close?: (context: WebKitRuntimeHookContext) => Awaitable<void>;
|
|
541
|
+
}
|
|
542
|
+
interface RunWebKitOptions {
|
|
543
|
+
readonly hooks?: WebKitRuntimeHooks;
|
|
544
|
+
}
|
|
545
|
+
interface WebKitRuntime {
|
|
546
|
+
readonly scope: ScopeController;
|
|
547
|
+
close(): Promise<void>;
|
|
548
|
+
}
|
|
549
|
+
//#endregion
|
|
550
|
+
//#region src/runtime/run-webkit.d.ts
|
|
551
|
+
declare function runWebKit(options: RunWebKitOptions): Promise<WebKitRuntime>;
|
|
535
552
|
//#endregion
|
|
536
|
-
export { AsyncQueue, AsyncQueueImpl, AsyncQueueMode, HttpClient, HttpClientOptions, HttpError, HttpErrorOptions, HttpRequest, HttpRequestInterceptor, HttpRequestInterceptorPipeline, HttpRequestOptions, PublicRemoteResource, RemoteEndpoint, RemoteResource, SecuredRemoteResource, TableDataModel, TablePaginationModel, UnauthorizedHandler, UnauthorizedOptions, WebKitL10nResource, WebKitSymbols, defineHttpRequest,
|
|
553
|
+
export { AsyncQueue, AsyncQueueImpl, AsyncQueueMode, HttpClient, HttpClientOptions, HttpError, HttpErrorOptions, HttpRequest, HttpRequestInterceptor, HttpRequestInterceptorPipeline, HttpRequestOptions, PublicRemoteResource, RemoteEndpoint, RemoteResource, RunWebKitOptions, SecuredRemoteResource, TableDataModel, TablePaginationModel, UnauthorizedHandler, UnauthorizedOptions, WebKitL10nResource, WebKitRuntime, WebKitRuntimeHookContext, WebKitRuntimeHooks, WebKitSymbols, defineHttpRequest, runWebKit };
|
package/dist/src/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"reflect-metadata";import{CanceledError as e,ConversionError as t,CoreL10nResource as n,NetworkError as r,
|
|
1
|
+
import"reflect-metadata";import{CanceledError as e,ConversionError as t,CoreL10nResource as n,NetworkError as r,ScopeController as i,TimeoutError as a,UnknownError as o,coreAssembly as s}from"@buildplease/core";import{injectable as c,unmanaged as l}from"inversify";export*from"@buildplease/core";`${{name:`buildplease`,displayName:`BuildPlease`,scope:`@buildplease`}.name}`;const u={DI:{}},d=n;var f=class{mode;pendingEntries=[];activeEntries=new Set;interruption;isSerialOperationRunning=!1;constructor(e=`parallel`){this.mode=e}execute(t){if(this.interruption)return Promise.reject(new e);let n=this.createEntry(t);return this.mode===`serial`?(this.pendingEntries.push(n),this.startNextSerialOperation()):this.startEntry(n),n.promise}cancelAll(e){let t=this.pendingEntries.splice(0);for(let n of t)this.cancelEntry(n,e);for(let t of this.activeEntries)this.cancelEntry(t,e)}async interrupt(e){if(!this.interruption){let t=Promise.resolve().then(e).finally(()=>{this.interruption===t&&(this.interruption=void 0,this.startNextSerialOperation())});this.interruption=t,this.cancelAll()}await this.interruption}createEntry(e){let t,n;return{operation:e,promise:new Promise((e,r)=>{t=e,n=r}),resolve:e=>t?.(e),reject:e=>n?.(e),canceled:!1,settled:!1}}startEntry(e){if(e.canceled||this.interruption){this.cancelEntry(e);return}this.activeEntries.add(e),this.mode===`serial`&&(this.isSerialOperationRunning=!0),Promise.resolve().then(e.operation).then(t=>{e.canceled||this.resolveEntry(e,t)},t=>{e.canceled||this.rejectEntry(e,t)}).finally(()=>{this.activeEntries.delete(e),this.mode===`serial`&&(this.isSerialOperationRunning=!1,this.startNextSerialOperation())})}startNextSerialOperation(){if(this.mode!==`serial`||this.isSerialOperationRunning||this.interruption)return;let e=this.pendingEntries.shift();e&&this.startEntry(e)}cancelEntry(t,n){t.canceled||(t.canceled=!0,t.settled||this.rejectEntry(t,new e({cause:n})))}resolveEntry(e,t){e.settled||(e.settled=!0,e.resolve(t))}rejectEntry(e,t){e.settled||(e.settled=!0,e.reject(t))}},p=class extends Error{statusCode;code;details;constructor(e){super(e.message),this.name=`HttpError`,this.statusCode=e.statusCode,this.code=e.code,this.details=e.details,e.cause!==void 0&&(this.cause=e.cause)}},m=class{interceptors;constructor(e=[],t){this.interceptors=this.resolveInterceptors(e,t)}async intercept(e){let t=e;for(let e of this.interceptors)t=await e.intercept(t);return t}resolveInterceptors(e,t){let n=new Set,r=[];for(let i of e){if(n.has(i.identity)){t?.(`Duplicate HTTP request interceptor ignored: ${String(i.identity)}`);continue}n.add(i.identity),r.push(i)}return Object.freeze(r)}};const h={credentials:!0,headers:{}};var g=class{requestOptions;interceptorPipeline;asyncQueue;unauthorized;constructor(e={}){this.requestOptions=e.requestOptions??{},this.interceptorPipeline=e.interceptorPipeline??new m,this.asyncQueue=e.asyncQueue??new f,this.unauthorized=e.unauthorized}execute(e,t){return this.asyncQueue.execute(async()=>{let n=await this.makeRequestOptions(e,t);try{let t=this.createClient(n);return await e.execute(t)}catch(e){throw this.handleError(e)}})}handleError(t){return t instanceof p||t instanceof r||t instanceof a||t instanceof e||t instanceof o?t:new o({message:t instanceof Error?t.message:void 0,cause:t})}async makeRequestOptions(e,t){let n=this.mergeRequestOptions(h,this.requestOptions);return n=await this.interceptorPipeline.intercept(n),n=this.mergeRequestOptions(n,e.options),n=this.mergeRequestOptions(n,t),n}mergeRequestOptions(e,t){return t?{credentials:t.credentials??e.credentials,headers:{...e.headers,...t.headers}}:e}};function _(e,t){return{execute:t=>e(t),options:t}}function v(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function y(e,t){return function(n,r){t(n,r,e)}}function b(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let x=class{endpoint;httpClient;constructor(e,t){this.endpoint=e,this.httpClient=t}async execute(e,t){let n=await this.convertOrThrow(()=>this.endpoint.convertInput(e)),r=this.endpoint.makeRequest(n),i=await this.httpClient.execute(r,t);return await this.convertOrThrow(()=>this.endpoint.convertOutput(i))}async convertOrThrow(e){try{return await e()}catch(e){throw new t({cause:e})}}};x=b([c(),y(0,l()),y(1,l()),v(`design:paramtypes`,[Object,Object])],x);let S=class extends x{constructor(e,t){super(e,t)}};S=b([c(),v(`design:paramtypes`,[Object,Object])],S);let C=class extends x{constructor(e,t){super(e,t)}async execute(t,n){try{return await super.execute(t,n)}catch(t){if(!(t instanceof p))throw t;let n=this.httpClient.unauthorized;throw!n||!n.statusCodes.includes(t.statusCode)?t:n.cancelAll?(await this.httpClient.asyncQueue.interrupt(()=>n.handler.handle(t)),new e({cause:t})):(await n.handler.handle(t),t)}}};C=b([c(),v(`design:paramtypes`,[Object,Object])],C);function w(){return[...s()]}async function T(e){let t=new i,n=e.hooks?.assemblies?.()??[],r={scope:t};return await t.registerAssemblies([...w(),...n]),await e.hooks?.prepare?.(r),{scope:t,close:async()=>e.hooks?.close?.(r)}}async function E(e){return T(e)}export{f as AsyncQueueImpl,g as HttpClient,p as HttpError,m as HttpRequestInterceptorPipeline,S as PublicRemoteResource,x as RemoteResource,C as SecuredRemoteResource,d as WebKitL10nResource,u as WebKitSymbols,_ as defineHttpRequest,E as runWebKit};
|
package/dist/src-node/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@buildplease/core/node");function
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@buildplease/core/node"),t=require("@buildplease/core");function n(t,n){return(0,e.defineConfig)(t,n)}function r(){return[...(0,t.coreAssembly)()]}async function i(e){let n=new t.ScopeController,i=e.hooks?.assemblies?.()??[],a={scope:n};return await n.registerAssemblies([...r(),...i]),await e.hooks?.prepare?.(a),{scope:n,close:async()=>e.hooks?.close?.(a)}}let a;async function o(){a??=(0,e.loadSelectedEnvironmentConfig)().then(()=>void 0),await a}async function s(e){return await o(),i(e)}exports.defineConfig=n,exports.runWebKit=s,Object.keys(e).forEach(function(t){t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import { ConfigDefinition, EnvironmentRegistry } from "@buildplease/core/node";
|
|
2
|
+
import { Assembly, Awaitable, ScopeController } from "@buildplease/core";
|
|
2
3
|
export * from "@buildplease/core/node";
|
|
3
4
|
//#region src-node/configuration.d.ts
|
|
4
5
|
type WebKitConfigurationInput = Readonly<Record<string, unknown>>;
|
|
5
6
|
declare function defineWebKitConfiguration<const Environments extends EnvironmentRegistry, const Input extends WebKitConfigurationInput>(environments: Environments, input: Input): ConfigDefinition<Environments, Input>;
|
|
6
7
|
//#endregion
|
|
7
|
-
|
|
8
|
+
//#region src/runtime/types.d.ts
|
|
9
|
+
interface WebKitRuntimeHookContext {
|
|
10
|
+
readonly scope: ScopeController;
|
|
11
|
+
}
|
|
12
|
+
interface WebKitRuntimeHooks {
|
|
13
|
+
readonly assemblies?: () => Assembly[];
|
|
14
|
+
readonly prepare?: (context: WebKitRuntimeHookContext) => Awaitable<void>;
|
|
15
|
+
readonly close?: (context: WebKitRuntimeHookContext) => Awaitable<void>;
|
|
16
|
+
}
|
|
17
|
+
interface RunWebKitOptions {
|
|
18
|
+
readonly hooks?: WebKitRuntimeHooks;
|
|
19
|
+
}
|
|
20
|
+
interface WebKitRuntime {
|
|
21
|
+
readonly scope: ScopeController;
|
|
22
|
+
close(): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src-node/runtime/run-webkit.d.ts
|
|
26
|
+
declare function runWebKit(options: RunWebKitOptions): Promise<WebKitRuntime>;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { type RunWebKitOptions, type WebKitRuntime, type WebKitRuntimeHookContext, type WebKitRuntimeHooks, defineWebKitConfiguration as defineConfig, runWebKit };
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import { ConfigDefinition, EnvironmentRegistry } from "@buildplease/core/node";
|
|
2
|
+
import { Assembly, Awaitable, ScopeController } from "@buildplease/core";
|
|
2
3
|
export * from "@buildplease/core/node";
|
|
3
4
|
//#region src-node/configuration.d.ts
|
|
4
5
|
type WebKitConfigurationInput = Readonly<Record<string, unknown>>;
|
|
5
6
|
declare function defineWebKitConfiguration<const Environments extends EnvironmentRegistry, const Input extends WebKitConfigurationInput>(environments: Environments, input: Input): ConfigDefinition<Environments, Input>;
|
|
6
7
|
//#endregion
|
|
7
|
-
|
|
8
|
+
//#region src/runtime/types.d.ts
|
|
9
|
+
interface WebKitRuntimeHookContext {
|
|
10
|
+
readonly scope: ScopeController;
|
|
11
|
+
}
|
|
12
|
+
interface WebKitRuntimeHooks {
|
|
13
|
+
readonly assemblies?: () => Assembly[];
|
|
14
|
+
readonly prepare?: (context: WebKitRuntimeHookContext) => Awaitable<void>;
|
|
15
|
+
readonly close?: (context: WebKitRuntimeHookContext) => Awaitable<void>;
|
|
16
|
+
}
|
|
17
|
+
interface RunWebKitOptions {
|
|
18
|
+
readonly hooks?: WebKitRuntimeHooks;
|
|
19
|
+
}
|
|
20
|
+
interface WebKitRuntime {
|
|
21
|
+
readonly scope: ScopeController;
|
|
22
|
+
close(): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src-node/runtime/run-webkit.d.ts
|
|
26
|
+
declare function runWebKit(options: RunWebKitOptions): Promise<WebKitRuntime>;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { type RunWebKitOptions, type WebKitRuntime, type WebKitRuntimeHookContext, type WebKitRuntimeHooks, defineWebKitConfiguration as defineConfig, runWebKit };
|
package/dist/src-node/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineConfig as e}from"@buildplease/core/node";export*from"@buildplease/core/node";function
|
|
1
|
+
import{defineConfig as e,loadSelectedEnvironmentConfig as t}from"@buildplease/core/node";import{ScopeController as n,coreAssembly as r}from"@buildplease/core";export*from"@buildplease/core/node";function i(t,n){return e(t,n)}function a(){return[...r()]}async function o(e){let t=new n,r=e.hooks?.assemblies?.()??[],i={scope:t};return await t.registerAssemblies([...a(),...r]),await e.hooks?.prepare?.(i),{scope:t,close:async()=>e.hooks?.close?.(i)}}let s;async function c(){s??=t().then(()=>void 0),await s}async function l(e){return await c(),o(e)}export{i as defineConfig,l as runWebKit};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buildplease/webkit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"resources"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@buildplease/core": "1.1.
|
|
40
|
+
"@buildplease/core": "1.1.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@buildplease/identity": "1.0.0"
|