multi_embed_player 3.2.1 → 3.2.2

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/add_exports.js CHANGED
@@ -4,7 +4,9 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
 
6
6
  const dtsPath = path.join(__dirname, 'dist', 'multi_embed_player.d.ts');
7
+ const jsPath = path.join(__dirname, 'dist', 'multi_embed_player.js');
7
8
 
9
+ // .d.ts ファイルの処理
8
10
  if (fs.existsSync(dtsPath)) {
9
11
  let content = fs.readFileSync(dtsPath, 'utf8');
10
12
 
@@ -39,4 +41,45 @@ export as namespace MultiEmbedPlayer;`;
39
41
  } else {
40
42
  console.error('✗ multi_embed_player.d.ts が見つかりません');
41
43
  process.exit(1);
44
+ }
45
+
46
+ // .js ファイルの処理
47
+ if (fs.existsSync(jsPath)) {
48
+ let jsContent = fs.readFileSync(jsPath, 'utf8');
49
+
50
+ // 既存の不適切な追加を削除
51
+ if (jsContent.includes('module.exports = { multi_embed_player')) {
52
+ jsContent = jsContent.replace(/module\.exports = \{ multi_embed_player[^}]+\};\s*$/g, '');
53
+ console.log('✓ 既存の不適切なexportを削除しました');
54
+ }
55
+
56
+ // 既にexport文が存在するかチェック
57
+ if (!jsContent.includes('// CommonJS/ES Modules export')) {
58
+ // JavaScriptファイルにも条件付きexportを追加
59
+ const jsExportStatement = `
60
+ // CommonJS/ES Modules export
61
+ if (typeof module !== 'undefined' && module.exports && typeof window === 'undefined') {
62
+ // Node.js環境でのみexport(ブラウザでは実行しない)
63
+ module.exports = {
64
+ mep_playitem: typeof mep_playitem !== 'undefined' ? mep_playitem : class {},
65
+ mep_parallel: typeof mep_parallel !== 'undefined' ? mep_parallel : class {},
66
+ mep_parallel_inner: typeof mep_parallel_inner !== 'undefined' ? mep_parallel_inner : class {},
67
+ multi_embed_player_fetch_iframe_api: typeof multi_embed_player_fetch_iframe_api !== 'undefined' ? multi_embed_player_fetch_iframe_api : function(){},
68
+ multi_embed_player_save_GDPR_status: typeof multi_embed_player_save_GDPR_status !== 'undefined' ? multi_embed_player_save_GDPR_status : function(){},
69
+ multi_embed_player_GDPR_reviever: typeof multi_embed_player_GDPR_reviever !== 'undefined' ? multi_embed_player_GDPR_reviever : function(){},
70
+ multi_embed_player_GDPR_accepted_all_back_down: typeof multi_embed_player_GDPR_accepted_all_back_down !== 'undefined' ? multi_embed_player_GDPR_accepted_all_back_down : function(){}
71
+ };
72
+ }`;
73
+
74
+ // ソースマップの行の前に挿入
75
+ jsContent = jsContent.replace('//# sourceMappingURL=', jsExportStatement + '\n//# sourceMappingURL=');
76
+
77
+ fs.writeFileSync(jsPath, jsContent);
78
+ console.log('✓ 条件付きExport文を multi_embed_player.js に追加しました');
79
+ } else {
80
+ console.log('✓ JavaScriptのExport文は既に存在します');
81
+ }
82
+ } else {
83
+ console.error('✗ multi_embed_player.js が見つかりません');
84
+ process.exit(1);
42
85
  }
@@ -917,4 +917,18 @@ document.head.appendChild(multi_embed_player_css);
917
917
  // Preserve class name for compilation
918
918
  window.multi_embed_player = multi_embed_player;
919
919
  customElements.define('multi-embed-player', multi_embed_player); //define custom element
920
+
921
+ // CommonJS/ES Modules export
922
+ if (typeof module !== 'undefined' && module.exports && typeof window === 'undefined') {
923
+ // Node.js環境でのみexport(ブラウザでは実行しない)
924
+ module.exports = {
925
+ mep_playitem: typeof mep_playitem !== 'undefined' ? mep_playitem : class {},
926
+ mep_parallel: typeof mep_parallel !== 'undefined' ? mep_parallel : class {},
927
+ mep_parallel_inner: typeof mep_parallel_inner !== 'undefined' ? mep_parallel_inner : class {},
928
+ multi_embed_player_fetch_iframe_api: typeof multi_embed_player_fetch_iframe_api !== 'undefined' ? multi_embed_player_fetch_iframe_api : function(){},
929
+ multi_embed_player_save_GDPR_status: typeof multi_embed_player_save_GDPR_status !== 'undefined' ? multi_embed_player_save_GDPR_status : function(){},
930
+ multi_embed_player_GDPR_reviever: typeof multi_embed_player_GDPR_reviever !== 'undefined' ? multi_embed_player_GDPR_reviever : function(){},
931
+ multi_embed_player_GDPR_accepted_all_back_down: typeof multi_embed_player_GDPR_accepted_all_back_down !== 'undefined' ? multi_embed_player_GDPR_accepted_all_back_down : function(){}
932
+ };
933
+ }
920
934
  //# sourceMappingURL=multi_embed_player.js.map
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main":"./dist/multi_embed_player.js",
4
4
  "module": "./dist/multi_embed_player.js",
5
5
  "types":"./dist/multi_embed_player.d.ts",
6
- "version": "3.2.1",
6
+ "version": "3.2.2",
7
7
  "license": "Apache-2.0",
8
8
  "style":"./multi_embed_player.css",
9
9
  "description": "some video site embed and control playing",
package/types.js ADDED
@@ -0,0 +1,41 @@
1
+ // Node.js環境用の型定義エクスポート
2
+ // これは外部プロジェクトでrequireできるように型のみをエクスポートします
3
+
4
+ module.exports = {
5
+ // これらは実際の実装ではなく、型確認用のスタブです
6
+ mep_playitem: class mep_playitem {
7
+ constructor(service, videoid) {
8
+ this.service = service;
9
+ this.videoid = videoid;
10
+ this.call_array = [];
11
+ }
12
+ toData() {
13
+ return {
14
+ service: this.service,
15
+ videoId: this.videoid,
16
+ call_array: this.call_array,
17
+ call_index: 0
18
+ };
19
+ }
20
+ },
21
+
22
+ mep_parallel: class mep_parallel {
23
+ constructor() {
24
+ this.data = [];
25
+ }
26
+ parse() {}
27
+ },
28
+
29
+ mep_parallel_inner: class mep_parallel_inner {
30
+ constructor(service, videoid) {
31
+ this.service = service;
32
+ this.videoid = videoid;
33
+ }
34
+ },
35
+
36
+ // 関数のスタブ
37
+ multi_embed_player_fetch_iframe_api: function() {},
38
+ multi_embed_player_save_GDPR_status: function() {},
39
+ multi_embed_player_GDPR_reviever: function() {},
40
+ multi_embed_player_GDPR_accepted_all_back_down: function() {}
41
+ };