@devframes/plugin-assets 1.3.1 → 1.3.2
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/dist/node/cli.d.mts +1 -3
- package/dist/node/cli.mjs +2 -3
- package/dist/node/index.d.mts +1 -3
- package/dist/node/index.mjs +1 -2
- package/dist/node/rpc/index.d.mts +0 -18
- package/dist/node/rpc/index.mjs +1 -2
- package/dist/node/setup.d.mts +1 -9
- package/dist/node/setup.mjs +2 -2
- package/dist/{node-DL18OAmb.mjs → node-BhSDcCcY.mjs} +5 -8
- package/dist/{rpc-f6T4yE2q.mjs → rpc-CqAuMDDE.mjs} +13 -26
- package/dist/{setup-C83m-OKB.mjs → setup-yvQQ5ETR.mjs} +4 -7
- package/dist/{types-Bspm5Ylo.d.mts → types-DYXlrd0o.d.mts} +0 -2
- package/package.json +20 -20
package/dist/node/cli.d.mts
CHANGED
package/dist/node/cli.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { t as createAssetsDevframe } from "../node-
|
|
1
|
+
import { t as createAssetsDevframe } from "../node-BhSDcCcY.mjs";
|
|
2
2
|
import { createCac } from "devframe/adapters/cac";
|
|
3
|
-
|
|
3
|
+
// src/node/cli.ts
|
|
4
4
|
function createAssetsCli() {
|
|
5
5
|
return createCac(createAssetsDevframe({ serveStatic: true }));
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { createAssetsCli };
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { a as DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, i as CodeSnippet, n as AssetInfo, r as AssetType, t as AssetImageMeta } from "../types-
|
|
1
|
+
import { a as DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, i as CodeSnippet, n as AssetInfo, r as AssetType, t as AssetImageMeta } from "../types-DYXlrd0o.mjs";
|
|
2
2
|
import { DevframeDefinition } from "devframe";
|
|
3
|
-
//#region src/node/index.d.ts
|
|
4
3
|
export interface AssetsDevframeOptions {
|
|
5
4
|
id?: string;
|
|
6
5
|
name?: string;
|
|
@@ -75,5 +74,4 @@ export interface AssetsDevframeOptions {
|
|
|
75
74
|
* version bump until it stabilizes.
|
|
76
75
|
*/
|
|
77
76
|
export declare function createAssetsDevframe(options?: AssetsDevframeOptions): DevframeDefinition;
|
|
78
|
-
//#endregion
|
|
79
77
|
export { type AssetImageMeta, type AssetInfo, type AssetType, type CodeSnippet, DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, createAssetsDevframe as default };
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, createAssetsDevframe, createAssetsDevframe as default };
|
|
1
|
+
export { n as DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, t as createAssetsDevframe, t as default } from "../node-BhSDcCcY.mjs";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { RpcDefinitionsToFunctions } from "devframe/rpc";
|
|
2
|
-
//#region src/node/rpc/functions/capabilities.d.ts
|
|
3
2
|
interface AssetsCapabilities {
|
|
4
3
|
write: boolean;
|
|
5
4
|
uploadExtensions: readonly string[] | '*';
|
|
@@ -17,8 +16,6 @@ export declare const capabilities: import("devframe/rpc").RpcFunctionDefinitionW
|
|
|
17
16
|
write: boolean;
|
|
18
17
|
uploadExtensions: string[] | "*";
|
|
19
18
|
}>, import("devframe").DevframeNodeContext>;
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/node/rpc/functions/delete.d.ts
|
|
22
19
|
/** One request covers both single- and multi-select delete. */
|
|
23
20
|
export declare const deleteAssets: import("devframe/rpc").RpcFunctionDefinitionWithSchemas<"devframes:plugin:assets:delete", "action", readonly [import("devframe/utils/simple-schema").SimpleSchema<{
|
|
24
21
|
paths: string[];
|
|
@@ -29,8 +26,6 @@ export declare const deleteAssets: import("devframe/rpc").RpcFunctionDefinitionW
|
|
|
29
26
|
}, {
|
|
30
27
|
deleted: string[];
|
|
31
28
|
}>, import("devframe").DevframeNodeContext>;
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region src/node/rpc/functions/list.d.ts
|
|
34
29
|
export declare const assetInfoSchema: import("devframe/utils/simple-schema").SimpleSchema<{
|
|
35
30
|
path: string;
|
|
36
31
|
type: "image" | "font" | "video" | "audio" | "text" | "other";
|
|
@@ -61,15 +56,11 @@ export declare const list: import("devframe/rpc").RpcFunctionDefinitionWithSchem
|
|
|
61
56
|
mtime: number;
|
|
62
57
|
fsPath?: string | undefined;
|
|
63
58
|
}[]>, import("devframe").DevframeNodeContext>;
|
|
64
|
-
//#endregion
|
|
65
|
-
//#region src/node/rpc/functions/mkdir.d.ts
|
|
66
59
|
export declare const mkdir: import("devframe/rpc").RpcFunctionDefinitionWithSchemas<"devframes:plugin:assets:mkdir", "action", readonly [import("devframe/utils/simple-schema").SimpleSchema<{
|
|
67
60
|
path: string;
|
|
68
61
|
}, {
|
|
69
62
|
path: string;
|
|
70
63
|
}>], import("devframe/utils/simple-schema").SimpleSchema<void, void>, import("devframe").DevframeNodeContext>;
|
|
71
|
-
//#endregion
|
|
72
|
-
//#region src/node/rpc/functions/read-image-meta.d.ts
|
|
73
64
|
export declare const readImageMeta: import("devframe/rpc").RpcFunctionDefinitionWithSchemas<"devframes:plugin:assets:read-image-meta", "query", readonly [import("devframe/utils/simple-schema").SimpleSchema<string, string>], import("devframe/utils/simple-schema").SimpleSchema<{
|
|
74
65
|
width?: number | undefined;
|
|
75
66
|
height?: number | undefined;
|
|
@@ -79,11 +70,7 @@ export declare const readImageMeta: import("devframe/rpc").RpcFunctionDefinition
|
|
|
79
70
|
height?: number | undefined;
|
|
80
71
|
orientation?: number | undefined;
|
|
81
72
|
} | null>, import("devframe").DevframeNodeContext>;
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/node/rpc/functions/read-text.d.ts
|
|
84
73
|
export declare const readText: import("devframe/rpc").RpcFunctionDefinitionWithSchemas<"devframes:plugin:assets:read-text", "query", readonly [import("devframe/utils/simple-schema").SimpleSchema<string, string>, import("devframe/utils/simple-schema").SimpleSchema<number | undefined, number | undefined>], import("devframe/utils/simple-schema").SimpleSchema<string | null, string | null>, import("devframe").DevframeNodeContext>;
|
|
85
|
-
//#endregion
|
|
86
|
-
//#region src/node/rpc/functions/rename.d.ts
|
|
87
74
|
interface RenameArgs {
|
|
88
75
|
/** Root-relative path of the asset to rename. */
|
|
89
76
|
path: string;
|
|
@@ -116,8 +103,6 @@ export declare const rename: import("devframe/rpc").RpcFunctionDefinitionWithSch
|
|
|
116
103
|
mtime: number;
|
|
117
104
|
fsPath?: string | undefined;
|
|
118
105
|
}>, import("devframe").DevframeNodeContext>;
|
|
119
|
-
//#endregion
|
|
120
|
-
//#region src/node/rpc/functions/upload.d.ts
|
|
121
106
|
/** Streaming channel name, namespaced like every other RPC name in this plugin. */
|
|
122
107
|
export declare const UPLOAD_CHANNEL = "devframes:plugin:assets:upload";
|
|
123
108
|
/**
|
|
@@ -134,8 +119,6 @@ export declare const upload: import("devframe/rpc").RpcFunctionDefinitionWithSch
|
|
|
134
119
|
}, {
|
|
135
120
|
uploadId: string;
|
|
136
121
|
}>, import("devframe").DevframeNodeContext>;
|
|
137
|
-
//#endregion
|
|
138
|
-
//#region src/node/rpc/index.d.ts
|
|
139
122
|
/** Read-only RPC, always registered. */
|
|
140
123
|
export declare const readFunctions: readonly [import("devframe/rpc").RpcFunctionDefinitionWithSchemas<"devframes:plugin:assets:list", "query", readonly [], import("devframe/utils/simple-schema").SimpleSchema<{
|
|
141
124
|
path: string;
|
|
@@ -280,5 +263,4 @@ export declare const serverFunctions: readonly [import("devframe/rpc").RpcFuncti
|
|
|
280
263
|
declare module 'devframe' {
|
|
281
264
|
interface DevframeRpcServerFunctions extends RpcDefinitionsToFunctions<typeof serverFunctions> {}
|
|
282
265
|
}
|
|
283
|
-
//#endregion
|
|
284
266
|
export type { AssetsCapabilities, RenameArgs };
|
package/dist/node/rpc/index.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { UPLOAD_CHANNEL, assetInfoSchema, capabilities, deleteAssets, list, mkdir, readFunctions, readImageMeta, readText, rename, serverFunctions, upload, writeFunctions };
|
|
1
|
+
export { m as UPLOAD_CHANNEL, c as assetInfoSchema, p as capabilities, f as deleteAssets, l as list, s as mkdir, t as readFunctions, o as readImageMeta, a as readText, i as rename, n as serverFunctions, h as upload, r as writeFunctions } from "../../rpc-CqAuMDDE.mjs";
|
package/dist/node/setup.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { n as AssetInfo, r as AssetType } from "../types-
|
|
1
|
+
import { n as AssetInfo, r as AssetType } from "../types-DYXlrd0o.mjs";
|
|
2
2
|
import { DevframeNodeContext, RpcStreamingChannel } from "devframe";
|
|
3
|
-
//#region src/node/context.d.ts
|
|
4
3
|
interface AssetsConfig {
|
|
5
4
|
/** Directory this devframe manages. */
|
|
6
5
|
dir: string;
|
|
@@ -37,8 +36,6 @@ export declare function configureAssets(ctx: DevframeNodeContext, config: Assets
|
|
|
37
36
|
* `configureAssets`'s config on every call.
|
|
38
37
|
*/
|
|
39
38
|
export declare function getAssetsContext(ctx: DevframeNodeContext): AssetsContext;
|
|
40
|
-
//#endregion
|
|
41
|
-
//#region src/node/paths.d.ts
|
|
42
39
|
/**
|
|
43
40
|
* Resolve a client-supplied, root-relative path against the managed
|
|
44
41
|
* directory, rejecting anything that would escape it lexically (`..`
|
|
@@ -47,14 +44,10 @@ export declare function getAssetsContext(ctx: DevframeNodeContext): AssetsContex
|
|
|
47
44
|
* (reads) and {@link assertAssetMutationPath} (mutations).
|
|
48
45
|
*/
|
|
49
46
|
export declare function resolveAssetPath(root: string, relativePath: string): string;
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region src/node/scanner.d.ts
|
|
52
47
|
/** Classifies a path by extension, driving preview and icon choice. */
|
|
53
48
|
export declare function guessAssetType(path: string): AssetType;
|
|
54
49
|
/** Recursively lists every file under `dir`, sorted alphabetically by path. */
|
|
55
50
|
export declare function scanAssets(dir: string, baseURL: string, includeFsPath?: boolean): Promise<AssetInfo[]>;
|
|
56
|
-
//#endregion
|
|
57
|
-
//#region src/node/setup.d.ts
|
|
58
51
|
export interface SetupAssetsOptions {
|
|
59
52
|
/** Directory this devframe manages. */
|
|
60
53
|
dir: string;
|
|
@@ -98,5 +91,4 @@ export declare function setupAssets(ctx: DevframeNodeContext, options: SetupAsse
|
|
|
98
91
|
* leaked chokidar watcher doesn't keep the process alive.
|
|
99
92
|
*/
|
|
100
93
|
export declare function disposeAssetsWatcher(ctx: DevframeNodeContext): Promise<void>;
|
|
101
|
-
//#endregion
|
|
102
94
|
export {};
|
package/dist/node/setup.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as setupAssets, t as disposeAssetsWatcher } from "../setup-
|
|
2
|
-
import { _ as getAssetsContext, d as scanAssets, g as configureAssets, u as guessAssetType, v as resolveAssetPath } from "../rpc-
|
|
1
|
+
import { n as setupAssets, t as disposeAssetsWatcher } from "../setup-yvQQ5ETR.mjs";
|
|
2
|
+
import { _ as getAssetsContext, d as scanAssets, g as configureAssets, u as guessAssetType, v as resolveAssetPath } from "../rpc-CqAuMDDE.mjs";
|
|
3
3
|
export { configureAssets, disposeAssetsWatcher, getAssetsContext, guessAssetType, resolveAssetPath, scanAssets, setupAssets };
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { n as setupAssets } from "./setup-
|
|
1
|
+
import { n as setupAssets } from "./setup-yvQQ5ETR.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import { defineDevframe } from "devframe";
|
|
4
4
|
import { resolve } from "pathe";
|
|
5
|
-
|
|
5
|
+
// package.json
|
|
6
6
|
var name = "@devframes/plugin-assets";
|
|
7
|
-
var version = "1.3.
|
|
7
|
+
var version = "1.3.2";
|
|
8
8
|
var description = "Devframe plugin for browsing, previewing, uploading, and managing static assets in a directory.";
|
|
9
9
|
var homepage = "https://github.com/devframes/devframe#readme";
|
|
10
|
-
|
|
11
|
-
//#region src/node/types.ts
|
|
10
|
+
// src/node/types.ts
|
|
12
11
|
/** Mirrors Nuxt DevTools' own default upload allow-list. */
|
|
13
12
|
const DEFAULT_ALLOWED_UPLOAD_EXTENSIONS = [
|
|
14
13
|
"png",
|
|
@@ -31,8 +30,7 @@ const DEFAULT_ALLOWED_UPLOAD_EXTENSIONS = [
|
|
|
31
30
|
"woff2",
|
|
32
31
|
"eot"
|
|
33
32
|
];
|
|
34
|
-
|
|
35
|
-
//#region src/node/index.ts
|
|
33
|
+
// src/node/index.ts
|
|
36
34
|
const remoteAssets = {
|
|
37
35
|
package: `${name}--assets`,
|
|
38
36
|
version
|
|
@@ -99,5 +97,4 @@ function createAssetsDevframe(options = {}) {
|
|
|
99
97
|
}
|
|
100
98
|
});
|
|
101
99
|
}
|
|
102
|
-
//#endregion
|
|
103
100
|
export { DEFAULT_ALLOWED_UPLOAD_EXTENSIONS as n, createAssetsDevframe as t };
|
|
@@ -7,7 +7,7 @@ import { s } from "devframe/utils/simple-schema";
|
|
|
7
7
|
import { joinURL } from "devframe/utils/url";
|
|
8
8
|
import { glob } from "tinyglobby";
|
|
9
9
|
import { imageMeta } from "image-meta";
|
|
10
|
-
|
|
10
|
+
// src/node/diagnostics.ts
|
|
11
11
|
/**
|
|
12
12
|
* Uses the plugin's own `DP_ASSETS_` prefix per the built-in plugin
|
|
13
13
|
* convention, keeping it collision-free with devframe core (`DF`) and the
|
|
@@ -46,8 +46,7 @@ const diagnostics = defineDiagnostics({
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
-
|
|
50
|
-
//#region src/node/paths.ts
|
|
49
|
+
// src/node/paths.ts
|
|
51
50
|
/** realpath, pathe-normalized, or `null` when the path doesn't exist. */
|
|
52
51
|
async function realpath(path) {
|
|
53
52
|
try {
|
|
@@ -103,8 +102,7 @@ async function assertAssetMutationPath(root, relativePath) {
|
|
|
103
102
|
}
|
|
104
103
|
return absolute;
|
|
105
104
|
}
|
|
106
|
-
|
|
107
|
-
//#region src/node/context.ts
|
|
105
|
+
// src/node/context.ts
|
|
108
106
|
const configs = /* @__PURE__ */ new WeakMap();
|
|
109
107
|
const contexts = /* @__PURE__ */ new WeakMap();
|
|
110
108
|
/**
|
|
@@ -136,8 +134,7 @@ function getAssetsContext(ctx) {
|
|
|
136
134
|
contexts.set(ctx, built);
|
|
137
135
|
return built;
|
|
138
136
|
}
|
|
139
|
-
|
|
140
|
-
//#region src/node/rpc/functions/upload.ts
|
|
137
|
+
// src/node/rpc/functions/upload.ts
|
|
141
138
|
/** Streaming channel name, namespaced like every other RPC name in this plugin. */
|
|
142
139
|
const UPLOAD_CHANNEL = "devframes:plugin:assets:upload";
|
|
143
140
|
function isExtensionAllowed(path, allowed) {
|
|
@@ -193,8 +190,7 @@ handler: (async ({ path }) => {
|
|
|
193
190
|
}) };
|
|
194
191
|
}
|
|
195
192
|
});
|
|
196
|
-
|
|
197
|
-
//#region src/node/rpc/functions/capabilities.ts
|
|
193
|
+
// src/node/rpc/functions/capabilities.ts
|
|
198
194
|
/**
|
|
199
195
|
* Lets the UI know upfront whether upload / rename / delete / mkdir are
|
|
200
196
|
* available, so it can hide or disable those affordances proactively
|
|
@@ -225,8 +221,7 @@ const capabilities = defineRpcFunction({
|
|
|
225
221
|
})) };
|
|
226
222
|
}
|
|
227
223
|
});
|
|
228
|
-
|
|
229
|
-
//#region src/node/rpc/functions/delete.ts
|
|
224
|
+
// src/node/rpc/functions/delete.ts
|
|
230
225
|
/** One request covers both single- and multi-select delete. */
|
|
231
226
|
const deleteAssets = defineRpcFunction({
|
|
232
227
|
name: "devframes:plugin:assets:delete",
|
|
@@ -259,8 +254,7 @@ handler: (async ({ paths }) => {
|
|
|
259
254
|
}) };
|
|
260
255
|
}
|
|
261
256
|
});
|
|
262
|
-
|
|
263
|
-
//#region src/node/scanner.ts
|
|
257
|
+
// src/node/scanner.ts
|
|
264
258
|
const reImage = /\.(?:png|jpe?g|jxl|gif|svg|webp|avif|ico|bmp|tiff?)$/i;
|
|
265
259
|
const reVideo = /\.(?:mp4|webm|ogv|mov|avi|flv|wmv|mpg|mpeg|mkv|3gp|3g2|ts|mts|m2ts|vob|ogm|ogx|rm|rmvb|asf|amv|divx|m4v|svi|viv|f4v|f4p|f4a|f4b)$/i;
|
|
266
260
|
const reAudio = /\.(?:mp3|wav|ogg|flac|aac|wma|alac|ape|ac3|dts|tta|opus|amr|aiff|au|mid|midi|ra|rm|wv|weba|dss|spx|vox|tak|dsf|dff|dsd|cda)$/i;
|
|
@@ -313,8 +307,7 @@ async function scanAssets(dir, baseURL, includeFsPath = false) {
|
|
|
313
307
|
}
|
|
314
308
|
}))).filter((info) => info !== void 0).sort((a, b) => a.path.localeCompare(b.path));
|
|
315
309
|
}
|
|
316
|
-
|
|
317
|
-
//#region src/node/rpc/functions/list.ts
|
|
310
|
+
// src/node/rpc/functions/list.ts
|
|
318
311
|
const assetInfoSchema = s.object({
|
|
319
312
|
path: s.string(),
|
|
320
313
|
type: s.picklist([
|
|
@@ -355,8 +348,7 @@ const list = defineRpcFunction({
|
|
|
355
348
|
handler: (async () => scanAssets(assets.dir, assets.baseURL, ctx.mode === "dev")) };
|
|
356
349
|
}
|
|
357
350
|
});
|
|
358
|
-
|
|
359
|
-
//#region src/node/rpc/functions/mkdir.ts
|
|
351
|
+
// src/node/rpc/functions/mkdir.ts
|
|
360
352
|
const mkdir = defineRpcFunction({
|
|
361
353
|
name: "devframes:plugin:assets:mkdir",
|
|
362
354
|
type: "action",
|
|
@@ -382,8 +374,7 @@ handler: (async ({ path }) => {
|
|
|
382
374
|
}) };
|
|
383
375
|
}
|
|
384
376
|
});
|
|
385
|
-
|
|
386
|
-
//#region src/node/rpc/functions/read-image-meta.ts
|
|
377
|
+
// src/node/rpc/functions/read-image-meta.ts
|
|
387
378
|
const readImageMeta = defineRpcFunction({
|
|
388
379
|
name: "devframes:plugin:assets:read-image-meta",
|
|
389
380
|
type: "query",
|
|
@@ -419,8 +410,7 @@ handler: (async (path) => {
|
|
|
419
410
|
}) };
|
|
420
411
|
}
|
|
421
412
|
});
|
|
422
|
-
|
|
423
|
-
//#region src/node/rpc/functions/read-text.ts
|
|
413
|
+
// src/node/rpc/functions/read-text.ts
|
|
424
414
|
const DEFAULT_LIMIT = 5e3;
|
|
425
415
|
const readText = defineRpcFunction({
|
|
426
416
|
name: "devframes:plugin:assets:read-text",
|
|
@@ -447,8 +437,7 @@ handler: (async (path, limit = DEFAULT_LIMIT) => {
|
|
|
447
437
|
}) };
|
|
448
438
|
}
|
|
449
439
|
});
|
|
450
|
-
|
|
451
|
-
//#region src/node/rpc/functions/rename.ts
|
|
440
|
+
// src/node/rpc/functions/rename.ts
|
|
452
441
|
const rename = defineRpcFunction({
|
|
453
442
|
name: "devframes:plugin:assets:rename",
|
|
454
443
|
type: "action",
|
|
@@ -495,8 +484,7 @@ handler: (async ({ path, newName }) => {
|
|
|
495
484
|
}) };
|
|
496
485
|
}
|
|
497
486
|
});
|
|
498
|
-
|
|
499
|
-
//#region src/node/rpc/index.ts
|
|
487
|
+
// src/node/rpc/index.ts
|
|
500
488
|
/** Read-only RPC, always registered. */
|
|
501
489
|
const readFunctions = [
|
|
502
490
|
list,
|
|
@@ -512,5 +500,4 @@ const writeFunctions = [
|
|
|
512
500
|
mkdir
|
|
513
501
|
];
|
|
514
502
|
const serverFunctions = [...readFunctions, ...writeFunctions];
|
|
515
|
-
//#endregion
|
|
516
503
|
export { getAssetsContext as _, readText as a, assetInfoSchema as c, scanAssets as d, deleteAssets as f, configureAssets as g, upload as h, rename as i, list as l, UPLOAD_CHANNEL as m, serverFunctions as n, readImageMeta as o, capabilities as p, writeFunctions as r, mkdir as s, readFunctions as t, guessAssetType as u, resolveAssetPath as v };
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { g as configureAssets, m as UPLOAD_CHANNEL, r as writeFunctions, t as readFunctions } from "./rpc-
|
|
1
|
+
import { g as configureAssets, m as UPLOAD_CHANNEL, r as writeFunctions, t as readFunctions } from "./rpc-CqAuMDDE.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import fsp from "node:fs/promises";
|
|
5
5
|
import { watch } from "chokidar";
|
|
6
6
|
import { debounce } from "devframe/utils/debounce";
|
|
7
|
-
|
|
7
|
+
// src/node/constants.ts
|
|
8
8
|
/** Broadcast whenever a file is added, removed, or changed under the managed directory. */
|
|
9
9
|
const CHANGED_EVENT = "devframes:plugin:assets:changed";
|
|
10
10
|
/** Preferred standalone CLI port. */
|
|
11
11
|
const DEFAULT_PORT = 9015;
|
|
12
|
-
|
|
13
|
-
//#region src/node/watcher.ts
|
|
12
|
+
// src/node/watcher.ts
|
|
14
13
|
/**
|
|
15
14
|
* Watch the managed directory and broadcast {@link CHANGED_EVENT} (debounced)
|
|
16
15
|
* whenever a file is added, removed, or changed, so connected UIs refresh
|
|
@@ -40,8 +39,7 @@ function watchAssetsDir(ctx, dir) {
|
|
|
40
39
|
if (process.platform === "win32") await new Promise((resolve) => setTimeout(resolve, 200));
|
|
41
40
|
};
|
|
42
41
|
}
|
|
43
|
-
|
|
44
|
-
//#region src/node/setup.ts
|
|
42
|
+
// src/node/setup.ts
|
|
45
43
|
const watchers = /* @__PURE__ */ new WeakMap();
|
|
46
44
|
/**
|
|
47
45
|
* Register the assets RPC surface on a devframe node context: ensures the
|
|
@@ -80,5 +78,4 @@ async function disposeAssetsWatcher(ctx) {
|
|
|
80
78
|
watchers.delete(ctx);
|
|
81
79
|
await dispose();
|
|
82
80
|
}
|
|
83
|
-
//#endregion
|
|
84
81
|
export { setupAssets as n, DEFAULT_PORT as r, disposeAssetsWatcher as t };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/node/types.d.ts
|
|
2
1
|
/** Broad category guessed from a file's extension, driving preview/icon choice. */
|
|
3
2
|
type AssetType = 'image' | 'font' | 'video' | 'audio' | 'text' | 'other';
|
|
4
3
|
/** One file under the managed directory. */
|
|
@@ -31,5 +30,4 @@ interface CodeSnippet {
|
|
|
31
30
|
}
|
|
32
31
|
/** Mirrors Nuxt DevTools' own default upload allow-list. */
|
|
33
32
|
declare const DEFAULT_ALLOWED_UPLOAD_EXTENSIONS: readonly string[];
|
|
34
|
-
//#endregion
|
|
35
33
|
export { DEFAULT_ALLOWED_UPLOAD_EXTENSIONS as a, CodeSnippet as i, AssetInfo as n, AssetType as r, AssetImageMeta as t };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devframes/plugin-assets",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.2",
|
|
5
5
|
"description": "Devframe plugin for browsing, previewing, uploading, and managing static assets in a directory.",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@devframes/plugin-assets--assets": "1.3.
|
|
40
|
-
"@devframes/service-shiki": "1.3.
|
|
41
|
-
"devframe": "1.3.
|
|
39
|
+
"@devframes/plugin-assets--assets": "1.3.2",
|
|
40
|
+
"@devframes/service-shiki": "1.3.2",
|
|
41
|
+
"devframe": "1.3.2",
|
|
42
42
|
"vite": "^7.0.0 || ^8.0.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
@@ -53,32 +53,32 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@devframes/service-open": "1.3.
|
|
56
|
+
"@devframes/service-open": "1.3.2",
|
|
57
57
|
"cac": "^7.1.0",
|
|
58
|
-
"chokidar": "^
|
|
59
|
-
"image-meta": "^0.3.
|
|
58
|
+
"chokidar": "^6.0.0",
|
|
59
|
+
"image-meta": "^0.3.1",
|
|
60
60
|
"pathe": "^2.0.3",
|
|
61
61
|
"tinyglobby": "^0.2.17"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@antfu/design": "^0.6.0",
|
|
65
|
-
"@devframes/plugin-assets--assets": "1.3.
|
|
66
|
-
"@devframes/service-shiki": "1.3.
|
|
67
|
-
"@devframes/vite": "1.3.
|
|
65
|
+
"@devframes/plugin-assets--assets": "1.3.2",
|
|
66
|
+
"@devframes/service-shiki": "1.3.2",
|
|
67
|
+
"@devframes/vite": "1.3.2",
|
|
68
68
|
"@iconify-json/ph": "^1.2.2",
|
|
69
|
-
"@storybook/addon-a11y": "^10.6.
|
|
70
|
-
"@storybook/addon-docs": "^10.6.
|
|
71
|
-
"@storybook/vue3-vite": "^10.6.
|
|
72
|
-
"@types/node": "^26.6.
|
|
69
|
+
"@storybook/addon-a11y": "^10.6.5",
|
|
70
|
+
"@storybook/addon-docs": "^10.6.5",
|
|
71
|
+
"@storybook/vue3-vite": "^10.6.5",
|
|
72
|
+
"@types/node": "^26.6.6",
|
|
73
73
|
"@vitejs/plugin-vue": "^6.0.10",
|
|
74
74
|
"colorjs.io": "^0.7.1",
|
|
75
|
-
"devframe": "1.3.
|
|
76
|
-
"h3": "^2.0.
|
|
75
|
+
"devframe": "1.3.2",
|
|
76
|
+
"h3": "^2.0.8",
|
|
77
77
|
"reka-ui": "^2.11.0",
|
|
78
|
-
"storybook": "^10.6.
|
|
79
|
-
"tsdown": "0.23.
|
|
80
|
-
"unocss": "^66.
|
|
81
|
-
"vite": "^8.3.
|
|
78
|
+
"storybook": "^10.6.5",
|
|
79
|
+
"tsdown": "^0.23.4",
|
|
80
|
+
"unocss": "^66.12.0",
|
|
81
|
+
"vite": "^8.3.5",
|
|
82
82
|
"vitest": "^5.0.5",
|
|
83
83
|
"vue": "^3.5.44",
|
|
84
84
|
"vue-afloat": "^0.2.0"
|