@next2d/builder 0.1.6 → 0.1.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.
Files changed (34) hide show
  1. package/README.md +5 -1
  2. package/dist/index.js +140 -36
  3. package/package.json +3 -2
  4. package/templates/xbox/CMakeLists.txt +74 -2
  5. package/templates/xbox/README.md +73 -12
  6. package/templates/xbox/cmake/FetchDawn.cmake +47 -6
  7. package/templates/xbox/cmake/FindV8.cmake +22 -1
  8. package/templates/xbox/js/bootstrap.js +31 -28
  9. package/templates/xbox/js/selftest.js +740 -90
  10. package/templates/xbox/src/EventLoop.cpp +28 -1
  11. package/templates/xbox/src/EventLoop.h +12 -0
  12. package/templates/xbox/src/bindings/Audio.cpp +99 -15
  13. package/templates/xbox/src/bindings/Bindings.h +10 -0
  14. package/templates/xbox/src/bindings/Canvas.cpp +45 -0
  15. package/templates/xbox/src/bindings/Canvas2D.cpp +2 -5
  16. package/templates/xbox/src/bindings/DomShims.cpp +127 -0
  17. package/templates/xbox/src/bindings/EventTarget.cpp +2 -0
  18. package/templates/xbox/src/bindings/Fetch.cpp +2 -8
  19. package/templates/xbox/src/bindings/Image.cpp +212 -10
  20. package/templates/xbox/src/bindings/Polyfills.cpp +791 -0
  21. package/templates/xbox/src/bindings/Video.cpp +96 -7
  22. package/templates/xbox/src/bindings/webgpu/WebGPU.cpp +815 -15
  23. package/templates/xbox/src/bindings/webgpu/WebGPUCommon.h +3 -8
  24. package/templates/xbox/src/gpu/DawnContext.cpp +90 -3
  25. package/templates/xbox/src/gpu/DawnContext.h +18 -0
  26. package/templates/xbox/src/main.cpp +88 -6
  27. package/templates/xbox/src/platform/AudioEngine.cpp +9 -3
  28. package/templates/xbox/src/v8/V8Runtime.cpp +69 -4
  29. package/templates/xbox/src/v8/V8Util.h +29 -0
  30. package/templates/xbox/src/v8/WeakHandle.h +45 -0
  31. package/templates/xbox/src/worker/WorkerRuntime.cpp +325 -41
  32. package/templates/xbox/src/worker/WorkerRuntime.h +20 -10
  33. package/templates/xbox/tests/check_local.sh +3 -2
  34. package/templates/xbox/tests/raster_test.bin +0 -0
@@ -10,10 +10,16 @@
10
10
  # v8_monolithic=true
11
11
  # v8_use_external_startup_data=false
12
12
  # is_component_build=false
13
+ # use_custom_libcxx=false
14
+ # icu_use_data_file=false
15
+ # treat_warnings_as_errors=false
16
+ # v8_jitless=true
17
+ # v8_enable_turbofan=false
18
+ # v8_enable_webassembly=false
13
19
  # target_cpu="x64"
14
20
  # is_debug=false
15
21
  # v8_enable_pointer_compression=true
16
- # v8_enable_sandbox=true'
22
+ # v8_enable_sandbox=false'
17
23
  # ninja -C out/x64.release v8_monolith
18
24
  #
19
25
  # 2. 配布物 (v8_monolith.lib + include/) を取得
@@ -34,6 +40,21 @@ if(NOT V8_ROOT OR NOT EXISTS "${V8_ROOT}")
34
40
  "詳細は README.md の『V8 の用意』を参照。")
35
41
  endif()
36
42
 
43
+ # find_path/find_library の結果は CMakeCache に永続化されるため、
44
+ # V8_ROOT の変更 (バージョン更新等) や参照先の消滅に追随しない。
45
+ # 古い/無効な検出結果はここで破棄して再探索させる。
46
+ if(DEFINED CACHE{NEXT2D_V8_ROOT_LAST} AND NOT "$CACHE{NEXT2D_V8_ROOT_LAST}" STREQUAL "${V8_ROOT}")
47
+ unset(V8_INCLUDE_DIR CACHE)
48
+ unset(V8_MONOLITH_LIB CACHE)
49
+ endif()
50
+ if(V8_INCLUDE_DIR AND NOT EXISTS "${V8_INCLUDE_DIR}/v8.h")
51
+ unset(V8_INCLUDE_DIR CACHE)
52
+ endif()
53
+ if(V8_MONOLITH_LIB AND NOT EXISTS "${V8_MONOLITH_LIB}")
54
+ unset(V8_MONOLITH_LIB CACHE)
55
+ endif()
56
+ set(NEXT2D_V8_ROOT_LAST "${V8_ROOT}" CACHE INTERNAL "直近の構成で使った V8_ROOT")
57
+
37
58
  find_path(V8_INCLUDE_DIR
38
59
  NAMES v8.h
39
60
  PATHS "${V8_ROOT}/include"
@@ -25,7 +25,7 @@
25
25
  // V8 単体には Web の Text* が含まれないため最小実装を提供する。
26
26
  if (typeof global.TextEncoder === "undefined") {
27
27
  global.TextEncoder = class TextEncoder {
28
- get encoding() { return "utf-8"; }
28
+ get encoding() { return "utf-8" }
29
29
  encode(str) {
30
30
  str = String(str);
31
31
  const out = [];
@@ -34,23 +34,23 @@
34
34
  if (code < 0x80) {
35
35
  out.push(code);
36
36
  } else if (code < 0x800) {
37
- out.push(0xc0 | (code >> 6), 0x80 | (code & 0x3f));
37
+ out.push(0xc0 | code >> 6, 0x80 | code & 0x3f);
38
38
  } else if (code >= 0xd800 && code <= 0xdbff) {
39
39
  // サロゲートペア
40
40
  const hi = code;
41
41
  const lo = str.charCodeAt(++i);
42
- code = 0x10000 + ((hi - 0xd800) << 10) + (lo - 0xdc00);
42
+ code = 0x10000 + (hi - 0xd800 << 10) + (lo - 0xdc00);
43
43
  out.push(
44
- 0xf0 | (code >> 18),
45
- 0x80 | ((code >> 12) & 0x3f),
46
- 0x80 | ((code >> 6) & 0x3f),
47
- 0x80 | (code & 0x3f)
44
+ 0xf0 | code >> 18,
45
+ 0x80 | code >> 12 & 0x3f,
46
+ 0x80 | code >> 6 & 0x3f,
47
+ 0x80 | code & 0x3f
48
48
  );
49
49
  } else {
50
50
  out.push(
51
- 0xe0 | (code >> 12),
52
- 0x80 | ((code >> 6) & 0x3f),
53
- 0x80 | (code & 0x3f)
51
+ 0xe0 | code >> 12,
52
+ 0x80 | code >> 6 & 0x3f,
53
+ 0x80 | code & 0x3f
54
54
  );
55
55
  }
56
56
  }
@@ -61,10 +61,10 @@
61
61
 
62
62
  if (typeof global.TextDecoder === "undefined") {
63
63
  global.TextDecoder = class TextDecoder {
64
- constructor(label) { this._label = label || "utf-8"; }
65
- get encoding() { return "utf-8"; }
64
+ constructor(label) { this._label = label || "utf-8" }
65
+ get encoding() { return "utf-8" }
66
66
  decode(input) {
67
- if (!input) return "";
67
+ if (!input) { return "" }
68
68
  const bytes = input instanceof Uint8Array
69
69
  ? input
70
70
  : new Uint8Array(input.buffer || input);
@@ -75,14 +75,14 @@
75
75
  if (c < 0x80) {
76
76
  out += String.fromCharCode(c);
77
77
  } else if (c < 0xe0) {
78
- out += String.fromCharCode(((c & 0x1f) << 6) | (bytes[i++] & 0x3f));
78
+ out += String.fromCharCode((c & 0x1f) << 6 | bytes[i++] & 0x3f);
79
79
  } else if (c < 0xf0) {
80
80
  out += String.fromCharCode(
81
- ((c & 0x0f) << 12) | ((bytes[i++] & 0x3f) << 6) | (bytes[i++] & 0x3f)
81
+ (c & 0x0f) << 12 | (bytes[i++] & 0x3f) << 6 | bytes[i++] & 0x3f
82
82
  );
83
83
  } else {
84
- let code = ((c & 0x07) << 18) | ((bytes[i++] & 0x3f) << 12) |
85
- ((bytes[i++] & 0x3f) << 6) | (bytes[i++] & 0x3f);
84
+ let code = (c & 0x07) << 18 | (bytes[i++] & 0x3f) << 12 |
85
+ (bytes[i++] & 0x3f) << 6 | bytes[i++] & 0x3f;
86
86
  code -= 0x10000;
87
87
  out += String.fromCharCode(0xd800 + (code >> 10), 0xdc00 + (code & 0x3ff));
88
88
  }
@@ -97,28 +97,31 @@
97
97
  if (typeof global.URL === "undefined") {
98
98
  global.URL = class URL {
99
99
  constructor(url, base) {
100
- this.href = base ? (String(base).replace(/\/?$/, "/") + url) : String(url);
100
+ this.href = base ? String(base).replace(/\/?$/, "/") + url : String(url);
101
101
  this.pathname = this.href.replace(/^[a-z]+:\/\/[^/]*/i, "");
102
102
  this.search = "";
103
103
  this.hash = "";
104
104
  }
105
- toString() { return this.href; }
105
+ toString() { return this.href }
106
106
  };
107
- global.URL.createObjectURL = function () { return ""; };
107
+ global.URL.createObjectURL = function () { return "" };
108
+ // 意図的な no-op スタブ (ローカル実行では解放処理は不要)
109
+ // eslint-disable-next-line no-empty-function
108
110
  global.URL.revokeObjectURL = function () {};
109
111
  }
110
112
 
111
113
  // --- location (Next2D が参照する場合の最小値) ---------------------------
112
114
  if (typeof global.location === "undefined") {
113
115
  global.location = {
114
- href: "app://local/",
115
- origin: "app://local",
116
- protocol: "app:",
117
- host: "local",
118
- hostname: "local",
119
- pathname: "/",
120
- search: "",
121
- hash: "",
116
+ "href": "app://local/",
117
+ "origin": "app://local",
118
+ "protocol": "app:",
119
+ "host": "local",
120
+ "hostname": "local",
121
+ "pathname": "/",
122
+ "search": "",
123
+ "hash": "",
124
+ // eslint-disable-next-line no-empty-function
122
125
  reload() {}
123
126
  };
124
127
  }