vite-plugin-react-native-web 2.7.0 → 3.0.0-rc.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.
@@ -0,0 +1,28 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
24
+ if (typeof require !== "undefined") return require.apply(this, arguments);
25
+ throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
26
+ });
27
+ //#endregion
28
+ export { __require as n, __toESM as r, __commonJSMin as t };
@@ -0,0 +1,39 @@
1
+ import { createRequire } from "node:module";
2
+ //#region node_modules/vite/dist/node/chunks/chunk.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
10
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
11
+ var __exportAll = (all, no_symbols) => {
12
+ let target = {};
13
+ for (var name in all) __defProp(target, name, {
14
+ get: all[name],
15
+ enumerable: true
16
+ });
17
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
18
+ return target;
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
22
+ key = keys[i];
23
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
24
+ get: ((k) => from[k]).bind(null, key),
25
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
26
+ });
27
+ }
28
+ return to;
29
+ };
30
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
31
+ value: mod,
32
+ enumerable: true
33
+ }) : target, mod));
34
+ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
36
+ //#endregion
37
+ export { __toCommonJS as a, __require as i, __esmMin as n, __toESM as o, __exportAll as r, __commonJSMin as t };
38
+
39
+ //# sourceMappingURL=chunk-CU5vi22U.js.map
@@ -0,0 +1,99 @@
1
+ import flowRemoveTypes from "flow-remove-types";
2
+ //#region src/plugins/flow-remove-types-plugin.ts
3
+ const reactNativeFlowJsxPathPattern = /\.(js|flow)$/;
4
+ const flowRemoveTypesPlugin = () => ({
5
+ name: "flow-remove-types",
6
+ transform: {
7
+ filter: { id: reactNativeFlowJsxPathPattern },
8
+ handler: async (code) => {
9
+ code = flowRemoveTypes(code).toString();
10
+ return code;
11
+ }
12
+ }
13
+ });
14
+ //#endregion
15
+ //#region src/plugins/treeshake-fix-plugin.ts
16
+ const treeshakeFixPlugin = () => ({
17
+ name: "treeshake-fix",
18
+ transform: {
19
+ filter: { id: "expo-modules-core" },
20
+ handler: () => {
21
+ return { moduleSideEffects: "no-treeshake" };
22
+ }
23
+ }
24
+ });
25
+ //#endregion
26
+ //#region src/plugins/type-exports-fix.ts
27
+ const typeExportsFixPlugin = () => ({
28
+ name: "type-exports-fix",
29
+ load: {
30
+ filter: { id: /expo-modules-core.*ts-declarations.*\.ts$/ },
31
+ handler: () => ({
32
+ code: "export {}",
33
+ moduleType: "js"
34
+ })
35
+ }
36
+ });
37
+ //#endregion
38
+ //#region src/index.ts
39
+ const development = false;
40
+ const extensions = [
41
+ ".web.mjs",
42
+ ".mjs",
43
+ ".web.js",
44
+ ".js",
45
+ ".web.mts",
46
+ ".mts",
47
+ ".web.ts",
48
+ ".ts",
49
+ ".web.jsx",
50
+ ".jsx",
51
+ ".web.tsx",
52
+ ".tsx",
53
+ ".json"
54
+ ];
55
+ const moduleTypes = {
56
+ ".js": "jsx",
57
+ ".flow": "jsx"
58
+ };
59
+ const reactNativeWeb = (_options) => ({
60
+ enforce: "pre",
61
+ name: "react-native-web",
62
+ config: () => ({
63
+ define: {
64
+ global: "globalThis",
65
+ __DEV__: JSON.stringify(development),
66
+ "process.env.NODE_ENV": JSON.stringify("production"),
67
+ "process.env.EXPO_OS": JSON.stringify("web")
68
+ },
69
+ resolve: {
70
+ extensions,
71
+ alias: [{
72
+ find: "react-native",
73
+ replacement: "react-native-web"
74
+ }]
75
+ },
76
+ build: { rolldownOptions: {
77
+ resolve: { extensions },
78
+ moduleTypes,
79
+ plugins: [
80
+ flowRemoveTypesPlugin(),
81
+ treeshakeFixPlugin(),
82
+ typeExportsFixPlugin()
83
+ ]
84
+ } },
85
+ optimizeDeps: { rolldownOptions: {
86
+ resolve: { extensions },
87
+ moduleTypes,
88
+ plugins: [
89
+ flowRemoveTypesPlugin(),
90
+ treeshakeFixPlugin(),
91
+ typeExportsFixPlugin()
92
+ ]
93
+ } }
94
+ })
95
+ });
96
+ //#endregion
97
+ export { reactNativeWeb as default };
98
+
99
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,365 @@
1
+ import { t as __commonJSMin } from "./chunk-CU5vi22U.js";
2
+ //#region node_modules/vite/dist/node/chunks/lib.js
3
+ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
+ var openParentheses = "(".charCodeAt(0);
5
+ var closeParentheses = ")".charCodeAt(0);
6
+ var singleQuote = "'".charCodeAt(0);
7
+ var doubleQuote = "\"".charCodeAt(0);
8
+ var backslash = "\\".charCodeAt(0);
9
+ var slash = "/".charCodeAt(0);
10
+ var comma = ",".charCodeAt(0);
11
+ var colon = ":".charCodeAt(0);
12
+ var star = "*".charCodeAt(0);
13
+ var uLower = "u".charCodeAt(0);
14
+ var uUpper = "U".charCodeAt(0);
15
+ var plus = "+".charCodeAt(0);
16
+ var isUnicodeRange = /^[a-f0-9?-]+$/i;
17
+ module.exports = function(input) {
18
+ var tokens = [];
19
+ var value = input;
20
+ var next, quote, prev, token, escape, escapePos, whitespacePos, parenthesesOpenPos;
21
+ var pos = 0;
22
+ var code = value.charCodeAt(pos);
23
+ var max = value.length;
24
+ var stack = [{ nodes: tokens }];
25
+ var balanced = 0;
26
+ var parent;
27
+ var name = "";
28
+ var before = "";
29
+ var after = "";
30
+ while (pos < max) if (code <= 32) {
31
+ next = pos;
32
+ do {
33
+ next += 1;
34
+ code = value.charCodeAt(next);
35
+ } while (code <= 32);
36
+ token = value.slice(pos, next);
37
+ prev = tokens[tokens.length - 1];
38
+ if (code === closeParentheses && balanced) after = token;
39
+ else if (prev && prev.type === "div") {
40
+ prev.after = token;
41
+ prev.sourceEndIndex += token.length;
42
+ } else if (code === comma || code === colon || code === slash && value.charCodeAt(next + 1) !== star && (!parent || parent && parent.type === "function" && parent.value !== "calc")) before = token;
43
+ else tokens.push({
44
+ type: "space",
45
+ sourceIndex: pos,
46
+ sourceEndIndex: next,
47
+ value: token
48
+ });
49
+ pos = next;
50
+ } else if (code === singleQuote || code === doubleQuote) {
51
+ next = pos;
52
+ quote = code === singleQuote ? "'" : "\"";
53
+ token = {
54
+ type: "string",
55
+ sourceIndex: pos,
56
+ quote
57
+ };
58
+ do {
59
+ escape = false;
60
+ next = value.indexOf(quote, next + 1);
61
+ if (~next) {
62
+ escapePos = next;
63
+ while (value.charCodeAt(escapePos - 1) === backslash) {
64
+ escapePos -= 1;
65
+ escape = !escape;
66
+ }
67
+ } else {
68
+ value += quote;
69
+ next = value.length - 1;
70
+ token.unclosed = true;
71
+ }
72
+ } while (escape);
73
+ token.value = value.slice(pos + 1, next);
74
+ token.sourceEndIndex = token.unclosed ? next : next + 1;
75
+ tokens.push(token);
76
+ pos = next + 1;
77
+ code = value.charCodeAt(pos);
78
+ } else if (code === slash && value.charCodeAt(pos + 1) === star) {
79
+ next = value.indexOf("*/", pos);
80
+ token = {
81
+ type: "comment",
82
+ sourceIndex: pos,
83
+ sourceEndIndex: next + 2
84
+ };
85
+ if (next === -1) {
86
+ token.unclosed = true;
87
+ next = value.length;
88
+ token.sourceEndIndex = next;
89
+ }
90
+ token.value = value.slice(pos + 2, next);
91
+ tokens.push(token);
92
+ pos = next + 2;
93
+ code = value.charCodeAt(pos);
94
+ } else if ((code === slash || code === star) && parent && parent.type === "function" && parent.value === "calc") {
95
+ token = value[pos];
96
+ tokens.push({
97
+ type: "word",
98
+ sourceIndex: pos - before.length,
99
+ sourceEndIndex: pos + token.length,
100
+ value: token
101
+ });
102
+ pos += 1;
103
+ code = value.charCodeAt(pos);
104
+ } else if (code === slash || code === comma || code === colon) {
105
+ token = value[pos];
106
+ tokens.push({
107
+ type: "div",
108
+ sourceIndex: pos - before.length,
109
+ sourceEndIndex: pos + token.length,
110
+ value: token,
111
+ before,
112
+ after: ""
113
+ });
114
+ before = "";
115
+ pos += 1;
116
+ code = value.charCodeAt(pos);
117
+ } else if (openParentheses === code) {
118
+ next = pos;
119
+ do {
120
+ next += 1;
121
+ code = value.charCodeAt(next);
122
+ } while (code <= 32);
123
+ parenthesesOpenPos = pos;
124
+ token = {
125
+ type: "function",
126
+ sourceIndex: pos - name.length,
127
+ value: name,
128
+ before: value.slice(parenthesesOpenPos + 1, next)
129
+ };
130
+ pos = next;
131
+ if (name === "url" && code !== singleQuote && code !== doubleQuote) {
132
+ next -= 1;
133
+ do {
134
+ escape = false;
135
+ next = value.indexOf(")", next + 1);
136
+ if (~next) {
137
+ escapePos = next;
138
+ while (value.charCodeAt(escapePos - 1) === backslash) {
139
+ escapePos -= 1;
140
+ escape = !escape;
141
+ }
142
+ } else {
143
+ value += ")";
144
+ next = value.length - 1;
145
+ token.unclosed = true;
146
+ }
147
+ } while (escape);
148
+ whitespacePos = next;
149
+ do {
150
+ whitespacePos -= 1;
151
+ code = value.charCodeAt(whitespacePos);
152
+ } while (code <= 32);
153
+ if (parenthesesOpenPos < whitespacePos) {
154
+ if (pos !== whitespacePos + 1) token.nodes = [{
155
+ type: "word",
156
+ sourceIndex: pos,
157
+ sourceEndIndex: whitespacePos + 1,
158
+ value: value.slice(pos, whitespacePos + 1)
159
+ }];
160
+ else token.nodes = [];
161
+ if (token.unclosed && whitespacePos + 1 !== next) {
162
+ token.after = "";
163
+ token.nodes.push({
164
+ type: "space",
165
+ sourceIndex: whitespacePos + 1,
166
+ sourceEndIndex: next,
167
+ value: value.slice(whitespacePos + 1, next)
168
+ });
169
+ } else {
170
+ token.after = value.slice(whitespacePos + 1, next);
171
+ token.sourceEndIndex = next;
172
+ }
173
+ } else {
174
+ token.after = "";
175
+ token.nodes = [];
176
+ }
177
+ pos = next + 1;
178
+ token.sourceEndIndex = token.unclosed ? next : pos;
179
+ code = value.charCodeAt(pos);
180
+ tokens.push(token);
181
+ } else {
182
+ balanced += 1;
183
+ token.after = "";
184
+ token.sourceEndIndex = pos + 1;
185
+ tokens.push(token);
186
+ stack.push(token);
187
+ tokens = token.nodes = [];
188
+ parent = token;
189
+ }
190
+ name = "";
191
+ } else if (closeParentheses === code && balanced) {
192
+ pos += 1;
193
+ code = value.charCodeAt(pos);
194
+ parent.after = after;
195
+ parent.sourceEndIndex += after.length;
196
+ after = "";
197
+ balanced -= 1;
198
+ stack[stack.length - 1].sourceEndIndex = pos;
199
+ stack.pop();
200
+ parent = stack[balanced];
201
+ tokens = parent.nodes;
202
+ } else {
203
+ next = pos;
204
+ do {
205
+ if (code === backslash) next += 1;
206
+ next += 1;
207
+ code = value.charCodeAt(next);
208
+ } while (next < max && !(code <= 32 || code === singleQuote || code === doubleQuote || code === comma || code === colon || code === slash || code === openParentheses || code === star && parent && parent.type === "function" && parent.value === "calc" || code === slash && parent.type === "function" && parent.value === "calc" || code === closeParentheses && balanced));
209
+ token = value.slice(pos, next);
210
+ if (openParentheses === code) name = token;
211
+ else if ((uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) && plus === token.charCodeAt(1) && isUnicodeRange.test(token.slice(2))) tokens.push({
212
+ type: "unicode-range",
213
+ sourceIndex: pos,
214
+ sourceEndIndex: next,
215
+ value: token
216
+ });
217
+ else tokens.push({
218
+ type: "word",
219
+ sourceIndex: pos,
220
+ sourceEndIndex: next,
221
+ value: token
222
+ });
223
+ pos = next;
224
+ }
225
+ for (pos = stack.length - 1; pos; pos -= 1) {
226
+ stack[pos].unclosed = true;
227
+ stack[pos].sourceEndIndex = value.length;
228
+ }
229
+ return stack[0].nodes;
230
+ };
231
+ }));
232
+ var require_walk = /* @__PURE__ */ __commonJSMin(((exports, module) => {
233
+ module.exports = function walk(nodes, cb, bubble) {
234
+ var i, max, node, result;
235
+ for (i = 0, max = nodes.length; i < max; i += 1) {
236
+ node = nodes[i];
237
+ if (!bubble) result = cb(node, i, nodes);
238
+ if (result !== false && node.type === "function" && Array.isArray(node.nodes)) walk(node.nodes, cb, bubble);
239
+ if (bubble) cb(node, i, nodes);
240
+ }
241
+ };
242
+ }));
243
+ var require_stringify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
244
+ function stringifyNode(node, custom) {
245
+ var type = node.type;
246
+ var value = node.value;
247
+ var buf;
248
+ var customResult;
249
+ if (custom && (customResult = custom(node)) !== void 0) return customResult;
250
+ else if (type === "word" || type === "space") return value;
251
+ else if (type === "string") {
252
+ buf = node.quote || "";
253
+ return buf + value + (node.unclosed ? "" : buf);
254
+ } else if (type === "comment") return "/*" + value + (node.unclosed ? "" : "*/");
255
+ else if (type === "div") return (node.before || "") + value + (node.after || "");
256
+ else if (Array.isArray(node.nodes)) {
257
+ buf = stringify(node.nodes, custom);
258
+ if (type !== "function") return buf;
259
+ return value + "(" + (node.before || "") + buf + (node.after || "") + (node.unclosed ? "" : ")");
260
+ }
261
+ return value;
262
+ }
263
+ function stringify(nodes, custom) {
264
+ var result, i;
265
+ if (Array.isArray(nodes)) {
266
+ result = "";
267
+ for (i = nodes.length - 1; ~i; i -= 1) result = stringifyNode(nodes[i], custom) + result;
268
+ return result;
269
+ }
270
+ return stringifyNode(nodes, custom);
271
+ }
272
+ module.exports = stringify;
273
+ }));
274
+ var require_unit = /* @__PURE__ */ __commonJSMin(((exports, module) => {
275
+ var minus = "-".charCodeAt(0);
276
+ var plus = "+".charCodeAt(0);
277
+ var dot = ".".charCodeAt(0);
278
+ var exp = "e".charCodeAt(0);
279
+ var EXP = "E".charCodeAt(0);
280
+ function likeNumber(value) {
281
+ var code = value.charCodeAt(0);
282
+ var nextCode;
283
+ if (code === plus || code === minus) {
284
+ nextCode = value.charCodeAt(1);
285
+ if (nextCode >= 48 && nextCode <= 57) return true;
286
+ var nextNextCode = value.charCodeAt(2);
287
+ if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) return true;
288
+ return false;
289
+ }
290
+ if (code === dot) {
291
+ nextCode = value.charCodeAt(1);
292
+ if (nextCode >= 48 && nextCode <= 57) return true;
293
+ return false;
294
+ }
295
+ if (code >= 48 && code <= 57) return true;
296
+ return false;
297
+ }
298
+ module.exports = function(value) {
299
+ var pos = 0;
300
+ var length = value.length;
301
+ var code;
302
+ var nextCode;
303
+ var nextNextCode;
304
+ if (length === 0 || !likeNumber(value)) return false;
305
+ code = value.charCodeAt(pos);
306
+ if (code === plus || code === minus) pos++;
307
+ while (pos < length) {
308
+ code = value.charCodeAt(pos);
309
+ if (code < 48 || code > 57) break;
310
+ pos += 1;
311
+ }
312
+ code = value.charCodeAt(pos);
313
+ nextCode = value.charCodeAt(pos + 1);
314
+ if (code === dot && nextCode >= 48 && nextCode <= 57) {
315
+ pos += 2;
316
+ while (pos < length) {
317
+ code = value.charCodeAt(pos);
318
+ if (code < 48 || code > 57) break;
319
+ pos += 1;
320
+ }
321
+ }
322
+ code = value.charCodeAt(pos);
323
+ nextCode = value.charCodeAt(pos + 1);
324
+ nextNextCode = value.charCodeAt(pos + 2);
325
+ if ((code === exp || code === EXP) && (nextCode >= 48 && nextCode <= 57 || (nextCode === plus || nextCode === minus) && nextNextCode >= 48 && nextNextCode <= 57)) {
326
+ pos += nextCode === plus || nextCode === minus ? 3 : 2;
327
+ while (pos < length) {
328
+ code = value.charCodeAt(pos);
329
+ if (code < 48 || code > 57) break;
330
+ pos += 1;
331
+ }
332
+ }
333
+ return {
334
+ number: value.slice(0, pos),
335
+ unit: value.slice(pos)
336
+ };
337
+ };
338
+ }));
339
+ var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
340
+ var parse = require_parse();
341
+ var walk = require_walk();
342
+ var stringify = require_stringify();
343
+ function ValueParser(value) {
344
+ if (this instanceof ValueParser) {
345
+ this.nodes = parse(value);
346
+ return this;
347
+ }
348
+ return new ValueParser(value);
349
+ }
350
+ ValueParser.prototype.toString = function() {
351
+ return Array.isArray(this.nodes) ? stringify(this.nodes) : "";
352
+ };
353
+ ValueParser.prototype.walk = function(cb, bubble) {
354
+ walk(this.nodes, cb, bubble);
355
+ return this;
356
+ };
357
+ ValueParser.unit = require_unit();
358
+ ValueParser.walk = walk;
359
+ ValueParser.stringify = stringify;
360
+ module.exports = ValueParser;
361
+ }));
362
+ //#endregion
363
+ export { require_lib as t };
364
+
365
+ //# sourceMappingURL=lib-CK8QVVm9.js.map