@tamagui/static 1.136.0 → 1.136.1-1762547287708
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/async-wrapper.js +94 -0
- package/dist/async-wrapper.js.map +6 -0
- package/dist/async-wrapper.mjs +113 -0
- package/dist/async-wrapper.mjs.map +1 -0
- package/dist/exports.js +17 -5
- package/dist/exports.js.map +2 -2
- package/dist/exports.mjs +23 -6
- package/dist/exports.mjs.map +1 -1
- package/dist/extractor/bundleConfig.js +1 -1
- package/dist/extractor/bundleConfig.js.map +1 -1
- package/dist/extractor/bundleConfig.mjs +4 -4
- package/dist/extractor/bundleConfig.mjs.map +1 -1
- package/dist/extractor/watchTamaguiConfig.js +3 -3
- package/dist/extractor/watchTamaguiConfig.js.map +1 -1
- package/dist/extractor/watchTamaguiConfig.mjs +4 -3
- package/dist/extractor/watchTamaguiConfig.mjs.map +1 -1
- package/dist/sync-wrapper.js +55 -0
- package/dist/sync-wrapper.js.map +6 -0
- package/dist/sync-wrapper.mjs +62 -0
- package/dist/sync-wrapper.mjs.map +1 -0
- package/dist/worker.js +65 -0
- package/dist/worker.js.map +6 -0
- package/dist/worker.mjs +84 -0
- package/dist/worker.mjs.map +1 -0
- package/package.json +18 -16
- package/src/async-wrapper.ts +149 -0
- package/src/exports.ts +30 -4
- package/src/extractor/bundleConfig.ts +4 -9
- package/src/extractor/watchTamaguiConfig.ts +3 -0
- package/src/sync-wrapper.ts +97 -0
- package/src/worker.ts +128 -0
- package/types/async-wrapper.d.ts +43 -0
- package/types/async-wrapper.d.ts.map +1 -0
- package/types/exports.d.ts +8 -4
- package/types/exports.d.ts.map +1 -1
- package/types/extractor/bundleConfig.d.ts +1 -1
- package/types/extractor/bundleConfig.d.ts.map +1 -1
- package/types/extractor/watchTamaguiConfig.d.ts.map +1 -1
- package/types/sync-wrapper.d.ts +23 -0
- package/types/sync-wrapper.d.ts.map +1 -0
- package/types/worker.d.ts +46 -0
- package/types/worker.d.ts.map +1 -0
|
@@ -0,0 +1,55 @@
|
|
|
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 sync_wrapper_exports = {};
|
|
16
|
+
__export(sync_wrapper_exports, {
|
|
17
|
+
extractToClassNamesSync: () => extractToClassNamesSync,
|
|
18
|
+
extractToNativeSync: () => extractToNativeSync
|
|
19
|
+
});
|
|
20
|
+
module.exports = __toCommonJS(sync_wrapper_exports);
|
|
21
|
+
var import_synckit = require("synckit"), import_node_path = require("node:path"), import_node_url = require("node:url");
|
|
22
|
+
const import_meta = {}, getWorkerPath = () => typeof __filename < "u" ? (0, import_node_path.resolve)(__dirname, "worker.js") : typeof import_meta < "u" && import_meta.url ? (0, import_node_path.resolve)((0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(import_meta.url)), "worker.js") : (0, import_node_path.resolve)(__dirname, "worker.js"), runTaskSync = (0, import_synckit.createSyncFn)(getWorkerPath());
|
|
23
|
+
function extractToClassNamesSync({
|
|
24
|
+
source,
|
|
25
|
+
sourcePath = "",
|
|
26
|
+
options,
|
|
27
|
+
shouldPrintDebug = !1
|
|
28
|
+
}) {
|
|
29
|
+
if (typeof source != "string")
|
|
30
|
+
throw new Error("`source` must be a string of javascript");
|
|
31
|
+
const result = runTaskSync({
|
|
32
|
+
type: "extractToClassNames",
|
|
33
|
+
source,
|
|
34
|
+
sourcePath,
|
|
35
|
+
options,
|
|
36
|
+
shouldPrintDebug
|
|
37
|
+
});
|
|
38
|
+
if (!result.success)
|
|
39
|
+
throw new Error(`Worker error: ${result.error}${result.stack ? `
|
|
40
|
+
${result.stack}` : ""}`);
|
|
41
|
+
return result.data;
|
|
42
|
+
}
|
|
43
|
+
function extractToNativeSync(sourceFileName, sourceCode, options) {
|
|
44
|
+
const result = runTaskSync({
|
|
45
|
+
type: "extractToNative",
|
|
46
|
+
sourceFileName,
|
|
47
|
+
sourceCode,
|
|
48
|
+
options
|
|
49
|
+
});
|
|
50
|
+
if (!result.success)
|
|
51
|
+
throw new Error(`Worker error: ${result.error}${result.stack ? `
|
|
52
|
+
${result.stack}` : ""}`);
|
|
53
|
+
return result.data;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=sync-wrapper.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/sync-wrapper.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,qBAA6B,oBAC7B,mBAAiC,sBACjC,kBAA8B;AAP9B,wBAcM,gBAAgB,MAEhB,OAAO,aAAe,UACjB,0BAAQ,WAAW,WAAW,IAGnC,OAAO,cAAgB,OAAe,YAAY,UAC7C,8BAAQ,8BAAQ,+BAAc,YAAY,GAAG,CAAC,GAAG,WAAW,QAG9D,0BAAQ,WAAW,WAAW,GAKjC,kBAAc,6BAA0D,cAAc,CAAC;AAMtF,SAAS,wBAAwB;AAAA,EACtC;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA,mBAAmB;AACrB,GAK6B;AAC3B,MAAI,OAAO,UAAW;AACpB,UAAM,IAAI,MAAM,yCAAyC;AAW3D,QAAM,SAAS,YARU;AAAA,IACvB,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAE+B;AAE/B,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,iBAAiB,OAAO,KAAK,GAAG,OAAO,QAAQ;AAAA,EAAK,OAAO,KAAK,KAAK,EAAE,EAAE;AAG3F,SAAO,OAAO;AAChB;AAMO,SAAS,oBACd,gBACA,YACA,SACiB;AAQjB,QAAM,SAAS,YAPU;AAAA,IACvB,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAE+B;AAE/B,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,iBAAiB,OAAO,KAAK,GAAG,OAAO,QAAQ;AAAA,EAAK,OAAO,KAAK,KAAK,EAAE,EAAE;AAG3F,SAAO,OAAO;AAChB;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
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) __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, {
|
|
13
|
+
get: () => from[key],
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), mod);
|
|
21
|
+
var sync_wrapper_exports = {};
|
|
22
|
+
__export(sync_wrapper_exports, {
|
|
23
|
+
extractToClassNamesSync: () => extractToClassNamesSync,
|
|
24
|
+
extractToNativeSync: () => extractToNativeSync
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(sync_wrapper_exports);
|
|
27
|
+
var import_synckit = require("synckit"),
|
|
28
|
+
import_node_path = require("node:path"),
|
|
29
|
+
import_node_url = require("node:url");
|
|
30
|
+
const import_meta = {},
|
|
31
|
+
getWorkerPath = () => typeof __filename < "u" ? (0, import_node_path.resolve)(__dirname, "worker.js") : typeof import_meta < "u" && import_meta.url ? (0, import_node_path.resolve)((0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(import_meta.url)), "worker.js") : (0, import_node_path.resolve)(__dirname, "worker.js"),
|
|
32
|
+
runTaskSync = (0, import_synckit.createSyncFn)(getWorkerPath());
|
|
33
|
+
function extractToClassNamesSync({
|
|
34
|
+
source,
|
|
35
|
+
sourcePath = "",
|
|
36
|
+
options,
|
|
37
|
+
shouldPrintDebug = !1
|
|
38
|
+
}) {
|
|
39
|
+
if (typeof source != "string") throw new Error("`source` must be a string of javascript");
|
|
40
|
+
const result = runTaskSync({
|
|
41
|
+
type: "extractToClassNames",
|
|
42
|
+
source,
|
|
43
|
+
sourcePath,
|
|
44
|
+
options,
|
|
45
|
+
shouldPrintDebug
|
|
46
|
+
});
|
|
47
|
+
if (!result.success) throw new Error(`Worker error: ${result.error}${result.stack ? `
|
|
48
|
+
${result.stack}` : ""}`);
|
|
49
|
+
return result.data;
|
|
50
|
+
}
|
|
51
|
+
function extractToNativeSync(sourceFileName, sourceCode, options) {
|
|
52
|
+
const result = runTaskSync({
|
|
53
|
+
type: "extractToNative",
|
|
54
|
+
sourceFileName,
|
|
55
|
+
sourceCode,
|
|
56
|
+
options
|
|
57
|
+
});
|
|
58
|
+
if (!result.success) throw new Error(`Worker error: ${result.error}${result.stack ? `
|
|
59
|
+
${result.stack}` : ""}`);
|
|
60
|
+
return result.data;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=sync-wrapper.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["sync_wrapper_exports","__export","extractToClassNamesSync","extractToNativeSync","module","exports","__toCommonJS","import_synckit","require","import_node_path","import_node_url","import_meta","getWorkerPath","__filename","resolve","__dirname","url","dirname","fileURLToPath","runTaskSync","createSyncFn","source","sourcePath","options","shouldPrintDebug","Error","result","type","success","error","stack","data","sourceFileName","sourceCode"],"sources":["../src/sync-wrapper.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,oBAAA;AAAAC,QAAA,CAAAD,oBAAA;EAAAE,uBAAA,EAAAA,CAAA,KAAAA,uBAAA;EAAAC,mBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAN,oBAAA;AAKA,IAAAO,cAAA,GAA6BC,OAAA;EAC7BC,gBAAA,GAAiCD,OAAA;EACjCE,eAAA,GAA8BF,OAAA;AAP9B,MAAAG,WAAA;EAcMC,aAAA,GAAgBA,CAAA,KAEhB,OAAOC,UAAA,GAAe,UACjBJ,gBAAA,CAAAK,OAAA,EAAQC,SAAA,EAAW,WAAW,IAGnC,OAAOJ,WAAA,GAAgB,OAAeA,WAAA,CAAYK,GAAA,OAC7CP,gBAAA,CAAAK,OAAA,MAAQL,gBAAA,CAAAQ,OAAA,MAAQP,eAAA,CAAAQ,aAAA,EAAcP,WAAA,CAAYK,GAAG,CAAC,GAAG,WAAW,QAG9DP,gBAAA,CAAAK,OAAA,EAAQC,SAAA,EAAW,WAAW;EAKjCI,WAAA,OAAcZ,cAAA,CAAAa,YAAA,EAA0DR,aAAA,CAAc,CAAC;AAMtF,SAASV,wBAAwB;EACtCmB,MAAA;EACAC,UAAA,GAAa;EACbC,OAAA;EACAC,gBAAA,GAAmB;AACrB,GAK6B;EAC3B,IAAI,OAAOH,MAAA,IAAW,UACpB,MAAM,IAAII,KAAA,CAAM,yCAAyC;EAW3D,MAAMC,MAAA,GAASP,WAAA,CARU;IACvBQ,IAAA,EAAM;IACNN,MAAA;IACAC,UAAA;IACAC,OAAA;IACAC;EACF,CAE+B;EAE/B,IAAI,CAACE,MAAA,CAAOE,OAAA,EACV,MAAM,IAAIH,KAAA,CAAM,iBAAiBC,MAAA,CAAOG,KAAK,GAAGH,MAAA,CAAOI,KAAA,GAAQ;AAAA,EAAKJ,MAAA,CAAOI,KAAK,KAAK,EAAE,EAAE;EAG3F,OAAOJ,MAAA,CAAOK,IAAA;AAChB;AAMO,SAAS5B,oBACd6B,cAAA,EACAC,UAAA,EACAV,OAAA,EACiB;EAQjB,MAAMG,MAAA,GAASP,WAAA,CAPU;IACvBQ,IAAA,EAAM;IACNK,cAAA;IACAC,UAAA;IACAV;EACF,CAE+B;EAE/B,IAAI,CAACG,MAAA,CAAOE,OAAA,EACV,MAAM,IAAIH,KAAA,CAAM,iBAAiBC,MAAA,CAAOG,KAAK,GAAGH,MAAA,CAAOI,KAAA,GAAQ;AAAA,EAAKJ,MAAA,CAAOI,KAAK,KAAK,EAAE,EAAE;EAG3F,OAAOJ,MAAA,CAAOK,IAAA;AAChB","ignoreList":[]}
|
package/dist/worker.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
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 worker_exports = {};
|
|
16
|
+
__export(worker_exports, {
|
|
17
|
+
default: () => worker_default,
|
|
18
|
+
runTask: () => runTask
|
|
19
|
+
});
|
|
20
|
+
module.exports = __toCommonJS(worker_exports);
|
|
21
|
+
var import_createExtractor = require("./extractor/createExtractor"), import_extractToClassNames = require("./extractor/extractToClassNames"), import_extractToNative = require("./extractor/extractToNative");
|
|
22
|
+
const webExtractor = (0, import_createExtractor.createExtractor)({ platform: "web" }), nativeExtractor = (0, import_createExtractor.createExtractor)({ platform: "native" }), configCache = /* @__PURE__ */ new Map();
|
|
23
|
+
async function runTask(task) {
|
|
24
|
+
try {
|
|
25
|
+
if (task.type === "extractToClassNames") {
|
|
26
|
+
if (!task.options.disableExtraction && !task.options._disableLoadTamagui) {
|
|
27
|
+
const cacheKey = JSON.stringify({
|
|
28
|
+
config: task.options.config,
|
|
29
|
+
components: task.options.components
|
|
30
|
+
});
|
|
31
|
+
configCache.has(cacheKey) || configCache.set(cacheKey, webExtractor.loadTamagui(task.options)), await configCache.get(cacheKey);
|
|
32
|
+
}
|
|
33
|
+
return { success: !0, data: await (0, import_extractToClassNames.extractToClassNames)({
|
|
34
|
+
extractor: webExtractor,
|
|
35
|
+
source: task.source,
|
|
36
|
+
sourcePath: task.sourcePath,
|
|
37
|
+
options: task.options,
|
|
38
|
+
shouldPrintDebug: task.shouldPrintDebug
|
|
39
|
+
}) };
|
|
40
|
+
}
|
|
41
|
+
if (task.type === "extractToNative") {
|
|
42
|
+
const cacheKey = JSON.stringify({
|
|
43
|
+
config: task.options.config,
|
|
44
|
+
components: task.options.components
|
|
45
|
+
});
|
|
46
|
+
return configCache.has(cacheKey) || configCache.set(cacheKey, nativeExtractor.loadTamagui(task.options)), await configCache.get(cacheKey), { success: !0, data: (0, import_extractToNative.extractToNative)(
|
|
47
|
+
task.sourceFileName,
|
|
48
|
+
task.sourceCode,
|
|
49
|
+
task.options
|
|
50
|
+
) };
|
|
51
|
+
}
|
|
52
|
+
return task.type === "clearCache" ? (configCache.clear(), { success: !0, data: null }) : {
|
|
53
|
+
success: !1,
|
|
54
|
+
error: `Unknown task type: ${task.type}`
|
|
55
|
+
};
|
|
56
|
+
} catch (error) {
|
|
57
|
+
return {
|
|
58
|
+
success: !1,
|
|
59
|
+
error: error instanceof Error ? error.message : String(error),
|
|
60
|
+
stack: error instanceof Error ? error.stack : void 0
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
var worker_default = runTask;
|
|
65
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/worker.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,6BAAgC,wCAKhC,6BAA+D,4CAC/D,yBAAuD;AAIvD,MAAM,mBAAe,wCAAgB,EAAE,UAAU,MAAM,CAAC,GAClD,sBAAkB,wCAAgB,EAAE,UAAU,SAAS,CAAC,GAGxD,cAAyC,oBAAI,IAAI;AAgCvD,eAAsB,QAAQ,MAAyC;AACrE,MAAI;AACF,QAAI,KAAK,SAAS,uBAAuB;AAEvC,UAAI,CAAC,KAAK,QAAQ,qBAAqB,CAAC,KAAK,QAAQ,qBAAwB;AAC3E,cAAM,WAAW,KAAK,UAAU;AAAA,UAC9B,QAAQ,KAAK,QAAQ;AAAA,UACrB,YAAY,KAAK,QAAQ;AAAA,QAC3B,CAAC;AAED,QAAK,YAAY,IAAI,QAAQ,KAC3B,YAAY,IAAI,UAAU,aAAa,YAAY,KAAK,OAAO,CAAC,GAGlE,MAAM,YAAY,IAAI,QAAQ;AAAA,MAChC;AAUA,aAAO,EAAE,SAAS,IAAM,MART,UAAM,2BAAAA,qBAAwB;AAAA,QAC3C,WAAW;AAAA,QACX,QAAQ,KAAK;AAAA,QACb,YAAY,KAAK;AAAA,QACjB,SAAS,KAAK;AAAA,QACd,kBAAkB,KAAK;AAAA,MACzB,CAAC,EAEoC;AAAA,IACvC;AAEA,QAAI,KAAK,SAAS,mBAAmB;AAEnC,YAAM,WAAW,KAAK,UAAU;AAAA,QAC9B,QAAQ,KAAK,QAAQ;AAAA,QACrB,YAAY,KAAK,QAAQ;AAAA,MAC3B,CAAC;AAED,aAAK,YAAY,IAAI,QAAQ,KAC3B,YAAY,IAAI,UAAU,gBAAgB,YAAY,KAAK,OAAO,CAAC,GAGrE,MAAM,YAAY,IAAI,QAAQ,GAUvB,EAAE,SAAS,IAAM,UANT,uBAAAC;AAAA,QACb,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,MACP,EAEqC;AAAA,IACvC;AAEA,WAAI,KAAK,SAAS,gBAEhB,YAAY,MAAM,GACX,EAAE,SAAS,IAAM,MAAM,KAAK,KAG9B;AAAA,MACL,SAAS;AAAA,MACT,OAAO,sBAAuB,KAAa,IAAI;AAAA,IACjD;AAAA,EACF,SAAS,OAAO;AACd,WAAO;AAAA,MACL,SAAS;AAAA,MACT,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAAA,MAC5D,OAAO,iBAAiB,QAAQ,MAAM,QAAQ;AAAA,IAChD;AAAA,EACF;AACF;AAMA,IAAO,iBAAQ;",
|
|
5
|
+
"names": ["extractToClassNamesImpl", "extractToNativeImpl"]
|
|
6
|
+
}
|
package/dist/worker.mjs
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
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) __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, {
|
|
13
|
+
get: () => from[key],
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), mod);
|
|
21
|
+
var worker_exports = {};
|
|
22
|
+
__export(worker_exports, {
|
|
23
|
+
default: () => worker_default,
|
|
24
|
+
runTask: () => runTask
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(worker_exports);
|
|
27
|
+
var import_createExtractor = require("./extractor/createExtractor.mjs"),
|
|
28
|
+
import_extractToClassNames = require("./extractor/extractToClassNames.mjs"),
|
|
29
|
+
import_extractToNative = require("./extractor/extractToNative.mjs");
|
|
30
|
+
const webExtractor = (0, import_createExtractor.createExtractor)({
|
|
31
|
+
platform: "web"
|
|
32
|
+
}),
|
|
33
|
+
nativeExtractor = (0, import_createExtractor.createExtractor)({
|
|
34
|
+
platform: "native"
|
|
35
|
+
}),
|
|
36
|
+
configCache = /* @__PURE__ */new Map();
|
|
37
|
+
async function runTask(task) {
|
|
38
|
+
try {
|
|
39
|
+
if (task.type === "extractToClassNames") {
|
|
40
|
+
if (!task.options.disableExtraction && !task.options._disableLoadTamagui) {
|
|
41
|
+
const cacheKey = JSON.stringify({
|
|
42
|
+
config: task.options.config,
|
|
43
|
+
components: task.options.components
|
|
44
|
+
});
|
|
45
|
+
configCache.has(cacheKey) || configCache.set(cacheKey, webExtractor.loadTamagui(task.options)), await configCache.get(cacheKey);
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
success: !0,
|
|
49
|
+
data: await (0, import_extractToClassNames.extractToClassNames)({
|
|
50
|
+
extractor: webExtractor,
|
|
51
|
+
source: task.source,
|
|
52
|
+
sourcePath: task.sourcePath,
|
|
53
|
+
options: task.options,
|
|
54
|
+
shouldPrintDebug: task.shouldPrintDebug
|
|
55
|
+
})
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (task.type === "extractToNative") {
|
|
59
|
+
const cacheKey = JSON.stringify({
|
|
60
|
+
config: task.options.config,
|
|
61
|
+
components: task.options.components
|
|
62
|
+
});
|
|
63
|
+
return configCache.has(cacheKey) || configCache.set(cacheKey, nativeExtractor.loadTamagui(task.options)), await configCache.get(cacheKey), {
|
|
64
|
+
success: !0,
|
|
65
|
+
data: (0, import_extractToNative.extractToNative)(task.sourceFileName, task.sourceCode, task.options)
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return task.type === "clearCache" ? (configCache.clear(), {
|
|
69
|
+
success: !0,
|
|
70
|
+
data: null
|
|
71
|
+
}) : {
|
|
72
|
+
success: !1,
|
|
73
|
+
error: `Unknown task type: ${task.type}`
|
|
74
|
+
};
|
|
75
|
+
} catch (error) {
|
|
76
|
+
return {
|
|
77
|
+
success: !1,
|
|
78
|
+
error: error instanceof Error ? error.message : String(error),
|
|
79
|
+
stack: error instanceof Error ? error.stack : void 0
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
var worker_default = runTask;
|
|
84
|
+
//# sourceMappingURL=worker.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["worker_exports","__export","default","worker_default","runTask","module","exports","__toCommonJS","import_createExtractor","require","import_extractToClassNames","import_extractToNative","webExtractor","createExtractor","platform","nativeExtractor","configCache","Map","task","type","options","disableExtraction","_disableLoadTamagui","cacheKey","JSON","stringify","config","components","has","set","loadTamagui","get","success","data","extractToClassNames","extractor","source","sourcePath","shouldPrintDebug","extractToNative","sourceFileName","sourceCode","clear","error","Error","message","String","stack"],"sources":["../src/worker.ts"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/static",
|
|
3
|
-
"version": "1.136.
|
|
3
|
+
"version": "1.136.1-1762547287708",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -43,19 +43,19 @@
|
|
|
43
43
|
"@babel/template": "^7.25.0",
|
|
44
44
|
"@babel/traverse": "^7.25.4",
|
|
45
45
|
"@babel/types": "^7.25.4",
|
|
46
|
-
"@tamagui/cli-color": "1.136.
|
|
47
|
-
"@tamagui/config-default": "1.136.
|
|
48
|
-
"@tamagui/core": "1.136.
|
|
49
|
-
"@tamagui/fake-react-native": "1.136.
|
|
50
|
-
"@tamagui/generate-themes": "1.136.
|
|
51
|
-
"@tamagui/helpers": "1.136.
|
|
52
|
-
"@tamagui/helpers-node": "1.136.
|
|
53
|
-
"@tamagui/proxy-worm": "1.136.
|
|
54
|
-
"@tamagui/react-native-web-internals": "1.136.
|
|
55
|
-
"@tamagui/react-native-web-lite": "1.136.
|
|
56
|
-
"@tamagui/shorthands": "1.136.
|
|
57
|
-
"@tamagui/types": "1.136.
|
|
58
|
-
"@tamagui/web": "1.136.
|
|
46
|
+
"@tamagui/cli-color": "1.136.1-1762547287708",
|
|
47
|
+
"@tamagui/config-default": "1.136.1-1762547287708",
|
|
48
|
+
"@tamagui/core": "1.136.1-1762547287708",
|
|
49
|
+
"@tamagui/fake-react-native": "1.136.1-1762547287708",
|
|
50
|
+
"@tamagui/generate-themes": "1.136.1-1762547287708",
|
|
51
|
+
"@tamagui/helpers": "1.136.1-1762547287708",
|
|
52
|
+
"@tamagui/helpers-node": "1.136.1-1762547287708",
|
|
53
|
+
"@tamagui/proxy-worm": "1.136.1-1762547287708",
|
|
54
|
+
"@tamagui/react-native-web-internals": "1.136.1-1762547287708",
|
|
55
|
+
"@tamagui/react-native-web-lite": "1.136.1-1762547287708",
|
|
56
|
+
"@tamagui/shorthands": "1.136.1-1762547287708",
|
|
57
|
+
"@tamagui/types": "1.136.1-1762547287708",
|
|
58
|
+
"@tamagui/web": "1.136.1-1762547287708",
|
|
59
59
|
"babel-literal-to-ast": "^2.1.0",
|
|
60
60
|
"browserslist": "^4.22.2",
|
|
61
61
|
"check-dependency-version-consistency": "^4.1.0",
|
|
@@ -67,12 +67,14 @@
|
|
|
67
67
|
"fs-extra": "^11.2.0",
|
|
68
68
|
"invariant": "^2.2.4",
|
|
69
69
|
"js-yaml": "^4.1.0",
|
|
70
|
-
"
|
|
70
|
+
"piscina": "^5.1.4",
|
|
71
|
+
"react-native-web": "^0.20.0",
|
|
72
|
+
"synckit": "^0.11.11"
|
|
71
73
|
},
|
|
72
74
|
"devDependencies": {
|
|
73
75
|
"@babel/plugin-syntax-typescript": "^7.25.4",
|
|
74
76
|
"@expo/match-media": "^0.4.0",
|
|
75
|
-
"@tamagui/build": "1.136.
|
|
77
|
+
"@tamagui/build": "1.136.1-1762547287708",
|
|
76
78
|
"@types/babel__core": "^7.20.5",
|
|
77
79
|
"@types/find-root": "^1.1.2",
|
|
78
80
|
"@types/node": "^22.1.0",
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Piscina-based async wrapper for bundlers (Webpack, Vite, Metro)
|
|
3
|
+
* Provides worker thread pooling for better performance
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import Piscina from 'piscina'
|
|
7
|
+
import { fileURLToPath } from 'node:url'
|
|
8
|
+
import { resolve, dirname } from 'node:path'
|
|
9
|
+
import type { BabelFileResult } from '@babel/core'
|
|
10
|
+
import type { ExtractedResponse } from './extractor/extractToClassNames'
|
|
11
|
+
import type { TamaguiOptions } from './types'
|
|
12
|
+
import type { WorkerTask, WorkerResult } from './worker'
|
|
13
|
+
|
|
14
|
+
// Resolve worker path - works for both CJS and ESM
|
|
15
|
+
const getWorkerPath = () => {
|
|
16
|
+
// In CJS, __filename is available
|
|
17
|
+
if (typeof __filename !== 'undefined') {
|
|
18
|
+
return resolve(__dirname, 'worker.js')
|
|
19
|
+
}
|
|
20
|
+
// In ESM, use import.meta.url
|
|
21
|
+
if (typeof import.meta !== 'undefined' && import.meta.url) {
|
|
22
|
+
return resolve(dirname(fileURLToPath(import.meta.url)), 'worker.js')
|
|
23
|
+
}
|
|
24
|
+
// Fallback
|
|
25
|
+
return resolve(__dirname, 'worker.js')
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let piscinaPool: Piscina | null = null
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get or create the Piscina worker pool
|
|
32
|
+
*/
|
|
33
|
+
function getPool(): Piscina {
|
|
34
|
+
if (!piscinaPool) {
|
|
35
|
+
piscinaPool = new Piscina({
|
|
36
|
+
filename: getWorkerPath(),
|
|
37
|
+
// Single worker for state consistency and simpler caching
|
|
38
|
+
minThreads: 1,
|
|
39
|
+
maxThreads: 1,
|
|
40
|
+
idleTimeout: 60000, // 60s - keep alive for config watching
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
return piscinaPool
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Extract Tamagui components to className-based CSS for web
|
|
48
|
+
* Used by Webpack, Vite, and Metro plugins
|
|
49
|
+
*/
|
|
50
|
+
export async function extractToClassNames({
|
|
51
|
+
source,
|
|
52
|
+
sourcePath = '',
|
|
53
|
+
options,
|
|
54
|
+
shouldPrintDebug = false,
|
|
55
|
+
}: {
|
|
56
|
+
source: string | Buffer
|
|
57
|
+
sourcePath?: string
|
|
58
|
+
options: TamaguiOptions
|
|
59
|
+
shouldPrintDebug?: boolean | 'verbose'
|
|
60
|
+
}): Promise<ExtractedResponse | null> {
|
|
61
|
+
if (typeof source !== 'string') {
|
|
62
|
+
throw new Error('`source` must be a string of javascript')
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const task: WorkerTask = {
|
|
66
|
+
type: 'extractToClassNames',
|
|
67
|
+
source,
|
|
68
|
+
sourcePath,
|
|
69
|
+
options,
|
|
70
|
+
shouldPrintDebug,
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const pool = getPool()
|
|
74
|
+
const result = (await pool.run(task, { name: 'runTask' })) as WorkerResult
|
|
75
|
+
|
|
76
|
+
if (!result.success) {
|
|
77
|
+
throw new Error(
|
|
78
|
+
`Worker error: ${result.error}${result.stack ? `\n${result.stack}` : ''}`
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return result.data as ExtractedResponse | null
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Extract Tamagui components to React Native StyleSheet format
|
|
87
|
+
* Used by native compilation (less common now)
|
|
88
|
+
*/
|
|
89
|
+
export async function extractToNative(
|
|
90
|
+
sourceFileName: string,
|
|
91
|
+
sourceCode: string,
|
|
92
|
+
options: TamaguiOptions
|
|
93
|
+
): Promise<BabelFileResult> {
|
|
94
|
+
const task: WorkerTask = {
|
|
95
|
+
type: 'extractToNative',
|
|
96
|
+
sourceFileName,
|
|
97
|
+
sourceCode,
|
|
98
|
+
options,
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const pool = getPool()
|
|
102
|
+
const result = (await pool.run(task, { name: 'runTask' })) as WorkerResult
|
|
103
|
+
|
|
104
|
+
if (!result.success) {
|
|
105
|
+
throw new Error(
|
|
106
|
+
`Worker error: ${result.error}${result.stack ? `\n${result.stack}` : ''}`
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return result.data as BabelFileResult
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Clear the worker's config cache
|
|
115
|
+
* Called when config files change (via watch)
|
|
116
|
+
*/
|
|
117
|
+
export async function clearWorkerCache(): Promise<void> {
|
|
118
|
+
if (!piscinaPool) return
|
|
119
|
+
|
|
120
|
+
const task: WorkerTask = { type: 'clearCache' }
|
|
121
|
+
await piscinaPool.run(task, { name: 'runTask' })
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Clean up the worker pool on exit
|
|
126
|
+
* Should be called when the build process completes
|
|
127
|
+
*/
|
|
128
|
+
export async function destroyPool(): Promise<void> {
|
|
129
|
+
if (piscinaPool) {
|
|
130
|
+
await piscinaPool.destroy()
|
|
131
|
+
piscinaPool = null
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Get pool statistics for debugging
|
|
137
|
+
*/
|
|
138
|
+
export function getPoolStats() {
|
|
139
|
+
if (!piscinaPool) {
|
|
140
|
+
return null
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
threads: piscinaPool.threads.length,
|
|
144
|
+
queueSize: piscinaPool.queueSize,
|
|
145
|
+
completed: piscinaPool.completed,
|
|
146
|
+
duration: piscinaPool.duration,
|
|
147
|
+
utilization: piscinaPool.utilization,
|
|
148
|
+
}
|
|
149
|
+
}
|
package/src/exports.ts
CHANGED
|
@@ -1,14 +1,40 @@
|
|
|
1
1
|
export * from './checkDeps'
|
|
2
2
|
export * from './types'
|
|
3
|
-
export { createExtractor } from './extractor/createExtractor'
|
|
4
3
|
export { literalToAst } from './extractor/literalToAst'
|
|
5
4
|
export * from './constants'
|
|
6
|
-
export * from './extractor/extractToClassNames'
|
|
7
5
|
export * from './extractor/concatClassName'
|
|
8
|
-
export * from './extractor/extractToNative'
|
|
9
6
|
export * from './extractor/extractHelpers'
|
|
10
|
-
export * from './extractor/loadTamagui'
|
|
11
7
|
export * from './extractor/watchTamaguiConfig'
|
|
12
8
|
export * from './extractor/createLogger'
|
|
13
9
|
export * from './registerRequire'
|
|
14
10
|
export * from './getPragmaOptions'
|
|
11
|
+
|
|
12
|
+
// PRIMARY API: Worker-based extraction (Webpack, Vite, Metro)
|
|
13
|
+
// Config loading happens automatically in worker thread
|
|
14
|
+
export {
|
|
15
|
+
extractToClassNames,
|
|
16
|
+
extractToNative,
|
|
17
|
+
clearWorkerCache,
|
|
18
|
+
destroyPool,
|
|
19
|
+
getPoolStats,
|
|
20
|
+
} from './async-wrapper'
|
|
21
|
+
|
|
22
|
+
// BABEL PLUGIN: Uses visitor pattern with in-process extraction
|
|
23
|
+
// Visitor processes AST incrementally so can't offload per-element to worker
|
|
24
|
+
// Uses esbuild-register in-process (acceptable tradeoff - babel/native less common)
|
|
25
|
+
export { getBabelPlugin } from './extractor/extractToNative'
|
|
26
|
+
|
|
27
|
+
// UTILITIES: For CLI and advanced usage
|
|
28
|
+
export {
|
|
29
|
+
generateThemesAndLog,
|
|
30
|
+
esbuildWatchFiles,
|
|
31
|
+
getOptions,
|
|
32
|
+
loadTamaguiBuildConfigSync,
|
|
33
|
+
} from './extractor/loadTamagui'
|
|
34
|
+
export type { TamaguiProjectInfo } from './extractor/loadTamagui'
|
|
35
|
+
|
|
36
|
+
// INTERNAL: For tests and backwards compatibility
|
|
37
|
+
export { createExtractor } from './extractor/createExtractor'
|
|
38
|
+
export { extractToClassNames as extractToClassNamesLegacy } from './extractor/extractToClassNames'
|
|
39
|
+
export { extractToNative as extractToNativeLegacy } from './extractor/extractToNative'
|
|
40
|
+
export { loadTamagui, loadTamaguiSync } from './extractor/loadTamagui'
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import generate from '@babel/generator'
|
|
2
2
|
import traverse from '@babel/traverse'
|
|
3
3
|
import * as t from '@babel/types'
|
|
4
|
-
import { existsSync, readFileSync } from 'node:fs'
|
|
5
|
-
import { basename, dirname, extname, join, relative, sep } from 'node:path'
|
|
6
|
-
// @ts-ignore why
|
|
7
4
|
import { Color, colorLog } from '@tamagui/cli-color'
|
|
8
|
-
import {
|
|
9
|
-
createTamagui,
|
|
10
|
-
type StaticConfig,
|
|
11
|
-
type TamaguiInternalConfig,
|
|
12
|
-
} from '@tamagui/web'
|
|
5
|
+
import type { StaticConfig, TamaguiInternalConfig } from '@tamagui/web'
|
|
13
6
|
import esbuild from 'esbuild'
|
|
14
7
|
import * as FS from 'fs-extra'
|
|
8
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
15
9
|
import { readFile } from 'node:fs/promises'
|
|
10
|
+
import { basename, dirname, extname, join, relative, sep } from 'node:path'
|
|
11
|
+
import { requireTamaguiCore } from '../helpers/requireTamaguiCore'
|
|
16
12
|
import { registerRequire, setRequireResult } from '../registerRequire'
|
|
17
13
|
import type { TamaguiOptions } from '../types'
|
|
18
14
|
import { babelParse } from './babelParse'
|
|
19
15
|
import { esbuildLoaderConfig, esbundleTamaguiConfig } from './bundle'
|
|
20
16
|
import { getTamaguiConfigPathFromOptionsConfig } from './getTamaguiConfigPathFromOptionsConfig'
|
|
21
|
-
import { requireTamaguiCore } from '../helpers/requireTamaguiCore'
|
|
22
17
|
|
|
23
18
|
type NameToPaths = {
|
|
24
19
|
[key: string]: Set<string>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TamaguiOptions } from '@tamagui/types'
|
|
2
|
+
import { clearWorkerCache } from '../async-wrapper'
|
|
2
3
|
import { esbuildWatchFiles, generateThemesAndLog, getOptions } from './loadTamagui'
|
|
3
4
|
import { regenerateConfig } from './regenerateConfig'
|
|
4
5
|
|
|
@@ -27,6 +28,7 @@ export async function watchTamaguiConfig(tamaguiOptions: TamaguiOptions) {
|
|
|
27
28
|
const disposeConfigWatcher = await esbuildWatchFiles(
|
|
28
29
|
options.tamaguiOptions.config,
|
|
29
30
|
async () => {
|
|
31
|
+
await clearWorkerCache() // Clear worker cache first
|
|
30
32
|
await generateThemesAndLog(options.tamaguiOptions)
|
|
31
33
|
await regenerateConfig(options.tamaguiOptions, null, true)
|
|
32
34
|
}
|
|
@@ -43,6 +45,7 @@ export async function watchTamaguiConfig(tamaguiOptions: TamaguiOptions) {
|
|
|
43
45
|
// ok
|
|
44
46
|
}
|
|
45
47
|
disposeThemesWatcher = await esbuildWatchFiles(inputPath, async () => {
|
|
48
|
+
await clearWorkerCache() // Clear worker cache first
|
|
46
49
|
await generateThemesAndLog(options.tamaguiOptions)
|
|
47
50
|
})
|
|
48
51
|
}
|