tamagui-loader 2.0.0-rc.8 → 2.0.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.
- package/dist/cjs/TamaguiPlugin.cjs +131 -79
- package/dist/cjs/css.cjs +15 -11
- package/dist/cjs/index.cjs +15 -13
- package/dist/cjs/loader.cjs +61 -52
- package/dist/cjs/requireResolve.cjs +14 -12
- package/dist/cjs/shouldExclude.cjs +30 -23
- package/dist/cjs/test.cjs +15 -13
- package/dist/esm/TamaguiPlugin.mjs +102 -52
- package/dist/esm/TamaguiPlugin.mjs.map +1 -1
- package/dist/esm/css.mjs +3 -1
- package/dist/esm/css.mjs.map +1 -1
- package/dist/esm/index.js +5 -7
- package/dist/esm/index.js.map +1 -6
- package/dist/esm/loader.mjs +35 -28
- package/dist/esm/loader.mjs.map +1 -1
- package/dist/esm/shouldExclude.mjs +6 -1
- package/dist/esm/shouldExclude.mjs.map +1 -1
- package/dist/esm/test.mjs +3 -3
- package/dist/esm/test.mjs.map +1 -1
- package/package.json +9 -8
- package/dist/cjs/TamaguiPlugin.js +0 -179
- package/dist/cjs/TamaguiPlugin.js.map +0 -6
- package/dist/cjs/css.js +0 -28
- package/dist/cjs/css.js.map +0 -6
- package/dist/cjs/index.js +0 -24
- package/dist/cjs/index.js.map +0 -6
- package/dist/cjs/loader.js +0 -92
- package/dist/cjs/loader.js.map +0 -6
- package/dist/cjs/polyfills.js +0 -4
- package/dist/cjs/polyfills.js.map +0 -6
- package/dist/cjs/requireResolve.js +0 -22
- package/dist/cjs/requireResolve.js.map +0 -6
- package/dist/cjs/shouldExclude.js +0 -33
- package/dist/cjs/shouldExclude.js.map +0 -6
- package/dist/cjs/test.js +0 -25
- package/dist/cjs/test.js.map +0 -6
- package/dist/esm/TamaguiPlugin.js +0 -159
- package/dist/esm/TamaguiPlugin.js.map +0 -6
- package/dist/esm/css.js +0 -12
- package/dist/esm/css.js.map +0 -6
- package/dist/esm/loader.js +0 -69
- package/dist/esm/loader.js.map +0 -6
- package/dist/esm/polyfills.js +0 -4
- package/dist/esm/polyfills.js.map +0 -6
- package/dist/esm/requireResolve.js +0 -6
- package/dist/esm/requireResolve.js.map +0 -6
- package/dist/esm/shouldExclude.js +0 -9
- package/dist/esm/shouldExclude.js.map +0 -6
- package/dist/esm/test.js +0 -9
- package/dist/esm/test.js.map +0 -6
|
@@ -2,43 +2,45 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
6
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
32
34
|
var TamaguiPlugin_exports = {};
|
|
33
35
|
__export(TamaguiPlugin_exports, {
|
|
34
36
|
TamaguiPlugin: () => TamaguiPlugin
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(TamaguiPlugin_exports);
|
|
37
|
-
var StaticWorker = __toESM(require("@tamagui/static-worker"), 1)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
var StaticWorker = __toESM(require("@tamagui/static-worker"), 1);
|
|
40
|
+
var import_node_fs = require("node:fs");
|
|
41
|
+
var import_node_path = require("node:path");
|
|
42
|
+
var import_webpack = __toESM(require("webpack"), 1);
|
|
43
|
+
var import_requireResolve = require("./requireResolve.cjs");
|
|
42
44
|
class TamaguiPlugin {
|
|
43
45
|
constructor(options = {
|
|
44
46
|
platform: "web",
|
|
@@ -47,7 +49,7 @@ class TamaguiPlugin {
|
|
|
47
49
|
this.options = options;
|
|
48
50
|
}
|
|
49
51
|
pluginName = "TamaguiPlugin";
|
|
50
|
-
safeResolves = (resolves, multiple =
|
|
52
|
+
safeResolves = (resolves, multiple = false) => {
|
|
51
53
|
const res = [];
|
|
52
54
|
for (const [out, mod] of resolves) {
|
|
53
55
|
if (out.endsWith("$")) {
|
|
@@ -55,29 +57,41 @@ class TamaguiPlugin {
|
|
|
55
57
|
continue;
|
|
56
58
|
}
|
|
57
59
|
try {
|
|
58
|
-
res.push([out, (0, import_requireResolve.requireResolve)(mod)])
|
|
60
|
+
res.push([out, (0, import_requireResolve.requireResolve)(mod)]);
|
|
61
|
+
if (multiple) {
|
|
62
|
+
res.push([out, (0, import_requireResolve.requireResolve)(mod)]);
|
|
63
|
+
}
|
|
59
64
|
} catch (err) {
|
|
60
|
-
if (out.includes(
|
|
61
|
-
|
|
65
|
+
if (out.includes(`@gorhom/bottom-sheet`)) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (process.env.DEBUG?.startsWith("tamagui")) {
|
|
69
|
+
console.info(` withTamagui skipping resolving ${out}`, err);
|
|
70
|
+
}
|
|
62
71
|
}
|
|
63
72
|
}
|
|
64
73
|
return res;
|
|
65
74
|
};
|
|
66
75
|
get componentsFullPaths() {
|
|
67
|
-
return this.safeResolves(this.options.components?.map(moduleName => [moduleName, moduleName]) || [],
|
|
76
|
+
return this.safeResolves(this.options.components?.map(moduleName => [moduleName, moduleName]) || [], true);
|
|
68
77
|
}
|
|
69
78
|
get componentsBaseDirs() {
|
|
70
79
|
return this.componentsFullPaths.map(([_, fullPath]) => {
|
|
71
80
|
let rootPath = (0, import_node_path.dirname)(fullPath);
|
|
72
|
-
|
|
81
|
+
while (rootPath.length > 1) {
|
|
73
82
|
const pkg = (0, import_node_path.join)(rootPath, "package.json");
|
|
74
|
-
|
|
83
|
+
const hasPkg = (0, import_node_fs.existsSync)(pkg);
|
|
84
|
+
if (hasPkg) {
|
|
85
|
+
return rootPath;
|
|
86
|
+
}
|
|
75
87
|
rootPath = (0, import_node_path.join)(rootPath, "..");
|
|
76
88
|
}
|
|
77
89
|
throw new Error(`Couldn't find package.json in any path above: ${fullPath}`);
|
|
78
90
|
});
|
|
79
91
|
}
|
|
80
|
-
isInComponentModule = fullPath =>
|
|
92
|
+
isInComponentModule = fullPath => {
|
|
93
|
+
return this.componentsBaseDirs.some(componentDir => fullPath.startsWith(componentDir));
|
|
94
|
+
};
|
|
81
95
|
get defaultAliases() {
|
|
82
96
|
return Object.fromEntries(this.safeResolves([["@tamagui/core/reset.css", "@tamagui/core/reset.css"],
|
|
83
97
|
// fixes https://github.com/kentcdodds/mdx-bundler/issues/143
|
|
@@ -88,63 +102,101 @@ class TamaguiPlugin {
|
|
|
88
102
|
const serializableOptions = {
|
|
89
103
|
...this.options
|
|
90
104
|
};
|
|
91
|
-
for (const key in serializableOptions)
|
|
92
|
-
|
|
105
|
+
for (const key in serializableOptions) {
|
|
106
|
+
const value = serializableOptions[key];
|
|
107
|
+
if (typeof value === "function") {
|
|
108
|
+
delete serializableOptions[key];
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
void StaticWorker.loadTamagui({
|
|
93
112
|
components: ["tamagui"],
|
|
94
113
|
platform: "web",
|
|
95
114
|
...serializableOptions
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
|
|
115
|
+
});
|
|
116
|
+
if (compiler.options.mode === "development" && !this.options.disableWatchConfig) {
|
|
117
|
+
void StaticWorker.watchTamaguiConfig(serializableOptions).then(watcher => {
|
|
118
|
+
process.once("exit", () => {
|
|
119
|
+
watcher?.dispose();
|
|
120
|
+
});
|
|
99
121
|
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
122
|
+
}
|
|
123
|
+
process.once("exit", () => {
|
|
124
|
+
void StaticWorker.destroyPool();
|
|
125
|
+
});
|
|
126
|
+
compiler.hooks.normalModuleFactory.tap(this.pluginName, nmf => {
|
|
103
127
|
nmf.hooks.createModule.tap(this.pluginName,
|
|
104
128
|
// @ts-expect-error CreateData is typed as 'object'...
|
|
105
129
|
createData => {
|
|
106
|
-
createData.matchResource?.endsWith(".tamagui.css")
|
|
130
|
+
if (createData.matchResource?.endsWith(".tamagui.css")) {
|
|
131
|
+
createData.settings.sideEffects = true;
|
|
132
|
+
}
|
|
107
133
|
});
|
|
108
|
-
})
|
|
134
|
+
});
|
|
135
|
+
if (!this.options.disableAliases) {
|
|
109
136
|
const existingAlias = compiler.options.resolve.alias;
|
|
110
|
-
Array.isArray(existingAlias)
|
|
137
|
+
if (Array.isArray(existingAlias)) {} else if (typeof existingAlias === "object") {
|
|
138
|
+
Object.assign(existingAlias, this.defaultAliases);
|
|
139
|
+
}
|
|
111
140
|
}
|
|
112
141
|
const excludeExports = this.options.excludeReactNativeWebExports;
|
|
113
|
-
if (excludeExports
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
142
|
+
if (excludeExports) {
|
|
143
|
+
if (Array.isArray(excludeExports)) {
|
|
144
|
+
try {
|
|
145
|
+
const regexStr = `react-native-web(-lite)?/.*(${excludeExports.join("|")}).*js`;
|
|
146
|
+
const regex = new RegExp(regexStr);
|
|
147
|
+
compiler.hooks.environment.tap("MyPlugin", () => {
|
|
148
|
+
const definePlugin = new import_webpack.default.NormalModuleReplacementPlugin(regex, (0, import_requireResolve.requireResolve)("@tamagui/proxy-worm"));
|
|
149
|
+
definePlugin.apply(compiler);
|
|
150
|
+
});
|
|
151
|
+
} catch (err) {
|
|
152
|
+
console.warn(`Invalid names provided to excludeReactNativeWebExports: ${excludeExports.join(", ")}`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
121
155
|
}
|
|
122
|
-
compiler.options.resolve.extensions = [... /* @__PURE__ */new Set([".web.tsx", ".web.ts", ".web.js", ".ts", ".tsx", ".js", ...(compiler.options.resolve.extensions || [])])]
|
|
156
|
+
compiler.options.resolve.extensions = [... /* @__PURE__ */new Set([".web.tsx", ".web.ts", ".web.js", ".ts", ".tsx", ".js", ...(compiler.options.resolve.extensions || [])])];
|
|
157
|
+
compiler.options.resolve.fallback ||= {};
|
|
158
|
+
compiler.options.resolve.fallback["crypto"] ||= false;
|
|
123
159
|
const mainFields = compiler.options.resolve.mainFields;
|
|
124
|
-
if (mainFields
|
|
160
|
+
if (mainFields) {
|
|
161
|
+
compiler.options.resolve.mainFields = Array.isArray(mainFields) ? mainFields : [mainFields];
|
|
162
|
+
if (!this.options.disableModuleJSXEntry) mainFields.unshift("module:jsx");
|
|
163
|
+
}
|
|
164
|
+
if (!compiler.options.module) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
125
167
|
const {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
let didReplaceNextJS =
|
|
138
|
-
for (const [index, rule] of rules.entries())
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
168
|
+
jsLoader
|
|
169
|
+
} = this.options;
|
|
170
|
+
const existing = compiler.options.module.rules;
|
|
171
|
+
const rules = existing.find(x => typeof x === "object" && "oneOf" in x ? x : null)?.oneOf ?? existing;
|
|
172
|
+
const tamaguiLoader = {
|
|
173
|
+
loader: (0, import_requireResolve.requireResolve)("tamagui-loader"),
|
|
174
|
+
options: {
|
|
175
|
+
...this.options,
|
|
176
|
+
_disableLoadTamagui: true
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
let didReplaceNextJS = false;
|
|
180
|
+
for (const [index, rule] of rules.entries()) {
|
|
181
|
+
const shouldReplaceNextJSRule = (rule?.use?.loader === "next-swc-loader" || Array.isArray(rule?.use) && rule?.use[0].loader === "next-swc-loader") && !rule.issuerLayer;
|
|
182
|
+
if (shouldReplaceNextJSRule) {
|
|
183
|
+
didReplaceNextJS = true;
|
|
184
|
+
rules[index] = {
|
|
185
|
+
...rule,
|
|
186
|
+
test: this.options.test ?? rule.test ?? /\.m?[jt]sx?$/,
|
|
187
|
+
exclude: this.options.exclude ?? rule.exclude,
|
|
188
|
+
use: [...(jsLoader ? [jsLoader] : []), ...(rule.use ? [].concat(rule.use) : []), tamaguiLoader]
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (!didReplaceNextJS) {
|
|
193
|
+
if (compiler.options.mode === "development") {
|
|
194
|
+
existing.push({
|
|
195
|
+
test: this.options.test ?? /\.tsx$/,
|
|
196
|
+
exclude: this.options.exclude,
|
|
197
|
+
use: [tamaguiLoader]
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
149
201
|
}
|
|
150
202
|
}
|
package/dist/cjs/css.cjs
CHANGED
|
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var css_exports = {};
|
|
22
24
|
__export(css_exports, {
|
|
@@ -29,7 +31,9 @@ function loader() {
|
|
|
29
31
|
...this.getOptions()
|
|
30
32
|
};
|
|
31
33
|
let out = Buffer.from(options.cssData, "base64").toString("utf-8");
|
|
32
|
-
if (out)
|
|
34
|
+
if (out) {
|
|
35
|
+
return this.callback(null, out || "");
|
|
36
|
+
}
|
|
33
37
|
this.callback({
|
|
34
38
|
message: "No CSS found",
|
|
35
39
|
name: "missing_css"
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -3,29 +3,31 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
21
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
20
|
-
value:
|
|
22
|
+
value: true
|
|
21
23
|
}), mod);
|
|
22
24
|
var index_exports = {};
|
|
23
25
|
__export(index_exports, {
|
|
24
26
|
default: () => index_default
|
|
25
27
|
});
|
|
26
28
|
module.exports = __toCommonJS(index_exports);
|
|
27
|
-
var import_polyfills = require("./polyfills.cjs")
|
|
28
|
-
|
|
29
|
+
var import_polyfills = require("./polyfills.cjs");
|
|
30
|
+
var import_loader = require("./loader.cjs");
|
|
29
31
|
__reExport(index_exports, require("./TamaguiPlugin.cjs"), module.exports);
|
|
30
32
|
__reExport(index_exports, require("./shouldExclude.cjs"), module.exports);
|
|
31
33
|
var index_default = import_loader.loader;
|
package/dist/cjs/loader.cjs
CHANGED
|
@@ -2,40 +2,42 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
6
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
32
34
|
var loader_exports = {};
|
|
33
35
|
__export(loader_exports, {
|
|
34
36
|
loader: () => loader
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(loader_exports);
|
|
37
|
-
var StaticWorker = __toESM(require("@tamagui/static-worker"), 1)
|
|
38
|
-
|
|
39
|
+
var StaticWorker = __toESM(require("@tamagui/static-worker"), 1);
|
|
40
|
+
var import_requireResolve = require("./requireResolve.cjs");
|
|
39
41
|
const {
|
|
40
42
|
getPragmaOptions
|
|
41
43
|
} = StaticWorker;
|
|
@@ -52,35 +54,41 @@ try {
|
|
|
52
54
|
}
|
|
53
55
|
let index = 0;
|
|
54
56
|
process.env.TAMAGUI_TARGET = "web";
|
|
55
|
-
const loader = async function (sourceIn) {
|
|
56
|
-
this.cacheable(
|
|
57
|
-
const callback = this.async()
|
|
58
|
-
|
|
57
|
+
const loader = async function loader2(sourceIn) {
|
|
58
|
+
this.cacheable(true);
|
|
59
|
+
const callback = this.async();
|
|
60
|
+
const sourcePath = `${this.resourcePath}`;
|
|
59
61
|
if (sourcePath.includes("node_modules") || sourcePath.includes("lucide-icons")) return callback(null, sourceIn);
|
|
60
62
|
const source = sourceIn.toString();
|
|
61
63
|
try {
|
|
62
64
|
const options = {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
platform: "web",
|
|
66
|
+
...this.getOptions()
|
|
67
|
+
};
|
|
68
|
+
const {
|
|
69
|
+
shouldDisable,
|
|
70
|
+
shouldPrintDebug
|
|
71
|
+
} = await getPragmaOptions({
|
|
72
|
+
source,
|
|
73
|
+
path: sourcePath
|
|
74
|
+
});
|
|
75
|
+
if (shouldPrintDebug === "verbose") {
|
|
76
|
+
console.warn(`
|
|
75
77
|
|
|
76
78
|
--- Incoming source ---
|
|
77
79
|
|
|
78
|
-
`)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
`);
|
|
81
|
+
console.warn(source);
|
|
82
|
+
}
|
|
83
|
+
if (shouldDisable) {
|
|
84
|
+
if (shouldPrintDebug) console.info("Disabling on file via pragma");
|
|
85
|
+
return callback(null, source);
|
|
86
|
+
}
|
|
87
|
+
const cssPath = `${sourcePath}.${index++}.tamagui.css`;
|
|
88
|
+
const serializableOptions = {
|
|
89
|
+
...options
|
|
90
|
+
};
|
|
91
|
+
for (const key in serializableOptions) if (typeof serializableOptions[key] === "function") delete serializableOptions[key];
|
|
84
92
|
const extracted = await StaticWorker.extractToClassNames({
|
|
85
93
|
source,
|
|
86
94
|
sourcePath,
|
|
@@ -89,9 +97,9 @@ const loader = async function (sourceIn) {
|
|
|
89
97
|
});
|
|
90
98
|
if (!extracted) return callback(null, source);
|
|
91
99
|
if (extracted.styles) {
|
|
92
|
-
const cssQuery = `cssData=${Buffer.from(extracted.styles).toString("base64")}
|
|
93
|
-
|
|
94
|
-
|
|
100
|
+
const cssQuery = `cssData=${Buffer.from(extracted.styles).toString("base64")}`;
|
|
101
|
+
const remReq = this.remainingRequest;
|
|
102
|
+
const importPath = `${cssPath}!=!${CSS_LOADER_PATH}?${cssQuery}!${remReq}`;
|
|
95
103
|
extracted.js = `${extracted.js}
|
|
96
104
|
|
|
97
105
|
require(${JSON.stringify(importPath)})`;
|
|
@@ -100,8 +108,9 @@ require(${JSON.stringify(importPath)})`;
|
|
|
100
108
|
} catch (err) {
|
|
101
109
|
const message = err instanceof Error ? `${err.message}
|
|
102
110
|
${err.stack}` : String(err);
|
|
103
|
-
console.error(
|
|
104
|
-
|
|
105
|
-
|
|
111
|
+
console.error("Tamagui Webpack Loader Error:\n", ` ${message}
|
|
112
|
+
`);
|
|
113
|
+
if (message.includes("Cannot create proxy")) console.info("This is usually due to components not loading at build-time. Check for logs just below the line above:");
|
|
114
|
+
callback(null, source);
|
|
106
115
|
}
|
|
107
116
|
};
|
|
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var requireResolve_exports = {};
|
|
22
24
|
__export(requireResolve_exports, {
|
|
@@ -24,5 +26,5 @@ __export(requireResolve_exports, {
|
|
|
24
26
|
});
|
|
25
27
|
module.exports = __toCommonJS(requireResolve_exports);
|
|
26
28
|
var import_node_module = require("node:module");
|
|
27
|
-
const import_meta = {}
|
|
28
|
-
|
|
29
|
+
const import_meta = {};
|
|
30
|
+
const requireResolve = "url" in import_meta ? (0, import_node_module.createRequire)(import_meta.url).resolve : require.resolve;
|
|
@@ -2,40 +2,47 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
6
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
32
34
|
var shouldExclude_exports = {};
|
|
33
35
|
__export(shouldExclude_exports, {
|
|
34
36
|
shouldExclude: () => shouldExclude
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(shouldExclude_exports);
|
|
37
39
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
38
|
-
const shouldExclude = (filePath, projectRoot) =>
|
|
40
|
+
const shouldExclude = (filePath, projectRoot) => {
|
|
41
|
+
if (projectRoot && filePath.includes(projectRoot) && filePath.endsWith("sx") || isTamaguiDistJSX(filePath)) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
};
|
|
39
46
|
function isTamaguiDistJSX(filePath) {
|
|
40
47
|
return filePath.includes("/dist/jsx/".replace(/\//g, import_node_path.default.sep));
|
|
41
48
|
}
|