@tamagui/cli 1.110.4 → 1.111.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/add.native.js +48 -232
- package/dist/add.native.js.map +2 -2
- package/dist/build.native.js +40 -231
- package/dist/build.native.js.map +2 -2
- package/dist/cli.native.js +103 -479
- package/dist/cli.native.js.map +2 -2
- package/dist/generate.native.js +38 -234
- package/dist/generate.native.js.map +2 -2
- package/dist/update-template.native.js +5 -8
- package/dist/update-template.native.js.map +1 -1
- package/dist/update.native.js +2 -125
- package/dist/update.native.js.map +1 -1
- package/dist/utils.native.js +48 -289
- package/dist/utils.native.js.map +2 -2
- package/package.json +7 -7
package/dist/add.native.js
CHANGED
|
@@ -28,160 +28,6 @@ __export(add_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(add_exports);
|
|
30
30
|
var import_node_child_process = require("node:child_process"), import_node_fs = require("node:fs"), import_promises = require("node:fs/promises"), import_node_os = require("node:os"), import_node_path = __toESM(require("node:path")), import_chalk = __toESM(require("chalk")), import_change_case = require("change-case"), import_fs_extra = require("fs-extra"), import_marked = require("marked"), import_marked_terminal = __toESM(require("marked-terminal")), import_opener = __toESM(require("opener")), import_prompts = __toESM(require("prompts"));
|
|
31
|
-
function _array_like_to_array(arr, len) {
|
|
32
|
-
(len == null || len > arr.length) && (len = arr.length);
|
|
33
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
34
|
-
return arr2;
|
|
35
|
-
}
|
|
36
|
-
function _array_with_holes(arr) {
|
|
37
|
-
if (Array.isArray(arr)) return arr;
|
|
38
|
-
}
|
|
39
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
40
|
-
try {
|
|
41
|
-
var info = gen[key](arg), value = info.value;
|
|
42
|
-
} catch (error) {
|
|
43
|
-
reject(error);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
|
|
47
|
-
}
|
|
48
|
-
function _async_to_generator(fn) {
|
|
49
|
-
return function() {
|
|
50
|
-
var self = this, args = arguments;
|
|
51
|
-
return new Promise(function(resolve, reject) {
|
|
52
|
-
var gen = fn.apply(self, args);
|
|
53
|
-
function _next(value) {
|
|
54
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
55
|
-
}
|
|
56
|
-
function _throw(err) {
|
|
57
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
58
|
-
}
|
|
59
|
-
_next(void 0);
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
function _instanceof(left, right) {
|
|
64
|
-
return right != null && typeof Symbol < "u" && right[Symbol.hasInstance] ? !!right[Symbol.hasInstance](left) : left instanceof right;
|
|
65
|
-
}
|
|
66
|
-
function _iterable_to_array_limit(arr, i) {
|
|
67
|
-
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
68
|
-
if (_i != null) {
|
|
69
|
-
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
70
|
-
try {
|
|
71
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
72
|
-
;
|
|
73
|
-
} catch (err) {
|
|
74
|
-
_d = !0, _e = err;
|
|
75
|
-
} finally {
|
|
76
|
-
try {
|
|
77
|
-
!_n && _i.return != null && _i.return();
|
|
78
|
-
} finally {
|
|
79
|
-
if (_d) throw _e;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return _arr;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
function _non_iterable_rest() {
|
|
86
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
87
|
-
}
|
|
88
|
-
function _sliced_to_array(arr, i) {
|
|
89
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
90
|
-
}
|
|
91
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
92
|
-
if (o) {
|
|
93
|
-
if (typeof o == "string") return _array_like_to_array(o, minLen);
|
|
94
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
95
|
-
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n);
|
|
96
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function _ts_generator(thisArg, body) {
|
|
100
|
-
var f, y, t, g, _ = {
|
|
101
|
-
label: 0,
|
|
102
|
-
sent: function() {
|
|
103
|
-
if (t[0] & 1) throw t[1];
|
|
104
|
-
return t[1];
|
|
105
|
-
},
|
|
106
|
-
trys: [],
|
|
107
|
-
ops: []
|
|
108
|
-
};
|
|
109
|
-
return g = {
|
|
110
|
-
next: verb(0),
|
|
111
|
-
throw: verb(1),
|
|
112
|
-
return: verb(2)
|
|
113
|
-
}, typeof Symbol == "function" && (g[Symbol.iterator] = function() {
|
|
114
|
-
return this;
|
|
115
|
-
}), g;
|
|
116
|
-
function verb(n) {
|
|
117
|
-
return function(v) {
|
|
118
|
-
return step([
|
|
119
|
-
n,
|
|
120
|
-
v
|
|
121
|
-
]);
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
function step(op) {
|
|
125
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
126
|
-
for (; _; ) try {
|
|
127
|
-
if (f = 1, y && (t = op[0] & 2 ? y.return : op[0] ? y.throw || ((t = y.return) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
128
|
-
switch (y = 0, t && (op = [
|
|
129
|
-
op[0] & 2,
|
|
130
|
-
t.value
|
|
131
|
-
]), op[0]) {
|
|
132
|
-
case 0:
|
|
133
|
-
case 1:
|
|
134
|
-
t = op;
|
|
135
|
-
break;
|
|
136
|
-
case 4:
|
|
137
|
-
return _.label++, {
|
|
138
|
-
value: op[1],
|
|
139
|
-
done: !1
|
|
140
|
-
};
|
|
141
|
-
case 5:
|
|
142
|
-
_.label++, y = op[1], op = [
|
|
143
|
-
0
|
|
144
|
-
];
|
|
145
|
-
continue;
|
|
146
|
-
case 7:
|
|
147
|
-
op = _.ops.pop(), _.trys.pop();
|
|
148
|
-
continue;
|
|
149
|
-
default:
|
|
150
|
-
if (t = _.trys, !(t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
151
|
-
_ = 0;
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
155
|
-
_.label = op[1];
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
159
|
-
_.label = t[1], t = op;
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
if (t && _.label < t[2]) {
|
|
163
|
-
_.label = t[2], _.ops.push(op);
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
t[2] && _.ops.pop(), _.trys.pop();
|
|
167
|
-
continue;
|
|
168
|
-
}
|
|
169
|
-
op = body.call(thisArg, _);
|
|
170
|
-
} catch (e) {
|
|
171
|
-
op = [
|
|
172
|
-
6,
|
|
173
|
-
e
|
|
174
|
-
], y = 0;
|
|
175
|
-
} finally {
|
|
176
|
-
f = t = 0;
|
|
177
|
-
}
|
|
178
|
-
if (op[0] & 5) throw op[1];
|
|
179
|
-
return {
|
|
180
|
-
value: op[0] ? op[1] : void 0,
|
|
181
|
-
done: !0
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
31
|
import_marked.marked.setOptions({
|
|
186
32
|
headerIds: !1,
|
|
187
33
|
mangle: !1,
|
|
@@ -190,85 +36,55 @@ import_marked.marked.setOptions({
|
|
|
190
36
|
var home = (0, import_node_os.homedir)(), tamaguiDir = import_node_path.default.join(home, ".tamagui"), generatedPackageTypes = [
|
|
191
37
|
"font",
|
|
192
38
|
"icon"
|
|
193
|
-
], installGeneratedPackage =
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
return repoName = type === "font" ? "tamagui-google-fonts" : "tamagui-iconify", console.info("Setting up ".concat(import_chalk.default.blueBright(tamaguiDir), "...")), [
|
|
202
|
-
4,
|
|
203
|
-
(0, import_fs_extra.ensureDir)(tamaguiDir)
|
|
204
|
-
];
|
|
205
|
-
case 1:
|
|
206
|
-
_state.sent(), tempDir = import_node_path.default.join(tamaguiDir, repoName), (0, import_node_fs.existsSync)(tempDir) && (0, import_node_fs.rmSync)(tempDir, {
|
|
207
|
-
recursive: !0
|
|
208
|
-
});
|
|
209
|
-
try {
|
|
210
|
-
process.chdir(tamaguiDir);
|
|
211
|
-
try {
|
|
212
|
-
console.info("Attempting to clone with SSH"), (0, import_node_child_process.execSync)("git clone -n --depth=1 --branch generated --filter=tree:0 git@github.com:tamagui/".concat(repoName, ".git"));
|
|
213
|
-
} catch {
|
|
214
|
-
console.info("SSH failed - Attempting to c lone with HTTPS"), (0, import_node_child_process.execSync)("git clone -n --depth=1 --branch generated --filter=tree:0 https://github.com/tamagui/".concat(repoName));
|
|
215
|
-
}
|
|
216
|
-
process.chdir(tempDir), (0, import_node_child_process.execSync)([
|
|
217
|
-
"git sparse-checkout set --no-cone meta",
|
|
218
|
-
"git checkout"
|
|
219
|
-
].join(" && "));
|
|
220
|
-
} catch (error) {
|
|
221
|
-
if (_instanceof(error, Error))
|
|
222
|
-
throw error != null && error.stderr.includes("Repository not found") && (console.info(import_chalk.default.yellow("You don't have access to Tamagui ".concat(type === "font" ? "fonts" : "icons", ". Check \u{1F961} Tamagui Takeout (https://tamagui.dev/takeout) for more info."))), (0, import_opener.default)("https://tamagui.dev/takeout"), process.exit(0)), error;
|
|
223
|
-
}
|
|
224
|
-
return _ = JSON.parse, [
|
|
225
|
-
4,
|
|
226
|
-
(0, import_promises.readFile)(import_node_path.default.join(tamaguiDir, repoName, "meta", "data.json")).then(function(r) {
|
|
227
|
-
return r.toString();
|
|
228
|
-
})
|
|
229
|
-
];
|
|
230
|
-
case 2:
|
|
231
|
-
return meta = _.apply(JSON, [
|
|
232
|
-
_state.sent()
|
|
233
|
-
]), console.info(import_chalk.default.gray("Use \u21E7/\u21E9 to navigate. Use tab to cycle the result. Use Page Up/Page Down (on Mac: fn + \u21E7 / \u21E9) to change page. Hit enter to select the highlighted item below the prompt.")), [
|
|
234
|
-
4,
|
|
235
|
-
(0, import_prompts.default)({
|
|
236
|
-
name: "packageName",
|
|
237
|
-
type: "autocomplete",
|
|
238
|
-
message: type === "icon" ? "Pick an icon pack:" : type === "font" ? "Pick a font:" : "Pick one:",
|
|
239
|
-
choices: Object.entries(meta).map(function(param) {
|
|
240
|
-
var _param = _sliced_to_array(param, 2), slug = _param[0], data = _param[1];
|
|
241
|
-
return {
|
|
242
|
-
title: type === "font" ? "".concat(slug, ": ").concat(data.weights.length, " weights, ").concat(data.styles.length, " styles, ").concat(data.subsets.length, " subsets (https://fonts.google.com/specimen/").concat((0, import_change_case.pascalCase)(slug), ")") : "".concat(data.name, ": ").concat(data.total, " icons, ").concat(data.license.title, " license (").concat(data.author.url, ")"),
|
|
243
|
-
value: slug
|
|
244
|
-
};
|
|
245
|
-
})
|
|
246
|
-
})
|
|
247
|
-
];
|
|
248
|
-
case 3:
|
|
249
|
-
return result = _state.sent(), packageName = "".concat(type, "-").concat(result.packageName), packageDir = import_node_path.default.join(tempDir, "packages", packageName), process.chdir(tempDir), (0, import_node_child_process.execSync)([
|
|
250
|
-
"git sparse-checkout set --no-cone packages/".concat(packageName),
|
|
251
|
-
"git checkout"
|
|
252
|
-
].join(" && ")), finalDir = import_node_path.default.join(packagesPath, packageName), [
|
|
253
|
-
4,
|
|
254
|
-
(0, import_fs_extra.ensureDir)(packagesPath)
|
|
255
|
-
];
|
|
256
|
-
case 4:
|
|
257
|
-
return _state.sent(), [
|
|
258
|
-
4,
|
|
259
|
-
(0, import_fs_extra.copy)(packageDir, finalDir)
|
|
260
|
-
];
|
|
261
|
-
case 5:
|
|
262
|
-
return _state.sent(), console.info(), console.info(import_chalk.default.green("Created the package under ".concat(finalDir))), console.info(), readmePath = import_node_path.default.join(finalDir, "README.md"), (0, import_node_fs.existsSync)(readmePath) && console.info(import_marked.marked.parse((0, import_fs_extra.readFileSync)(readmePath).toString())), [
|
|
263
|
-
2
|
|
264
|
-
];
|
|
265
|
-
}
|
|
266
|
-
});
|
|
39
|
+
], installGeneratedPackage = async function(type, packagesPath) {
|
|
40
|
+
if (packagesPath = packagesPath || import_node_path.default.join(process.cwd(), "packages"), !generatedPackageTypes.includes(type))
|
|
41
|
+
throw new Error(`${type ? `Type "${type}" is Not supported.` : "No type provided."} Supported types: ${generatedPackageTypes.join(", ")}`);
|
|
42
|
+
var repoName = type === "font" ? "tamagui-google-fonts" : "tamagui-iconify";
|
|
43
|
+
console.info(`Setting up ${import_chalk.default.blueBright(tamaguiDir)}...`), await (0, import_fs_extra.ensureDir)(tamaguiDir);
|
|
44
|
+
var tempDir = import_node_path.default.join(tamaguiDir, repoName);
|
|
45
|
+
(0, import_node_fs.existsSync)(tempDir) && (0, import_node_fs.rmSync)(tempDir, {
|
|
46
|
+
recursive: !0
|
|
267
47
|
});
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
48
|
+
try {
|
|
49
|
+
process.chdir(tamaguiDir);
|
|
50
|
+
try {
|
|
51
|
+
console.info("Attempting to clone with SSH"), (0, import_node_child_process.execSync)(`git clone -n --depth=1 --branch generated --filter=tree:0 git@github.com:tamagui/${repoName}.git`);
|
|
52
|
+
} catch {
|
|
53
|
+
console.info("SSH failed - Attempting to c lone with HTTPS"), (0, import_node_child_process.execSync)(`git clone -n --depth=1 --branch generated --filter=tree:0 https://github.com/tamagui/${repoName}`);
|
|
54
|
+
}
|
|
55
|
+
process.chdir(tempDir), (0, import_node_child_process.execSync)([
|
|
56
|
+
"git sparse-checkout set --no-cone meta",
|
|
57
|
+
"git checkout"
|
|
58
|
+
].join(" && "));
|
|
59
|
+
} catch (error) {
|
|
60
|
+
if (error instanceof Error)
|
|
61
|
+
throw error != null && error.stderr.includes("Repository not found") && (console.info(import_chalk.default.yellow(`You don't have access to Tamagui ${type === "font" ? "fonts" : "icons"}. Check \u{1F961} Tamagui Takeout (https://tamagui.dev/takeout) for more info.`)), (0, import_opener.default)("https://tamagui.dev/takeout"), process.exit(0)), error;
|
|
62
|
+
}
|
|
63
|
+
var meta = JSON.parse(await (0, import_promises.readFile)(import_node_path.default.join(tamaguiDir, repoName, "meta", "data.json")).then(function(r) {
|
|
64
|
+
return r.toString();
|
|
65
|
+
}));
|
|
66
|
+
console.info(import_chalk.default.gray("Use \u21E7/\u21E9 to navigate. Use tab to cycle the result. Use Page Up/Page Down (on Mac: fn + \u21E7 / \u21E9) to change page. Hit enter to select the highlighted item below the prompt."));
|
|
67
|
+
var result = await (0, import_prompts.default)({
|
|
68
|
+
name: "packageName",
|
|
69
|
+
type: "autocomplete",
|
|
70
|
+
message: type === "icon" ? "Pick an icon pack:" : type === "font" ? "Pick a font:" : "Pick one:",
|
|
71
|
+
choices: Object.entries(meta).map(function(param) {
|
|
72
|
+
var [slug, data] = param;
|
|
73
|
+
return {
|
|
74
|
+
title: type === "font" ? `${slug}: ${data.weights.length} weights, ${data.styles.length} styles, ${data.subsets.length} subsets (https://fonts.google.com/specimen/${(0, import_change_case.pascalCase)(slug)})` : `${data.name}: ${data.total} icons, ${data.license.title} license (${data.author.url})`,
|
|
75
|
+
value: slug
|
|
76
|
+
};
|
|
77
|
+
})
|
|
78
|
+
}), packageName = `${type}-${result.packageName}`, packageDir = import_node_path.default.join(tempDir, "packages", packageName);
|
|
79
|
+
process.chdir(tempDir), (0, import_node_child_process.execSync)([
|
|
80
|
+
`git sparse-checkout set --no-cone packages/${packageName}`,
|
|
81
|
+
"git checkout"
|
|
82
|
+
].join(" && "));
|
|
83
|
+
var finalDir = import_node_path.default.join(packagesPath, packageName);
|
|
84
|
+
await (0, import_fs_extra.ensureDir)(packagesPath), await (0, import_fs_extra.copy)(packageDir, finalDir), console.info(), console.info(import_chalk.default.green(`Created the package under ${finalDir}`)), console.info();
|
|
85
|
+
var readmePath = import_node_path.default.join(finalDir, "README.md");
|
|
86
|
+
(0, import_node_fs.existsSync)(readmePath) && console.info(import_marked.marked.parse((0, import_fs_extra.readFileSync)(readmePath).toString()));
|
|
87
|
+
};
|
|
272
88
|
// Annotate the CommonJS export names for ESM import in node:
|
|
273
89
|
0 && (module.exports = {
|
|
274
90
|
generatedPackageTypes,
|
package/dist/add.native.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/Users/n8/tamagui/code/core/cli/src/add.ts"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": ["marked", "setOptions", "headerIds", "mangle", "renderer", "TerminalRenderer", "home", "homedir", "tamaguiDir", "path", "join", "generatedPackageTypes", "installGeneratedPackage", "type", "packagesPath", "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;gCAAyB,+BACzB,iBAAmC,oBACnC,kBAAyB,6BACzB,iBAAwB,oBACxB,mBAAiB,+BAEjB,eAAkB,2BAClB,qBAA2B,wBAC3B,kBAA8C,qBAC9C,gBAAuB,mBACvB,yBAA6B,qCAC7B,gBAAiB,4BACjB,iBAAoB;AAEpBA,qBAAOC,WAAW;EAChBC,WAAW;EACXC,QAAQ;EACRC,UAAU,IAAIC,uBAAAA,QAAAA;AAChB,CAAA;AAEA,IAAMC,WAAOC,wBAAAA,GACPC,aAAaC,iBA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AaD,UAAAA,EAAY5B,SAAQ,CAAA,CAAA;AAE/D;",
|
|
5
|
+
"names": ["marked", "setOptions", "headerIds", "mangle", "renderer", "TerminalRenderer", "home", "homedir", "tamaguiDir", "path", "join", "generatedPackageTypes", "installGeneratedPackage", "type", "packagesPath", "process", "cwd", "includes", "Error", "repoName", "console", "info", "chalk", "blueBright", "ensureDir", "tempDir", "existsSync", "rmSync", "recursive", "chdir", "execSync", "error", "stderr", "yellow", "open", "exit", "meta", "JSON", "parse", "readFile", "then", "r", "toString", "gray", "result", "prompts", "name", "message", "choices", "Object", "entries", "map", "slug", "data", "title", "weights", "length", "styles", "subsets", "pascalCase", "total", "license", "author", "url", "value", "packageName", "packageDir", "finalDir", "copy", "green", "readmePath", "readFileSync"]
|
|
6
6
|
}
|
package/dist/build.native.js
CHANGED
|
@@ -26,242 +26,51 @@ __export(build_exports, {
|
|
|
26
26
|
build: () => build
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(build_exports);
|
|
29
|
-
var import_node_path = require("node:path"), import_static = require("@tamagui/static"), import_chokidar = __toESM(require("chokidar")), import_fs_extra = require("fs-extra"), import_micromatch = __toESM(require("micromatch"))
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
info.done ? resolve2(value) : Promise.resolve(value).then(_next, _throw);
|
|
38
|
-
}
|
|
39
|
-
function _async_to_generator(fn) {
|
|
40
|
-
return function() {
|
|
41
|
-
var self = this, args = arguments;
|
|
42
|
-
return new Promise(function(resolve2, reject) {
|
|
43
|
-
var gen = fn.apply(self, args);
|
|
44
|
-
function _next(value) {
|
|
45
|
-
asyncGeneratorStep(gen, resolve2, reject, _next, _throw, "next", value);
|
|
46
|
-
}
|
|
47
|
-
function _throw(err) {
|
|
48
|
-
asyncGeneratorStep(gen, resolve2, reject, _next, _throw, "throw", err);
|
|
49
|
-
}
|
|
50
|
-
_next(void 0);
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function _define_property(obj, key, value) {
|
|
55
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
56
|
-
value,
|
|
57
|
-
enumerable: !0,
|
|
58
|
-
configurable: !0,
|
|
59
|
-
writable: !0
|
|
60
|
-
}) : obj[key] = value, obj;
|
|
61
|
-
}
|
|
62
|
-
function _object_spread(target) {
|
|
63
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
64
|
-
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
65
|
-
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
66
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
67
|
-
}))), ownKeys2.forEach(function(key) {
|
|
68
|
-
_define_property(target, key, source[key]);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return target;
|
|
72
|
-
}
|
|
73
|
-
function ownKeys(object, enumerableOnly) {
|
|
74
|
-
var keys = Object.keys(object);
|
|
75
|
-
if (Object.getOwnPropertySymbols) {
|
|
76
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
77
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
78
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
79
|
-
})), keys.push.apply(keys, symbols);
|
|
80
|
-
}
|
|
81
|
-
return keys;
|
|
82
|
-
}
|
|
83
|
-
function _object_spread_props(target, source) {
|
|
84
|
-
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
85
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
86
|
-
}), target;
|
|
87
|
-
}
|
|
88
|
-
function _ts_generator(thisArg, body) {
|
|
89
|
-
var f, y, t, g, _ = {
|
|
90
|
-
label: 0,
|
|
91
|
-
sent: function() {
|
|
92
|
-
if (t[0] & 1) throw t[1];
|
|
93
|
-
return t[1];
|
|
94
|
-
},
|
|
95
|
-
trys: [],
|
|
96
|
-
ops: []
|
|
29
|
+
var import_node_path = require("node:path"), import_static = require("@tamagui/static"), import_chokidar = __toESM(require("chokidar")), import_fs_extra = require("fs-extra"), import_micromatch = __toESM(require("micromatch")), build = async function(options) {
|
|
30
|
+
var _options_dir, sourceDir = (_options_dir = options.dir) !== null && _options_dir !== void 0 ? _options_dir : ".", promises = [], buildOptions = (0, import_static.loadTamaguiBuildConfigSync)(options.tamaguiOptions), _options_target, platform = (_options_target = options.target) !== null && _options_target !== void 0 ? _options_target : "web";
|
|
31
|
+
process.env.TAMAGUI_TARGET = platform;
|
|
32
|
+
var tamaguiOptions = {
|
|
33
|
+
...buildOptions,
|
|
34
|
+
platform
|
|
97
35
|
};
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return function(v) {
|
|
107
|
-
return step([
|
|
108
|
-
n,
|
|
109
|
-
v
|
|
110
|
-
]);
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
function step(op) {
|
|
114
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
115
|
-
for (; _; ) try {
|
|
116
|
-
if (f = 1, y && (t = op[0] & 2 ? y.return : op[0] ? y.throw || ((t = y.return) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
117
|
-
switch (y = 0, t && (op = [
|
|
118
|
-
op[0] & 2,
|
|
119
|
-
t.value
|
|
120
|
-
]), op[0]) {
|
|
121
|
-
case 0:
|
|
122
|
-
case 1:
|
|
123
|
-
t = op;
|
|
124
|
-
break;
|
|
125
|
-
case 4:
|
|
126
|
-
return _.label++, {
|
|
127
|
-
value: op[1],
|
|
128
|
-
done: !1
|
|
129
|
-
};
|
|
130
|
-
case 5:
|
|
131
|
-
_.label++, y = op[1], op = [
|
|
132
|
-
0
|
|
133
|
-
];
|
|
134
|
-
continue;
|
|
135
|
-
case 7:
|
|
136
|
-
op = _.ops.pop(), _.trys.pop();
|
|
137
|
-
continue;
|
|
138
|
-
default:
|
|
139
|
-
if (t = _.trys, !(t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
140
|
-
_ = 0;
|
|
141
|
-
continue;
|
|
36
|
+
await (0, import_static.loadTamagui)(tamaguiOptions), await new Promise(function(res) {
|
|
37
|
+
import_chokidar.default.watch(`${sourceDir}/**/*.tsx`, {}).on("add", function(relativePath) {
|
|
38
|
+
if (!(options.exclude && import_micromatch.default.contains(relativePath, options.exclude)) && !(options.include && !import_micromatch.default.contains(relativePath, options.include))) {
|
|
39
|
+
var sourcePath = (0, import_node_path.resolve)(process.cwd(), relativePath);
|
|
40
|
+
console.info(` [tamagui] optimizing ${sourcePath}`), promises.push(async function() {
|
|
41
|
+
if (options.debug) {
|
|
42
|
+
var _process_env;
|
|
43
|
+
(_process_env = process.env).NODE_ENV || (_process_env.NODE_ENV = "development");
|
|
142
44
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
45
|
+
var source = await (0, import_fs_extra.readFile)(sourcePath, "utf-8");
|
|
46
|
+
if (platform === "web") {
|
|
47
|
+
var extractor = (0, import_static.createExtractor)({
|
|
48
|
+
platform
|
|
49
|
+
}), out = await (0, import_static.extractToClassNames)({
|
|
50
|
+
extractor,
|
|
51
|
+
source,
|
|
52
|
+
sourcePath,
|
|
53
|
+
options: buildOptions,
|
|
54
|
+
shouldPrintDebug: options.debug || !1
|
|
55
|
+
});
|
|
56
|
+
if (!out)
|
|
57
|
+
return;
|
|
58
|
+
var cssName = "_" + (0, import_node_path.basename)(sourcePath, (0, import_node_path.extname)(sourcePath)), stylePath = (0, import_node_path.join)((0, import_node_path.dirname)(sourcePath), cssName + ".css"), code = `import "./${cssName}.css"
|
|
59
|
+
${out.js}`;
|
|
60
|
+
await Promise.all([
|
|
61
|
+
(0, import_fs_extra.writeFile)(sourcePath, code, "utf-8"),
|
|
62
|
+
(0, import_fs_extra.writeFile)(stylePath, out.styles, "utf-8")
|
|
63
|
+
]);
|
|
146
64
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
if (t && _.label < t[2]) {
|
|
152
|
-
_.label = t[2], _.ops.push(op);
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
t[2] && _.ops.pop(), _.trys.pop();
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
|
-
op = body.call(thisArg, _);
|
|
159
|
-
} catch (e) {
|
|
160
|
-
op = [
|
|
161
|
-
6,
|
|
162
|
-
e
|
|
163
|
-
], y = 0;
|
|
164
|
-
} finally {
|
|
165
|
-
f = t = 0;
|
|
166
|
-
}
|
|
167
|
-
if (op[0] & 5) throw op[1];
|
|
168
|
-
return {
|
|
169
|
-
value: op[0] ? op[1] : void 0,
|
|
170
|
-
done: !0
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
var build = /* @__PURE__ */ function() {
|
|
175
|
-
var _ref = _async_to_generator(function(options) {
|
|
176
|
-
var _options_dir, sourceDir, promises, buildOptions, _options_target, platform, tamaguiOptions;
|
|
177
|
-
return _ts_generator(this, function(_state) {
|
|
178
|
-
switch (_state.label) {
|
|
179
|
-
case 0:
|
|
180
|
-
return sourceDir = (_options_dir = options.dir) !== null && _options_dir !== void 0 ? _options_dir : ".", promises = [], buildOptions = (0, import_static.loadTamaguiBuildConfigSync)(options.tamaguiOptions), platform = (_options_target = options.target) !== null && _options_target !== void 0 ? _options_target : "web", process.env.TAMAGUI_TARGET = platform, tamaguiOptions = _object_spread_props(_object_spread({}, buildOptions), {
|
|
181
|
-
platform
|
|
182
|
-
}), [
|
|
183
|
-
4,
|
|
184
|
-
(0, import_static.loadTamagui)(tamaguiOptions)
|
|
185
|
-
];
|
|
186
|
-
case 1:
|
|
187
|
-
return _state.sent(), [
|
|
188
|
-
4,
|
|
189
|
-
new Promise(function(res) {
|
|
190
|
-
import_chokidar.default.watch("".concat(sourceDir, "/**/*.tsx"), {}).on("add", function(relativePath) {
|
|
191
|
-
if (!(options.exclude && import_micromatch.default.contains(relativePath, options.exclude)) && !(options.include && !import_micromatch.default.contains(relativePath, options.include))) {
|
|
192
|
-
var sourcePath = (0, import_node_path.resolve)(process.cwd(), relativePath);
|
|
193
|
-
console.info(" [tamagui] optimizing ".concat(sourcePath)), promises.push(_async_to_generator(function() {
|
|
194
|
-
var _process_env, source, extractor, out, cssName, stylePath, code, out1;
|
|
195
|
-
return _ts_generator(this, function(_state2) {
|
|
196
|
-
switch (_state2.label) {
|
|
197
|
-
case 0:
|
|
198
|
-
return options.debug && ((_process_env = process.env).NODE_ENV || (_process_env.NODE_ENV = "development")), [
|
|
199
|
-
4,
|
|
200
|
-
(0, import_fs_extra.readFile)(sourcePath, "utf-8")
|
|
201
|
-
];
|
|
202
|
-
case 1:
|
|
203
|
-
return source = _state2.sent(), platform !== "web" ? [
|
|
204
|
-
3,
|
|
205
|
-
4
|
|
206
|
-
] : (extractor = (0, import_static.createExtractor)({
|
|
207
|
-
platform
|
|
208
|
-
}), [
|
|
209
|
-
4,
|
|
210
|
-
(0, import_static.extractToClassNames)({
|
|
211
|
-
extractor,
|
|
212
|
-
source,
|
|
213
|
-
sourcePath,
|
|
214
|
-
options: buildOptions,
|
|
215
|
-
shouldPrintDebug: options.debug || !1
|
|
216
|
-
})
|
|
217
|
-
]);
|
|
218
|
-
case 2:
|
|
219
|
-
return out = _state2.sent(), out ? (cssName = "_" + (0, import_node_path.basename)(sourcePath, (0, import_node_path.extname)(sourcePath)), stylePath = (0, import_node_path.join)((0, import_node_path.dirname)(sourcePath), cssName + ".css"), code = 'import "./'.concat(cssName, `.css"
|
|
220
|
-
`).concat(out.js), [
|
|
221
|
-
4,
|
|
222
|
-
Promise.all([
|
|
223
|
-
(0, import_fs_extra.writeFile)(sourcePath, code, "utf-8"),
|
|
224
|
-
(0, import_fs_extra.writeFile)(stylePath, out.styles, "utf-8")
|
|
225
|
-
])
|
|
226
|
-
]) : [
|
|
227
|
-
2
|
|
228
|
-
];
|
|
229
|
-
case 3:
|
|
230
|
-
_state2.sent(), _state2.label = 4;
|
|
231
|
-
case 4:
|
|
232
|
-
return out1 = (0, import_static.extractToNative)(sourcePath, source, tamaguiOptions), [
|
|
233
|
-
4,
|
|
234
|
-
(0, import_fs_extra.writeFile)(sourcePath, out1.code, "utf-8")
|
|
235
|
-
];
|
|
236
|
-
case 5:
|
|
237
|
-
return _state2.sent(), [
|
|
238
|
-
2
|
|
239
|
-
];
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
})());
|
|
243
|
-
}
|
|
244
|
-
}).on("ready", function() {
|
|
245
|
-
res();
|
|
246
|
-
});
|
|
247
|
-
})
|
|
248
|
-
];
|
|
249
|
-
case 2:
|
|
250
|
-
return _state.sent(), [
|
|
251
|
-
4,
|
|
252
|
-
Promise.all(promises)
|
|
253
|
-
];
|
|
254
|
-
case 3:
|
|
255
|
-
return _state.sent(), [
|
|
256
|
-
2
|
|
257
|
-
];
|
|
65
|
+
var out1 = (0, import_static.extractToNative)(sourcePath, source, tamaguiOptions);
|
|
66
|
+
await (0, import_fs_extra.writeFile)(sourcePath, out1.code, "utf-8");
|
|
67
|
+
}());
|
|
258
68
|
}
|
|
69
|
+
}).on("ready", function() {
|
|
70
|
+
res();
|
|
259
71
|
});
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
return _ref.apply(this, arguments);
|
|
263
|
-
};
|
|
264
|
-
}();
|
|
72
|
+
}), await Promise.all(promises);
|
|
73
|
+
};
|
|
265
74
|
// Annotate the CommonJS export names for ESM import in node:
|
|
266
75
|
0 && (module.exports = {
|
|
267
76
|
build
|
package/dist/build.native.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3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,GAEM4B,MAAM,UAAMC,mCAAoB;cACpCH;cACAF;cACAR;cACAvB,SAASI;cACTiC,kBAAkBrC,QAAQ6B,SAAS;YACrC,CAAA;AAEA,gBAAI,CAACM;AACH;AAGF,gBAAMG,UAAU,UAAMC,2BAAShB,gBAAYiB,0BAAQjB,UAAAA,CAAAA,GAC7CkB,gBAAYC,2BAAKC,0BAAQpB,UAAAA,GAAae,UAAU,MAAA,GAChDM,OAAO,aAAaN,OAAAA;EAAiBH,IAAIU,EAAE;AAEjD,kBAAMhC,QAAQiC,IAAI;kBAChBC,2BAAUxB,YAAYqB,MAAM,OAAA;kBAC5BG,2BAAUN,WAAWN,IAAIa,QAAQ,OAAA;aAClC;UACH;AAGA,cAAMb,WAAMc,+BAAgB1B,YAAYQ,QAAQzB,cAAAA;AAChD,oBAAMyC,2BAAUxB,YAAYY,KAAIS,MAAM,OAAA;QACxC,EAAA,CAAA;;IAEJ,CAAA,EACC3B,GAAG,SAAS,WAAA;AACXH,UAAAA;IACF,CAAA;EACJ,CAAA,GAEA,MAAMD,QAAQiC,IAAI3C,QAAAA;AACpB;",
|
|
5
|
+
"names": ["build", "options", "sourceDir", "dir", "promises", "buildOptions", "loadTamaguiBuildConfigSync", "tamaguiOptions", "platform", "target", "process", "env", "TAMAGUI_TARGET", "loadTamagui", "Promise", "res", "chokidar", "watch", "on", "relativePath", "exclude", "MicroMatch", "contains", "include", "sourcePath", "resolve", "cwd", "console", "info", "push", "debug", "NODE_ENV", "source", "readFile", "extractor", "createExtractor", "out", "extractToClassNames", "shouldPrintDebug", "cssName", "basename", "extname", "stylePath", "join", "dirname", "code", "js", "all", "writeFile", "styles", "extractToNative"]
|
|
6
6
|
}
|