react-native-windows 0.0.0-canary.487 → 0.0.0-canary.488
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/Libraries/StyleSheet/processTransform.windows.js +272 -0
- package/Microsoft.ReactNative/Views/FrameworkElementViewManager.cpp +90 -18
- package/PropertySheets/Generated/PackageVersion.g.props +1 -1
- package/Shared/Shared.vcxitems +0 -1
- package/Shared/Shared.vcxitems.filters +0 -3
- package/include/Shared/cdebug.h +9 -9
- package/package.json +1 -1
- package/Shared/cdebug.cpp +0 -6
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @flow
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
const MatrixMath = require('../Utilities/MatrixMath');
|
|
14
|
+
const Platform = require('../Utilities/Platform');
|
|
15
|
+
|
|
16
|
+
const invariant = require('invariant');
|
|
17
|
+
const stringifySafe = require('../Utilities/stringifySafe').default;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Generate a transform matrix based on the provided transforms, and use that
|
|
21
|
+
* within the style object instead.
|
|
22
|
+
*
|
|
23
|
+
* This allows us to provide an API that is similar to CSS, where transforms may
|
|
24
|
+
* be applied in an arbitrary order, and yet have a universal, singular
|
|
25
|
+
* interface to native code.
|
|
26
|
+
*/
|
|
27
|
+
function processTransform(
|
|
28
|
+
transform: Array<Object>,
|
|
29
|
+
): Array<Object> | Array<number> {
|
|
30
|
+
if (__DEV__) {
|
|
31
|
+
_validateTransforms(transform);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Android & iOS implementations of transform property accept the list of
|
|
35
|
+
// transform properties as opposed to a transform Matrix. This is necessary
|
|
36
|
+
// to control transform property updates completely on the native thread.
|
|
37
|
+
if (
|
|
38
|
+
Platform.OS === 'android' ||
|
|
39
|
+
Platform.OS === 'ios' ||
|
|
40
|
+
Platform.OS === 'windows'
|
|
41
|
+
) {
|
|
42
|
+
return transform;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const result = MatrixMath.createIdentityMatrix();
|
|
46
|
+
|
|
47
|
+
transform.forEach((transformation) => {
|
|
48
|
+
const key = Object.keys(transformation)[0];
|
|
49
|
+
const value = transformation[key];
|
|
50
|
+
|
|
51
|
+
switch (key) {
|
|
52
|
+
case 'matrix':
|
|
53
|
+
MatrixMath.multiplyInto(result, result, value);
|
|
54
|
+
break;
|
|
55
|
+
case 'perspective':
|
|
56
|
+
_multiplyTransform(result, MatrixMath.reusePerspectiveCommand, [value]);
|
|
57
|
+
break;
|
|
58
|
+
case 'rotateX':
|
|
59
|
+
_multiplyTransform(result, MatrixMath.reuseRotateXCommand, [
|
|
60
|
+
_convertToRadians(value),
|
|
61
|
+
]);
|
|
62
|
+
break;
|
|
63
|
+
case 'rotateY':
|
|
64
|
+
_multiplyTransform(result, MatrixMath.reuseRotateYCommand, [
|
|
65
|
+
_convertToRadians(value),
|
|
66
|
+
]);
|
|
67
|
+
break;
|
|
68
|
+
case 'rotate':
|
|
69
|
+
case 'rotateZ':
|
|
70
|
+
_multiplyTransform(result, MatrixMath.reuseRotateZCommand, [
|
|
71
|
+
_convertToRadians(value),
|
|
72
|
+
]);
|
|
73
|
+
break;
|
|
74
|
+
case 'scale':
|
|
75
|
+
_multiplyTransform(result, MatrixMath.reuseScaleCommand, [value]);
|
|
76
|
+
break;
|
|
77
|
+
case 'scaleX':
|
|
78
|
+
_multiplyTransform(result, MatrixMath.reuseScaleXCommand, [value]);
|
|
79
|
+
break;
|
|
80
|
+
case 'scaleY':
|
|
81
|
+
_multiplyTransform(result, MatrixMath.reuseScaleYCommand, [value]);
|
|
82
|
+
break;
|
|
83
|
+
case 'translate':
|
|
84
|
+
_multiplyTransform(result, MatrixMath.reuseTranslate3dCommand, [
|
|
85
|
+
value[0],
|
|
86
|
+
value[1],
|
|
87
|
+
value[2] || 0,
|
|
88
|
+
]);
|
|
89
|
+
break;
|
|
90
|
+
case 'translateX':
|
|
91
|
+
_multiplyTransform(result, MatrixMath.reuseTranslate2dCommand, [
|
|
92
|
+
value,
|
|
93
|
+
0,
|
|
94
|
+
]);
|
|
95
|
+
break;
|
|
96
|
+
case 'translateY':
|
|
97
|
+
_multiplyTransform(result, MatrixMath.reuseTranslate2dCommand, [
|
|
98
|
+
0,
|
|
99
|
+
value,
|
|
100
|
+
]);
|
|
101
|
+
break;
|
|
102
|
+
case 'skewX':
|
|
103
|
+
_multiplyTransform(result, MatrixMath.reuseSkewXCommand, [
|
|
104
|
+
_convertToRadians(value),
|
|
105
|
+
]);
|
|
106
|
+
break;
|
|
107
|
+
case 'skewY':
|
|
108
|
+
_multiplyTransform(result, MatrixMath.reuseSkewYCommand, [
|
|
109
|
+
_convertToRadians(value),
|
|
110
|
+
]);
|
|
111
|
+
break;
|
|
112
|
+
default:
|
|
113
|
+
throw new Error('Invalid transform name: ' + key);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Performs a destructive operation on a transform matrix.
|
|
122
|
+
*/
|
|
123
|
+
function _multiplyTransform(
|
|
124
|
+
result: Array<number>,
|
|
125
|
+
matrixMathFunction: Function,
|
|
126
|
+
args: Array<number>,
|
|
127
|
+
): void {
|
|
128
|
+
const matrixToApply = MatrixMath.createIdentityMatrix();
|
|
129
|
+
const argsWithIdentity = [matrixToApply].concat(args);
|
|
130
|
+
matrixMathFunction.apply(this, argsWithIdentity);
|
|
131
|
+
MatrixMath.multiplyInto(result, result, matrixToApply);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Parses a string like '0.5rad' or '60deg' into radians expressed in a float.
|
|
136
|
+
* Note that validation on the string is done in `_validateTransform()`.
|
|
137
|
+
*/
|
|
138
|
+
function _convertToRadians(value: string): number {
|
|
139
|
+
const floatValue = parseFloat(value);
|
|
140
|
+
return value.indexOf('rad') > -1 ? floatValue : (floatValue * Math.PI) / 180;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function _validateTransforms(transform: Array<Object>): void {
|
|
144
|
+
transform.forEach((transformation) => {
|
|
145
|
+
const keys = Object.keys(transformation);
|
|
146
|
+
invariant(
|
|
147
|
+
keys.length === 1,
|
|
148
|
+
'You must specify exactly one property per transform object. Passed properties: %s',
|
|
149
|
+
stringifySafe(transformation),
|
|
150
|
+
);
|
|
151
|
+
const key = keys[0];
|
|
152
|
+
const value = transformation[key];
|
|
153
|
+
_validateTransform(key, value, transformation);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function _validateTransform(
|
|
158
|
+
key:
|
|
159
|
+
| string
|
|
160
|
+
| $TEMPORARY$string<'matrix'>
|
|
161
|
+
| $TEMPORARY$string<'perspective'>
|
|
162
|
+
| $TEMPORARY$string<'rotate'>
|
|
163
|
+
| $TEMPORARY$string<'rotateX'>
|
|
164
|
+
| $TEMPORARY$string<'rotateY'>
|
|
165
|
+
| $TEMPORARY$string<'rotateZ'>
|
|
166
|
+
| $TEMPORARY$string<'scale'>
|
|
167
|
+
| $TEMPORARY$string<'scaleX'>
|
|
168
|
+
| $TEMPORARY$string<'scaleY'>
|
|
169
|
+
| $TEMPORARY$string<'skewX'>
|
|
170
|
+
| $TEMPORARY$string<'skewY'>
|
|
171
|
+
| $TEMPORARY$string<'translate'>
|
|
172
|
+
| $TEMPORARY$string<'translateX'>
|
|
173
|
+
| $TEMPORARY$string<'translateY'>,
|
|
174
|
+
value: any | number | string,
|
|
175
|
+
transformation: any,
|
|
176
|
+
) {
|
|
177
|
+
invariant(
|
|
178
|
+
!value.getValue,
|
|
179
|
+
'You passed an Animated.Value to a normal component. ' +
|
|
180
|
+
'You need to wrap that component in an Animated. For example, ' +
|
|
181
|
+
'replace <View /> by <Animated.View />.',
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
const multivalueTransforms = ['matrix', 'translate'];
|
|
185
|
+
if (multivalueTransforms.indexOf(key) !== -1) {
|
|
186
|
+
invariant(
|
|
187
|
+
Array.isArray(value),
|
|
188
|
+
'Transform with key of %s must have an array as the value: %s',
|
|
189
|
+
key,
|
|
190
|
+
stringifySafe(transformation),
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
switch (key) {
|
|
194
|
+
case 'matrix':
|
|
195
|
+
invariant(
|
|
196
|
+
value.length === 9 || value.length === 16,
|
|
197
|
+
'Matrix transform must have a length of 9 (2d) or 16 (3d). ' +
|
|
198
|
+
'Provided matrix has a length of %s: %s',
|
|
199
|
+
/* $FlowFixMe[prop-missing] (>=0.84.0 site=react_native_fb) This
|
|
200
|
+
* comment suppresses an error found when Flow v0.84 was deployed. To
|
|
201
|
+
* see the error, delete this comment and run Flow. */
|
|
202
|
+
value.length,
|
|
203
|
+
stringifySafe(transformation),
|
|
204
|
+
);
|
|
205
|
+
break;
|
|
206
|
+
case 'translate':
|
|
207
|
+
invariant(
|
|
208
|
+
value.length === 2 || value.length === 3,
|
|
209
|
+
'Transform with key translate must be an array of length 2 or 3, found %s: %s',
|
|
210
|
+
/* $FlowFixMe[prop-missing] (>=0.84.0 site=react_native_fb) This
|
|
211
|
+
* comment suppresses an error found when Flow v0.84 was deployed. To
|
|
212
|
+
* see the error, delete this comment and run Flow. */
|
|
213
|
+
value.length,
|
|
214
|
+
stringifySafe(transformation),
|
|
215
|
+
);
|
|
216
|
+
break;
|
|
217
|
+
case 'rotateX':
|
|
218
|
+
case 'rotateY':
|
|
219
|
+
case 'rotateZ':
|
|
220
|
+
case 'rotate':
|
|
221
|
+
case 'skewX':
|
|
222
|
+
case 'skewY':
|
|
223
|
+
invariant(
|
|
224
|
+
typeof value === 'string',
|
|
225
|
+
'Transform with key of "%s" must be a string: %s',
|
|
226
|
+
key,
|
|
227
|
+
stringifySafe(transformation),
|
|
228
|
+
);
|
|
229
|
+
invariant(
|
|
230
|
+
value.indexOf('deg') > -1 || value.indexOf('rad') > -1,
|
|
231
|
+
'Rotate transform must be expressed in degrees (deg) or radians ' +
|
|
232
|
+
'(rad): %s',
|
|
233
|
+
stringifySafe(transformation),
|
|
234
|
+
);
|
|
235
|
+
break;
|
|
236
|
+
case 'perspective':
|
|
237
|
+
invariant(
|
|
238
|
+
typeof value === 'number',
|
|
239
|
+
'Transform with key of "%s" must be a number: %s',
|
|
240
|
+
key,
|
|
241
|
+
stringifySafe(transformation),
|
|
242
|
+
);
|
|
243
|
+
invariant(
|
|
244
|
+
value !== 0,
|
|
245
|
+
'Transform with key of "%s" cannot be zero: %s',
|
|
246
|
+
key,
|
|
247
|
+
stringifySafe(transformation),
|
|
248
|
+
);
|
|
249
|
+
break;
|
|
250
|
+
case 'translateX':
|
|
251
|
+
case 'translateY':
|
|
252
|
+
case 'scale':
|
|
253
|
+
case 'scaleX':
|
|
254
|
+
case 'scaleY':
|
|
255
|
+
invariant(
|
|
256
|
+
typeof value === 'number',
|
|
257
|
+
'Transform with key of "%s" must be a number: %s',
|
|
258
|
+
key,
|
|
259
|
+
stringifySafe(transformation),
|
|
260
|
+
);
|
|
261
|
+
break;
|
|
262
|
+
default:
|
|
263
|
+
invariant(
|
|
264
|
+
false,
|
|
265
|
+
'Invalid transform %s: %s',
|
|
266
|
+
key,
|
|
267
|
+
stringifySafe(transformation),
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
module.exports = processTransform;
|
|
@@ -99,6 +99,21 @@ static void GetAccessibilityValueProps(const winrt::Microsoft::ReactNative::IJSV
|
|
|
99
99
|
writer.WriteObjectEnd();
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
inline float ToRadians(const winrt::Microsoft::ReactNative::JSValue &value) {
|
|
103
|
+
if ((value.Type() == winrt::Microsoft::ReactNative::JSValueType::Double)) {
|
|
104
|
+
return value.AsSingle();
|
|
105
|
+
}
|
|
106
|
+
assert(value.Type() == winrt::Microsoft::ReactNative::JSValueType::String);
|
|
107
|
+
|
|
108
|
+
auto stringValue = value.AsString();
|
|
109
|
+
char *suffixStart;
|
|
110
|
+
double num = strtod(stringValue.c_str(), &suffixStart);
|
|
111
|
+
if (0 == strncmp(suffixStart, "deg", 3)) {
|
|
112
|
+
return static_cast<float>(num * M_PI / 180.0f);
|
|
113
|
+
}
|
|
114
|
+
return static_cast<float>(num); // assume suffix is "rad"
|
|
115
|
+
}
|
|
116
|
+
|
|
102
117
|
void FrameworkElementViewManager::GetNativeProps(const winrt::Microsoft::ReactNative::IJSValueWriter &writer) const {
|
|
103
118
|
Super::GetNativeProps(writer);
|
|
104
119
|
|
|
@@ -139,24 +154,81 @@ bool FrameworkElementViewManager::UpdateProperty(
|
|
|
139
154
|
if (element.try_as<xaml::IUIElement10>()) // Works on 19H1+
|
|
140
155
|
{
|
|
141
156
|
if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Array) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
winrt::Windows::Foundation::Numerics::float4x4 transformMatrix{
|
|
158
|
+
winrt::Windows::Foundation::Numerics::float4x4::identity()};
|
|
159
|
+
for (const auto &transform : propertyValue.AsArray()) {
|
|
160
|
+
for (const auto &operation : transform.AsObject()) {
|
|
161
|
+
const std::string &transformType = operation.first;
|
|
162
|
+
const auto &innerValue = operation.second;
|
|
163
|
+
|
|
164
|
+
if (transformType == "matrix") {
|
|
165
|
+
assert(innerValue.AsArray().size() == 16);
|
|
166
|
+
winrt::Windows::Foundation::Numerics::float4x4 innerMatrix;
|
|
167
|
+
innerMatrix.m11 = static_cast<float>(innerValue[0].AsDouble());
|
|
168
|
+
innerMatrix.m12 = static_cast<float>(innerValue[1].AsDouble());
|
|
169
|
+
innerMatrix.m13 = static_cast<float>(innerValue[2].AsDouble());
|
|
170
|
+
innerMatrix.m14 = static_cast<float>(innerValue[3].AsDouble());
|
|
171
|
+
innerMatrix.m21 = static_cast<float>(innerValue[4].AsDouble());
|
|
172
|
+
innerMatrix.m22 = static_cast<float>(innerValue[5].AsDouble());
|
|
173
|
+
innerMatrix.m23 = static_cast<float>(innerValue[6].AsDouble());
|
|
174
|
+
innerMatrix.m24 = static_cast<float>(innerValue[7].AsDouble());
|
|
175
|
+
innerMatrix.m31 = static_cast<float>(innerValue[8].AsDouble());
|
|
176
|
+
innerMatrix.m32 = static_cast<float>(innerValue[9].AsDouble());
|
|
177
|
+
innerMatrix.m33 = static_cast<float>(innerValue[10].AsDouble());
|
|
178
|
+
innerMatrix.m34 = static_cast<float>(innerValue[11].AsDouble());
|
|
179
|
+
innerMatrix.m41 = static_cast<float>(innerValue[12].AsDouble());
|
|
180
|
+
innerMatrix.m42 = static_cast<float>(innerValue[13].AsDouble());
|
|
181
|
+
innerMatrix.m43 = static_cast<float>(innerValue[14].AsDouble());
|
|
182
|
+
innerMatrix.m44 = static_cast<float>(innerValue[15].AsDouble());
|
|
183
|
+
transformMatrix = transformMatrix * innerMatrix;
|
|
184
|
+
} else if (transformType == "perspective") {
|
|
185
|
+
auto innerMatrix = winrt::Windows::Foundation::Numerics::float4x4::identity();
|
|
186
|
+
innerMatrix.m34 = -1 / innerValue.AsSingle();
|
|
187
|
+
transformMatrix = transformMatrix * innerMatrix;
|
|
188
|
+
} else if (transformType == "rotateX") {
|
|
189
|
+
transformMatrix = transformMatrix *
|
|
190
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_rotation_x(ToRadians(innerValue));
|
|
191
|
+
} else if (transformType == "rotateY") {
|
|
192
|
+
transformMatrix = transformMatrix *
|
|
193
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_rotation_y(ToRadians(innerValue));
|
|
194
|
+
} else if (transformType == "rotate" || transformType == "rotateZ") {
|
|
195
|
+
transformMatrix = transformMatrix *
|
|
196
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_rotation_z(ToRadians(innerValue));
|
|
197
|
+
} else if (transformType == "scale") {
|
|
198
|
+
transformMatrix = transformMatrix *
|
|
199
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_scale(
|
|
200
|
+
innerValue.AsSingle(), innerValue.AsSingle(), 1);
|
|
201
|
+
} else if (transformType == "scaleX") {
|
|
202
|
+
transformMatrix = transformMatrix *
|
|
203
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_scale(innerValue.AsSingle(), 1, 1);
|
|
204
|
+
} else if (transformType == "scaleY") {
|
|
205
|
+
transformMatrix = transformMatrix *
|
|
206
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_scale(1, innerValue.AsSingle(), 1);
|
|
207
|
+
} else if (transformType == "translate") {
|
|
208
|
+
auto ¶ms = innerValue.AsArray();
|
|
209
|
+
transformMatrix =
|
|
210
|
+
transformMatrix *
|
|
211
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_translation(
|
|
212
|
+
params[0].AsSingle(), params[1].AsSingle(), params.size() > 2 ? params[2].AsSingle() : 0.f);
|
|
213
|
+
} else if (transformType == "translateX") {
|
|
214
|
+
transformMatrix = transformMatrix *
|
|
215
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_translation(innerValue.AsSingle(), 0.f, 0.f);
|
|
216
|
+
} else if (transformType == "translateY") {
|
|
217
|
+
transformMatrix = transformMatrix *
|
|
218
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_translation(0.f, innerValue.AsSingle(), 0.f);
|
|
219
|
+
} else if (transformType == "skewX") {
|
|
220
|
+
transformMatrix =
|
|
221
|
+
transformMatrix *
|
|
222
|
+
winrt::Windows::Foundation::Numerics::float4x4(
|
|
223
|
+
winrt::Windows::Foundation::Numerics::make_float3x2_skew(innerValue.AsSingle(), 0.f));
|
|
224
|
+
} else if (transformType == "skewY") {
|
|
225
|
+
transformMatrix =
|
|
226
|
+
transformMatrix *
|
|
227
|
+
winrt::Windows::Foundation::Numerics::float4x4(
|
|
228
|
+
winrt::Windows::Foundation::Numerics::make_float3x2_skew(0.f, innerValue.AsSingle()));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
160
232
|
|
|
161
233
|
if (!element.IsLoaded()) {
|
|
162
234
|
element.Loaded([=](auto sender, auto &&) -> auto {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.0.0-canary.
|
|
13
|
+
<ReactNativeWindowsVersion>0.0.0-canary.488</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>0</ReactNativeWindowsMinor>
|
|
16
16
|
<ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
|
package/Shared/Shared.vcxitems
CHANGED
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
<ClCompile Include="$(MSBuildThisFileDirectory)AsyncStorage\KeyValueStorage.cpp" />
|
|
21
21
|
<ClCompile Include="$(MSBuildThisFileDirectory)AsyncStorage\StorageFileIO.cpp" />
|
|
22
22
|
<ClCompile Include="$(MSBuildThisFileDirectory)BaseScriptStoreImpl.cpp" />
|
|
23
|
-
<ClCompile Include="$(MSBuildThisFileDirectory)cdebug.cpp" />
|
|
24
23
|
<ClCompile Include="$(MSBuildThisFileDirectory)ChakraRuntimeHolder.cpp" />
|
|
25
24
|
<ClCompile Include="$(MSBuildThisFileDirectory)CxxMessageQueue.cpp" />
|
|
26
25
|
<ClCompile Include="$(MSBuildThisFileDirectory)DevSupportManager.cpp" />
|
|
@@ -37,9 +37,6 @@
|
|
|
37
37
|
<ClCompile Include="$(MSBuildThisFileDirectory)BaseScriptStoreImpl.cpp">
|
|
38
38
|
<Filter>Source Files</Filter>
|
|
39
39
|
</ClCompile>
|
|
40
|
-
<ClCompile Include="$(MSBuildThisFileDirectory)cdebug.cpp">
|
|
41
|
-
<Filter>Source Files</Filter>
|
|
42
|
-
</ClCompile>
|
|
43
40
|
<ClCompile Include="$(MSBuildThisFileDirectory)ChakraRuntimeHolder.cpp">
|
|
44
41
|
<Filter>Source Files</Filter>
|
|
45
42
|
</ClCompile>
|
package/include/Shared/cdebug.h
CHANGED
|
@@ -4,37 +4,37 @@
|
|
|
4
4
|
#include <sstream>
|
|
5
5
|
#include <string>
|
|
6
6
|
|
|
7
|
-
struct basic_dostream
|
|
7
|
+
struct basic_dostream {};
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
inline constexpr basic_dostream cdebug{};
|
|
10
10
|
|
|
11
|
-
inline basic_dostream &operator<<(basic_dostream &o, const char *str) {
|
|
11
|
+
inline const basic_dostream &operator<<(const basic_dostream &o, const char *str) {
|
|
12
12
|
OutputDebugStringA(str);
|
|
13
13
|
return o;
|
|
14
14
|
}
|
|
15
|
-
inline basic_dostream &operator<<(basic_dostream &o, const wchar_t *str) {
|
|
15
|
+
inline const basic_dostream &operator<<(const basic_dostream &o, const wchar_t *str) {
|
|
16
16
|
OutputDebugStringW(str);
|
|
17
17
|
return o;
|
|
18
18
|
}
|
|
19
19
|
template <typename T>
|
|
20
|
-
basic_dostream &operator<<(basic_dostream &o, const T &t) {
|
|
20
|
+
const basic_dostream &operator<<(const basic_dostream &o, const T &t) {
|
|
21
21
|
auto str = std::to_string(t);
|
|
22
22
|
return o << str;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
inline basic_dostream &operator<<(basic_dostream &o, const std::string_view &sv) {
|
|
25
|
+
inline const basic_dostream &operator<<(const basic_dostream &o, const std::string_view &sv) {
|
|
26
26
|
return o << sv.data();
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
inline basic_dostream &operator<<(basic_dostream &o, const std::string &sv) {
|
|
29
|
+
inline const basic_dostream &operator<<(const basic_dostream &o, const std::string &sv) {
|
|
30
30
|
return o << sv.data();
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
inline basic_dostream &operator<<(basic_dostream &o, const std::wstring_view &sv) {
|
|
33
|
+
inline const basic_dostream &operator<<(const basic_dostream &o, const std::wstring_view &sv) {
|
|
34
34
|
return o << sv.data();
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
inline basic_dostream &operator<<(basic_dostream &o, const std::wstring &sv) {
|
|
37
|
+
inline const basic_dostream &operator<<(const basic_dostream &o, const std::wstring &sv) {
|
|
38
38
|
return o << sv.data();
|
|
39
39
|
}
|
|
40
40
|
|
package/package.json
CHANGED