@tamagui/static-worker 1.136.4 → 1.136.7
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/index.cjs +181 -0
- package/dist/cjs/index.js +155 -0
- package/dist/cjs/index.js.map +6 -0
- package/dist/esm/index.js +132 -0
- package/dist/esm/index.js.map +6 -0
- package/dist/esm/index.mjs +138 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/index.js +26 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -8
- package/src/index.ts +36 -14
- package/types/index.d.ts.map +1 -1
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
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);
|
|
32
|
+
var index_exports = {};
|
|
33
|
+
__export(index_exports, {
|
|
34
|
+
clearWorkerCache: () => clearWorkerCache,
|
|
35
|
+
destroyPool: () => destroyPool,
|
|
36
|
+
extractToClassNames: () => extractToClassNames,
|
|
37
|
+
extractToNative: () => extractToNative,
|
|
38
|
+
getPoolStats: () => getPoolStats,
|
|
39
|
+
getPragmaOptions: () => getPragmaOptions,
|
|
40
|
+
loadTamagui: () => loadTamagui,
|
|
41
|
+
loadTamaguiBuildConfig: () => loadTamaguiBuildConfig,
|
|
42
|
+
watchTamaguiConfig: () => watchTamaguiConfig
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(index_exports);
|
|
45
|
+
var import_node_url = require("node:url"),
|
|
46
|
+
import_piscina = __toESM(require("piscina"), 1);
|
|
47
|
+
const import_meta = {},
|
|
48
|
+
getPragmaOptions = async props => {
|
|
49
|
+
const {
|
|
50
|
+
default: Static
|
|
51
|
+
} = await import("@tamagui/static");
|
|
52
|
+
return Static.getPragmaOptions(props);
|
|
53
|
+
},
|
|
54
|
+
getWorkerPath = () => typeof import_meta < "u" && import_meta.url ? (0, import_node_url.fileURLToPath)(import_meta.resolve("@tamagui/static/worker")).replace(/\.mjs$/, ".js") : require.resolve("@tamagui/static/worker").replace(/\.mjs$/, ".js");
|
|
55
|
+
let piscinaPool = null,
|
|
56
|
+
isClosing = !1;
|
|
57
|
+
function getPool() {
|
|
58
|
+
return piscinaPool || (piscinaPool = new import_piscina.default({
|
|
59
|
+
filename: getWorkerPath(),
|
|
60
|
+
// Single worker for state consistency and simpler caching
|
|
61
|
+
minThreads: 1,
|
|
62
|
+
maxThreads: 1,
|
|
63
|
+
idleTimeout: 6e4
|
|
64
|
+
// 60s - keep alive for config watching
|
|
65
|
+
})), piscinaPool;
|
|
66
|
+
}
|
|
67
|
+
async function loadTamagui(options) {
|
|
68
|
+
const pool = getPool(),
|
|
69
|
+
task = {
|
|
70
|
+
type: "extractToClassNames",
|
|
71
|
+
source: "// dummy",
|
|
72
|
+
sourcePath: "__dummy__.tsx",
|
|
73
|
+
options: {
|
|
74
|
+
components: ["tamagui"],
|
|
75
|
+
...options
|
|
76
|
+
},
|
|
77
|
+
shouldPrintDebug: !1
|
|
78
|
+
};
|
|
79
|
+
try {
|
|
80
|
+
return await pool.run(task, {
|
|
81
|
+
name: "runTask"
|
|
82
|
+
}), {
|
|
83
|
+
success: !0
|
|
84
|
+
};
|
|
85
|
+
} catch (error) {
|
|
86
|
+
throw console.error("[static-worker] Error loading Tamagui config:", error), error;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async function extractToClassNames(params) {
|
|
90
|
+
const {
|
|
91
|
+
source,
|
|
92
|
+
sourcePath = "",
|
|
93
|
+
options,
|
|
94
|
+
shouldPrintDebug = !1
|
|
95
|
+
} = params;
|
|
96
|
+
if (typeof source != "string") throw new Error("`source` must be a string of javascript");
|
|
97
|
+
const task = {
|
|
98
|
+
type: "extractToClassNames",
|
|
99
|
+
source,
|
|
100
|
+
sourcePath,
|
|
101
|
+
options,
|
|
102
|
+
shouldPrintDebug
|
|
103
|
+
},
|
|
104
|
+
result = await getPool().run(task, {
|
|
105
|
+
name: "runTask"
|
|
106
|
+
});
|
|
107
|
+
if (!result.success) {
|
|
108
|
+
const errorMessage = [`[tamagui-extract] Error processing file: ${sourcePath || "(unknown)"}`, "", result.error, result.stack ? `
|
|
109
|
+
${result.stack}` : ""].filter(Boolean).join(`
|
|
110
|
+
`);
|
|
111
|
+
throw new Error(errorMessage);
|
|
112
|
+
}
|
|
113
|
+
return result.data;
|
|
114
|
+
}
|
|
115
|
+
async function extractToNative(sourceFileName, sourceCode, options) {
|
|
116
|
+
const task = {
|
|
117
|
+
type: "extractToNative",
|
|
118
|
+
sourceFileName,
|
|
119
|
+
sourceCode,
|
|
120
|
+
options
|
|
121
|
+
},
|
|
122
|
+
result = await getPool().run(task, {
|
|
123
|
+
name: "runTask"
|
|
124
|
+
});
|
|
125
|
+
if (!result.success) {
|
|
126
|
+
const errorMessage = [`[tamagui-extract] Error processing file: ${sourceFileName || "(unknown)"}`, "", result.error, result.stack ? `
|
|
127
|
+
${result.stack}` : ""].filter(Boolean).join(`
|
|
128
|
+
`);
|
|
129
|
+
throw new Error(errorMessage);
|
|
130
|
+
}
|
|
131
|
+
return result.data;
|
|
132
|
+
}
|
|
133
|
+
async function watchTamaguiConfig(options) {
|
|
134
|
+
const {
|
|
135
|
+
default: Static
|
|
136
|
+
} = await import("@tamagui/static"),
|
|
137
|
+
watcher = await Static.watchTamaguiConfig(options);
|
|
138
|
+
if (!watcher) return;
|
|
139
|
+
const originalDispose = watcher.dispose;
|
|
140
|
+
return {
|
|
141
|
+
dispose: () => {
|
|
142
|
+
originalDispose(), piscinaPool && clearWorkerCache();
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
async function loadTamaguiBuildConfig(tamaguiOptions) {
|
|
147
|
+
const {
|
|
148
|
+
default: Static
|
|
149
|
+
} = await import("@tamagui/static");
|
|
150
|
+
return Static.loadTamaguiBuildConfigSync(tamaguiOptions);
|
|
151
|
+
}
|
|
152
|
+
async function clearWorkerCache() {
|
|
153
|
+
if (!piscinaPool || isClosing) return;
|
|
154
|
+
const task = {
|
|
155
|
+
type: "clearCache"
|
|
156
|
+
};
|
|
157
|
+
await piscinaPool.run(task, {
|
|
158
|
+
name: "runTask"
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
async function destroyPool() {
|
|
162
|
+
if (piscinaPool) {
|
|
163
|
+
isClosing = !0;
|
|
164
|
+
try {
|
|
165
|
+
await piscinaPool.destroy();
|
|
166
|
+
} catch (err) {
|
|
167
|
+
if (err && typeof err == "object" && "message" in err && !String(err.message).includes("Terminating worker thread")) throw err;
|
|
168
|
+
} finally {
|
|
169
|
+
piscinaPool = null, isClosing = !1;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function getPoolStats() {
|
|
174
|
+
return piscinaPool ? {
|
|
175
|
+
threads: piscinaPool.threads.length,
|
|
176
|
+
queueSize: piscinaPool.queueSize,
|
|
177
|
+
completed: piscinaPool.completed,
|
|
178
|
+
duration: piscinaPool.duration,
|
|
179
|
+
utilization: piscinaPool.utilization
|
|
180
|
+
} : null;
|
|
181
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
+
mod
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
+
var index_exports = {};
|
|
24
|
+
__export(index_exports, {
|
|
25
|
+
clearWorkerCache: () => clearWorkerCache,
|
|
26
|
+
destroyPool: () => destroyPool,
|
|
27
|
+
extractToClassNames: () => extractToClassNames,
|
|
28
|
+
extractToNative: () => extractToNative,
|
|
29
|
+
getPoolStats: () => getPoolStats,
|
|
30
|
+
getPragmaOptions: () => getPragmaOptions,
|
|
31
|
+
loadTamagui: () => loadTamagui,
|
|
32
|
+
loadTamaguiBuildConfig: () => loadTamaguiBuildConfig,
|
|
33
|
+
watchTamaguiConfig: () => watchTamaguiConfig
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(index_exports);
|
|
36
|
+
var import_node_url = require("node:url"), import_piscina = __toESM(require("piscina"), 1);
|
|
37
|
+
const import_meta = {}, getPragmaOptions = async (props) => {
|
|
38
|
+
const { default: Static } = await import("@tamagui/static");
|
|
39
|
+
return Static.getPragmaOptions(props);
|
|
40
|
+
}, getWorkerPath = () => typeof import_meta < "u" && import_meta.url ? (0, import_node_url.fileURLToPath)(import_meta.resolve("@tamagui/static/worker")).replace(/\.mjs$/, ".js") : require.resolve("@tamagui/static/worker").replace(/\.mjs$/, ".js");
|
|
41
|
+
let piscinaPool = null, isClosing = !1;
|
|
42
|
+
function getPool() {
|
|
43
|
+
return piscinaPool || (piscinaPool = new import_piscina.default({
|
|
44
|
+
filename: getWorkerPath(),
|
|
45
|
+
// Single worker for state consistency and simpler caching
|
|
46
|
+
minThreads: 1,
|
|
47
|
+
maxThreads: 1,
|
|
48
|
+
idleTimeout: 6e4
|
|
49
|
+
// 60s - keep alive for config watching
|
|
50
|
+
})), piscinaPool;
|
|
51
|
+
}
|
|
52
|
+
async function loadTamagui(options) {
|
|
53
|
+
const pool = getPool(), task = {
|
|
54
|
+
type: "extractToClassNames",
|
|
55
|
+
source: "// dummy",
|
|
56
|
+
sourcePath: "__dummy__.tsx",
|
|
57
|
+
options: {
|
|
58
|
+
components: ["tamagui"],
|
|
59
|
+
...options
|
|
60
|
+
},
|
|
61
|
+
shouldPrintDebug: !1
|
|
62
|
+
};
|
|
63
|
+
try {
|
|
64
|
+
return await pool.run(task, { name: "runTask" }), { success: !0 };
|
|
65
|
+
} catch (error) {
|
|
66
|
+
throw console.error("[static-worker] Error loading Tamagui config:", error), error;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function extractToClassNames(params) {
|
|
70
|
+
const { source, sourcePath = "", options, shouldPrintDebug = !1 } = params;
|
|
71
|
+
if (typeof source != "string")
|
|
72
|
+
throw new Error("`source` must be a string of javascript");
|
|
73
|
+
const task = {
|
|
74
|
+
type: "extractToClassNames",
|
|
75
|
+
source,
|
|
76
|
+
sourcePath,
|
|
77
|
+
options,
|
|
78
|
+
shouldPrintDebug
|
|
79
|
+
}, result = await getPool().run(task, { name: "runTask" });
|
|
80
|
+
if (!result.success) {
|
|
81
|
+
const errorMessage = [
|
|
82
|
+
`[tamagui-extract] Error processing file: ${sourcePath || "(unknown)"}`,
|
|
83
|
+
"",
|
|
84
|
+
result.error,
|
|
85
|
+
result.stack ? `
|
|
86
|
+
${result.stack}` : ""
|
|
87
|
+
].filter(Boolean).join(`
|
|
88
|
+
`);
|
|
89
|
+
throw new Error(errorMessage);
|
|
90
|
+
}
|
|
91
|
+
return result.data;
|
|
92
|
+
}
|
|
93
|
+
async function extractToNative(sourceFileName, sourceCode, options) {
|
|
94
|
+
const task = {
|
|
95
|
+
type: "extractToNative",
|
|
96
|
+
sourceFileName,
|
|
97
|
+
sourceCode,
|
|
98
|
+
options
|
|
99
|
+
}, result = await getPool().run(task, { name: "runTask" });
|
|
100
|
+
if (!result.success) {
|
|
101
|
+
const errorMessage = [
|
|
102
|
+
`[tamagui-extract] Error processing file: ${sourceFileName || "(unknown)"}`,
|
|
103
|
+
"",
|
|
104
|
+
result.error,
|
|
105
|
+
result.stack ? `
|
|
106
|
+
${result.stack}` : ""
|
|
107
|
+
].filter(Boolean).join(`
|
|
108
|
+
`);
|
|
109
|
+
throw new Error(errorMessage);
|
|
110
|
+
}
|
|
111
|
+
return result.data;
|
|
112
|
+
}
|
|
113
|
+
async function watchTamaguiConfig(options) {
|
|
114
|
+
const { default: Static } = await import("@tamagui/static"), watcher = await Static.watchTamaguiConfig(options);
|
|
115
|
+
if (!watcher)
|
|
116
|
+
return;
|
|
117
|
+
const originalDispose = watcher.dispose;
|
|
118
|
+
return {
|
|
119
|
+
dispose: () => {
|
|
120
|
+
originalDispose(), piscinaPool && clearWorkerCache();
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
async function loadTamaguiBuildConfig(tamaguiOptions) {
|
|
125
|
+
const { default: Static } = await import("@tamagui/static");
|
|
126
|
+
return Static.loadTamaguiBuildConfigSync(tamaguiOptions);
|
|
127
|
+
}
|
|
128
|
+
async function clearWorkerCache() {
|
|
129
|
+
if (!piscinaPool || isClosing) return;
|
|
130
|
+
const task = { type: "clearCache" };
|
|
131
|
+
await piscinaPool.run(task, { name: "runTask" });
|
|
132
|
+
}
|
|
133
|
+
async function destroyPool() {
|
|
134
|
+
if (piscinaPool) {
|
|
135
|
+
isClosing = !0;
|
|
136
|
+
try {
|
|
137
|
+
await piscinaPool.destroy();
|
|
138
|
+
} catch (err) {
|
|
139
|
+
if (err && typeof err == "object" && "message" in err && !String(err.message).includes("Terminating worker thread"))
|
|
140
|
+
throw err;
|
|
141
|
+
} finally {
|
|
142
|
+
piscinaPool = null, isClosing = !1;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function getPoolStats() {
|
|
147
|
+
return piscinaPool ? {
|
|
148
|
+
threads: piscinaPool.threads.length,
|
|
149
|
+
queueSize: piscinaPool.queueSize,
|
|
150
|
+
completed: piscinaPool.completed,
|
|
151
|
+
duration: piscinaPool.duration,
|
|
152
|
+
utilization: piscinaPool.utilization
|
|
153
|
+
} : null;
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,sBAA8B,qBAC9B,iBAAoB;AAbpB,wBAqBa,mBAAmB,OAAO,UAGjC;AACJ,QAAM,EAAE,SAAS,OAAO,IAAI,MAAM,OAAO,iBAAiB;AAC1D,SAAO,OAAO,iBAAiB,KAAK;AACtC,GAGM,gBAAgB,MAGhB,OAAO,cAAgB,OAAe,YAAY,UACjC,+BAAc,YAAY,QAAQ,wBAAwB,CAAC,EAE5D,QAAQ,UAAU,KAAK,IAIpC,gBAAgB,wBAAwB,EAAE,QAAQ,UAAU,KAAK;AAG1E,IAAI,cAA8B,MAC9B,YAAY;AAKhB,SAAS,UAAmB;AAC1B,SAAK,gBACH,cAAc,IAAI,eAAAA,QAAQ;AAAA,IACxB,UAAU,cAAc;AAAA;AAAA,IAExB,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,aAAa;AAAA;AAAA,EACf,CAAC,IAEI;AACT;AAMA,eAAsB,YAAY,SAAgD;AAChF,QAAM,OAAO,QAAQ,GAIf,OAAO;AAAA,IACX,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,SAAS;AAAA,MACP,YAAY,CAAC,SAAS;AAAA,MACtB,GAAG;AAAA,IACL;AAAA,IACA,kBAAkB;AAAA,EACpB;AAEA,MAAI;AACF,iBAAM,KAAK,IAAI,MAAM,EAAE,MAAM,UAA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AAM,OAAO,iBAAiB,GACpD,UAAU,MAAM,OAAO,mBAAmB,OAAO;AAEvD,MAAI,CAAC;AACH;AAIF,QAAM,kBAAkB,QAAQ;AAChC,SAAO;AAAA,IACL,SAAS,MAAM;AACb,sBAAgB,GACZ,eAEF,iBAAiB;AAAA,IAErB;AAAA,EACF;AACF;AAMA,eAAsB,uBACpB,gBACyB;AAEzB,QAAM,EAAE,SAAS,OAAO,IAAI,MAAM,OAAO,iBAAiB;AAE1D,SAAO,OAAO,2BAA2B,cAAc;AACzD;AAMA,eAAsB,mBAAkC;AACtD,MAAI,CAAC,eAAe,UAAW;AAE/B,QAAM,OAAO,EAAE,MAAM,aAAa;AAClC,QAAM,YAAY,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AACjD;AAMA,eAAsB,cAA6B;AACjD,MAAI,aAAa;AACf,gBAAY;AACZ,QAAI;AACF,YAAM,YAAY,QAAQ;AAAA,IAC5B,SAAS,KAAK;AAGZ,UAAI,OAAO,OAAO,OAAQ,YAAY,aAAa,OAE7C,CADY,OAAO,IAAI,OAAO,EACrB,SAAS,2BAA2B;AAC/C,cAAM;AAAA,IAGZ,UAAE;AACA,oBAAc,MACd,YAAY;AAAA,IACd;AAAA,EACF;AACF;AAKO,SAAS,eAAe;AAC7B,SAAK,cAGE;AAAA,IACL,SAAS,YAAY,QAAQ;AAAA,IAC7B,WAAW,YAAY;AAAA,IACvB,WAAW,YAAY;AAAA,IACvB,UAAU,YAAY;AAAA,IACtB,aAAa,YAAY;AAAA,EAC3B,IARS;AASX;",
|
|
5
|
+
"names": ["Piscina"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
import Piscina from "piscina";
|
|
3
|
+
const getPragmaOptions = async (props) => {
|
|
4
|
+
const { default: Static } = await import("@tamagui/static");
|
|
5
|
+
return Static.getPragmaOptions(props);
|
|
6
|
+
}, getWorkerPath = () => typeof import.meta < "u" && import.meta.url ? fileURLToPath(import.meta.resolve("@tamagui/static/worker")).replace(/\.mjs$/, ".js") : require.resolve("@tamagui/static/worker").replace(/\.mjs$/, ".js");
|
|
7
|
+
let piscinaPool = null, isClosing = !1;
|
|
8
|
+
function getPool() {
|
|
9
|
+
return piscinaPool || (piscinaPool = new Piscina({
|
|
10
|
+
filename: getWorkerPath(),
|
|
11
|
+
// Single worker for state consistency and simpler caching
|
|
12
|
+
minThreads: 1,
|
|
13
|
+
maxThreads: 1,
|
|
14
|
+
idleTimeout: 6e4
|
|
15
|
+
// 60s - keep alive for config watching
|
|
16
|
+
})), piscinaPool;
|
|
17
|
+
}
|
|
18
|
+
async function loadTamagui(options) {
|
|
19
|
+
const pool = getPool(), task = {
|
|
20
|
+
type: "extractToClassNames",
|
|
21
|
+
source: "// dummy",
|
|
22
|
+
sourcePath: "__dummy__.tsx",
|
|
23
|
+
options: {
|
|
24
|
+
components: ["tamagui"],
|
|
25
|
+
...options
|
|
26
|
+
},
|
|
27
|
+
shouldPrintDebug: !1
|
|
28
|
+
};
|
|
29
|
+
try {
|
|
30
|
+
return await pool.run(task, { name: "runTask" }), { success: !0 };
|
|
31
|
+
} catch (error) {
|
|
32
|
+
throw console.error("[static-worker] Error loading Tamagui config:", error), error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async function extractToClassNames(params) {
|
|
36
|
+
const { source, sourcePath = "", options, shouldPrintDebug = !1 } = params;
|
|
37
|
+
if (typeof source != "string")
|
|
38
|
+
throw new Error("`source` must be a string of javascript");
|
|
39
|
+
const task = {
|
|
40
|
+
type: "extractToClassNames",
|
|
41
|
+
source,
|
|
42
|
+
sourcePath,
|
|
43
|
+
options,
|
|
44
|
+
shouldPrintDebug
|
|
45
|
+
}, result = await getPool().run(task, { name: "runTask" });
|
|
46
|
+
if (!result.success) {
|
|
47
|
+
const errorMessage = [
|
|
48
|
+
`[tamagui-extract] Error processing file: ${sourcePath || "(unknown)"}`,
|
|
49
|
+
"",
|
|
50
|
+
result.error,
|
|
51
|
+
result.stack ? `
|
|
52
|
+
${result.stack}` : ""
|
|
53
|
+
].filter(Boolean).join(`
|
|
54
|
+
`);
|
|
55
|
+
throw new Error(errorMessage);
|
|
56
|
+
}
|
|
57
|
+
return result.data;
|
|
58
|
+
}
|
|
59
|
+
async function extractToNative(sourceFileName, sourceCode, options) {
|
|
60
|
+
const task = {
|
|
61
|
+
type: "extractToNative",
|
|
62
|
+
sourceFileName,
|
|
63
|
+
sourceCode,
|
|
64
|
+
options
|
|
65
|
+
}, result = await getPool().run(task, { name: "runTask" });
|
|
66
|
+
if (!result.success) {
|
|
67
|
+
const errorMessage = [
|
|
68
|
+
`[tamagui-extract] Error processing file: ${sourceFileName || "(unknown)"}`,
|
|
69
|
+
"",
|
|
70
|
+
result.error,
|
|
71
|
+
result.stack ? `
|
|
72
|
+
${result.stack}` : ""
|
|
73
|
+
].filter(Boolean).join(`
|
|
74
|
+
`);
|
|
75
|
+
throw new Error(errorMessage);
|
|
76
|
+
}
|
|
77
|
+
return result.data;
|
|
78
|
+
}
|
|
79
|
+
async function watchTamaguiConfig(options) {
|
|
80
|
+
const { default: Static } = await import("@tamagui/static"), watcher = await Static.watchTamaguiConfig(options);
|
|
81
|
+
if (!watcher)
|
|
82
|
+
return;
|
|
83
|
+
const originalDispose = watcher.dispose;
|
|
84
|
+
return {
|
|
85
|
+
dispose: () => {
|
|
86
|
+
originalDispose(), piscinaPool && clearWorkerCache();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
async function loadTamaguiBuildConfig(tamaguiOptions) {
|
|
91
|
+
const { default: Static } = await import("@tamagui/static");
|
|
92
|
+
return Static.loadTamaguiBuildConfigSync(tamaguiOptions);
|
|
93
|
+
}
|
|
94
|
+
async function clearWorkerCache() {
|
|
95
|
+
if (!piscinaPool || isClosing) return;
|
|
96
|
+
const task = { type: "clearCache" };
|
|
97
|
+
await piscinaPool.run(task, { name: "runTask" });
|
|
98
|
+
}
|
|
99
|
+
async function destroyPool() {
|
|
100
|
+
if (piscinaPool) {
|
|
101
|
+
isClosing = !0;
|
|
102
|
+
try {
|
|
103
|
+
await piscinaPool.destroy();
|
|
104
|
+
} catch (err) {
|
|
105
|
+
if (err && typeof err == "object" && "message" in err && !String(err.message).includes("Terminating worker thread"))
|
|
106
|
+
throw err;
|
|
107
|
+
} finally {
|
|
108
|
+
piscinaPool = null, isClosing = !1;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function getPoolStats() {
|
|
113
|
+
return piscinaPool ? {
|
|
114
|
+
threads: piscinaPool.threads.length,
|
|
115
|
+
queueSize: piscinaPool.queueSize,
|
|
116
|
+
completed: piscinaPool.completed,
|
|
117
|
+
duration: piscinaPool.duration,
|
|
118
|
+
utilization: piscinaPool.utilization
|
|
119
|
+
} : null;
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
clearWorkerCache,
|
|
123
|
+
destroyPool,
|
|
124
|
+
extractToClassNames,
|
|
125
|
+
extractToNative,
|
|
126
|
+
getPoolStats,
|
|
127
|
+
getPragmaOptions,
|
|
128
|
+
loadTamagui,
|
|
129
|
+
loadTamaguiBuildConfig,
|
|
130
|
+
watchTamaguiConfig
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"mappings": "AAYA,SAAS,qBAAqB;AAC9B,OAAO,aAAa;AAQb,MAAM,mBAAmB,OAAO,UAGjC;AACJ,QAAM,EAAE,SAAS,OAAO,IAAI,MAAM,OAAO,iBAAiB;AAC1D,SAAO,OAAO,iBAAiB,KAAK;AACtC,GAGM,gBAAgB,MAGhB,OAAO,cAAgB,OAAe,YAAY,MACjC,cAAc,YAAY,QAAQ,wBAAwB,CAAC,EAE5D,QAAQ,UAAU,KAAK,IAIpC,gBAAgB,wBAAwB,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AE;AACA,oBAAc,MACd,YAAY;AAAA,IACd;AAAA,EACF;AACF;AAKO,SAAS,eAAe;AAC7B,SAAK,cAGE;AAAA,IACL,SAAS,YAAY,QAAQ;AAAA,IAC7B,WAAW,YAAY;AAAA,IACvB,WAAW,YAAY;AAAA,IACvB,UAAU,YAAY;AAAA,IACtB,aAAa,YAAY;AAAA,EAC3B,IARS;AASX;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
import Piscina from "piscina";
|
|
3
|
+
const getPragmaOptions = async props => {
|
|
4
|
+
const {
|
|
5
|
+
default: Static
|
|
6
|
+
} = await import("@tamagui/static");
|
|
7
|
+
return Static.getPragmaOptions(props);
|
|
8
|
+
},
|
|
9
|
+
getWorkerPath = () => typeof import.meta < "u" && import.meta.url ? fileURLToPath(import.meta.resolve("@tamagui/static/worker")).replace(/\.mjs$/, ".js") : require.resolve("@tamagui/static/worker").replace(/\.mjs$/, ".js");
|
|
10
|
+
let piscinaPool = null,
|
|
11
|
+
isClosing = !1;
|
|
12
|
+
function getPool() {
|
|
13
|
+
return piscinaPool || (piscinaPool = new Piscina({
|
|
14
|
+
filename: getWorkerPath(),
|
|
15
|
+
// Single worker for state consistency and simpler caching
|
|
16
|
+
minThreads: 1,
|
|
17
|
+
maxThreads: 1,
|
|
18
|
+
idleTimeout: 6e4
|
|
19
|
+
// 60s - keep alive for config watching
|
|
20
|
+
})), piscinaPool;
|
|
21
|
+
}
|
|
22
|
+
async function loadTamagui(options) {
|
|
23
|
+
const pool = getPool(),
|
|
24
|
+
task = {
|
|
25
|
+
type: "extractToClassNames",
|
|
26
|
+
source: "// dummy",
|
|
27
|
+
sourcePath: "__dummy__.tsx",
|
|
28
|
+
options: {
|
|
29
|
+
components: ["tamagui"],
|
|
30
|
+
...options
|
|
31
|
+
},
|
|
32
|
+
shouldPrintDebug: !1
|
|
33
|
+
};
|
|
34
|
+
try {
|
|
35
|
+
return await pool.run(task, {
|
|
36
|
+
name: "runTask"
|
|
37
|
+
}), {
|
|
38
|
+
success: !0
|
|
39
|
+
};
|
|
40
|
+
} catch (error) {
|
|
41
|
+
throw console.error("[static-worker] Error loading Tamagui config:", error), error;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async function extractToClassNames(params) {
|
|
45
|
+
const {
|
|
46
|
+
source,
|
|
47
|
+
sourcePath = "",
|
|
48
|
+
options,
|
|
49
|
+
shouldPrintDebug = !1
|
|
50
|
+
} = params;
|
|
51
|
+
if (typeof source != "string") throw new Error("`source` must be a string of javascript");
|
|
52
|
+
const task = {
|
|
53
|
+
type: "extractToClassNames",
|
|
54
|
+
source,
|
|
55
|
+
sourcePath,
|
|
56
|
+
options,
|
|
57
|
+
shouldPrintDebug
|
|
58
|
+
},
|
|
59
|
+
result = await getPool().run(task, {
|
|
60
|
+
name: "runTask"
|
|
61
|
+
});
|
|
62
|
+
if (!result.success) {
|
|
63
|
+
const errorMessage = [`[tamagui-extract] Error processing file: ${sourcePath || "(unknown)"}`, "", result.error, result.stack ? `
|
|
64
|
+
${result.stack}` : ""].filter(Boolean).join(`
|
|
65
|
+
`);
|
|
66
|
+
throw new Error(errorMessage);
|
|
67
|
+
}
|
|
68
|
+
return result.data;
|
|
69
|
+
}
|
|
70
|
+
async function extractToNative(sourceFileName, sourceCode, options) {
|
|
71
|
+
const task = {
|
|
72
|
+
type: "extractToNative",
|
|
73
|
+
sourceFileName,
|
|
74
|
+
sourceCode,
|
|
75
|
+
options
|
|
76
|
+
},
|
|
77
|
+
result = await getPool().run(task, {
|
|
78
|
+
name: "runTask"
|
|
79
|
+
});
|
|
80
|
+
if (!result.success) {
|
|
81
|
+
const errorMessage = [`[tamagui-extract] Error processing file: ${sourceFileName || "(unknown)"}`, "", result.error, result.stack ? `
|
|
82
|
+
${result.stack}` : ""].filter(Boolean).join(`
|
|
83
|
+
`);
|
|
84
|
+
throw new Error(errorMessage);
|
|
85
|
+
}
|
|
86
|
+
return result.data;
|
|
87
|
+
}
|
|
88
|
+
async function watchTamaguiConfig(options) {
|
|
89
|
+
const {
|
|
90
|
+
default: Static
|
|
91
|
+
} = await import("@tamagui/static"),
|
|
92
|
+
watcher = await Static.watchTamaguiConfig(options);
|
|
93
|
+
if (!watcher) return;
|
|
94
|
+
const originalDispose = watcher.dispose;
|
|
95
|
+
return {
|
|
96
|
+
dispose: () => {
|
|
97
|
+
originalDispose(), piscinaPool && clearWorkerCache();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
async function loadTamaguiBuildConfig(tamaguiOptions) {
|
|
102
|
+
const {
|
|
103
|
+
default: Static
|
|
104
|
+
} = await import("@tamagui/static");
|
|
105
|
+
return Static.loadTamaguiBuildConfigSync(tamaguiOptions);
|
|
106
|
+
}
|
|
107
|
+
async function clearWorkerCache() {
|
|
108
|
+
if (!piscinaPool || isClosing) return;
|
|
109
|
+
const task = {
|
|
110
|
+
type: "clearCache"
|
|
111
|
+
};
|
|
112
|
+
await piscinaPool.run(task, {
|
|
113
|
+
name: "runTask"
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
async function destroyPool() {
|
|
117
|
+
if (piscinaPool) {
|
|
118
|
+
isClosing = !0;
|
|
119
|
+
try {
|
|
120
|
+
await piscinaPool.destroy();
|
|
121
|
+
} catch (err) {
|
|
122
|
+
if (err && typeof err == "object" && "message" in err && !String(err.message).includes("Terminating worker thread")) throw err;
|
|
123
|
+
} finally {
|
|
124
|
+
piscinaPool = null, isClosing = !1;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function getPoolStats() {
|
|
129
|
+
return piscinaPool ? {
|
|
130
|
+
threads: piscinaPool.threads.length,
|
|
131
|
+
queueSize: piscinaPool.queueSize,
|
|
132
|
+
completed: piscinaPool.completed,
|
|
133
|
+
duration: piscinaPool.duration,
|
|
134
|
+
utilization: piscinaPool.utilization
|
|
135
|
+
} : null;
|
|
136
|
+
}
|
|
137
|
+
export { clearWorkerCache, destroyPool, extractToClassNames, extractToNative, getPoolStats, getPragmaOptions, loadTamagui, loadTamaguiBuildConfig, watchTamaguiConfig };
|
|
138
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["fileURLToPath","Piscina","getPragmaOptions","props","default","Static","getWorkerPath","import","meta","url","resolve","replace","require","piscinaPool","isClosing","getPool","filename","minThreads","maxThreads","idleTimeout","loadTamagui","options","pool","task","type","source","sourcePath","components","shouldPrintDebug","run","name","success","error","console","extractToClassNames","params","Error","result","errorMessage","stack","filter","Boolean","join","data","extractToNative","sourceFileName","sourceCode","watchTamaguiConfig","watcher","originalDispose","dispose","clearWorkerCache","loadTamaguiBuildConfig","tamaguiOptions","loadTamaguiBuildConfigSync","destroyPool","destroy","err","String","message","includes","getPoolStats","threads","length","queueSize","completed","duration","utilization"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAYA,SAASA,aAAA,QAAqB;AAC9B,OAAOC,OAAA,MAAa;AAQb,MAAMC,gBAAA,GAAmB,MAAOC,KAAA,IAGjC;IACJ,MAAM;MAAEC,OAAA,EAASC;IAAO,IAAI,MAAM,OAAO,iBAAiB;IAC1D,OAAOA,MAAA,CAAOH,gBAAA,CAAiBC,KAAK;EACtC;EAGMG,aAAA,GAAgBA,CAAA,KAGhB,OAAOC,MAAA,CAAAC,IAAA,GAAgB,OAAeD,MAAA,CAAAC,IAAA,CAAYC,GAAA,GACjCT,aAAA,CAAcO,MAAA,CAAAC,IAAA,CAAYE,OAAA,CAAQ,wBAAwB,CAAC,EAE5DC,OAAA,CAAQ,UAAU,KAAK,IAIpCC,OAAA,CAAAF,OAAA,CAAgB,wBAAwB,EAAEC,OAAA,CAAQ,UAAU,KAAK;AAG1E,IAAIE,WAAA,GAA8B;EAC9BC,SAAA,GAAY;AAKhB,SAASC,QAAA,EAAmB;EAC1B,OAAKF,WAAA,KACH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D,0BAAA,CAA2BD,cAAc;AACzD;AAMA,eAAsBF,iBAAA,EAAkC;EACtD,IAAI,CAACtC,WAAA,IAAeC,SAAA,EAAW;EAE/B,MAAMS,IAAA,GAAO;IAAEC,IAAA,EAAM;EAAa;EAClC,MAAMX,WAAA,CAAYgB,GAAA,CAAIN,IAAA,EAAM;IAAEO,IAAA,EAAM;EAAU,CAAC;AACjD;AAMA,eAAsByB,YAAA,EAA6B;EACjD,IAAI1C,WAAA,EAAa;IACfC,SAAA,GAAY;IACZ,IAAI;MACF,MAAMD,WAAA,CAAY2C,OAAA,CAAQ;IAC5B,SAASC,GAAA,EAAK;MAGZ,IAAIA,GAAA,IAAO,OAAOA,GAAA,IAAQ,YAAY,aAAaA,GAAA,IAE7C,CADYC,MAAA,CAAOD,GAAA,CAAIE,OAAO,EACrBC,QAAA,CAAS,2BAA2B,GAC/C,MAAMH,GAAA;IAGZ,UAAE;MACA5C,WAAA,GAAc,MACdC,SAAA,GAAY;IACd;EACF;AACF;AAKO,SAAS+C,aAAA,EAAe;EAC7B,OAAKhD,WAAA,GAGE;IACLiD,OAAA,EAASjD,WAAA,CAAYiD,OAAA,CAAQC,MAAA;IAC7BC,SAAA,EAAWnD,WAAA,CAAYmD,SAAA;IACvBC,SAAA,EAAWpD,WAAA,CAAYoD,SAAA;IACvBC,QAAA,EAAUrD,WAAA,CAAYqD,QAAA;IACtBC,WAAA,EAAatD,WAAA,CAAYsD;EAC3B,IARS;AASX","ignoreList":[]}
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import { dirname, resolve } from "node:path";
|
|
2
1
|
import { fileURLToPath } from "node:url";
|
|
3
2
|
import Piscina from "piscina";
|
|
4
3
|
const getPragmaOptions = async (props) => {
|
|
5
4
|
const { default: Static } = await import("@tamagui/static");
|
|
6
5
|
return Static.getPragmaOptions(props);
|
|
7
|
-
}, getWorkerPath = () =>
|
|
8
|
-
if (typeof import.meta < "u" && import.meta.url) {
|
|
9
|
-
const staticPackagePath = fileURLToPath(import.meta.resolve("@tamagui/static"));
|
|
10
|
-
return resolve(dirname(staticPackagePath), "worker.js");
|
|
11
|
-
}
|
|
12
|
-
return resolve(process.cwd(), "node_modules/@tamagui/static/dist/worker.js");
|
|
13
|
-
};
|
|
6
|
+
}, getWorkerPath = () => typeof import.meta < "u" && import.meta.url ? fileURLToPath(import.meta.resolve("@tamagui/static/worker")).replace(/\.mjs$/, ".js") : require.resolve("@tamagui/static/worker").replace(/\.mjs$/, ".js");
|
|
14
7
|
let piscinaPool = null, isClosing = !1;
|
|
15
8
|
function getPool() {
|
|
16
9
|
return piscinaPool || (piscinaPool = new Piscina({
|
|
@@ -50,11 +43,17 @@ async function extractToClassNames(params) {
|
|
|
50
43
|
options,
|
|
51
44
|
shouldPrintDebug
|
|
52
45
|
}, result = await getPool().run(task, { name: "runTask" });
|
|
53
|
-
if (!result.success)
|
|
54
|
-
|
|
55
|
-
`
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
if (!result.success) {
|
|
47
|
+
const errorMessage = [
|
|
48
|
+
`[tamagui-extract] Error processing file: ${sourcePath || "(unknown)"}`,
|
|
49
|
+
"",
|
|
50
|
+
result.error,
|
|
51
|
+
result.stack ? `
|
|
52
|
+
${result.stack}` : ""
|
|
53
|
+
].filter(Boolean).join(`
|
|
54
|
+
`);
|
|
55
|
+
throw new Error(errorMessage);
|
|
56
|
+
}
|
|
58
57
|
return result.data;
|
|
59
58
|
}
|
|
60
59
|
async function extractToNative(sourceFileName, sourceCode, options) {
|
|
@@ -64,11 +63,17 @@ async function extractToNative(sourceFileName, sourceCode, options) {
|
|
|
64
63
|
sourceCode,
|
|
65
64
|
options
|
|
66
65
|
}, result = await getPool().run(task, { name: "runTask" });
|
|
67
|
-
if (!result.success)
|
|
68
|
-
|
|
69
|
-
`
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
if (!result.success) {
|
|
67
|
+
const errorMessage = [
|
|
68
|
+
`[tamagui-extract] Error processing file: ${sourceFileName || "(unknown)"}`,
|
|
69
|
+
"",
|
|
70
|
+
result.error,
|
|
71
|
+
result.stack ? `
|
|
72
|
+
${result.stack}` : ""
|
|
73
|
+
].filter(Boolean).join(`
|
|
74
|
+
`);
|
|
75
|
+
throw new Error(errorMessage);
|
|
76
|
+
}
|
|
72
77
|
return result.data;
|
|
73
78
|
}
|
|
74
79
|
async function watchTamaguiConfig(options) {
|
|
@@ -96,7 +101,9 @@ async function destroyPool() {
|
|
|
96
101
|
isClosing = !0;
|
|
97
102
|
try {
|
|
98
103
|
await piscinaPool.destroy();
|
|
99
|
-
} catch {
|
|
104
|
+
} catch (err) {
|
|
105
|
+
if (err && typeof err == "object" && "message" in err && !String(err.message).includes("Terminating worker thread"))
|
|
106
|
+
throw err;
|
|
100
107
|
} finally {
|
|
101
108
|
piscinaPool = null, isClosing = !1;
|
|
102
109
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAYA,SAAS,qBAAqB;AAC9B,OAAO,aAAa;AAQb,MAAM,mBAAmB,OAAO,UAGjC;AACJ,QAAM,EAAE,SAAS,OAAO,IAAI,MAAM,OAAO,iBAAiB;AAC1D,SAAO,OAAO,iBAAiB,KAAK;AACtC,GAGM,gBAAgB,MAGhB,OAAO,cAAgB,OAAe,YAAY,MACjC,cAAc,YAAY,QAAQ,wBAAwB,CAAC,EAE5D,QAAQ,UAAU,KAAK,IAIpC,gBAAgB,wBAAwB,EAAE,QAAQ,UAAU,KAAK;AAG1E,IAAI,cAA8B,MAC9B,YAAY;AAKhB,SAAS,UAAmB;AAC1B,SAAK,gBACH,cAAc,IAAI,QAAQ;AAAA,IACxB,UAAU,cAAc;AAAA;AAAA,IAExB,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,aAAa;AAAA;AAAA,EACf,CAAC,IAEI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,IARS;AASX;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { dirname, resolve } from "node:path";
|
|
2
1
|
import { fileURLToPath } from "node:url";
|
|
3
2
|
import Piscina from "piscina";
|
|
4
3
|
const getPragmaOptions = async props => {
|
|
@@ -7,13 +6,7 @@ const getPragmaOptions = async props => {
|
|
|
7
6
|
} = await import("@tamagui/static");
|
|
8
7
|
return Static.getPragmaOptions(props);
|
|
9
8
|
},
|
|
10
|
-
getWorkerPath = () =>
|
|
11
|
-
if (typeof import.meta < "u" && import.meta.url) {
|
|
12
|
-
const staticPackagePath = fileURLToPath(import.meta.resolve("@tamagui/static"));
|
|
13
|
-
return resolve(dirname(staticPackagePath), "worker.js");
|
|
14
|
-
}
|
|
15
|
-
return resolve(process.cwd(), "node_modules/@tamagui/static/dist/worker.js");
|
|
16
|
-
};
|
|
9
|
+
getWorkerPath = () => typeof import.meta < "u" && import.meta.url ? fileURLToPath(import.meta.resolve("@tamagui/static/worker")).replace(/\.mjs$/, ".js") : require.resolve("@tamagui/static/worker").replace(/\.mjs$/, ".js");
|
|
17
10
|
let piscinaPool = null,
|
|
18
11
|
isClosing = !1;
|
|
19
12
|
function getPool() {
|
|
@@ -66,8 +59,12 @@ async function extractToClassNames(params) {
|
|
|
66
59
|
result = await getPool().run(task, {
|
|
67
60
|
name: "runTask"
|
|
68
61
|
});
|
|
69
|
-
if (!result.success)
|
|
70
|
-
${result.stack
|
|
62
|
+
if (!result.success) {
|
|
63
|
+
const errorMessage = [`[tamagui-extract] Error processing file: ${sourcePath || "(unknown)"}`, "", result.error, result.stack ? `
|
|
64
|
+
${result.stack}` : ""].filter(Boolean).join(`
|
|
65
|
+
`);
|
|
66
|
+
throw new Error(errorMessage);
|
|
67
|
+
}
|
|
71
68
|
return result.data;
|
|
72
69
|
}
|
|
73
70
|
async function extractToNative(sourceFileName, sourceCode, options) {
|
|
@@ -80,8 +77,12 @@ async function extractToNative(sourceFileName, sourceCode, options) {
|
|
|
80
77
|
result = await getPool().run(task, {
|
|
81
78
|
name: "runTask"
|
|
82
79
|
});
|
|
83
|
-
if (!result.success)
|
|
84
|
-
${result.stack
|
|
80
|
+
if (!result.success) {
|
|
81
|
+
const errorMessage = [`[tamagui-extract] Error processing file: ${sourceFileName || "(unknown)"}`, "", result.error, result.stack ? `
|
|
82
|
+
${result.stack}` : ""].filter(Boolean).join(`
|
|
83
|
+
`);
|
|
84
|
+
throw new Error(errorMessage);
|
|
85
|
+
}
|
|
85
86
|
return result.data;
|
|
86
87
|
}
|
|
87
88
|
async function watchTamaguiConfig(options) {
|
|
@@ -117,7 +118,9 @@ async function destroyPool() {
|
|
|
117
118
|
isClosing = !0;
|
|
118
119
|
try {
|
|
119
120
|
await piscinaPool.destroy();
|
|
120
|
-
} catch
|
|
121
|
+
} catch (err) {
|
|
122
|
+
if (err && typeof err == "object" && "message" in err && !String(err.message).includes("Terminating worker thread")) throw err;
|
|
123
|
+
} finally {
|
|
121
124
|
piscinaPool = null, isClosing = !1;
|
|
122
125
|
}
|
|
123
126
|
}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["fileURLToPath","Piscina","getPragmaOptions","props","default","Static","getWorkerPath","import","meta","url","resolve","replace","require","piscinaPool","isClosing","getPool","filename","minThreads","maxThreads","idleTimeout","loadTamagui","options","pool","task","type","source","sourcePath","components","shouldPrintDebug","run","name","success","error","console","extractToClassNames","params","Error","result","errorMessage","stack","filter","Boolean","join","data","extractToNative","sourceFileName","sourceCode","watchTamaguiConfig","watcher","originalDispose","dispose","clearWorkerCache","loadTamaguiBuildConfig","tamaguiOptions","loadTamaguiBuildConfigSync","destroyPool","destroy","err","String","message","includes","getPoolStats","threads","length","queueSize","completed","duration","utilization"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAYA,SAASA,aAAA,QAAqB;A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C7B,OAAKhD,WAAA,GAGE;IACLiD,OAAA,EAASjD,WAAA,CAAYiD,OAAA,CAAQC,MAAA;IAC7BC,SAAA,EAAWnD,WAAA,CAAYmD,SAAA;IACvBC,SAAA,EAAWpD,WAAA,CAAYoD,SAAA;IACvBC,QAAA,EAAUrD,WAAA,CAAYqD,QAAA;IACtBC,WAAA,EAAatD,WAAA,CAAYsD;EAC3B,IARS;AASX","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/static-worker",
|
|
3
|
-
"version": "1.136.
|
|
3
|
+
"version": "1.136.7",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"
|
|
7
|
+
"main": "dist/cjs",
|
|
8
|
+
"module": "dist/esm",
|
|
8
9
|
"files": [
|
|
9
10
|
"src",
|
|
10
11
|
"types",
|
|
@@ -16,14 +17,16 @@
|
|
|
16
17
|
"clean": "tamagui-build clean",
|
|
17
18
|
"clean:build": "tamagui-build clean:build",
|
|
18
19
|
"lint": "biome check src",
|
|
19
|
-
"lint:fix": "biome check --write src"
|
|
20
|
+
"lint:fix": "biome check --write src",
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"test:watch": "vitest"
|
|
20
23
|
},
|
|
21
24
|
"exports": {
|
|
22
25
|
"./package.json": "./package.json",
|
|
23
26
|
".": {
|
|
24
27
|
"types": "./types/index.d.ts",
|
|
25
|
-
"require": "./dist/index.
|
|
26
|
-
"import": "./dist/index.
|
|
28
|
+
"require": "./dist/cjs/index.cjs",
|
|
29
|
+
"import": "./dist/esm/index.mjs"
|
|
27
30
|
}
|
|
28
31
|
},
|
|
29
32
|
"publishConfig": {
|
|
@@ -31,11 +34,12 @@
|
|
|
31
34
|
},
|
|
32
35
|
"license": "MIT",
|
|
33
36
|
"dependencies": {
|
|
34
|
-
"@tamagui/static": "1.136.
|
|
35
|
-
"@tamagui/types": "1.136.
|
|
37
|
+
"@tamagui/static": "1.136.7",
|
|
38
|
+
"@tamagui/types": "1.136.7",
|
|
36
39
|
"piscina": "^4.7.0"
|
|
37
40
|
},
|
|
38
41
|
"devDependencies": {
|
|
39
|
-
"@tamagui/build": "1.136.
|
|
42
|
+
"@tamagui/build": "1.136.7",
|
|
43
|
+
"vitest": "^4.0.4"
|
|
40
44
|
}
|
|
41
45
|
}
|
package/src/index.ts
CHANGED
|
@@ -29,15 +29,16 @@ export const getPragmaOptions = async (props: {
|
|
|
29
29
|
|
|
30
30
|
// Resolve worker path - works for both CJS and ESM
|
|
31
31
|
const getWorkerPath = () => {
|
|
32
|
-
//
|
|
32
|
+
// Piscina needs the actual file path, not the module resolution
|
|
33
|
+
// Use the CommonJS .js version which works for piscina
|
|
33
34
|
if (typeof import.meta !== 'undefined' && import.meta.url) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return
|
|
35
|
+
const workerPath = fileURLToPath(import.meta.resolve('@tamagui/static/worker'))
|
|
36
|
+
// Replace .mjs with .js for CommonJS compatibility
|
|
37
|
+
return workerPath.replace(/\.mjs$/, '.js')
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
// Fallback
|
|
40
|
-
return resolve(
|
|
40
|
+
// Fallback for CJS
|
|
41
|
+
return require.resolve('@tamagui/static/worker').replace(/\.mjs$/, '.js')
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
let piscinaPool: Piscina | null = null
|
|
@@ -115,9 +116,16 @@ export async function extractToClassNames(params: {
|
|
|
115
116
|
const result = (await pool.run(task, { name: 'runTask' })) as any
|
|
116
117
|
|
|
117
118
|
if (!result.success) {
|
|
118
|
-
|
|
119
|
-
`
|
|
120
|
-
|
|
119
|
+
const errorMessage = [
|
|
120
|
+
`[tamagui-extract] Error processing file: ${sourcePath || '(unknown)'}`,
|
|
121
|
+
``,
|
|
122
|
+
result.error,
|
|
123
|
+
result.stack ? `\n${result.stack}` : '',
|
|
124
|
+
]
|
|
125
|
+
.filter(Boolean)
|
|
126
|
+
.join('\n')
|
|
127
|
+
|
|
128
|
+
throw new Error(errorMessage)
|
|
121
129
|
}
|
|
122
130
|
|
|
123
131
|
return result.data
|
|
@@ -142,9 +150,16 @@ export async function extractToNative(
|
|
|
142
150
|
const result = (await pool.run(task, { name: 'runTask' })) as any
|
|
143
151
|
|
|
144
152
|
if (!result.success) {
|
|
145
|
-
|
|
146
|
-
`
|
|
147
|
-
|
|
153
|
+
const errorMessage = [
|
|
154
|
+
`[tamagui-extract] Error processing file: ${sourceFileName || '(unknown)'}`,
|
|
155
|
+
``,
|
|
156
|
+
result.error,
|
|
157
|
+
result.stack ? `\n${result.stack}` : '',
|
|
158
|
+
]
|
|
159
|
+
.filter(Boolean)
|
|
160
|
+
.join('\n')
|
|
161
|
+
|
|
162
|
+
throw new Error(errorMessage)
|
|
148
163
|
}
|
|
149
164
|
|
|
150
165
|
return result.data
|
|
@@ -211,8 +226,15 @@ export async function destroyPool(): Promise<void> {
|
|
|
211
226
|
isClosing = true
|
|
212
227
|
try {
|
|
213
228
|
await piscinaPool.destroy()
|
|
214
|
-
} catch {
|
|
215
|
-
//
|
|
229
|
+
} catch (err) {
|
|
230
|
+
// Only ignore worker termination errors during shutdown
|
|
231
|
+
// Re-throw any other errors as they may be legitimate issues
|
|
232
|
+
if (err && typeof err === 'object' && 'message' in err) {
|
|
233
|
+
const message = String(err.message)
|
|
234
|
+
if (!message.includes('Terminating worker thread')) {
|
|
235
|
+
throw err
|
|
236
|
+
}
|
|
237
|
+
}
|
|
216
238
|
} finally {
|
|
217
239
|
piscinaPool = null
|
|
218
240
|
isClosing = false
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAKpD,YA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