@devframes/plugin-assets 0.9.0-beta.9 → 0.9.1
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/cli.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/node/index.mjs +2 -2
- package/dist/{node-BvtIJMoW.mjs → node-DUay0toc.mjs} +1 -1
- package/dist/rpc/index.mjs +1 -1
- package/dist/{rpc-CNe8lZPf.mjs → rpc-BObgi2mL.mjs} +4 -2
- package/dist/{src-DsR2iHua.mjs → src-BTiBbgej.mjs} +4 -3
- package/package.json +6 -7
package/dist/cli.mjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, t as createAssetsDevframe } from "./src-
|
|
1
|
+
import { n as DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, t as createAssetsDevframe } from "./src-BTiBbgej.mjs";
|
|
2
2
|
export { DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, createAssetsDevframe, createAssetsDevframe as default };
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as setupAssets, t as disposeAssetsWatcher } from "../node-
|
|
2
|
-
import { b as getAssetsContext, m as scanAssets, p as guessAssetType, x as resolveAssetPath, y as configureAssets } from "../rpc-
|
|
1
|
+
import { n as setupAssets, t as disposeAssetsWatcher } from "../node-DUay0toc.mjs";
|
|
2
|
+
import { b as getAssetsContext, m as scanAssets, p as guessAssetType, x as resolveAssetPath, y as configureAssets } from "../rpc-BObgi2mL.mjs";
|
|
3
3
|
export { configureAssets, disposeAssetsWatcher, getAssetsContext, guessAssetType, resolveAssetPath, scanAssets, setupAssets };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as UPLOAD_CHANNEL, i as writeFunctions, n as readFunctions, t as alwaysFunctions, y as configureAssets } from "./rpc-
|
|
1
|
+
import { _ as UPLOAD_CHANNEL, i as writeFunctions, n as readFunctions, t as alwaysFunctions, y as configureAssets } from "./rpc-BObgi2mL.mjs";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import fsp from "node:fs/promises";
|
|
4
4
|
import process from "node:process";
|
package/dist/rpc/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as UPLOAD_CHANNEL, a as revealInFolder, c as readImageMeta, d as assetInfoSchema, f as list, g as capabilities, h as deleteAssets, i as writeFunctions, l as openInEditor, n as readFunctions, o as rename, r as serverFunctions, s as readText, t as alwaysFunctions, u as mkdir, v as upload } from "../rpc-
|
|
1
|
+
import { _ as UPLOAD_CHANNEL, a as revealInFolder, c as readImageMeta, d as assetInfoSchema, f as list, g as capabilities, h as deleteAssets, i as writeFunctions, l as openInEditor, n as readFunctions, o as rename, r as serverFunctions, s as readText, t as alwaysFunctions, u as mkdir, v as upload } from "../rpc-BObgi2mL.mjs";
|
|
2
2
|
export { UPLOAD_CHANNEL, alwaysFunctions, assetInfoSchema, capabilities, deleteAssets, list, mkdir, openInEditor, readFunctions, readImageMeta, readText, rename, revealInFolder, serverFunctions, upload, writeFunctions };
|
|
@@ -223,7 +223,8 @@ function guessAssetType(path) {
|
|
|
223
223
|
return "other";
|
|
224
224
|
}
|
|
225
225
|
function toPublicPath(baseURL, posixPath) {
|
|
226
|
-
|
|
226
|
+
const encoded = posixPath.split("/").map(encodeURIComponent).join("/");
|
|
227
|
+
return joinURL(baseURL, encoded);
|
|
227
228
|
}
|
|
228
229
|
/** Builds an {@link AssetInfo} from an already-resolved `fs.Stats`. */
|
|
229
230
|
function statToAssetInfo(dir, baseURL, relPath, stat) {
|
|
@@ -353,7 +354,8 @@ const readImageMeta = createDefineWrapperWithContext()({
|
|
|
353
354
|
const assets = getAssetsContext(ctx);
|
|
354
355
|
return { handler: (async (path) => {
|
|
355
356
|
try {
|
|
356
|
-
const
|
|
357
|
+
const buffer = await fsp.readFile(assets.resolvePath(path));
|
|
358
|
+
const meta = imageMeta(buffer);
|
|
357
359
|
return {
|
|
358
360
|
width: meta.width,
|
|
359
361
|
height: meta.height,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as setupAssets } from "./node-
|
|
1
|
+
import { n as setupAssets } from "./node-DUay0toc.mjs";
|
|
2
2
|
import { defineDevframe } from "devframe";
|
|
3
3
|
import { resolve } from "pathe";
|
|
4
4
|
//#region package.json
|
|
5
5
|
var name = "@devframes/plugin-assets";
|
|
6
|
-
var version = "0.9.
|
|
6
|
+
var version = "0.9.1";
|
|
7
7
|
var description = "Devframe plugin for browsing, previewing, uploading, and managing static assets in a directory.";
|
|
8
8
|
var homepage = "https://github.com/devframes/devframe#readme";
|
|
9
9
|
//#endregion
|
|
@@ -74,8 +74,9 @@ function createAssetsDevframe(options = {}) {
|
|
|
74
74
|
dock: { category: "~builtin" },
|
|
75
75
|
async setup(ctx, info) {
|
|
76
76
|
const readOnlyFlag = info?.flags?.readOnly === true;
|
|
77
|
+
const dir = options.dir ? resolve(ctx.cwd, options.dir) : resolve(ctx.cwd, "public");
|
|
77
78
|
await setupAssets(ctx, {
|
|
78
|
-
dir
|
|
79
|
+
dir,
|
|
79
80
|
write: readOnlyFlag ? false : write,
|
|
80
81
|
uploadExtensions: options.uploadExtensions ?? DEFAULT_ALLOWED_UPLOAD_EXTENSIONS,
|
|
81
82
|
baseURL,
|
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.1",
|
|
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",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
],
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"vite": "^7.0.0 || ^8.0.0",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
41
|
+
"@devframes/plugin-assets--assets": "0.9.1",
|
|
42
|
+
"devframe": "0.9.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
45
45
|
"@devframes/plugin-assets--assets": {
|
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"@vitejs/plugin-vue": "^6.0.8",
|
|
69
69
|
"colorjs.io": "^0.7.1",
|
|
70
70
|
"floating-vue": "^5.2.2",
|
|
71
|
-
"get-port-please": "^3.2.0",
|
|
72
71
|
"h3": "^2.0.1-rc.26",
|
|
73
72
|
"reka-ui": "^2.10.3",
|
|
74
73
|
"storybook": "^10.5.7",
|
|
@@ -77,9 +76,9 @@
|
|
|
77
76
|
"vite": "^8.2.1",
|
|
78
77
|
"vitest": "^4.1.10",
|
|
79
78
|
"vue": "^3.5.41",
|
|
80
|
-
"@devframes/
|
|
81
|
-
"devframe": "0.9.
|
|
82
|
-
"@devframes/
|
|
79
|
+
"@devframes/vite": "0.9.1",
|
|
80
|
+
"devframe": "0.9.1",
|
|
81
|
+
"@devframes/plugin-assets--assets": "0.9.1"
|
|
83
82
|
},
|
|
84
83
|
"scripts": {
|
|
85
84
|
"build": "tsdown && vite build --config src/spa/vite.config.ts",
|