@devframes/plugin-assets 0.9.0-beta.4 → 0.9.0-beta.8

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/README.md CHANGED
@@ -6,7 +6,7 @@ Browse, preview, upload, rename, and delete the files in a directory — a frame
6
6
  pnpx @devframes/plugin-assets
7
7
  ```
8
8
 
9
- Manages `<cwd>/public` by default. The package exports `createAssetsDevframe()` for custom definitions and `assetsVitePlugin()` from `@devframes/plugin-assets/vite` for Vite hosts. Pass `{ dir }` to manage a different directory, `{ baseURL }` to match where the host serves it, or `{ write: false }` (`--read-only` on the standalone CLI) for a browse-only deployment.
9
+ Manages `<cwd>/public` by default. The package exports `createAssetsDevframe()` for custom definitions — mount it into a Vite host with `devframeVite()` from `@devframes/vite/single`. Pass `{ dir }` to manage a different directory, `{ baseURL }` to match where the host serves it, or `{ write: false }` (`--read-only` on the standalone CLI) for a browse-only deployment.
10
10
 
11
11
  Asset previews load files by their public URL, served by the host the plugin is mounted into (Vite/Nuxt/etc. already serve `public/` at `/`) — the plugin doesn't serve the bytes itself. The standalone CLI is its own host, so it serves the directory for you.
12
12
 
package/dist/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as createAssetsDevframe } from "./src-BS_BDvKC.mjs";
1
+ import { t as createAssetsDevframe } from "./src-BUQxHyBg.mjs";
2
2
  import { createCac } from "devframe/adapters/cac";
3
3
  //#region src/cli.ts
4
4
  function createAssetsCli() {
package/dist/index.d.mts CHANGED
@@ -75,6 +75,5 @@ interface AssetsDevframeOptions {
75
75
  * version bump until it stabilizes.
76
76
  */
77
77
  declare function createAssetsDevframe(options?: AssetsDevframeOptions): DevframeDefinition;
78
- declare const assetsDevframe: DevframeDefinition;
79
78
  //#endregion
80
- export { type AssetImageMeta, type AssetInfo, type AssetType, AssetsDevframeOptions, type CodeSnippet, DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, createAssetsDevframe, assetsDevframe as default };
79
+ export { type AssetImageMeta, type AssetInfo, type AssetType, AssetsDevframeOptions, type CodeSnippet, DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, createAssetsDevframe, createAssetsDevframe as default };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as createAssetsDevframe, r as DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, t as assetsDevframe } from "./src-BS_BDvKC.mjs";
2
- export { DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, createAssetsDevframe, assetsDevframe as default };
1
+ import { n as DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, t as createAssetsDevframe } from "./src-BUQxHyBg.mjs";
2
+ export { DEFAULT_ALLOWED_UPLOAD_EXTENSIONS, createAssetsDevframe, createAssetsDevframe as default };
@@ -1,3 +1,3 @@
1
- import { n as setupAssets, t as disposeAssetsWatcher } from "../node-BYWWO6JH.mjs";
2
- import { b as getAssetsContext, m as scanAssets, p as guessAssetType, x as resolveAssetPath, y as configureAssets } from "../rpc-BHri4K4-.mjs";
1
+ import { n as setupAssets, t as disposeAssetsWatcher } from "../node-BvtIJMoW.mjs";
2
+ import { b as getAssetsContext, m as scanAssets, p as guessAssetType, x as resolveAssetPath, y as configureAssets } from "../rpc-CNe8lZPf.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-BHri4K4-.mjs";
1
+ import { _ as UPLOAD_CHANNEL, i as writeFunctions, n as readFunctions, t as alwaysFunctions, y as configureAssets } from "./rpc-CNe8lZPf.mjs";
2
2
  import { existsSync } from "node:fs";
3
3
  import fsp from "node:fs/promises";
4
4
  import process from "node:process";
@@ -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-BHri4K4-.mjs";
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-CNe8lZPf.mjs";
2
2
  export { UPLOAD_CHANNEL, alwaysFunctions, assetInfoSchema, capabilities, deleteAssets, list, mkdir, openInEditor, readFunctions, readImageMeta, readText, rename, revealInFolder, serverFunctions, upload, writeFunctions };
@@ -3,7 +3,7 @@ import { createWriteStream } from "node:fs";
3
3
  import fsp from "node:fs/promises";
4
4
  import { createDefineWrapperWithContext } from "devframe/rpc";
5
5
  import { s } from "devframe/utils/simple-schema";
6
- import { defineDiagnostics } from "nostics";
6
+ import { defineDiagnostics } from "devframe/utils/nostics";
7
7
  import { glob } from "tinyglobby";
8
8
  import { joinURL } from "ufo";
9
9
  import { launchEditor } from "devframe/utils/launch-editor";
@@ -1,10 +1,9 @@
1
- import { n as setupAssets } from "./node-BYWWO6JH.mjs";
2
- import { fileURLToPath } from "node:url";
1
+ import { n as setupAssets } from "./node-BvtIJMoW.mjs";
3
2
  import { defineDevframe } from "devframe";
4
- import { dirname, resolve } from "pathe";
3
+ import { resolve } from "pathe";
5
4
  //#region package.json
6
5
  var name = "@devframes/plugin-assets";
7
- var version = "0.9.0-beta.4";
6
+ var version = "0.9.0-beta.8";
8
7
  var description = "Devframe plugin for browsing, previewing, uploading, and managing static assets in a directory.";
9
8
  var homepage = "https://github.com/devframes/devframe#readme";
10
9
  //#endregion
@@ -33,7 +32,11 @@ const DEFAULT_ALLOWED_UPLOAD_EXTENSIONS = [
33
32
  ];
34
33
  //#endregion
35
34
  //#region src/index.ts
36
- const PKG_ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
35
+ const remoteAssets = {
36
+ package: `${name}--assets`,
37
+ version,
38
+ resolveFrom: import.meta.url
39
+ };
37
40
  const DEFAULT_ID = "devframes_plugin_assets";
38
41
  /**
39
42
  * Create the assets manager devframe — a framework-neutral port of Nuxt
@@ -45,7 +48,7 @@ const DEFAULT_ID = "devframes_plugin_assets";
45
48
  */
46
49
  function createAssetsDevframe(options = {}) {
47
50
  const id = options.id ?? DEFAULT_ID;
48
- const distDir = options.distDir ?? resolve(PKG_ROOT, "dist/spa");
51
+ const distDir = options.distDir ?? remoteAssets;
49
52
  const write = options.write ?? true;
50
53
  const serveStatic = options.serveStatic ?? false;
51
54
  const baseURL = options.baseURL ?? (serveStatic ? `/__${id}-raw/` : "/");
@@ -68,7 +71,6 @@ function createAssetsDevframe(options = {}) {
68
71
  cli.option("--read-only", "Disable upload, rename, delete, and folder creation");
69
72
  }
70
73
  },
71
- spa: { loader: "none" },
72
74
  dock: { category: "~builtin" },
73
75
  async setup(ctx, info) {
74
76
  const readOnlyFlag = info?.flags?.readOnly === true;
@@ -83,6 +85,5 @@ function createAssetsDevframe(options = {}) {
83
85
  }
84
86
  });
85
87
  }
86
- const assetsDevframe = createAssetsDevframe();
87
88
  //#endregion
88
- export { createAssetsDevframe as n, DEFAULT_ALLOWED_UPLOAD_EXTENSIONS as r, assetsDevframe as t };
89
+ export { DEFAULT_ALLOWED_UPLOAD_EXTENSIONS as n, createAssetsDevframe as t };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@devframes/plugin-assets",
3
3
  "type": "module",
4
- "version": "0.9.0-beta.4",
4
+ "version": "0.9.0-beta.8",
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",
@@ -26,7 +26,6 @@
26
26
  "./cli": "./dist/cli.mjs",
27
27
  "./node": "./dist/node/index.mjs",
28
28
  "./rpc": "./dist/rpc/index.mjs",
29
- "./vite": "./dist/vite.mjs",
30
29
  "./package.json": "./package.json"
31
30
  },
32
31
  "types": "./dist/index.d.mts",
@@ -39,9 +38,13 @@
39
38
  ],
40
39
  "peerDependencies": {
41
40
  "vite": "^7.0.0 || ^8.0.0",
42
- "devframe": "0.9.0-beta.4"
41
+ "devframe": "0.9.0-beta.8",
42
+ "@devframes/plugin-assets--assets": "0.9.0-beta.8"
43
43
  },
44
44
  "peerDependenciesMeta": {
45
+ "@devframes/plugin-assets--assets": {
46
+ "optional": true
47
+ },
45
48
  "vite": {
46
49
  "optional": true
47
50
  }
@@ -50,12 +53,10 @@
50
53
  "cac": "^7.0.0",
51
54
  "chokidar": "^5.0.0",
52
55
  "image-meta": "^0.2.2",
53
- "nostics": "^1.2.0",
54
56
  "pathe": "^2.0.3",
55
57
  "perfect-debounce": "^2.1.0",
56
58
  "tinyglobby": "^0.2.17",
57
- "ufo": "^1.6.4",
58
- "@devframes/vite": "0.9.0-beta.4"
59
+ "ufo": "^1.6.4"
59
60
  },
60
61
  "devDependencies": {
61
62
  "@antfu/design": "^0.3.4",
@@ -76,7 +77,9 @@
76
77
  "vite": "^8.2.1",
77
78
  "vitest": "^4.1.10",
78
79
  "vue": "^3.5.41",
79
- "devframe": "0.9.0-beta.4"
80
+ "@devframes/plugin-assets--assets": "0.9.0-beta.8",
81
+ "@devframes/vite": "0.9.0-beta.8",
82
+ "devframe": "0.9.0-beta.8"
80
83
  },
81
84
  "scripts": {
82
85
  "build": "tsdown && vite build --config src/spa/vite.config.ts",