@m11s-io/decap-cms-media-library-s3 0.1.1 → 0.1.3

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/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- interface Options {
1
+ interface Config {
2
2
  upload_url?: string;
3
3
  }
4
4
  interface InitArgs {
5
- options?: Options;
5
+ config?: Config;
6
6
  handleInsert: (url: string) => void;
7
7
  }
8
8
  interface Instance {
@@ -16,7 +16,7 @@ interface Instance {
16
16
  }
17
17
  declare const S3MediaLibrary: {
18
18
  name: string;
19
- init({ options, handleInsert }: InitArgs): Instance;
19
+ init({ config, handleInsert }: InitArgs): Instance;
20
20
  };
21
21
 
22
22
  export { S3MediaLibrary as default };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- interface Options {
1
+ interface Config {
2
2
  upload_url?: string;
3
3
  }
4
4
  interface InitArgs {
5
- options?: Options;
5
+ config?: Config;
6
6
  handleInsert: (url: string) => void;
7
7
  }
8
8
  interface Instance {
@@ -16,7 +16,7 @@ interface Instance {
16
16
  }
17
17
  declare const S3MediaLibrary: {
18
18
  name: string;
19
- init({ options, handleInsert }: InitArgs): Instance;
19
+ init({ config, handleInsert }: InitArgs): Instance;
20
20
  };
21
21
 
22
22
  export { S3MediaLibrary as default };
@@ -25,16 +25,16 @@ var S3MediaLibrary = (() => {
25
25
  });
26
26
  var S3MediaLibrary = {
27
27
  name: "s3",
28
- init({ options = {}, handleInsert }) {
29
- var _a;
30
- const uploadUrl = (_a = options.upload_url) != null ? _a : "http://localhost:8082/upload";
28
+ init({ config = {}, handleInsert }) {
29
+ const uploadUrl = config.upload_url;
30
+ if (!uploadUrl) throw new Error("decap-cms-media-library-s3: upload_url is required in media_library.config");
31
31
  const input = document.createElement("input");
32
32
  input.type = "file";
33
33
  input.style.display = "none";
34
34
  document.body.appendChild(input);
35
35
  input.addEventListener("change", async () => {
36
- var _a2;
37
- const file = (_a2 = input.files) == null ? void 0 : _a2[0];
36
+ var _a;
37
+ const file = (_a = input.files) == null ? void 0 : _a[0];
38
38
  if (!file) return;
39
39
  const formData = new FormData();
40
40
  formData.append("file", file);
package/dist/index.js CHANGED
@@ -25,16 +25,16 @@ __export(index_exports, {
25
25
  module.exports = __toCommonJS(index_exports);
26
26
  var S3MediaLibrary = {
27
27
  name: "s3",
28
- init({ options = {}, handleInsert }) {
29
- var _a;
30
- const uploadUrl = (_a = options.upload_url) != null ? _a : "http://localhost:8082/upload";
28
+ init({ config = {}, handleInsert }) {
29
+ const uploadUrl = config.upload_url;
30
+ if (!uploadUrl) throw new Error("decap-cms-media-library-s3: upload_url is required in media_library.config");
31
31
  const input = document.createElement("input");
32
32
  input.type = "file";
33
33
  input.style.display = "none";
34
34
  document.body.appendChild(input);
35
35
  input.addEventListener("change", async () => {
36
- var _a2;
37
- const file = (_a2 = input.files) == null ? void 0 : _a2[0];
36
+ var _a;
37
+ const file = (_a = input.files) == null ? void 0 : _a[0];
38
38
  if (!file) return;
39
39
  const formData = new FormData();
40
40
  formData.append("file", file);
package/dist/index.mjs CHANGED
@@ -1,16 +1,16 @@
1
1
  // src/index.ts
2
2
  var S3MediaLibrary = {
3
3
  name: "s3",
4
- init({ options = {}, handleInsert }) {
5
- var _a;
6
- const uploadUrl = (_a = options.upload_url) != null ? _a : "http://localhost:8082/upload";
4
+ init({ config = {}, handleInsert }) {
5
+ const uploadUrl = config.upload_url;
6
+ if (!uploadUrl) throw new Error("decap-cms-media-library-s3: upload_url is required in media_library.config");
7
7
  const input = document.createElement("input");
8
8
  input.type = "file";
9
9
  input.style.display = "none";
10
10
  document.body.appendChild(input);
11
11
  input.addEventListener("change", async () => {
12
- var _a2;
13
- const file = (_a2 = input.files) == null ? void 0 : _a2[0];
12
+ var _a;
13
+ const file = (_a = input.files) == null ? void 0 : _a[0];
14
14
  if (!file) return;
15
15
  const formData = new FormData();
16
16
  formData.append("file", file);
package/package.json CHANGED
@@ -1,9 +1,18 @@
1
1
  {
2
2
  "name": "@m11s-io/decap-cms-media-library-s3",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "S3-compatible media library plugin for Decap CMS",
5
- "main": "dist/index.umd.js",
6
- "module": "dist/index.esm.js",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "unpkg": "dist/index.global.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.mjs",
13
+ "require": "./dist/index.js"
14
+ }
15
+ },
7
16
  "files": [
8
17
  "dist"
9
18
  ],
@@ -18,6 +27,10 @@
18
27
  "minio",
19
28
  "media-library"
20
29
  ],
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/m11s-io/js"
33
+ },
21
34
  "license": "MIT",
22
35
  "devDependencies": {
23
36
  "tsup": "^8"