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