effective-rsc 0.1.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/LLMS.md +382 -0
- package/README.md +235 -0
- package/bin/ersc.js +3 -0
- package/dist/application/component.d.ts +15 -0
- package/dist/application/component.js +20 -0
- package/dist/application/component.js.map +1 -0
- package/dist/application/definition.d.ts +31 -0
- package/dist/application/definition.js +57 -0
- package/dist/application/definition.js.map +1 -0
- package/dist/application/ersc-identity.d.ts +25 -0
- package/dist/application/ersc-identity.js +23 -0
- package/dist/application/ersc-identity.js.map +1 -0
- package/dist/application/ersc.d.ts +28 -0
- package/dist/application/ersc.js +72 -0
- package/dist/application/ersc.js.map +1 -0
- package/dist/application/layout.d.ts +18 -0
- package/dist/application/layout.js +17 -0
- package/dist/application/layout.js.map +1 -0
- package/dist/application/loading.d.ts +17 -0
- package/dist/application/loading.js +14 -0
- package/dist/application/loading.js.map +1 -0
- package/dist/application/middleware.d.ts +36 -0
- package/dist/application/middleware.js +46 -0
- package/dist/application/middleware.js.map +1 -0
- package/dist/application/page.d.ts +58 -0
- package/dist/application/page.js +50 -0
- package/dist/application/page.js.map +1 -0
- package/dist/application/render-runtime.d.ts +9 -0
- package/dist/application/render-runtime.js +28 -0
- package/dist/application/render-runtime.js.map +1 -0
- package/dist/application/route-graph.d.ts +22 -0
- package/dist/application/route-graph.js +68 -0
- package/dist/application/route-graph.js.map +1 -0
- package/dist/application/route-path.d.ts +31 -0
- package/dist/application/route-path.js +67 -0
- package/dist/application/route-path.js.map +1 -0
- package/dist/application/routes.d.ts +66 -0
- package/dist/application/routes.js +159 -0
- package/dist/application/routes.js.map +1 -0
- package/dist/application/server-fn.d.ts +30 -0
- package/dist/application/server-fn.js +58 -0
- package/dist/application/server-fn.js.map +1 -0
- package/dist/build/build.d.ts +26 -0
- package/dist/build/build.js +59 -0
- package/dist/build/build.js.map +1 -0
- package/dist/build/compiled-server.d.ts +53 -0
- package/dist/build/compiled-server.js +77 -0
- package/dist/build/compiled-server.js.map +1 -0
- package/dist/build/contract.d.ts +23 -0
- package/dist/build/contract.js +41 -0
- package/dist/build/contract.js.map +1 -0
- package/dist/build/dev-channel.d.ts +20 -0
- package/dist/build/dev-channel.js +71 -0
- package/dist/build/dev-channel.js.map +1 -0
- package/dist/build/dev.d.ts +41 -0
- package/dist/build/dev.js +186 -0
- package/dist/build/dev.js.map +1 -0
- package/dist/build/rsc-entry.d.ts +4 -0
- package/dist/build/rsc-entry.js +17 -0
- package/dist/build/rsc-entry.js.map +1 -0
- package/dist/build/rspack-config.d.ts +17 -0
- package/dist/build/rspack-config.js +259 -0
- package/dist/build/rspack-config.js.map +1 -0
- package/dist/build/rspack.d.ts +45 -0
- package/dist/build/rspack.js +231 -0
- package/dist/build/rspack.js.map +1 -0
- package/dist/build/terminal.d.ts +9 -0
- package/dist/build/terminal.js +17 -0
- package/dist/build/terminal.js.map +1 -0
- package/dist/cli.d.ts +14 -0
- package/dist/cli.js +116 -0
- package/dist/cli.js.map +1 -0
- package/dist/client/application.d.ts +2 -0
- package/dist/client/application.js +73 -0
- package/dist/client/application.js.map +1 -0
- package/dist/client/browser-capabilities.d.ts +9 -0
- package/dist/client/browser-capabilities.js +20 -0
- package/dist/client/browser-capabilities.js.map +1 -0
- package/dist/client/browser-effect-runner.d.ts +13 -0
- package/dist/client/browser-effect-runner.js +13 -0
- package/dist/client/browser-effect-runner.js.map +1 -0
- package/dist/client/browser-renderer.d.ts +70 -0
- package/dist/client/browser-renderer.js +159 -0
- package/dist/client/browser-renderer.js.map +1 -0
- package/dist/client/browser-screen.d.ts +2 -0
- package/dist/client/browser-screen.js +215 -0
- package/dist/client/browser-screen.js.map +1 -0
- package/dist/client/call-server.d.ts +8 -0
- package/dist/client/call-server.js +151 -0
- package/dist/client/call-server.js.map +1 -0
- package/dist/client/client-router.d.ts +6 -0
- package/dist/client/client-router.js +588 -0
- package/dist/client/client-router.js.map +1 -0
- package/dist/client/entry.d.ts +1 -0
- package/dist/client/entry.js +12 -0
- package/dist/client/entry.js.map +1 -0
- package/dist/client/flight-client.d.ts +83 -0
- package/dist/client/flight-client.js +146 -0
- package/dist/client/flight-client.js.map +1 -0
- package/dist/client/initial-flight-stream.d.ts +18 -0
- package/dist/client/initial-flight-stream.js +60 -0
- package/dist/client/initial-flight-stream.js.map +1 -0
- package/dist/client/navigation-api.d.ts +34 -0
- package/dist/client/navigation-api.js +25 -0
- package/dist/client/navigation-api.js.map +1 -0
- package/dist/client/navigation-routing.d.ts +3 -0
- package/dist/client/navigation-routing.js +8 -0
- package/dist/client/navigation-routing.js.map +1 -0
- package/dist/client/react-dom-renderer.d.ts +20 -0
- package/dist/client/react-dom-renderer.js +101 -0
- package/dist/client/react-dom-renderer.js.map +1 -0
- package/dist/client/route-loader.d.ts +81 -0
- package/dist/client/route-loader.js +128 -0
- package/dist/client/route-loader.js.map +1 -0
- package/dist/client/route-refresh.d.ts +31 -0
- package/dist/client/route-refresh.js +132 -0
- package/dist/client/route-refresh.js.map +1 -0
- package/dist/client/route-tree.d.ts +7 -0
- package/dist/client/route-tree.js +34 -0
- package/dist/client/route-tree.js.map +1 -0
- package/dist/dev/channel.d.ts +18 -0
- package/dist/dev/channel.js +30 -0
- package/dist/dev/channel.js.map +1 -0
- package/dist/dev/client.d.ts +3 -0
- package/dist/dev/client.js +132 -0
- package/dist/dev/client.js.map +1 -0
- package/dist/dev/hmr-update.d.ts +20 -0
- package/dist/dev/hmr-update.js +28 -0
- package/dist/dev/hmr-update.js.map +1 -0
- package/dist/dev/panel.d.ts +41 -0
- package/dist/dev/panel.js +9946 -0
- package/dist/dev/panel.js.map +1 -0
- package/dist/dev/runtime-failure.d.ts +11 -0
- package/dist/dev/runtime-failure.js +32 -0
- package/dist/dev/runtime-failure.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/rsc/flight.d.ts +16 -0
- package/dist/rsc/flight.js +6 -0
- package/dist/rsc/flight.js.map +1 -0
- package/dist/rsc/render-route-tree.d.ts +11 -0
- package/dist/rsc/render-route-tree.js +52 -0
- package/dist/rsc/render-route-tree.js.map +1 -0
- package/dist/rsc/route-tree.d.ts +6 -0
- package/dist/rsc/route-tree.js +5 -0
- package/dist/rsc/route-tree.js.map +1 -0
- package/dist/server/application.d.ts +17 -0
- package/dist/server/application.js +178 -0
- package/dist/server/application.js.map +1 -0
- package/dist/server/flight-html-stream.d.ts +19 -0
- package/dist/server/flight-html-stream.js +193 -0
- package/dist/server/flight-html-stream.js.map +1 -0
- package/dist/server/flight-renderer.d.ts +31 -0
- package/dist/server/flight-renderer.js +47 -0
- package/dist/server/flight-renderer.js.map +1 -0
- package/dist/server/html-renderer.d.ts +28 -0
- package/dist/server/html-renderer.js +82 -0
- package/dist/server/html-renderer.js.map +1 -0
- package/dist/server/request-outcome.d.ts +8 -0
- package/dist/server/request-outcome.js +5 -0
- package/dist/server/request-outcome.js.map +1 -0
- package/dist/server/server-config.d.ts +17 -0
- package/dist/server/server-config.js +18 -0
- package/dist/server/server-config.js.map +1 -0
- package/dist/server/server-fn-outcome.d.ts +13 -0
- package/dist/server/server-fn-outcome.js +24 -0
- package/dist/server/server-fn-outcome.js.map +1 -0
- package/dist/server/server-fn-request.d.ts +24 -0
- package/dist/server/server-fn-request.js +160 -0
- package/dist/server/server-fn-request.js.map +1 -0
- package/dist/unsupported.d.ts +0 -0
- package/dist/unsupported.js +5 -0
- package/dist/unsupported.js.map +1 -0
- package/docs/01-getting-started/01_first-application.tsx +26 -0
- package/docs/01-getting-started/20_styling.tsx +6 -0
- package/docs/01-getting-started/index.md +27 -0
- package/docs/01-getting-started/styles.css +1 -0
- package/docs/02-guides/01-server-functions/10_ersc.ts +6 -0
- package/docs/02-guides/01-server-functions/20_follow-author.ts +15 -0
- package/docs/02-guides/01-server-functions/30_follow-author-button.tsx +19 -0
- package/docs/02-guides/01-server-functions/40_application.tsx +30 -0
- package/docs/02-guides/01-server-functions/index.md +19 -0
- package/docs/02-guides/02-services/10_catalog.ts +22 -0
- package/docs/02-guides/02-services/20_application.tsx +44 -0
- package/docs/02-guides/02-services/index.md +17 -0
- package/docs/02-guides/03-routing/10_ersc.ts +6 -0
- package/docs/02-guides/03-routing/10_layouts.tsx +36 -0
- package/docs/02-guides/03-routing/20_pages.tsx +23 -0
- package/docs/02-guides/03-routing/30_routes.tsx +17 -0
- package/docs/02-guides/03-routing/40_application.ts +7 -0
- package/docs/02-guides/03-routing/index.md +22 -0
- package/docs/02-guides/04-middleware/10_auth.ts +27 -0
- package/docs/02-guides/04-middleware/20_account-page.tsx +13 -0
- package/docs/02-guides/04-middleware/30_update-profile.ts +16 -0
- package/docs/02-guides/04-middleware/40_application.tsx +20 -0
- package/docs/02-guides/04-middleware/index.md +25 -0
- package/docs/02-guides/05-http/10_application-layer.tsx +60 -0
- package/docs/02-guides/05-http/index.md +23 -0
- package/docs/02-guides/index.md +11 -0
- package/docs/03-advanced/01-request-runtime-and-lifetimes/index.md +13 -0
- package/docs/03-advanced/02-client-navigation/index.md +61 -0
- package/docs/03-advanced/03-server-function-execution-and-refresh/index.md +17 -0
- package/docs/03-advanced/index.md +11 -0
- package/docs/04-api-reference/01-application/index.md +8 -0
- package/docs/04-api-reference/02-page/index.md +12 -0
- package/docs/04-api-reference/03-layout/index.md +4 -0
- package/docs/04-api-reference/04-loading/index.md +4 -0
- package/docs/04-api-reference/05-component/10_component.tsx +18 -0
- package/docs/04-api-reference/05-component/index.md +10 -0
- package/docs/04-api-reference/06-middleware/index.md +33 -0
- package/docs/04-api-reference/07-routes/index.md +20 -0
- package/docs/04-api-reference/08-server-fn/index.md +43 -0
- package/docs/04-api-reference/index.md +17 -0
- package/docs/environment.d.ts +1 -0
- package/docs/index.md +15 -0
- package/logo-dark.svg +6 -0
- package/logo.svg +6 -0
- package/package.json +87 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application/server-fn.js","sources":["../../src/application/server-fn.ts"],"sourcesContent":["import { Effect, Predicate, Schema } from 'effect';\n\nimport { attachERSCMember, type ERSCIdentity, type ERSCMember } from './ersc-identity';\nimport type { AnyMiddleware } from './middleware';\n\nconst ServerFnInvocationTypeId: unique symbol = Symbol.for('ersc/ServerFnInvocation');\n\nclass ServerFnOperationError extends Schema.TaggedError<ServerFnOperationError>()(\n 'ServerFnOperationError',\n { cause: Schema.Defect() },\n) {}\n\ntype ServerFnInvocation<ApplicationServices> = {\n readonly [ServerFnInvocationTypeId]: {\n readonly effect: Effect.Effect<unknown, ServerFnOperationError, ApplicationServices>;\n readonly identity: ERSCIdentity<ApplicationServices>;\n readonly middleware: ReadonlyArray<AnyMiddleware<ApplicationServices>>;\n };\n};\n\ntype ServerFnInvocationMatch<ApplicationServices> =\n | { readonly _tag: 'Native' }\n | { readonly _tag: 'IdentityMismatch' }\n | {\n readonly _tag: 'Match';\n readonly effect: Effect.Effect<unknown, ServerFnOperationError, ApplicationServices>;\n readonly middleware: ReadonlyArray<AnyMiddleware<ApplicationServices>>;\n };\n\ninterface ServerFunction<Input, Output, ApplicationServices> extends ERSCMember<\n ApplicationServices,\n 'ServerFn'\n> {\n (input: Input): Promise<Output>;\n}\n\ntype ServerFnOptions<InputSchema extends Schema.Constraint, Output, Error, Services> = {\n readonly input: InputSchema;\n readonly handler: (input: InputSchema['Type']) => Effect.Effect<Output, Error, Services>;\n};\n\nexport type ServerFnFactory<ApplicationServices, AvailableServices> = {\n readonly make: <\n InputSchema extends Schema.ConstraintDecoder<unknown, AvailableServices>,\n Output,\n Error,\n >(\n options: ServerFnOptions<InputSchema, Output, Error, AvailableServices>,\n ) => ServerFunction<InputSchema['Encoded'], Output, ApplicationServices>;\n};\n\nconst directInvocationError = () =>\n new TypeError(\n 'An ERSC ServerFn is a framework intrinsic and cannot be invoked directly in the server graph.',\n );\n\nconst isServerFnInvocation = <ApplicationServices>(\n value: unknown,\n): value is ServerFnInvocation<ApplicationServices> =>\n Predicate.hasProperty(value, ServerFnInvocationTypeId);\n\nexport const matchServerFnInvocation = <ApplicationServices>(\n value: unknown,\n identity: ERSCIdentity<ApplicationServices>,\n): ServerFnInvocationMatch<ApplicationServices> => {\n if (!isServerFnInvocation<ApplicationServices>(value)) {\n return { _tag: 'Native' };\n }\n\n // The framework-owned brand proves the state shape; matching the opaque identity proves the\n // application service universe erased by the native React invocation.\n const metadata = value[ServerFnInvocationTypeId];\n if (metadata.identity !== identity) {\n return { _tag: 'IdentityMismatch' };\n }\n\n return { _tag: 'Match', effect: metadata.effect, middleware: metadata.middleware };\n};\n\nexport const makeServerFnFactory = <ApplicationServices, AvailableServices>(\n identity: ERSCIdentity<ApplicationServices>,\n middleware: ReadonlyArray<AnyMiddleware<ApplicationServices>>,\n): ServerFnFactory<ApplicationServices, AvailableServices> => ({\n make: ({ input, handler }) => {\n const decode = Schema.decodeUnknownEffect(input);\n const serverFunction = (untrustedInput: typeof input.Encoded) => {\n const effect = decode(untrustedInput).pipe(\n Effect.flatMap(handler),\n Effect.mapError((cause) => new ServerFnOperationError({ cause })),\n );\n const unavailable = Promise.reject<Effect.Success<typeof effect>>(directInvocationError());\n void unavailable.catch(() => undefined);\n\n return Object.assign(unavailable, {\n [ServerFnInvocationTypeId]: Object.freeze({ effect, identity, middleware }),\n });\n };\n\n return attachERSCMember(serverFunction, identity, 'ServerFn');\n },\n});\n"],"names":["Effect","Predicate","Schema","attachERSCMember","ServerFnInvocationTypeId","Symbol","ServerFnOperationError","directInvocationError","TypeError","isServerFnInvocation","value","matchServerFnInvocation","identity","metadata","makeServerFnFactory","middleware","input","handler","decode","serverFunction","untrustedInput","effect","cause","unavailable","Promise","undefined","Object"],"mappings":";;;;;AAAmD;AAEoC;AAGvF,MAAMI,wBAAwBA,GAAkBC,OAAO,GAAG,CAAC;AAE3D,MAAMC,sBAAsBA,SAASJ,kBAAkB,GACrD,0BACA;IAAE,OAAOA,aAAa;AAAG;AACxB;AAyCH,MAAMK,qBAAqBA,GAAG,IAC5B,IAAIC,UACF;AAGJ,MAAMC,oBAAoBA,GAAG,CAC3BC,QAEAT,qBAAqB,CAACS,OAAON,wBAAwBA;AAEhD,MAAMO,uBAAuBA,GAAG,CACrCD,OACAE;IAEA,IAAI,CAACH,oBAAoBA,CAAsBC,QAAQ;QACrD,OAAO;YAAE,MAAM;QAAS;IAC1B;IAEA,4FAA4F;IAC5F,sEAAsE;IACtE,MAAMG,WAAWH,KAAK,CAACN,wBAAwBA,CAAC;IAChD,IAAIS,SAAS,QAAQ,KAAKD,UAAU;QAClC,OAAO;YAAE,MAAM;QAAmB;IACpC;IAEA,OAAO;QAAE,MAAM;QAAS,QAAQC,SAAS,MAAM;QAAE,YAAYA,SAAS,UAAU;IAAC;AACnF,EAAE;AAEK,MAAMC,mBAAmBA,GAAG,CACjCF,UACAG,aAC6D;QAC7D,MAAM,CAAC,EAAEC,KAAK,EAAEC,OAAO,EAAE;YACvB,MAAMC,SAAShB,0BAA0B,CAACc;YAC1C,MAAMG,iBAAiB,CAACC;gBACtB,MAAMC,SAASH,OAAOE,gBAAgB,IAAI,CACxCpB,cAAc,CAACiB,UACfjB,eAAe,CAAC,CAACsB,QAAU,IAAIhB,sBAAsBA,CAAC;wBAAEgB;oBAAM;gBAEhE,MAAMC,cAAcC,QAAQ,MAAM,CAAgCjB,qBAAqBA;gBACvF,KAAKgB,YAAY,KAAK,CAAC,IAAME;gBAE7B,OAAOC,OAAO,MAAM,CAACH,aAAa;oBAChC,CAACnB,wBAAwBA,CAAC,EAAEsB,OAAO,MAAM,CAAC;wBAAEL;wBAAQT;wBAAUG;oBAAW;gBAC3E;YACF;YAEA,OAAOZ,gBAAgBA,CAACgB,gBAAgBP,UAAU;QACpD;IACF,GAAG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Effect, Path, Schema } from 'effect';
|
|
2
|
+
import { Rspack } from './rspack.js';
|
|
3
|
+
export type BuildOptions = {
|
|
4
|
+
readonly root: string;
|
|
5
|
+
};
|
|
6
|
+
export type ResolveApplicationBuildOptions = BuildOptions & {
|
|
7
|
+
readonly buildModuleUrl?: URL;
|
|
8
|
+
};
|
|
9
|
+
declare const BuildEntryError_base: Schema.Class<BuildEntryError, Schema.TaggedStruct<"BuildEntryError", {
|
|
10
|
+
readonly message: Schema.String;
|
|
11
|
+
readonly cause: Schema.Defect;
|
|
12
|
+
}>, import("effect/Cause").YieldableError>;
|
|
13
|
+
export declare class BuildEntryError extends BuildEntryError_base {
|
|
14
|
+
}
|
|
15
|
+
export declare const resolveApplicationBuild: (args_0: ResolveApplicationBuildOptions) => Effect.Effect<{
|
|
16
|
+
readonly applicationRoot: string;
|
|
17
|
+
readonly entries: {
|
|
18
|
+
application: string;
|
|
19
|
+
client: string;
|
|
20
|
+
rsc: string;
|
|
21
|
+
ssr: string;
|
|
22
|
+
};
|
|
23
|
+
}, BuildEntryError, Path.Path>;
|
|
24
|
+
export declare const build: (options: BuildOptions) => Effect.Effect<void, BuildEntryError | import("./rspack.js").RspackError, Path.Path | Rspack | import("effect/Scope").Scope>;
|
|
25
|
+
export declare const buildApplication: (options: BuildOptions) => Effect.Effect<void, BuildEntryError | import("./rspack.js").RspackError, Path.Path>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Effect, Path, Schema } from "effect";
|
|
2
|
+
import { ApplicationEntryPath } from "./contract.js";
|
|
3
|
+
import { Rspack } from "./rspack.js";
|
|
4
|
+
import { makeRspackBuildConfig } from "./rspack-config.js";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class BuildEntryError extends Schema.TaggedError()('BuildEntryError', {
|
|
15
|
+
message: Schema.String,
|
|
16
|
+
cause: Schema.Defect()
|
|
17
|
+
}) {
|
|
18
|
+
}
|
|
19
|
+
const ClientEntryPath = '../client/entry.js';
|
|
20
|
+
const RscEntryPath = './rsc-entry.js';
|
|
21
|
+
const SsrEntryPath = '../server/html-renderer.js';
|
|
22
|
+
const resolveFrameworkEntry = Effect.fnUntraced(function*(buildModuleUrl, relativePath) {
|
|
23
|
+
const path = yield* Path.Path;
|
|
24
|
+
const buildModulePath = yield* path.fromFileUrl(buildModuleUrl).pipe(Effect.mapError((cause)=>new BuildEntryError({
|
|
25
|
+
message: `Failed to convert the framework build module ${buildModuleUrl.href} to a file path.`,
|
|
26
|
+
cause
|
|
27
|
+
})));
|
|
28
|
+
return path.resolve(path.dirname(buildModulePath), relativePath);
|
|
29
|
+
});
|
|
30
|
+
const resolveApplicationBuild = Effect.fnUntraced(function*({ root, buildModuleUrl = new URL(import.meta.url) }) {
|
|
31
|
+
const path = yield* Path.Path;
|
|
32
|
+
const applicationRoot = path.resolve(root);
|
|
33
|
+
const applicationPath = path.resolve(applicationRoot, ApplicationEntryPath);
|
|
34
|
+
const clientEntry = yield* resolveFrameworkEntry(buildModuleUrl, ClientEntryPath);
|
|
35
|
+
const rscEntry = yield* resolveFrameworkEntry(buildModuleUrl, RscEntryPath);
|
|
36
|
+
const ssrEntry = yield* resolveFrameworkEntry(buildModuleUrl, SsrEntryPath);
|
|
37
|
+
const entries = {
|
|
38
|
+
application: applicationPath,
|
|
39
|
+
client: clientEntry,
|
|
40
|
+
rsc: rscEntry,
|
|
41
|
+
ssr: ssrEntry
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
applicationRoot,
|
|
45
|
+
entries
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
const build = Effect.fn('ersc/rspack/build')(function*(options) {
|
|
49
|
+
const { applicationRoot, entries } = yield* resolveApplicationBuild(options);
|
|
50
|
+
const rspack = yield* Rspack;
|
|
51
|
+
yield* rspack.build(makeRspackBuildConfig(applicationRoot, entries));
|
|
52
|
+
});
|
|
53
|
+
const buildApplication = Effect.fn('ersc/build/buildApplication')(function*(options) {
|
|
54
|
+
yield* build(options).pipe(Effect.provide(Rspack.layer), Effect.scoped);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export { BuildEntryError, build, buildApplication, resolveApplicationBuild };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build/build.js","sources":["../../src/build/build.ts"],"sourcesContent":["import { Effect, Path, Schema } from 'effect';\n\nimport { ApplicationEntryPath } from './contract';\nimport { Rspack } from './rspack';\nimport { makeRspackBuildConfig } from './rspack-config';\n\nexport type BuildOptions = {\n readonly root: string;\n};\n\nexport type ResolveApplicationBuildOptions = BuildOptions & {\n readonly buildModuleUrl?: URL;\n};\n\nexport class BuildEntryError extends Schema.TaggedError<BuildEntryError>()('BuildEntryError', {\n message: Schema.String,\n cause: Schema.Defect(),\n}) {}\n\nconst ClientEntryPath = '../client/entry.js';\nconst RscEntryPath = './rsc-entry.js';\nconst SsrEntryPath = '../server/html-renderer.js';\n\nconst resolveFrameworkEntry = Effect.fnUntraced(function* (\n buildModuleUrl: URL,\n relativePath: string,\n) {\n const path = yield* Path.Path;\n\n const buildModulePath = yield* path.fromFileUrl(buildModuleUrl).pipe(\n Effect.mapError(\n (cause) =>\n new BuildEntryError({\n message: `Failed to convert the framework build module ${buildModuleUrl.href} to a file path.`,\n cause,\n }),\n ),\n );\n\n return path.resolve(path.dirname(buildModulePath), relativePath);\n});\n\nexport const resolveApplicationBuild = Effect.fnUntraced(function* ({\n root,\n buildModuleUrl = new URL(import.meta.url),\n}: ResolveApplicationBuildOptions) {\n const path = yield* Path.Path;\n const applicationRoot = path.resolve(root);\n const applicationPath = path.resolve(applicationRoot, ApplicationEntryPath);\n const clientEntry = yield* resolveFrameworkEntry(buildModuleUrl, ClientEntryPath);\n const rscEntry = yield* resolveFrameworkEntry(buildModuleUrl, RscEntryPath);\n const ssrEntry = yield* resolveFrameworkEntry(buildModuleUrl, SsrEntryPath);\n const entries = {\n application: applicationPath,\n client: clientEntry,\n rsc: rscEntry,\n ssr: ssrEntry,\n };\n\n return { applicationRoot, entries } as const;\n});\n\nexport const build = Effect.fn('ersc/rspack/build')(function* (options: BuildOptions) {\n const { applicationRoot, entries } = yield* resolveApplicationBuild(options);\n const rspack = yield* Rspack;\n\n yield* rspack.build(makeRspackBuildConfig(applicationRoot, entries));\n});\n\nexport const buildApplication = Effect.fn('ersc/build/buildApplication')(function* (\n options: BuildOptions,\n) {\n yield* build(options).pipe(Effect.provide(Rspack.layer), Effect.scoped);\n});\n"],"names":["Effect","Path","Schema","ApplicationEntryPath","Rspack","makeRspackBuildConfig","BuildEntryError","ClientEntryPath","RscEntryPath","SsrEntryPath","resolveFrameworkEntry","buildModuleUrl","relativePath","path","buildModulePath","cause","resolveApplicationBuild","root","URL","applicationRoot","applicationPath","clientEntry","rscEntry","ssrEntry","entries","build","options","rspack","buildApplication"],"mappings":";;;;;;;;;AAA8C;AAEI;AAChB;AACsB;AAUjD,MAAMM,eAAeA,SAASJ,kBAAkB,GAAoB,mBAAmB;IAC5F,SAASA,aAAa;IACtB,OAAOA,aAAa;AACtB;AAAI;AAEJ,MAAMK,eAAeA,GAAG;AACxB,MAAMC,YAAYA,GAAG;AACrB,MAAMC,YAAYA,GAAG;AAErB,MAAMC,qBAAqBA,GAAGV,iBAAiB,CAAC,UAC9CW,cAAmB,EACnBC,YAAoB;IAEpB,MAAMC,OAAO,OAAOZ,SAAS;IAE7B,MAAMa,kBAAkB,OAAOD,KAAK,WAAW,CAACF,gBAAgB,IAAI,CAClEX,eAAe,CACb,CAACe,QACC,IAAIT,eAAeA,CAAC;YAClB,SAAS,CAAC,6CAA6C,EAAEK,eAAe,IAAI,CAAC,gBAAgB,CAAC;YAC9FI;QACF;IAIN,OAAOF,KAAK,OAAO,CAACA,KAAK,OAAO,CAACC,kBAAkBF;AACrD;AAEO,MAAMI,uBAAuBA,GAAGhB,iBAAiB,CAAC,UAAW,EAClEiB,IAAI,EACJN,iBAAiB,IAAIO,IAAI,YAAY,GAAG,CAAC,EACV;IAC/B,MAAML,OAAO,OAAOZ,SAAS;IAC7B,MAAMkB,kBAAkBN,KAAK,OAAO,CAACI;IACrC,MAAMG,kBAAkBP,KAAK,OAAO,CAACM,iBAAiBhB,oBAAoBA;IAC1E,MAAMkB,cAAc,OAAOX,qBAAqBA,CAACC,gBAAgBJ,eAAeA;IAChF,MAAMe,WAAW,OAAOZ,qBAAqBA,CAACC,gBAAgBH,YAAYA;IAC1E,MAAMe,WAAW,OAAOb,qBAAqBA,CAACC,gBAAgBF,YAAYA;IAC1E,MAAMe,UAAU;QACd,aAAaJ;QACb,QAAQC;QACR,KAAKC;QACL,KAAKC;IACP;IAEA,OAAO;QAAEJ;QAAiBK;IAAQ;AACpC,GAAG;AAEI,MAAMC,KAAKA,GAAGzB,SAAS,CAAC,qBAAqB,UAAW0B,OAAqB;IAClF,MAAM,EAAEP,eAAe,EAAEK,OAAO,EAAE,GAAG,OAAOR,uBAAuBA,CAACU;IACpE,MAAMC,SAAS,OAAOvB,MAAMA;IAE5B,OAAOuB,OAAO,KAAK,CAACtB,qBAAqBA,CAACc,iBAAiBK;AAC7D,GAAG;AAEI,MAAMI,gBAAgBA,GAAG5B,SAAS,CAAC,+BAA+B,UACvE0B,OAAqB;IAErB,OAAOD,KAAKA,CAACC,SAAS,IAAI,CAAC1B,cAAc,CAACI,YAAY,GAAGJ,aAAa;AACxE,GAAG"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Effect, FileSystem, Layer, Path, Schema, Types } from 'effect';
|
|
2
|
+
import { HttpRouter } from 'effect/unstable/http';
|
|
3
|
+
import { ServerConfig } from '../server/server-config.js';
|
|
4
|
+
declare const CompiledServerError_base: Schema.Class<CompiledServerError, Schema.TaggedStruct<"CompiledServerError", {
|
|
5
|
+
readonly message: Schema.String;
|
|
6
|
+
readonly cause: Schema.Defect;
|
|
7
|
+
}>, import("effect/Cause").YieldableError>;
|
|
8
|
+
export declare class CompiledServerError extends CompiledServerError_base {
|
|
9
|
+
}
|
|
10
|
+
declare const ServerBundle: Schema.Struct<{
|
|
11
|
+
readonly default: Schema.Struct<{
|
|
12
|
+
readonly entryCssFiles: Schema.$Array<Schema.String>;
|
|
13
|
+
readonly entryJsFiles: Schema.NonEmptyArray<Schema.String>;
|
|
14
|
+
}>;
|
|
15
|
+
readonly HttpLayer: Schema.declare<Layer.Layer<never, Types.unhandled, FileSystem.FileSystem | HttpRouter.HttpRouter | Path.Path | ServerConfig>, Layer.Layer<never, Types.unhandled, FileSystem.FileSystem | HttpRouter.HttpRouter | Path.Path | ServerConfig>>;
|
|
16
|
+
readonly ServerLayer: Schema.declare<Layer.Layer<never, Types.unhandled, ServerConfig>, Layer.Layer<never, Types.unhandled, ServerConfig>>;
|
|
17
|
+
}>;
|
|
18
|
+
export type ServerBundle = typeof ServerBundle.Type;
|
|
19
|
+
export declare const decodeServerBundle: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<{
|
|
20
|
+
readonly default: {
|
|
21
|
+
readonly entryCssFiles: readonly string[];
|
|
22
|
+
readonly entryJsFiles: readonly [string, ...string[]];
|
|
23
|
+
};
|
|
24
|
+
readonly HttpLayer: Layer.Layer<never, Types.unhandled, FileSystem.FileSystem | HttpRouter.HttpRouter | Path.Path | ServerConfig>;
|
|
25
|
+
readonly ServerLayer: Layer.Layer<never, Types.unhandled, ServerConfig>;
|
|
26
|
+
}, Schema.SchemaError, never>;
|
|
27
|
+
type RunnableLayerOptions = {
|
|
28
|
+
readonly bundle: ServerBundle;
|
|
29
|
+
readonly clientAssetsCacheControl: string;
|
|
30
|
+
readonly clientOutputDir: string;
|
|
31
|
+
readonly hostname: string;
|
|
32
|
+
readonly port: number;
|
|
33
|
+
readonly root: string;
|
|
34
|
+
};
|
|
35
|
+
export declare const makeRunnableServerLayer: (options: RunnableLayerOptions) => Effect.Effect<Layer.Layer<never, Types.unhandled, never>, never, Path.Path>;
|
|
36
|
+
export declare const makeRunnableHttpLayer: (options: RunnableLayerOptions) => Effect.Effect<Layer.Layer<never, Types.unhandled, FileSystem.FileSystem | HttpRouter.HttpRouter | Path.Path>, never, Path.Path>;
|
|
37
|
+
export declare const loadServerBundle: (serverBundlePath: string) => Effect.Effect<{
|
|
38
|
+
readonly default: {
|
|
39
|
+
readonly entryCssFiles: readonly string[];
|
|
40
|
+
readonly entryJsFiles: readonly [string, ...string[]];
|
|
41
|
+
};
|
|
42
|
+
readonly HttpLayer: Layer.Layer<never, Types.unhandled, FileSystem.FileSystem | HttpRouter.HttpRouter | Path.Path | ServerConfig>;
|
|
43
|
+
readonly ServerLayer: Layer.Layer<never, Types.unhandled, ServerConfig>;
|
|
44
|
+
}, CompiledServerError, Path.Path>;
|
|
45
|
+
export declare const loadCompiledServer: (root: string) => Effect.Effect<{
|
|
46
|
+
readonly default: {
|
|
47
|
+
readonly entryCssFiles: readonly string[];
|
|
48
|
+
readonly entryJsFiles: readonly [string, ...string[]];
|
|
49
|
+
};
|
|
50
|
+
readonly HttpLayer: Layer.Layer<never, Types.unhandled, FileSystem.FileSystem | HttpRouter.HttpRouter | Path.Path | ServerConfig>;
|
|
51
|
+
readonly ServerLayer: Layer.Layer<never, Types.unhandled, ServerConfig>;
|
|
52
|
+
}, CompiledServerError, Path.Path>;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Effect, Layer, Path, Schema } from "effect";
|
|
2
|
+
import { ServerConfig } from "../server/server-config.js";
|
|
3
|
+
import { BuildServerBundlePath, CompiledServerExportNames, PublicAssetsDir } from "./contract.js";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class CompiledServerError extends Schema.TaggedError()('CompiledServerError', {
|
|
12
|
+
message: Schema.String,
|
|
13
|
+
cause: Schema.Defect()
|
|
14
|
+
}) {
|
|
15
|
+
}
|
|
16
|
+
const CompiledApplication = Schema.Struct({
|
|
17
|
+
entryCssFiles: Schema.Array(Schema.String),
|
|
18
|
+
entryJsFiles: Schema.NonEmptyArray(Schema.String)
|
|
19
|
+
});
|
|
20
|
+
const CompiledServerLayer = Schema.declare((input)=>Layer.isLayer(input), {
|
|
21
|
+
expected: 'the compiled effective-rsc ServerLayer'
|
|
22
|
+
});
|
|
23
|
+
const CompiledHttpLayer = Schema.declare((input)=>Layer.isLayer(input), {
|
|
24
|
+
expected: 'the compiled effective-rsc HttpLayer'
|
|
25
|
+
});
|
|
26
|
+
const ServerBundle = Schema.Struct({
|
|
27
|
+
[CompiledServerExportNames.application]: CompiledApplication,
|
|
28
|
+
[CompiledServerExportNames.httpLayer]: CompiledHttpLayer,
|
|
29
|
+
[CompiledServerExportNames.serverLayer]: CompiledServerLayer
|
|
30
|
+
});
|
|
31
|
+
const decodeServerBundle = Schema.decodeUnknownEffect(ServerBundle);
|
|
32
|
+
const makeServerConfigLayer = Effect.fnUntraced(function*({ bundle, clientAssetsCacheControl, clientOutputDir, hostname, port, root }) {
|
|
33
|
+
const path = yield* Path.Path;
|
|
34
|
+
return Layer.succeed(ServerConfig, ServerConfig.of({
|
|
35
|
+
clientAssetsCacheControl,
|
|
36
|
+
clientAssetsRoot: path.resolve(root, clientOutputDir),
|
|
37
|
+
clientBootstrapScripts: bundle[CompiledServerExportNames.application].entryJsFiles,
|
|
38
|
+
clientStylesheets: bundle[CompiledServerExportNames.application].entryCssFiles,
|
|
39
|
+
hostname,
|
|
40
|
+
port,
|
|
41
|
+
publicAssetsRoot: path.resolve(root, PublicAssetsDir)
|
|
42
|
+
}));
|
|
43
|
+
});
|
|
44
|
+
const makeRunnableServerLayer = Effect.fnUntraced(function*(options) {
|
|
45
|
+
const ServerConfigLayer = yield* makeServerConfigLayer(options);
|
|
46
|
+
return options.bundle[CompiledServerExportNames.serverLayer].pipe(Layer.provide(ServerConfigLayer));
|
|
47
|
+
});
|
|
48
|
+
const makeRunnableHttpLayer = Effect.fnUntraced(function*(options) {
|
|
49
|
+
const ServerConfigLayer = yield* makeServerConfigLayer(options);
|
|
50
|
+
return options.bundle[CompiledServerExportNames.httpLayer].pipe(Layer.provide(ServerConfigLayer));
|
|
51
|
+
});
|
|
52
|
+
const loadServerBundle = Effect.fnUntraced(function*(serverBundlePath) {
|
|
53
|
+
const path = yield* Path.Path;
|
|
54
|
+
const serverBundleUrl = yield* path.toFileUrl(serverBundlePath).pipe(Effect.mapError((cause)=>new CompiledServerError({
|
|
55
|
+
message: `Failed to resolve the server bundle at ${serverBundlePath}.`,
|
|
56
|
+
cause
|
|
57
|
+
})));
|
|
58
|
+
const importedBundle = yield* Effect.tryPromise({
|
|
59
|
+
try: ()=>import(serverBundleUrl.href),
|
|
60
|
+
catch: (cause)=>new CompiledServerError({
|
|
61
|
+
message: `Failed to load the server bundle at ${serverBundlePath}.`,
|
|
62
|
+
cause
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
return yield* decodeServerBundle(importedBundle).pipe(Effect.mapError((cause)=>new CompiledServerError({
|
|
66
|
+
message: `The server bundle at ${serverBundlePath} has an invalid framework contract.`,
|
|
67
|
+
cause
|
|
68
|
+
})));
|
|
69
|
+
});
|
|
70
|
+
const loadCompiledServer = Effect.fnUntraced(function*(root) {
|
|
71
|
+
const path = yield* Path.Path;
|
|
72
|
+
return yield* loadServerBundle(path.resolve(root, BuildServerBundlePath));
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export { CompiledServerError, decodeServerBundle, loadCompiledServer, loadServerBundle, makeRunnableHttpLayer, makeRunnableServerLayer };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=compiled-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build/compiled-server.js","sources":["../../src/build/compiled-server.ts"],"sourcesContent":["import { Effect, FileSystem, Layer, Path, Schema, Types } from 'effect';\nimport { HttpRouter } from 'effect/unstable/http';\n\nimport { ServerConfig } from '../server/server-config';\nimport { BuildServerBundlePath, CompiledServerExportNames, PublicAssetsDir } from './contract';\n\nexport class CompiledServerError extends Schema.TaggedError<CompiledServerError>()(\n 'CompiledServerError',\n {\n message: Schema.String,\n cause: Schema.Defect(),\n },\n) {}\n\nconst CompiledApplication = Schema.Struct({\n entryCssFiles: Schema.Array(Schema.String),\n entryJsFiles: Schema.NonEmptyArray(Schema.String),\n});\n\nconst CompiledServerLayer = Schema.declare(\n (input): input is Layer.Layer<never, Types.unhandled, ServerConfig> => Layer.isLayer(input),\n { expected: 'the compiled effective-rsc ServerLayer' },\n);\n\nconst CompiledHttpLayer = Schema.declare(\n (\n input,\n ): input is Layer.Layer<\n never,\n Types.unhandled,\n FileSystem.FileSystem | HttpRouter.HttpRouter | Path.Path | ServerConfig\n > => Layer.isLayer(input),\n { expected: 'the compiled effective-rsc HttpLayer' },\n);\n\nconst ServerBundle = Schema.Struct({\n [CompiledServerExportNames.application]: CompiledApplication,\n [CompiledServerExportNames.httpLayer]: CompiledHttpLayer,\n [CompiledServerExportNames.serverLayer]: CompiledServerLayer,\n});\n\nexport type ServerBundle = typeof ServerBundle.Type;\n\nexport const decodeServerBundle = Schema.decodeUnknownEffect(ServerBundle);\n\ntype RunnableLayerOptions = {\n readonly bundle: ServerBundle;\n readonly clientAssetsCacheControl: string;\n readonly clientOutputDir: string;\n readonly hostname: string;\n readonly port: number;\n readonly root: string;\n};\n\nconst makeServerConfigLayer = Effect.fnUntraced(function* ({\n bundle,\n clientAssetsCacheControl,\n clientOutputDir,\n hostname,\n port,\n root,\n}: RunnableLayerOptions) {\n const path = yield* Path.Path;\n\n return Layer.succeed(\n ServerConfig,\n ServerConfig.of({\n clientAssetsCacheControl,\n clientAssetsRoot: path.resolve(root, clientOutputDir),\n clientBootstrapScripts: bundle[CompiledServerExportNames.application].entryJsFiles,\n clientStylesheets: bundle[CompiledServerExportNames.application].entryCssFiles,\n hostname,\n port,\n publicAssetsRoot: path.resolve(root, PublicAssetsDir),\n }),\n );\n});\n\nexport const makeRunnableServerLayer = Effect.fnUntraced(function* (options: RunnableLayerOptions) {\n const ServerConfigLayer = yield* makeServerConfigLayer(options);\n\n return options.bundle[CompiledServerExportNames.serverLayer].pipe(\n Layer.provide(ServerConfigLayer),\n );\n});\n\nexport const makeRunnableHttpLayer = Effect.fnUntraced(function* (options: RunnableLayerOptions) {\n const ServerConfigLayer = yield* makeServerConfigLayer(options);\n\n return options.bundle[CompiledServerExportNames.httpLayer].pipe(Layer.provide(ServerConfigLayer));\n});\n\nexport const loadServerBundle = Effect.fnUntraced(function* (serverBundlePath: string) {\n const path = yield* Path.Path;\n const serverBundleUrl = yield* path.toFileUrl(serverBundlePath).pipe(\n Effect.mapError(\n (cause) =>\n new CompiledServerError({\n message: `Failed to resolve the server bundle at ${serverBundlePath}.`,\n cause,\n }),\n ),\n );\n const importedBundle = yield* Effect.tryPromise({\n try: (): Promise<unknown> => import(serverBundleUrl.href),\n catch: (cause) =>\n new CompiledServerError({\n message: `Failed to load the server bundle at ${serverBundlePath}.`,\n cause,\n }),\n });\n\n return yield* decodeServerBundle(importedBundle).pipe(\n Effect.mapError(\n (cause) =>\n new CompiledServerError({\n message: `The server bundle at ${serverBundlePath} has an invalid framework contract.`,\n cause,\n }),\n ),\n );\n});\n\nexport const loadCompiledServer = Effect.fnUntraced(function* (root: string) {\n const path = yield* Path.Path;\n\n return yield* loadServerBundle(path.resolve(root, BuildServerBundlePath));\n});\n"],"names":["Effect","Layer","Path","Schema","ServerConfig","BuildServerBundlePath","CompiledServerExportNames","PublicAssetsDir","CompiledServerError","CompiledApplication","CompiledServerLayer","input","CompiledHttpLayer","ServerBundle","decodeServerBundle","makeServerConfigLayer","bundle","clientAssetsCacheControl","clientOutputDir","hostname","port","root","path","makeRunnableServerLayer","options","ServerConfigLayer","makeRunnableHttpLayer","loadServerBundle","serverBundlePath","serverBundleUrl","cause","importedBundle","loadCompiledServer"],"mappings":";;;;;;;AAAwE;AAGjB;AACwC;AAExF,MAAMQ,mBAAmBA,SAASL,kBAAkB,GACzD,uBACA;IACE,SAASA,aAAa;IACtB,OAAOA,aAAa;AACtB;AACC;AAEH,MAAMM,mBAAmBA,GAAGN,aAAa,CAAC;IACxC,eAAeA,YAAY,CAACA,aAAa;IACzC,cAAcA,oBAAoB,CAACA,aAAa;AAClD;AAEA,MAAMO,mBAAmBA,GAAGP,cAAc,CACxC,CAACQ,QAAsEV,aAAa,CAACU,QACrF;IAAE,UAAU;AAAyC;AAGvD,MAAMC,iBAAiBA,GAAGT,cAAc,CACtC,CACEQ,QAKGV,aAAa,CAACU,QACnB;IAAE,UAAU;AAAuC;AAGrD,MAAME,YAAYA,GAAGV,aAAa,CAAC;IACjC,CAACG,qCAAqC,CAAC,EAAEG,mBAAmBA;IAC5D,CAACH,mCAAmC,CAAC,EAAEM,iBAAiBA;IACxD,CAACN,qCAAqC,CAAC,EAAEI,mBAAmBA;AAC9D;AAIO,MAAMI,kBAAkBA,GAAGX,0BAA0B,CAACU,YAAYA,EAAE;AAW3E,MAAME,qBAAqBA,GAAGf,iBAAiB,CAAC,UAAW,EACzDgB,MAAM,EACNC,wBAAwB,EACxBC,eAAe,EACfC,QAAQ,EACRC,IAAI,EACJC,IAAI,EACiB;IACrB,MAAMC,OAAO,OAAOpB,SAAS;IAE7B,OAAOD,aAAa,CAClBG,YAAYA,EACZA,eAAe,CAAC;QACda;QACA,kBAAkBK,KAAK,OAAO,CAACD,MAAMH;QACrC,wBAAwBF,MAAM,CAACV,qCAAqC,CAAC,CAAC,YAAY;QAClF,mBAAmBU,MAAM,CAACV,qCAAqC,CAAC,CAAC,aAAa;QAC9Ea;QACAC;QACA,kBAAkBE,KAAK,OAAO,CAACD,MAAMd,eAAeA;IACtD;AAEJ;AAEO,MAAMgB,uBAAuBA,GAAGvB,iBAAiB,CAAC,UAAWwB,OAA6B;IAC/F,MAAMC,oBAAoB,OAAOV,qBAAqBA,CAACS;IAEvD,OAAOA,QAAQ,MAAM,CAAClB,qCAAqC,CAAC,CAAC,IAAI,CAC/DL,aAAa,CAACwB;AAElB,GAAG;AAEI,MAAMC,qBAAqBA,GAAG1B,iBAAiB,CAAC,UAAWwB,OAA6B;IAC7F,MAAMC,oBAAoB,OAAOV,qBAAqBA,CAACS;IAEvD,OAAOA,QAAQ,MAAM,CAAClB,mCAAmC,CAAC,CAAC,IAAI,CAACL,aAAa,CAACwB;AAChF,GAAG;AAEI,MAAME,gBAAgBA,GAAG3B,iBAAiB,CAAC,UAAW4B,gBAAwB;IACnF,MAAMN,OAAO,OAAOpB,SAAS;IAC7B,MAAM2B,kBAAkB,OAAOP,KAAK,SAAS,CAACM,kBAAkB,IAAI,CAClE5B,eAAe,CACb,CAAC8B,QACC,IAAItB,mBAAmBA,CAAC;YACtB,SAAS,CAAC,uCAAuC,EAAEoB,iBAAiB,CAAC,CAAC;YACtEE;QACF;IAGN,MAAMC,iBAAiB,OAAO/B,iBAAiB,CAAC;QAC9C,KAAK,IAAwB,MAAM,CAAC6B,gBAAgB,IAAI;QACxD,OAAO,CAACC,QACN,IAAItB,mBAAmBA,CAAC;gBACtB,SAAS,CAAC,oCAAoC,EAAEoB,iBAAiB,CAAC,CAAC;gBACnEE;YACF;IACJ;IAEA,OAAO,OAAOhB,kBAAkBA,CAACiB,gBAAgB,IAAI,CACnD/B,eAAe,CACb,CAAC8B,QACC,IAAItB,mBAAmBA,CAAC;YACtB,SAAS,CAAC,qBAAqB,EAAEoB,iBAAiB,mCAAmC,CAAC;YACtFE;QACF;AAGR,GAAG;AAEI,MAAME,kBAAkBA,GAAGhC,iBAAiB,CAAC,UAAWqB,IAAY;IACzE,MAAMC,OAAO,OAAOpB,SAAS;IAE7B,OAAO,OAAOyB,gBAAgBA,CAACL,KAAK,OAAO,CAACD,MAAMhB,qBAAqBA;AACzE,GAAG"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const ApplicationEntryPath = "src/application.tsx";
|
|
2
|
+
export declare const ApplicationEntrySpecifier = "effective-rsc/application-entry";
|
|
3
|
+
export declare const ErscOutputDir = ".ersc";
|
|
4
|
+
export declare const ClientEntryName = "main";
|
|
5
|
+
export declare const DevOutputDir = ".ersc/dev";
|
|
6
|
+
export declare const PublicAssetsDir = "public";
|
|
7
|
+
export declare const ServerEntryName = "main";
|
|
8
|
+
export type Environment = 'development' | 'production';
|
|
9
|
+
export type EnvironmentConfig = {
|
|
10
|
+
readonly clientAssetsCacheControl: string;
|
|
11
|
+
readonly clientCssFilename: string;
|
|
12
|
+
readonly clientJsFilename: string;
|
|
13
|
+
readonly clientOutputDir: string;
|
|
14
|
+
readonly serverJsFilename: string;
|
|
15
|
+
readonly serverOutputDir: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const EnvironmentConfig: Record<Environment, EnvironmentConfig>;
|
|
18
|
+
export declare const CompiledServerExportNames: {
|
|
19
|
+
readonly application: 'default';
|
|
20
|
+
readonly httpLayer: 'HttpLayer';
|
|
21
|
+
readonly serverLayer: 'ServerLayer';
|
|
22
|
+
};
|
|
23
|
+
export declare const BuildServerBundlePath: string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const ApplicationEntryPath = 'src/application.tsx';
|
|
2
|
+
const ApplicationEntrySpecifier = 'effective-rsc/application-entry';
|
|
3
|
+
const ErscOutputDir = '.ersc';
|
|
4
|
+
const ClientEntryName = 'main';
|
|
5
|
+
const DevOutputDir = `${ErscOutputDir}/dev`;
|
|
6
|
+
const PublicAssetsDir = 'public';
|
|
7
|
+
const ServerEntryName = 'main';
|
|
8
|
+
// A client asset name changes whenever its bytes change, so a client may keep it forever, and
|
|
9
|
+
// `ersc start` resolves the server bundle by path, so that one is named once.
|
|
10
|
+
const production = {
|
|
11
|
+
clientAssetsCacheControl: 'public, max-age=31536000, immutable',
|
|
12
|
+
clientCssFilename: '[name].[contenthash].css',
|
|
13
|
+
clientJsFilename: '[name].[contenthash].js',
|
|
14
|
+
clientOutputDir: `${ErscOutputDir}/client`,
|
|
15
|
+
serverJsFilename: '[name].js',
|
|
16
|
+
serverOutputDir: `${ErscOutputDir}/server`
|
|
17
|
+
};
|
|
18
|
+
// Development keeps its own output directory, stores nothing across rebuilds, and reimports the
|
|
19
|
+
// server bundle every generation, where a repeated specifier would resolve to the module already
|
|
20
|
+
// in the registry.
|
|
21
|
+
const development = {
|
|
22
|
+
...production,
|
|
23
|
+
clientAssetsCacheControl: 'no-store',
|
|
24
|
+
clientOutputDir: `${DevOutputDir}/client`,
|
|
25
|
+
serverJsFilename: '[name].[contenthash].js',
|
|
26
|
+
serverOutputDir: `${DevOutputDir}/server`
|
|
27
|
+
};
|
|
28
|
+
const EnvironmentConfig = {
|
|
29
|
+
development: development,
|
|
30
|
+
production: production
|
|
31
|
+
};
|
|
32
|
+
const CompiledServerExportNames = {
|
|
33
|
+
application: 'default',
|
|
34
|
+
httpLayer: 'HttpLayer',
|
|
35
|
+
serverLayer: 'ServerLayer'
|
|
36
|
+
};
|
|
37
|
+
const BuildServerBundlePath = `${production.serverOutputDir}/${production.serverJsFilename.replace('[name]', ServerEntryName)}`;
|
|
38
|
+
|
|
39
|
+
export { ApplicationEntryPath, ApplicationEntrySpecifier, BuildServerBundlePath, ClientEntryName, CompiledServerExportNames, DevOutputDir, EnvironmentConfig, ErscOutputDir, PublicAssetsDir, ServerEntryName };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build/contract.js","sources":["../../src/build/contract.ts"],"sourcesContent":["export const ApplicationEntryPath = 'src/application.tsx';\nexport const ApplicationEntrySpecifier = 'effective-rsc/application-entry';\n\nexport const ErscOutputDir = '.ersc';\nexport const ClientEntryName = 'main';\nexport const DevOutputDir = `${ErscOutputDir}/dev`;\nexport const PublicAssetsDir = 'public';\nexport const ServerEntryName = 'main';\n\nexport type Environment = 'development' | 'production';\n\nexport type EnvironmentConfig = {\n readonly clientAssetsCacheControl: string;\n readonly clientCssFilename: string;\n readonly clientJsFilename: string;\n readonly clientOutputDir: string;\n readonly serverJsFilename: string;\n readonly serverOutputDir: string;\n};\n\n// A client asset name changes whenever its bytes change, so a client may keep it forever, and\n// `ersc start` resolves the server bundle by path, so that one is named once.\nconst production: EnvironmentConfig = {\n clientAssetsCacheControl: 'public, max-age=31536000, immutable',\n clientCssFilename: '[name].[contenthash].css',\n clientJsFilename: '[name].[contenthash].js',\n clientOutputDir: `${ErscOutputDir}/client`,\n serverJsFilename: '[name].js',\n serverOutputDir: `${ErscOutputDir}/server`,\n};\n\n// Development keeps its own output directory, stores nothing across rebuilds, and reimports the\n// server bundle every generation, where a repeated specifier would resolve to the module already\n// in the registry.\nconst development: EnvironmentConfig = {\n ...production,\n clientAssetsCacheControl: 'no-store',\n clientOutputDir: `${DevOutputDir}/client`,\n serverJsFilename: '[name].[contenthash].js',\n serverOutputDir: `${DevOutputDir}/server`,\n};\n\nexport const EnvironmentConfig: Record<Environment, EnvironmentConfig> = {\n development,\n production,\n};\n\nexport const CompiledServerExportNames: {\n readonly application: 'default';\n readonly httpLayer: 'HttpLayer';\n readonly serverLayer: 'ServerLayer';\n} = {\n application: 'default',\n httpLayer: 'HttpLayer',\n serverLayer: 'ServerLayer',\n};\n\nexport const BuildServerBundlePath = `${production.serverOutputDir}/${production.serverJsFilename.replace('[name]', ServerEntryName)}`;\n"],"names":["ApplicationEntryPath","ApplicationEntrySpecifier","ErscOutputDir","ClientEntryName","DevOutputDir","PublicAssetsDir","ServerEntryName","production","development","EnvironmentConfig","CompiledServerExportNames","BuildServerBundlePath"],"mappings":"AAAO,MAAMA,oBAAoBA,GAAG,sBAAsB;AACnD,MAAMC,yBAAyBA,GAAG,kCAAkC;AAEpE,MAAMC,aAAaA,GAAG,QAAQ;AAC9B,MAAMC,eAAeA,GAAG,OAAO;AAC/B,MAAMC,YAAYA,GAAG,GAAGF,aAAaA,CAAC,IAAI,CAAC,CAAC;AAC5C,MAAMG,eAAeA,GAAG,SAAS;AACjC,MAAMC,eAAeA,GAAG,OAAO;AAatC,8FAA8F;AAC9F,8EAA8E;AAC9E,MAAMC,UAAUA,GAAsB;IACpC,0BAA0B;IAC1B,mBAAmB;IACnB,kBAAkB;IAClB,iBAAiB,GAAGL,aAAaA,CAAC,OAAO,CAAC;IAC1C,kBAAkB;IAClB,iBAAiB,GAAGA,aAAaA,CAAC,OAAO,CAAC;AAC5C;AAEA,gGAAgG;AAChG,iGAAiG;AACjG,mBAAmB;AACnB,MAAMM,WAAWA,GAAsB;IACrC,GAAGD,UAAU;IACb,0BAA0B;IAC1B,iBAAiB,GAAGH,YAAYA,CAAC,OAAO,CAAC;IACzC,kBAAkB;IAClB,iBAAiB,GAAGA,YAAYA,CAAC,OAAO,CAAC;AAC3C;AAEO,MAAMK,iBAAiBA,GAA2C;IACvED,wBAAWA;IACXD,sBAAUA;AACZ,EAAE;AAEK,MAAMG,yBAAyBA,GAIlC;IACF,aAAa;IACb,WAAW;IACX,aAAa;AACf,EAAE;AAEK,MAAMC,qBAAqBA,GAAG,GAAGJ,UAAUA,CAAC,eAAe,CAAC,CAAC,EAAEA,UAAUA,CAAC,gBAAgB,CAAC,OAAO,CAAC,UAAUD,eAAeA,GAAG,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Effect, Stream } from 'effect';
|
|
2
|
+
import { HttpServerRequest, HttpServerResponse } from 'effect/unstable/http';
|
|
3
|
+
export declare const makeDevChannel: Effect.Effect<{
|
|
4
|
+
close: Effect.Effect<void, never, never>;
|
|
5
|
+
httpEffect: Effect.Effect<HttpServerResponse.HttpServerResponse, never, HttpServerRequest.HttpServerRequest | import("effect/Scope").Scope>;
|
|
6
|
+
onCompilationStart: () => void;
|
|
7
|
+
onServerComponentChanges: () => void;
|
|
8
|
+
publishBuildFailure: (diagnostics: string) => Effect.Effect<void, never, never>;
|
|
9
|
+
publishCompilation: (clientHash: string) => Effect.Effect<void, never, never>;
|
|
10
|
+
updates: Stream.Stream<{
|
|
11
|
+
readonly _tag: "ClientUpdate";
|
|
12
|
+
readonly clientHash: string;
|
|
13
|
+
} | {
|
|
14
|
+
readonly _tag: "RscUpdate";
|
|
15
|
+
readonly clientHash: string;
|
|
16
|
+
} | {
|
|
17
|
+
readonly _tag: "BuildFailed";
|
|
18
|
+
readonly diagnostics: string;
|
|
19
|
+
}, never, never>;
|
|
20
|
+
}, never, import("effect/Scope").Scope>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Deferred, Effect, Layer, MutableRef, Stream, SubscriptionRef } from "effect";
|
|
2
|
+
import { HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
|
|
3
|
+
import { RpcSerialization, RpcServer } from "effect/unstable/rpc";
|
|
4
|
+
import { DevRpcs } from "../dev/channel.js";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
const hasSameOrigin = (request)=>{
|
|
15
|
+
const origin = request.headers['origin'];
|
|
16
|
+
if (origin === undefined) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
return new URL(origin).origin === new URL(request.originalUrl).origin;
|
|
21
|
+
} catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const makeDevChannel = Effect.gen(function*() {
|
|
26
|
+
const pending = MutableRef.make({
|
|
27
|
+
_tag: 'ClientUpdate'
|
|
28
|
+
});
|
|
29
|
+
const state = yield* SubscriptionRef.make({
|
|
30
|
+
_tag: 'Initial'
|
|
31
|
+
});
|
|
32
|
+
const shutdownSignal = yield* Deferred.make();
|
|
33
|
+
const updates = SubscriptionRef.changes(state).pipe(Stream.filter((update)=>update._tag !== 'Initial'));
|
|
34
|
+
const onCompilationStart = ()=>{
|
|
35
|
+
MutableRef.set(pending, {
|
|
36
|
+
_tag: 'ClientUpdate'
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const onServerComponentChanges = ()=>{
|
|
40
|
+
MutableRef.set(pending, {
|
|
41
|
+
_tag: 'RscUpdate'
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const publishCompilation = (clientHash)=>SubscriptionRef.set(state, {
|
|
45
|
+
...MutableRef.get(pending),
|
|
46
|
+
clientHash
|
|
47
|
+
});
|
|
48
|
+
const publishBuildFailure = (diagnostics)=>SubscriptionRef.set(state, {
|
|
49
|
+
_tag: 'BuildFailed',
|
|
50
|
+
diagnostics
|
|
51
|
+
});
|
|
52
|
+
const Handlers = DevRpcs.toLayerHandler('ObserveDevUpdates', ()=>updates);
|
|
53
|
+
const rpcHttpEffect = yield* RpcServer.toHttpEffectWebsocket(DevRpcs).pipe(Effect.provide(Layer.merge(Handlers, RpcSerialization.layerJson)));
|
|
54
|
+
const sameOriginRpcHttpEffect = HttpServerRequest.HttpServerRequest.use((request)=>hasSameOrigin(request) ? rpcHttpEffect : Effect.succeed(HttpServerResponse.empty({
|
|
55
|
+
status: 403
|
|
56
|
+
})));
|
|
57
|
+
const httpEffect = Effect.raceFirst(Deferred["await"](shutdownSignal).pipe(Effect.as(HttpServerResponse.empty())), sameOriginRpcHttpEffect);
|
|
58
|
+
return {
|
|
59
|
+
close: Deferred.succeed(shutdownSignal, undefined).pipe(Effect.asVoid),
|
|
60
|
+
httpEffect,
|
|
61
|
+
onCompilationStart,
|
|
62
|
+
onServerComponentChanges,
|
|
63
|
+
publishBuildFailure,
|
|
64
|
+
publishCompilation,
|
|
65
|
+
updates
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export { makeDevChannel };
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=dev-channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build/dev-channel.js","sources":["../../src/build/dev-channel.ts"],"sourcesContent":["import { Deferred, Effect, Layer, MutableRef, Stream, SubscriptionRef } from 'effect';\nimport { HttpServerRequest, HttpServerResponse } from 'effect/unstable/http';\nimport { RpcSerialization, RpcServer } from 'effect/unstable/rpc';\n\nimport { DevRpcs, type DevUpdate } from '../dev/channel';\n\ntype DevChannelState = { readonly _tag: 'Initial' } | DevUpdate;\ntype PendingDevUpdate = { readonly _tag: 'ClientUpdate' } | { readonly _tag: 'RscUpdate' };\n\nconst hasSameOrigin = (request: HttpServerRequest.HttpServerRequest) => {\n const origin = request.headers['origin'];\n if (origin === undefined) {\n return false;\n }\n\n try {\n return new URL(origin).origin === new URL(request.originalUrl).origin;\n } catch {\n return false;\n }\n};\n\nexport const makeDevChannel = Effect.gen(function* () {\n const pending = MutableRef.make<PendingDevUpdate>({ _tag: 'ClientUpdate' });\n const state = yield* SubscriptionRef.make<DevChannelState>({ _tag: 'Initial' });\n const shutdownSignal = yield* Deferred.make<void>();\n const updates = SubscriptionRef.changes(state).pipe(\n Stream.filter((update): update is DevUpdate => update._tag !== 'Initial'),\n );\n const onCompilationStart = () => {\n MutableRef.set(pending, { _tag: 'ClientUpdate' });\n };\n const onServerComponentChanges = () => {\n MutableRef.set(pending, { _tag: 'RscUpdate' });\n };\n const publishCompilation = (clientHash: string) =>\n SubscriptionRef.set(state, { ...MutableRef.get(pending), clientHash });\n const publishBuildFailure = (diagnostics: string) =>\n SubscriptionRef.set(state, { _tag: 'BuildFailed', diagnostics });\n const Handlers = DevRpcs.toLayerHandler('ObserveDevUpdates', () => updates);\n const rpcHttpEffect = yield* RpcServer.toHttpEffectWebsocket(DevRpcs).pipe(\n Effect.provide(Layer.merge(Handlers, RpcSerialization.layerJson)),\n );\n const sameOriginRpcHttpEffect = HttpServerRequest.HttpServerRequest.use((request) =>\n hasSameOrigin(request)\n ? rpcHttpEffect\n : Effect.succeed(HttpServerResponse.empty({ status: 403 })),\n );\n const httpEffect = Effect.raceFirst(\n Deferred.await(shutdownSignal).pipe(Effect.as(HttpServerResponse.empty())),\n sameOriginRpcHttpEffect,\n );\n\n return {\n close: Deferred.succeed(shutdownSignal, undefined).pipe(Effect.asVoid),\n httpEffect,\n onCompilationStart,\n onServerComponentChanges,\n publishBuildFailure,\n publishCompilation,\n updates,\n };\n});\n"],"names":["Deferred","Effect","Layer","MutableRef","Stream","SubscriptionRef","HttpServerRequest","HttpServerResponse","RpcSerialization","RpcServer","DevRpcs","hasSameOrigin","request","origin","undefined","URL","makeDevChannel","pending","state","shutdownSignal","updates","update","onCompilationStart","onServerComponentChanges","publishCompilation","clientHash","publishBuildFailure","diagnostics","Handlers","rpcHttpEffect","sameOriginRpcHttpEffect","httpEffect"],"mappings":";;;;;;;;;AAAsF;AACT;AACX;AAET;AAKzD,MAAMW,aAAaA,GAAG,CAACC;IACrB,MAAMC,SAASD,QAAQ,OAAO,CAAC,SAAS;IACxC,IAAIC,WAAWC,WAAW;QACxB,OAAO;IACT;IAEA,IAAI;QACF,OAAO,IAAIC,IAAIF,QAAQ,MAAM,KAAK,IAAIE,IAAIH,QAAQ,WAAW,EAAE,MAAM;IACvE,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEO,MAAMI,cAAcA,GAAGf,UAAU,CAAC;IACvC,MAAMgB,UAAUd,eAAe,CAAmB;QAAE,MAAM;IAAe;IACzE,MAAMe,QAAQ,OAAOb,oBAAoB,CAAkB;QAAE,MAAM;IAAU;IAC7E,MAAMc,iBAAiB,OAAOnB,aAAa;IAC3C,MAAMoB,UAAUf,uBAAuB,CAACa,OAAO,IAAI,CACjDd,aAAa,CAAC,CAACiB,SAAgCA,OAAO,IAAI,KAAK;IAEjE,MAAMC,qBAAqB;QACzBnB,cAAc,CAACc,SAAS;YAAE,MAAM;QAAe;IACjD;IACA,MAAMM,2BAA2B;QAC/BpB,cAAc,CAACc,SAAS;YAAE,MAAM;QAAY;IAC9C;IACA,MAAMO,qBAAqB,CAACC,aAC1BpB,mBAAmB,CAACa,OAAO;YAAE,GAAGf,cAAc,CAACc,QAAQ;YAAEQ;QAAW;IACtE,MAAMC,sBAAsB,CAACC,cAC3BtB,mBAAmB,CAACa,OAAO;YAAE,MAAM;YAAeS;QAAY;IAChE,MAAMC,WAAWlB,sBAAsB,CAAC,qBAAqB,IAAMU;IACnE,MAAMS,gBAAgB,OAAOpB,+BAA+B,CAACC,OAAOA,EAAE,IAAI,CACxET,cAAc,CAACC,WAAW,CAAC0B,UAAUpB,0BAA0B;IAEjE,MAAMsB,0BAA0BxB,uCAAuC,CAAC,CAACM,UACvED,aAAaA,CAACC,WACViB,gBACA5B,cAAc,CAACM,wBAAwB,CAAC;YAAE,QAAQ;QAAI;IAE5D,MAAMwB,aAAa9B,gBAAgB,CACjCD,iBAAc,CAACmB,gBAAgB,IAAI,CAAClB,SAAS,CAACM,wBAAwB,MACtEuB;IAGF,OAAO;QACL,OAAO9B,gBAAgB,CAACmB,gBAAgBL,WAAW,IAAI,CAACb,aAAa;QACrE8B;QACAT;QACAC;QACAG;QACAF;QACAJ;IACF;AACF,GAAG"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Effect, FileSystem, Path, Schema } from 'effect';
|
|
2
|
+
import { HttpServer } from 'effect/unstable/http';
|
|
3
|
+
import { Rspack, type RspackError, type RspackWatchEvent } from './rspack.js';
|
|
4
|
+
type RspackCompilation = Extract<RspackWatchEvent, {
|
|
5
|
+
readonly _tag: 'Compiled';
|
|
6
|
+
}>;
|
|
7
|
+
declare const DevGenerationError_base: Schema.Class<DevGenerationError, Schema.TaggedStruct<"DevGenerationError", {
|
|
8
|
+
readonly message: Schema.String;
|
|
9
|
+
readonly cause: Schema.Defect;
|
|
10
|
+
}>, import("effect/Cause").YieldableError>;
|
|
11
|
+
export declare class DevGenerationError extends DevGenerationError_base {
|
|
12
|
+
}
|
|
13
|
+
type AcquireDevGenerationOptions = {
|
|
14
|
+
readonly compilation: RspackCompilation;
|
|
15
|
+
readonly hostname: string;
|
|
16
|
+
readonly port: number;
|
|
17
|
+
readonly root: string;
|
|
18
|
+
};
|
|
19
|
+
type DevGenerationOptions = Omit<AcquireDevGenerationOptions, 'compilation'>;
|
|
20
|
+
export type DevApplicationOptions = DevGenerationOptions;
|
|
21
|
+
export declare const acquireDevGeneration: (args_0: AcquireDevGenerationOptions) => Effect.Effect<{
|
|
22
|
+
hash: string;
|
|
23
|
+
httpEffect: Effect.Effect<import("effect/unstable/http/HttpServerResponse").HttpServerResponse, import("effect/unstable/http/HttpServerError").HttpServerError, import("effect/unstable/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>;
|
|
24
|
+
}, import("./compiled-server.js").CompiledServerError | DevGenerationError, FileSystem.FileSystem | Path.Path | import("effect/Scope").Scope>;
|
|
25
|
+
type DevGenerationFailure = Effect.Error<ReturnType<typeof acquireDevGeneration>> | RspackError;
|
|
26
|
+
export declare const makeDevGenerationStore: (options: DevGenerationOptions) => Effect.Effect<{
|
|
27
|
+
httpEffect: Effect.Effect<import("effect/unstable/http/HttpServerResponse").HttpServerResponse, import("effect/unstable/http/HttpServerError").HttpServerError | DevGenerationFailure, import("effect/unstable/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>;
|
|
28
|
+
update: (event: RspackWatchEvent) => Effect.Effect<undefined, import("./compiled-server.js").CompiledServerError | DevGenerationError, FileSystem.FileSystem | Path.Path>;
|
|
29
|
+
}, never, import("effect/Scope").Scope>;
|
|
30
|
+
export declare const makeDevApplication: (args_0: DevGenerationOptions) => Effect.Effect<{
|
|
31
|
+
closeDevChannel: Effect.Effect<void, never, never>;
|
|
32
|
+
httpEffect: Effect.Effect<import("effect/unstable/http/HttpServerResponse").HttpServerResponse, import("./compiled-server.js").CompiledServerError | DevGenerationError | import("effect/unstable/http/HttpServerError").HttpServerError | RspackError, import("effect/unstable/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>;
|
|
33
|
+
watch: Effect.Effect<void, import("./compiled-server.js").CompiledServerError | DevGenerationError | RspackError, FileSystem.FileSystem | Path.Path>;
|
|
34
|
+
}, import("./build.js").BuildEntryError | import("effect/PlatformError").PlatformError, FileSystem.FileSystem | Path.Path | Rspack | import("effect/Scope").Scope>;
|
|
35
|
+
export declare const launchDevApplication: (application: {
|
|
36
|
+
closeDevChannel: Effect.Effect<void, never, never>;
|
|
37
|
+
httpEffect: Effect.Effect<import("effect/unstable/http/HttpServerResponse").HttpServerResponse, import("./compiled-server.js").CompiledServerError | DevGenerationError | import("effect/unstable/http/HttpServerError").HttpServerError | RspackError, import("effect/unstable/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>;
|
|
38
|
+
watch: Effect.Effect<void, import("./compiled-server.js").CompiledServerError | DevGenerationError | RspackError, FileSystem.FileSystem | Path.Path>;
|
|
39
|
+
}) => Effect.Effect<void, import("./compiled-server.js").CompiledServerError | DevGenerationError | RspackError, FileSystem.FileSystem | HttpServer.HttpServer | Path.Path>;
|
|
40
|
+
export declare const devApplication: (options: DevGenerationOptions) => Effect.Effect<void, import("./build.js").BuildEntryError | import("./compiled-server.js").CompiledServerError | DevGenerationError | import("effect/PlatformError").PlatformError | RspackError, FileSystem.FileSystem | HttpServer.HttpServer | Path.Path | import("effect/Scope").Scope>;
|
|
41
|
+
export {};
|