appium-xcuitest-driver 13.0.6 → 13.0.7

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 (42) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/lib/commands/display.d.ts +3 -3
  3. package/build/lib/commands/display.js +5 -5
  4. package/build/lib/commands/display.js.map +1 -1
  5. package/lib/commands/display.ts +5 -5
  6. package/node_modules/appium-webdriveragent/CHANGELOG.md +7 -0
  7. package/node_modules/appium-webdriveragent/WebDriverAgentLib/Categories/XCUIDevice+FBHinge.h +2 -1
  8. package/node_modules/appium-webdriveragent/WebDriverAgentLib/Categories/XCUIDevice+FBHinge.m +92 -8
  9. package/node_modules/appium-webdriveragent/WebDriverAgentLib/Info.plist +2 -2
  10. package/node_modules/appium-webdriveragent/WebDriverAgentTests/UnitTests/FBCustomCommandsTests.m +27 -0
  11. package/node_modules/appium-webdriveragent/package.json +2 -2
  12. package/node_modules/bare-buffer/CMakeLists.txt +30 -0
  13. package/node_modules/bare-buffer/LICENSE +201 -0
  14. package/node_modules/bare-buffer/README.md +26 -0
  15. package/node_modules/bare-buffer/binding.c +2041 -0
  16. package/node_modules/bare-buffer/binding.js +1 -0
  17. package/node_modules/bare-buffer/global.d.ts +21 -0
  18. package/node_modules/bare-buffer/global.js +6 -0
  19. package/node_modules/bare-buffer/index.d.ts +769 -0
  20. package/node_modules/bare-buffer/index.js +1339 -0
  21. package/node_modules/bare-buffer/lib/ascii.js +36 -0
  22. package/node_modules/bare-buffer/lib/base64.js +25 -0
  23. package/node_modules/bare-buffer/lib/base64url.js +25 -0
  24. package/node_modules/bare-buffer/lib/checked.js +23 -0
  25. package/node_modules/bare-buffer/lib/constants.d.ts +7 -0
  26. package/node_modules/bare-buffer/lib/constants.js +3 -0
  27. package/node_modules/bare-buffer/lib/hex.js +20 -0
  28. package/node_modules/bare-buffer/lib/latin1.js +14 -0
  29. package/node_modules/bare-buffer/lib/utf16le.js +20 -0
  30. package/node_modules/bare-buffer/lib/utf8.js +18 -0
  31. package/node_modules/bare-buffer/package.json +59 -0
  32. package/node_modules/bare-buffer/prebuilds/darwin-arm64/bare-buffer.bare +0 -0
  33. package/node_modules/bare-buffer/prebuilds/linux-arm64/bare-buffer.bare +0 -0
  34. package/node_modules/bare-buffer/prebuilds/linux-x64/bare-buffer.bare +0 -0
  35. package/node_modules/bare-buffer/prebuilds/win32-x64/bare-buffer.bare +0 -0
  36. package/node_modules/bare-url/lib/url-search-params.js +16 -1
  37. package/node_modules/bare-url/package.json +2 -1
  38. package/node_modules/bare-url/prebuilds/darwin-arm64/bare-url.bare +0 -0
  39. package/node_modules/bare-url/prebuilds/linux-arm64/bare-url.bare +0 -0
  40. package/node_modules/bare-url/prebuilds/linux-x64/bare-url.bare +0 -0
  41. package/node_modules/bare-url/prebuilds/win32-x64/bare-url.bare +0 -0
  42. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [13.0.7](https://github.com/appium/appium-xcuitest-driver/compare/v13.0.6...v13.0.7) (2026-11-05)
2
+
3
+ ### Bug Fixes
4
+
5
+ * apply WDA hinge correction to simulated angle commands ([#3131](https://github.com/appium/appium-xcuitest-driver/issues/3131)) ([de0521e](https://github.com/appium/appium-xcuitest-driver/commit/de0521e3a7788d1c35491c5efd7b54096f83f32f))
6
+
1
7
  ## [13.0.6](https://github.com/appium/appium-xcuitest-driver/compare/v13.0.5...v13.0.6) (2026-11-04)
2
8
 
3
9
  ### Bug Fixes
@@ -51,10 +51,10 @@ export declare function getDevicePixelRatio(this: XCUITestDriver): Promise<numbe
51
51
  */
52
52
  export declare function mobileGetSimulatedHingeAngle(this: XCUITestDriver): Promise<number>;
53
53
  /**
54
- * Requests a simulated hinge angle through the host CoreSimulator HID service.
54
+ * Requests a simulated hinge angle through WDA, including its settling/correction logic.
55
55
  * Requires an iPhone Duo Simulator on Xcode 27+; CoreSimulator identifies the device type.
56
- * WDA supplies hinge angle readings.
57
- * The transition completes asynchronously. Select currentDisplayId separately.
56
+ * WDA supplies hinge angle readings. Its correction is best effort; application
57
+ * layout readiness and currentDisplayId selection remain separate.
58
58
  *
59
59
  * @param angle - Degrees from 0 (closed) to 180 (fully open), inclusive.
60
60
  */
@@ -1,5 +1,5 @@
1
1
  import { errors } from 'appium/driver.js';
2
- import { getDuoSimulator, withDuoArgumentErrors } from './helpers/duo.js';
2
+ import { getDuoSimulator } from './helpers/duo.js';
3
3
  /**
4
4
  * Retrieves the viewport dimensions.
5
5
  *
@@ -78,10 +78,10 @@ export async function mobileGetSimulatedHingeAngle() {
78
78
  return await this.proxyCommand('/wda/device/hingeAngle', 'GET');
79
79
  }
80
80
  /**
81
- * Requests a simulated hinge angle through the host CoreSimulator HID service.
81
+ * Requests a simulated hinge angle through WDA, including its settling/correction logic.
82
82
  * Requires an iPhone Duo Simulator on Xcode 27+; CoreSimulator identifies the device type.
83
- * WDA supplies hinge angle readings.
84
- * The transition completes asynchronously. Select currentDisplayId separately.
83
+ * WDA supplies hinge angle readings. Its correction is best effort; application
84
+ * layout readiness and currentDisplayId selection remain separate.
85
85
  *
86
86
  * @param angle - Degrees from 0 (closed) to 180 (fully open), inclusive.
87
87
  */
@@ -90,6 +90,6 @@ export async function mobileSetSimulatedHingeAngle(angle) {
90
90
  if (!simulator) {
91
91
  throw new errors.UnsupportedOperationError('Setting the hinge angle requires an iPhone Duo Simulator on Xcode 27+');
92
92
  }
93
- await withDuoArgumentErrors(() => simulator.setSimulatedHingeAngle(angle));
93
+ await this.proxyCommand('/wda/device/hingeAngle', 'POST', { angle });
94
94
  }
95
95
  //# sourceMappingURL=display.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"display.js","sourceRoot":"","sources":["../../../lib/commands/display.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAGxC,OAAO,EAAC,eAAe,EAAE,qBAAqB,EAAC,MAAM,kBAAkB,CAAC;AAmBxE;;;;;;G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MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,MAAM,EAAC,aAAa,EAAC,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;IACnD,OAAO,aAAa,CAAC,MAAM,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;IAC3C,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B;IAChD,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;AAClE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAuB,KAAa;IACpF,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,MAAM,CAAC,yBAAyB,CAAC,uEAAuE,CAAC,CAAC;IACtH,CAAC;IACD,MAAM,IAAI,CAAC,YAAY,CAAC,wBAAwB,EAAE,MAAM,EAAE,EAAC,KAAK,EAAC,CAAC,CAAC;AACrE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import {errors} from 'appium/driver.js';
2
2
 
3
3
  import type {XCUITestDriver} from '../driver.js';
4
- import {getDuoSimulator, withDuoArgumentErrors} from './helpers/duo.js';
4
+ import {getDuoSimulator} from './helpers/duo.js';
5
5
  import type {Viewport, ScreenInfo, DisplayInfo, WDADisplayInfo} from './types.js';
6
6
 
7
7
  declare module '../driver.js' {
@@ -105,10 +105,10 @@ export async function mobileGetSimulatedHingeAngle(this: XCUITestDriver): Promis
105
105
  }
106
106
 
107
107
  /**
108
- * Requests a simulated hinge angle through the host CoreSimulator HID service.
108
+ * Requests a simulated hinge angle through WDA, including its settling/correction logic.
109
109
  * Requires an iPhone Duo Simulator on Xcode 27+; CoreSimulator identifies the device type.
110
- * WDA supplies hinge angle readings.
111
- * The transition completes asynchronously. Select currentDisplayId separately.
110
+ * WDA supplies hinge angle readings. Its correction is best effort; application
111
+ * layout readiness and currentDisplayId selection remain separate.
112
112
  *
113
113
  * @param angle - Degrees from 0 (closed) to 180 (fully open), inclusive.
114
114
  */
@@ -117,5 +117,5 @@ export async function mobileSetSimulatedHingeAngle(this: XCUITestDriver, angle:
117
117
  if (!simulator) {
118
118
  throw new errors.UnsupportedOperationError('Setting the hinge angle requires an iPhone Duo Simulator on Xcode 27+');
119
119
  }
120
- await withDuoArgumentErrors(() => simulator.setSimulatedHingeAngle(angle));
120
+ await this.proxyCommand('/wda/device/hingeAngle', 'POST', {angle});
121
121
  }
@@ -3,6 +3,13 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [16.17.10](https://github.com/appium/appium-ios/compare/appium-webdriveragent@16.17.9...appium-webdriveragent@16.17.10) (2026-11-05)
7
+
8
+ ### Bug Fixes
9
+
10
+ * **webdriveragent:** correct hinge angle undershoot on iOS 27.2 simulator ([#152](https://github.com/appium/appium-ios/issues/152)) ([b3ce495](https://github.com/appium/appium-ios/commit/b3ce495b49566f0eebff5192c5698d010e6c0ab1)), closes [#151](https://github.com/appium/appium-ios/issues/151)
11
+
12
+
6
13
  ## [16.17.9](https://github.com/appium/appium-ios/compare/appium-webdriveragent@16.17.8...appium-webdriveragent@16.17.9) (2026-11-04)
7
14
 
8
15
  ### Bug Fixes
@@ -30,7 +30,8 @@ NS_ASSUME_NONNULL_BEGIN
30
30
 
31
31
  /**
32
32
  Sends a simulated hinge angle in degrees (0 = closed, 180 = fully open).
33
- This dispatches the event; the display transition completes asynchronously.
33
+ Dispatches the event, then waits for the angle to settle and re-sends a slightly
34
+ nudged value if the reading is off (iOS 27.2 stops intermediate moves short).
34
35
  Verified on the iPhone Duo simulator; physical-device behavior is unverified.
35
36
  Does not change currentDisplayId.
36
37
  */
@@ -16,6 +16,22 @@
16
16
 
17
17
  #if !TARGET_OS_TV && !TARGET_OS_WATCH
18
18
  static const NSTimeInterval FBHingeAngleReadingTimeout = 5.0;
19
+ // iOS 27.2 stops the first move of a hinge gesture ~5% short. A following event with
20
+ // a slightly different value lands exactly, so we verify and correct after settling.
21
+ static const NSTimeInterval FBHingeSettleDelay = 0.4;
22
+ static const NSTimeInterval FBHingeSettlePollInterval = 0.15;
23
+ static const NSTimeInterval FBHingeSettleTimeout = 2.0;
24
+ static const double FBHingeSettledEpsilon = 0.01;
25
+ static const double FBHingeAngleTolerance = 0.05;
26
+ static const double FBHingeCorrectionNudge = 0.001;
27
+ static const NSUInteger FBHingeMaxCorrections = 2;
28
+ static const double FBHingeClosedAngle = 0.0;
29
+ static const double FBHingeOpenAngle = 180.0;
30
+
31
+ static BOOL FBHingeAnglesEqual(double first, double second)
32
+ {
33
+ return fabs(first - second) < FBHingeAngleTolerance;
34
+ }
19
35
 
20
36
  typedef CFDataRef (*FBIOCFSerialize)(CFTypeRef object, CFOptionFlags options);
21
37
  typedef CFTypeRef (*FBIOHIDEventCreateVendorDefinedEvent)(CFAllocatorRef allocator,
@@ -121,6 +137,16 @@ static const FBHingeInjectionAPI *FBHingeInjectionFunctions(void)
121
137
  return nil;
122
138
  }
123
139
  #if !TARGET_OS_TV && !TARGET_OS_WATCH
140
+ return [self fb_hingeAngleWithTimeout:FBHingeAngleReadingTimeout error:error];
141
+ #else
142
+ return nil;
143
+ #endif
144
+ }
145
+
146
+ #if !TARGET_OS_TV && !TARGET_OS_WATCH
147
+
148
+ - (nullable NSNumber *)fb_hingeAngleWithTimeout:(NSTimeInterval)timeout error:(NSError **)error
149
+ {
124
150
  id<FBAngleManager> manager = [FBAngleManagerClass() new];
125
151
  NSOperationQueue *queue = [NSOperationQueue new];
126
152
  queue.maxConcurrentOperationCount = 1;
@@ -144,7 +170,7 @@ static const FBHingeInjectionAPI *FBHingeInjectionFunctions(void)
144
170
  }
145
171
  [condition unlock];
146
172
  }];
147
- NSDate *deadline = [NSDate dateWithTimeIntervalSinceNow:FBHingeAngleReadingTimeout];
173
+ NSDate *deadline = [NSDate dateWithTimeIntervalSinceNow:timeout];
148
174
  [condition lock];
149
175
  while (nil == reading) {
150
176
  if (![condition waitUntilDate:deadline]) {
@@ -158,14 +184,13 @@ static const FBHingeInjectionAPI *FBHingeInjectionFunctions(void)
158
184
  }
159
185
  if (nil == result) {
160
186
  [[FBErrorBuilder.builder withDescriptionFormat:@"Timed out after %g seconds waiting for a valid hinge angle",
161
- FBHingeAngleReadingTimeout] buildError:error];
187
+ timeout] buildError:error];
162
188
  }
163
189
  return result;
164
- #else
165
- return nil;
166
- #endif
167
190
  }
168
191
 
192
+ #endif
193
+
169
194
  - (BOOL)fb_setSimulatedHingeAngle:(double)angle error:(NSError **)error
170
195
  {
171
196
  if (!isfinite(angle) || angle < 0 || angle > 180) {
@@ -175,6 +200,22 @@ static const FBHingeInjectionAPI *FBHingeInjectionFunctions(void)
175
200
  return [[FBErrorBuilder.builder withDescription:@"Hinge angle injection requires an available hinge and the IOKit HID APIs"] buildError:error];
176
201
  }
177
202
  #if !TARGET_OS_TV && !TARGET_OS_WATCH
203
+ if (![self.class fb_dispatchHingeAngle:angle error:error]) {
204
+ return NO;
205
+ }
206
+ if (self.fb_supportsHingeAngleReading) {
207
+ [self fb_correctHingeAngleToward:angle];
208
+ }
209
+ return YES;
210
+ #else
211
+ return NO;
212
+ #endif
213
+ }
214
+
215
+ #if !TARGET_OS_TV && !TARGET_OS_WATCH
216
+
217
+ + (BOOL)fb_dispatchHingeAngle:(double)angle error:(NSError **)error
218
+ {
178
219
  // WDA's fb_performIOHIDEventWithPage:usage:duration:error: uses XCDeviceEvent
179
220
  // with page, usage, and duration only. The XCDeviceEvent interfaces checked
180
221
  // in Xcode 27.1 provide no way to attach the vendor payload containing the
@@ -207,9 +248,52 @@ static const FBHingeInjectionAPI *FBHingeInjectionFunctions(void)
207
248
  CFRelease(client);
208
249
  }
209
250
  return canDispatch || [[FBErrorBuilder.builder withDescription:@"Cannot create the simulated hinge HID event or client"] buildError:error];
210
- #else
211
- return NO;
212
- #endif
213
251
  }
214
252
 
253
+ // Waits until two consecutive readings agree; nil if the angle never settles in time.
254
+ - (nullable NSNumber *)fb_settledHingeAngle
255
+ {
256
+ [NSThread sleepForTimeInterval:FBHingeSettleDelay];
257
+ NSDate *deadline = [NSDate dateWithTimeIntervalSinceNow:FBHingeSettleTimeout];
258
+ NSNumber *previous = nil;
259
+ NSTimeInterval remaining;
260
+ while ((remaining = [deadline timeIntervalSinceNow]) > 0) {
261
+ NSNumber *current = [self fb_hingeAngleWithTimeout:MIN(remaining, FBHingeAngleReadingTimeout) error:nil];
262
+ if (nil == current) {
263
+ return nil;
264
+ }
265
+ if (nil != previous && fabs(current.doubleValue - previous.doubleValue) < FBHingeSettledEpsilon) {
266
+ return current;
267
+ }
268
+ previous = current;
269
+ [NSThread sleepForTimeInterval:FBHingeSettlePollInterval];
270
+ }
271
+ return nil;
272
+ }
273
+
274
+ // Best effort: a failed read or correction never fails the original request.
275
+ - (void)fb_correctHingeAngleToward:(double)angle
276
+ {
277
+ // Identical consecutive values are ignored by the device, so each retry is nudged
278
+ // inward; values near the ends are not nudged outward as >170 snaps to 180.
279
+ double direction = angle <= 90 ? 1 : -1;
280
+ for (NSUInteger attempt = 0; attempt <= FBHingeMaxCorrections; ++attempt) {
281
+ NSNumber *reading = [self fb_settledHingeAngle];
282
+ // 0 and 180 are the device's snap points, so a reading there is final
283
+ if (nil == reading
284
+ || FBHingeAnglesEqual(reading.doubleValue, FBHingeClosedAngle)
285
+ || FBHingeAnglesEqual(reading.doubleValue, FBHingeOpenAngle)
286
+ || FBHingeAnglesEqual(reading.doubleValue, angle)
287
+ || attempt == FBHingeMaxCorrections) {
288
+ return;
289
+ }
290
+ double nudged = angle + direction * FBHingeCorrectionNudge * (attempt + 1);
291
+ if (![self.class fb_dispatchHingeAngle:nudged error:nil]) {
292
+ return;
293
+ }
294
+ }
295
+ }
296
+
297
+ #endif
298
+
215
299
  @end
@@ -15,11 +15,11 @@
15
15
  <key>CFBundlePackageType</key>
16
16
  <string>FMWK</string>
17
17
  <key>CFBundleShortVersionString</key>
18
- <string>16.17.9</string>
18
+ <string>16.17.10</string>
19
19
  <key>CFBundleSignature</key>
20
20
  <string>????</string>
21
21
  <key>CFBundleVersion</key>
22
- <string>16.17.9</string>
22
+ <string>16.17.10</string>
23
23
  <key>NSPrincipalClass</key>
24
24
  <string/>
25
25
  </dict>
@@ -130,6 +130,33 @@
130
130
  XCTAssertEqualObjects([self hingeResponseWithArguments:@{}][@"value"][@"error"], @"invalid argument");
131
131
  }
132
132
 
133
+ - (void)testHingeAngleReadbackMatchesRequestedAngle
134
+ {
135
+ #if TARGET_OS_SIMULATOR
136
+ XCUIDevice *device = XCUIDevice.sharedDevice;
137
+ XCTSkipUnless(device.fb_supportsHingeAngleReading && device.fb_canAttemptSimulatedHingeAngleInjection,
138
+ @"Requires a device with a hinge that supports reading and injection");
139
+ NSNumber *originalAngle = [device fb_getSimulatedHingeAngle:nil];
140
+ XCTAssertNotNil(originalAngle, @"Cannot read the original hinge angle");
141
+ if (nil == originalAngle) {
142
+ return;
143
+ }
144
+ [self addTeardownBlock:^{
145
+ [device fb_setSimulatedHingeAngle:originalAngle.doubleValue error:nil];
146
+ }];
147
+ // Intermediate angles are the ones iOS 27.2 initially stops short of
148
+ for (NSNumber *angle in @[@0, @45, @90, @150, @120, @10, @180]) {
149
+ NSError *error = nil;
150
+ XCTAssertTrue([device fb_setSimulatedHingeAngle:angle.doubleValue error:&error], @"%@", error);
151
+ NSNumber *reading = [device fb_getSimulatedHingeAngle:&error];
152
+ XCTAssertNotNil(reading, @"%@", error);
153
+ XCTAssertEqualWithAccuracy(reading.doubleValue, angle.doubleValue, 0.1, @"Requested %@", angle);
154
+ }
155
+ #else
156
+ XCTSkip(@"Hinge injection is only verified on simulators");
157
+ #endif
158
+ }
159
+
133
160
  - (void)testHingeAngleRejectsUnsupportedDevices
134
161
  {
135
162
  XCTSkipIf(XCUIDevice.sharedDevice.fb_canAttemptSimulatedHingeAngleInjection, @"Requires a device without an available hinge");
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "16.17.9",
3
+ "version": "16.17.10",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "keywords": [
6
6
  "Appium",
@@ -83,5 +83,5 @@
83
83
  "node": "^20.19.0 || ^22.12.0 || >=24.0.0",
84
84
  "npm": ">=10"
85
85
  },
86
- "gitHead": "afeb9cd03af16c7f3cea23633c82d715642c4e58"
86
+ "gitHead": "1da0348a440d0fa66f1b4b65d0334a9d164bc5ab"
87
87
  }
@@ -0,0 +1,30 @@
1
+ cmake_minimum_required(VERSION 4.0)
2
+
3
+ find_package(cmake-bare REQUIRED PATHS node_modules/cmake-bare)
4
+ find_package(cmake-fetch REQUIRED PATHS node_modules/cmake-fetch)
5
+
6
+ project(bare_buffer C)
7
+
8
+ fetch_package("github:holepunchto/libutf#dca86e6")
9
+ fetch_package("github:holepunchto/libbase64#078ad06")
10
+ fetch_package("github:holepunchto/libhex#a4a2c84")
11
+
12
+ add_bare_module(bare_buffer)
13
+
14
+ target_sources(
15
+ ${bare_buffer}
16
+ PRIVATE
17
+ binding.c
18
+ )
19
+
20
+ target_link_libraries(
21
+ ${bare_buffer}
22
+ PRIVATE
23
+ $<TARGET_OBJECTS:utf>
24
+ $<TARGET_OBJECTS:base64>
25
+ $<TARGET_OBJECTS:hex>
26
+ PUBLIC
27
+ utf
28
+ base64
29
+ hex
30
+ )
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,26 @@
1
+ # bare-buffer
2
+
3
+ Native buffers for JavaScript.
4
+
5
+ ```
6
+ npm i bare-buffer
7
+ ```
8
+
9
+ ## Usage
10
+
11
+ ```js
12
+ const Buffer = require('bare-buffer')
13
+
14
+ const message = Buffer.from('hello')
15
+ const empty = Buffer.alloc(16)
16
+ const buffer = Buffer.allocUnsafe(4).fill(123)
17
+ const combined = Buffer.concat([buffer, buffer])
18
+ ```
19
+
20
+ ## API
21
+
22
+ See the [`bare-buffer` reference](https://docs.pears.com/reference/bare/modules/bare-buffer).
23
+
24
+ ## License
25
+
26
+ Apache-2.0