@tamagui/cli 2.0.0-rc.4 → 2.0.0-rc.40

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/generate.cjs CHANGED
@@ -3,42 +3,44 @@ var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf,
7
- __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __export = (target, all) => {
9
- for (var name in all) __defProp(target, name, {
10
- get: all[name],
11
- enumerable: !0
12
- });
13
- },
14
- __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
17
  get: () => from[key],
17
18
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
19
  });
19
- return to;
20
- };
20
+ }
21
+ return to;
22
+ };
21
23
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
27
- value: mod,
28
- enumerable: !0
29
- }) : target, mod)),
30
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
31
- value: !0
32
- }), mod);
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
29
+ value: mod,
30
+ enumerable: true
31
+ }) : target, mod));
32
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
33
+ value: true
34
+ }), mod);
33
35
  var generate_exports = {};
34
36
  __export(generate_exports, {
35
37
  generateTypes: () => generateTypes,
36
38
  getTypes: () => getTypes
37
39
  });
38
40
  module.exports = __toCommonJS(generate_exports);
39
- var import_fs_extra = __toESM(require("fs-extra")),
40
- import_ts_morph = require("ts-morph"),
41
- import_utils = require("./utils.cjs");
41
+ var import_fs_extra = __toESM(require("fs-extra"));
42
+ var import_ts_morph = require("ts-morph");
43
+ var import_utils = require("./utils.cjs");
42
44
  async function generateTypes(options) {
43
45
  const types = await getTypes(options);
44
46
  await import_fs_extra.default.writeJSON(options.paths.types, types, {
@@ -47,17 +49,28 @@ async function generateTypes(options) {
47
49
  }
48
50
  async function getTypes(options) {
49
51
  const tamagui = await (0, import_utils.loadTamagui)(options.tamaguiOptions);
50
- if (!tamagui) throw new Error("No tamagui config");
51
- const nameToPaths = tamagui.nameToPaths || [],
52
- uniqueViewExportingPaths = new Set(Object.keys(nameToPaths).map(name => `${[...nameToPaths[name]][0]}.ts*`)),
53
- files = new import_ts_morph.Project({
54
- compilerOptions: {
55
- noEmit: !1,
56
- declaration: !0,
57
- emitDeclarationOnly: !0
58
- },
59
- skipAddingFilesFromTsConfig: !0,
60
- tsConfigFilePath: options.tsconfigPath
61
- }).addSourceFilesAtPaths([...uniqueViewExportingPaths]);
62
- return Object.fromEntries(files.flatMap(x => [...x.getExportedDeclarations()].map(([k, v]) => [k, v[0].getType().getApparentType().getProperties().map(prop => [prop.getEscapedName(), prop.getValueDeclaration()?.getType().getText()])])));
52
+ if (!tamagui) {
53
+ throw new Error(`No tamagui config`);
54
+ }
55
+ const nameToPaths = tamagui.nameToPaths || [];
56
+ const uniqueViewExportingPaths = new Set(Object.keys(nameToPaths).map(name => {
57
+ return `${[...nameToPaths[name]][0]}.ts*`;
58
+ }));
59
+ const project = new import_ts_morph.Project({
60
+ compilerOptions: {
61
+ noEmit: false,
62
+ declaration: true,
63
+ emitDeclarationOnly: true
64
+ },
65
+ skipAddingFilesFromTsConfig: true,
66
+ tsConfigFilePath: options.tsconfigPath
67
+ });
68
+ const files = project.addSourceFilesAtPaths([...uniqueViewExportingPaths]);
69
+ return Object.fromEntries(files.flatMap(x => {
70
+ return [...x.getExportedDeclarations()].map(([k, v]) => {
71
+ return [k, v[0].getType().getApparentType().getProperties().map(prop => {
72
+ return [prop.getEscapedName(), prop.getValueDeclaration()?.getType().getText()];
73
+ })];
74
+ });
75
+ }));
63
76
  }
@@ -2,54 +2,66 @@ 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;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
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, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  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);
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var update_template_exports = {};
33
35
  __export(update_template_exports, {
34
36
  updateTemplate: () => updateTemplate
35
37
  });
36
38
  module.exports = __toCommonJS(update_template_exports);
37
- var import_chalk = __toESM(require("chalk")),
38
- import_node_child_process = require("node:child_process");
39
+ var import_chalk = __toESM(require("chalk"));
40
+ var import_node_child_process = require("node:child_process");
39
41
  function updateTemplate(templateUrl, ignoredPatterns = []) {
40
- const remoteName = `${templateUrl.split("/").pop()?.split(".")[0] || "template"}-template`,
41
- addRemoteCommand = `git remote add ${remoteName} ${templateUrl}`,
42
- rmRemoteCommand = `git remote remove ${remoteName}`;
42
+ const templateName = templateUrl.split("/").pop()?.split(".")[0] || "template";
43
+ const remoteName = `${templateName}-template`;
44
+ const addRemoteCommand = `git remote add ${remoteName} ${templateUrl}`;
45
+ const rmRemoteCommand = `git remote remove ${remoteName}`;
43
46
  try {
44
47
  (0, import_node_child_process.execSync)(addRemoteCommand);
45
48
  } catch (error) {
46
- if (error instanceof Error && error.toString().includes("already exists")) (0, import_node_child_process.execSync)(rmRemoteCommand), (0, import_node_child_process.execSync)(addRemoteCommand);else throw error;
49
+ if (error instanceof Error && error.toString().includes("already exists")) {
50
+ (0, import_node_child_process.execSync)(rmRemoteCommand);
51
+ (0, import_node_child_process.execSync)(addRemoteCommand);
52
+ } else {
53
+ throw error;
54
+ }
47
55
  }
48
- (0, import_node_child_process.execSync)("git fetch --all");
56
+ (0, import_node_child_process.execSync)(`git fetch --all`);
49
57
  try {
50
- (0, import_node_child_process.execSync)("git merge takeout-template/main --allow-unrelated-histories");
58
+ (0, import_node_child_process.execSync)(`git merge takeout-template/main --allow-unrelated-histories`);
51
59
  } catch (error) {
52
- if (error instanceof Error && error.message.includes("unresolved conflict")) console.info(tamaguiLog("We've merged the latest changes. Please resolve the conflicts and commit the merge."));else throw error;
60
+ if (error instanceof Error && error.message.includes("unresolved conflict")) {
61
+ console.info(tamaguiLog("We've merged the latest changes. Please resolve the conflicts and commit the merge."));
62
+ } else {
63
+ throw error;
64
+ }
53
65
  }
54
66
  (0, import_node_child_process.execSync)(`git reset HEAD ${ignoredPatterns.join(" ")}`);
55
67
  }
package/dist/update.cjs CHANGED
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- 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, {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
14
  get: () => from[key],
14
15
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
16
  });
16
- return to;
17
- };
17
+ }
18
+ return to;
19
+ };
18
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
21
+ value: true
20
22
  }), mod);
21
23
  var update_exports = {};
22
24
  __export(update_exports, {