@riebeckite/plugin-attachment 0.0.34 → 0.0.36

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
@@ -41,9 +41,9 @@ The following source is rendered on this page. A plain wikilink becomes a downlo
41
41
 
42
42
  #### Rendered
43
43
 
44
- [attachment-example.txt](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/attachment-example.txt.md)
44
+ [attachment-example.txt](https://github.com/Rerurate514/riebeckite/blob/main/docs/assets/attachment-example.txt)
45
45
 
46
- ![attachment-example.txt](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/attachment-example.txt.md)
46
+ ![attachment-example.txt](https://github.com/Rerurate514/riebeckite/blob/main/docs/assets/attachment-example.txt)
47
47
 
48
48
  - Format is the uppercased file extension.
49
49
  - Size is read from disk under `config.content.directory` (path-traversal safe)
package/README_ja.md CHANGED
@@ -27,8 +27,8 @@ export default defineConfig({
27
27
 
28
28
  ## リンクと埋め込みの表示
29
29
 
30
- - `[attachment-example.txt](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/attachment-example.txt.ja.md)` は、`download` 属性を持つ通常のリンクになります。
31
- - `![attachment-example.txt](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/attachment-example.txt.ja.md)` は、拡張子、ファイル名、ダウンロードリンクを含む添付カードになります。
30
+ - `[attachment-example.txt](https://github.com/Rerurate514/riebeckite/blob/main/docs/assets/attachment-example.txt)` は、`download` 属性を持つ通常のリンクになります。
31
+ - `![attachment-example.txt](https://github.com/Rerurate514/riebeckite/blob/main/docs/assets/attachment-example.txt)` は、拡張子、ファイル名、ダウンロードリンクを含む添付カードになります。
32
32
 
33
33
  以下のソースは、このページ上で実際に描画されます。
34
34
 
@@ -42,9 +42,9 @@ export default defineConfig({
42
42
 
43
43
  #### 実行例
44
44
 
45
- [attachment-example.txt](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/attachment-example.txt.ja.md)
45
+ [attachment-example.txt](https://github.com/Rerurate514/riebeckite/blob/main/docs/assets/attachment-example.txt)
46
46
 
47
- ![attachment-example.txt](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/attachment-example.txt.ja.md)
47
+ ![attachment-example.txt](https://github.com/Rerurate514/riebeckite/blob/main/docs/assets/attachment-example.txt)
48
48
 
49
49
  - 形式は拡張子を大文字にしたものです。
50
50
  - カードのファイルサイズは `config.content.directory` 配下から読み取ります。パスは
package/dist/index.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  definePlugin,
4
4
  escapeHtml,
5
5
  escapeHtmlAttribute,
6
- getExtension,
7
- readContentSourceEntry
6
+ getContentSourceEntrySize,
7
+ getExtension
8
8
  } from "@riebeckite/core";
9
9
  var PLUGIN_NAME = "attachment";
10
10
  function attachment(options = {}) {
@@ -50,12 +50,11 @@ async function renderAttachment(context, options) {
50
50
  }
51
51
  async function getAttachmentSize(context) {
52
52
  if (!context.contentSource) return null;
53
- const content = await readContentSourceEntry(
53
+ const bytes = await getContentSourceEntrySize(
54
54
  context.contentSource,
55
55
  context.path
56
56
  );
57
- if (content === null) return null;
58
- const bytes = typeof content === "string" ? new TextEncoder().encode(content).byteLength : content.byteLength;
57
+ if (bytes === null) return null;
59
58
  return formatBytes(bytes);
60
59
  }
61
60
  function getFileName(contentPath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/plugin-attachment",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,7 +15,7 @@
15
15
  "./style.css": "./style.css"
16
16
  },
17
17
  "dependencies": {
18
- "@riebeckite/core": "0.0.34"
18
+ "@riebeckite/core": "0.0.36"
19
19
  },
20
20
  "devDependencies": {
21
21
  "tsx": "^4.22.4"