@wvb/remote-local 0.0.0-next.3603a22

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,10 @@
1
+ # Changelog
2
+
3
+ ## local v0.0.0-next.3603a22
4
+
5
+ This release includes packages: [`@wvb/remote-local`](https://www.npmjs.com/package/@wvb/remote-local/v/0.0.0-next.3603a22)
6
+
7
+ - fix(remote-local): add missing `content-length` header (#162) (0c184ac)
8
+ - feat(ffi): add ffi package for Android/iOS bindings (#139) (c41b723)
9
+ - feat: redesgin cli commands, add local remote provider, oxc -> biome (#132) (af26b39)
10
+ - update dependencies: @wvb/config@0.1.0-next.3603a22
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @wvb/remote-local
@@ -0,0 +1,12 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_api = require("../api-BAHtiZKk.cjs");
3
+ exports.BundleMetadataFileSchema = require_api.BundleMetadataFileSchema;
4
+ exports.DeploymentFileSchema = require_api.DeploymentFileSchema;
5
+ exports.getBundleFileSize = require_api.getBundleFileSize;
6
+ exports.readAllDeployments = require_api.readAllDeployments;
7
+ exports.readBundleMetadata = require_api.readBundleMetadata;
8
+ exports.readBundleStream = require_api.readBundleStream;
9
+ exports.readDeployment = require_api.readDeployment;
10
+ exports.writeBundle = require_api.writeBundle;
11
+ exports.writeBundleMetadata = require_api.writeBundleMetadata;
12
+ exports.writeDeployment = require_api.writeDeployment;
@@ -0,0 +1,95 @@
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
+ declare function getBundleFileSize({
17
+ baseDir,
18
+ bundle,
19
+ version
20
+ }: ReadBundleStreamParams): Promise<number>;
21
+ interface WriteBundleParams {
22
+ baseDir: string;
23
+ bundle: string;
24
+ version: string;
25
+ data: Buffer;
26
+ }
27
+ declare function writeBundle({
28
+ baseDir,
29
+ bundle,
30
+ version,
31
+ data
32
+ }: WriteBundleParams): Promise<void>;
33
+ declare const BundleMetadataFileSchema: z.ZodObject<{
34
+ integrity: z.ZodOptional<z.ZodString>;
35
+ signature: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$strip>;
37
+ type BundleMetadataFile = z.infer<typeof BundleMetadataFileSchema>;
38
+ interface ReadBundleMetadataParams {
39
+ baseDir: string;
40
+ bundle: string;
41
+ version: string;
42
+ }
43
+ declare function readBundleMetadata({
44
+ baseDir,
45
+ bundle,
46
+ version
47
+ }: ReadBundleMetadataParams): Promise<BundleMetadataFile | null>;
48
+ interface WriteBundleMetadataParams {
49
+ baseDir: string;
50
+ bundle: string;
51
+ version: string;
52
+ metadata: BundleMetadataFile;
53
+ }
54
+ declare function writeBundleMetadata({
55
+ baseDir,
56
+ bundle,
57
+ version,
58
+ metadata
59
+ }: WriteBundleMetadataParams): Promise<void>;
60
+ //#endregion
61
+ //#region src/api/deployment.d.ts
62
+ declare const DeploymentFileSchema: z.ZodObject<{
63
+ name: z.ZodString;
64
+ version: z.ZodOptional<z.ZodString>;
65
+ channels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
66
+ }, z.core.$strip>;
67
+ type DeploymentFile = z.infer<typeof DeploymentFileSchema>;
68
+ interface ReadDeploymentParams {
69
+ bundle: string;
70
+ baseDir: string;
71
+ }
72
+ declare function readDeployment({
73
+ bundle,
74
+ baseDir
75
+ }: ReadDeploymentParams): Promise<DeploymentFile | null>;
76
+ interface ReadAllDeploymentsParams {
77
+ baseDir: string;
78
+ }
79
+ declare function readAllDeployments({
80
+ baseDir
81
+ }: ReadAllDeploymentsParams): Promise<DeploymentFile[]>;
82
+ interface WriteDeploymentParams {
83
+ baseDir: string;
84
+ bundle: string;
85
+ version: string;
86
+ channel?: string;
87
+ }
88
+ declare function writeDeployment({
89
+ baseDir,
90
+ bundle,
91
+ version,
92
+ channel
93
+ }: WriteDeploymentParams): Promise<void>;
94
+ //#endregion
95
+ export { type BundleMetadataFile, BundleMetadataFileSchema, type DeploymentFile, DeploymentFileSchema, getBundleFileSize, readAllDeployments, readBundleMetadata, readBundleStream, readDeployment, writeBundle, writeBundleMetadata, writeDeployment };
@@ -0,0 +1,95 @@
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
+ declare function getBundleFileSize({
17
+ baseDir,
18
+ bundle,
19
+ version
20
+ }: ReadBundleStreamParams): Promise<number>;
21
+ interface WriteBundleParams {
22
+ baseDir: string;
23
+ bundle: string;
24
+ version: string;
25
+ data: Buffer;
26
+ }
27
+ declare function writeBundle({
28
+ baseDir,
29
+ bundle,
30
+ version,
31
+ data
32
+ }: WriteBundleParams): Promise<void>;
33
+ declare const BundleMetadataFileSchema: z.ZodObject<{
34
+ integrity: z.ZodOptional<z.ZodString>;
35
+ signature: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$strip>;
37
+ type BundleMetadataFile = z.infer<typeof BundleMetadataFileSchema>;
38
+ interface ReadBundleMetadataParams {
39
+ baseDir: string;
40
+ bundle: string;
41
+ version: string;
42
+ }
43
+ declare function readBundleMetadata({
44
+ baseDir,
45
+ bundle,
46
+ version
47
+ }: ReadBundleMetadataParams): Promise<BundleMetadataFile | null>;
48
+ interface WriteBundleMetadataParams {
49
+ baseDir: string;
50
+ bundle: string;
51
+ version: string;
52
+ metadata: BundleMetadataFile;
53
+ }
54
+ declare function writeBundleMetadata({
55
+ baseDir,
56
+ bundle,
57
+ version,
58
+ metadata
59
+ }: WriteBundleMetadataParams): Promise<void>;
60
+ //#endregion
61
+ //#region src/api/deployment.d.ts
62
+ declare const DeploymentFileSchema: z.ZodObject<{
63
+ name: z.ZodString;
64
+ version: z.ZodOptional<z.ZodString>;
65
+ channels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
66
+ }, z.core.$strip>;
67
+ type DeploymentFile = z.infer<typeof DeploymentFileSchema>;
68
+ interface ReadDeploymentParams {
69
+ bundle: string;
70
+ baseDir: string;
71
+ }
72
+ declare function readDeployment({
73
+ bundle,
74
+ baseDir
75
+ }: ReadDeploymentParams): Promise<DeploymentFile | null>;
76
+ interface ReadAllDeploymentsParams {
77
+ baseDir: string;
78
+ }
79
+ declare function readAllDeployments({
80
+ baseDir
81
+ }: ReadAllDeploymentsParams): Promise<DeploymentFile[]>;
82
+ interface WriteDeploymentParams {
83
+ baseDir: string;
84
+ bundle: string;
85
+ version: string;
86
+ channel?: string;
87
+ }
88
+ declare function writeDeployment({
89
+ baseDir,
90
+ bundle,
91
+ version,
92
+ channel
93
+ }: WriteDeploymentParams): Promise<void>;
94
+ //#endregion
95
+ export { type BundleMetadataFile, BundleMetadataFileSchema, type DeploymentFile, DeploymentFileSchema, getBundleFileSize, readAllDeployments, readBundleMetadata, readBundleStream, readDeployment, writeBundle, writeBundleMetadata, writeDeployment };
@@ -0,0 +1,2 @@
1
+ import { a as BundleMetadataFileSchema, c as readBundleStream, i as writeDeployment, l as writeBundle, n as readAllDeployments, o as getBundleFileSize, r as readDeployment, s as readBundleMetadata, t as DeploymentFileSchema, u as writeBundleMetadata } from "../api-CHVFBPei.mjs";
2
+ export { BundleMetadataFileSchema, DeploymentFileSchema, getBundleFileSize, readAllDeployments, readBundleMetadata, readBundleStream, readDeployment, writeBundle, writeBundleMetadata, writeDeployment };
@@ -0,0 +1,190 @@
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 getBundleFileSize({ baseDir, bundle, version }) {
40
+ const filePath = getBundleFilePath(baseDir, bundle, version);
41
+ return (await node_fs_promises.default.stat(filePath)).size;
42
+ }
43
+ async function writeBundle({ baseDir, bundle, version, data }) {
44
+ const filePath = getBundleFilePath(baseDir, bundle, version);
45
+ await node_fs_promises.default.mkdir(node_path.default.dirname(filePath), { recursive: true });
46
+ await node_fs_promises.default.writeFile(filePath, data);
47
+ }
48
+ const BundleMetadataFileSchema = zod.z.object({
49
+ integrity: zod.z.string().optional(),
50
+ signature: zod.z.string().optional()
51
+ });
52
+ async function readBundleMetadata({ baseDir, bundle, version }) {
53
+ const filePath = getBundleMetadataFilePath(baseDir, bundle, version);
54
+ try {
55
+ const raw = await node_fs_promises.default.readFile(filePath, "utf8");
56
+ return BundleMetadataFileSchema.parse(JSON.parse(raw));
57
+ } catch {
58
+ return null;
59
+ }
60
+ }
61
+ async function writeBundleMetadata({ baseDir, bundle, version, metadata }) {
62
+ const filePath = getBundleMetadataFilePath(baseDir, bundle, version);
63
+ await node_fs_promises.default.mkdir(node_path.default.dirname(filePath), { recursive: true });
64
+ await node_fs_promises.default.writeFile(filePath, JSON.stringify(metadata, null, 2), "utf8");
65
+ }
66
+ function getBundleFilePath(baseDir, bundle, version) {
67
+ const bundleName = normalizeBundleName(bundle);
68
+ return node_path.default.join(baseDir, "bundles", bundleName, `${bundleName}_${version}.wvb`);
69
+ }
70
+ function getBundleMetadataFilePath(baseDir, bundle, version) {
71
+ const bundleName = normalizeBundleName(bundle);
72
+ return node_path.default.join(baseDir, "bundles", bundleName, `${bundleName}_${version}.json`);
73
+ }
74
+ //#endregion
75
+ //#region src/api/deployment.ts
76
+ const DeploymentFileSchema = zod.z.object({
77
+ name: zod.z.string().describe("The name of the bundle"),
78
+ version: zod.z.string().describe("Current deployed version of the bundle").optional(),
79
+ channels: zod.z.record(zod.z.string(), zod.z.string()).optional().describe("Version deployed in each channel")
80
+ });
81
+ async function readDeployment({ bundle, baseDir }) {
82
+ const filePath = getDeploymentFilePath(baseDir, bundle);
83
+ try {
84
+ const raw = await node_fs_promises.default.readFile(filePath, "utf8");
85
+ return DeploymentFileSchema.parse(JSON.parse(raw));
86
+ } catch {
87
+ return null;
88
+ }
89
+ }
90
+ async function readAllDeployments({ baseDir }) {
91
+ const filePaths = await (0, tinyglobby.glob)("*/deployment.json", {
92
+ cwd: node_path.default.join(baseDir, "bundles"),
93
+ absolute: true,
94
+ onlyFiles: true
95
+ });
96
+ const deployments = [];
97
+ for (const file of filePaths) try {
98
+ const raw = await node_fs_promises.default.readFile(file, "utf8");
99
+ const parsed = DeploymentFileSchema.parse(JSON.parse(raw));
100
+ deployments.push(parsed);
101
+ } catch {}
102
+ return deployments;
103
+ }
104
+ async function writeDeployment({ baseDir, bundle, version, channel }) {
105
+ const deployment = await readDeployment({
106
+ baseDir,
107
+ bundle
108
+ }) ?? {
109
+ name: bundle,
110
+ version: void 0,
111
+ channels: {}
112
+ };
113
+ if (channel != null) {
114
+ deployment.channels ??= {};
115
+ deployment.channels[channel] = version;
116
+ } else deployment.version = version;
117
+ const filePath = getDeploymentFilePath(baseDir, bundle);
118
+ await node_fs_promises.default.mkdir(node_path.default.dirname(filePath), { recursive: true });
119
+ await node_fs_promises.default.writeFile(filePath, JSON.stringify(deployment, null, 2), "utf8");
120
+ }
121
+ function getDeploymentFilePath(baseDir, bundle) {
122
+ return node_path.default.join(baseDir, "bundles", `${normalizeBundleName(bundle)}`, "deployment.json");
123
+ }
124
+ //#endregion
125
+ Object.defineProperty(exports, "BundleMetadataFileSchema", {
126
+ enumerable: true,
127
+ get: function() {
128
+ return BundleMetadataFileSchema;
129
+ }
130
+ });
131
+ Object.defineProperty(exports, "DeploymentFileSchema", {
132
+ enumerable: true,
133
+ get: function() {
134
+ return DeploymentFileSchema;
135
+ }
136
+ });
137
+ Object.defineProperty(exports, "__toESM", {
138
+ enumerable: true,
139
+ get: function() {
140
+ return __toESM;
141
+ }
142
+ });
143
+ Object.defineProperty(exports, "getBundleFileSize", {
144
+ enumerable: true,
145
+ get: function() {
146
+ return getBundleFileSize;
147
+ }
148
+ });
149
+ Object.defineProperty(exports, "readAllDeployments", {
150
+ enumerable: true,
151
+ get: function() {
152
+ return readAllDeployments;
153
+ }
154
+ });
155
+ Object.defineProperty(exports, "readBundleMetadata", {
156
+ enumerable: true,
157
+ get: function() {
158
+ return readBundleMetadata;
159
+ }
160
+ });
161
+ Object.defineProperty(exports, "readBundleStream", {
162
+ enumerable: true,
163
+ get: function() {
164
+ return readBundleStream;
165
+ }
166
+ });
167
+ Object.defineProperty(exports, "readDeployment", {
168
+ enumerable: true,
169
+ get: function() {
170
+ return readDeployment;
171
+ }
172
+ });
173
+ Object.defineProperty(exports, "writeBundle", {
174
+ enumerable: true,
175
+ get: function() {
176
+ return writeBundle;
177
+ }
178
+ });
179
+ Object.defineProperty(exports, "writeBundleMetadata", {
180
+ enumerable: true,
181
+ get: function() {
182
+ return writeBundleMetadata;
183
+ }
184
+ });
185
+ Object.defineProperty(exports, "writeDeployment", {
186
+ enumerable: true,
187
+ get: function() {
188
+ return writeDeployment;
189
+ }
190
+ });
@@ -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
+ //#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 getBundleFileSize({ baseDir, bundle, version }) {
16
+ const filePath = getBundleFilePath(baseDir, bundle, version);
17
+ return (await fs.stat(filePath)).size;
18
+ }
19
+ async function writeBundle({ baseDir, bundle, version, data }) {
20
+ const filePath = getBundleFilePath(baseDir, bundle, version);
21
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
22
+ await fs.writeFile(filePath, data);
23
+ }
24
+ const BundleMetadataFileSchema = z.object({
25
+ integrity: z.string().optional(),
26
+ signature: z.string().optional()
27
+ });
28
+ async function readBundleMetadata({ baseDir, bundle, version }) {
29
+ const filePath = getBundleMetadataFilePath(baseDir, bundle, version);
30
+ try {
31
+ const raw = await fs.readFile(filePath, "utf8");
32
+ return BundleMetadataFileSchema.parse(JSON.parse(raw));
33
+ } catch {
34
+ return null;
35
+ }
36
+ }
37
+ async function writeBundleMetadata({ baseDir, bundle, version, metadata }) {
38
+ const filePath = getBundleMetadataFilePath(baseDir, bundle, version);
39
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
40
+ await fs.writeFile(filePath, JSON.stringify(metadata, null, 2), "utf8");
41
+ }
42
+ function getBundleFilePath(baseDir, bundle, version) {
43
+ const bundleName = normalizeBundleName(bundle);
44
+ return path.join(baseDir, "bundles", bundleName, `${bundleName}_${version}.wvb`);
45
+ }
46
+ function getBundleMetadataFilePath(baseDir, bundle, version) {
47
+ const bundleName = normalizeBundleName(bundle);
48
+ return path.join(baseDir, "bundles", bundleName, `${bundleName}_${version}.json`);
49
+ }
50
+ //#endregion
51
+ //#region src/api/deployment.ts
52
+ const DeploymentFileSchema = z.object({
53
+ name: z.string().describe("The name of the bundle"),
54
+ version: z.string().describe("Current deployed version of the bundle").optional(),
55
+ channels: z.record(z.string(), z.string()).optional().describe("Version deployed in each channel")
56
+ });
57
+ async function readDeployment({ bundle, baseDir }) {
58
+ const filePath = getDeploymentFilePath(baseDir, bundle);
59
+ try {
60
+ const raw = await fs.readFile(filePath, "utf8");
61
+ return DeploymentFileSchema.parse(JSON.parse(raw));
62
+ } catch {
63
+ return null;
64
+ }
65
+ }
66
+ async function readAllDeployments({ baseDir }) {
67
+ const filePaths = await glob("*/deployment.json", {
68
+ cwd: path.join(baseDir, "bundles"),
69
+ absolute: true,
70
+ onlyFiles: true
71
+ });
72
+ const deployments = [];
73
+ for (const file of filePaths) try {
74
+ const raw = await fs.readFile(file, "utf8");
75
+ const parsed = DeploymentFileSchema.parse(JSON.parse(raw));
76
+ deployments.push(parsed);
77
+ } catch {}
78
+ return deployments;
79
+ }
80
+ async function writeDeployment({ baseDir, bundle, version, channel }) {
81
+ const deployment = await readDeployment({
82
+ baseDir,
83
+ bundle
84
+ }) ?? {
85
+ name: bundle,
86
+ version: void 0,
87
+ channels: {}
88
+ };
89
+ if (channel != null) {
90
+ deployment.channels ??= {};
91
+ deployment.channels[channel] = version;
92
+ } else deployment.version = version;
93
+ const filePath = getDeploymentFilePath(baseDir, bundle);
94
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
95
+ await fs.writeFile(filePath, JSON.stringify(deployment, null, 2), "utf8");
96
+ }
97
+ function getDeploymentFilePath(baseDir, bundle) {
98
+ return path.join(baseDir, "bundles", `${normalizeBundleName(bundle)}`, "deployment.json");
99
+ }
100
+ //#endregion
101
+ export { BundleMetadataFileSchema as a, readBundleStream as c, writeDeployment as i, writeBundle as l, readAllDeployments as n, getBundleFileSize as o, readDeployment as r, readBundleMetadata as s, DeploymentFileSchema as t, writeBundleMetadata as u };
package/dist/index.cjs ADDED
@@ -0,0 +1,68 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_api = require("./api-BAHtiZKk.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 { i as writeDeployment, l as writeBundle, u as writeBundleMetadata } from "./api-CHVFBPei.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.3603a22",
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.3603a22",
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
+ }