@devframes/plugin-assets 0.9.11 → 0.9.15
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 +2 -3
- package/dist/node/cli.mjs +1 -1
- package/dist/node/index.d.mts +3 -3
- package/dist/node/index.mjs +1 -1
- package/dist/node/rpc/index.d.mts +30 -31
- package/dist/node/rpc/index.mjs +1 -1
- package/dist/node/setup.d.mts +9 -10
- package/dist/node/setup.mjs +2 -2
- package/dist/{node-Bv-v7YvO.mjs → node-R7TKGJPj.mjs} +2 -2
- package/dist/{rpc-DG9tV_c_.mjs → rpc-G5ynmiLP.mjs} +19 -12
- package/dist/{setup-BIpnpKP0.mjs → setup-D6v6l0Ri.mjs} +1 -1
- package/package.json +18 -18
package/dist/node/cli.d.mts
CHANGED
package/dist/node/cli.mjs
CHANGED
package/dist/node/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, i as CodeSnippet, n as AssetInfo, r as AssetType, t as AssetImageMeta } from "../types-Bspm5Ylo.mjs";
|
|
2
2
|
import { DevframeDefinition } from "devframe";
|
|
3
3
|
//#region src/node/index.d.ts
|
|
4
|
-
interface AssetsDevframeOptions {
|
|
4
|
+
export interface AssetsDevframeOptions {
|
|
5
5
|
id?: string;
|
|
6
6
|
name?: string;
|
|
7
7
|
icon?: string;
|
|
@@ -74,6 +74,6 @@ interface AssetsDevframeOptions {
|
|
|
74
74
|
* @experimental This plugin is experimental and may change without a major
|
|
75
75
|
* version bump until it stabilizes.
|
|
76
76
|
*/
|
|
77
|
-
declare function createAssetsDevframe(options?: AssetsDevframeOptions): DevframeDefinition;
|
|
77
|
+
export declare function createAssetsDevframe(options?: AssetsDevframeOptions): DevframeDefinition;
|
|
78
78
|
//#endregion
|
|
79
|
-
export { type AssetImageMeta, type AssetInfo, type AssetType,
|
|
79
|
+
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,2 @@
|
|
|
1
|
-
import { n as DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, t as createAssetsDevframe } from "../node-
|
|
1
|
+
import { n as DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, t as createAssetsDevframe } from "../node-R7TKGJPj.mjs";
|
|
2
2
|
export { DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, createAssetsDevframe, createAssetsDevframe as default };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DevframeNodeContext } from "devframe";
|
|
2
1
|
import { RpcDefinitionsToFunctions } from "devframe/rpc";
|
|
3
2
|
//#region src/node/rpc/functions/capabilities.d.ts
|
|
4
3
|
interface AssetsCapabilities {
|
|
@@ -11,7 +10,7 @@ interface AssetsCapabilities {
|
|
|
11
10
|
* instead of letting the user hit a "method not found" error, the same
|
|
12
11
|
* `canWrite`-gating idea the git plugin's `GitStatus.canWrite` follows.
|
|
13
12
|
*/
|
|
14
|
-
declare const capabilities: {
|
|
13
|
+
export declare const capabilities: {
|
|
15
14
|
name: "devframes:plugin:assets:capabilities";
|
|
16
15
|
type?: "query" | undefined;
|
|
17
16
|
cacheable?: boolean;
|
|
@@ -25,7 +24,7 @@ declare const capabilities: {
|
|
|
25
24
|
}>;
|
|
26
25
|
jsonSerializable?: boolean;
|
|
27
26
|
agent?: import("devframe").RpcFunctionAgentOptions;
|
|
28
|
-
setup?: ((context: DevframeNodeContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[], import("devframe/rpc").Thenable<{
|
|
27
|
+
setup?: ((context: import("devframe").DevframeNodeContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[], import("devframe/rpc").Thenable<{
|
|
29
28
|
write: boolean;
|
|
30
29
|
uploadExtensions: string[] | "*";
|
|
31
30
|
}>>>) | undefined;
|
|
@@ -36,7 +35,7 @@ declare const capabilities: {
|
|
|
36
35
|
dump?: import("devframe/rpc").RpcDump<[], import("devframe/rpc").Thenable<{
|
|
37
36
|
write: boolean;
|
|
38
37
|
uploadExtensions: string[] | "*";
|
|
39
|
-
}>, DevframeNodeContext> | undefined;
|
|
38
|
+
}>, import("devframe").DevframeNodeContext> | undefined;
|
|
40
39
|
snapshot?: boolean;
|
|
41
40
|
__cache?: WeakMap<object, import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[], import("devframe/rpc").Thenable<{
|
|
42
41
|
write: boolean;
|
|
@@ -50,7 +49,7 @@ declare const capabilities: {
|
|
|
50
49
|
//#endregion
|
|
51
50
|
//#region src/node/rpc/functions/delete.d.ts
|
|
52
51
|
/** One request covers both single- and multi-select delete. */
|
|
53
|
-
declare const deleteAssets: {
|
|
52
|
+
export declare const deleteAssets: {
|
|
54
53
|
name: "devframes:plugin:assets:delete";
|
|
55
54
|
type?: "action" | undefined;
|
|
56
55
|
cacheable?: boolean;
|
|
@@ -66,7 +65,7 @@ declare const deleteAssets: {
|
|
|
66
65
|
}>;
|
|
67
66
|
jsonSerializable?: boolean;
|
|
68
67
|
agent?: import("devframe").RpcFunctionAgentOptions;
|
|
69
|
-
setup?: ((context: DevframeNodeContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[{
|
|
68
|
+
setup?: ((context: import("devframe").DevframeNodeContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[{
|
|
70
69
|
paths: string[];
|
|
71
70
|
}], import("devframe/rpc").Thenable<{
|
|
72
71
|
deleted: string[];
|
|
@@ -80,7 +79,7 @@ declare const deleteAssets: {
|
|
|
80
79
|
paths: string[];
|
|
81
80
|
}], import("devframe/rpc").Thenable<{
|
|
82
81
|
deleted: string[];
|
|
83
|
-
}>, DevframeNodeContext> | undefined;
|
|
82
|
+
}>, import("devframe").DevframeNodeContext> | undefined;
|
|
84
83
|
snapshot?: boolean;
|
|
85
84
|
__cache?: WeakMap<object, import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[{
|
|
86
85
|
paths: string[];
|
|
@@ -95,7 +94,7 @@ declare const deleteAssets: {
|
|
|
95
94
|
};
|
|
96
95
|
//#endregion
|
|
97
96
|
//#region src/node/rpc/functions/list.d.ts
|
|
98
|
-
declare const assetInfoSchema: import("devframe/utils/simple-schema").SimpleSchema<{
|
|
97
|
+
export declare const assetInfoSchema: import("devframe/utils/simple-schema").SimpleSchema<{
|
|
99
98
|
path: string;
|
|
100
99
|
type: "image" | "font" | "video" | "audio" | "text" | "other";
|
|
101
100
|
publicPath: string;
|
|
@@ -110,7 +109,7 @@ declare const assetInfoSchema: import("devframe/utils/simple-schema").SimpleSche
|
|
|
110
109
|
mtime: number;
|
|
111
110
|
fsPath?: string | undefined;
|
|
112
111
|
}>;
|
|
113
|
-
declare const list: {
|
|
112
|
+
export declare const list: {
|
|
114
113
|
name: "devframes:plugin:assets:list";
|
|
115
114
|
type?: "query" | undefined;
|
|
116
115
|
cacheable?: boolean;
|
|
@@ -132,7 +131,7 @@ declare const list: {
|
|
|
132
131
|
}[]>;
|
|
133
132
|
jsonSerializable?: boolean;
|
|
134
133
|
agent?: import("devframe").RpcFunctionAgentOptions;
|
|
135
|
-
setup?: ((context: DevframeNodeContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[], import("devframe/rpc").Thenable<{
|
|
134
|
+
setup?: ((context: import("devframe").DevframeNodeContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[], import("devframe/rpc").Thenable<{
|
|
136
135
|
path: string;
|
|
137
136
|
type: "image" | "font" | "video" | "audio" | "text" | "other";
|
|
138
137
|
publicPath: string;
|
|
@@ -155,7 +154,7 @@ declare const list: {
|
|
|
155
154
|
size: number;
|
|
156
155
|
mtime: number;
|
|
157
156
|
fsPath?: string | undefined;
|
|
158
|
-
}[]>, DevframeNodeContext> | undefined;
|
|
157
|
+
}[]>, import("devframe").DevframeNodeContext> | undefined;
|
|
159
158
|
snapshot?: boolean;
|
|
160
159
|
__cache?: WeakMap<object, import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[], import("devframe/rpc").Thenable<{
|
|
161
160
|
path: string;
|
|
@@ -176,7 +175,7 @@ declare const list: {
|
|
|
176
175
|
};
|
|
177
176
|
//#endregion
|
|
178
177
|
//#region src/node/rpc/functions/mkdir.d.ts
|
|
179
|
-
declare const mkdir: {
|
|
178
|
+
export declare const mkdir: {
|
|
180
179
|
name: "devframes:plugin:assets:mkdir";
|
|
181
180
|
type?: "action" | undefined;
|
|
182
181
|
cacheable?: boolean;
|
|
@@ -188,7 +187,7 @@ declare const mkdir: {
|
|
|
188
187
|
returns: import("devframe/utils/simple-schema").SimpleSchema<void, void>;
|
|
189
188
|
jsonSerializable?: boolean;
|
|
190
189
|
agent?: import("devframe").RpcFunctionAgentOptions;
|
|
191
|
-
setup?: ((context: DevframeNodeContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[{
|
|
190
|
+
setup?: ((context: import("devframe").DevframeNodeContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[{
|
|
192
191
|
path: string;
|
|
193
192
|
}], import("devframe/rpc").Thenable<void>>>) | undefined;
|
|
194
193
|
handler?: ((args_0: {
|
|
@@ -196,7 +195,7 @@ declare const mkdir: {
|
|
|
196
195
|
}) => import("devframe/rpc").Thenable<void>) | undefined;
|
|
197
196
|
dump?: import("devframe/rpc").RpcDump<[{
|
|
198
197
|
path: string;
|
|
199
|
-
}], import("devframe/rpc").Thenable<void>, DevframeNodeContext> | undefined;
|
|
198
|
+
}], import("devframe/rpc").Thenable<void>, import("devframe").DevframeNodeContext> | undefined;
|
|
200
199
|
snapshot?: boolean;
|
|
201
200
|
__cache?: WeakMap<object, import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[{
|
|
202
201
|
path: string;
|
|
@@ -207,7 +206,7 @@ declare const mkdir: {
|
|
|
207
206
|
};
|
|
208
207
|
//#endregion
|
|
209
208
|
//#region src/node/rpc/functions/read-image-meta.d.ts
|
|
210
|
-
declare const readImageMeta: {
|
|
209
|
+
export declare const readImageMeta: {
|
|
211
210
|
name: "devframes:plugin:assets:read-image-meta";
|
|
212
211
|
type?: "query" | undefined;
|
|
213
212
|
cacheable?: boolean;
|
|
@@ -223,7 +222,7 @@ declare const readImageMeta: {
|
|
|
223
222
|
} | null>;
|
|
224
223
|
jsonSerializable?: boolean;
|
|
225
224
|
agent?: import("devframe").RpcFunctionAgentOptions;
|
|
226
|
-
setup?: ((context: DevframeNodeContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[string], import("devframe/rpc").Thenable<{
|
|
225
|
+
setup?: ((context: import("devframe").DevframeNodeContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[string], import("devframe/rpc").Thenable<{
|
|
227
226
|
width?: number | undefined;
|
|
228
227
|
height?: number | undefined;
|
|
229
228
|
orientation?: number | undefined;
|
|
@@ -237,7 +236,7 @@ declare const readImageMeta: {
|
|
|
237
236
|
width?: number | undefined;
|
|
238
237
|
height?: number | undefined;
|
|
239
238
|
orientation?: number | undefined;
|
|
240
|
-
} | null>, DevframeNodeContext> | undefined;
|
|
239
|
+
} | null>, import("devframe").DevframeNodeContext> | undefined;
|
|
241
240
|
snapshot?: boolean;
|
|
242
241
|
__cache?: WeakMap<object, import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[string], import("devframe/rpc").Thenable<{
|
|
243
242
|
width?: number | undefined;
|
|
@@ -252,7 +251,7 @@ declare const readImageMeta: {
|
|
|
252
251
|
};
|
|
253
252
|
//#endregion
|
|
254
253
|
//#region src/node/rpc/functions/read-text.d.ts
|
|
255
|
-
declare const readText: {
|
|
254
|
+
export declare const readText: {
|
|
256
255
|
name: "devframes:plugin:assets:read-text";
|
|
257
256
|
type?: "query" | undefined;
|
|
258
257
|
cacheable?: boolean;
|
|
@@ -260,9 +259,9 @@ declare const readText: {
|
|
|
260
259
|
returns: import("devframe/utils/simple-schema").SimpleSchema<string | null, string | null>;
|
|
261
260
|
jsonSerializable?: boolean;
|
|
262
261
|
agent?: import("devframe").RpcFunctionAgentOptions;
|
|
263
|
-
setup?: ((context: DevframeNodeContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[string, number | undefined], import("devframe/rpc").Thenable<string | null>>>) | undefined;
|
|
262
|
+
setup?: ((context: import("devframe").DevframeNodeContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[string, number | undefined], import("devframe/rpc").Thenable<string | null>>>) | undefined;
|
|
264
263
|
handler?: ((args_0: string, args_1: number | undefined) => import("devframe/rpc").Thenable<string | null>) | undefined;
|
|
265
|
-
dump?: import("devframe/rpc").RpcDump<[string, number | undefined], import("devframe/rpc").Thenable<string | null>, DevframeNodeContext> | undefined;
|
|
264
|
+
dump?: import("devframe/rpc").RpcDump<[string, number | undefined], import("devframe/rpc").Thenable<string | null>, import("devframe").DevframeNodeContext> | undefined;
|
|
266
265
|
snapshot?: boolean;
|
|
267
266
|
__cache?: WeakMap<object, import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[string, number | undefined], import("devframe/rpc").Thenable<string | null>>>> | undefined;
|
|
268
267
|
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[string, number | undefined], import("devframe/rpc").Thenable<string | null>>> | undefined;
|
|
@@ -280,7 +279,7 @@ interface RenameArgs {
|
|
|
280
279
|
*/
|
|
281
280
|
newName: string;
|
|
282
281
|
}
|
|
283
|
-
declare const rename: {
|
|
282
|
+
export declare const rename: {
|
|
284
283
|
name: "devframes:plugin:assets:rename";
|
|
285
284
|
type?: "action" | undefined;
|
|
286
285
|
cacheable?: boolean;
|
|
@@ -308,7 +307,7 @@ declare const rename: {
|
|
|
308
307
|
}>;
|
|
309
308
|
jsonSerializable?: boolean;
|
|
310
309
|
agent?: import("devframe").RpcFunctionAgentOptions;
|
|
311
|
-
setup?: ((context: DevframeNodeContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[{
|
|
310
|
+
setup?: ((context: import("devframe").DevframeNodeContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[{
|
|
312
311
|
path: string;
|
|
313
312
|
newName: string;
|
|
314
313
|
}], import("devframe/rpc").Thenable<{
|
|
@@ -340,7 +339,7 @@ declare const rename: {
|
|
|
340
339
|
size: number;
|
|
341
340
|
mtime: number;
|
|
342
341
|
fsPath?: string | undefined;
|
|
343
|
-
}>, DevframeNodeContext> | undefined;
|
|
342
|
+
}>, import("devframe").DevframeNodeContext> | undefined;
|
|
344
343
|
snapshot?: boolean;
|
|
345
344
|
__cache?: WeakMap<object, import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[{
|
|
346
345
|
path: string;
|
|
@@ -368,13 +367,13 @@ declare const rename: {
|
|
|
368
367
|
//#endregion
|
|
369
368
|
//#region src/node/rpc/functions/upload.d.ts
|
|
370
369
|
/** Streaming channel name, namespaced like every other RPC name in this plugin. */
|
|
371
|
-
declare const UPLOAD_CHANNEL = "devframes:plugin:assets:upload";
|
|
370
|
+
export declare const UPLOAD_CHANNEL = "devframes:plugin:assets:upload";
|
|
372
371
|
/**
|
|
373
372
|
* Allocates an upload and returns a streaming id. Actual bytes flow over
|
|
374
373
|
* the `upload` channel opened in `setupAssets`; see the client-side
|
|
375
374
|
* `useUpload` hook for the matching `rpc.streaming.upload()` call.
|
|
376
375
|
*/
|
|
377
|
-
declare const upload: {
|
|
376
|
+
export declare const upload: {
|
|
378
377
|
name: "devframes:plugin:assets:upload";
|
|
379
378
|
type?: "action" | undefined;
|
|
380
379
|
cacheable?: boolean;
|
|
@@ -390,7 +389,7 @@ declare const upload: {
|
|
|
390
389
|
}>;
|
|
391
390
|
jsonSerializable?: boolean;
|
|
392
391
|
agent?: import("devframe").RpcFunctionAgentOptions;
|
|
393
|
-
setup?: ((context: DevframeNodeContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[{
|
|
392
|
+
setup?: ((context: import("devframe").DevframeNodeContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[{
|
|
394
393
|
path: string;
|
|
395
394
|
}], import("devframe/rpc").Thenable<{
|
|
396
395
|
uploadId: string;
|
|
@@ -404,7 +403,7 @@ declare const upload: {
|
|
|
404
403
|
path: string;
|
|
405
404
|
}], import("devframe/rpc").Thenable<{
|
|
406
405
|
uploadId: string;
|
|
407
|
-
}>, DevframeNodeContext> | undefined;
|
|
406
|
+
}>, import("devframe").DevframeNodeContext> | undefined;
|
|
408
407
|
snapshot?: boolean;
|
|
409
408
|
__cache?: WeakMap<object, import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[{
|
|
410
409
|
path: string;
|
|
@@ -420,7 +419,7 @@ declare const upload: {
|
|
|
420
419
|
//#endregion
|
|
421
420
|
//#region src/node/rpc/index.d.ts
|
|
422
421
|
/** Read-only RPC, always registered. */
|
|
423
|
-
declare const readFunctions: readonly [{
|
|
422
|
+
export declare const readFunctions: readonly [{
|
|
424
423
|
name: "devframes:plugin:assets:list";
|
|
425
424
|
type?: "query" | undefined;
|
|
426
425
|
cacheable?: boolean;
|
|
@@ -576,7 +575,7 @@ declare const readFunctions: readonly [{
|
|
|
576
575
|
}>>> | undefined;
|
|
577
576
|
}];
|
|
578
577
|
/** Mutating RPC, registered only when write actions are enabled. */
|
|
579
|
-
declare const writeFunctions: readonly [{
|
|
578
|
+
export declare const writeFunctions: readonly [{
|
|
580
579
|
name: "devframes:plugin:assets:upload";
|
|
581
580
|
type?: "action" | undefined;
|
|
582
581
|
cacheable?: boolean;
|
|
@@ -773,7 +772,7 @@ declare const writeFunctions: readonly [{
|
|
|
773
772
|
path: string;
|
|
774
773
|
}], import("devframe/rpc").Thenable<void>>> | undefined;
|
|
775
774
|
}];
|
|
776
|
-
declare const serverFunctions: readonly [{
|
|
775
|
+
export declare const serverFunctions: readonly [{
|
|
777
776
|
name: "devframes:plugin:assets:list";
|
|
778
777
|
type?: "query" | undefined;
|
|
779
778
|
cacheable?: boolean;
|
|
@@ -1128,4 +1127,4 @@ declare module 'devframe' {
|
|
|
1128
1127
|
interface DevframeRpcServerFunctions extends RpcDefinitionsToFunctions<typeof serverFunctions> {}
|
|
1129
1128
|
}
|
|
1130
1129
|
//#endregion
|
|
1131
|
-
export {
|
|
1130
|
+
export type { AssetsCapabilities, RenameArgs };
|
package/dist/node/rpc/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as readText, c as assetInfoSchema, f as deleteAssets, h as upload, i as rename, l as list, m as UPLOAD_CHANNEL, n as serverFunctions, o as readImageMeta, p as capabilities, r as writeFunctions, s as mkdir, t as readFunctions } from "../../rpc-
|
|
1
|
+
import { a as readText, c as assetInfoSchema, f as deleteAssets, h as upload, i as rename, l as list, m as UPLOAD_CHANNEL, n as serverFunctions, o as readImageMeta, p as capabilities, r as writeFunctions, s as mkdir, t as readFunctions } from "../../rpc-G5ynmiLP.mjs";
|
|
2
2
|
export { UPLOAD_CHANNEL, assetInfoSchema, capabilities, deleteAssets, list, mkdir, readFunctions, readImageMeta, readText, rename, serverFunctions, upload, writeFunctions };
|
package/dist/node/setup.d.mts
CHANGED
|
@@ -30,13 +30,13 @@ interface AssetsContext extends AssetsConfig {
|
|
|
30
30
|
* Record the managed directory and write policy for a context. Called from
|
|
31
31
|
* the devframe's `setup` before any RPC handler runs.
|
|
32
32
|
*/
|
|
33
|
-
declare function configureAssets(ctx: DevframeNodeContext, config: AssetsConfig): void;
|
|
33
|
+
export declare function configureAssets(ctx: DevframeNodeContext, config: AssetsConfig): void;
|
|
34
34
|
/**
|
|
35
35
|
* Per-`DevframeNodeContext` assets state. Each RPC function pulls its
|
|
36
36
|
* managed directory and path resolver from here instead of re-reading
|
|
37
37
|
* `configureAssets`'s config on every call.
|
|
38
38
|
*/
|
|
39
|
-
declare function getAssetsContext(ctx: DevframeNodeContext): AssetsContext;
|
|
39
|
+
export declare function getAssetsContext(ctx: DevframeNodeContext): AssetsContext;
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/node/paths.d.ts
|
|
42
42
|
/**
|
|
@@ -46,16 +46,16 @@ declare function getAssetsContext(ctx: DevframeNodeContext): AssetsContext;
|
|
|
46
46
|
* symlink-aware containment is layered on by {@link resolveAssetReadPath}
|
|
47
47
|
* (reads) and {@link assertAssetMutationPath} (mutations).
|
|
48
48
|
*/
|
|
49
|
-
declare function resolveAssetPath(root: string, relativePath: string): string;
|
|
49
|
+
export declare function resolveAssetPath(root: string, relativePath: string): string;
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/node/scanner.d.ts
|
|
52
52
|
/** Classifies a path by extension, driving preview and icon choice. */
|
|
53
|
-
declare function guessAssetType(path: string): AssetType;
|
|
53
|
+
export declare function guessAssetType(path: string): AssetType;
|
|
54
54
|
/** Recursively lists every file under `dir`, sorted alphabetically by path. */
|
|
55
|
-
declare function scanAssets(dir: string, baseURL: string, includeFsPath?: boolean): Promise<AssetInfo[]>;
|
|
55
|
+
export declare function scanAssets(dir: string, baseURL: string, includeFsPath?: boolean): Promise<AssetInfo[]>;
|
|
56
56
|
//#endregion
|
|
57
57
|
//#region src/node/setup.d.ts
|
|
58
|
-
interface SetupAssetsOptions {
|
|
58
|
+
export interface SetupAssetsOptions {
|
|
59
59
|
/** Directory this devframe manages. */
|
|
60
60
|
dir: string;
|
|
61
61
|
/** Whether upload / rename / delete / mkdir are registered. */
|
|
@@ -91,12 +91,11 @@ interface SetupAssetsOptions {
|
|
|
91
91
|
* Called from the definition's `setup(ctx)` and reusable by host adapters
|
|
92
92
|
* that wire their own context.
|
|
93
93
|
*/
|
|
94
|
-
declare function setupAssets(ctx: DevframeNodeContext, options: SetupAssetsOptions): Promise<void>;
|
|
94
|
+
export declare function setupAssets(ctx: DevframeNodeContext, options: SetupAssetsOptions): Promise<void>;
|
|
95
95
|
/**
|
|
96
96
|
* Stop the live file watcher started by {@link setupAssets}. Test harnesses
|
|
97
97
|
* wrap their dev-server `close()` with this (see `test/_utils.ts`), so a
|
|
98
98
|
* leaked chokidar watcher doesn't keep the process alive.
|
|
99
99
|
*/
|
|
100
|
-
declare function disposeAssetsWatcher(ctx: DevframeNodeContext): Promise<void>;
|
|
101
|
-
//#endregion
|
|
102
|
-
export { SetupAssetsOptions, configureAssets, disposeAssetsWatcher, getAssetsContext, guessAssetType, resolveAssetPath, scanAssets, setupAssets };
|
|
100
|
+
export declare function disposeAssetsWatcher(ctx: DevframeNodeContext): Promise<void>;
|
|
101
|
+
//#endregion
|
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-D6v6l0Ri.mjs";
|
|
2
|
+
import { _ as getAssetsContext, d as scanAssets, g as configureAssets, u as guessAssetType, v as resolveAssetPath } from "../rpc-G5ynmiLP.mjs";
|
|
3
3
|
export { configureAssets, disposeAssetsWatcher, getAssetsContext, guessAssetType, resolveAssetPath, scanAssets, setupAssets };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as setupAssets } from "./setup-
|
|
1
|
+
import { n as setupAssets } from "./setup-D6v6l0Ri.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import { defineDevframe } from "devframe";
|
|
4
4
|
import { resolve } from "pathe";
|
|
5
5
|
//#region package.json
|
|
6
6
|
var name = "@devframes/plugin-assets";
|
|
7
|
-
var version = "0.9.
|
|
7
|
+
var version = "0.9.15";
|
|
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
10
|
//#endregion
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { defineRpcFunction } from "devframe";
|
|
1
2
|
import { dirname, extname, join, normalize, resolve } from "pathe";
|
|
2
3
|
import { createWriteStream } from "node:fs";
|
|
3
4
|
import fsp from "node:fs/promises";
|
|
4
5
|
import { defineDiagnostics } from "devframe/utils/nostics";
|
|
5
|
-
import { createDefineWrapperWithContext } from "devframe/rpc";
|
|
6
6
|
import { s } from "devframe/utils/simple-schema";
|
|
7
7
|
import { glob } from "tinyglobby";
|
|
8
8
|
import { joinURL } from "ufo";
|
|
@@ -138,7 +138,6 @@ function getAssetsContext(ctx) {
|
|
|
138
138
|
}
|
|
139
139
|
//#endregion
|
|
140
140
|
//#region src/node/rpc/functions/upload.ts
|
|
141
|
-
const defineAssetsRpc$7 = createDefineWrapperWithContext();
|
|
142
141
|
/** Streaming channel name, namespaced like every other RPC name in this plugin. */
|
|
143
142
|
const UPLOAD_CHANNEL = "devframes:plugin:assets:upload";
|
|
144
143
|
function isExtensionAllowed(path, allowed) {
|
|
@@ -151,7 +150,7 @@ function isExtensionAllowed(path, allowed) {
|
|
|
151
150
|
* the `upload` channel opened in `setupAssets`; see the client-side
|
|
152
151
|
* `useUpload` hook for the matching `rpc.streaming.upload()` call.
|
|
153
152
|
*/
|
|
154
|
-
const upload =
|
|
153
|
+
const upload = defineRpcFunction({
|
|
155
154
|
name: "devframes:plugin:assets:upload",
|
|
156
155
|
type: "action",
|
|
157
156
|
jsonSerializable: true,
|
|
@@ -194,13 +193,15 @@ handler: (async ({ path }) => {
|
|
|
194
193
|
}) };
|
|
195
194
|
}
|
|
196
195
|
});
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/node/rpc/functions/capabilities.ts
|
|
197
198
|
/**
|
|
198
199
|
* Lets the UI know upfront whether upload / rename / delete / mkdir are
|
|
199
200
|
* available, so it can hide or disable those affordances proactively
|
|
200
201
|
* instead of letting the user hit a "method not found" error, the same
|
|
201
202
|
* `canWrite`-gating idea the git plugin's `GitStatus.canWrite` follows.
|
|
202
203
|
*/
|
|
203
|
-
const capabilities =
|
|
204
|
+
const capabilities = defineRpcFunction({
|
|
204
205
|
name: "devframes:plugin:assets:capabilities",
|
|
205
206
|
type: "query",
|
|
206
207
|
snapshot: true,
|
|
@@ -224,8 +225,10 @@ const capabilities = createDefineWrapperWithContext()({
|
|
|
224
225
|
})) };
|
|
225
226
|
}
|
|
226
227
|
});
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/node/rpc/functions/delete.ts
|
|
227
230
|
/** One request covers both single- and multi-select delete. */
|
|
228
|
-
const deleteAssets =
|
|
231
|
+
const deleteAssets = defineRpcFunction({
|
|
229
232
|
name: "devframes:plugin:assets:delete",
|
|
230
233
|
type: "action",
|
|
231
234
|
jsonSerializable: true,
|
|
@@ -312,7 +315,6 @@ async function scanAssets(dir, baseURL, includeFsPath = false) {
|
|
|
312
315
|
}
|
|
313
316
|
//#endregion
|
|
314
317
|
//#region src/node/rpc/functions/list.ts
|
|
315
|
-
const defineAssetsRpc$4 = createDefineWrapperWithContext();
|
|
316
318
|
const assetInfoSchema = s.object({
|
|
317
319
|
path: s.string(),
|
|
318
320
|
type: s.picklist([
|
|
@@ -328,7 +330,7 @@ const assetInfoSchema = s.object({
|
|
|
328
330
|
mtime: s.number(),
|
|
329
331
|
fsPath: s.optional(s.string())
|
|
330
332
|
});
|
|
331
|
-
const list =
|
|
333
|
+
const list = defineRpcFunction({
|
|
332
334
|
name: "devframes:plugin:assets:list",
|
|
333
335
|
type: "query",
|
|
334
336
|
snapshot: true,
|
|
@@ -353,7 +355,9 @@ const list = defineAssetsRpc$4({
|
|
|
353
355
|
handler: (async () => scanAssets(assets.dir, assets.baseURL, ctx.mode === "dev")) };
|
|
354
356
|
}
|
|
355
357
|
});
|
|
356
|
-
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/node/rpc/functions/mkdir.ts
|
|
360
|
+
const mkdir = defineRpcFunction({
|
|
357
361
|
name: "devframes:plugin:assets:mkdir",
|
|
358
362
|
type: "action",
|
|
359
363
|
jsonSerializable: true,
|
|
@@ -378,7 +382,9 @@ handler: (async ({ path }) => {
|
|
|
378
382
|
}) };
|
|
379
383
|
}
|
|
380
384
|
});
|
|
381
|
-
|
|
385
|
+
//#endregion
|
|
386
|
+
//#region src/node/rpc/functions/read-image-meta.ts
|
|
387
|
+
const readImageMeta = defineRpcFunction({
|
|
382
388
|
name: "devframes:plugin:assets:read-image-meta",
|
|
383
389
|
type: "query",
|
|
384
390
|
jsonSerializable: true,
|
|
@@ -415,9 +421,8 @@ handler: (async (path) => {
|
|
|
415
421
|
});
|
|
416
422
|
//#endregion
|
|
417
423
|
//#region src/node/rpc/functions/read-text.ts
|
|
418
|
-
const defineAssetsRpc$1 = createDefineWrapperWithContext();
|
|
419
424
|
const DEFAULT_LIMIT = 5e3;
|
|
420
|
-
const readText =
|
|
425
|
+
const readText = defineRpcFunction({
|
|
421
426
|
name: "devframes:plugin:assets:read-text",
|
|
422
427
|
type: "query",
|
|
423
428
|
jsonSerializable: true,
|
|
@@ -442,7 +447,9 @@ handler: (async (path, limit = DEFAULT_LIMIT) => {
|
|
|
442
447
|
}) };
|
|
443
448
|
}
|
|
444
449
|
});
|
|
445
|
-
|
|
450
|
+
//#endregion
|
|
451
|
+
//#region src/node/rpc/functions/rename.ts
|
|
452
|
+
const rename = defineRpcFunction({
|
|
446
453
|
name: "devframes:plugin:assets:rename",
|
|
447
454
|
type: "action",
|
|
448
455
|
jsonSerializable: true,
|
|
@@ -1,4 +1,4 @@
|
|
|
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-G5ynmiLP.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import fsp from "node:fs/promises";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devframes/plugin-assets",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.15",
|
|
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": "0.9.
|
|
40
|
-
"@devframes/service-shiki": "0.9.
|
|
41
|
-
"devframe": "0.9.
|
|
39
|
+
"@devframes/plugin-assets--assets": "0.9.15",
|
|
40
|
+
"@devframes/service-shiki": "0.9.15",
|
|
41
|
+
"devframe": "0.9.15",
|
|
42
42
|
"vite": "^7.0.0 || ^8.0.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@devframes/service-open": "0.9.
|
|
56
|
+
"@devframes/service-open": "0.9.15",
|
|
57
57
|
"cac": "^7.0.0",
|
|
58
58
|
"chokidar": "^5.0.0",
|
|
59
59
|
"image-meta": "^0.2.2",
|
|
@@ -64,25 +64,25 @@
|
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@antfu/design": "^0.4.0",
|
|
67
|
-
"@devframes/plugin-assets--assets": "0.9.
|
|
68
|
-
"@devframes/service-shiki": "0.9.
|
|
69
|
-
"@devframes/vite": "0.9.
|
|
67
|
+
"@devframes/plugin-assets--assets": "0.9.15",
|
|
68
|
+
"@devframes/service-shiki": "0.9.15",
|
|
69
|
+
"@devframes/vite": "0.9.15",
|
|
70
70
|
"@iconify-json/ph": "^1.2.2",
|
|
71
|
-
"@storybook/addon-a11y": "^10.
|
|
72
|
-
"@storybook/addon-docs": "^10.
|
|
73
|
-
"@storybook/vue3-vite": "^10.
|
|
74
|
-
"@types/node": "^26.
|
|
71
|
+
"@storybook/addon-a11y": "^10.6.0",
|
|
72
|
+
"@storybook/addon-docs": "^10.6.0",
|
|
73
|
+
"@storybook/vue3-vite": "^10.6.0",
|
|
74
|
+
"@types/node": "^26.5.0",
|
|
75
75
|
"@vitejs/plugin-vue": "^6.0.8",
|
|
76
76
|
"colorjs.io": "^0.7.1",
|
|
77
|
-
"devframe": "0.9.
|
|
77
|
+
"devframe": "0.9.15",
|
|
78
78
|
"floating-vue": "^5.2.2",
|
|
79
|
-
"h3": "^2.0.1-rc.
|
|
79
|
+
"h3": "^2.0.1-rc.31",
|
|
80
80
|
"reka-ui": "^2.10.4",
|
|
81
|
-
"storybook": "^10.
|
|
82
|
-
"tsdown": "^0.
|
|
83
|
-
"unocss": "^66.
|
|
81
|
+
"storybook": "^10.6.0",
|
|
82
|
+
"tsdown": "^0.23.0",
|
|
83
|
+
"unocss": "^66.10.0",
|
|
84
84
|
"vite": "^8.2.2",
|
|
85
|
-
"vitest": "^
|
|
85
|
+
"vitest": "^5.0.0",
|
|
86
86
|
"vue": "^3.5.42"
|
|
87
87
|
},
|
|
88
88
|
"scripts": {
|