@tamagui/cli 1.0.1-rc.8 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/build.js +4 -7
- package/dist/cjs/build.js.map +2 -2
- package/dist/esm/build.js +4 -7
- package/dist/esm/build.js.map +2 -2
- package/package.json +6 -6
- package/src/build.ts +7 -10
package/dist/cjs/build.js
CHANGED
|
@@ -27,6 +27,7 @@ __export(build_exports, {
|
|
|
27
27
|
build: () => build
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(build_exports);
|
|
30
|
+
var import_fs = require("fs");
|
|
30
31
|
var import_path = require("path");
|
|
31
32
|
var import_static = require("@tamagui/static");
|
|
32
33
|
var import_chokidar = __toESM(require("chokidar"));
|
|
@@ -34,18 +35,15 @@ var import_fs_extra = require("fs-extra");
|
|
|
34
35
|
const build = async (options) => {
|
|
35
36
|
const entry = options.pkgJson.source;
|
|
36
37
|
if (!entry) {
|
|
37
|
-
throw new Error(
|
|
38
|
-
`Must add "source" to package.json pointing to your source directory`
|
|
39
|
-
);
|
|
38
|
+
throw new Error(`Must add "source" to package.json pointing to your source directory`);
|
|
40
39
|
}
|
|
41
40
|
const sourceDir = (0, import_path.dirname)(entry);
|
|
42
41
|
const promises = [];
|
|
43
42
|
const targets = ["web"];
|
|
43
|
+
console.log("sourceDir", sourceDir, targets);
|
|
44
44
|
await new Promise((res) => {
|
|
45
45
|
import_chokidar.default.watch(sourceDir, {}).on("add", (relativePath) => {
|
|
46
46
|
const sourcePath = (0, import_path.resolve)(process.cwd(), relativePath);
|
|
47
|
-
if (!sourcePath.endsWith("Layouts.tsx"))
|
|
48
|
-
return;
|
|
49
47
|
promises.push(
|
|
50
48
|
(async () => {
|
|
51
49
|
await Promise.all(
|
|
@@ -55,7 +53,6 @@ const build = async (options) => {
|
|
|
55
53
|
if (options.debug) {
|
|
56
54
|
(_a = process.env).NODE_ENV || (_a.NODE_ENV = "development");
|
|
57
55
|
}
|
|
58
|
-
console.log("go", sourcePath);
|
|
59
56
|
const source = await (0, import_fs_extra.readFile)(sourcePath, "utf-8");
|
|
60
57
|
const extractor = (0, import_static.createExtractor)();
|
|
61
58
|
const out = await (0, import_static.extractToClassNames)({
|
|
@@ -65,7 +62,7 @@ const build = async (options) => {
|
|
|
65
62
|
options: options.tamaguiOptions,
|
|
66
63
|
shouldPrintDebug: options.debug || false
|
|
67
64
|
});
|
|
68
|
-
|
|
65
|
+
await (0, import_fs.writeFile)();
|
|
69
66
|
})
|
|
70
67
|
);
|
|
71
68
|
})()
|
package/dist/cjs/build.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/build.ts"],
|
|
4
|
-
"sourcesContent": ["import { basename, dirname, join, resolve } from 'path'\n\nimport { createExtractor, extractToClassNames, loadTamagui } from '@tamagui/static'\nimport chokidar from 'chokidar'\nimport { readFile } from 'fs-extra'\n\nimport { ResolvedOptions } from './types.js'\n\nexport const build = async (options: ResolvedOptions) => {\n // const tamagui = await loadTamagui(options.tamaguiOptions)\n\n const entry = options.pkgJson.source\n if (!entry) {\n throw new Error(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiD;AAEjD,oBAAkE;AAClE,sBAAqB;AACrB,sBAAyB;AAIlB,MAAM,QAAQ,OAAO,YAA6B;AAGvD,QAAM,QAAQ,QAAQ,QAAQ;AAC9B,MAAI,CAAC,OAAO;AACV,UAAM,IAAI
|
|
4
|
+
"sourcesContent": ["import { writeFile } from 'fs'\nimport { basename, dirname, join, resolve } from 'path'\n\nimport { createExtractor, extractToClassNames, loadTamagui } from '@tamagui/static'\nimport chokidar from 'chokidar'\nimport { readFile } from 'fs-extra'\n\nimport { ResolvedOptions } from './types.js'\n\nexport const build = async (options: ResolvedOptions) => {\n // const tamagui = await loadTamagui(options.tamaguiOptions)\n\n const entry = options.pkgJson.source\n if (!entry) {\n throw new Error(`Must add \"source\" to package.json pointing to your source directory`)\n }\n const sourceDir = dirname(entry)\n const promises: Promise<void>[] = []\n const targets = ['web']\n\n console.log('sourceDir', sourceDir, targets)\n\n await new Promise<void>((res) => {\n chokidar\n // prevent infinite loop but cause race condition if you just build directly\n .watch(sourceDir, {\n // persistent: true,\n })\n .on('add', (relativePath) => {\n const sourcePath = resolve(process.cwd(), relativePath)\n\n promises.push(\n (async () => {\n await Promise.all(\n targets.map(async (target) => {\n process.env.TAMAGUI_TARGET = target\n if (options.debug) {\n process.env.NODE_ENV ||= 'development'\n }\n const source = await readFile(sourcePath, 'utf-8')\n const extractor = createExtractor()\n const out = await extractToClassNames({\n extractor,\n source,\n sourcePath,\n options: options.tamaguiOptions,\n shouldPrintDebug: options.debug || false,\n })\n\n await writeFile()\n })\n )\n })()\n )\n })\n .on('ready', () => {\n res()\n })\n })\n\n await Promise.all(promises)\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA0B;AAC1B,kBAAiD;AAEjD,oBAAkE;AAClE,sBAAqB;AACrB,sBAAyB;AAIlB,MAAM,QAAQ,OAAO,YAA6B;AAGvD,QAAM,QAAQ,QAAQ,QAAQ;AAC9B,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,qEAAqE;AAAA,EACvF;AACA,QAAM,gBAAY,qBAAQ,KAAK;AAC/B,QAAM,WAA4B,CAAC;AACnC,QAAM,UAAU,CAAC,KAAK;AAEtB,UAAQ,IAAI,aAAa,WAAW,OAAO;AAE3C,QAAM,IAAI,QAAc,CAAC,QAAQ;AAC/B,oBAAAA,QAEG,MAAM,WAAW,CAElB,CAAC,EACA,GAAG,OAAO,CAAC,iBAAiB;AAC3B,YAAM,iBAAa,qBAAQ,QAAQ,IAAI,GAAG,YAAY;AAEtD,eAAS;AAAA,SACN,YAAY;AACX,gBAAM,QAAQ;AAAA,YACZ,QAAQ,IAAI,OAAO,WAAW;AAlC5C;AAmCgB,sBAAQ,IAAI,iBAAiB;AAC7B,kBAAI,QAAQ,OAAO;AACjB,8BAAQ,KAAI,aAAZ,GAAY,WAAa;AAAA,cAC3B;AACA,oBAAM,SAAS,UAAM,0BAAS,YAAY,OAAO;AACjD,oBAAM,gBAAY,+BAAgB;AAClC,oBAAM,MAAM,UAAM,mCAAoB;AAAA,gBACpC;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA,SAAS,QAAQ;AAAA,gBACjB,kBAAkB,QAAQ,SAAS;AAAA,cACrC,CAAC;AAED,wBAAM,qBAAU;AAAA,YAClB,CAAC;AAAA,UACH;AAAA,QACF,GAAG;AAAA,MACL;AAAA,IACF,CAAC,EACA,GAAG,SAAS,MAAM;AACjB,UAAI;AAAA,IACN,CAAC;AAAA,EACL,CAAC;AAED,QAAM,QAAQ,IAAI,QAAQ;AAC5B;",
|
|
6
6
|
"names": ["chokidar"]
|
|
7
7
|
}
|
package/dist/esm/build.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { writeFile } from "fs";
|
|
1
2
|
import { dirname, resolve } from "path";
|
|
2
3
|
import { createExtractor, extractToClassNames } from "@tamagui/static";
|
|
3
4
|
import chokidar from "chokidar";
|
|
@@ -5,18 +6,15 @@ import { readFile } from "fs-extra";
|
|
|
5
6
|
const build = async (options) => {
|
|
6
7
|
const entry = options.pkgJson.source;
|
|
7
8
|
if (!entry) {
|
|
8
|
-
throw new Error(
|
|
9
|
-
`Must add "source" to package.json pointing to your source directory`
|
|
10
|
-
);
|
|
9
|
+
throw new Error(`Must add "source" to package.json pointing to your source directory`);
|
|
11
10
|
}
|
|
12
11
|
const sourceDir = dirname(entry);
|
|
13
12
|
const promises = [];
|
|
14
13
|
const targets = ["web"];
|
|
14
|
+
console.log("sourceDir", sourceDir, targets);
|
|
15
15
|
await new Promise((res) => {
|
|
16
16
|
chokidar.watch(sourceDir, {}).on("add", (relativePath) => {
|
|
17
17
|
const sourcePath = resolve(process.cwd(), relativePath);
|
|
18
|
-
if (!sourcePath.endsWith("Layouts.tsx"))
|
|
19
|
-
return;
|
|
20
18
|
promises.push(
|
|
21
19
|
(async () => {
|
|
22
20
|
await Promise.all(
|
|
@@ -25,7 +23,6 @@ const build = async (options) => {
|
|
|
25
23
|
if (options.debug) {
|
|
26
24
|
process.env.NODE_ENV ||= "development";
|
|
27
25
|
}
|
|
28
|
-
console.log("go", sourcePath);
|
|
29
26
|
const source = await readFile(sourcePath, "utf-8");
|
|
30
27
|
const extractor = createExtractor();
|
|
31
28
|
const out = await extractToClassNames({
|
|
@@ -35,7 +32,7 @@ const build = async (options) => {
|
|
|
35
32
|
options: options.tamaguiOptions,
|
|
36
33
|
shouldPrintDebug: options.debug || false
|
|
37
34
|
});
|
|
38
|
-
|
|
35
|
+
await writeFile();
|
|
39
36
|
})
|
|
40
37
|
);
|
|
41
38
|
})()
|
package/dist/esm/build.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/build.ts"],
|
|
4
|
-
"sourcesContent": ["import { basename, dirname, join, resolve } from 'path'\n\nimport { createExtractor, extractToClassNames, loadTamagui } from '@tamagui/static'\nimport chokidar from 'chokidar'\nimport { readFile } from 'fs-extra'\n\nimport { ResolvedOptions } from './types.js'\n\nexport const build = async (options: ResolvedOptions) => {\n // const tamagui = await loadTamagui(options.tamaguiOptions)\n\n const entry = options.pkgJson.source\n if (!entry) {\n throw new Error(
|
|
5
|
-
"mappings": "AAAA,SAAmB,SAAe,eAAe;AAEjD,SAAS,iBAAiB,2BAAwC;AAClE,OAAO,cAAc;AACrB,SAAS,gBAAgB;AAIlB,MAAM,QAAQ,OAAO,YAA6B;AAGvD,QAAM,QAAQ,QAAQ,QAAQ;AAC9B,MAAI,CAAC,OAAO;AACV,UAAM,IAAI
|
|
4
|
+
"sourcesContent": ["import { writeFile } from 'fs'\nimport { basename, dirname, join, resolve } from 'path'\n\nimport { createExtractor, extractToClassNames, loadTamagui } from '@tamagui/static'\nimport chokidar from 'chokidar'\nimport { readFile } from 'fs-extra'\n\nimport { ResolvedOptions } from './types.js'\n\nexport const build = async (options: ResolvedOptions) => {\n // const tamagui = await loadTamagui(options.tamaguiOptions)\n\n const entry = options.pkgJson.source\n if (!entry) {\n throw new Error(`Must add \"source\" to package.json pointing to your source directory`)\n }\n const sourceDir = dirname(entry)\n const promises: Promise<void>[] = []\n const targets = ['web']\n\n console.log('sourceDir', sourceDir, targets)\n\n await new Promise<void>((res) => {\n chokidar\n // prevent infinite loop but cause race condition if you just build directly\n .watch(sourceDir, {\n // persistent: true,\n })\n .on('add', (relativePath) => {\n const sourcePath = resolve(process.cwd(), relativePath)\n\n promises.push(\n (async () => {\n await Promise.all(\n targets.map(async (target) => {\n process.env.TAMAGUI_TARGET = target\n if (options.debug) {\n process.env.NODE_ENV ||= 'development'\n }\n const source = await readFile(sourcePath, 'utf-8')\n const extractor = createExtractor()\n const out = await extractToClassNames({\n extractor,\n source,\n sourcePath,\n options: options.tamaguiOptions,\n shouldPrintDebug: options.debug || false,\n })\n\n await writeFile()\n })\n )\n })()\n )\n })\n .on('ready', () => {\n res()\n })\n })\n\n await Promise.all(promises)\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAmB,SAAe,eAAe;AAEjD,SAAS,iBAAiB,2BAAwC;AAClE,OAAO,cAAc;AACrB,SAAS,gBAAgB;AAIlB,MAAM,QAAQ,OAAO,YAA6B;AAGvD,QAAM,QAAQ,QAAQ,QAAQ;AAC9B,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,qEAAqE;AAAA,EACvF;AACA,QAAM,YAAY,QAAQ,KAAK;AAC/B,QAAM,WAA4B,CAAC;AACnC,QAAM,UAAU,CAAC,KAAK;AAEtB,UAAQ,IAAI,aAAa,WAAW,OAAO;AAE3C,QAAM,IAAI,QAAc,CAAC,QAAQ;AAC/B,aAEG,MAAM,WAAW,CAElB,CAAC,EACA,GAAG,OAAO,CAAC,iBAAiB;AAC3B,YAAM,aAAa,QAAQ,QAAQ,IAAI,GAAG,YAAY;AAEtD,eAAS;AAAA,SACN,YAAY;AACX,gBAAM,QAAQ;AAAA,YACZ,QAAQ,IAAI,OAAO,WAAW;AAC5B,sBAAQ,IAAI,iBAAiB;AAC7B,kBAAI,QAAQ,OAAO;AACjB,wBAAQ,IAAI,aAAa;AAAA,cAC3B;AACA,oBAAM,SAAS,MAAM,SAAS,YAAY,OAAO;AACjD,oBAAM,YAAY,gBAAgB;AAClC,oBAAM,MAAM,MAAM,oBAAoB;AAAA,gBACpC;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA,SAAS,QAAQ;AAAA,gBACjB,kBAAkB,QAAQ,SAAS;AAAA,cACrC,CAAC;AAED,oBAAM,UAAU;AAAA,YAClB,CAAC;AAAA,UACH;AAAA,QACF,GAAG;AAAA,MACL;AAAA,IACF,CAAC,EACA,GAAG,SAAS,MAAM;AACjB,UAAI;AAAA,IACN,CAAC;AAAA,EACL,CAAC;AAED,QAAM,QAAQ,IAAI,QAAQ;AAC5B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/cli",
|
|
3
|
-
"version": "1.0.1
|
|
3
|
+
"version": "1.0.1",
|
|
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.1
|
|
35
|
-
"@tamagui/static": "^1.0.1
|
|
36
|
-
"@tamagui/vite-plugin": "^1.0.1
|
|
34
|
+
"@tamagui/build": "^1.0.1",
|
|
35
|
+
"@tamagui/static": "^1.0.1",
|
|
36
|
+
"@tamagui/vite-plugin": "^1.0.1",
|
|
37
37
|
"@types/compression": "^1.7.2",
|
|
38
38
|
"@types/morgan": "^1.9.3",
|
|
39
39
|
"arg": "^5.0.2",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"ts-morph": "^15.1.0",
|
|
54
54
|
"typescript": "^4.7.4",
|
|
55
55
|
"url": "^0.11.0",
|
|
56
|
-
"vite": "^4.0.
|
|
56
|
+
"vite": "^4.0.3",
|
|
57
57
|
"zx": "^7.1.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@takeout/studio": "^1.0.1
|
|
60
|
+
"@takeout/studio": "^1.0.1"
|
|
61
61
|
}
|
|
62
62
|
}
|
package/src/build.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { writeFile } from 'fs'
|
|
1
2
|
import { basename, dirname, join, resolve } from 'path'
|
|
2
3
|
|
|
3
4
|
import { createExtractor, extractToClassNames, loadTamagui } from '@tamagui/static'
|
|
@@ -11,14 +12,14 @@ export const build = async (options: ResolvedOptions) => {
|
|
|
11
12
|
|
|
12
13
|
const entry = options.pkgJson.source
|
|
13
14
|
if (!entry) {
|
|
14
|
-
throw new Error(
|
|
15
|
-
`Must add "source" to package.json pointing to your source directory`,
|
|
16
|
-
)
|
|
15
|
+
throw new Error(`Must add "source" to package.json pointing to your source directory`)
|
|
17
16
|
}
|
|
18
17
|
const sourceDir = dirname(entry)
|
|
19
18
|
const promises: Promise<void>[] = []
|
|
20
19
|
const targets = ['web']
|
|
21
20
|
|
|
21
|
+
console.log('sourceDir', sourceDir, targets)
|
|
22
|
+
|
|
22
23
|
await new Promise<void>((res) => {
|
|
23
24
|
chokidar
|
|
24
25
|
// prevent infinite loop but cause race condition if you just build directly
|
|
@@ -28,9 +29,6 @@ export const build = async (options: ResolvedOptions) => {
|
|
|
28
29
|
.on('add', (relativePath) => {
|
|
29
30
|
const sourcePath = resolve(process.cwd(), relativePath)
|
|
30
31
|
|
|
31
|
-
// testing..
|
|
32
|
-
if (!sourcePath.endsWith('Layouts.tsx')) return
|
|
33
|
-
|
|
34
32
|
promises.push(
|
|
35
33
|
(async () => {
|
|
36
34
|
await Promise.all(
|
|
@@ -39,7 +37,6 @@ export const build = async (options: ResolvedOptions) => {
|
|
|
39
37
|
if (options.debug) {
|
|
40
38
|
process.env.NODE_ENV ||= 'development'
|
|
41
39
|
}
|
|
42
|
-
console.log('go', sourcePath)
|
|
43
40
|
const source = await readFile(sourcePath, 'utf-8')
|
|
44
41
|
const extractor = createExtractor()
|
|
45
42
|
const out = await extractToClassNames({
|
|
@@ -50,10 +47,10 @@ export const build = async (options: ResolvedOptions) => {
|
|
|
50
47
|
shouldPrintDebug: options.debug || false,
|
|
51
48
|
})
|
|
52
49
|
|
|
53
|
-
|
|
54
|
-
})
|
|
50
|
+
await writeFile()
|
|
51
|
+
})
|
|
55
52
|
)
|
|
56
|
-
})()
|
|
53
|
+
})()
|
|
57
54
|
)
|
|
58
55
|
})
|
|
59
56
|
.on('ready', () => {
|