@tamagui/static 1.114.4 → 1.115.1
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/check-dep-versions.cjs +267 -0
- package/dist/checkDeps.cjs +32 -0
- package/dist/{constants.js → constants.cjs} +29 -14
- package/dist/exports.cjs +40 -0
- package/dist/extractor/accessSafe.cjs +46 -0
- package/dist/extractor/babelParse.cjs +54 -0
- package/dist/extractor/buildClassName.cjs +62 -0
- package/dist/extractor/bundle.cjs +146 -0
- package/dist/extractor/bundleConfig.cjs +322 -0
- package/dist/extractor/{createEvaluator.js → createEvaluator.cjs} +37 -21
- package/dist/extractor/createExtractor.cjs +1008 -0
- package/dist/extractor/createLogger.cjs +45 -0
- package/dist/extractor/ensureImportingConcat.cjs +48 -0
- package/dist/extractor/esbuildAliasPlugin.cjs +44 -0
- package/dist/extractor/evaluateAstNode.cjs +83 -0
- package/dist/extractor/extractHelpers.cjs +120 -0
- package/dist/extractor/extractMediaStyle.cjs +129 -0
- package/dist/extractor/extractToClassNames.cjs +254 -0
- package/dist/extractor/extractToNative.cjs +274 -0
- package/dist/extractor/findTopmostFunction.cjs +34 -0
- package/dist/extractor/generatedUid.cjs +47 -0
- package/dist/extractor/getPrefixLogs.cjs +28 -0
- package/dist/extractor/getPropValueFromAttributes.cjs +67 -0
- package/dist/extractor/getSourceModule.cjs +68 -0
- package/dist/extractor/{getStaticBindingsForScope.js → getStaticBindingsForScope.cjs} +66 -61
- package/dist/extractor/{getTamaguiConfigPathFromOptionsConfig.js → getTamaguiConfigPathFromOptionsConfig.cjs} +16 -11
- package/dist/extractor/{hoistClassNames.js → hoistClassNames.cjs} +31 -32
- package/dist/extractor/{literalToAst.js → literalToAst.cjs} +38 -44
- package/dist/extractor/{loadFile.js → loadFile.cjs} +3 -6
- package/dist/extractor/{loadTamagui.js → loadTamagui.cjs} +99 -78
- package/dist/extractor/logLines.cjs +35 -0
- package/dist/extractor/{normalizeTernaries.js → normalizeTernaries.cjs} +38 -29
- package/dist/extractor/{propsToFontFamilyCache.js → propsToFontFamilyCache.cjs} +18 -14
- package/dist/extractor/regenerateConfig.cjs +144 -0
- package/dist/extractor/{removeUnusedHooks.js → removeUnusedHooks.cjs} +31 -27
- package/dist/extractor/{timer.js → timer.cjs} +16 -11
- package/dist/extractor/{validHTMLAttributes.js → validHTMLAttributes.cjs} +16 -11
- package/dist/extractor/{watchTamaguiConfig.js → watchTamaguiConfig.cjs} +30 -29
- package/dist/{getPragmaOptions.js → getPragmaOptions.cjs} +22 -17
- package/dist/helpers/memoize.cjs +37 -0
- package/dist/helpers/requireTamaguiCore.cjs +33 -0
- package/dist/index.cjs +40 -0
- package/dist/registerRequire.cjs +102 -0
- package/dist/{server.js → server.cjs} +38 -21
- package/dist/setup.cjs +0 -0
- package/dist/types.cjs +16 -0
- package/package.json +18 -16
- package/dist/check-dep-versions.js +0 -389
- package/dist/checkDeps.js +0 -26
- package/dist/exports.js +0 -33
- package/dist/extractor/accessSafe.js +0 -47
- package/dist/extractor/babelParse.js +0 -59
- package/dist/extractor/buildClassName.js +0 -72
- package/dist/extractor/bundle.js +0 -133
- package/dist/extractor/bundleConfig.js +0 -350
- package/dist/extractor/createExtractor.js +0 -1217
- package/dist/extractor/createLogger.js +0 -32
- package/dist/extractor/ensureImportingConcat.js +0 -50
- package/dist/extractor/esbuildAliasPlugin.js +0 -36
- package/dist/extractor/evaluateAstNode.js +0 -99
- package/dist/extractor/extractHelpers.js +0 -109
- package/dist/extractor/extractMediaStyle.js +0 -123
- package/dist/extractor/extractToClassNames.js +0 -291
- package/dist/extractor/extractToNative.js +0 -319
- package/dist/extractor/findTopmostFunction.js +0 -32
- package/dist/extractor/generatedUid.js +0 -42
- package/dist/extractor/getPrefixLogs.js +0 -23
- package/dist/extractor/getPropValueFromAttributes.js +0 -65
- package/dist/extractor/getSourceModule.js +0 -66
- package/dist/extractor/logLines.js +0 -30
- package/dist/extractor/regenerateConfig.js +0 -111
- package/dist/helpers/memoize.js +0 -33
- package/dist/helpers/requireTamaguiCore.js +0 -30
- package/dist/index.js +0 -30
- package/dist/registerRequire.js +0 -96
- package/dist/setup.js +0 -1
- package/dist/types.js +0 -14
- /package/dist/{check-dep-versions.js.map → check-dep-versions.cjs.map} +0 -0
- /package/dist/{checkDeps.js.map → checkDeps.cjs.map} +0 -0
- /package/dist/{constants.js.map → constants.cjs.map} +0 -0
- /package/dist/{exports.js.map → exports.cjs.map} +0 -0
- /package/dist/extractor/{accessSafe.js.map → accessSafe.cjs.map} +0 -0
- /package/dist/extractor/{babelParse.js.map → babelParse.cjs.map} +0 -0
- /package/dist/extractor/{buildClassName.js.map → buildClassName.cjs.map} +0 -0
- /package/dist/extractor/{bundle.js.map → bundle.cjs.map} +0 -0
- /package/dist/extractor/{bundleConfig.js.map → bundleConfig.cjs.map} +0 -0
- /package/dist/extractor/{createEvaluator.js.map → createEvaluator.cjs.map} +0 -0
- /package/dist/extractor/{createExtractor.js.map → createExtractor.cjs.map} +0 -0
- /package/dist/extractor/{createLogger.js.map → createLogger.cjs.map} +0 -0
- /package/dist/extractor/{ensureImportingConcat.js.map → ensureImportingConcat.cjs.map} +0 -0
- /package/dist/extractor/{esbuildAliasPlugin.js.map → esbuildAliasPlugin.cjs.map} +0 -0
- /package/dist/extractor/{evaluateAstNode.js.map → evaluateAstNode.cjs.map} +0 -0
- /package/dist/extractor/{extractHelpers.js.map → extractHelpers.cjs.map} +0 -0
- /package/dist/extractor/{extractMediaStyle.js.map → extractMediaStyle.cjs.map} +0 -0
- /package/dist/extractor/{extractToClassNames.js.map → extractToClassNames.cjs.map} +0 -0
- /package/dist/extractor/{extractToNative.js.map → extractToNative.cjs.map} +0 -0
- /package/dist/extractor/{findTopmostFunction.js.map → findTopmostFunction.cjs.map} +0 -0
- /package/dist/extractor/{generatedUid.js.map → generatedUid.cjs.map} +0 -0
- /package/dist/extractor/{getPrefixLogs.js.map → getPrefixLogs.cjs.map} +0 -0
- /package/dist/extractor/{getPropValueFromAttributes.js.map → getPropValueFromAttributes.cjs.map} +0 -0
- /package/dist/extractor/{getSourceModule.js.map → getSourceModule.cjs.map} +0 -0
- /package/dist/extractor/{getStaticBindingsForScope.js.map → getStaticBindingsForScope.cjs.map} +0 -0
- /package/dist/extractor/{getTamaguiConfigPathFromOptionsConfig.js.map → getTamaguiConfigPathFromOptionsConfig.cjs.map} +0 -0
- /package/dist/extractor/{hoistClassNames.js.map → hoistClassNames.cjs.map} +0 -0
- /package/dist/extractor/{literalToAst.js.map → literalToAst.cjs.map} +0 -0
- /package/dist/extractor/{loadFile.js.map → loadFile.cjs.map} +0 -0
- /package/dist/extractor/{loadTamagui.js.map → loadTamagui.cjs.map} +0 -0
- /package/dist/extractor/{logLines.js.map → logLines.cjs.map} +0 -0
- /package/dist/extractor/{normalizeTernaries.js.map → normalizeTernaries.cjs.map} +0 -0
- /package/dist/extractor/{propsToFontFamilyCache.js.map → propsToFontFamilyCache.cjs.map} +0 -0
- /package/dist/extractor/{regenerateConfig.js.map → regenerateConfig.cjs.map} +0 -0
- /package/dist/extractor/{removeUnusedHooks.js.map → removeUnusedHooks.cjs.map} +0 -0
- /package/dist/extractor/{timer.js.map → timer.cjs.map} +0 -0
- /package/dist/extractor/{validHTMLAttributes.js.map → validHTMLAttributes.cjs.map} +0 -0
- /package/dist/extractor/{watchTamaguiConfig.js.map → watchTamaguiConfig.cjs.map} +0 -0
- /package/dist/{getPragmaOptions.js.map → getPragmaOptions.cjs.map} +0 -0
- /package/dist/helpers/{memoize.js.map → memoize.cjs.map} +0 -0
- /package/dist/helpers/{requireTamaguiCore.js.map → requireTamaguiCore.cjs.map} +0 -0
- /package/dist/{index.js.map → index.cjs.map} +0 -0
- /package/dist/{registerRequire.js.map → registerRequire.cjs.map} +0 -0
- /package/dist/{server.js.map → server.cjs.map} +0 -0
- /package/dist/{setup.js.map → setup.cjs.map} +0 -0
- /package/dist/{types.js.map → types.cjs.map} +0 -0
@@ -2,24 +2,33 @@ 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,
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
6
7
|
var __export = (target, all) => {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
for (var name in all) __defProp(target, name, {
|
9
|
+
get: all[name],
|
10
|
+
enumerable: !0
|
11
|
+
});
|
12
|
+
},
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
15
|
+
get: () => from[key],
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
17
|
+
});
|
18
|
+
return to;
|
19
|
+
};
|
15
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
16
21
|
// If the importer is in node compatibility mode or this is not an ESM
|
17
22
|
// file that has been converted to a CommonJS file using a Babel-
|
18
23
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
19
24
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
21
|
-
|
22
|
-
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
26
|
+
value: mod,
|
27
|
+
enumerable: !0
|
28
|
+
}) : target, mod)),
|
29
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
30
|
+
value: !0
|
31
|
+
}), mod);
|
23
32
|
var loadTamagui_exports = {};
|
24
33
|
__export(loadTamagui_exports, {
|
25
34
|
esbuildWatchFiles: () => esbuildWatchFiles,
|
@@ -31,8 +40,17 @@ __export(loadTamagui_exports, {
|
|
31
40
|
resolveWebOrNativeSpecificEntry: () => resolveWebOrNativeSpecificEntry
|
32
41
|
});
|
33
42
|
module.exports = __toCommonJS(loadTamagui_exports);
|
34
|
-
var import_node_path = require("node:path"),
|
35
|
-
|
43
|
+
var import_node_path = require("node:path"),
|
44
|
+
import_cli_color = require("@tamagui/cli-color"),
|
45
|
+
import_esbuild = __toESM(require("esbuild")),
|
46
|
+
fsExtra = __toESM(require("fs-extra")),
|
47
|
+
import_constants = require("../constants.cjs"),
|
48
|
+
import_requireTamaguiCore = require("../helpers/requireTamaguiCore.cjs"),
|
49
|
+
import_registerRequire = require("../registerRequire.cjs"),
|
50
|
+
import_bundleConfig = require("./bundleConfig.cjs"),
|
51
|
+
import_getTamaguiConfigPathFromOptionsConfig = require("./getTamaguiConfigPathFromOptionsConfig.cjs"),
|
52
|
+
import_regenerateConfig = require("./regenerateConfig.cjs");
|
53
|
+
const getFilledOptions = propsIn => ({
|
36
54
|
// defaults
|
37
55
|
platform: "web",
|
38
56
|
config: "tamagui.config.ts",
|
@@ -47,10 +65,9 @@ async function loadTamagui(propsIn) {
|
|
47
65
|
resolvePromise = res, rejectPromise = rej;
|
48
66
|
});
|
49
67
|
try {
|
50
|
-
const props = getFilledOptions(propsIn),
|
51
|
-
|
52
|
-
|
53
|
-
), resolvePromise(null), null);
|
68
|
+
const props = getFilledOptions(propsIn),
|
69
|
+
bundleInfo = await (0, import_bundleConfig.getBundledConfig)(props);
|
70
|
+
return bundleInfo ? (await generateThemesAndLog(props), (0, import_bundleConfig.hasBundledConfigChanged)() ? (process.env.NODE_ENV === "development" && (await (0, import_regenerateConfig.regenerateConfig)(props, bundleInfo)), resolvePromise(bundleInfo), bundleInfo) : (resolvePromise(bundleInfo), bundleInfo)) : (console.warn("No bundled config generated, maybe an error in bundling. Set DEBUG=tamagui and re-run to get logs."), resolvePromise(null), null);
|
54
71
|
} catch (err) {
|
55
72
|
throw rejectPromise(), err;
|
56
73
|
} finally {
|
@@ -59,30 +76,24 @@ async function loadTamagui(propsIn) {
|
|
59
76
|
}
|
60
77
|
let waiting = !1;
|
61
78
|
const generateThemesAndLog = async (options, force = !1) => {
|
62
|
-
|
63
|
-
|
64
|
-
if (waiting = !0, await new Promise((res) => setTimeout(res, 30)), await (0, import_regenerateConfig.generateTamaguiThemes)(options, force) && ((0, import_cli_color.colorLog)(
|
65
|
-
import_cli_color.Color.FgYellow,
|
66
|
-
` \u27A1 [tamagui] generated themes: ${(0, import_node_path.relative)(
|
67
|
-
process.cwd(),
|
68
|
-
options.themeBuilder.output
|
69
|
-
)}`
|
70
|
-
), options.outputCSS)) {
|
79
|
+
if (!waiting && options.themeBuilder) try {
|
80
|
+
if (waiting = !0, await new Promise(res => setTimeout(res, 30)), (await (0, import_regenerateConfig.generateTamaguiThemes)(options, force)) && ((0, import_cli_color.colorLog)(import_cli_color.Color.FgYellow, ` \u27A1 [tamagui] generated themes: ${(0, import_node_path.relative)(process.cwd(), options.themeBuilder.output)}`), options.outputCSS)) {
|
71
81
|
const loadedConfig = (0, import_bundleConfig.getLoadedConfig)();
|
72
|
-
loadedConfig && await (0, import_bundleConfig.writeTamaguiCSS)(options.outputCSS, loadedConfig);
|
82
|
+
loadedConfig && (await (0, import_bundleConfig.writeTamaguiCSS)(options.outputCSS, loadedConfig));
|
73
83
|
}
|
74
84
|
} finally {
|
75
85
|
waiting = !1;
|
76
86
|
}
|
77
|
-
},
|
87
|
+
},
|
88
|
+
last = {},
|
89
|
+
lastVersion = {};
|
78
90
|
function loadTamaguiBuildConfigSync(tamaguiOptions) {
|
79
91
|
const buildFilePath = tamaguiOptions?.buildFile ?? "tamagui.build.ts";
|
80
92
|
if (fsExtra.existsSync(buildFilePath)) {
|
81
93
|
const registered = (0, import_registerRequire.registerRequire)("web");
|
82
94
|
try {
|
83
95
|
const out = require(buildFilePath).default;
|
84
|
-
if (!out)
|
85
|
-
throw new Error(`No default export found in ${buildFilePath}: ${out}`);
|
96
|
+
if (!out) throw new Error(`No default export found in ${buildFilePath}: ${out}`);
|
86
97
|
tamaguiOptions = {
|
87
98
|
...tamaguiOptions,
|
88
99
|
...out
|
@@ -91,10 +102,7 @@ function loadTamaguiBuildConfigSync(tamaguiOptions) {
|
|
91
102
|
registered.unregister();
|
92
103
|
}
|
93
104
|
}
|
94
|
-
if (!tamaguiOptions)
|
95
|
-
throw new Error(
|
96
|
-
"No tamagui build options found either via input props or at tamagui.build.ts"
|
97
|
-
);
|
105
|
+
if (!tamaguiOptions) throw new Error("No tamagui build options found either via input props or at tamagui.build.ts");
|
98
106
|
return {
|
99
107
|
config: "tamagui.config.ts",
|
100
108
|
components: ["@tamagui/core"],
|
@@ -107,12 +115,13 @@ function loadTamaguiSync({
|
|
107
115
|
...propsIn
|
108
116
|
}) {
|
109
117
|
const key = JSON.stringify(propsIn);
|
110
|
-
if (last[key] && !(0, import_bundleConfig.hasBundledConfigChanged)() && (!lastVersion[key] || lastVersion[key] === cacheKey))
|
111
|
-
return last[key];
|
118
|
+
if (last[key] && !(0, import_bundleConfig.hasBundledConfigChanged)() && (!lastVersion[key] || lastVersion[key] === cacheKey)) return last[key];
|
112
119
|
lastVersion[key] = cacheKey || "";
|
113
120
|
const props = getFilledOptions(propsIn);
|
114
121
|
process.env.IS_STATIC = "is_static", process.env.TAMAGUI_IS_SERVER = "true";
|
115
|
-
const {
|
122
|
+
const {
|
123
|
+
unregister
|
124
|
+
} = (0, import_registerRequire.registerRequire)(props.platform || "web", {
|
116
125
|
proxyWormImports: !!forceExports
|
117
126
|
});
|
118
127
|
try {
|
@@ -121,7 +130,8 @@ function loadTamaguiSync({
|
|
121
130
|
try {
|
122
131
|
let tamaguiConfig = null;
|
123
132
|
if (propsIn.config) {
|
124
|
-
const configPath = (0, import_getTamaguiConfigPathFromOptionsConfig.getTamaguiConfigPathFromOptionsConfig)(propsIn.config),
|
133
|
+
const configPath = (0, import_getTamaguiConfigPathFromOptionsConfig.getTamaguiConfigPathFromOptionsConfig)(propsIn.config),
|
134
|
+
exp = require(configPath);
|
125
135
|
if (tamaguiConfig = exp.default || exp.config || exp, !tamaguiConfig || !tamaguiConfig.parsed) {
|
126
136
|
const confPath = require.resolve(configPath);
|
127
137
|
throw new Error(`Can't find valid config in ${confPath}:
|
@@ -129,13 +139,14 @@ function loadTamaguiSync({
|
|
129
139
|
Be sure you "export default" or "export const config" the config.`);
|
130
140
|
}
|
131
141
|
if (tamaguiConfig) {
|
132
|
-
const {
|
142
|
+
const {
|
143
|
+
createTamagui
|
144
|
+
} = (0, import_requireTamaguiCore.requireTamaguiCore)(props.platform || "web");
|
133
145
|
createTamagui(tamaguiConfig);
|
134
146
|
}
|
135
147
|
}
|
136
148
|
const components = (0, import_bundleConfig.loadComponents)(props, forceExports);
|
137
|
-
if (!components)
|
138
|
-
throw new Error("No components loaded");
|
149
|
+
if (!components) throw new Error("No components loaded");
|
139
150
|
process.env.DEBUG === "tamagui" && console.info("components", components), process.env.IS_STATIC = void 0, globalThis.__DEV__ = devValueOG;
|
140
151
|
const info = {
|
141
152
|
components,
|
@@ -143,7 +154,9 @@ function loadTamaguiSync({
|
|
143
154
|
nameToPaths: (0, import_registerRequire.getNameToPaths)()
|
144
155
|
};
|
145
156
|
if (tamaguiConfig) {
|
146
|
-
const {
|
157
|
+
const {
|
158
|
+
outputCSS
|
159
|
+
} = props;
|
147
160
|
outputCSS && (0, import_bundleConfig.writeTamaguiCSS)(outputCSS, tamaguiConfig), (0, import_regenerateConfig.regenerateConfigSync)(props, info);
|
148
161
|
}
|
149
162
|
return last[key] = {
|
@@ -151,14 +164,17 @@ function loadTamaguiSync({
|
|
151
164
|
cached: !0
|
152
165
|
}, info;
|
153
166
|
} catch (err) {
|
154
|
-
err instanceof Error ? !import_constants.SHOULD_DEBUG && !forceExports ? (console.warn(
|
155
|
-
"Error loading tamagui.config.ts (set DEBUG=tamagui to see full stack), running tamagui without custom config"
|
156
|
-
), console.info(`
|
167
|
+
err instanceof Error ? !import_constants.SHOULD_DEBUG && !forceExports ? (console.warn("Error loading tamagui.config.ts (set DEBUG=tamagui to see full stack), running tamagui without custom config"), console.info(`
|
157
168
|
|
158
169
|
${err.message}
|
159
170
|
|
160
171
|
`)) : import_constants.SHOULD_DEBUG && console.error(err) : console.error("Error loading tamagui.config.ts", err);
|
161
|
-
const {
|
172
|
+
const {
|
173
|
+
createTamagui
|
174
|
+
} = (0, import_requireTamaguiCore.requireTamaguiCore)(props.platform || "web"),
|
175
|
+
{
|
176
|
+
getDefaultTamaguiConfig
|
177
|
+
} = require("@tamagui/config-default");
|
162
178
|
return {
|
163
179
|
components: [],
|
164
180
|
tamaguiConfig: createTamagui(getDefaultTamaguiConfig()),
|
@@ -180,8 +196,7 @@ async function getOptions({
|
|
180
196
|
let pkgJson = {};
|
181
197
|
try {
|
182
198
|
pkgJson = await fsExtra.readJSON((0, import_node_path.join)(root, "package.json"));
|
183
|
-
} catch {
|
184
|
-
}
|
199
|
+
} catch {}
|
185
200
|
return {
|
186
201
|
mode: process.env.NODE_ENV === "production" ? "production" : "development",
|
187
202
|
root,
|
@@ -193,7 +208,7 @@ async function getOptions({
|
|
193
208
|
platform: "web",
|
194
209
|
components: ["tamagui"],
|
195
210
|
...tamaguiOptions,
|
196
|
-
config: tamaguiOptions?.config ?? await getDefaultTamaguiConfigPath(root, tamaguiOptions?.config)
|
211
|
+
config: tamaguiOptions?.config ?? (await getDefaultTamaguiConfigPath(root, tamaguiOptions?.config))
|
197
212
|
},
|
198
213
|
paths: {
|
199
214
|
root,
|
@@ -204,20 +219,20 @@ async function getOptions({
|
|
204
219
|
};
|
205
220
|
}
|
206
221
|
function resolveWebOrNativeSpecificEntry(entry) {
|
207
|
-
const workspaceRoot = (0, import_node_path.resolve)(),
|
222
|
+
const workspaceRoot = (0, import_node_path.resolve)(),
|
223
|
+
resolved = require.resolve(entry, {
|
224
|
+
paths: [workspaceRoot]
|
225
|
+
}),
|
226
|
+
ext = (0, import_node_path.extname)(resolved),
|
227
|
+
fileName = (0, import_node_path.basename)(resolved).replace(ext, ""),
|
228
|
+
specificFile = (0, import_node_path.join)((0, import_node_path.dirname)(resolved), fileName + "." + "web" + ext);
|
208
229
|
return fsExtra.existsSync(specificFile) ? specificFile : entry;
|
209
230
|
}
|
210
231
|
const defaultPaths = ["tamagui.config.ts", (0, import_node_path.join)("src", "tamagui.config.ts")];
|
211
232
|
let hasWarnedOnce = !1;
|
212
233
|
async function getDefaultTamaguiConfigPath(root, configPath) {
|
213
|
-
const searchPaths = [
|
214
|
-
|
215
|
-
[configPath, ...defaultPaths].filter(Boolean).map((p) => (0, import_node_path.join)(root, p))
|
216
|
-
)
|
217
|
-
];
|
218
|
-
for (const path of searchPaths)
|
219
|
-
if (await fsExtra.pathExists(path))
|
220
|
-
return path;
|
234
|
+
const searchPaths = [...new Set([configPath, ...defaultPaths].filter(Boolean).map(p => (0, import_node_path.join)(root, p)))];
|
235
|
+
for (const path of searchPaths) if (await fsExtra.pathExists(path)) return path;
|
221
236
|
hasWarnedOnce || (hasWarnedOnce = !0, console.warn(`Warning: couldn't find tamagui.config.ts in the following paths given configuration "${configPath}":
|
222
237
|
${searchPaths.join(`
|
223
238
|
`)}
|
@@ -237,27 +252,33 @@ async function esbuildWatchFiles(entry, onChanged) {
|
|
237
252
|
"react-native": "@tamagui/proxy-worm"
|
238
253
|
},
|
239
254
|
plugins: [
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
255
|
+
// to log what its watching:
|
256
|
+
// {
|
257
|
+
// name: 'test',
|
258
|
+
// setup({ onResolve }) {
|
259
|
+
// onResolve({ filter: /.*/ }, (args) => {
|
260
|
+
// console.log('wtf', args.path)
|
261
|
+
// })
|
262
|
+
// },
|
263
|
+
// },
|
264
|
+
{
|
265
|
+
name: "on-rebuild",
|
266
|
+
setup({
|
267
|
+
onEnd,
|
268
|
+
onResolve
|
269
|
+
}) {
|
270
|
+
onResolve({
|
271
|
+
filter: /^[^.\/]|^\.[^.\/]|^\.\.[^\/]/
|
272
|
+
}, args => ({
|
273
|
+
path: args.path,
|
274
|
+
external: !0
|
275
|
+
})), onEnd(() => {
|
276
|
+
hasRunOnce ? onChanged() : hasRunOnce = !0;
|
277
|
+
});
|
256
278
|
}
|
257
|
-
]
|
279
|
+
}]
|
258
280
|
});
|
259
281
|
return context.watch(), () => {
|
260
282
|
context.dispose();
|
261
283
|
};
|
262
|
-
}
|
263
|
-
//# sourceMappingURL=loadTamagui.js.map
|
284
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __export = (target, all) => {
|
6
|
+
for (var name in all) __defProp(target, name, {
|
7
|
+
get: all[name],
|
8
|
+
enumerable: !0
|
9
|
+
});
|
10
|
+
},
|
11
|
+
__copyProps = (to, from, except, desc) => {
|
12
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
13
|
+
get: () => from[key],
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
15
|
+
});
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
19
|
+
value: !0
|
20
|
+
}), mod);
|
21
|
+
var logLines_exports = {};
|
22
|
+
__export(logLines_exports, {
|
23
|
+
logLines: () => logLines
|
24
|
+
});
|
25
|
+
module.exports = __toCommonJS(logLines_exports);
|
26
|
+
const prefix = " ",
|
27
|
+
logLines = (str, singleLine = !1) => {
|
28
|
+
if (singleLine) return prefix + str.split(" ").join(`
|
29
|
+
${prefix}`);
|
30
|
+
const lines = [""],
|
31
|
+
items = str.split(" ");
|
32
|
+
for (const item of items) item.length + lines[lines.length - 1].length > 85 && lines.push(""), lines[lines.length - 1] += item + " ";
|
33
|
+
return lines.map((line, i) => prefix + (i == 0 ? "" : " ") + line.trim()).join(`
|
34
|
+
`);
|
35
|
+
};
|
@@ -2,47 +2,56 @@ 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,
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
6
7
|
var __export = (target, all) => {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
for (var name in all) __defProp(target, name, {
|
9
|
+
get: all[name],
|
10
|
+
enumerable: !0
|
11
|
+
});
|
12
|
+
},
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
15
|
+
get: () => from[key],
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
17
|
+
});
|
18
|
+
return to;
|
19
|
+
};
|
15
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
16
21
|
// If the importer is in node compatibility mode or this is not an ESM
|
17
22
|
// file that has been converted to a CommonJS file using a Babel-
|
18
23
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
19
24
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
21
|
-
|
22
|
-
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
26
|
+
value: mod,
|
27
|
+
enumerable: !0
|
28
|
+
}) : target, mod)),
|
29
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
30
|
+
value: !0
|
31
|
+
}), mod);
|
23
32
|
var normalizeTernaries_exports = {};
|
24
33
|
__export(normalizeTernaries_exports, {
|
25
34
|
normalizeTernaries: () => normalizeTernaries
|
26
35
|
});
|
27
36
|
module.exports = __toCommonJS(normalizeTernaries_exports);
|
28
|
-
var import_generator = __toESM(require("@babel/generator")),
|
37
|
+
var import_generator = __toESM(require("@babel/generator")),
|
38
|
+
t = __toESM(require("@babel/types")),
|
39
|
+
import_invariant = __toESM(require("invariant"));
|
29
40
|
function normalizeTernaries(ternaries) {
|
30
|
-
if ((0, import_invariant.default)(
|
31
|
-
Array.isArray(ternaries),
|
32
|
-
"extractStaticTernaries expects param 1 to be an array of ternaries"
|
33
|
-
), ternaries.length === 0)
|
34
|
-
return [];
|
41
|
+
if ((0, import_invariant.default)(Array.isArray(ternaries), "extractStaticTernaries expects param 1 to be an array of ternaries"), ternaries.length === 0) return [];
|
35
42
|
const ternariesByKey = {};
|
36
|
-
for (let idx = -1, len = ternaries.length; ++idx < len;
|
37
|
-
const {
|
43
|
+
for (let idx = -1, len = ternaries.length; ++idx < len;) {
|
44
|
+
const {
|
45
|
+
test,
|
46
|
+
consequent,
|
47
|
+
alternate,
|
48
|
+
remove,
|
49
|
+
...rest
|
50
|
+
} = ternaries[idx];
|
38
51
|
let ternaryTest = test;
|
39
52
|
t.isExpressionStatement(test) && (ternaryTest = test.expression);
|
40
53
|
let shouldSwap = !1;
|
41
|
-
t.isUnaryExpression(test) && test.operator === "!" ? (ternaryTest = test.argument, shouldSwap = !0) : t.isBinaryExpression(test) && (test.operator === "!==" || test.operator === "!=") && (ternaryTest = t.binaryExpression(
|
42
|
-
test.operator.replace("!", "="),
|
43
|
-
test.left,
|
44
|
-
test.right
|
45
|
-
), shouldSwap = !0);
|
54
|
+
t.isUnaryExpression(test) && test.operator === "!" ? (ternaryTest = test.argument, shouldSwap = !0) : t.isBinaryExpression(test) && (test.operator === "!==" || test.operator === "!=") && (ternaryTest = t.binaryExpression(test.operator.replace("!", "="), test.left, test.right), shouldSwap = !0);
|
46
55
|
const key = (0, import_generator.default)(ternaryTest).code;
|
47
56
|
ternariesByKey[key] || (ternariesByKey[key] = {
|
48
57
|
...rest,
|
@@ -51,9 +60,9 @@ function normalizeTernaries(ternaries) {
|
|
51
60
|
test: ternaryTest,
|
52
61
|
remove
|
53
62
|
});
|
54
|
-
const altStyle = (shouldSwap ? consequent : alternate) ?? {},
|
63
|
+
const altStyle = (shouldSwap ? consequent : alternate) ?? {},
|
64
|
+
consStyle = (shouldSwap ? alternate : consequent) ?? {};
|
55
65
|
Object.assign(ternariesByKey[key].alternate, altStyle), Object.assign(ternariesByKey[key].consequent, consStyle);
|
56
66
|
}
|
57
|
-
return Object.keys(ternariesByKey).map(
|
58
|
-
}
|
59
|
-
//# sourceMappingURL=normalizeTernaries.js.map
|
67
|
+
return Object.keys(ternariesByKey).map(key => ternariesByKey[key]);
|
68
|
+
}
|
@@ -3,15 +3,21 @@ 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
|
-
|
13
|
-
|
14
|
-
|
6
|
+
for (var name in all) __defProp(target, name, {
|
7
|
+
get: all[name],
|
8
|
+
enumerable: !0
|
9
|
+
});
|
10
|
+
},
|
11
|
+
__copyProps = (to, from, except, desc) => {
|
12
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
13
|
+
get: () => from[key],
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
15
|
+
});
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
19
|
+
value: !0
|
20
|
+
}), mod);
|
15
21
|
var propsToFontFamilyCache_exports = {};
|
16
22
|
__export(propsToFontFamilyCache_exports, {
|
17
23
|
getFontFamilyClassNameFromProps: () => getFontFamilyClassNameFromProps,
|
@@ -19,7 +25,7 @@ __export(propsToFontFamilyCache_exports, {
|
|
19
25
|
setPropsToFontFamily: () => setPropsToFontFamily
|
20
26
|
});
|
21
27
|
module.exports = __toCommonJS(propsToFontFamilyCache_exports);
|
22
|
-
const cache = /* @__PURE__ */
|
28
|
+
const cache = /* @__PURE__ */new WeakMap();
|
23
29
|
function setPropsToFontFamily(props, ff) {
|
24
30
|
cache.set(props, ff);
|
25
31
|
}
|
@@ -28,7 +34,5 @@ function getPropsToFontFamily(props) {
|
|
28
34
|
}
|
29
35
|
function getFontFamilyClassNameFromProps(props) {
|
30
36
|
const ff = getPropsToFontFamily(props);
|
31
|
-
if (ff)
|
32
|
-
|
33
|
-
}
|
34
|
-
//# sourceMappingURL=propsToFontFamilyCache.js.map
|
37
|
+
if (ff) return ` font_${ff.replace("$", "")}`;
|
38
|
+
}
|
@@ -0,0 +1,144 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __export = (target, all) => {
|
8
|
+
for (var name in all) __defProp(target, name, {
|
9
|
+
get: all[name],
|
10
|
+
enumerable: !0
|
11
|
+
});
|
12
|
+
},
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
15
|
+
get: () => from[key],
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
17
|
+
});
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
26
|
+
value: mod,
|
27
|
+
enumerable: !0
|
28
|
+
}) : target, mod)),
|
29
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
30
|
+
value: !0
|
31
|
+
}), mod);
|
32
|
+
var regenerateConfig_exports = {};
|
33
|
+
__export(regenerateConfig_exports, {
|
34
|
+
generateTamaguiThemes: () => generateTamaguiThemes,
|
35
|
+
regenerateConfig: () => regenerateConfig,
|
36
|
+
regenerateConfigSync: () => regenerateConfigSync
|
37
|
+
});
|
38
|
+
module.exports = __toCommonJS(regenerateConfig_exports);
|
39
|
+
var import_node_path = require("node:path"),
|
40
|
+
import_generate_themes = require("@tamagui/generate-themes"),
|
41
|
+
FS = __toESM(require("fs-extra")),
|
42
|
+
import_requireTamaguiCore = require("../helpers/requireTamaguiCore.cjs"),
|
43
|
+
import_bundleConfig = require("./bundleConfig.cjs");
|
44
|
+
const tamaguiDir = (0, import_node_path.join)(process.cwd(), ".tamagui"),
|
45
|
+
confFile = (0, import_node_path.join)(tamaguiDir, "tamagui.config.json");
|
46
|
+
async function regenerateConfig(tamaguiOptions, configIn, rebuild = !1) {
|
47
|
+
try {
|
48
|
+
const config = configIn ?? (await (0, import_bundleConfig.getBundledConfig)(tamaguiOptions, rebuild));
|
49
|
+
if (!config) return;
|
50
|
+
const out = transformConfig(config, tamaguiOptions.platform || "web");
|
51
|
+
await FS.ensureDir((0, import_node_path.dirname)(confFile)), await FS.writeJSON(confFile, out, {
|
52
|
+
spaces: 2
|
53
|
+
});
|
54
|
+
} catch (err) {
|
55
|
+
(process.env.DEBUG?.includes("tamagui") || process.env.IS_TAMAGUI_DEV) && console.warn("regenerateConfig error", err);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
function regenerateConfigSync(_tamaguiOptions, config) {
|
59
|
+
try {
|
60
|
+
FS.ensureDirSync((0, import_node_path.dirname)(confFile)), FS.writeJSONSync(confFile, transformConfig(config, _tamaguiOptions.platform || "web"), {
|
61
|
+
spaces: 2
|
62
|
+
});
|
63
|
+
} catch (err) {
|
64
|
+
(process.env.DEBUG?.includes("tamagui") || process.env.IS_TAMAGUI_DEV) && console.warn("regenerateConfig error", err);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
async function generateTamaguiThemes(tamaguiOptions, force = !1) {
|
68
|
+
if (!tamaguiOptions.themeBuilder) return;
|
69
|
+
const {
|
70
|
+
input,
|
71
|
+
output
|
72
|
+
} = tamaguiOptions.themeBuilder,
|
73
|
+
inPath = resolveRelativePath(input),
|
74
|
+
outPath = resolveRelativePath(output),
|
75
|
+
generatedOutput = await (0, import_generate_themes.generateThemes)(inPath),
|
76
|
+
hasChanged = force || (await (async () => {
|
77
|
+
try {
|
78
|
+
if (!generatedOutput) return !1;
|
79
|
+
const next = generatedOutput.generated,
|
80
|
+
current = await FS.readFile(outPath, "utf-8");
|
81
|
+
return next !== current;
|
82
|
+
} catch {}
|
83
|
+
return !0;
|
84
|
+
})());
|
85
|
+
return hasChanged && (await (0, import_generate_themes.writeGeneratedThemes)(tamaguiDir, outPath, generatedOutput)), hasChanged;
|
86
|
+
}
|
87
|
+
const resolveRelativePath = inputPath => inputPath.startsWith(".") ? (0, import_node_path.join)(process.cwd(), inputPath) : require.resolve(inputPath);
|
88
|
+
function cloneDeepSafe(x, excludeKeys = {}) {
|
89
|
+
return x && (Array.isArray(x) ? x.map(_ => cloneDeepSafe(_)) : typeof x == "function" ? "Function" : typeof x != "object" ? x : "$$typeof" in x ? "Component" : Object.fromEntries(Object.entries(x).flatMap(([k, v]) => excludeKeys[k] ? [] : [[k, cloneDeepSafe(v)]])));
|
90
|
+
}
|
91
|
+
function transformConfig(config, platform) {
|
92
|
+
if (!config) return null;
|
93
|
+
const {
|
94
|
+
getVariableValue
|
95
|
+
} = (0, import_requireTamaguiCore.requireTamaguiCore)(platform),
|
96
|
+
next = cloneDeepSafe(config, {
|
97
|
+
validStyles: !0
|
98
|
+
}),
|
99
|
+
{
|
100
|
+
components,
|
101
|
+
nameToPaths,
|
102
|
+
tamaguiConfig
|
103
|
+
} = next,
|
104
|
+
{
|
105
|
+
themes,
|
106
|
+
tokens
|
107
|
+
} = tamaguiConfig;
|
108
|
+
for (const key in themes) {
|
109
|
+
const theme = themes[key];
|
110
|
+
theme.id = key;
|
111
|
+
for (const tkey in theme) theme[tkey] = getVariableValue(theme[tkey]);
|
112
|
+
}
|
113
|
+
for (const key in tokens) {
|
114
|
+
const token = {
|
115
|
+
...tokens[key]
|
116
|
+
};
|
117
|
+
for (const tkey in token) token[tkey] = getVariableValue(token[tkey]);
|
118
|
+
}
|
119
|
+
for (const component of components) for (const _ in component.nameToInfo) {
|
120
|
+
const compDefinition = {
|
121
|
+
...component.nameToInfo[_]
|
122
|
+
};
|
123
|
+
component.nameToInfo[_] = compDefinition;
|
124
|
+
const {
|
125
|
+
parentStaticConfig,
|
126
|
+
...rest
|
127
|
+
} = compDefinition.staticConfig;
|
128
|
+
compDefinition.staticConfig = rest;
|
129
|
+
}
|
130
|
+
next.nameToPaths = {};
|
131
|
+
for (const key in nameToPaths) next.nameToPaths[key] = [...nameToPaths[key]];
|
132
|
+
const {
|
133
|
+
fontsParsed,
|
134
|
+
getCSS,
|
135
|
+
tokensParsed,
|
136
|
+
themeConfig,
|
137
|
+
...cleanedConfig
|
138
|
+
} = next.tamaguiConfig;
|
139
|
+
return {
|
140
|
+
components,
|
141
|
+
nameToPaths,
|
142
|
+
tamaguiConfig: cleanedConfig
|
143
|
+
};
|
144
|
+
}
|