@openvcs/sdk 0.2.14 → 0.2.16

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/test/init.test.js CHANGED
@@ -81,11 +81,11 @@ test("writeModuleTemplate scaffolds SDK runtime entrypoint", () => {
81
81
  });
82
82
 
83
83
  const pluginSource = fs.readFileSync(path.join(targetDir, "src", "plugin.ts"), "utf8");
84
- const manifest = JSON.parse(
85
- fs.readFileSync(path.join(targetDir, "openvcs.plugin.json"), "utf8")
84
+ const packageJson = JSON.parse(
85
+ fs.readFileSync(path.join(targetDir, "package.json"), "utf8")
86
86
  );
87
87
 
88
- assert.equal(manifest.module.exec, "openvcs-plugin.js");
88
+ assert.equal(packageJson.openvcs.module.exec, "openvcs-plugin.js");
89
89
  assert.match(pluginSource, /OnPluginStart/);
90
90
  assert.match(pluginSource, /PluginDefinition/);
91
91
  assert.match(pluginSource, /context\.host\.info\('OpenVCS plugin started'\)/);
package/lib/dist.d.ts DELETED
@@ -1,27 +0,0 @@
1
- import { readManifest, validateDeclaredModuleExec } from "./build";
2
- interface DistArgs {
3
- pluginDir: string;
4
- outDir: string;
5
- verbose: boolean;
6
- noNpmDeps: boolean;
7
- noBuild: boolean;
8
- }
9
- export declare function distUsage(commandName?: string): string;
10
- export declare function parseDistArgs(args: string[]): DistArgs;
11
- declare function validateManifestEntry(pluginDir: string, entry: string): void;
12
- declare function rejectNativeAddonsRecursive(dirPath: string): void;
13
- declare function copyIcon(pluginDir: string, bundleDir: string): void;
14
- declare function uniqueStagingDir(outDir: string): string;
15
- declare function writeTarGz(outPath: string, baseDir: string, folderName: string): Promise<void>;
16
- export declare function bundlePlugin(parsedArgs: DistArgs): Promise<string>;
17
- export declare const __private: {
18
- ICON_EXTENSIONS: string[];
19
- copyIcon: typeof copyIcon;
20
- readManifest: typeof readManifest;
21
- rejectNativeAddonsRecursive: typeof rejectNativeAddonsRecursive;
22
- uniqueStagingDir: typeof uniqueStagingDir;
23
- validateDeclaredModuleExec: typeof validateDeclaredModuleExec;
24
- validateManifestEntry: typeof validateManifestEntry;
25
- writeTarGz: typeof writeTarGz;
26
- };
27
- export {};
package/lib/dist.js DELETED
@@ -1,241 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.__private = void 0;
4
- exports.distUsage = distUsage;
5
- exports.parseDistArgs = parseDistArgs;
6
- exports.bundlePlugin = bundlePlugin;
7
- const fs = require("node:fs");
8
- const path = require("node:path");
9
- const tar = require("tar");
10
- const build_1 = require("./build");
11
- const fs_utils_1 = require("./fs-utils");
12
- const ICON_EXTENSIONS = ["png", "jpg", "jpeg", "webp", "avif", "svg"];
13
- function distUsage(commandName = "openvcs") {
14
- return `${commandName} dist [args]\n\n --plugin-dir <path> Plugin repository root (contains openvcs.plugin.json)\n --out <path> Output directory (default: ./dist)\n --no-build Skip the plugin build step before packaging\n --no-npm-deps Disable npm dependency bundling (enabled by default)\n -V, --verbose Enable verbose output\n`;
15
- }
16
- function parseDistArgs(args) {
17
- let pluginDir = process.cwd();
18
- let outDir = "dist";
19
- let verbose = false;
20
- let noNpmDeps = false;
21
- let noBuild = false;
22
- for (let index = 0; index < args.length; index += 1) {
23
- const arg = args[index];
24
- if (arg === "--plugin-dir") {
25
- index += 1;
26
- if (index >= args.length) {
27
- throw new Error("missing value for --plugin-dir");
28
- }
29
- pluginDir = args[index];
30
- continue;
31
- }
32
- if (arg === "--out") {
33
- index += 1;
34
- if (index >= args.length) {
35
- throw new Error("missing value for --out");
36
- }
37
- outDir = args[index];
38
- continue;
39
- }
40
- if (arg === "--no-npm-deps") {
41
- noNpmDeps = true;
42
- continue;
43
- }
44
- if (arg === "--no-build") {
45
- noBuild = true;
46
- continue;
47
- }
48
- if (arg === "-V" || arg === "--verbose") {
49
- verbose = true;
50
- continue;
51
- }
52
- if (arg === "--help") {
53
- const error = new Error(distUsage());
54
- error.code = "USAGE";
55
- throw error;
56
- }
57
- throw new Error(`unknown flag: ${arg}`);
58
- }
59
- return {
60
- pluginDir: path.resolve(pluginDir),
61
- outDir: path.resolve(outDir),
62
- verbose,
63
- noNpmDeps,
64
- noBuild,
65
- };
66
- }
67
- function validateManifestEntry(pluginDir, entry) {
68
- const normalized = entry.trim();
69
- if (path.isAbsolute(normalized)) {
70
- throw new Error(`manifest entry must be a relative path: ${entry}`);
71
- }
72
- const targetPath = path.resolve(pluginDir, normalized);
73
- const pluginDirResolved = path.resolve(pluginDir);
74
- if (!(0, fs_utils_1.isPathInside)(pluginDirResolved, targetPath) || targetPath === pluginDirResolved) {
75
- throw new Error(`manifest entry must point to a file under the plugin directory: ${entry}`);
76
- }
77
- if (!fs.existsSync(targetPath) || !fs.lstatSync(targetPath).isFile()) {
78
- throw new Error(`manifest entry file not found: ${entry}`);
79
- }
80
- }
81
- function copyEntryDirectory(pluginDir, bundleDir, entry) {
82
- const normalized = entry.trim();
83
- const entryDir = path.dirname(normalized);
84
- const sourceDir = path.join(pluginDir, entryDir);
85
- const destDir = path.join(bundleDir, entryDir);
86
- (0, fs_utils_1.copyDirectoryRecursiveStrict)(sourceDir, destDir);
87
- }
88
- function ensurePackageLock(pluginDir, bundleDir, verbose) {
89
- if (!(0, build_1.hasPackageJson)(pluginDir)) {
90
- return;
91
- }
92
- const lockPath = path.join(pluginDir, "package-lock.json");
93
- if (fs.existsSync(lockPath) && fs.lstatSync(lockPath).isFile()) {
94
- return;
95
- }
96
- const packageJsonPath = path.join(pluginDir, "package.json");
97
- (0, fs_utils_1.copyFileStrict)(packageJsonPath, path.join(bundleDir, "package.json"));
98
- if (verbose) {
99
- process.stderr.write(`Generating package-lock.json in staging\n`);
100
- }
101
- (0, build_1.runCommand)((0, build_1.npmExecutable)(), ["install", "--package-lock-only", "--ignore-scripts", "--no-audit", "--no-fund"], bundleDir, verbose);
102
- }
103
- function copyNpmFilesToStaging(pluginDir, bundleDir) {
104
- const packageJsonPath = path.join(pluginDir, "package.json");
105
- const lockPath = path.join(pluginDir, "package-lock.json");
106
- if (!fs.existsSync(packageJsonPath) || !fs.lstatSync(packageJsonPath).isFile()) {
107
- throw new Error(`missing package.json at ${packageJsonPath}`);
108
- }
109
- (0, fs_utils_1.copyFileStrict)(packageJsonPath, path.join(bundleDir, "package.json"));
110
- const stagedLockPath = path.join(bundleDir, "package-lock.json");
111
- if (fs.existsSync(stagedLockPath) && fs.lstatSync(stagedLockPath).isFile()) {
112
- return;
113
- }
114
- if (fs.existsSync(lockPath) && fs.lstatSync(lockPath).isFile()) {
115
- (0, fs_utils_1.copyFileStrict)(lockPath, path.join(bundleDir, "package-lock.json"));
116
- }
117
- }
118
- function rejectNativeAddonsRecursive(dirPath) {
119
- const entries = fs.readdirSync(dirPath, { withFileTypes: true });
120
- for (const entry of entries) {
121
- const entryPath = path.join(dirPath, entry.name);
122
- const stats = fs.lstatSync(entryPath);
123
- if (stats.isSymbolicLink()) {
124
- throw new Error(`plugin contains a symlink: ${entryPath}`);
125
- }
126
- if (stats.isDirectory()) {
127
- rejectNativeAddonsRecursive(entryPath);
128
- continue;
129
- }
130
- if (!stats.isFile()) {
131
- continue;
132
- }
133
- if (entry.name.toLowerCase().endsWith(".node")) {
134
- throw new Error(`native Node addon files are not supported in portable bundles: ${entryPath}`);
135
- }
136
- }
137
- }
138
- function installNpmDependencies(pluginDir, bundleDir, verbose) {
139
- copyNpmFilesToStaging(pluginDir, bundleDir);
140
- (0, build_1.runCommand)((0, build_1.npmExecutable)(), ["ci", "--omit=dev", "--ignore-scripts", "--no-bin-links", "--no-audit", "--no-fund"], bundleDir, verbose);
141
- const nodeModulesPath = path.join(bundleDir, "node_modules");
142
- if (!fs.existsSync(nodeModulesPath)) {
143
- return;
144
- }
145
- if (!fs.lstatSync(nodeModulesPath).isDirectory()) {
146
- throw new Error(`npm install produced non-directory node_modules path: ${nodeModulesPath}`);
147
- }
148
- rejectNativeAddonsRecursive(nodeModulesPath);
149
- }
150
- function copyIcon(pluginDir, bundleDir) {
151
- const entries = fs.readdirSync(pluginDir, { withFileTypes: true });
152
- const iconEntries = entries.filter((e) => {
153
- if (!e.isFile())
154
- return false;
155
- const name = e.name.toLowerCase();
156
- return name.startsWith("icon.") && ICON_EXTENSIONS.includes(name.slice(5));
157
- });
158
- for (const ext of ICON_EXTENSIONS) {
159
- const found = iconEntries.find((e) => e.name.toLowerCase() === `icon.${ext}`);
160
- if (found) {
161
- (0, fs_utils_1.copyFileStrict)(path.join(pluginDir, found.name), path.join(bundleDir, found.name));
162
- return;
163
- }
164
- }
165
- }
166
- function uniqueStagingDir(outDir) {
167
- return path.join(outDir, `.openvcs-plugin-staging-${Date.now()}-${process.pid}`);
168
- }
169
- async function writeTarGz(outPath, baseDir, folderName) {
170
- const folderPath = path.join(baseDir, folderName);
171
- (0, fs_utils_1.rejectSymlinksRecursive)(folderPath);
172
- await tar.create({
173
- cwd: baseDir,
174
- file: outPath,
175
- gzip: true,
176
- portable: true,
177
- noMtime: true,
178
- preservePaths: false,
179
- strict: true,
180
- }, [folderName]);
181
- }
182
- async function bundlePlugin(parsedArgs) {
183
- const { pluginDir, outDir, verbose, noNpmDeps, noBuild } = parsedArgs;
184
- if (verbose) {
185
- process.stderr.write(`Bundling plugin from: ${pluginDir}\n`);
186
- }
187
- const { pluginId, moduleExec, entry, manifestPath } = noBuild
188
- ? (0, build_1.readManifest)(pluginDir)
189
- : (0, build_1.buildPluginAssets)({ pluginDir, verbose });
190
- const themesPath = path.join(pluginDir, "themes");
191
- const hasThemes = fs.existsSync(themesPath) && fs.lstatSync(themesPath).isDirectory();
192
- if (entry) {
193
- validateManifestEntry(pluginDir, entry);
194
- }
195
- if (!moduleExec && !hasThemes && !entry) {
196
- throw new Error("manifest has no module.exec, entry, or themes/");
197
- }
198
- (0, build_1.validateGeneratedBootstrapTargets)(pluginDir, moduleExec);
199
- (0, build_1.validateDeclaredModuleExec)(pluginDir, moduleExec);
200
- (0, fs_utils_1.ensureDirectory)(outDir);
201
- const stagingRoot = uniqueStagingDir(outDir);
202
- const bundleDir = path.join(stagingRoot, pluginId);
203
- (0, fs_utils_1.ensureDirectory)(bundleDir);
204
- try {
205
- (0, fs_utils_1.copyFileStrict)(manifestPath, path.join(bundleDir, "openvcs.plugin.json"));
206
- copyIcon(pluginDir, bundleDir);
207
- if (entry) {
208
- copyEntryDirectory(pluginDir, bundleDir, entry);
209
- }
210
- const sourceBinDir = path.join(pluginDir, "bin");
211
- if (fs.existsSync(sourceBinDir) && fs.lstatSync(sourceBinDir).isDirectory()) {
212
- (0, fs_utils_1.copyDirectoryRecursiveStrict)(sourceBinDir, path.join(bundleDir, "bin"));
213
- }
214
- if (hasThemes) {
215
- (0, fs_utils_1.copyDirectoryRecursiveStrict)(themesPath, path.join(bundleDir, "themes"));
216
- }
217
- if (!noNpmDeps && (0, build_1.hasPackageJson)(pluginDir)) {
218
- ensurePackageLock(pluginDir, bundleDir, verbose);
219
- installNpmDependencies(pluginDir, bundleDir, verbose);
220
- }
221
- const outPath = path.join(outDir, `${pluginId}.ovcsp`);
222
- if (fs.existsSync(outPath)) {
223
- fs.rmSync(outPath, { force: true });
224
- }
225
- await writeTarGz(outPath, stagingRoot, pluginId);
226
- return outPath;
227
- }
228
- finally {
229
- fs.rmSync(stagingRoot, { recursive: true, force: true });
230
- }
231
- }
232
- exports.__private = {
233
- ICON_EXTENSIONS,
234
- copyIcon,
235
- readManifest: build_1.readManifest,
236
- rejectNativeAddonsRecursive,
237
- uniqueStagingDir,
238
- validateDeclaredModuleExec: build_1.validateDeclaredModuleExec,
239
- validateManifestEntry,
240
- writeTarGz,
241
- };
package/src/lib/dist.ts DELETED
@@ -1,306 +0,0 @@
1
- import * as fs from "node:fs";
2
- import * as path from "node:path";
3
- import tar = require("tar");
4
- import {
5
- buildPluginAssets,
6
- hasPackageJson,
7
- ManifestInfo,
8
- npmExecutable,
9
- readManifest,
10
- runCommand,
11
- validateDeclaredModuleExec,
12
- validateGeneratedBootstrapTargets,
13
- } from "./build";
14
- import {
15
- copyDirectoryRecursiveStrict,
16
- copyFileStrict,
17
- ensureDirectory,
18
- isPathInside,
19
- rejectSymlinksRecursive,
20
- } from "./fs-utils";
21
-
22
- const ICON_EXTENSIONS = ["png", "jpg", "jpeg", "webp", "avif", "svg"];
23
-
24
- type UsageError = Error & { code?: string };
25
-
26
- interface DistArgs {
27
- pluginDir: string;
28
- outDir: string;
29
- verbose: boolean;
30
- noNpmDeps: boolean;
31
- noBuild: boolean;
32
- }
33
-
34
- export function distUsage(commandName = "openvcs"): string {
35
- return `${commandName} dist [args]\n\n --plugin-dir <path> Plugin repository root (contains openvcs.plugin.json)\n --out <path> Output directory (default: ./dist)\n --no-build Skip the plugin build step before packaging\n --no-npm-deps Disable npm dependency bundling (enabled by default)\n -V, --verbose Enable verbose output\n`;
36
- }
37
-
38
- export function parseDistArgs(args: string[]): DistArgs {
39
- let pluginDir = process.cwd();
40
- let outDir = "dist";
41
- let verbose = false;
42
- let noNpmDeps = false;
43
- let noBuild = false;
44
-
45
- for (let index = 0; index < args.length; index += 1) {
46
- const arg = args[index];
47
- if (arg === "--plugin-dir") {
48
- index += 1;
49
- if (index >= args.length) {
50
- throw new Error("missing value for --plugin-dir");
51
- }
52
- pluginDir = args[index] as string;
53
- continue;
54
- }
55
- if (arg === "--out") {
56
- index += 1;
57
- if (index >= args.length) {
58
- throw new Error("missing value for --out");
59
- }
60
- outDir = args[index] as string;
61
- continue;
62
- }
63
- if (arg === "--no-npm-deps") {
64
- noNpmDeps = true;
65
- continue;
66
- }
67
- if (arg === "--no-build") {
68
- noBuild = true;
69
- continue;
70
- }
71
- if (arg === "-V" || arg === "--verbose") {
72
- verbose = true;
73
- continue;
74
- }
75
- if (arg === "--help") {
76
- const error = new Error(distUsage()) as UsageError;
77
- error.code = "USAGE";
78
- throw error;
79
- }
80
- throw new Error(`unknown flag: ${arg}`);
81
- }
82
-
83
- return {
84
- pluginDir: path.resolve(pluginDir),
85
- outDir: path.resolve(outDir),
86
- verbose,
87
- noNpmDeps,
88
- noBuild,
89
- };
90
- }
91
-
92
- function validateManifestEntry(pluginDir: string, entry: string): void {
93
- const normalized = entry.trim();
94
- if (path.isAbsolute(normalized)) {
95
- throw new Error(`manifest entry must be a relative path: ${entry}`);
96
- }
97
- const targetPath = path.resolve(pluginDir, normalized);
98
- const pluginDirResolved = path.resolve(pluginDir);
99
- if (!isPathInside(pluginDirResolved, targetPath) || targetPath === pluginDirResolved) {
100
- throw new Error(`manifest entry must point to a file under the plugin directory: ${entry}`);
101
- }
102
- if (!fs.existsSync(targetPath) || !fs.lstatSync(targetPath).isFile()) {
103
- throw new Error(`manifest entry file not found: ${entry}`);
104
- }
105
- }
106
-
107
- function copyEntryDirectory(pluginDir: string, bundleDir: string, entry: string): void {
108
- const normalized = entry.trim();
109
- const entryDir = path.dirname(normalized);
110
- const sourceDir = path.join(pluginDir, entryDir);
111
- const destDir = path.join(bundleDir, entryDir);
112
- copyDirectoryRecursiveStrict(sourceDir, destDir);
113
- }
114
-
115
- function ensurePackageLock(pluginDir: string, bundleDir: string, verbose: boolean): void {
116
- if (!hasPackageJson(pluginDir)) {
117
- return;
118
- }
119
- const lockPath = path.join(pluginDir, "package-lock.json");
120
- if (fs.existsSync(lockPath) && fs.lstatSync(lockPath).isFile()) {
121
- return;
122
- }
123
-
124
- const packageJsonPath = path.join(pluginDir, "package.json");
125
- copyFileStrict(packageJsonPath, path.join(bundleDir, "package.json"));
126
-
127
- if (verbose) {
128
- process.stderr.write(`Generating package-lock.json in staging\n`);
129
- }
130
- runCommand(
131
- npmExecutable(),
132
- ["install", "--package-lock-only", "--ignore-scripts", "--no-audit", "--no-fund"],
133
- bundleDir,
134
- verbose
135
- );
136
- }
137
-
138
- function copyNpmFilesToStaging(pluginDir: string, bundleDir: string): void {
139
- const packageJsonPath = path.join(pluginDir, "package.json");
140
- const lockPath = path.join(pluginDir, "package-lock.json");
141
-
142
- if (!fs.existsSync(packageJsonPath) || !fs.lstatSync(packageJsonPath).isFile()) {
143
- throw new Error(`missing package.json at ${packageJsonPath}`);
144
- }
145
-
146
- copyFileStrict(packageJsonPath, path.join(bundleDir, "package.json"));
147
-
148
- const stagedLockPath = path.join(bundleDir, "package-lock.json");
149
- if (fs.existsSync(stagedLockPath) && fs.lstatSync(stagedLockPath).isFile()) {
150
- return;
151
- }
152
-
153
- if (fs.existsSync(lockPath) && fs.lstatSync(lockPath).isFile()) {
154
- copyFileStrict(lockPath, path.join(bundleDir, "package-lock.json"));
155
- }
156
- }
157
-
158
- function rejectNativeAddonsRecursive(dirPath: string): void {
159
- const entries = fs.readdirSync(dirPath, { withFileTypes: true });
160
- for (const entry of entries) {
161
- const entryPath = path.join(dirPath, entry.name);
162
- const stats = fs.lstatSync(entryPath);
163
- if (stats.isSymbolicLink()) {
164
- throw new Error(`plugin contains a symlink: ${entryPath}`);
165
- }
166
- if (stats.isDirectory()) {
167
- rejectNativeAddonsRecursive(entryPath);
168
- continue;
169
- }
170
- if (!stats.isFile()) {
171
- continue;
172
- }
173
- if (entry.name.toLowerCase().endsWith(".node")) {
174
- throw new Error(`native Node addon files are not supported in portable bundles: ${entryPath}`);
175
- }
176
- }
177
- }
178
-
179
- function installNpmDependencies(pluginDir: string, bundleDir: string, verbose: boolean): void {
180
- copyNpmFilesToStaging(pluginDir, bundleDir);
181
- runCommand(
182
- npmExecutable(),
183
- ["ci", "--omit=dev", "--ignore-scripts", "--no-bin-links", "--no-audit", "--no-fund"],
184
- bundleDir,
185
- verbose
186
- );
187
-
188
- const nodeModulesPath = path.join(bundleDir, "node_modules");
189
- if (!fs.existsSync(nodeModulesPath)) {
190
- return;
191
- }
192
- if (!fs.lstatSync(nodeModulesPath).isDirectory()) {
193
- throw new Error(`npm install produced non-directory node_modules path: ${nodeModulesPath}`);
194
- }
195
- rejectNativeAddonsRecursive(nodeModulesPath);
196
- }
197
-
198
- function copyIcon(pluginDir: string, bundleDir: string): void {
199
- const entries = fs.readdirSync(pluginDir, { withFileTypes: true });
200
- const iconEntries = entries.filter((e) => {
201
- if (!e.isFile()) return false;
202
- const name = e.name.toLowerCase();
203
- return name.startsWith("icon.") && ICON_EXTENSIONS.includes(name.slice(5));
204
- });
205
- for (const ext of ICON_EXTENSIONS) {
206
- const found = iconEntries.find((e) => e.name.toLowerCase() === `icon.${ext}`);
207
- if (found) {
208
- copyFileStrict(
209
- path.join(pluginDir, found.name),
210
- path.join(bundleDir, found.name)
211
- );
212
- return;
213
- }
214
- }
215
- }
216
-
217
- function uniqueStagingDir(outDir: string): string {
218
- return path.join(outDir, `.openvcs-plugin-staging-${Date.now()}-${process.pid}`);
219
- }
220
-
221
- async function writeTarGz(outPath: string, baseDir: string, folderName: string): Promise<void> {
222
- const folderPath = path.join(baseDir, folderName);
223
- rejectSymlinksRecursive(folderPath);
224
- await tar.create(
225
- {
226
- cwd: baseDir,
227
- file: outPath,
228
- gzip: true,
229
- portable: true,
230
- noMtime: true,
231
- preservePaths: false,
232
- strict: true,
233
- },
234
- [folderName]
235
- );
236
- }
237
-
238
- export async function bundlePlugin(parsedArgs: DistArgs): Promise<string> {
239
- const { pluginDir, outDir, verbose, noNpmDeps, noBuild } = parsedArgs;
240
- if (verbose) {
241
- process.stderr.write(`Bundling plugin from: ${pluginDir}\n`);
242
- }
243
-
244
- const { pluginId, moduleExec, entry, manifestPath } = noBuild
245
- ? readManifest(pluginDir)
246
- : buildPluginAssets({ pluginDir, verbose });
247
- const themesPath = path.join(pluginDir, "themes");
248
- const hasThemes = fs.existsSync(themesPath) && fs.lstatSync(themesPath).isDirectory();
249
- if (entry) {
250
- validateManifestEntry(pluginDir, entry);
251
- }
252
- if (!moduleExec && !hasThemes && !entry) {
253
- throw new Error("manifest has no module.exec, entry, or themes/");
254
- }
255
- validateGeneratedBootstrapTargets(pluginDir, moduleExec);
256
- validateDeclaredModuleExec(pluginDir, moduleExec);
257
-
258
- ensureDirectory(outDir);
259
- const stagingRoot = uniqueStagingDir(outDir);
260
- const bundleDir = path.join(stagingRoot, pluginId);
261
-
262
- ensureDirectory(bundleDir);
263
-
264
- try {
265
- copyFileStrict(manifestPath, path.join(bundleDir, "openvcs.plugin.json"));
266
- copyIcon(pluginDir, bundleDir);
267
-
268
- if (entry) {
269
- copyEntryDirectory(pluginDir, bundleDir, entry);
270
- }
271
-
272
- const sourceBinDir = path.join(pluginDir, "bin");
273
- if (fs.existsSync(sourceBinDir) && fs.lstatSync(sourceBinDir).isDirectory()) {
274
- copyDirectoryRecursiveStrict(sourceBinDir, path.join(bundleDir, "bin"));
275
- }
276
- if (hasThemes) {
277
- copyDirectoryRecursiveStrict(themesPath, path.join(bundleDir, "themes"));
278
- }
279
-
280
- if (!noNpmDeps && hasPackageJson(pluginDir)) {
281
- ensurePackageLock(pluginDir, bundleDir, verbose);
282
- installNpmDependencies(pluginDir, bundleDir, verbose);
283
- }
284
-
285
- const outPath = path.join(outDir, `${pluginId}.ovcsp`);
286
- if (fs.existsSync(outPath)) {
287
- fs.rmSync(outPath, { force: true });
288
- }
289
-
290
- await writeTarGz(outPath, stagingRoot, pluginId);
291
- return outPath;
292
- } finally {
293
- fs.rmSync(stagingRoot, { recursive: true, force: true });
294
- }
295
- }
296
-
297
- export const __private = {
298
- ICON_EXTENSIONS,
299
- copyIcon,
300
- readManifest,
301
- rejectNativeAddonsRecursive,
302
- uniqueStagingDir,
303
- validateDeclaredModuleExec,
304
- validateManifestEntry,
305
- writeTarGz,
306
- };