@wvb/remote-local 0.0.0-next.4513cab

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.4513cab
4
+
5
+ This release includes packages: [`@wvb/remote-local`](https://www.npmjs.com/package/@wvb/remote-local/v/0.0.0-next.4513cab)
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.4513cab
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @wvb/remote-local
@@ -0,0 +1,11 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_api = require("../api-CGbxQBqw.cjs");
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,2 @@
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-BkFIwVQt.mjs";
2
+ export { BundleMetadataFileSchema, DeploymentFileSchema, readAllDeployments, readBundleMetadata, readBundleStream, readDeployment, writeBundle, writeBundleMetadata, writeDeployment };
@@ -0,0 +1,97 @@
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
+ //#region src/utils.ts
7
+ function normalizeBundleName(file) {
8
+ return file.replace(/([\\/\s])/g, "-").replace(/\.wvb$/, "");
9
+ }
10
+ //#endregion
11
+ //#region src/api/bundles.ts
12
+ function readBundleStream({ baseDir, bundle, version }) {
13
+ return createReadStream(getBundleFilePath(baseDir, bundle, version));
14
+ }
15
+ async function writeBundle({ baseDir, bundle, version, data }) {
16
+ const filePath = getBundleFilePath(baseDir, bundle, version);
17
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
18
+ await fs.writeFile(filePath, data);
19
+ }
20
+ const BundleMetadataFileSchema = z.object({
21
+ integrity: z.string().optional(),
22
+ signature: z.string().optional()
23
+ });
24
+ async function readBundleMetadata({ baseDir, bundle, version }) {
25
+ const filePath = getBundleMetadataFilePath(baseDir, bundle, version);
26
+ try {
27
+ const raw = await fs.readFile(filePath, "utf8");
28
+ return BundleMetadataFileSchema.parse(JSON.parse(raw));
29
+ } catch {
30
+ return null;
31
+ }
32
+ }
33
+ async function writeBundleMetadata({ baseDir, bundle, version, metadata }) {
34
+ const filePath = getBundleMetadataFilePath(baseDir, bundle, version);
35
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
36
+ await fs.writeFile(filePath, JSON.stringify(metadata, null, 2), "utf8");
37
+ }
38
+ function getBundleFilePath(baseDir, bundle, version) {
39
+ const bundleName = normalizeBundleName(bundle);
40
+ return path.join(baseDir, "bundles", bundleName, `${bundleName}_${version}.wvb`);
41
+ }
42
+ function getBundleMetadataFilePath(baseDir, bundle, version) {
43
+ const bundleName = normalizeBundleName(bundle);
44
+ return path.join(baseDir, "bundles", bundleName, `${bundleName}_${version}.json`);
45
+ }
46
+ //#endregion
47
+ //#region src/api/deployment.ts
48
+ const DeploymentFileSchema = z.object({
49
+ name: z.string().describe("The name of the bundle"),
50
+ version: z.string().describe("Current deployed version of the bundle").optional(),
51
+ channels: z.record(z.string(), z.string()).optional().describe("Version deployed in each channel")
52
+ });
53
+ async function readDeployment({ bundle, baseDir }) {
54
+ const filePath = getDeploymentFilePath(baseDir, bundle);
55
+ try {
56
+ const raw = await fs.readFile(filePath, "utf8");
57
+ return DeploymentFileSchema.parse(JSON.parse(raw));
58
+ } catch {
59
+ return null;
60
+ }
61
+ }
62
+ async function readAllDeployments({ baseDir }) {
63
+ const filePaths = await glob("*/deployment.json", {
64
+ cwd: path.join(baseDir, "bundles"),
65
+ absolute: true,
66
+ onlyFiles: true
67
+ });
68
+ const deployments = [];
69
+ for (const file of filePaths) try {
70
+ const raw = await fs.readFile(file, "utf8");
71
+ const parsed = DeploymentFileSchema.parse(JSON.parse(raw));
72
+ deployments.push(parsed);
73
+ } catch {}
74
+ return deployments;
75
+ }
76
+ async function writeDeployment({ baseDir, bundle, version, channel }) {
77
+ const deployment = await readDeployment({
78
+ baseDir,
79
+ bundle
80
+ }) ?? {
81
+ name: bundle,
82
+ version: void 0,
83
+ channels: {}
84
+ };
85
+ if (channel != null) {
86
+ deployment.channels ??= {};
87
+ deployment.channels[channel] = version;
88
+ } else deployment.version = version;
89
+ const filePath = getDeploymentFilePath(baseDir, bundle);
90
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
91
+ await fs.writeFile(filePath, JSON.stringify(deployment, null, 2), "utf8");
92
+ }
93
+ function getDeploymentFilePath(baseDir, bundle) {
94
+ return path.join(baseDir, "bundles", `${normalizeBundleName(bundle)}`, "deployment.json");
95
+ }
96
+ //#endregion
97
+ 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,180 @@
1
+ //#region \0rolldown/runtime.js
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") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ let node_path = require("node:path");
24
+ node_path = __toESM(node_path, 1);
25
+ let node_fs = require("node:fs");
26
+ let node_fs_promises = require("node:fs/promises");
27
+ node_fs_promises = __toESM(node_fs_promises, 1);
28
+ let zod = require("zod");
29
+ let tinyglobby = require("tinyglobby");
30
+ //#region src/utils.ts
31
+ function normalizeBundleName(file) {
32
+ return file.replace(/([\\/\s])/g, "-").replace(/\.wvb$/, "");
33
+ }
34
+ //#endregion
35
+ //#region src/api/bundles.ts
36
+ function readBundleStream({ baseDir, bundle, version }) {
37
+ return (0, node_fs.createReadStream)(getBundleFilePath(baseDir, bundle, version));
38
+ }
39
+ async function writeBundle({ baseDir, bundle, version, data }) {
40
+ const filePath = getBundleFilePath(baseDir, bundle, version);
41
+ await node_fs_promises.default.mkdir(node_path.default.dirname(filePath), { recursive: true });
42
+ await node_fs_promises.default.writeFile(filePath, data);
43
+ }
44
+ const BundleMetadataFileSchema = zod.z.object({
45
+ integrity: zod.z.string().optional(),
46
+ signature: zod.z.string().optional()
47
+ });
48
+ async function readBundleMetadata({ baseDir, bundle, version }) {
49
+ const filePath = getBundleMetadataFilePath(baseDir, bundle, version);
50
+ try {
51
+ const raw = await node_fs_promises.default.readFile(filePath, "utf8");
52
+ return BundleMetadataFileSchema.parse(JSON.parse(raw));
53
+ } catch {
54
+ return null;
55
+ }
56
+ }
57
+ async function writeBundleMetadata({ baseDir, bundle, version, metadata }) {
58
+ const filePath = getBundleMetadataFilePath(baseDir, bundle, version);
59
+ await node_fs_promises.default.mkdir(node_path.default.dirname(filePath), { recursive: true });
60
+ await node_fs_promises.default.writeFile(filePath, JSON.stringify(metadata, null, 2), "utf8");
61
+ }
62
+ function getBundleFilePath(baseDir, bundle, version) {
63
+ const bundleName = normalizeBundleName(bundle);
64
+ return node_path.default.join(baseDir, "bundles", bundleName, `${bundleName}_${version}.wvb`);
65
+ }
66
+ function getBundleMetadataFilePath(baseDir, bundle, version) {
67
+ const bundleName = normalizeBundleName(bundle);
68
+ return node_path.default.join(baseDir, "bundles", bundleName, `${bundleName}_${version}.json`);
69
+ }
70
+ //#endregion
71
+ //#region src/api/deployment.ts
72
+ const DeploymentFileSchema = zod.z.object({
73
+ name: zod.z.string().describe("The name of the bundle"),
74
+ version: zod.z.string().describe("Current deployed version of the bundle").optional(),
75
+ channels: zod.z.record(zod.z.string(), zod.z.string()).optional().describe("Version deployed in each channel")
76
+ });
77
+ async function readDeployment({ bundle, baseDir }) {
78
+ const filePath = getDeploymentFilePath(baseDir, bundle);
79
+ try {
80
+ const raw = await node_fs_promises.default.readFile(filePath, "utf8");
81
+ return DeploymentFileSchema.parse(JSON.parse(raw));
82
+ } catch {
83
+ return null;
84
+ }
85
+ }
86
+ async function readAllDeployments({ baseDir }) {
87
+ const filePaths = await (0, tinyglobby.glob)("*/deployment.json", {
88
+ cwd: node_path.default.join(baseDir, "bundles"),
89
+ absolute: true,
90
+ onlyFiles: true
91
+ });
92
+ const deployments = [];
93
+ for (const file of filePaths) try {
94
+ const raw = await node_fs_promises.default.readFile(file, "utf8");
95
+ const parsed = DeploymentFileSchema.parse(JSON.parse(raw));
96
+ deployments.push(parsed);
97
+ } catch {}
98
+ return deployments;
99
+ }
100
+ async function writeDeployment({ baseDir, bundle, version, channel }) {
101
+ const deployment = await readDeployment({
102
+ baseDir,
103
+ bundle
104
+ }) ?? {
105
+ name: bundle,
106
+ version: void 0,
107
+ channels: {}
108
+ };
109
+ if (channel != null) {
110
+ deployment.channels ??= {};
111
+ deployment.channels[channel] = version;
112
+ } else deployment.version = version;
113
+ const filePath = getDeploymentFilePath(baseDir, bundle);
114
+ await node_fs_promises.default.mkdir(node_path.default.dirname(filePath), { recursive: true });
115
+ await node_fs_promises.default.writeFile(filePath, JSON.stringify(deployment, null, 2), "utf8");
116
+ }
117
+ function getDeploymentFilePath(baseDir, bundle) {
118
+ return node_path.default.join(baseDir, "bundles", `${normalizeBundleName(bundle)}`, "deployment.json");
119
+ }
120
+ //#endregion
121
+ Object.defineProperty(exports, "BundleMetadataFileSchema", {
122
+ enumerable: true,
123
+ get: function() {
124
+ return BundleMetadataFileSchema;
125
+ }
126
+ });
127
+ Object.defineProperty(exports, "DeploymentFileSchema", {
128
+ enumerable: true,
129
+ get: function() {
130
+ return DeploymentFileSchema;
131
+ }
132
+ });
133
+ Object.defineProperty(exports, "__toESM", {
134
+ enumerable: true,
135
+ get: function() {
136
+ return __toESM;
137
+ }
138
+ });
139
+ Object.defineProperty(exports, "readAllDeployments", {
140
+ enumerable: true,
141
+ get: function() {
142
+ return readAllDeployments;
143
+ }
144
+ });
145
+ Object.defineProperty(exports, "readBundleMetadata", {
146
+ enumerable: true,
147
+ get: function() {
148
+ return readBundleMetadata;
149
+ }
150
+ });
151
+ Object.defineProperty(exports, "readBundleStream", {
152
+ enumerable: true,
153
+ get: function() {
154
+ return readBundleStream;
155
+ }
156
+ });
157
+ Object.defineProperty(exports, "readDeployment", {
158
+ enumerable: true,
159
+ get: function() {
160
+ return readDeployment;
161
+ }
162
+ });
163
+ Object.defineProperty(exports, "writeBundle", {
164
+ enumerable: true,
165
+ get: function() {
166
+ return writeBundle;
167
+ }
168
+ });
169
+ Object.defineProperty(exports, "writeBundleMetadata", {
170
+ enumerable: true,
171
+ get: function() {
172
+ return writeBundleMetadata;
173
+ }
174
+ });
175
+ Object.defineProperty(exports, "writeDeployment", {
176
+ enumerable: true,
177
+ get: function() {
178
+ return writeDeployment;
179
+ }
180
+ });
package/dist/index.cjs ADDED
@@ -0,0 +1,68 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_api = require("./api-CGbxQBqw.cjs");
3
+ let node_os = require("node:os");
4
+ node_os = require_api.__toESM(node_os, 1);
5
+ let node_path = require("node:path");
6
+ node_path = require_api.__toESM(node_path, 1);
7
+ //#region src/deployer.ts
8
+ var LocalRemoteDeployer = class {
9
+ config;
10
+ constructor(config) {
11
+ this.config = config;
12
+ }
13
+ async deploy(params) {
14
+ const { baseDir } = this.config;
15
+ const { bundleName, version, channel } = params;
16
+ await require_api.writeDeployment({
17
+ baseDir,
18
+ bundle: bundleName,
19
+ version,
20
+ channel
21
+ });
22
+ }
23
+ };
24
+ function localRemoteDeployer(config) {
25
+ return new LocalRemoteDeployer(config);
26
+ }
27
+ //#endregion
28
+ //#region src/uploader.ts
29
+ var LocalUploaderImpl = class {
30
+ config;
31
+ constructor(config) {
32
+ this.config = config;
33
+ }
34
+ async upload(params) {
35
+ const { baseDir } = this.config;
36
+ const { bundle, bundleName, version, integrity, signature } = params;
37
+ const metadata = {
38
+ integrity,
39
+ signature
40
+ };
41
+ await require_api.writeBundle({
42
+ baseDir,
43
+ bundle: bundleName,
44
+ version,
45
+ data: bundle
46
+ });
47
+ await require_api.writeBundleMetadata({
48
+ baseDir,
49
+ bundle: bundleName,
50
+ version,
51
+ metadata
52
+ });
53
+ }
54
+ };
55
+ function localRemoteUploader(config) {
56
+ return new LocalUploaderImpl(config);
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
+ //#endregion
68
+ 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,65 @@
1
+ import { c as writeBundle, i as writeDeployment, l as writeBundleMetadata } from "./api-BkFIwVQt.mjs";
2
+ import * as os from "node:os";
3
+ import path from "node:path";
4
+ //#region src/deployer.ts
5
+ var LocalRemoteDeployer = class {
6
+ config;
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
+ //#endregion
25
+ //#region src/uploader.ts
26
+ var LocalUploaderImpl = class {
27
+ config;
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
+ //#endregion
56
+ //#region src/config.ts
57
+ function localRemote(config) {
58
+ const resolvedConfig = { baseDir: config.baseDir ?? path.join(os.homedir(), ".wvb", "local") };
59
+ return {
60
+ uploader: localRemoteUploader(resolvedConfig),
61
+ deployer: localRemoteDeployer(resolvedConfig)
62
+ };
63
+ }
64
+ //#endregion
65
+ export { localRemote };
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@wvb/remote-local",
3
+ "version": "0.0.0-next.4513cab",
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.4513cab",
46
+ "tinyglobby": "^0.2.14",
47
+ "zod": "^4.0.5"
48
+ },
49
+ "devDependencies": {
50
+ "@types/node": "25.9.1",
51
+ "tsdown": "0.22.1",
52
+ "typescript": "6.0.3",
53
+ "vitest": "4.1.8"
54
+ }
55
+ }