react-native-windows 0.81.0-preview.1 → 0.81.0-preview.10

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.
@@ -2,7 +2,6 @@ const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
4
  const escape = require('escape-string-regexp');
5
- const exclusionList = require('metro-config/src/defaults/exclusionList');
6
5
  const pack = require('../package.json');
7
6
 
8
7
  const root = path.resolve(__dirname, '..');
@@ -33,7 +32,7 @@ const config = {
33
32
  // We need to make sure that only one version is loaded for peerDependencies
34
33
  // So we block them at the root, and alias them to the versions in example's node_modules
35
34
  resolver: {
36
- blockList: exclusionList(
35
+ blockList:
37
36
  modules.map(
38
37
  (m) =>
39
38
  new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)
@@ -47,7 +46,7 @@ const config = {
47
46
  new RegExp(`${rnwPath}/target/.*`),
48
47
  /.*\.ProjectImports\.zip/,
49
48
  ])
50
- ),
49
+ ,
51
50
 
52
51
  extraNodeModules: modules.reduce((acc, name) => {
53
52
  acc[name] = path.join(__dirname, 'node_modules', name);
@@ -1,232 +0,0 @@
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
-
8
- #pragma once
9
-
10
- #include <cmath>
11
- #include <string_view>
12
-
13
- #include <folly/../../fast_float-6.1.4/include/fast_float/fast_float.h> // [Windows] - Full relative path needed to find file
14
- #include <react/renderer/css/CSSToken.h>
15
-
16
- namespace facebook::react {
17
-
18
- /**
19
- * A minimal tokenizer for a subset of CSS syntax.
20
- *
21
- * This is based on the W3C CSS Syntax specification, with simplifications made
22
- * for syntax which React Native does not attempt to support.
23
- * https://www.w3.org/TR/css-syntax-3/#tokenizing-and-parsing
24
- */
25
- class CSSTokenizer {
26
- public:
27
- explicit constexpr CSSTokenizer(std::string_view characters)
28
- : remainingCharacters_{characters} {}
29
-
30
- /**
31
- * Returns the next token according to the algorithm described in
32
- * https://www.w3.org/TR/css-syntax-3/#consume-token
33
- */
34
- constexpr CSSToken next() {
35
- char nextChar = peek();
36
-
37
- if (isWhitespace(nextChar)) {
38
- return consumeWhitespace();
39
- }
40
-
41
- switch (nextChar) {
42
- case '(':
43
- return consumeCharacter(CSSTokenType::OpenParen);
44
- case ')':
45
- return consumeCharacter(CSSTokenType::CloseParen);
46
- case '[':
47
- return consumeCharacter(CSSTokenType::OpenSquare);
48
- case ']':
49
- return consumeCharacter(CSSTokenType::CloseSquare);
50
- case '{':
51
- return consumeCharacter(CSSTokenType::OpenCurly);
52
- case '}':
53
- return consumeCharacter(CSSTokenType::CloseCurly);
54
- case ',':
55
- return consumeCharacter(CSSTokenType::Comma);
56
- case '+':
57
- case '-':
58
- case '.':
59
- if (wouldStartNumber()) {
60
- return consumeNumeric();
61
- } else {
62
- return consumeDelim();
63
- }
64
- case '#':
65
- if (isIdent(peek(1))) {
66
- return consumeHash();
67
- } else {
68
- return consumeDelim();
69
- }
70
- }
71
-
72
- if (isDigit(nextChar)) {
73
- return consumeNumeric();
74
- }
75
-
76
- if (isIdentStart(nextChar)) {
77
- return consumeIdentlikeToken();
78
- }
79
-
80
- if (nextChar == '\0') {
81
- return CSSToken{CSSTokenType::EndOfFile};
82
- }
83
-
84
- return consumeDelim();
85
- }
86
-
87
- private:
88
- constexpr char peek(size_t i = 0) const {
89
- auto index = position_ + i;
90
- return index >= remainingCharacters_.size() ? '\0'
91
- : remainingCharacters_[index];
92
- }
93
-
94
- constexpr void advance() {
95
- position_ += 1;
96
- }
97
-
98
- constexpr CSSToken consumeDelim() {
99
- advance();
100
- return {CSSTokenType::Delim, consumeRunningValue()};
101
- }
102
-
103
- constexpr CSSToken consumeCharacter(CSSTokenType tokenType) {
104
- advance();
105
- consumeRunningValue();
106
- return CSSToken{tokenType};
107
- }
108
-
109
- constexpr CSSToken consumeWhitespace() {
110
- while (isWhitespace(peek())) {
111
- advance();
112
- }
113
-
114
- consumeRunningValue();
115
- return CSSToken{CSSTokenType::WhiteSpace};
116
- }
117
-
118
- constexpr bool wouldStartNumber() const {
119
- // https://www.w3.org/TR/css-syntax-3/#starts-with-a-number
120
- if (peek() == '+' || peek() == '-') {
121
- if (isDigit(peek(1))) {
122
- return true;
123
- }
124
- if (peek(1) == '.' && isDigit(peek(2))) {
125
- return true;
126
- }
127
- } else if (peek() == '.' && isDigit(peek(1))) {
128
- return true;
129
- } else if (isDigit(peek())) {
130
- return true;
131
- }
132
-
133
- return false;
134
- }
135
-
136
- constexpr CSSToken consumeNumber() {
137
- // https://www.w3.org/TR/css-syntax-3/#consume-number
138
- // https://www.w3.org/TR/css-syntax-3/#convert-a-string-to-a-number
139
- auto* b = remainingCharacters_.data();
140
- auto* e = b + remainingCharacters_.size();
141
-
142
- float value;
143
- fast_float::parse_options options{
144
- fast_float::chars_format::general};
145
- auto [ptr, ec] = fast_float::from_chars_advanced(b, e, value, options);
146
-
147
- consumeRunningValue();
148
- return {CSSTokenType::Number, value};
149
- }
150
-
151
- constexpr CSSToken consumeNumeric() {
152
- // https://www.w3.org/TR/css-syntax-3/#consume-numeric-token
153
- auto numberToken = consumeNumber();
154
-
155
- if (isIdent(peek())) {
156
- auto ident = consumeIdentSequence();
157
- return {
158
- CSSTokenType::Dimension,
159
- numberToken.numericValue(),
160
- ident.stringValue()};
161
- } else if (peek() == '%') {
162
- advance();
163
- consumeRunningValue();
164
- return {CSSTokenType::Percentage, numberToken.numericValue()};
165
- } else {
166
- return numberToken;
167
- }
168
- }
169
-
170
- constexpr CSSToken consumeIdentlikeToken() {
171
- // https://www.w3.org/TR/css-syntax-3/#consume-ident-like-token
172
- auto ident = consumeIdentSequence();
173
- if (peek() == '(') {
174
- advance();
175
- consumeRunningValue();
176
- return {CSSTokenType::Function, ident.stringValue()};
177
- }
178
-
179
- return ident;
180
- }
181
-
182
- constexpr CSSToken consumeIdentSequence() {
183
- // https://www.w3.org/TR/css-syntax-3/#consume-an-ident-sequence
184
- while (isIdent(peek())) {
185
- advance();
186
- }
187
-
188
- return {CSSTokenType::Ident, consumeRunningValue()};
189
- }
190
-
191
- constexpr CSSToken consumeHash() {
192
- // https://www.w3.org/TR/css-syntax-3/#consume-token (U+0023 NUMBER SIGN)
193
- advance();
194
- consumeRunningValue();
195
-
196
- return {CSSTokenType::Hash, consumeIdentSequence().stringValue()};
197
- }
198
-
199
- constexpr std::string_view consumeRunningValue() {
200
- auto next = remainingCharacters_.substr(0, position_);
201
- remainingCharacters_ = remainingCharacters_.substr(next.size());
202
- position_ = 0;
203
- return next;
204
- }
205
-
206
- static constexpr bool isDigit(char c) {
207
- // https://www.w3.org/TR/css-syntax-3/#digit
208
- return c >= '0' && c <= '9';
209
- }
210
-
211
- static constexpr bool isIdentStart(char c) {
212
- // https://www.w3.org/TR/css-syntax-3/#ident-start-code-point
213
- return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' ||
214
- static_cast<unsigned char>(c) > 0x80;
215
- }
216
-
217
- static constexpr bool isIdent(char c) {
218
- {
219
- // https://www.w3.org/TR/css-syntax-3/#ident-code-point
220
- return isIdentStart(c) || isDigit(c) || c == '-';
221
- }
222
- }
223
-
224
- static constexpr bool isWhitespace(char c) {
225
- // https://www.w3.org/TR/css-syntax-3/#whitespace
226
- return c == ' ' || c == '\t' || c == '\r' || c == '\n';
227
- }
228
-
229
- std::string_view remainingCharacters_;
230
- size_t position_{0};
231
- };
232
- } // namespace facebook::react