ember-native 3.0.2 → 3.1.0

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 (2) hide show
  1. package/dist/setup.js +177 -0
  2. package/package.json +4 -4
package/dist/setup.js CHANGED
@@ -7,6 +7,183 @@ import ElementNode from './dom/nodes/ElementNode.js';
7
7
  import { _backburner } from '@ember/runloop';
8
8
  import DocumentNode from './dom/nodes/DocumentNode.js';
9
9
 
10
+ globalThis.registerBundlerModules = () => null;
11
+ globalThis.structuredClone = x => JSON.parse(JSON.stringify(x));
12
+
13
+ // this is used by warp-drive, and should somehow be setup by ember.js. did not figure out where...
14
+ globalThis.warn = (...args) => console.warn(...args);
15
+
16
+ // Polyfill console.warn if not available
17
+ if (typeof console.warn === 'undefined') {
18
+ console.warn = function (...args) {
19
+ console.log('[WARN]', ...args);
20
+ };
21
+ }
22
+
23
+ // Polyfill queueMicrotask for async operations
24
+ if (typeof globalThis.queueMicrotask === 'undefined') {
25
+ globalThis.queueMicrotask = callback => {
26
+ Promise.resolve().then(callback).catch(err => {
27
+ setTimeout(() => {
28
+ throw err;
29
+ }, 0);
30
+ });
31
+ };
32
+ }
33
+
34
+ // Polyfill ReadableStream for fetch API
35
+ if (typeof globalThis.ReadableStream === 'undefined') {
36
+ class ReadableStream {
37
+ constructor(underlyingSource) {
38
+ _defineProperty(this, "_locked", false);
39
+ _defineProperty(this, "_reader", null);
40
+ } // Basic implementation for compatibility
41
+ get locked() {
42
+ return this._locked;
43
+ }
44
+ getReader() {
45
+ if (this._locked) {
46
+ throw new TypeError('ReadableStream is locked');
47
+ }
48
+ this._locked = true;
49
+ this._reader = {
50
+ read: () => Promise.resolve({
51
+ done: true,
52
+ value: undefined
53
+ }),
54
+ releaseLock: () => {
55
+ this._locked = false;
56
+ },
57
+ closed: Promise.resolve()
58
+ };
59
+ return this._reader;
60
+ }
61
+ cancel(reason) {
62
+ return Promise.resolve();
63
+ }
64
+ }
65
+ globalThis.ReadableStream = ReadableStream;
66
+ }
67
+
68
+ // Polyfill WritableStream for fetch API
69
+ if (typeof globalThis.WritableStream === 'undefined') {
70
+ class WritableStream {
71
+ constructor(underlyingSink) {
72
+ _defineProperty(this, "_locked", false);
73
+ _defineProperty(this, "_writer", null);
74
+ } // Basic implementation for compatibility
75
+ get locked() {
76
+ return this._locked;
77
+ }
78
+ getWriter() {
79
+ if (this._locked) {
80
+ throw new TypeError('WritableStream is locked');
81
+ }
82
+ this._locked = true;
83
+ this._writer = {
84
+ write: chunk => Promise.resolve(),
85
+ close: () => Promise.resolve(),
86
+ abort: reason => Promise.resolve(),
87
+ releaseLock: () => {
88
+ this._locked = false;
89
+ },
90
+ closed: Promise.resolve(),
91
+ ready: Promise.resolve()
92
+ };
93
+ return this._writer;
94
+ }
95
+ abort(reason) {
96
+ return Promise.resolve();
97
+ }
98
+ }
99
+ globalThis.WritableStream = WritableStream;
100
+ }
101
+
102
+ // Polyfill TransformStream for fetch API
103
+ if (typeof globalThis.TransformStream === 'undefined') {
104
+ class TransformStream {
105
+ constructor(transformer) {
106
+ _defineProperty(this, "readable", void 0);
107
+ _defineProperty(this, "writable", void 0);
108
+ this.readable = new globalThis.ReadableStream();
109
+ this.writable = new globalThis.WritableStream();
110
+ }
111
+ }
112
+ globalThis.TransformStream = TransformStream;
113
+ }
114
+
115
+ // Polyfill EventTarget for AbortSignal
116
+ if (typeof globalThis.EventTarget === 'undefined') {
117
+ class EventTarget {
118
+ constructor() {
119
+ _defineProperty(this, "_listeners", new Map());
120
+ }
121
+ addEventListener(type, listener) {
122
+ if (!this._listeners.has(type)) {
123
+ this._listeners.set(type, new Set());
124
+ }
125
+ this._listeners.get(type).add(listener);
126
+ }
127
+ removeEventListener(type, listener) {
128
+ const listeners = this._listeners.get(type);
129
+ if (listeners) {
130
+ listeners.delete(listener);
131
+ }
132
+ }
133
+ dispatchEvent(event) {
134
+ const listeners = this._listeners.get(event.type);
135
+ if (listeners) {
136
+ listeners.forEach(listener => listener(event));
137
+ }
138
+ return true;
139
+ }
140
+ }
141
+ globalThis.EventTarget = EventTarget;
142
+ }
143
+
144
+ // Polyfill AbortController for WarpDrive requests
145
+ if (typeof globalThis.AbortController === 'undefined') {
146
+ class AbortController {
147
+ constructor() {
148
+ _defineProperty(this, "signal", void 0);
149
+ this.signal = new AbortSignal();
150
+ }
151
+ abort(reason) {
152
+ this.signal._aborted = true;
153
+ this.signal._reason = reason;
154
+ if (this.signal.onabort) {
155
+ this.signal.onabort();
156
+ }
157
+ // Dispatch abort event
158
+ const event = {
159
+ type: 'abort',
160
+ target: this.signal
161
+ };
162
+ this.signal['dispatchEvent'](event);
163
+ }
164
+ }
165
+ class AbortSignal extends globalThis.EventTarget {
166
+ constructor(...args) {
167
+ super(...args);
168
+ _defineProperty(this, "_aborted", false);
169
+ _defineProperty(this, "_reason", undefined);
170
+ _defineProperty(this, "onabort", null);
171
+ }
172
+ get aborted() {
173
+ return this._aborted;
174
+ }
175
+ get reason() {
176
+ return this._reason;
177
+ }
178
+ throwIfAborted() {
179
+ if (this._aborted) {
180
+ throw this._reason || new Error('Aborted');
181
+ }
182
+ }
183
+ }
184
+ globalThis.AbortController = AbortController;
185
+ globalThis.AbortSignal = AbortSignal;
186
+ }
10
187
  function setup() {
11
188
  globalThis.requireModule = loader.require;
12
189
  globalThis.requirejs = loader.require;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-native",
3
- "version": "3.0.2",
3
+ "version": "3.1.0",
4
4
  "description": "Use the Ember framework with Nativescript",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -25,12 +25,12 @@
25
25
  "loader.js": "*"
26
26
  },
27
27
  "dependencies": {
28
- "@babel/core": "^7.27.7",
29
28
  "@babel/plugin-syntax-decorators": "^7.22.5",
30
29
  "@ember/render-modifiers": "^3.0.0",
31
30
  "@ember/string": "^4.0.0",
32
31
  "@ember/test-waiters": "^4.1.1",
33
32
  "@embroider/addon-shim": "^1.10.2",
33
+ "@embroider/vite": "^1.4.2",
34
34
  "@eslint/js": "^9.28.0",
35
35
  "@glimmer/component": "^2.0.0",
36
36
  "@rollup/plugin-alias": "^5.1.0",
@@ -49,8 +49,7 @@
49
49
  "rollup-plugin-astroturf": "https://codeload.github.com/patricklx/rollup-plugin-astroturf/tar.gz/5354c7a",
50
50
  "rollup-plugin-postcss": "^4.0.2",
51
51
  "rollup-plugin-root-import": "^1.0.0",
52
- "rollup-plugin-styles": "^4.0.0",
53
- "@embroider/vite": "^1.4.2"
52
+ "rollup-plugin-styles": "^4.0.0"
54
53
  },
55
54
  "devDependencies": {
56
55
  "@babel/types": "^7.28.5",
@@ -64,6 +63,7 @@
64
63
  "@embroider/util": "^1.13.3",
65
64
  "@embroider/webpack": "^4.1.1",
66
65
  "@glimmer/syntax": "^0.94.9",
66
+ "@glimmer/tracking": "^1.1.2",
67
67
  "@glint/core": "^1.5.0",
68
68
  "@glint/environment-ember-loose": "^1.5.0",
69
69
  "@glint/environment-ember-template-imports": "^1.5.0",