Skip to content

Commit 55a219e

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/allow-conditional-esm-consumption
2 parents 4d2aba4 + d289232 commit 55a219e

22 files changed

Lines changed: 382 additions & 143 deletions

File tree

.github/workflows/dependency-review.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: 'Checkout Repository'
20-
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
20+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2121
- name: 'Dependency Review'
22-
uses: actions/dependency-review-action@595b5aeba73380359d98a5e087f648dbb0edce1b # v4.7.3
22+
uses: actions/dependency-review-action@40c09b7dc99638e5ddb0bfd91c1673effc064d8a # v4.8.1

.github/workflows/npm_release.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ jobs:
2424
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
2525
with:
2626
xcode-version: ${{env.XCODE_VERSION}}
27-
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
27+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2828
with:
2929
fetch-depth: 0
3030
- name: LLVM cache
31-
uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3.4.3
31+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
3232
with:
3333
path: ./llvm
3434
key: ${{ hashFiles('download_llvm.sh') }}
35-
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
35+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
3636
with:
3737
node-version: 20
3838
registry-url: "https://registry.npmjs.org"
@@ -93,13 +93,13 @@ jobs:
9393
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
9494
with:
9595
xcode-version: ${{env.XCODE_VERSION}}
96-
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
96+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
9797
- name: LLVM cache
98-
uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3.4.3
98+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
9999
with:
100100
path: ./llvm
101101
key: ${{ hashFiles('download_llvm.sh') }}
102-
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
102+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
103103
with:
104104
node-version: 20
105105
- name: Install Python
@@ -164,11 +164,11 @@ jobs:
164164
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
165165
with:
166166
egress-policy: audit
167-
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
167+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
168168
with:
169169
node-version: 20
170170
registry-url: "https://registry.npmjs.org"
171-
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
171+
- uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
172172
with:
173173
name: npm-package
174174
path: dist
@@ -194,19 +194,19 @@ jobs:
194194
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
195195
with:
196196
egress-policy: audit
197-
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
197+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
198198
with:
199199
fetch-depth: 0
200-
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
200+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
201201
with:
202202
node-version: 20
203203
- name: Setup
204204
run: npm install
205-
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
205+
- uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
206206
with:
207207
name: npm-package
208208
path: dist
209-
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
209+
- uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
210210
with:
211211
name: NativeScript-dSYMs
212212
path: dist/dSYMs

.github/workflows/pull_request.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ jobs:
1313
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
1414
with:
1515
xcode-version: ${{env.XCODE_VERSION}}
16-
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
16+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1717
with:
1818
fetch-depth: 0
1919
- name: LLVM cache
20-
uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3.4.3
20+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
2121
with:
2222
path: ./llvm
2323
key: ${{ hashFiles('download_llvm.sh') }}
24-
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
24+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
2525
with:
2626
node-version: 20
2727
- name: Install Python
@@ -69,13 +69,13 @@ jobs:
6969
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
7070
with:
7171
xcode-version: ${{env.XCODE_VERSION}}
72-
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
72+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
7373
- name: LLVM cache
74-
uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3.4.3
74+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
7575
with:
7676
path: ./llvm
7777
key: ${{ hashFiles('download_llvm.sh') }}
78-
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
78+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
7979
with:
8080
node-version: 20
8181
- name: Install Python

.github/workflows/scorecards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
steps:
3434

3535
- name: "Checkout code"
36-
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
36+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3737
with:
3838
persist-credentials: false
3939

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
## [8.9.5](https://github.com/NativeScript/ios/compare/v8.9.4...v8.9.5) (2025-10-24)
2+
3+
4+
### Bug Fixes
5+
6+
* make debugger log public ([#302](https://github.com/NativeScript/ios/issues/302)) ([e89067c](https://github.com/NativeScript/ios/commit/e89067cf0f57adcc2479642e4e043b6d6e0d8a0b))
7+
* prevent crash during debug on fast view churn (like with HMR) ([#294](https://github.com/NativeScript/ios/issues/294)) ([42a5328](https://github.com/NativeScript/ios/commit/42a5328f9e95b2298efe067485ac6775718d0510))
8+
* properly convert objective-c logs into os_log ([#301](https://github.com/NativeScript/ios/issues/301)) ([5733af1](https://github.com/NativeScript/ios/commit/5733af1abd896ef8902fbd5b0f57888e71d67d1b))
9+
* symbol loader log true errors only to not confuse terminal output ([#293](https://github.com/NativeScript/ios/issues/293)) ([7101127](https://github.com/NativeScript/ios/commit/710112731a9149020c49c2b2b34a82ebd39a2d49))
10+
* x86 simulators and add better failsafe around generated class names ([#303](https://github.com/NativeScript/ios/issues/303)) ([bb02623](https://github.com/NativeScript/ios/commit/bb02623415359d11cd9e17f3d6351c3b04c4f01d))
11+
12+
13+
### Features
14+
15+
* queueMicrotask support ([#291](https://github.com/NativeScript/ios/issues/291)) ([b12d552](https://github.com/NativeScript/ios/commit/b12d5528885086335487bae4c62cab13ccdb841a))
16+
17+
18+
119
## [8.9.4](https://github.com/NativeScript/ios/compare/v8.9.2...v8.9.3) (2025-09-09)
220

321

NativeScript/inspector/JsV8InspectorClient.mm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
[[NSString stringWithFormat:@"%@:NativeScript.Debug.%s", \
2525
[[NSBundle mainBundle] bundleIdentifier], name] UTF8String]
2626

27-
#define LOG_DEBUGGER_PORT(port) \
28-
NSLog(@"NativeScript debugger has opened inspector socket on port %d for %@.", port, \
29-
[[NSBundle mainBundle] bundleIdentifier])
27+
#define LOG_DEBUGGER_PORT(port) \
28+
Log(@"NativeScript debugger has opened inspector socket on port %d for %@.", port, \
29+
[[NSBundle mainBundle] bundleIdentifier])
3030

3131
JsV8InspectorClient::JsV8InspectorClient(tns::Runtime* runtime)
3232
: runtime_(runtime), isolate_(runtime_->GetIsolate()), messages_(), runningNestedLoops_(false) {
@@ -578,4 +578,4 @@
578578

579579
std::map<std::string, Persistent<Object>*> JsV8InspectorClient::Domains;
580580

581-
}
581+
} // namespace v8_inspector
Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,18 @@
11
#include "ClassBuilder.h"
2-
#if TARGET_CPU_X86_64 || TARGET_CPU_X86
3-
#include "SpinLock.h"
4-
#endif
52

63
namespace tns {
74

85
// Moved this method in a separate .cpp file because ARC destroys the class
96
// created with objc_allocateClassPair when the control leaves this method scope
10-
// TODO: revist this as there are x86 simulator issues, so maybe a lock is
11-
// needed regardless
7+
// TODO: revist this. Maybe a lock is needed regardless
128
Class ClassBuilder::GetExtendedClass(std::string baseClassName,
13-
std::string staticClassName) {
14-
#if TARGET_CPU_X86_64 || TARGET_CPU_X86
15-
// X86 simulators have this bugged, so we fallback to old behavior
16-
static SpinMutex m;
17-
SpinLock lock(m);
9+
std::string staticClassName,
10+
std::string suffix) {
1811
Class baseClass = objc_getClass(baseClassName.c_str());
1912
std::string name =
2013
!staticClassName.empty()
2114
? staticClassName
22-
: baseClassName + "_" +
23-
std::to_string(++ClassBuilder::classNameCounter_);
24-
Class clazz = objc_getClass(name.c_str());
25-
26-
if (clazz != nil) {
27-
int i = 1;
28-
std::string initialName = name;
29-
while (clazz != nil) {
30-
name = initialName + std::to_string(i++);
31-
clazz = objc_getClass(name.c_str());
32-
}
33-
}
34-
35-
clazz = objc_allocateClassPair(baseClass, name.c_str(), 0);
36-
37-
objc_registerClassPair(clazz);
38-
return clazz;
39-
#else
40-
Class baseClass = objc_getClass(baseClassName.c_str());
41-
std::string name =
42-
!staticClassName.empty()
43-
? staticClassName
44-
: baseClassName + "_" +
15+
: baseClassName + suffix + "_" +
4516
std::to_string(++ClassBuilder::classNameCounter_);
4617
// here we could either call objc_getClass with the name to see if the class
4718
// already exists or we can just try allocating it, which will return nil if
@@ -60,7 +31,6 @@ Class ClassBuilder::GetExtendedClass(std::string baseClassName,
6031

6132
objc_registerClassPair(clazz);
6233
return clazz;
63-
#endif
6434
}
6535

6636
} // namespace tns

NativeScript/runtime/ClassBuilder.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ struct PropertyCallbackContext {
2323
class ClassBuilder {
2424
public:
2525
static v8::Local<v8::FunctionTemplate> GetExtendFunction(v8::Isolate* isolate, const InterfaceMeta* interfaceMeta);
26-
static Class GetExtendedClass(std::string baseClassName, std::string staticClassName);
26+
static Class GetExtendedClass(std::string baseClassName, std::string staticClassName, std::string suffix);
2727

2828
static void RegisterBaseTypeScriptExtendsFunction(v8::Local<v8::Context> context);
2929
static void RegisterNativeTypeScriptExtendsFunction(v8::Local<v8::Context> context);
3030
static std::string GetTypeEncoding(const TypeEncoding* typeEncoding, int argsCount);
3131
private:
32-
static unsigned long long classNameCounter_;
32+
static std::atomic<unsigned long long> classNameCounter_;
3333

3434
static void ExtendCallback(const v8::FunctionCallbackInfo<v8::Value>& info);
3535
static void SuperAccessorGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info);

NativeScript/runtime/ClassBuilder.mm

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@
5757
staticClassName = tns::ToString(isolate, explicitClassName);
5858
}
5959
}
60+
auto cache = Caches::Get(isolate);
61+
auto isolateId = cache->getIsolateId();
6062

61-
Class extendedClass = ClassBuilder::GetExtendedClass(baseClassName, staticClassName);
63+
Class extendedClass = ClassBuilder::GetExtendedClass(baseClassName, staticClassName, std::to_string(isolateId) + "_");
6264
class_addProtocol(extendedClass, @protocol(TNSDerivedClass));
6365
class_addProtocol(object_getClass(extendedClass), @protocol(TNSDerivedClass));
6466

@@ -70,7 +72,6 @@
7072
implementationObject);
7173
}
7274

73-
auto cache = Caches::Get(isolate);
7475
Local<v8::Function> baseCtorFunc =
7576
cache->CtorFuncs.find(item->meta_->name())->second->Get(isolate);
7677

@@ -212,8 +213,9 @@
212213
Local<v8::Function> extendedClassCtorFunc = info[0].As<v8::Function>();
213214
std::string extendedClassName = tns::ToString(isolate, extendedClassCtorFunc->GetName());
214215

216+
auto isolateId = cache->getIsolateId();
215217
__block Class extendedClass =
216-
ClassBuilder::GetExtendedClass(baseClassName, extendedClassName);
218+
ClassBuilder::GetExtendedClass(baseClassName, extendedClassName, std::to_string(isolateId) + "_");
217219
class_addProtocol(extendedClass, @protocol(TNSDerivedClass));
218220
class_addProtocol(object_getClass(extendedClass), @protocol(TNSDerivedClass));
219221

@@ -984,6 +986,6 @@
984986
return class_getMethodImplementation(klass, method);
985987
}
986988

987-
unsigned long long ClassBuilder::classNameCounter_ = 0;
989+
std::atomic<unsigned long long> ClassBuilder::classNameCounter_{0};
988990

989991
} // namespace tns

NativeScript/runtime/Helpers.h

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ bool IsArrayOrArrayLike(v8::Isolate* isolate,
219219
void* TryGetBufferFromArrayBuffer(const v8::Local<v8::Value>& value,
220220
bool& isArrayBuffer);
221221

222-
void ExecuteOnRunLoop(CFRunLoopRef queue, std::function<void()> func,
223-
bool async = true);
222+
void ExecuteOnRunLoop(CFRunLoopRef queue, void (^func)(void), bool async = true);
224223
void ExecuteOnDispatchQueue(dispatch_queue_t queue, std::function<void()> func,
225224
bool async = true);
226225
void ExecuteOnMainThread(std::function<void()> func, bool async = true);
@@ -240,47 +239,27 @@ static inline void TNS_FormatAndLog(NSString* fmt, ...) {
240239
va_list ap;
241240
va_start(ap, fmt);
242241

243-
// Convert NSString format to C string and delegate to the main implementation
244-
const char* cFmt = [fmt UTF8String];
245-
if (!cFmt) {
246-
va_end(ap);
242+
// Use NSString's formatting to handle both C and Objective-C format
243+
// specifiers
244+
NSString* formattedString =
245+
[[NSString alloc] initWithFormat:fmt arguments:ap];
246+
va_end(ap);
247+
248+
if (!formattedString) {
247249
return;
248250
}
249251

250-
// Fast path: try a reasonably sized stack buffer first
251-
const int STACK_BUF_SIZE = 1024;
252-
char stack_buf[STACK_BUF_SIZE];
253-
254-
va_list ap_copy;
255-
va_copy(ap_copy, ap);
256-
int needed = vsnprintf(stack_buf, STACK_BUF_SIZE, cFmt, ap_copy);
257-
va_end(ap_copy);
258-
259-
if (needed < 0) {
260-
va_end(ap);
252+
// Convert to C string for logging
253+
const char* cStr = [formattedString UTF8String];
254+
if (!cStr) {
261255
return;
262256
}
263257

264-
if (needed < STACK_BUF_SIZE) {
265-
// Message fit into stack buffer
266-
#if TNS_HAVE_OS_LOG
267-
os_log(OS_LOG_DEFAULT, "%{public}s", stack_buf);
268-
#else
269-
NSLog(@"%s", stack_buf);
270-
#endif
271-
} else {
272-
// Needs heap allocation
273-
std::vector<char> buffer((size_t)needed + 1);
274-
vsnprintf(buffer.data(), buffer.size(), cFmt, ap);
275-
276258
#if TNS_HAVE_OS_LOG
277-
os_log(OS_LOG_DEFAULT, "%{public}s", buffer.data());
259+
os_log(OS_LOG_DEFAULT, "%{public}s", cStr);
278260
#else
279-
NSLog(@"%s", buffer.data());
261+
NSLog(@"%s", cStr);
280262
#endif
281-
}
282-
283-
va_end(ap);
284263
}
285264
#endif
286265

@@ -337,7 +316,7 @@ static inline void TNS_FormatAndLog(const char* fmt, ...) {
337316
}
338317

339318
// Keep the existing Log(...) macro name for call-site compatibility.
340-
#define Log(...) TNS_FormatAndLog(__VA_ARGS__)
319+
#define Log(...) tns::TNS_FormatAndLog(__VA_ARGS__)
341320

342321
v8::Local<v8::String> JsonStringifyObject(v8::Local<v8::Context> context,
343322
v8::Local<v8::Value> value,

0 commit comments

Comments
 (0)