@replayablejs/build 0.1.0-alpha.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Replayable contributors
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/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # @replayablejs/build
2
+
3
+ Run local preview and produce runnable playable variants.
4
+
5
+ Part of [Replayable](https://github.com/replayablejs/replayable) **0.1.0-alpha.0**.
6
+ APIs may change during the alpha series.
7
+
8
+ ## Install
9
+
10
+ ```sh
11
+ pnpm add -D @replayablejs/build@0.1.0-alpha.0
12
+ ```
13
+
14
+ ## Public surface
15
+
16
+ `servePreview`, `buildProject`, `buildVariant` and their option/result types.
17
+
18
+ [Usage and reference](https://github.com/replayablejs/replayable/blob/main/docs/reference/build.md).
19
+ The package manifest defines supported import paths; internal source files are not public APIs.
20
+
21
+ ## Development
22
+
23
+ From the repository root, install with `pnpm install --frozen-lockfile` and build dependencies
24
+ with `pnpm build`. Run `pnpm --filter @replayablejs/build test` for this package's tests.
25
+
26
+ ## License
27
+
28
+ Original code is [MIT licensed](https://github.com/replayablejs/replayable/blob/main/LICENSE). Bundled third-party resources retain
29
+ their accompanying license terms.
@@ -0,0 +1,85 @@
1
+ import { BuildAssetsResult } from "@replayablejs/assets";
2
+ import { PlayableVariant, ReplayableConfigInput } from "@replayablejs/config";
3
+ //#region src/types/build.d.ts
4
+ /** Optional variant and server choices accepted by local development. */
5
+ interface ServePreviewOptions {
6
+ /** Hostname or IP address exposed by the development server. */
7
+ readonly host?: string;
8
+ /** Language selected from the configured playable variants. */
9
+ readonly language?: string;
10
+ /** Opens the playable in the default browser after the server starts. */
11
+ readonly open?: boolean;
12
+ /** Preferred development server port. */
13
+ readonly port?: number;
14
+ /** Root directory of the authored Replayable project. */
15
+ readonly projectRoot: string;
16
+ /** Version selected from the configured playable variants. */
17
+ readonly version?: string;
18
+ }
19
+ /** Running local development server and its selected playable variant. */
20
+ interface ServePreviewResult {
21
+ /** Stops the development server and releases its resources. */
22
+ readonly close: () => Promise<void>;
23
+ /** URLs available only from the current machine. */
24
+ readonly localUrls: readonly string[];
25
+ /** URLs exposed to other devices on the network. */
26
+ readonly networkUrls: readonly string[];
27
+ /** ID of the concrete version, network, and language being served. */
28
+ readonly variantId: string;
29
+ }
30
+ /** Explicit filesystem destinations required to build one concrete variant. */
31
+ interface BuildVariantOptions {
32
+ /** Absolute directory that will contain this runnable playable. */
33
+ readonly outputDirectory: string;
34
+ /** Root directory of the authored Replayable project. */
35
+ readonly projectRoot: string;
36
+ }
37
+ /** Files and metadata produced by one successful playable build. */
38
+ interface BuildVariantResult {
39
+ /** Summary of the assets consumed by the playable bundle. */
40
+ readonly assets: BuildAssetsResult;
41
+ /** Absolute path to the generated playable HTML document. */
42
+ readonly htmlFile: string;
43
+ /** Absolute directory containing the complete runnable playable. */
44
+ readonly outputDirectory: string;
45
+ /** ID of the concrete version, network, and language that was built. */
46
+ readonly variantId: string;
47
+ }
48
+ /** Files and metadata produced by one successful project build. */
49
+ interface BuildProjectResult {
50
+ /** Absolute directory containing every generated playable variant. */
51
+ readonly outputDirectory: string;
52
+ /** Results for the concrete variants in deterministic configuration order. */
53
+ readonly variants: readonly BuildVariantResult[];
54
+ }
55
+ //#endregion
56
+ //#region src/development/serve-preview.d.ts
57
+ /** Builds one preview variant's assets and starts its local Vite server. */
58
+ declare function servePreview(config: ReplayableConfigInput, options: ServePreviewOptions): Promise<ServePreviewResult>;
59
+ //#endregion
60
+ //#region src/production/build-project.d.ts
61
+ /**
62
+ * Builds every concrete variant configured by one Replayable project.
63
+ *
64
+ * Variants are built sequentially because their asset builds share generated
65
+ * source paths. The project output is reset once so variants removed from the
66
+ * configuration cannot leave stale playable directories behind.
67
+ * The first variant is restored afterward as a deterministic baseline. This
68
+ * does not isolate an active preview: build and development share asset paths.
69
+ *
70
+ * @param config - Human-authored or already validated Replayable configuration.
71
+ * @param workingDirectory - Project directory used to resolve authored paths.
72
+ */
73
+ declare function buildProject(config: ReplayableConfigInput, workingDirectory?: string): Promise<BuildProjectResult>;
74
+ //#endregion
75
+ //#region src/production/build-variant.d.ts
76
+ /**
77
+ * Produces one runnable playable from a concrete configuration variant.
78
+ *
79
+ * @param variant - Fully resolved version, network, and language combination.
80
+ * @param options - Explicit project root and variant output directory.
81
+ */
82
+ declare function buildVariant(variant: PlayableVariant, options: BuildVariantOptions): Promise<BuildVariantResult>;
83
+ //#endregion
84
+ export { type BuildProjectResult, type BuildVariantOptions, type BuildVariantResult, type ServePreviewOptions, type ServePreviewResult, buildProject, buildVariant, servePreview };
85
+ //# sourceMappingURL=index.d.mts.map