spoclip-kit 1.0.13 → 1.0.14

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.cjs ADDED
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ getVideoDownloadCost: () => getVideoDownloadCost
24
+ });
25
+ module.exports = __toCommonJS(src_exports);
26
+
27
+ // src/libs/cost.ts
28
+ function getVideoDownloadCost({
29
+ duration,
30
+ quality,
31
+ ticketCode,
32
+ remainingFreeDownloads
33
+ }) {
34
+ if (quality === "4K") {
35
+ return { cost: 20, isPlusFree: false };
36
+ }
37
+ const durationInSeconds = duration / 1e3;
38
+ const isUnder61 = durationInSeconds < 61;
39
+ const isPlus = ticketCode === "PLUS";
40
+ if (isPlus && remainingFreeDownloads > 0 && isUnder61) {
41
+ return { cost: 0, isPlusFree: true };
42
+ }
43
+ const costPerSecond = 1 / 60;
44
+ const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;
45
+ return { cost, isPlusFree: false };
46
+ }
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ getVideoDownloadCost
50
+ });
51
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/libs/cost.ts"],"sourcesContent":["// Main entry point for spoclip-kit\nexport * from './libs';\n","import type { TicketCode } from '@/types/membership';\n\n/**\n * 비디오 다운로드 비용을 계산합니다.\n *\n * @description\n * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨\n * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료\n * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작\n * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨\n * - 59초부터는 1.98xx 이므로 반올림 시 2톨\n * - 60초부터는 2.00xx 이므로 반올림 시 2톨\n * - 62초부터는 2.03xx 이므로 반올림 시 2톨\n * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨\n *\n */\n\ntype GetVideoDownloadCostParams = {\n duration: number;\n quality: '2K' | '4K';\n ticketCode: TicketCode;\n remainingFreeDownloads: number;\n\n /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */\n isFullTime?: boolean;\n};\nexport function getVideoDownloadCost({\n duration,\n quality,\n ticketCode,\n remainingFreeDownloads,\n}: GetVideoDownloadCostParams) {\n if (quality === '4K') {\n return { cost: 20, isPlusFree: false };\n }\n\n const durationInSeconds = duration / 1000;\n const isUnder61 = durationInSeconds < 61;\n const isPlus = ticketCode === 'PLUS';\n\n if (isPlus && remainingFreeDownloads > 0 && isUnder61) {\n return { cost: 0, isPlusFree: true };\n }\n\n const costPerSecond = 1 / 60;\n const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;\n return { cost, isPlusFree: false };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC0BO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA+B;AAC7B,MAAI,YAAY,MAAM;AACpB,WAAO,EAAE,MAAM,IAAI,YAAY,MAAM;AAAA,EACvC;AAEA,QAAM,oBAAoB,WAAW;AACrC,QAAM,YAAY,oBAAoB;AACtC,QAAM,SAAS,eAAe;AAE9B,MAAI,UAAU,yBAAyB,KAAK,WAAW;AACrD,WAAO,EAAE,MAAM,GAAG,YAAY,KAAK;AAAA,EACrC;AAEA,QAAM,gBAAgB,IAAI;AAC1B,QAAM,OAAO,KAAK,MAAM,oBAAoB,gBAAgB,EAAE,IAAI;AAClE,SAAO,EAAE,MAAM,YAAY,MAAM;AACnC;","names":[]}
@@ -0,0 +1 @@
1
+ export { getVideoDownloadCost } from './libs.cjs';
package/dist/index.d.ts CHANGED
@@ -1,2 +1 @@
1
- export * from './libs';
2
- //# sourceMappingURL=index.d.ts.map
1
+ export { getVideoDownloadCost } from './libs.js';
package/dist/index.js CHANGED
@@ -1,19 +1,24 @@
1
- 'use strict';
2
-
3
- function getVideoDownloadCost({ duration, quality, ticketCode, remainingFreeDownloads, }) {
4
- if (quality === '4K') {
5
- return { cost: 20, isPlusFree: false };
6
- }
7
- const durationInSeconds = duration / 1000;
8
- const isUnder61 = durationInSeconds < 61;
9
- const isPlus = ticketCode === 'PLUS';
10
- if (isPlus && remainingFreeDownloads > 0 && isUnder61) {
11
- return { cost: 0, isPlusFree: true };
12
- }
13
- const costPerSecond = 1 / 60;
14
- const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;
15
- return { cost, isPlusFree: false };
1
+ // src/libs/cost.ts
2
+ function getVideoDownloadCost({
3
+ duration,
4
+ quality,
5
+ ticketCode,
6
+ remainingFreeDownloads
7
+ }) {
8
+ if (quality === "4K") {
9
+ return { cost: 20, isPlusFree: false };
10
+ }
11
+ const durationInSeconds = duration / 1e3;
12
+ const isUnder61 = durationInSeconds < 61;
13
+ const isPlus = ticketCode === "PLUS";
14
+ if (isPlus && remainingFreeDownloads > 0 && isUnder61) {
15
+ return { cost: 0, isPlusFree: true };
16
+ }
17
+ const costPerSecond = 1 / 60;
18
+ const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;
19
+ return { cost, isPlusFree: false };
16
20
  }
17
-
18
- exports.getVideoDownloadCost = getVideoDownloadCost;
19
- //# sourceMappingURL=index.js.map
21
+ export {
22
+ getVideoDownloadCost
23
+ };
24
+ //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/libs/cost.ts"],"sourcesContent":[null],"names":[],"mappings":";;AA0BM,SAAU,oBAAoB,CAAC,EACnC,QAAQ,EACR,OAAO,EACP,UAAU,EACV,sBAAsB,GACK,EAAA;AAC3B,IAAA,IAAI,OAAO,KAAK,IAAI,EAAE;QACpB,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;IACxC;AAEA,IAAA,MAAM,iBAAiB,GAAG,QAAQ,GAAG,IAAI;AACzC,IAAA,MAAM,SAAS,GAAG,iBAAiB,GAAG,EAAE;AACxC,IAAA,MAAM,MAAM,GAAG,UAAU,KAAK,MAAM;IAEpC,IAAI,MAAM,IAAI,sBAAsB,GAAG,CAAC,IAAI,SAAS,EAAE;QACrD,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;IACtC;AAEA,IAAA,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;AAC5B,IAAA,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,GAAG,aAAa,GAAG,EAAE,CAAC,GAAG,EAAE;AACpE,IAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE;AACpC;;;;"}
1
+ {"version":3,"sources":["../src/libs/cost.ts"],"sourcesContent":["import type { TicketCode } from '@/types/membership';\n\n/**\n * 비디오 다운로드 비용을 계산합니다.\n *\n * @description\n * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨\n * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료\n * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작\n * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨\n * - 59초부터는 1.98xx 이므로 반올림 시 2톨\n * - 60초부터는 2.00xx 이므로 반올림 시 2톨\n * - 62초부터는 2.03xx 이므로 반올림 시 2톨\n * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨\n *\n */\n\ntype GetVideoDownloadCostParams = {\n duration: number;\n quality: '2K' | '4K';\n ticketCode: TicketCode;\n remainingFreeDownloads: number;\n\n /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */\n isFullTime?: boolean;\n};\nexport function getVideoDownloadCost({\n duration,\n quality,\n ticketCode,\n remainingFreeDownloads,\n}: GetVideoDownloadCostParams) {\n if (quality === '4K') {\n return { cost: 20, isPlusFree: false };\n }\n\n const durationInSeconds = duration / 1000;\n const isUnder61 = durationInSeconds < 61;\n const isPlus = ticketCode === 'PLUS';\n\n if (isPlus && remainingFreeDownloads > 0 && isUnder61) {\n return { cost: 0, isPlusFree: true };\n }\n\n const costPerSecond = 1 / 60;\n const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;\n return { cost, isPlusFree: false };\n}\n"],"mappings":";AA0BO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA+B;AAC7B,MAAI,YAAY,MAAM;AACpB,WAAO,EAAE,MAAM,IAAI,YAAY,MAAM;AAAA,EACvC;AAEA,QAAM,oBAAoB,WAAW;AACrC,QAAM,YAAY,oBAAoB;AACtC,QAAM,SAAS,eAAe;AAE9B,MAAI,UAAU,yBAAyB,KAAK,WAAW;AACrD,WAAO,EAAE,MAAM,GAAG,YAAY,KAAK;AAAA,EACrC;AAEA,QAAM,gBAAgB,IAAI;AAC1B,QAAM,OAAO,KAAK,MAAM,oBAAoB,gBAAgB,EAAE,IAAI;AAClE,SAAO,EAAE,MAAM,YAAY,MAAM;AACnC;","names":[]}
package/dist/libs.cjs ADDED
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/libs/index.ts
21
+ var libs_exports = {};
22
+ __export(libs_exports, {
23
+ getVideoDownloadCost: () => getVideoDownloadCost
24
+ });
25
+ module.exports = __toCommonJS(libs_exports);
26
+
27
+ // src/libs/cost.ts
28
+ function getVideoDownloadCost({
29
+ duration,
30
+ quality,
31
+ ticketCode,
32
+ remainingFreeDownloads
33
+ }) {
34
+ if (quality === "4K") {
35
+ return { cost: 20, isPlusFree: false };
36
+ }
37
+ const durationInSeconds = duration / 1e3;
38
+ const isUnder61 = durationInSeconds < 61;
39
+ const isPlus = ticketCode === "PLUS";
40
+ if (isPlus && remainingFreeDownloads > 0 && isUnder61) {
41
+ return { cost: 0, isPlusFree: true };
42
+ }
43
+ const costPerSecond = 1 / 60;
44
+ const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;
45
+ return { cost, isPlusFree: false };
46
+ }
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ getVideoDownloadCost
50
+ });
51
+ //# sourceMappingURL=libs.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/libs/index.ts","../src/libs/cost.ts"],"sourcesContent":["export { getVideoDownloadCost } from './cost';\n","import type { TicketCode } from '@/types/membership';\n\n/**\n * 비디오 다운로드 비용을 계산합니다.\n *\n * @description\n * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨\n * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료\n * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작\n * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨\n * - 59초부터는 1.98xx 이므로 반올림 시 2톨\n * - 60초부터는 2.00xx 이므로 반올림 시 2톨\n * - 62초부터는 2.03xx 이므로 반올림 시 2톨\n * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨\n *\n */\n\ntype GetVideoDownloadCostParams = {\n duration: number;\n quality: '2K' | '4K';\n ticketCode: TicketCode;\n remainingFreeDownloads: number;\n\n /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */\n isFullTime?: boolean;\n};\nexport function getVideoDownloadCost({\n duration,\n quality,\n ticketCode,\n remainingFreeDownloads,\n}: GetVideoDownloadCostParams) {\n if (quality === '4K') {\n return { cost: 20, isPlusFree: false };\n }\n\n const durationInSeconds = duration / 1000;\n const isUnder61 = durationInSeconds < 61;\n const isPlus = ticketCode === 'PLUS';\n\n if (isPlus && remainingFreeDownloads > 0 && isUnder61) {\n return { cost: 0, isPlusFree: true };\n }\n\n const costPerSecond = 1 / 60;\n const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;\n return { cost, isPlusFree: false };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC0BO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA+B;AAC7B,MAAI,YAAY,MAAM;AACpB,WAAO,EAAE,MAAM,IAAI,YAAY,MAAM;AAAA,EACvC;AAEA,QAAM,oBAAoB,WAAW;AACrC,QAAM,YAAY,oBAAoB;AACtC,QAAM,SAAS,eAAe;AAE9B,MAAI,UAAU,yBAAyB,KAAK,WAAW;AACrD,WAAO,EAAE,MAAM,GAAG,YAAY,KAAK;AAAA,EACrC;AAEA,QAAM,gBAAgB,IAAI;AAC1B,QAAM,OAAO,KAAK,MAAM,oBAAoB,gBAAgB,EAAE,IAAI;AAClE,SAAO,EAAE,MAAM,YAAY,MAAM;AACnC;","names":[]}
@@ -1,4 +1,5 @@
1
- import type { TicketCode } from '@/types/membership';
1
+ type TicketCode = 'PLUS' | 'FREE';
2
+
2
3
  /**
3
4
  * 비디오 다운로드 비용을 계산합니다.
4
5
  *
@@ -21,9 +22,9 @@ type GetVideoDownloadCostParams = {
21
22
  /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */
22
23
  isFullTime?: boolean;
23
24
  };
24
- export declare function getVideoDownloadCost({ duration, quality, ticketCode, remainingFreeDownloads, }: GetVideoDownloadCostParams): {
25
+ declare function getVideoDownloadCost({ duration, quality, ticketCode, remainingFreeDownloads, }: GetVideoDownloadCostParams): {
25
26
  cost: number;
26
27
  isPlusFree: boolean;
27
28
  };
28
- export {};
29
- //# sourceMappingURL=cost.d.ts.map
29
+
30
+ export { getVideoDownloadCost };
@@ -1,4 +1,5 @@
1
- import type { TicketCode } from '@/types/membership';
1
+ type TicketCode = 'PLUS' | 'FREE';
2
+
2
3
  /**
3
4
  * 비디오 다운로드 비용을 계산합니다.
4
5
  *
@@ -21,9 +22,9 @@ type GetVideoDownloadCostParams = {
21
22
  /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */
22
23
  isFullTime?: boolean;
23
24
  };
24
- export declare function getVideoDownloadCost({ duration, quality, ticketCode, remainingFreeDownloads, }: GetVideoDownloadCostParams): {
25
+ declare function getVideoDownloadCost({ duration, quality, ticketCode, remainingFreeDownloads, }: GetVideoDownloadCostParams): {
25
26
  cost: number;
26
27
  isPlusFree: boolean;
27
28
  };
28
- export {};
29
- //# sourceMappingURL=cost.d.ts.map
29
+
30
+ export { getVideoDownloadCost };
package/dist/libs.js ADDED
@@ -0,0 +1,24 @@
1
+ // src/libs/cost.ts
2
+ function getVideoDownloadCost({
3
+ duration,
4
+ quality,
5
+ ticketCode,
6
+ remainingFreeDownloads
7
+ }) {
8
+ if (quality === "4K") {
9
+ return { cost: 20, isPlusFree: false };
10
+ }
11
+ const durationInSeconds = duration / 1e3;
12
+ const isUnder61 = durationInSeconds < 61;
13
+ const isPlus = ticketCode === "PLUS";
14
+ if (isPlus && remainingFreeDownloads > 0 && isUnder61) {
15
+ return { cost: 0, isPlusFree: true };
16
+ }
17
+ const costPerSecond = 1 / 60;
18
+ const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;
19
+ return { cost, isPlusFree: false };
20
+ }
21
+ export {
22
+ getVideoDownloadCost
23
+ };
24
+ //# sourceMappingURL=libs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/libs/cost.ts"],"sourcesContent":["import type { TicketCode } from '@/types/membership';\n\n/**\n * 비디오 다운로드 비용을 계산합니다.\n *\n * @description\n * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨\n * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료\n * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작\n * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨\n * - 59초부터는 1.98xx 이므로 반올림 시 2톨\n * - 60초부터는 2.00xx 이므로 반올림 시 2톨\n * - 62초부터는 2.03xx 이므로 반올림 시 2톨\n * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨\n *\n */\n\ntype GetVideoDownloadCostParams = {\n duration: number;\n quality: '2K' | '4K';\n ticketCode: TicketCode;\n remainingFreeDownloads: number;\n\n /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */\n isFullTime?: boolean;\n};\nexport function getVideoDownloadCost({\n duration,\n quality,\n ticketCode,\n remainingFreeDownloads,\n}: GetVideoDownloadCostParams) {\n if (quality === '4K') {\n return { cost: 20, isPlusFree: false };\n }\n\n const durationInSeconds = duration / 1000;\n const isUnder61 = durationInSeconds < 61;\n const isPlus = ticketCode === 'PLUS';\n\n if (isPlus && remainingFreeDownloads > 0 && isUnder61) {\n return { cost: 0, isPlusFree: true };\n }\n\n const costPerSecond = 1 / 60;\n const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;\n return { cost, isPlusFree: false };\n}\n"],"mappings":";AA0BO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA+B;AAC7B,MAAI,YAAY,MAAM;AACpB,WAAO,EAAE,MAAM,IAAI,YAAY,MAAM;AAAA,EACvC;AAEA,QAAM,oBAAoB,WAAW;AACrC,QAAM,YAAY,oBAAoB;AACtC,QAAM,SAAS,eAAe;AAE9B,MAAI,UAAU,yBAAyB,KAAK,WAAW;AACrD,WAAO,EAAE,MAAM,GAAG,YAAY,KAAK;AAAA,EACrC;AAEA,QAAM,gBAAgB,IAAI;AAC1B,QAAM,OAAO,KAAK,MAAM,oBAAoB,gBAAgB,EAAE,IAAI;AAClE,SAAO,EAAE,MAAM,YAAY,MAAM;AACnC;","names":[]}
package/package.json CHANGED
@@ -1,17 +1,29 @@
1
1
  {
2
2
  "name": "spoclip-kit",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "type": "module",
5
5
  "description": "TypeScript utility library for internal use",
6
- "main": "dist/index.js",
7
- "module": "dist/index.esm.js",
8
- "types": "dist/index.d.ts",
9
6
  "files": [
10
7
  "dist"
11
8
  ],
9
+ "main": "./dist/index.js",
10
+ "module": "./dist/index.mjs",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "require": "./dist/index.js",
16
+ "import": "./dist/index.mjs"
17
+ },
18
+ "./libs": {
19
+ "types": "./dist/libs/index.d.ts",
20
+ "require": "./dist/libs/index.js",
21
+ "import": "./dist/libs/index.mjs"
22
+ }
23
+ },
12
24
  "scripts": {
13
- "build": "rollup -c",
14
- "dev": "rollup -c -w",
25
+ "build": "tsup",
26
+ "dev": "tsup --watch",
15
27
  "test": "vitest",
16
28
  "test:run": "vitest run",
17
29
  "lint": "eslint src --ext .ts,.tsx",
@@ -34,9 +46,6 @@
34
46
  "license": "MIT",
35
47
  "devDependencies": {
36
48
  "@eslint/js": "^9.37.0",
37
- "@rollup/plugin-commonjs": "^25.0.7",
38
- "@rollup/plugin-node-resolve": "^15.2.3",
39
- "@rollup/plugin-typescript": "^11.1.5",
40
49
  "@types/node": "^20.10.5",
41
50
  "@typescript-eslint/eslint-plugin": "^8.46.1",
42
51
  "@typescript-eslint/parser": "^8.46.1",
@@ -44,27 +53,14 @@
44
53
  "globals": "^16.4.0",
45
54
  "prettier": "^3.1.1",
46
55
  "rimraf": "^5.0.5",
47
- "rollup": "^4.9.1",
48
- "rollup-plugin-dts": "^6.1.0",
49
56
  "tslib": "^2.6.2",
57
+ "tsup": "^8.5.0",
50
58
  "typescript": "^5.9.3",
51
59
  "vitest": "^1.1.0"
52
60
  },
53
61
  "peerDependencies": {
54
62
  "typescript": ">=4.9.0"
55
63
  },
56
- "exports": {
57
- ".": {
58
- "import": "./dist/index.esm.js",
59
- "require": "./dist/index.js",
60
- "types": "./dist/index.d.ts"
61
- },
62
- "./libs": {
63
- "import": "./dist/libs/index.esm.js",
64
- "require": "./dist/libs/index.js",
65
- "types": "./dist/libs/index.d.ts"
66
- }
67
- },
68
64
  "publishConfig": {
69
65
  "access": "public"
70
66
  },
@@ -1,6 +0,0 @@
1
- declare const SECOND = 1000;
2
- declare const MINUTE: number;
3
- declare const HOUR: number;
4
- declare const DAY: number;
5
- export { SECOND, MINUTE, HOUR, DAY };
6
- //# sourceMappingURL=time.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/constants/time.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,OAAO,CAAC;AACpB,QAAA,MAAM,MAAM,QAAc,CAAC;AAC3B,QAAA,MAAM,IAAI,QAAc,CAAC;AACzB,QAAA,MAAM,GAAG,QAAY,CAAC;AAEtB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,QAAQ,CAAC"}
package/dist/index.esm.js DELETED
@@ -1,17 +0,0 @@
1
- function getVideoDownloadCost({ duration, quality, ticketCode, remainingFreeDownloads, }) {
2
- if (quality === '4K') {
3
- return { cost: 20, isPlusFree: false };
4
- }
5
- const durationInSeconds = duration / 1000;
6
- const isUnder61 = durationInSeconds < 61;
7
- const isPlus = ticketCode === 'PLUS';
8
- if (isPlus && remainingFreeDownloads > 0 && isUnder61) {
9
- return { cost: 0, isPlusFree: true };
10
- }
11
- const costPerSecond = 1 / 60;
12
- const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;
13
- return { cost, isPlusFree: false };
14
- }
15
-
16
- export { getVideoDownloadCost };
17
- //# sourceMappingURL=index.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/libs/cost.ts"],"sourcesContent":[null],"names":[],"mappings":"AA0BM,SAAU,oBAAoB,CAAC,EACnC,QAAQ,EACR,OAAO,EACP,UAAU,EACV,sBAAsB,GACK,EAAA;AAC3B,IAAA,IAAI,OAAO,KAAK,IAAI,EAAE;QACpB,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;IACxC;AAEA,IAAA,MAAM,iBAAiB,GAAG,QAAQ,GAAG,IAAI;AACzC,IAAA,MAAM,SAAS,GAAG,iBAAiB,GAAG,EAAE;AACxC,IAAA,MAAM,MAAM,GAAG,UAAU,KAAK,MAAM;IAEpC,IAAI,MAAM,IAAI,sBAAsB,GAAG,CAAC,IAAI,SAAS,EAAE;QACrD,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;IACtC;AAEA,IAAA,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;AAC5B,IAAA,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,GAAG,aAAa,GAAG,EAAE,CAAC,GAAG,EAAE;AACpE,IAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE;AACpC;;;;"}
@@ -1,6 +0,0 @@
1
- declare const SECOND = 1000;
2
- declare const MINUTE: number;
3
- declare const HOUR: number;
4
- declare const DAY: number;
5
- export { SECOND, MINUTE, HOUR, DAY };
6
- //# sourceMappingURL=time.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/constants/time.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,OAAO,CAAC;AACpB,QAAA,MAAM,MAAM,QAAc,CAAC;AAC3B,QAAA,MAAM,IAAI,QAAc,CAAC;AACzB,QAAA,MAAM,GAAG,QAAY,CAAC;AAEtB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"cost.d.ts","sourceRoot":"","sources":["../../src/libs/cost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;GAaG;AAEH,KAAK,0BAA0B,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;IAE/B,yCAAyC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AACF,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,OAAO,EACP,UAAU,EACV,sBAAsB,GACvB,EAAE,0BAA0B;;;EAgB5B"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=cost.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cost.test.d.ts","sourceRoot":"","sources":["../../src/libs/cost.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export * from './libs';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,QAAQ,CAAC"}
@@ -1,17 +0,0 @@
1
- function getVideoDownloadCost({ duration, quality, ticketCode, remainingFreeDownloads, }) {
2
- if (quality === '4K') {
3
- return { cost: 20, isPlusFree: false };
4
- }
5
- const durationInSeconds = duration / 1000;
6
- const isUnder61 = durationInSeconds < 61;
7
- const isPlus = ticketCode === 'PLUS';
8
- if (isPlus && remainingFreeDownloads > 0 && isUnder61) {
9
- return { cost: 0, isPlusFree: true };
10
- }
11
- const costPerSecond = 1 / 60;
12
- const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;
13
- return { cost, isPlusFree: false };
14
- }
15
-
16
- export { getVideoDownloadCost };
17
- //# sourceMappingURL=index.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../src/libs/cost.ts"],"sourcesContent":[null],"names":[],"mappings":"AA0BM,SAAU,oBAAoB,CAAC,EACnC,QAAQ,EACR,OAAO,EACP,UAAU,EACV,sBAAsB,GACK,EAAA;AAC3B,IAAA,IAAI,OAAO,KAAK,IAAI,EAAE;QACpB,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;IACxC;AAEA,IAAA,MAAM,iBAAiB,GAAG,QAAQ,GAAG,IAAI;AACzC,IAAA,MAAM,SAAS,GAAG,iBAAiB,GAAG,EAAE;AACxC,IAAA,MAAM,MAAM,GAAG,UAAU,KAAK,MAAM;IAEpC,IAAI,MAAM,IAAI,sBAAsB,GAAG,CAAC,IAAI,SAAS,EAAE;QACrD,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;IACtC;AAEA,IAAA,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;AAC5B,IAAA,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,GAAG,aAAa,GAAG,EAAE,CAAC,GAAG,EAAE;AACpE,IAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE;AACpC;;;;"}
@@ -1,19 +0,0 @@
1
- 'use strict';
2
-
3
- function getVideoDownloadCost({ duration, quality, ticketCode, remainingFreeDownloads, }) {
4
- if (quality === '4K') {
5
- return { cost: 20, isPlusFree: false };
6
- }
7
- const durationInSeconds = duration / 1000;
8
- const isUnder61 = durationInSeconds < 61;
9
- const isPlus = ticketCode === 'PLUS';
10
- if (isPlus && remainingFreeDownloads > 0 && isUnder61) {
11
- return { cost: 0, isPlusFree: true };
12
- }
13
- const costPerSecond = 1 / 60;
14
- const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;
15
- return { cost, isPlusFree: false };
16
- }
17
-
18
- exports.getVideoDownloadCost = getVideoDownloadCost;
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../src/libs/cost.ts"],"sourcesContent":[null],"names":[],"mappings":";;AA0BM,SAAU,oBAAoB,CAAC,EACnC,QAAQ,EACR,OAAO,EACP,UAAU,EACV,sBAAsB,GACK,EAAA;AAC3B,IAAA,IAAI,OAAO,KAAK,IAAI,EAAE;QACpB,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;IACxC;AAEA,IAAA,MAAM,iBAAiB,GAAG,QAAQ,GAAG,IAAI;AACzC,IAAA,MAAM,SAAS,GAAG,iBAAiB,GAAG,EAAE;AACxC,IAAA,MAAM,MAAM,GAAG,UAAU,KAAK,MAAM;IAEpC,IAAI,MAAM,IAAI,sBAAsB,GAAG,CAAC,IAAI,SAAS,EAAE;QACrD,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;IACtC;AAEA,IAAA,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;AAC5B,IAAA,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,GAAG,aAAa,GAAG,EAAE,CAAC,GAAG,EAAE;AACpE,IAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE;AACpC;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"cost.d.ts","sourceRoot":"","sources":["../../src/libs/cost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;GAaG;AAEH,KAAK,0BAA0B,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;IAE/B,yCAAyC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AACF,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,OAAO,EACP,UAAU,EACV,sBAAsB,GACvB,EAAE,0BAA0B;;;EAgB5B"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=cost.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cost.test.d.ts","sourceRoot":"","sources":["../../src/libs/cost.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export { getVideoDownloadCost } from './cost';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/libs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC"}
@@ -1,2 +0,0 @@
1
- export type TicketCode = 'PLUS' | 'FREE';
2
- //# sourceMappingURL=membership.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"membership.d.ts","sourceRoot":"","sources":["../../src/types/membership.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC"}
@@ -1,2 +0,0 @@
1
- export type TicketCode = 'PLUS' | 'FREE';
2
- //# sourceMappingURL=membership.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"membership.d.ts","sourceRoot":"","sources":["../../src/types/membership.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC"}