@tamagui/cli 1.0.17 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/dev.js CHANGED
@@ -27,6 +27,7 @@ __export(dev_exports, {
27
27
  dev: () => dev
28
28
  });
29
29
  module.exports = __toCommonJS(dev_exports);
30
+ var import_path = require("path");
30
31
  var import_vite_plugin = require("@tamagui/vite-plugin");
31
32
  var import_chalk = __toESM(require("chalk"));
32
33
  var import_express = __toESM(require("express"));
@@ -37,26 +38,37 @@ var import_vite = require("vite");
37
38
  var import_tamaguiConfigUtils = require("./tamaguiConfigUtils.js");
38
39
  var import_utils = require("./utils.js");
39
40
  const dev = async (options) => {
40
- var _a;
41
+ var _a, _b;
41
42
  const { root, mode, paths } = options;
42
43
  process.chdir(process.cwd());
44
+ const plugins = [
45
+ (0, import_vite_plugin.tamaguiPlugin)({
46
+ components: ["tamagui"]
47
+ }),
48
+ (0, import_vite_plugin.nativePlugin)()
49
+ ];
50
+ const buildOutput = await (0, import_vite.build)({
51
+ plugins,
52
+ root
53
+ });
54
+ const outputJsFile = "output" in buildOutput ? (_a = buildOutput.output[0]) == null ? void 0 : _a.fileName : null;
55
+ if (!outputJsFile) {
56
+ throw new Error(`No js?`);
57
+ }
58
+ const outputJsPath = (0, import_path.join)(process.cwd(), "dist", outputJsFile);
43
59
  const server = await (0, import_vite.createServer)({
44
60
  root,
45
61
  server: {
46
62
  port: options.port,
47
63
  host: options.host || "localhost"
48
64
  },
49
- plugins: [
50
- (0, import_vite_plugin.tamaguiPlugin)({
51
- components: ["tamagui"]
52
- })
53
- ]
65
+ plugins
54
66
  });
55
67
  await Promise.all([
56
68
  server.listen(),
57
69
  (0, import_tamaguiConfigUtils.watchTamaguiConfig)(options)
58
70
  ]);
59
- const info = (_a = server.httpServer) == null ? void 0 : _a.address();
71
+ const info = (_b = server.httpServer) == null ? void 0 : _b.address();
60
72
  const app = (0, import_express.default)();
61
73
  app.disable("x-powered-by");
62
74
  app.use(import_express.default.static(paths.dotDir, { maxAge: "2h" }));
@@ -65,11 +77,18 @@ const dev = async (options) => {
65
77
  const conf = await import_fs_extra.default.readJSON(paths.conf);
66
78
  res.status(200).json(conf);
67
79
  });
80
+ app.get("/index.bundle", async (req, res) => {
81
+ const output = (await import_fs_extra.default.readFile(outputJsPath)).toString();
82
+ res.status(200).send(output);
83
+ });
68
84
  app.use("/", (0, import_express_http_proxy.default)(`${info.address}:${info.port}`));
69
85
  const port = 8081;
70
86
  app.listen(port);
71
87
  console.log(`Listening on`, import_chalk.default.green(`http://localhost:${port}`));
72
88
  server.printUrls();
89
+ process.on("beforeExit", () => {
90
+ server.close();
91
+ });
73
92
  await (0, import_utils.closeEvent)(server);
74
93
  };
75
94
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/dev.ts"],
4
- "sourcesContent": ["import { AddressInfo } from 'net'\nimport { join } from 'path'\n\nimport { tamaguiPlugin } from '@tamagui/vite-plugin'\nimport chalk from 'chalk'\nimport express from 'express'\nimport proxy from 'express-http-proxy'\nimport fs from 'fs-extra'\nimport morgan from 'morgan'\nimport { createServer } from 'vite'\n\nimport { watchTamaguiConfig } from './tamaguiConfigUtils.js'\nimport { ResolvedOptions } from './types.js'\nimport { closeEvent } from './utils.js'\n\nexport const dev = async (options: ResolvedOptions) => {\n const { root, mode, paths } = options\n\n process.chdir(process.cwd())\n\n const server = await createServer({\n root,\n server: {\n port: options.port,\n host: options.host || 'localhost',\n },\n plugins: [\n tamaguiPlugin({\n components: ['tamagui'],\n }),\n ],\n })\n\n // these can be lazy loaded (eventually should put in own process)\n await Promise.all([\n server.listen(),\n //\n watchTamaguiConfig(options),\n // generateTypes(options),\n ])\n\n const info = server.httpServer?.address() as AddressInfo\n const app = express()\n\n app.disable('x-powered-by')\n app.use(express.static(paths.dotDir, { maxAge: '2h' }))\n app.use(morgan('tiny'))\n\n // studio specific - move out eventually to studioPlugin\n\n app.get('/conf', async (req, res) => {\n const conf = await fs.readJSON(paths.conf)\n res.status(200).json(conf)\n })\n\n app.use('/', proxy(`${info.address}:${info.port}`))\n\n // react native port\n const port = 8081\n app.listen(port)\n\n // eslint-disable-next-line no-console\n console.log(`Listening on`, chalk.green(`http://localhost:${port}`))\n server.printUrls()\n\n await closeEvent(server)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yBAA8B;AAC9B,mBAAkB;AAClB,qBAAoB;AACpB,gCAAkB;AAClB,sBAAe;AACf,oBAAmB;AACnB,kBAA6B;AAE7B,gCAAmC;AAEnC,mBAA2B;AAEpB,MAAM,MAAM,OAAO,YAA6B;AAfvD;AAgBE,QAAM,EAAE,MAAM,MAAM,MAAM,IAAI;AAE9B,UAAQ,MAAM,QAAQ,IAAI,CAAC;AAE3B,QAAM,SAAS,UAAM,0BAAa;AAAA,IAChC;AAAA,IACA,QAAQ;AAAA,MACN,MAAM,QAAQ;AAAA,MACd,MAAM,QAAQ,QAAQ;AAAA,IACxB;AAAA,IACA,SAAS;AAAA,UACP,kCAAc;AAAA,QACZ,YAAY,CAAC,SAAS;AAAA,MACxB,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AAGD,QAAM,QAAQ,IAAI;AAAA,IAChB,OAAO,OAAO;AAAA,QAEd,8CAAmB,OAAO;AAAA,EAE5B,CAAC;AAED,QAAM,QAAO,YAAO,eAAP,mBAAmB;AAChC,QAAM,UAAM,eAAAA,SAAQ;AAEpB,MAAI,QAAQ,cAAc;AAC1B,MAAI,IAAI,eAAAA,QAAQ,OAAO,MAAM,QAAQ,EAAE,QAAQ,KAAK,CAAC,CAAC;AACtD,MAAI,QAAI,cAAAC,SAAO,MAAM,CAAC;AAItB,MAAI,IAAI,SAAS,OAAO,KAAK,QAAQ;AACnC,UAAM,OAAO,MAAM,gBAAAC,QAAG,SAAS,MAAM,IAAI;AACzC,QAAI,OAAO,GAAG,EAAE,KAAK,IAAI;AAAA,EAC3B,CAAC;AAED,MAAI,IAAI,SAAK,0BAAAC,SAAM,GAAG,KAAK,WAAW,KAAK,MAAM,CAAC;AAGlD,QAAM,OAAO;AACb,MAAI,OAAO,IAAI;AAGf,UAAQ,IAAI,gBAAgB,aAAAC,QAAM,MAAM,oBAAoB,MAAM,CAAC;AACnE,SAAO,UAAU;AAEjB,YAAM,yBAAW,MAAM;AACzB;",
4
+ "sourcesContent": ["import { AddressInfo } from 'net'\nimport { join } from 'path'\n\nimport { nativePlugin, tamaguiPlugin } from '@tamagui/vite-plugin'\nimport chalk from 'chalk'\nimport express from 'express'\nimport proxy from 'express-http-proxy'\nimport fs from 'fs-extra'\nimport morgan from 'morgan'\nimport { build, createServer } from 'vite'\n\nimport { watchTamaguiConfig } from './tamaguiConfigUtils.js'\nimport { ResolvedOptions } from './types.js'\nimport { closeEvent } from './utils.js'\n\nexport const dev = async (options: ResolvedOptions) => {\n const { root, mode, paths } = options\n\n process.chdir(process.cwd())\n\n const plugins = [\n tamaguiPlugin({\n components: ['tamagui'],\n }),\n nativePlugin(),\n ]\n\n const buildOutput = await build({\n plugins,\n root,\n })\n const outputJsFile = 'output' in buildOutput ? buildOutput.output[0]?.fileName : null\n\n if (!outputJsFile) {\n throw new Error(`No js?`)\n }\n\n const outputJsPath = join(process.cwd(), 'dist', outputJsFile)\n\n const server = await createServer({\n root,\n server: {\n port: options.port,\n host: options.host || 'localhost',\n },\n plugins,\n })\n\n // these can be lazy loaded (eventually should put in own process)\n await Promise.all([\n server.listen(),\n //\n watchTamaguiConfig(options),\n // generateTypes(options),\n ])\n\n const info = server.httpServer?.address() as AddressInfo\n const app = express()\n\n app.disable('x-powered-by')\n app.use(express.static(paths.dotDir, { maxAge: '2h' }))\n app.use(morgan('tiny'))\n\n // studio specific - move out eventually to studioPlugin\n\n app.get('/conf', async (req, res) => {\n const conf = await fs.readJSON(paths.conf)\n res.status(200).json(conf)\n })\n\n // /index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=dish.motion:2811:36)\n app.get('/index.bundle', async (req, res) => {\n const output = (await fs.readFile(outputJsPath)).toString()\n res.status(200).send(output)\n })\n\n app.use('/', proxy(`${info.address}:${info.port}`))\n\n // react native port\n const port = 8081\n app.listen(port)\n\n // eslint-disable-next-line no-console\n console.log(`Listening on`, chalk.green(`http://localhost:${port}`))\n server.printUrls()\n\n process.on('beforeExit', () => {\n server.close()\n })\n\n await closeEvent(server)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAqB;AAErB,yBAA4C;AAC5C,mBAAkB;AAClB,qBAAoB;AACpB,gCAAkB;AAClB,sBAAe;AACf,oBAAmB;AACnB,kBAAoC;AAEpC,gCAAmC;AAEnC,mBAA2B;AAEpB,MAAM,MAAM,OAAO,YAA6B;AAfvD;AAgBE,QAAM,EAAE,MAAM,MAAM,MAAM,IAAI;AAE9B,UAAQ,MAAM,QAAQ,IAAI,CAAC;AAE3B,QAAM,UAAU;AAAA,QACd,kCAAc;AAAA,MACZ,YAAY,CAAC,SAAS;AAAA,IACxB,CAAC;AAAA,QACD,iCAAa;AAAA,EACf;AAEA,QAAM,cAAc,UAAM,mBAAM;AAAA,IAC9B;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,eAAe,YAAY,eAAc,iBAAY,OAAO,OAAnB,mBAAuB,WAAW;AAEjF,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI,MAAM,QAAQ;AAAA,EAC1B;AAEA,QAAM,mBAAe,kBAAK,QAAQ,IAAI,GAAG,QAAQ,YAAY;AAE7D,QAAM,SAAS,UAAM,0BAAa;AAAA,IAChC;AAAA,IACA,QAAQ;AAAA,MACN,MAAM,QAAQ;AAAA,MACd,MAAM,QAAQ,QAAQ;AAAA,IACxB;AAAA,IACA;AAAA,EACF,CAAC;AAGD,QAAM,QAAQ,IAAI;AAAA,IAChB,OAAO,OAAO;AAAA,QAEd,8CAAmB,OAAO;AAAA,EAE5B,CAAC;AAED,QAAM,QAAO,YAAO,eAAP,mBAAmB;AAChC,QAAM,UAAM,eAAAA,SAAQ;AAEpB,MAAI,QAAQ,cAAc;AAC1B,MAAI,IAAI,eAAAA,QAAQ,OAAO,MAAM,QAAQ,EAAE,QAAQ,KAAK,CAAC,CAAC;AACtD,MAAI,QAAI,cAAAC,SAAO,MAAM,CAAC;AAItB,MAAI,IAAI,SAAS,OAAO,KAAK,QAAQ;AACnC,UAAM,OAAO,MAAM,gBAAAC,QAAG,SAAS,MAAM,IAAI;AACzC,QAAI,OAAO,GAAG,EAAE,KAAK,IAAI;AAAA,EAC3B,CAAC;AAGD,MAAI,IAAI,iBAAiB,OAAO,KAAK,QAAQ;AAC3C,UAAM,UAAU,MAAM,gBAAAA,QAAG,SAAS,YAAY,GAAG,SAAS;AAC1D,QAAI,OAAO,GAAG,EAAE,KAAK,MAAM;AAAA,EAC7B,CAAC;AAED,MAAI,IAAI,SAAK,0BAAAC,SAAM,GAAG,KAAK,WAAW,KAAK,MAAM,CAAC;AAGlD,QAAM,OAAO;AACb,MAAI,OAAO,IAAI;AAGf,UAAQ,IAAI,gBAAgB,aAAAC,QAAM,MAAM,oBAAoB,MAAM,CAAC;AACnE,SAAO,UAAU;AAEjB,UAAQ,GAAG,cAAc,MAAM;AAC7B,WAAO,MAAM;AAAA,EACf,CAAC;AAED,YAAM,yBAAW,MAAM;AACzB;",
6
6
  "names": ["express", "morgan", "fs", "proxy", "chalk"]
7
7
  }
package/dist/esm/dev.js CHANGED
@@ -1,33 +1,45 @@
1
- import { tamaguiPlugin } from "@tamagui/vite-plugin";
1
+ import { join } from "path";
2
+ import { nativePlugin, tamaguiPlugin } from "@tamagui/vite-plugin";
2
3
  import chalk from "chalk";
3
4
  import express from "express";
4
5
  import proxy from "express-http-proxy";
5
6
  import fs from "fs-extra";
6
7
  import morgan from "morgan";
7
- import { createServer } from "vite";
8
+ import { build, createServer } from "vite";
8
9
  import { watchTamaguiConfig } from "./tamaguiConfigUtils.js";
9
10
  import { closeEvent } from "./utils.js";
10
11
  const dev = async (options) => {
11
- var _a;
12
+ var _a, _b;
12
13
  const { root, mode, paths } = options;
13
14
  process.chdir(process.cwd());
15
+ const plugins = [
16
+ tamaguiPlugin({
17
+ components: ["tamagui"]
18
+ }),
19
+ nativePlugin()
20
+ ];
21
+ const buildOutput = await build({
22
+ plugins,
23
+ root
24
+ });
25
+ const outputJsFile = "output" in buildOutput ? (_a = buildOutput.output[0]) == null ? void 0 : _a.fileName : null;
26
+ if (!outputJsFile) {
27
+ throw new Error(`No js?`);
28
+ }
29
+ const outputJsPath = join(process.cwd(), "dist", outputJsFile);
14
30
  const server = await createServer({
15
31
  root,
16
32
  server: {
17
33
  port: options.port,
18
34
  host: options.host || "localhost"
19
35
  },
20
- plugins: [
21
- tamaguiPlugin({
22
- components: ["tamagui"]
23
- })
24
- ]
36
+ plugins
25
37
  });
26
38
  await Promise.all([
27
39
  server.listen(),
28
40
  watchTamaguiConfig(options)
29
41
  ]);
30
- const info = (_a = server.httpServer) == null ? void 0 : _a.address();
42
+ const info = (_b = server.httpServer) == null ? void 0 : _b.address();
31
43
  const app = express();
32
44
  app.disable("x-powered-by");
33
45
  app.use(express.static(paths.dotDir, { maxAge: "2h" }));
@@ -36,11 +48,18 @@ const dev = async (options) => {
36
48
  const conf = await fs.readJSON(paths.conf);
37
49
  res.status(200).json(conf);
38
50
  });
51
+ app.get("/index.bundle", async (req, res) => {
52
+ const output = (await fs.readFile(outputJsPath)).toString();
53
+ res.status(200).send(output);
54
+ });
39
55
  app.use("/", proxy(`${info.address}:${info.port}`));
40
56
  const port = 8081;
41
57
  app.listen(port);
42
58
  console.log(`Listening on`, chalk.green(`http://localhost:${port}`));
43
59
  server.printUrls();
60
+ process.on("beforeExit", () => {
61
+ server.close();
62
+ });
44
63
  await closeEvent(server);
45
64
  };
46
65
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/dev.ts"],
4
- "sourcesContent": ["import { AddressInfo } from 'net'\nimport { join } from 'path'\n\nimport { tamaguiPlugin } from '@tamagui/vite-plugin'\nimport chalk from 'chalk'\nimport express from 'express'\nimport proxy from 'express-http-proxy'\nimport fs from 'fs-extra'\nimport morgan from 'morgan'\nimport { createServer } from 'vite'\n\nimport { watchTamaguiConfig } from './tamaguiConfigUtils.js'\nimport { ResolvedOptions } from './types.js'\nimport { closeEvent } from './utils.js'\n\nexport const dev = async (options: ResolvedOptions) => {\n const { root, mode, paths } = options\n\n process.chdir(process.cwd())\n\n const server = await createServer({\n root,\n server: {\n port: options.port,\n host: options.host || 'localhost',\n },\n plugins: [\n tamaguiPlugin({\n components: ['tamagui'],\n }),\n ],\n })\n\n // these can be lazy loaded (eventually should put in own process)\n await Promise.all([\n server.listen(),\n //\n watchTamaguiConfig(options),\n // generateTypes(options),\n ])\n\n const info = server.httpServer?.address() as AddressInfo\n const app = express()\n\n app.disable('x-powered-by')\n app.use(express.static(paths.dotDir, { maxAge: '2h' }))\n app.use(morgan('tiny'))\n\n // studio specific - move out eventually to studioPlugin\n\n app.get('/conf', async (req, res) => {\n const conf = await fs.readJSON(paths.conf)\n res.status(200).json(conf)\n })\n\n app.use('/', proxy(`${info.address}:${info.port}`))\n\n // react native port\n const port = 8081\n app.listen(port)\n\n // eslint-disable-next-line no-console\n console.log(`Listening on`, chalk.green(`http://localhost:${port}`))\n server.printUrls()\n\n await closeEvent(server)\n}\n"],
5
- "mappings": "AAGA,SAAS,qBAAqB;AAC9B,OAAO,WAAW;AAClB,OAAO,aAAa;AACpB,OAAO,WAAW;AAClB,OAAO,QAAQ;AACf,OAAO,YAAY;AACnB,SAAS,oBAAoB;AAE7B,SAAS,0BAA0B;AAEnC,SAAS,kBAAkB;AAEpB,MAAM,MAAM,OAAO,YAA6B;AAfvD;AAgBE,QAAM,EAAE,MAAM,MAAM,MAAM,IAAI;AAE9B,UAAQ,MAAM,QAAQ,IAAI,CAAC;AAE3B,QAAM,SAAS,MAAM,aAAa;AAAA,IAChC;AAAA,IACA,QAAQ;AAAA,MACN,MAAM,QAAQ;AAAA,MACd,MAAM,QAAQ,QAAQ;AAAA,IACxB;AAAA,IACA,SAAS;AAAA,MACP,cAAc;AAAA,QACZ,YAAY,CAAC,SAAS;AAAA,MACxB,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AAGD,QAAM,QAAQ,IAAI;AAAA,IAChB,OAAO,OAAO;AAAA,IAEd,mBAAmB,OAAO;AAAA,EAE5B,CAAC;AAED,QAAM,QAAO,YAAO,eAAP,mBAAmB;AAChC,QAAM,MAAM,QAAQ;AAEpB,MAAI,QAAQ,cAAc;AAC1B,MAAI,IAAI,QAAQ,OAAO,MAAM,QAAQ,EAAE,QAAQ,KAAK,CAAC,CAAC;AACtD,MAAI,IAAI,OAAO,MAAM,CAAC;AAItB,MAAI,IAAI,SAAS,OAAO,KAAK,QAAQ;AACnC,UAAM,OAAO,MAAM,GAAG,SAAS,MAAM,IAAI;AACzC,QAAI,OAAO,GAAG,EAAE,KAAK,IAAI;AAAA,EAC3B,CAAC;AAED,MAAI,IAAI,KAAK,MAAM,GAAG,KAAK,WAAW,KAAK,MAAM,CAAC;AAGlD,QAAM,OAAO;AACb,MAAI,OAAO,IAAI;AAGf,UAAQ,IAAI,gBAAgB,MAAM,MAAM,oBAAoB,MAAM,CAAC;AACnE,SAAO,UAAU;AAEjB,QAAM,WAAW,MAAM;AACzB;",
4
+ "sourcesContent": ["import { AddressInfo } from 'net'\nimport { join } from 'path'\n\nimport { nativePlugin, tamaguiPlugin } from '@tamagui/vite-plugin'\nimport chalk from 'chalk'\nimport express from 'express'\nimport proxy from 'express-http-proxy'\nimport fs from 'fs-extra'\nimport morgan from 'morgan'\nimport { build, createServer } from 'vite'\n\nimport { watchTamaguiConfig } from './tamaguiConfigUtils.js'\nimport { ResolvedOptions } from './types.js'\nimport { closeEvent } from './utils.js'\n\nexport const dev = async (options: ResolvedOptions) => {\n const { root, mode, paths } = options\n\n process.chdir(process.cwd())\n\n const plugins = [\n tamaguiPlugin({\n components: ['tamagui'],\n }),\n nativePlugin(),\n ]\n\n const buildOutput = await build({\n plugins,\n root,\n })\n const outputJsFile = 'output' in buildOutput ? buildOutput.output[0]?.fileName : null\n\n if (!outputJsFile) {\n throw new Error(`No js?`)\n }\n\n const outputJsPath = join(process.cwd(), 'dist', outputJsFile)\n\n const server = await createServer({\n root,\n server: {\n port: options.port,\n host: options.host || 'localhost',\n },\n plugins,\n })\n\n // these can be lazy loaded (eventually should put in own process)\n await Promise.all([\n server.listen(),\n //\n watchTamaguiConfig(options),\n // generateTypes(options),\n ])\n\n const info = server.httpServer?.address() as AddressInfo\n const app = express()\n\n app.disable('x-powered-by')\n app.use(express.static(paths.dotDir, { maxAge: '2h' }))\n app.use(morgan('tiny'))\n\n // studio specific - move out eventually to studioPlugin\n\n app.get('/conf', async (req, res) => {\n const conf = await fs.readJSON(paths.conf)\n res.status(200).json(conf)\n })\n\n // /index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=dish.motion:2811:36)\n app.get('/index.bundle', async (req, res) => {\n const output = (await fs.readFile(outputJsPath)).toString()\n res.status(200).send(output)\n })\n\n app.use('/', proxy(`${info.address}:${info.port}`))\n\n // react native port\n const port = 8081\n app.listen(port)\n\n // eslint-disable-next-line no-console\n console.log(`Listening on`, chalk.green(`http://localhost:${port}`))\n server.printUrls()\n\n process.on('beforeExit', () => {\n server.close()\n })\n\n await closeEvent(server)\n}\n"],
5
+ "mappings": "AACA,SAAS,YAAY;AAErB,SAAS,cAAc,qBAAqB;AAC5C,OAAO,WAAW;AAClB,OAAO,aAAa;AACpB,OAAO,WAAW;AAClB,OAAO,QAAQ;AACf,OAAO,YAAY;AACnB,SAAS,OAAO,oBAAoB;AAEpC,SAAS,0BAA0B;AAEnC,SAAS,kBAAkB;AAEpB,MAAM,MAAM,OAAO,YAA6B;AAfvD;AAgBE,QAAM,EAAE,MAAM,MAAM,MAAM,IAAI;AAE9B,UAAQ,MAAM,QAAQ,IAAI,CAAC;AAE3B,QAAM,UAAU;AAAA,IACd,cAAc;AAAA,MACZ,YAAY,CAAC,SAAS;AAAA,IACxB,CAAC;AAAA,IACD,aAAa;AAAA,EACf;AAEA,QAAM,cAAc,MAAM,MAAM;AAAA,IAC9B;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,eAAe,YAAY,eAAc,iBAAY,OAAO,OAAnB,mBAAuB,WAAW;AAEjF,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI,MAAM,QAAQ;AAAA,EAC1B;AAEA,QAAM,eAAe,KAAK,QAAQ,IAAI,GAAG,QAAQ,YAAY;AAE7D,QAAM,SAAS,MAAM,aAAa;AAAA,IAChC;AAAA,IACA,QAAQ;AAAA,MACN,MAAM,QAAQ;AAAA,MACd,MAAM,QAAQ,QAAQ;AAAA,IACxB;AAAA,IACA;AAAA,EACF,CAAC;AAGD,QAAM,QAAQ,IAAI;AAAA,IAChB,OAAO,OAAO;AAAA,IAEd,mBAAmB,OAAO;AAAA,EAE5B,CAAC;AAED,QAAM,QAAO,YAAO,eAAP,mBAAmB;AAChC,QAAM,MAAM,QAAQ;AAEpB,MAAI,QAAQ,cAAc;AAC1B,MAAI,IAAI,QAAQ,OAAO,MAAM,QAAQ,EAAE,QAAQ,KAAK,CAAC,CAAC;AACtD,MAAI,IAAI,OAAO,MAAM,CAAC;AAItB,MAAI,IAAI,SAAS,OAAO,KAAK,QAAQ;AACnC,UAAM,OAAO,MAAM,GAAG,SAAS,MAAM,IAAI;AACzC,QAAI,OAAO,GAAG,EAAE,KAAK,IAAI;AAAA,EAC3B,CAAC;AAGD,MAAI,IAAI,iBAAiB,OAAO,KAAK,QAAQ;AAC3C,UAAM,UAAU,MAAM,GAAG,SAAS,YAAY,GAAG,SAAS;AAC1D,QAAI,OAAO,GAAG,EAAE,KAAK,MAAM;AAAA,EAC7B,CAAC;AAED,MAAI,IAAI,KAAK,MAAM,GAAG,KAAK,WAAW,KAAK,MAAM,CAAC;AAGlD,QAAM,OAAO;AACb,MAAI,OAAO,IAAI;AAGf,UAAQ,IAAI,gBAAgB,MAAM,MAAM,oBAAoB,MAAM,CAAC;AACnE,SAAO,UAAU;AAEjB,UAAQ,GAAG,cAAc,MAAM;AAC7B,WAAO,MAAM;AAAA,EACf,CAAC;AAED,QAAM,WAAW,MAAM;AACzB;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/cli",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "module": "dist/esm",
@@ -31,9 +31,9 @@
31
31
  "clean:build": "tamagui-build clean:build"
32
32
  },
33
33
  "dependencies": {
34
- "@tamagui/build": "^1.0.17",
35
- "@tamagui/static": "^1.0.17",
36
- "@tamagui/vite-plugin": "^1.0.17",
34
+ "@tamagui/build": "^1.0.19",
35
+ "@tamagui/static": "^1.0.19",
36
+ "@tamagui/vite-plugin": "^1.0.19",
37
37
  "@types/compression": "^1.7.2",
38
38
  "@types/morgan": "^1.9.3",
39
39
  "arg": "^5.0.2",
@@ -57,6 +57,6 @@
57
57
  "zx": "^7.1.1"
58
58
  },
59
59
  "devDependencies": {
60
- "@takeout/studio": "^1.0.17"
60
+ "@takeout/studio": "^1.0.19"
61
61
  }
62
62
  }
package/src/dev.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { AddressInfo } from 'net'
2
2
  import { join } from 'path'
3
3
 
4
- import { tamaguiPlugin } from '@tamagui/vite-plugin'
4
+ import { nativePlugin, tamaguiPlugin } from '@tamagui/vite-plugin'
5
5
  import chalk from 'chalk'
6
6
  import express from 'express'
7
7
  import proxy from 'express-http-proxy'
8
8
  import fs from 'fs-extra'
9
9
  import morgan from 'morgan'
10
- import { createServer } from 'vite'
10
+ import { build, createServer } from 'vite'
11
11
 
12
12
  import { watchTamaguiConfig } from './tamaguiConfigUtils.js'
13
13
  import { ResolvedOptions } from './types.js'
@@ -18,17 +18,32 @@ export const dev = async (options: ResolvedOptions) => {
18
18
 
19
19
  process.chdir(process.cwd())
20
20
 
21
+ const plugins = [
22
+ tamaguiPlugin({
23
+ components: ['tamagui'],
24
+ }),
25
+ nativePlugin(),
26
+ ]
27
+
28
+ const buildOutput = await build({
29
+ plugins,
30
+ root,
31
+ })
32
+ const outputJsFile = 'output' in buildOutput ? buildOutput.output[0]?.fileName : null
33
+
34
+ if (!outputJsFile) {
35
+ throw new Error(`No js?`)
36
+ }
37
+
38
+ const outputJsPath = join(process.cwd(), 'dist', outputJsFile)
39
+
21
40
  const server = await createServer({
22
41
  root,
23
42
  server: {
24
43
  port: options.port,
25
44
  host: options.host || 'localhost',
26
45
  },
27
- plugins: [
28
- tamaguiPlugin({
29
- components: ['tamagui'],
30
- }),
31
- ],
46
+ plugins,
32
47
  })
33
48
 
34
49
  // these can be lazy loaded (eventually should put in own process)
@@ -53,6 +68,12 @@ export const dev = async (options: ResolvedOptions) => {
53
68
  res.status(200).json(conf)
54
69
  })
55
70
 
71
+ // /index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=dish.motion:2811:36)
72
+ app.get('/index.bundle', async (req, res) => {
73
+ const output = (await fs.readFile(outputJsPath)).toString()
74
+ res.status(200).send(output)
75
+ })
76
+
56
77
  app.use('/', proxy(`${info.address}:${info.port}`))
57
78
 
58
79
  // react native port
@@ -63,5 +84,9 @@ export const dev = async (options: ResolvedOptions) => {
63
84
  console.log(`Listening on`, chalk.green(`http://localhost:${port}`))
64
85
  server.printUrls()
65
86
 
87
+ process.on('beforeExit', () => {
88
+ server.close()
89
+ })
90
+
66
91
  await closeEvent(server)
67
92
  }