@wvb/remote-local 0.0.0-next.4b4aa30

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/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ## local v0.0.0-next.4b4aa30
4
+
5
+ This release includes packages: [`@wvb/remote-local`](https://www.npmjs.com/package/@wvb/remote-local/v/0.0.0-next.4b4aa30)
6
+
7
+ - feat(ffi): add ffi package for Android/iOS bindings (#139) (c41b723)
8
+ - feat: redesgin cli commands, add local remote provider, oxc -> biome (#132) (af26b39)
9
+ - update dependencies: @wvb/config@0.1.0-next.4b4aa30
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @wvb/remote-local
@@ -0,0 +1,11 @@
1
+ const require_api = require('../api-oBJy5sKt.cjs');
2
+
3
+ exports.BundleMetadataFileSchema = require_api.BundleMetadataFileSchema;
4
+ exports.DeploymentFileSchema = require_api.DeploymentFileSchema;
5
+ exports.readAllDeployments = require_api.readAllDeployments;
6
+ exports.readBundleMetadata = require_api.readBundleMetadata;
7
+ exports.readBundleStream = require_api.readBundleStream;
8
+ exports.readDeployment = require_api.readDeployment;
9
+ exports.writeBundle = require_api.writeBundle;
10
+ exports.writeBundleMetadata = require_api.writeBundleMetadata;
11
+ exports.writeDeployment = require_api.writeDeployment;
@@ -0,0 +1,90 @@
1
+ import { Buffer } from "node:buffer";
2
+ import { ReadStream } from "node:fs";
3
+ import { z } from "zod";
4
+
5
+ //#region src/api/bundles.d.ts
6
+ interface ReadBundleStreamParams {
7
+ baseDir: string;
8
+ bundle: string;
9
+ version: string;
10
+ }
11
+ declare function readBundleStream({
12
+ baseDir,
13
+ bundle,
14
+ version
15
+ }: ReadBundleStreamParams): ReadStream;
16
+ interface WriteBundleParams {
17
+ baseDir: string;
18
+ bundle: string;
19
+ version: string;
20
+ data: Buffer;
21
+ }
22
+ declare function writeBundle({
23
+ baseDir,
24
+ bundle,
25
+ version,
26
+ data
27
+ }: WriteBundleParams): Promise<void>;
28
+ declare const BundleMetadataFileSchema: z.ZodObject<{
29
+ integrity: z.ZodOptional<z.ZodString>;
30
+ signature: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strip>;
32
+ type BundleMetadataFile = z.infer<typeof BundleMetadataFileSchema>;
33
+ interface ReadBundleMetadataParams {
34
+ baseDir: string;
35
+ bundle: string;
36
+ version: string;
37
+ }
38
+ declare function readBundleMetadata({
39
+ baseDir,
40
+ bundle,
41
+ version
42
+ }: ReadBundleMetadataParams): Promise<BundleMetadataFile | null>;
43
+ interface WriteBundleMetadataParams {
44
+ baseDir: string;
45
+ bundle: string;
46
+ version: string;
47
+ metadata: BundleMetadataFile;
48
+ }
49
+ declare function writeBundleMetadata({
50
+ baseDir,
51
+ bundle,
52
+ version,
53
+ metadata
54
+ }: WriteBundleMetadataParams): Promise<void>;
55
+ //#endregion
56
+ //#region src/api/deployment.d.ts
57
+ declare const DeploymentFileSchema: z.ZodObject<{
58
+ name: z.ZodString;
59
+ version: z.ZodOptional<z.ZodString>;
60
+ channels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
61
+ }, z.core.$strip>;
62
+ type DeploymentFile = z.infer<typeof DeploymentFileSchema>;
63
+ interface ReadDeploymentParams {
64
+ bundle: string;
65
+ baseDir: string;
66
+ }
67
+ declare function readDeployment({
68
+ bundle,
69
+ baseDir
70
+ }: ReadDeploymentParams): Promise<DeploymentFile | null>;
71
+ interface ReadAllDeploymentsParams {
72
+ baseDir: string;
73
+ }
74
+ declare function readAllDeployments({
75
+ baseDir
76
+ }: ReadAllDeploymentsParams): Promise<DeploymentFile[]>;
77
+ interface WriteDeploymentParams {
78
+ baseDir: string;
79
+ bundle: string;
80
+ version: string;
81
+ channel?: string;
82
+ }
83
+ declare function writeDeployment({
84
+ baseDir,
85
+ bundle,
86
+ version,
87
+ channel
88
+ }: WriteDeploymentParams): Promise<void>;
89
+ //#endregion
90
+ export { type BundleMetadataFile, BundleMetadataFileSchema, type DeploymentFile, DeploymentFileSchema, readAllDeployments, readBundleMetadata, readBundleStream, readDeployment, writeBundle, writeBundleMetadata, writeDeployment };
@@ -0,0 +1,90 @@
1
+ import { ReadStream } from "node:fs";
2
+ import { z } from "zod";
3
+ import { Buffer } from "node:buffer";
4
+
5
+ //#region src/api/bundles.d.ts
6
+ interface ReadBundleStreamParams {
7
+ baseDir: string;
8
+ bundle: string;
9
+ version: string;
10
+ }
11
+ declare function readBundleStream({
12
+ baseDir,
13
+ bundle,
14
+ version
15
+ }: ReadBundleStreamParams): ReadStream;
16
+ interface WriteBundleParams {
17
+ baseDir: string;
18
+ bundle: string;
19
+ version: string;
20
+ data: Buffer;
21
+ }
22
+ declare function writeBundle({
23
+ baseDir,
24
+ bundle,
25
+ version,
26
+ data
27
+ }: WriteBundleParams): Promise<void>;
28
+ declare const BundleMetadataFileSchema: z.ZodObject<{
29
+ integrity: z.ZodOptional<z.ZodString>;
30
+ signature: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strip>;
32
+ type BundleMetadataFile = z.infer<typeof BundleMetadataFileSchema>;
33
+ interface ReadBundleMetadataParams {
34
+ baseDir: string;
35
+ bundle: string;
36
+ version: string;
37
+ }
38
+ declare function readBundleMetadata({
39
+ baseDir,
40
+ bundle,
41
+ version
42
+ }: ReadBundleMetadataParams): Promise<BundleMetadataFile | null>;
43
+ interface WriteBundleMetadataParams {
44
+ baseDir: string;
45
+ bundle: string;
46
+ version: string;
47
+ metadata: BundleMetadataFile;
48
+ }
49
+ declare function writeBundleMetadata({
50
+ baseDir,
51
+ bundle,
52
+ version,
53
+ metadata
54
+ }: WriteBundleMetadataParams): Promise<void>;
55
+ //#endregion
56
+ //#region src/api/deployment.d.ts
57
+ declare const DeploymentFileSchema: z.ZodObject<{
58
+ name: z.ZodString;
59
+ version: z.ZodOptional<z.ZodString>;
60
+ channels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
61
+ }, z.core.$strip>;
62
+ type DeploymentFile = z.infer<typeof DeploymentFileSchema>;
63
+ interface ReadDeploymentParams {
64
+ bundle: string;
65
+ baseDir: string;
66
+ }
67
+ declare function readDeployment({
68
+ bundle,
69
+ baseDir
70
+ }: ReadDeploymentParams): Promise<DeploymentFile | null>;
71
+ interface ReadAllDeploymentsParams {
72
+ baseDir: string;
73
+ }
74
+ declare function readAllDeployments({
75
+ baseDir
76
+ }: ReadAllDeploymentsParams): Promise<DeploymentFile[]>;
77
+ interface WriteDeploymentParams {
78
+ baseDir: string;
79
+ bundle: string;
80
+ version: string;
81
+ channel?: string;
82
+ }
83
+ declare function writeDeployment({
84
+ baseDir,
85
+ bundle,
86
+ version,
87
+ channel
88
+ }: WriteDeploymentParams): Promise<void>;
89
+ //#endregion
90
+ export { type BundleMetadataFile, BundleMetadataFileSchema, type DeploymentFile, DeploymentFileSchema, readAllDeployments, readBundleMetadata, readBundleStream, readDeployment, writeBundle, writeBundleMetadata, writeDeployment };
@@ -0,0 +1,3 @@
1
+ import { a as BundleMetadataFileSchema, c as writeBundle, i as writeDeployment, l as writeBundleMetadata, n as readAllDeployments, o as readBundleMetadata, r as readDeployment, s as readBundleStream, t as DeploymentFileSchema } from "../api-8MXKpsHj.mjs";
2
+
3
+ export { BundleMetadataFileSchema, DeploymentFileSchema, readAllDeployments, readBundleMetadata, readBundleStream, readDeployment, writeBundle, writeBundleMetadata, writeDeployment };
@@ -0,0 +1,101 @@
1
+ import path from "node:path";
2
+ import { createReadStream } from "node:fs";
3
+ import fs from "node:fs/promises";
4
+ import { z } from "zod";
5
+ import { glob } from "tinyglobby";
6
+
7
+ //#region src/utils.ts
8
+ function normalizeBundleName(file) {
9
+ return file.replace(/([\\/\s])/g, "-").replace(/\.wvb$/, "");
10
+ }
11
+
12
+ //#endregion
13
+ //#region src/api/bundles.ts
14
+ function readBundleStream({ baseDir, bundle, version }) {
15
+ return createReadStream(getBundleFilePath(baseDir, bundle, version));
16
+ }
17
+ async function writeBundle({ baseDir, bundle, version, data }) {
18
+ const filePath = getBundleFilePath(baseDir, bundle, version);
19
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
20
+ await fs.writeFile(filePath, data);
21
+ }
22
+ const BundleMetadataFileSchema = z.object({
23
+ integrity: z.string().optional(),
24
+ signature: z.string().optional()
25
+ });
26
+ async function readBundleMetadata({ baseDir, bundle, version }) {
27
+ const filePath = getBundleMetadataFilePath(baseDir, bundle, version);
28
+ try {
29
+ const raw = await fs.readFile(filePath, "utf8");
30
+ return BundleMetadataFileSchema.parse(JSON.parse(raw));
31
+ } catch {
32
+ return null;
33
+ }
34
+ }
35
+ async function writeBundleMetadata({ baseDir, bundle, version, metadata }) {
36
+ const filePath = getBundleMetadataFilePath(baseDir, bundle, version);
37
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
38
+ await fs.writeFile(filePath, JSON.stringify(metadata, null, 2), "utf8");
39
+ }
40
+ function getBundleFilePath(baseDir, bundle, version) {
41
+ const bundleName = normalizeBundleName(bundle);
42
+ return path.join(baseDir, "bundles", bundleName, `${bundleName}_${version}.wvb`);
43
+ }
44
+ function getBundleMetadataFilePath(baseDir, bundle, version) {
45
+ const bundleName = normalizeBundleName(bundle);
46
+ return path.join(baseDir, "bundles", bundleName, `${bundleName}_${version}.json`);
47
+ }
48
+
49
+ //#endregion
50
+ //#region src/api/deployment.ts
51
+ const DeploymentFileSchema = z.object({
52
+ name: z.string().describe("The name of the bundle"),
53
+ version: z.string().describe("Current deployed version of the bundle").optional(),
54
+ channels: z.record(z.string(), z.string()).optional().describe("Version deployed in each channel")
55
+ });
56
+ async function readDeployment({ bundle, baseDir }) {
57
+ const filePath = getDeploymentFilePath(baseDir, bundle);
58
+ try {
59
+ const raw = await fs.readFile(filePath, "utf8");
60
+ return DeploymentFileSchema.parse(JSON.parse(raw));
61
+ } catch {
62
+ return null;
63
+ }
64
+ }
65
+ async function readAllDeployments({ baseDir }) {
66
+ const filePaths = await glob("*/deployment.json", {
67
+ cwd: path.join(baseDir, "bundles"),
68
+ absolute: true,
69
+ onlyFiles: true
70
+ });
71
+ const deployments = [];
72
+ for (const file of filePaths) try {
73
+ const raw = await fs.readFile(file, "utf8");
74
+ const parsed = DeploymentFileSchema.parse(JSON.parse(raw));
75
+ deployments.push(parsed);
76
+ } catch {}
77
+ return deployments;
78
+ }
79
+ async function writeDeployment({ baseDir, bundle, version, channel }) {
80
+ const deployment = await readDeployment({
81
+ baseDir,
82
+ bundle
83
+ }) ?? {
84
+ name: bundle,
85
+ version: void 0,
86
+ channels: {}
87
+ };
88
+ if (channel != null) {
89
+ deployment.channels ??= {};
90
+ deployment.channels[channel] = version;
91
+ } else deployment.version = version;
92
+ const filePath = getDeploymentFilePath(baseDir, bundle);
93
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
94
+ await fs.writeFile(filePath, JSON.stringify(deployment, null, 2), "utf8");
95
+ }
96
+ function getDeploymentFilePath(baseDir, bundle) {
97
+ return path.join(baseDir, "bundles", `${normalizeBundleName(bundle)}`, "deployment.json");
98
+ }
99
+
100
+ //#endregion
101
+ export { BundleMetadataFileSchema as a, writeBundle as c, writeDeployment as i, writeBundleMetadata as l, readAllDeployments as n, readBundleMetadata as o, readDeployment as r, readBundleStream as s, DeploymentFileSchema as t };
@@ -0,0 +1,189 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+ let node_path = require("node:path");
29
+ node_path = __toESM(node_path);
30
+ let node_fs = require("node:fs");
31
+ let node_fs_promises = require("node:fs/promises");
32
+ node_fs_promises = __toESM(node_fs_promises);
33
+ let zod = require("zod");
34
+ let tinyglobby = require("tinyglobby");
35
+
36
+ //#region src/utils.ts
37
+ function normalizeBundleName(file) {
38
+ return file.replace(/([\\/\s])/g, "-").replace(/\.wvb$/, "");
39
+ }
40
+
41
+ //#endregion
42
+ //#region src/api/bundles.ts
43
+ function readBundleStream({ baseDir, bundle, version }) {
44
+ return (0, node_fs.createReadStream)(getBundleFilePath(baseDir, bundle, version));
45
+ }
46
+ async function writeBundle({ baseDir, bundle, version, data }) {
47
+ const filePath = getBundleFilePath(baseDir, bundle, version);
48
+ await node_fs_promises.default.mkdir(node_path.default.dirname(filePath), { recursive: true });
49
+ await node_fs_promises.default.writeFile(filePath, data);
50
+ }
51
+ const BundleMetadataFileSchema = zod.z.object({
52
+ integrity: zod.z.string().optional(),
53
+ signature: zod.z.string().optional()
54
+ });
55
+ async function readBundleMetadata({ baseDir, bundle, version }) {
56
+ const filePath = getBundleMetadataFilePath(baseDir, bundle, version);
57
+ try {
58
+ const raw = await node_fs_promises.default.readFile(filePath, "utf8");
59
+ return BundleMetadataFileSchema.parse(JSON.parse(raw));
60
+ } catch {
61
+ return null;
62
+ }
63
+ }
64
+ async function writeBundleMetadata({ baseDir, bundle, version, metadata }) {
65
+ const filePath = getBundleMetadataFilePath(baseDir, bundle, version);
66
+ await node_fs_promises.default.mkdir(node_path.default.dirname(filePath), { recursive: true });
67
+ await node_fs_promises.default.writeFile(filePath, JSON.stringify(metadata, null, 2), "utf8");
68
+ }
69
+ function getBundleFilePath(baseDir, bundle, version) {
70
+ const bundleName = normalizeBundleName(bundle);
71
+ return node_path.default.join(baseDir, "bundles", bundleName, `${bundleName}_${version}.wvb`);
72
+ }
73
+ function getBundleMetadataFilePath(baseDir, bundle, version) {
74
+ const bundleName = normalizeBundleName(bundle);
75
+ return node_path.default.join(baseDir, "bundles", bundleName, `${bundleName}_${version}.json`);
76
+ }
77
+
78
+ //#endregion
79
+ //#region src/api/deployment.ts
80
+ const DeploymentFileSchema = zod.z.object({
81
+ name: zod.z.string().describe("The name of the bundle"),
82
+ version: zod.z.string().describe("Current deployed version of the bundle").optional(),
83
+ channels: zod.z.record(zod.z.string(), zod.z.string()).optional().describe("Version deployed in each channel")
84
+ });
85
+ async function readDeployment({ bundle, baseDir }) {
86
+ const filePath = getDeploymentFilePath(baseDir, bundle);
87
+ try {
88
+ const raw = await node_fs_promises.default.readFile(filePath, "utf8");
89
+ return DeploymentFileSchema.parse(JSON.parse(raw));
90
+ } catch {
91
+ return null;
92
+ }
93
+ }
94
+ async function readAllDeployments({ baseDir }) {
95
+ const filePaths = await (0, tinyglobby.glob)("*/deployment.json", {
96
+ cwd: node_path.default.join(baseDir, "bundles"),
97
+ absolute: true,
98
+ onlyFiles: true
99
+ });
100
+ const deployments = [];
101
+ for (const file of filePaths) try {
102
+ const raw = await node_fs_promises.default.readFile(file, "utf8");
103
+ const parsed = DeploymentFileSchema.parse(JSON.parse(raw));
104
+ deployments.push(parsed);
105
+ } catch {}
106
+ return deployments;
107
+ }
108
+ async function writeDeployment({ baseDir, bundle, version, channel }) {
109
+ const deployment = await readDeployment({
110
+ baseDir,
111
+ bundle
112
+ }) ?? {
113
+ name: bundle,
114
+ version: void 0,
115
+ channels: {}
116
+ };
117
+ if (channel != null) {
118
+ deployment.channels ??= {};
119
+ deployment.channels[channel] = version;
120
+ } else deployment.version = version;
121
+ const filePath = getDeploymentFilePath(baseDir, bundle);
122
+ await node_fs_promises.default.mkdir(node_path.default.dirname(filePath), { recursive: true });
123
+ await node_fs_promises.default.writeFile(filePath, JSON.stringify(deployment, null, 2), "utf8");
124
+ }
125
+ function getDeploymentFilePath(baseDir, bundle) {
126
+ return node_path.default.join(baseDir, "bundles", `${normalizeBundleName(bundle)}`, "deployment.json");
127
+ }
128
+
129
+ //#endregion
130
+ Object.defineProperty(exports, 'BundleMetadataFileSchema', {
131
+ enumerable: true,
132
+ get: function () {
133
+ return BundleMetadataFileSchema;
134
+ }
135
+ });
136
+ Object.defineProperty(exports, 'DeploymentFileSchema', {
137
+ enumerable: true,
138
+ get: function () {
139
+ return DeploymentFileSchema;
140
+ }
141
+ });
142
+ Object.defineProperty(exports, '__toESM', {
143
+ enumerable: true,
144
+ get: function () {
145
+ return __toESM;
146
+ }
147
+ });
148
+ Object.defineProperty(exports, 'readAllDeployments', {
149
+ enumerable: true,
150
+ get: function () {
151
+ return readAllDeployments;
152
+ }
153
+ });
154
+ Object.defineProperty(exports, 'readBundleMetadata', {
155
+ enumerable: true,
156
+ get: function () {
157
+ return readBundleMetadata;
158
+ }
159
+ });
160
+ Object.defineProperty(exports, 'readBundleStream', {
161
+ enumerable: true,
162
+ get: function () {
163
+ return readBundleStream;
164
+ }
165
+ });
166
+ Object.defineProperty(exports, 'readDeployment', {
167
+ enumerable: true,
168
+ get: function () {
169
+ return readDeployment;
170
+ }
171
+ });
172
+ Object.defineProperty(exports, 'writeBundle', {
173
+ enumerable: true,
174
+ get: function () {
175
+ return writeBundle;
176
+ }
177
+ });
178
+ Object.defineProperty(exports, 'writeBundleMetadata', {
179
+ enumerable: true,
180
+ get: function () {
181
+ return writeBundleMetadata;
182
+ }
183
+ });
184
+ Object.defineProperty(exports, 'writeDeployment', {
185
+ enumerable: true,
186
+ get: function () {
187
+ return writeDeployment;
188
+ }
189
+ });
package/dist/index.cjs ADDED
@@ -0,0 +1,69 @@
1
+ const require_api = require('./api-oBJy5sKt.cjs');
2
+ let node_os = require("node:os");
3
+ node_os = require_api.__toESM(node_os);
4
+ let node_path = require("node:path");
5
+ node_path = require_api.__toESM(node_path);
6
+
7
+ //#region src/deployer.ts
8
+ var LocalRemoteDeployer = class {
9
+ constructor(config) {
10
+ this.config = config;
11
+ }
12
+ async deploy(params) {
13
+ const { baseDir } = this.config;
14
+ const { bundleName, version, channel } = params;
15
+ await require_api.writeDeployment({
16
+ baseDir,
17
+ bundle: bundleName,
18
+ version,
19
+ channel
20
+ });
21
+ }
22
+ };
23
+ function localRemoteDeployer(config) {
24
+ return new LocalRemoteDeployer(config);
25
+ }
26
+
27
+ //#endregion
28
+ //#region src/uploader.ts
29
+ var LocalUploaderImpl = class {
30
+ constructor(config) {
31
+ this.config = config;
32
+ }
33
+ async upload(params) {
34
+ const { baseDir } = this.config;
35
+ const { bundle, bundleName, version, integrity, signature } = params;
36
+ const metadata = {
37
+ integrity,
38
+ signature
39
+ };
40
+ await require_api.writeBundle({
41
+ baseDir,
42
+ bundle: bundleName,
43
+ version,
44
+ data: bundle
45
+ });
46
+ await require_api.writeBundleMetadata({
47
+ baseDir,
48
+ bundle: bundleName,
49
+ version,
50
+ metadata
51
+ });
52
+ }
53
+ };
54
+ function localRemoteUploader(config) {
55
+ return new LocalUploaderImpl(config);
56
+ }
57
+
58
+ //#endregion
59
+ //#region src/config.ts
60
+ function localRemote(config) {
61
+ const resolvedConfig = { baseDir: config.baseDir ?? node_path.default.join(node_os.homedir(), ".wvb", "local") };
62
+ return {
63
+ uploader: localRemoteUploader(resolvedConfig),
64
+ deployer: localRemoteDeployer(resolvedConfig)
65
+ };
66
+ }
67
+
68
+ //#endregion
69
+ exports.localRemote = localRemote;
@@ -0,0 +1,16 @@
1
+ import { BaseRemoteDeployer, BaseRemoteUploader } from "@wvb/config/remote";
2
+
3
+ //#region src/config.d.ts
4
+ interface LocalRemoteConfig {
5
+ /**
6
+ * @default "~/.wvb/local"
7
+ */
8
+ baseDir?: string;
9
+ }
10
+ interface LocalRemote {
11
+ uploader: BaseRemoteUploader;
12
+ deployer: BaseRemoteDeployer;
13
+ }
14
+ declare function localRemote(config: LocalRemoteConfig): LocalRemote;
15
+ //#endregion
16
+ export { type LocalRemote, type LocalRemoteConfig, localRemote };
@@ -0,0 +1,16 @@
1
+ import { BaseRemoteDeployer, BaseRemoteUploader } from "@wvb/config/remote";
2
+
3
+ //#region src/config.d.ts
4
+ interface LocalRemoteConfig {
5
+ /**
6
+ * @default "~/.wvb/local"
7
+ */
8
+ baseDir?: string;
9
+ }
10
+ interface LocalRemote {
11
+ uploader: BaseRemoteUploader;
12
+ deployer: BaseRemoteDeployer;
13
+ }
14
+ declare function localRemote(config: LocalRemoteConfig): LocalRemote;
15
+ //#endregion
16
+ export { type LocalRemote, type LocalRemoteConfig, localRemote };
package/dist/index.mjs ADDED
@@ -0,0 +1,67 @@
1
+ import { c as writeBundle, i as writeDeployment, l as writeBundleMetadata } from "./api-8MXKpsHj.mjs";
2
+ import * as os from "node:os";
3
+ import path from "node:path";
4
+
5
+ //#region src/deployer.ts
6
+ var LocalRemoteDeployer = class {
7
+ constructor(config) {
8
+ this.config = config;
9
+ }
10
+ async deploy(params) {
11
+ const { baseDir } = this.config;
12
+ const { bundleName, version, channel } = params;
13
+ await writeDeployment({
14
+ baseDir,
15
+ bundle: bundleName,
16
+ version,
17
+ channel
18
+ });
19
+ }
20
+ };
21
+ function localRemoteDeployer(config) {
22
+ return new LocalRemoteDeployer(config);
23
+ }
24
+
25
+ //#endregion
26
+ //#region src/uploader.ts
27
+ var LocalUploaderImpl = class {
28
+ constructor(config) {
29
+ this.config = config;
30
+ }
31
+ async upload(params) {
32
+ const { baseDir } = this.config;
33
+ const { bundle, bundleName, version, integrity, signature } = params;
34
+ const metadata = {
35
+ integrity,
36
+ signature
37
+ };
38
+ await writeBundle({
39
+ baseDir,
40
+ bundle: bundleName,
41
+ version,
42
+ data: bundle
43
+ });
44
+ await writeBundleMetadata({
45
+ baseDir,
46
+ bundle: bundleName,
47
+ version,
48
+ metadata
49
+ });
50
+ }
51
+ };
52
+ function localRemoteUploader(config) {
53
+ return new LocalUploaderImpl(config);
54
+ }
55
+
56
+ //#endregion
57
+ //#region src/config.ts
58
+ function localRemote(config) {
59
+ const resolvedConfig = { baseDir: config.baseDir ?? path.join(os.homedir(), ".wvb", "local") };
60
+ return {
61
+ uploader: localRemoteUploader(resolvedConfig),
62
+ deployer: localRemoteDeployer(resolvedConfig)
63
+ };
64
+ }
65
+
66
+ //#endregion
67
+ export { localRemote };
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@wvb/remote-local",
3
+ "version": "0.0.0-next.4b4aa30",
4
+ "description": "Webview Bundle remote config for local simulation",
5
+ "homepage": "https://github.com/webview-bundle/webview-bundle",
6
+ "bugs": {
7
+ "url": "https://github.com/webview-bundle/webview-bundle/issues"
8
+ },
9
+ "license": "MIT",
10
+ "author": {
11
+ "name": "Seokju Na",
12
+ "email": "seokju.me@gmail.com",
13
+ "url": "https://github.com/seokju-na"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/webview-bundle/webview-bundle",
18
+ "directory": "packages/remote/local"
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "README.md",
23
+ "CHANGELOG.md"
24
+ ],
25
+ "type": "module",
26
+ "main": "./dist/index.mjs",
27
+ "types": "./dist/index.d.mts",
28
+ "exports": {
29
+ ".": {
30
+ "import": "./dist/index.mjs",
31
+ "require": "./dist/index.cjs"
32
+ },
33
+ "./api": {
34
+ "import": "./dist/api/index.mjs",
35
+ "require": "./dist/api/index.cjs"
36
+ },
37
+ "./package.json": "./package.json"
38
+ },
39
+ "scripts": {
40
+ "prepack": "yarn build",
41
+ "build": "tsdown",
42
+ "typecheck": "tsc --noEmit"
43
+ },
44
+ "dependencies": {
45
+ "@wvb/config": "^0.1.0-next.4b4aa30",
46
+ "tinyglobby": "^0.2.14",
47
+ "zod": "^4.0.5"
48
+ },
49
+ "devDependencies": {
50
+ "@types/node": "22.19.3",
51
+ "tsdown": "0.20.1",
52
+ "typescript": "5.9.3",
53
+ "vitest": "4.1.5"
54
+ }
55
+ }