@pipelab/plugin-tauri 1.0.0-beta.0
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/CHANGELOG.md +14 -0
- package/LICENSE +110 -0
- package/README.md +3 -0
- package/dist/index.cjs +1658 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1660 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +44 -0
- package/src/configure.ts +23 -0
- package/src/declarations.d.ts +1 -0
- package/src/fixtures/build/index.html +11 -0
- package/src/index.ts +68 -0
- package/src/make.spec.ts +57 -0
- package/src/make.ts +21 -0
- package/src/package.ts +43 -0
- package/src/preview.ts +51 -0
- package/src/public/tauri.webp +0 -0
- package/src/tauri.ts +842 -0
- package/src/utils.ts +27 -0
- package/tsconfig.json +10 -0
- package/tsdown.config.ts +15 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1660 @@
|
|
|
1
|
+
import { createAction, createActionRunner, createArray, createBooleanParam, createNodeDefinition, createNumberParam, createPathParam, createStringParam, detectRuntime, fetchPipelabAsset, runPnpm, runWithLiveLogs } from "@pipelab/plugin-core";
|
|
2
|
+
import { getBinName } from "@pipelab/constants";
|
|
3
|
+
import { basename, delimiter, dirname, join } from "node:path";
|
|
4
|
+
import { existsSync, readFile, writeFile } from "node:fs";
|
|
5
|
+
import { cp, readFile as readFile$1, writeFile as writeFile$1 } from "node:fs/promises";
|
|
6
|
+
import { arch, homedir, platform } from "node:os";
|
|
7
|
+
import { execa } from "execa";
|
|
8
|
+
import { merge } from "ts-deepmerge";
|
|
9
|
+
//#region ../../node_modules/change-case/dist/index.js
|
|
10
|
+
const SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
11
|
+
const SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
12
|
+
const SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u;
|
|
13
|
+
const DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
|
|
14
|
+
const SPLIT_REPLACE_VALUE = "$1\0$2";
|
|
15
|
+
const DEFAULT_PREFIX_SUFFIX_CHARACTERS = "";
|
|
16
|
+
/**
|
|
17
|
+
* Split any cased input strings into an array of words.
|
|
18
|
+
*/
|
|
19
|
+
function split(value) {
|
|
20
|
+
let result = value.trim();
|
|
21
|
+
result = result.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
|
|
22
|
+
result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
|
|
23
|
+
let start = 0;
|
|
24
|
+
let end = result.length;
|
|
25
|
+
while (result.charAt(start) === "\0") start++;
|
|
26
|
+
if (start === end) return [];
|
|
27
|
+
while (result.charAt(end - 1) === "\0") end--;
|
|
28
|
+
return result.slice(start, end).split(/\0/g);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Split the input string into an array of words, separating numbers.
|
|
32
|
+
*/
|
|
33
|
+
function splitSeparateNumbers(value) {
|
|
34
|
+
const words = split(value);
|
|
35
|
+
for (let i = 0; i < words.length; i++) {
|
|
36
|
+
const word = words[i];
|
|
37
|
+
const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);
|
|
38
|
+
if (match) {
|
|
39
|
+
const offset = match.index + (match[1] ?? match[2]).length;
|
|
40
|
+
words.splice(i, 1, word.slice(0, offset), word.slice(offset));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return words;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Convert a string to space separated lower case (`foo bar`).
|
|
47
|
+
*/
|
|
48
|
+
function noCase(input, options) {
|
|
49
|
+
const [prefix, words, suffix] = splitPrefixSuffix(input, options);
|
|
50
|
+
return prefix + words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? " ") + suffix;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Convert a string to kebab case (`foo-bar`).
|
|
54
|
+
*/
|
|
55
|
+
function kebabCase(input, options) {
|
|
56
|
+
return noCase(input, {
|
|
57
|
+
delimiter: "-",
|
|
58
|
+
...options
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function lowerFactory(locale) {
|
|
62
|
+
return locale === false ? (input) => input.toLowerCase() : (input) => input.toLocaleLowerCase(locale);
|
|
63
|
+
}
|
|
64
|
+
function splitPrefixSuffix(input, options = {}) {
|
|
65
|
+
const splitFn = options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);
|
|
66
|
+
const prefixCharacters = options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
|
|
67
|
+
const suffixCharacters = options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
|
|
68
|
+
let prefixIndex = 0;
|
|
69
|
+
let suffixIndex = input.length;
|
|
70
|
+
while (prefixIndex < input.length) {
|
|
71
|
+
const char = input.charAt(prefixIndex);
|
|
72
|
+
if (!prefixCharacters.includes(char)) break;
|
|
73
|
+
prefixIndex++;
|
|
74
|
+
}
|
|
75
|
+
while (suffixIndex > prefixIndex) {
|
|
76
|
+
const index = suffixIndex - 1;
|
|
77
|
+
const char = input.charAt(index);
|
|
78
|
+
if (!suffixCharacters.includes(char)) break;
|
|
79
|
+
suffixIndex = index;
|
|
80
|
+
}
|
|
81
|
+
return [
|
|
82
|
+
input.slice(0, prefixIndex),
|
|
83
|
+
splitFn(input.slice(prefixIndex, suffixIndex)),
|
|
84
|
+
input.slice(suffixIndex)
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region ../../node_modules/confbox/dist/_chunks/libs/detect-indent.mjs
|
|
89
|
+
const e$1 = /^(?:( )+|\t+)/, t$2 = `space`;
|
|
90
|
+
function n$2(e, n, r) {
|
|
91
|
+
return e && n === t$2 && r === 1;
|
|
92
|
+
}
|
|
93
|
+
function r$2(r, a) {
|
|
94
|
+
let o = /* @__PURE__ */ new Map(), s = 0, c, l;
|
|
95
|
+
for (let u of r.split(/\n/g)) {
|
|
96
|
+
if (!u) continue;
|
|
97
|
+
let r = u.match(e$1);
|
|
98
|
+
if (r === null) s = 0, c = ``;
|
|
99
|
+
else {
|
|
100
|
+
let e = r[0].length, u = r[1] ? t$2 : `tab`;
|
|
101
|
+
if (n$2(a, u, e)) continue;
|
|
102
|
+
u !== c && (s = 0), c = u;
|
|
103
|
+
let d = 1, f = 0, p = e - s;
|
|
104
|
+
if (s = e, p === 0) d = 0, f = 1;
|
|
105
|
+
else {
|
|
106
|
+
let e = Math.abs(p);
|
|
107
|
+
if (n$2(a, u, e)) continue;
|
|
108
|
+
l = i$3(u, e);
|
|
109
|
+
}
|
|
110
|
+
let m = o.get(l);
|
|
111
|
+
o.set(l, m === void 0 ? [1, 0] : [m[0] + d, m[1] + f]);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return o;
|
|
115
|
+
}
|
|
116
|
+
function i$3(e, n) {
|
|
117
|
+
return (e === t$2 ? `s` : `t`) + String(n);
|
|
118
|
+
}
|
|
119
|
+
function a$3(e) {
|
|
120
|
+
return {
|
|
121
|
+
type: e[0] === `s` ? t$2 : `tab`,
|
|
122
|
+
amount: Number(e.slice(1))
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function o$2(e) {
|
|
126
|
+
let t, n = 0, r = 0;
|
|
127
|
+
for (let [i, [a, o]] of e) (a > n || a === n && o > r) && (n = a, r = o, t = i);
|
|
128
|
+
return t;
|
|
129
|
+
}
|
|
130
|
+
function s$1(e, n) {
|
|
131
|
+
return (e === t$2 ? ` ` : ` `).repeat(n);
|
|
132
|
+
}
|
|
133
|
+
function c$1(e) {
|
|
134
|
+
if (typeof e != `string`) throw TypeError(`Expected a string`);
|
|
135
|
+
let t = r$2(e, !0);
|
|
136
|
+
t.size === 0 && (t = r$2(e, !1));
|
|
137
|
+
let n = o$2(t), i, c = 0, l = ``;
|
|
138
|
+
return n !== void 0 && ({type: i, amount: c} = a$3(n), l = s$1(i, c)), {
|
|
139
|
+
amount: c,
|
|
140
|
+
type: i,
|
|
141
|
+
indent: l
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region ../../node_modules/confbox/dist/_chunks/_format.mjs
|
|
146
|
+
const t$1 = Symbol.for(`__confbox_fmt__`), n$1 = /^(\s+)/, r$1 = /(\s+)$/;
|
|
147
|
+
function i$2(e, t = {}) {
|
|
148
|
+
return {
|
|
149
|
+
sample: t.indent === void 0 && t.preserveIndentation !== !1 && e.slice(0, t?.sampleSize || 1024),
|
|
150
|
+
whiteSpace: t.preserveWhitespace === !1 ? void 0 : {
|
|
151
|
+
start: n$1.exec(e)?.[0] || ``,
|
|
152
|
+
end: r$1.exec(e)?.[0] || ``
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function a$2(e, n, r) {
|
|
157
|
+
!n || typeof n != `object` || Object.defineProperty(n, t$1, {
|
|
158
|
+
enumerable: !1,
|
|
159
|
+
configurable: !0,
|
|
160
|
+
writable: !0,
|
|
161
|
+
value: i$2(e, r)
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function o$1(n, r) {
|
|
165
|
+
if (!n || typeof n != `object` || !(t$1 in n)) return {
|
|
166
|
+
indent: r?.indent ?? 2,
|
|
167
|
+
whitespace: {
|
|
168
|
+
start: ``,
|
|
169
|
+
end: ``
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
let i = n[t$1];
|
|
173
|
+
return {
|
|
174
|
+
indent: r?.indent || c$1(i.sample || ``).indent,
|
|
175
|
+
whitespace: i.whiteSpace || {
|
|
176
|
+
start: ``,
|
|
177
|
+
end: ``
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region ../../node_modules/confbox/dist/_chunks/libs/smol-toml.mjs
|
|
183
|
+
/*!
|
|
184
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
185
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
186
|
+
*
|
|
187
|
+
* Redistribution and use in source and binary forms, with or without
|
|
188
|
+
* modification, are permitted provided that the following conditions are met:
|
|
189
|
+
*
|
|
190
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
191
|
+
* list of conditions and the following disclaimer.
|
|
192
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
193
|
+
* this list of conditions and the following disclaimer in the
|
|
194
|
+
* documentation and/or other materials provided with the distribution.
|
|
195
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
196
|
+
* may be used to endorse or promote products derived from this software without
|
|
197
|
+
* specific prior written permission.
|
|
198
|
+
*
|
|
199
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
200
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
201
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
202
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
203
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
204
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
205
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
206
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
207
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
208
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
209
|
+
*/
|
|
210
|
+
function e(e, t) {
|
|
211
|
+
let n = e.slice(0, t).split(/\r\n|\n|\r/g);
|
|
212
|
+
return [n.length, n.pop().length + 1];
|
|
213
|
+
}
|
|
214
|
+
function t(e, t, n) {
|
|
215
|
+
let r = e.split(/\r\n|\n|\r/g), i = ``, a = (Math.log10(t + 1) | 0) + 1;
|
|
216
|
+
for (let e = t - 1; e <= t + 1; e++) {
|
|
217
|
+
let o = r[e - 1];
|
|
218
|
+
o && (i += e.toString().padEnd(a, ` `), i += `: `, i += o, i += `
|
|
219
|
+
`, e === t && (i += ` `.repeat(a + n + 2), i += `^
|
|
220
|
+
`));
|
|
221
|
+
}
|
|
222
|
+
return i;
|
|
223
|
+
}
|
|
224
|
+
var n = class extends Error {
|
|
225
|
+
line;
|
|
226
|
+
column;
|
|
227
|
+
codeblock;
|
|
228
|
+
constructor(n, r) {
|
|
229
|
+
let [i, a] = e(r.toml, r.ptr), o = t(r.toml, i, a);
|
|
230
|
+
super(`Invalid TOML document: ${n}\n\n${o}`, r), this.line = i, this.column = a, this.codeblock = o;
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
/*!
|
|
234
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
235
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
236
|
+
*
|
|
237
|
+
* Redistribution and use in source and binary forms, with or without
|
|
238
|
+
* modification, are permitted provided that the following conditions are met:
|
|
239
|
+
*
|
|
240
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
241
|
+
* list of conditions and the following disclaimer.
|
|
242
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
243
|
+
* this list of conditions and the following disclaimer in the
|
|
244
|
+
* documentation and/or other materials provided with the distribution.
|
|
245
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
246
|
+
* may be used to endorse or promote products derived from this software without
|
|
247
|
+
* specific prior written permission.
|
|
248
|
+
*
|
|
249
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
250
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
251
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
252
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
253
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
254
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
255
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
256
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
257
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
258
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
259
|
+
*/
|
|
260
|
+
function r(e, t) {
|
|
261
|
+
let n = 0;
|
|
262
|
+
for (; e[t - ++n] === `\\`;);
|
|
263
|
+
return --n && n % 2;
|
|
264
|
+
}
|
|
265
|
+
function i$1(e, t = 0, n = e.length) {
|
|
266
|
+
let r = e.indexOf(`
|
|
267
|
+
`, t);
|
|
268
|
+
return e[r - 1] === `\r` && r--, r <= n ? r : -1;
|
|
269
|
+
}
|
|
270
|
+
function a$1(e, t) {
|
|
271
|
+
for (let r = t; r < e.length; r++) {
|
|
272
|
+
let i = e[r];
|
|
273
|
+
if (i === `
|
|
274
|
+
`) return r;
|
|
275
|
+
if (i === `\r` && e[r + 1] === `
|
|
276
|
+
`) return r + 1;
|
|
277
|
+
if (i < ` ` && i !== ` ` || i === ``) throw new n(`control characters are not allowed in comments`, {
|
|
278
|
+
toml: e,
|
|
279
|
+
ptr: t
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
return e.length;
|
|
283
|
+
}
|
|
284
|
+
function o(e, t, n, r) {
|
|
285
|
+
let i;
|
|
286
|
+
for (; (i = e[t]) === ` ` || i === ` ` || !n && (i === `
|
|
287
|
+
` || i === `\r` && e[t + 1] === `
|
|
288
|
+
`);) t++;
|
|
289
|
+
return r || i !== `#` ? t : o(e, a$1(e, t), n);
|
|
290
|
+
}
|
|
291
|
+
function s(e, t, r, a, o = !1) {
|
|
292
|
+
if (!a) return t = i$1(e, t), t < 0 ? e.length : t;
|
|
293
|
+
for (let n = t; n < e.length; n++) {
|
|
294
|
+
let t = e[n];
|
|
295
|
+
if (t === `#`) n = i$1(e, n);
|
|
296
|
+
else if (t === r) return n + 1;
|
|
297
|
+
else if (t === a || o && (t === `
|
|
298
|
+
` || t === `\r` && e[n + 1] === `
|
|
299
|
+
`)) return n;
|
|
300
|
+
}
|
|
301
|
+
throw new n(`cannot find end of structure`, {
|
|
302
|
+
toml: e,
|
|
303
|
+
ptr: t
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
function c(e, t) {
|
|
307
|
+
let n = e[t], i = n === e[t + 1] && e[t + 1] === e[t + 2] ? e.slice(t, t + 3) : n;
|
|
308
|
+
t += i.length - 1;
|
|
309
|
+
do
|
|
310
|
+
t = e.indexOf(i, ++t);
|
|
311
|
+
while (t > -1 && n !== `'` && r(e, t));
|
|
312
|
+
return t > -1 && (t += i.length, i.length > 1 && (e[t] === n && t++, e[t] === n && t++)), t;
|
|
313
|
+
}
|
|
314
|
+
/*!
|
|
315
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
316
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
317
|
+
*
|
|
318
|
+
* Redistribution and use in source and binary forms, with or without
|
|
319
|
+
* modification, are permitted provided that the following conditions are met:
|
|
320
|
+
*
|
|
321
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
322
|
+
* list of conditions and the following disclaimer.
|
|
323
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
324
|
+
* this list of conditions and the following disclaimer in the
|
|
325
|
+
* documentation and/or other materials provided with the distribution.
|
|
326
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
327
|
+
* may be used to endorse or promote products derived from this software without
|
|
328
|
+
* specific prior written permission.
|
|
329
|
+
*
|
|
330
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
331
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
332
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
333
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
334
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
335
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
336
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
337
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
338
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
339
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
340
|
+
*/
|
|
341
|
+
let l = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
342
|
+
var u = class e extends Date {
|
|
343
|
+
#e = !1;
|
|
344
|
+
#t = !1;
|
|
345
|
+
#n = null;
|
|
346
|
+
constructor(e) {
|
|
347
|
+
let t = !0, n = !0, r = `Z`;
|
|
348
|
+
if (typeof e == `string`) {
|
|
349
|
+
let i = e.match(l);
|
|
350
|
+
i ? (i[1] || (t = !1, e = `0000-01-01T${e}`), n = !!i[2], n && e[10] === ` ` && (e = e.replace(` `, `T`)), i[2] && +i[2] > 23 ? e = `` : (r = i[3] || null, e = e.toUpperCase(), !r && n && (e += `Z`))) : e = ``;
|
|
351
|
+
}
|
|
352
|
+
super(e), isNaN(this.getTime()) || (this.#e = t, this.#t = n, this.#n = r);
|
|
353
|
+
}
|
|
354
|
+
isDateTime() {
|
|
355
|
+
return this.#e && this.#t;
|
|
356
|
+
}
|
|
357
|
+
isLocal() {
|
|
358
|
+
return !this.#e || !this.#t || !this.#n;
|
|
359
|
+
}
|
|
360
|
+
isDate() {
|
|
361
|
+
return this.#e && !this.#t;
|
|
362
|
+
}
|
|
363
|
+
isTime() {
|
|
364
|
+
return this.#t && !this.#e;
|
|
365
|
+
}
|
|
366
|
+
isValid() {
|
|
367
|
+
return this.#e || this.#t;
|
|
368
|
+
}
|
|
369
|
+
toISOString() {
|
|
370
|
+
let e = super.toISOString();
|
|
371
|
+
if (this.isDate()) return e.slice(0, 10);
|
|
372
|
+
if (this.isTime()) return e.slice(11, 23);
|
|
373
|
+
if (this.#n === null) return e.slice(0, -1);
|
|
374
|
+
if (this.#n === `Z`) return e;
|
|
375
|
+
let t = this.#n.slice(1, 3) * 60 + +this.#n.slice(4, 6);
|
|
376
|
+
return t = this.#n[0] === `-` ? t : -t, (/* @__PURE__ */ new Date(this.getTime() - t * 6e4)).toISOString().slice(0, -1) + this.#n;
|
|
377
|
+
}
|
|
378
|
+
static wrapAsOffsetDateTime(t, n = `Z`) {
|
|
379
|
+
let r = new e(t);
|
|
380
|
+
return r.#n = n, r;
|
|
381
|
+
}
|
|
382
|
+
static wrapAsLocalDateTime(t) {
|
|
383
|
+
let n = new e(t);
|
|
384
|
+
return n.#n = null, n;
|
|
385
|
+
}
|
|
386
|
+
static wrapAsLocalDate(t) {
|
|
387
|
+
let n = new e(t);
|
|
388
|
+
return n.#t = !1, n.#n = null, n;
|
|
389
|
+
}
|
|
390
|
+
static wrapAsLocalTime(t) {
|
|
391
|
+
let n = new e(t);
|
|
392
|
+
return n.#e = !1, n.#n = null, n;
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
/*!
|
|
396
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
397
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
398
|
+
*
|
|
399
|
+
* Redistribution and use in source and binary forms, with or without
|
|
400
|
+
* modification, are permitted provided that the following conditions are met:
|
|
401
|
+
*
|
|
402
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
403
|
+
* list of conditions and the following disclaimer.
|
|
404
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
405
|
+
* this list of conditions and the following disclaimer in the
|
|
406
|
+
* documentation and/or other materials provided with the distribution.
|
|
407
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
408
|
+
* may be used to endorse or promote products derived from this software without
|
|
409
|
+
* specific prior written permission.
|
|
410
|
+
*
|
|
411
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
412
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
413
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
414
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
415
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
416
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
417
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
418
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
419
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
420
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
421
|
+
*/
|
|
422
|
+
let d = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/, f = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/, p = /^[+-]?0[0-9_]/, m = /^[0-9a-f]{2,8}$/i, h = {
|
|
423
|
+
b: `\b`,
|
|
424
|
+
t: ` `,
|
|
425
|
+
n: `
|
|
426
|
+
`,
|
|
427
|
+
f: `\f`,
|
|
428
|
+
r: `\r`,
|
|
429
|
+
e: `\x1B`,
|
|
430
|
+
"\"": `"`,
|
|
431
|
+
"\\": `\\`
|
|
432
|
+
};
|
|
433
|
+
function g(e, t = 0, r = e.length) {
|
|
434
|
+
let i = e[t] === `'`, a = e[t++] === e[t] && e[t] === e[t + 1];
|
|
435
|
+
a && (r -= 2, e[t += 2] === `\r` && t++, e[t] === `
|
|
436
|
+
` && t++);
|
|
437
|
+
let s = 0, c, l = ``, u = t;
|
|
438
|
+
for (; t < r - 1;) {
|
|
439
|
+
let r = e[t++];
|
|
440
|
+
if (r === `
|
|
441
|
+
` || r === `\r` && e[t] === `
|
|
442
|
+
`) {
|
|
443
|
+
if (!a) throw new n(`newlines are not allowed in strings`, {
|
|
444
|
+
toml: e,
|
|
445
|
+
ptr: t - 1
|
|
446
|
+
});
|
|
447
|
+
} else if (r < ` ` && r !== ` ` || r === ``) throw new n(`control characters are not allowed in strings`, {
|
|
448
|
+
toml: e,
|
|
449
|
+
ptr: t - 1
|
|
450
|
+
});
|
|
451
|
+
if (c) {
|
|
452
|
+
if (c = !1, r === `x` || r === `u` || r === `U`) {
|
|
453
|
+
let i = e.slice(t, t += r === `x` ? 2 : r === `u` ? 4 : 8);
|
|
454
|
+
if (!m.test(i)) throw new n(`invalid unicode escape`, {
|
|
455
|
+
toml: e,
|
|
456
|
+
ptr: s
|
|
457
|
+
});
|
|
458
|
+
try {
|
|
459
|
+
l += String.fromCodePoint(parseInt(i, 16));
|
|
460
|
+
} catch {
|
|
461
|
+
throw new n(`invalid unicode escape`, {
|
|
462
|
+
toml: e,
|
|
463
|
+
ptr: s
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
} else if (a && (r === `
|
|
467
|
+
` || r === ` ` || r === ` ` || r === `\r`)) {
|
|
468
|
+
if (t = o(e, t - 1, !0), e[t] !== `
|
|
469
|
+
` && e[t] !== `\r`) throw new n(`invalid escape: only line-ending whitespace may be escaped`, {
|
|
470
|
+
toml: e,
|
|
471
|
+
ptr: s
|
|
472
|
+
});
|
|
473
|
+
t = o(e, t);
|
|
474
|
+
} else if (r in h) l += h[r];
|
|
475
|
+
else throw new n(`unrecognized escape sequence`, {
|
|
476
|
+
toml: e,
|
|
477
|
+
ptr: s
|
|
478
|
+
});
|
|
479
|
+
u = t;
|
|
480
|
+
} else !i && r === `\\` && (s = t - 1, c = !0, l += e.slice(u, s));
|
|
481
|
+
}
|
|
482
|
+
return l + e.slice(u, r - 1);
|
|
483
|
+
}
|
|
484
|
+
function _(e, t, r, i) {
|
|
485
|
+
if (e === `true`) return !0;
|
|
486
|
+
if (e === `false`) return !1;
|
|
487
|
+
if (e === `-inf`) return -Infinity;
|
|
488
|
+
if (e === `inf` || e === `+inf`) return Infinity;
|
|
489
|
+
if (e === `nan` || e === `+nan` || e === `-nan`) return NaN;
|
|
490
|
+
if (e === `-0`) return i ? 0n : 0;
|
|
491
|
+
let a = d.test(e);
|
|
492
|
+
if (a || f.test(e)) {
|
|
493
|
+
if (p.test(e)) throw new n(`leading zeroes are not allowed`, {
|
|
494
|
+
toml: t,
|
|
495
|
+
ptr: r
|
|
496
|
+
});
|
|
497
|
+
e = e.replace(/_/g, ``);
|
|
498
|
+
let o = +e;
|
|
499
|
+
if (isNaN(o)) throw new n(`invalid number`, {
|
|
500
|
+
toml: t,
|
|
501
|
+
ptr: r
|
|
502
|
+
});
|
|
503
|
+
if (a) {
|
|
504
|
+
if ((a = !Number.isSafeInteger(o)) && !i) throw new n(`integer value cannot be represented losslessly`, {
|
|
505
|
+
toml: t,
|
|
506
|
+
ptr: r
|
|
507
|
+
});
|
|
508
|
+
(a || i === !0) && (o = BigInt(e));
|
|
509
|
+
}
|
|
510
|
+
return o;
|
|
511
|
+
}
|
|
512
|
+
let o = new u(e);
|
|
513
|
+
if (!o.isValid()) throw new n(`invalid value`, {
|
|
514
|
+
toml: t,
|
|
515
|
+
ptr: r
|
|
516
|
+
});
|
|
517
|
+
return o;
|
|
518
|
+
}
|
|
519
|
+
/*!
|
|
520
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
521
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
522
|
+
*
|
|
523
|
+
* Redistribution and use in source and binary forms, with or without
|
|
524
|
+
* modification, are permitted provided that the following conditions are met:
|
|
525
|
+
*
|
|
526
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
527
|
+
* list of conditions and the following disclaimer.
|
|
528
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
529
|
+
* this list of conditions and the following disclaimer in the
|
|
530
|
+
* documentation and/or other materials provided with the distribution.
|
|
531
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
532
|
+
* may be used to endorse or promote products derived from this software without
|
|
533
|
+
* specific prior written permission.
|
|
534
|
+
*
|
|
535
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
536
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
537
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
538
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
539
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
540
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
541
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
542
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
543
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
544
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
545
|
+
*/
|
|
546
|
+
function v(e, t, n) {
|
|
547
|
+
let r = e.slice(t, n), i = r.indexOf(`#`);
|
|
548
|
+
return i > -1 && (a$1(e, i), r = r.slice(0, i)), [r.trimEnd(), i];
|
|
549
|
+
}
|
|
550
|
+
function y(e, t, r, i, a) {
|
|
551
|
+
if (i === 0) throw new n(`document contains excessively nested structures. aborting.`, {
|
|
552
|
+
toml: e,
|
|
553
|
+
ptr: t
|
|
554
|
+
});
|
|
555
|
+
let l = e[t];
|
|
556
|
+
if (l === `[` || l === `{`) {
|
|
557
|
+
let [s, c] = l === `[` ? C(e, t, i, a) : S(e, t, i, a);
|
|
558
|
+
if (r) {
|
|
559
|
+
if (c = o(e, c), e[c] === `,`) c++;
|
|
560
|
+
else if (e[c] !== r) throw new n(`expected comma or end of structure`, {
|
|
561
|
+
toml: e,
|
|
562
|
+
ptr: c
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
return [s, c];
|
|
566
|
+
}
|
|
567
|
+
let u;
|
|
568
|
+
if (l === `"` || l === `'`) {
|
|
569
|
+
u = c(e, t);
|
|
570
|
+
let i = g(e, t, u);
|
|
571
|
+
if (r) {
|
|
572
|
+
if (u = o(e, u), e[u] && e[u] !== `,` && e[u] !== r && e[u] !== `
|
|
573
|
+
` && e[u] !== `\r`) throw new n(`unexpected character encountered`, {
|
|
574
|
+
toml: e,
|
|
575
|
+
ptr: u
|
|
576
|
+
});
|
|
577
|
+
u += +(e[u] === `,`);
|
|
578
|
+
}
|
|
579
|
+
return [i, u];
|
|
580
|
+
}
|
|
581
|
+
u = s(e, t, `,`, r);
|
|
582
|
+
let d = v(e, t, u - +(e[u - 1] === `,`));
|
|
583
|
+
if (!d[0]) throw new n(`incomplete key-value declaration: no value specified`, {
|
|
584
|
+
toml: e,
|
|
585
|
+
ptr: t
|
|
586
|
+
});
|
|
587
|
+
return r && d[1] > -1 && (u = o(e, t + d[1]), u += +(e[u] === `,`)), [_(d[0], e, t, a), u];
|
|
588
|
+
}
|
|
589
|
+
/*!
|
|
590
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
591
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
592
|
+
*
|
|
593
|
+
* Redistribution and use in source and binary forms, with or without
|
|
594
|
+
* modification, are permitted provided that the following conditions are met:
|
|
595
|
+
*
|
|
596
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
597
|
+
* list of conditions and the following disclaimer.
|
|
598
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
599
|
+
* this list of conditions and the following disclaimer in the
|
|
600
|
+
* documentation and/or other materials provided with the distribution.
|
|
601
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
602
|
+
* may be used to endorse or promote products derived from this software without
|
|
603
|
+
* specific prior written permission.
|
|
604
|
+
*
|
|
605
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
606
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
607
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
608
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
609
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
610
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
611
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
612
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
613
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
614
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
615
|
+
*/
|
|
616
|
+
let b = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
617
|
+
function x(e, t, r = `=`) {
|
|
618
|
+
let a = t - 1, s = [], l = e.indexOf(r, t);
|
|
619
|
+
if (l < 0) throw new n(`incomplete key-value: cannot find end of key`, {
|
|
620
|
+
toml: e,
|
|
621
|
+
ptr: t
|
|
622
|
+
});
|
|
623
|
+
do {
|
|
624
|
+
let o = e[t = ++a];
|
|
625
|
+
if (o !== ` ` && o !== ` `) if (o === `"` || o === `'`) {
|
|
626
|
+
if (o === e[t + 1] && o === e[t + 2]) throw new n(`multiline strings are not allowed in keys`, {
|
|
627
|
+
toml: e,
|
|
628
|
+
ptr: t
|
|
629
|
+
});
|
|
630
|
+
let u = c(e, t);
|
|
631
|
+
if (u < 0) throw new n(`unfinished string encountered`, {
|
|
632
|
+
toml: e,
|
|
633
|
+
ptr: t
|
|
634
|
+
});
|
|
635
|
+
a = e.indexOf(`.`, u);
|
|
636
|
+
let d = e.slice(u, a < 0 || a > l ? l : a), f = i$1(d);
|
|
637
|
+
if (f > -1) throw new n(`newlines are not allowed in keys`, {
|
|
638
|
+
toml: e,
|
|
639
|
+
ptr: t + a + f
|
|
640
|
+
});
|
|
641
|
+
if (d.trimStart()) throw new n(`found extra tokens after the string part`, {
|
|
642
|
+
toml: e,
|
|
643
|
+
ptr: u
|
|
644
|
+
});
|
|
645
|
+
if (l < u && (l = e.indexOf(r, u), l < 0)) throw new n(`incomplete key-value: cannot find end of key`, {
|
|
646
|
+
toml: e,
|
|
647
|
+
ptr: t
|
|
648
|
+
});
|
|
649
|
+
s.push(g(e, t, u));
|
|
650
|
+
} else {
|
|
651
|
+
a = e.indexOf(`.`, t);
|
|
652
|
+
let r = e.slice(t, a < 0 || a > l ? l : a);
|
|
653
|
+
if (!b.test(r)) throw new n(`only letter, numbers, dashes and underscores are allowed in keys`, {
|
|
654
|
+
toml: e,
|
|
655
|
+
ptr: t
|
|
656
|
+
});
|
|
657
|
+
s.push(r.trimEnd());
|
|
658
|
+
}
|
|
659
|
+
} while (a + 1 && a < l);
|
|
660
|
+
return [s, o(e, l + 1, !0, !0)];
|
|
661
|
+
}
|
|
662
|
+
function S(e, t, r, i) {
|
|
663
|
+
let o = {}, s = /* @__PURE__ */ new Set(), c;
|
|
664
|
+
for (t++; (c = e[t++]) !== `}` && c;) if (c === `,`) throw new n(`expected value, found comma`, {
|
|
665
|
+
toml: e,
|
|
666
|
+
ptr: t - 1
|
|
667
|
+
});
|
|
668
|
+
else if (c === `#`) t = a$1(e, t);
|
|
669
|
+
else if (c !== ` ` && c !== ` ` && c !== `
|
|
670
|
+
` && c !== `\r`) {
|
|
671
|
+
let a, c = o, l = !1, [u, d] = x(e, t - 1);
|
|
672
|
+
for (let r = 0; r < u.length; r++) {
|
|
673
|
+
if (r && (c = l ? c[a] : c[a] = {}), a = u[r], (l = Object.hasOwn(c, a)) && (typeof c[a] != `object` || s.has(c[a]))) throw new n(`trying to redefine an already defined value`, {
|
|
674
|
+
toml: e,
|
|
675
|
+
ptr: t
|
|
676
|
+
});
|
|
677
|
+
!l && a === `__proto__` && Object.defineProperty(c, a, {
|
|
678
|
+
enumerable: !0,
|
|
679
|
+
configurable: !0,
|
|
680
|
+
writable: !0
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
if (l) throw new n(`trying to redefine an already defined value`, {
|
|
684
|
+
toml: e,
|
|
685
|
+
ptr: t
|
|
686
|
+
});
|
|
687
|
+
let [f, p] = y(e, d, `}`, r - 1, i);
|
|
688
|
+
s.add(f), c[a] = f, t = p;
|
|
689
|
+
}
|
|
690
|
+
if (!c) throw new n(`unfinished table encountered`, {
|
|
691
|
+
toml: e,
|
|
692
|
+
ptr: t
|
|
693
|
+
});
|
|
694
|
+
return [o, t];
|
|
695
|
+
}
|
|
696
|
+
function C(e, t, r, i) {
|
|
697
|
+
let o = [], s;
|
|
698
|
+
for (t++; (s = e[t++]) !== `]` && s;) if (s === `,`) throw new n(`expected value, found comma`, {
|
|
699
|
+
toml: e,
|
|
700
|
+
ptr: t - 1
|
|
701
|
+
});
|
|
702
|
+
else if (s === `#`) t = a$1(e, t);
|
|
703
|
+
else if (s !== ` ` && s !== ` ` && s !== `
|
|
704
|
+
` && s !== `\r`) {
|
|
705
|
+
let n = y(e, t - 1, `]`, r - 1, i);
|
|
706
|
+
o.push(n[0]), t = n[1];
|
|
707
|
+
}
|
|
708
|
+
if (!s) throw new n(`unfinished array encountered`, {
|
|
709
|
+
toml: e,
|
|
710
|
+
ptr: t
|
|
711
|
+
});
|
|
712
|
+
return [o, t];
|
|
713
|
+
}
|
|
714
|
+
/*!
|
|
715
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
716
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
717
|
+
*
|
|
718
|
+
* Redistribution and use in source and binary forms, with or without
|
|
719
|
+
* modification, are permitted provided that the following conditions are met:
|
|
720
|
+
*
|
|
721
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
722
|
+
* list of conditions and the following disclaimer.
|
|
723
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
724
|
+
* this list of conditions and the following disclaimer in the
|
|
725
|
+
* documentation and/or other materials provided with the distribution.
|
|
726
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
727
|
+
* may be used to endorse or promote products derived from this software without
|
|
728
|
+
* specific prior written permission.
|
|
729
|
+
*
|
|
730
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
731
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
732
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
733
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
734
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
735
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
736
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
737
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
738
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
739
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
740
|
+
*/
|
|
741
|
+
function w(e, t, n, r) {
|
|
742
|
+
let i = t, a = n, o, s = !1, c;
|
|
743
|
+
for (let t = 0; t < e.length; t++) {
|
|
744
|
+
if (t) {
|
|
745
|
+
if (i = s ? i[o] : i[o] = {}, a = (c = a[o]).c, r === 0 && (c.t === 1 || c.t === 2)) return null;
|
|
746
|
+
if (c.t === 2) {
|
|
747
|
+
let e = i.length - 1;
|
|
748
|
+
i = i[e], a = a[e].c;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
if (o = e[t], (s = Object.hasOwn(i, o)) && a[o]?.t === 0 && a[o]?.d) return null;
|
|
752
|
+
s || (o === `__proto__` && (Object.defineProperty(i, o, {
|
|
753
|
+
enumerable: !0,
|
|
754
|
+
configurable: !0,
|
|
755
|
+
writable: !0
|
|
756
|
+
}), Object.defineProperty(a, o, {
|
|
757
|
+
enumerable: !0,
|
|
758
|
+
configurable: !0,
|
|
759
|
+
writable: !0
|
|
760
|
+
})), a[o] = {
|
|
761
|
+
t: t < e.length - 1 && r === 2 ? 3 : r,
|
|
762
|
+
d: !1,
|
|
763
|
+
i: 0,
|
|
764
|
+
c: {}
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
if (c = a[o], c.t !== r && !(r === 1 && c.t === 3) || (r === 2 && (c.d || (c.d = !0, i[o] = []), i[o].push(i = {}), c.c[c.i++] = c = {
|
|
768
|
+
t: 1,
|
|
769
|
+
d: !1,
|
|
770
|
+
i: 0,
|
|
771
|
+
c: {}
|
|
772
|
+
}), c.d)) return null;
|
|
773
|
+
if (c.d = !0, r === 1) i = s ? i[o] : i[o] = {};
|
|
774
|
+
else if (r === 0 && s) return null;
|
|
775
|
+
return [
|
|
776
|
+
o,
|
|
777
|
+
i,
|
|
778
|
+
c.c
|
|
779
|
+
];
|
|
780
|
+
}
|
|
781
|
+
function T(e, { maxDepth: t = 1e3, integersAsBigInt: r } = {}) {
|
|
782
|
+
let i = {}, a = {}, s = i, c = a;
|
|
783
|
+
for (let l = o(e, 0); l < e.length;) {
|
|
784
|
+
if (e[l] === `[`) {
|
|
785
|
+
let t = e[++l] === `[`, r = x(e, l += +t, `]`);
|
|
786
|
+
if (t) {
|
|
787
|
+
if (e[r[1] - 1] !== `]`) throw new n(`expected end of table declaration`, {
|
|
788
|
+
toml: e,
|
|
789
|
+
ptr: r[1] - 1
|
|
790
|
+
});
|
|
791
|
+
r[1]++;
|
|
792
|
+
}
|
|
793
|
+
let o = w(r[0], i, a, t ? 2 : 1);
|
|
794
|
+
if (!o) throw new n(`trying to redefine an already defined table or value`, {
|
|
795
|
+
toml: e,
|
|
796
|
+
ptr: l
|
|
797
|
+
});
|
|
798
|
+
c = o[2], s = o[1], l = r[1];
|
|
799
|
+
} else {
|
|
800
|
+
let i = x(e, l), a = w(i[0], s, c, 0);
|
|
801
|
+
if (!a) throw new n(`trying to redefine an already defined table or value`, {
|
|
802
|
+
toml: e,
|
|
803
|
+
ptr: l
|
|
804
|
+
});
|
|
805
|
+
let o = y(e, i[1], void 0, t, r);
|
|
806
|
+
a[1][a[0]] = o[0], l = o[1];
|
|
807
|
+
}
|
|
808
|
+
if (l = o(e, l, !0), e[l] && e[l] !== `
|
|
809
|
+
` && e[l] !== `\r`) throw new n(`each key-value declaration must be followed by an end-of-line`, {
|
|
810
|
+
toml: e,
|
|
811
|
+
ptr: l
|
|
812
|
+
});
|
|
813
|
+
l = o(e, l);
|
|
814
|
+
}
|
|
815
|
+
return i;
|
|
816
|
+
}
|
|
817
|
+
/*!
|
|
818
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
819
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
820
|
+
*
|
|
821
|
+
* Redistribution and use in source and binary forms, with or without
|
|
822
|
+
* modification, are permitted provided that the following conditions are met:
|
|
823
|
+
*
|
|
824
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
825
|
+
* list of conditions and the following disclaimer.
|
|
826
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
827
|
+
* this list of conditions and the following disclaimer in the
|
|
828
|
+
* documentation and/or other materials provided with the distribution.
|
|
829
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
830
|
+
* may be used to endorse or promote products derived from this software without
|
|
831
|
+
* specific prior written permission.
|
|
832
|
+
*
|
|
833
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
834
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
835
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
836
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
837
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
838
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
839
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
840
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
841
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
842
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
843
|
+
*/
|
|
844
|
+
let E = /^[a-z0-9-_]+$/i;
|
|
845
|
+
function D(e) {
|
|
846
|
+
let t = typeof e;
|
|
847
|
+
if (t === `object`) {
|
|
848
|
+
if (Array.isArray(e)) return `array`;
|
|
849
|
+
if (e instanceof Date) return `date`;
|
|
850
|
+
}
|
|
851
|
+
return t;
|
|
852
|
+
}
|
|
853
|
+
function O(e) {
|
|
854
|
+
for (let t = 0; t < e.length; t++) if (D(e[t]) !== `object`) return !1;
|
|
855
|
+
return e.length != 0;
|
|
856
|
+
}
|
|
857
|
+
function k(e) {
|
|
858
|
+
return JSON.stringify(e).replace(/\x7f/g, `\\u007f`);
|
|
859
|
+
}
|
|
860
|
+
function A(e, t, n, r) {
|
|
861
|
+
if (n === 0) throw Error(`Could not stringify the object: maximum object depth exceeded`);
|
|
862
|
+
if (t === `number`) return isNaN(e) ? `nan` : e === Infinity ? `inf` : e === -Infinity ? `-inf` : r && Number.isInteger(e) ? e.toFixed(1) : e.toString();
|
|
863
|
+
if (t === `bigint` || t === `boolean`) return e.toString();
|
|
864
|
+
if (t === `string`) return k(e);
|
|
865
|
+
if (t === `date`) {
|
|
866
|
+
if (isNaN(e.getTime())) throw TypeError(`cannot serialize invalid date`);
|
|
867
|
+
return e.toISOString();
|
|
868
|
+
}
|
|
869
|
+
if (t === `object`) return j(e, n, r);
|
|
870
|
+
if (t === `array`) return M(e, n, r);
|
|
871
|
+
}
|
|
872
|
+
function j(e, t, n) {
|
|
873
|
+
let r = Object.keys(e);
|
|
874
|
+
if (r.length === 0) return `{}`;
|
|
875
|
+
let i = `{ `;
|
|
876
|
+
for (let a = 0; a < r.length; a++) {
|
|
877
|
+
let o = r[a];
|
|
878
|
+
a && (i += `, `), i += E.test(o) ? o : k(o), i += ` = `, i += A(e[o], D(e[o]), t - 1, n);
|
|
879
|
+
}
|
|
880
|
+
return i + ` }`;
|
|
881
|
+
}
|
|
882
|
+
function M(e, t, n) {
|
|
883
|
+
if (e.length === 0) return `[]`;
|
|
884
|
+
let r = `[ `;
|
|
885
|
+
for (let i = 0; i < e.length; i++) {
|
|
886
|
+
if (i && (r += `, `), e[i] === null || e[i] === void 0) throw TypeError(`arrays cannot contain null or undefined values`);
|
|
887
|
+
r += A(e[i], D(e[i]), t - 1, n);
|
|
888
|
+
}
|
|
889
|
+
return r + ` ]`;
|
|
890
|
+
}
|
|
891
|
+
function N(e, t, n, r) {
|
|
892
|
+
if (n === 0) throw Error(`Could not stringify the object: maximum object depth exceeded`);
|
|
893
|
+
let i = ``;
|
|
894
|
+
for (let a = 0; a < e.length; a++) i += `${i && `
|
|
895
|
+
`}[[${t}]]\n`, i += P(0, e[a], t, n, r);
|
|
896
|
+
return i;
|
|
897
|
+
}
|
|
898
|
+
function P(e, t, n, r, i) {
|
|
899
|
+
if (r === 0) throw Error(`Could not stringify the object: maximum object depth exceeded`);
|
|
900
|
+
let a = ``, o = ``, s = Object.keys(t);
|
|
901
|
+
for (let e = 0; e < s.length; e++) {
|
|
902
|
+
let c = s[e];
|
|
903
|
+
if (t[c] !== null && t[c] !== void 0) {
|
|
904
|
+
let e = D(t[c]);
|
|
905
|
+
if (e === `symbol` || e === `function`) throw TypeError(`cannot serialize values of type '${e}'`);
|
|
906
|
+
let s = E.test(c) ? c : k(c);
|
|
907
|
+
if (e === `array` && O(t[c])) o += (o && `
|
|
908
|
+
`) + N(t[c], n ? `${n}.${s}` : s, r - 1, i);
|
|
909
|
+
else if (e === `object`) {
|
|
910
|
+
let e = n ? `${n}.${s}` : s;
|
|
911
|
+
o += (o && `
|
|
912
|
+
`) + P(e, t[c], e, r - 1, i);
|
|
913
|
+
} else a += s, a += ` = `, a += A(t[c], e, r, i), a += `
|
|
914
|
+
`;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
return e && (a || !o) && (a = a ? `[${e}]\n${a}` : `[${e}]`), a && o ? `${a}\n${o}` : a || o;
|
|
918
|
+
}
|
|
919
|
+
function F(e, { maxDepth: t = 1e3, numbersAsFloat: n = !1 } = {}) {
|
|
920
|
+
if (D(e) !== `object`) throw TypeError(`stringify can only be called with an object`);
|
|
921
|
+
let r = P(0, e, ``, t, n);
|
|
922
|
+
return r[r.length - 1] === `
|
|
923
|
+
` ? r : r + `
|
|
924
|
+
`;
|
|
925
|
+
}
|
|
926
|
+
//#endregion
|
|
927
|
+
//#region ../../node_modules/confbox/dist/toml.mjs
|
|
928
|
+
function i(t) {
|
|
929
|
+
let r = T(t);
|
|
930
|
+
return a$2(t, r, { preserveIndentation: !1 }), r;
|
|
931
|
+
}
|
|
932
|
+
function a(e) {
|
|
933
|
+
let n = o$1(e, { preserveIndentation: !1 }), i = F(e);
|
|
934
|
+
return n.whitespace.start + i + n.whitespace.end;
|
|
935
|
+
}
|
|
936
|
+
//#endregion
|
|
937
|
+
//#region src/tauri.ts
|
|
938
|
+
/**
|
|
939
|
+
* Searches for common cargo paths and resolves to a valid cargo executable path
|
|
940
|
+
* @returns The path to the cargo executable
|
|
941
|
+
* @throws Error if cargo cannot be found
|
|
942
|
+
*/
|
|
943
|
+
async function resolveCargoPath() {
|
|
944
|
+
const cargoBinName = platform() === "win32" ? "cargo.exe" : "cargo";
|
|
945
|
+
const commonPaths = [];
|
|
946
|
+
const currentPlatform = platform();
|
|
947
|
+
const addIfExists = (path) => {
|
|
948
|
+
if (existsSync(path)) commonPaths.push(path);
|
|
949
|
+
};
|
|
950
|
+
const rustupHome = process.env.RUSTUP_HOME || join(homedir(), ".rustup");
|
|
951
|
+
const cargoHome = process.env.CARGO_HOME || join(homedir(), ".cargo");
|
|
952
|
+
if (currentPlatform === "win32") {
|
|
953
|
+
addIfExists(join(rustupHome, "toolchains", "stable-x86_64-pc-windows-msvc", "bin", cargoBinName));
|
|
954
|
+
addIfExists(join(rustupHome, "toolchains", "nightly-x86_64-pc-windows-msvc", "bin", cargoBinName));
|
|
955
|
+
addIfExists(join(cargoHome, "bin", cargoBinName));
|
|
956
|
+
} else if (currentPlatform === "linux") {
|
|
957
|
+
addIfExists(join(rustupHome, "toolchains", "stable-x86_64-unknown-linux-gnu", "bin", cargoBinName));
|
|
958
|
+
addIfExists(join(rustupHome, "toolchains", "nightly-x86_64-unknown-linux-gnu", "bin", cargoBinName));
|
|
959
|
+
addIfExists(join(cargoHome, "bin", cargoBinName));
|
|
960
|
+
addIfExists("/usr/bin/cargo");
|
|
961
|
+
addIfExists("/usr/local/bin/cargo");
|
|
962
|
+
} else if (currentPlatform === "darwin") {
|
|
963
|
+
addIfExists(join(rustupHome, "toolchains", "stable-x86_64-apple-darwin", "bin", cargoBinName));
|
|
964
|
+
addIfExists(join(rustupHome, "toolchains", "nightly-x86_64-apple-darwin", "bin", cargoBinName));
|
|
965
|
+
addIfExists(join(cargoHome, "bin", cargoBinName));
|
|
966
|
+
addIfExists("/usr/local/bin/cargo");
|
|
967
|
+
addIfExists("/opt/homebrew/bin/cargo");
|
|
968
|
+
}
|
|
969
|
+
if (commonPaths.length > 0) return commonPaths[0];
|
|
970
|
+
if (currentPlatform !== "win32") try {
|
|
971
|
+
const cargoPath = (await execa("which", ["cargo"])).stdout.trim();
|
|
972
|
+
if (cargoPath && existsSync(cargoPath)) return cargoPath;
|
|
973
|
+
} catch {}
|
|
974
|
+
throw new Error("Cargo not found. Please install it first");
|
|
975
|
+
}
|
|
976
|
+
const IDMake = "tauri:make";
|
|
977
|
+
const IDPackageV2 = "tauri:package:v2";
|
|
978
|
+
const IDPreview = "tauri:preview";
|
|
979
|
+
const paramsInputFolder = { "input-folder": createPathParam("", {
|
|
980
|
+
label: "Folder to package",
|
|
981
|
+
required: true,
|
|
982
|
+
control: {
|
|
983
|
+
type: "path",
|
|
984
|
+
options: { properties: ["openDirectory"] }
|
|
985
|
+
}
|
|
986
|
+
}) };
|
|
987
|
+
const paramsInputURL = { "input-url": createStringParam("", {
|
|
988
|
+
label: "URL to preview",
|
|
989
|
+
required: true
|
|
990
|
+
}) };
|
|
991
|
+
const params = {
|
|
992
|
+
arch: {
|
|
993
|
+
value: "",
|
|
994
|
+
label: "Architecture",
|
|
995
|
+
required: false,
|
|
996
|
+
control: {
|
|
997
|
+
type: "select",
|
|
998
|
+
options: {
|
|
999
|
+
placeholder: "Architecture",
|
|
1000
|
+
options: [
|
|
1001
|
+
{
|
|
1002
|
+
label: "Older PCs (ia32)",
|
|
1003
|
+
value: "ia32"
|
|
1004
|
+
},
|
|
1005
|
+
{
|
|
1006
|
+
label: "Modern PCs (x64)",
|
|
1007
|
+
value: "x64"
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
label: "Older Mobile/Pi (armv7l)",
|
|
1011
|
+
value: "armv7l"
|
|
1012
|
+
},
|
|
1013
|
+
{
|
|
1014
|
+
label: "New Mobile/Apple Silicon (arm64)",
|
|
1015
|
+
value: "arm64"
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
label: "Mac Universal (universal)",
|
|
1019
|
+
value: "universal"
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
label: "Special Systems (mips64el)",
|
|
1023
|
+
value: "mips64el"
|
|
1024
|
+
}
|
|
1025
|
+
]
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
},
|
|
1029
|
+
platform: {
|
|
1030
|
+
value: "",
|
|
1031
|
+
label: "Platform",
|
|
1032
|
+
required: false,
|
|
1033
|
+
control: {
|
|
1034
|
+
type: "select",
|
|
1035
|
+
options: {
|
|
1036
|
+
placeholder: "Platform",
|
|
1037
|
+
options: [
|
|
1038
|
+
{
|
|
1039
|
+
label: "Windows (win32)",
|
|
1040
|
+
value: "win32"
|
|
1041
|
+
},
|
|
1042
|
+
{
|
|
1043
|
+
label: "macOS (darwin)",
|
|
1044
|
+
value: "darwin"
|
|
1045
|
+
},
|
|
1046
|
+
{
|
|
1047
|
+
label: "Linux (linux)",
|
|
1048
|
+
value: "linux"
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
label: "Android",
|
|
1052
|
+
value: "android"
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
label: "iOS",
|
|
1056
|
+
value: "ios"
|
|
1057
|
+
}
|
|
1058
|
+
]
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
},
|
|
1062
|
+
configuration: {
|
|
1063
|
+
label: "Tauri configuration",
|
|
1064
|
+
value: void 0,
|
|
1065
|
+
required: true,
|
|
1066
|
+
control: { type: "json" }
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
const configureParams = {
|
|
1070
|
+
name: createStringParam("Pipelab", {
|
|
1071
|
+
label: "Application name",
|
|
1072
|
+
description: "The name of the application",
|
|
1073
|
+
required: true
|
|
1074
|
+
}),
|
|
1075
|
+
appBundleId: createStringParam("com.pipelab.app", {
|
|
1076
|
+
label: "Application bundle ID",
|
|
1077
|
+
description: "The bundle ID of the application",
|
|
1078
|
+
required: true
|
|
1079
|
+
}),
|
|
1080
|
+
appCopyright: createStringParam("Copyright © 2024 Pipelab", {
|
|
1081
|
+
label: "Application copyright",
|
|
1082
|
+
description: "The copyright of the application",
|
|
1083
|
+
required: false
|
|
1084
|
+
}),
|
|
1085
|
+
appVersion: createStringParam("1.0.0", {
|
|
1086
|
+
label: "Application version",
|
|
1087
|
+
description: "The version of the application",
|
|
1088
|
+
required: true
|
|
1089
|
+
}),
|
|
1090
|
+
icon: createPathParam("", {
|
|
1091
|
+
label: "Application icon",
|
|
1092
|
+
description: "The icon of the application. macOS: .icns. Windows: .ico",
|
|
1093
|
+
required: false,
|
|
1094
|
+
control: {
|
|
1095
|
+
type: "path",
|
|
1096
|
+
options: { filters: [{
|
|
1097
|
+
name: "Image",
|
|
1098
|
+
extensions: [
|
|
1099
|
+
"png",
|
|
1100
|
+
"jpg",
|
|
1101
|
+
"jpeg",
|
|
1102
|
+
"gif",
|
|
1103
|
+
"bmp",
|
|
1104
|
+
"ico",
|
|
1105
|
+
"icns"
|
|
1106
|
+
]
|
|
1107
|
+
}] },
|
|
1108
|
+
label: "Path to an image file"
|
|
1109
|
+
}
|
|
1110
|
+
}),
|
|
1111
|
+
author: createStringParam("Pipelab", {
|
|
1112
|
+
label: "Application author",
|
|
1113
|
+
description: "The author of the application",
|
|
1114
|
+
required: true
|
|
1115
|
+
}),
|
|
1116
|
+
description: createStringParam("A simple Electron application", {
|
|
1117
|
+
label: "Application description",
|
|
1118
|
+
description: "The description of the application",
|
|
1119
|
+
required: false
|
|
1120
|
+
}),
|
|
1121
|
+
appCategoryType: createStringParam("public.app-category.developer-tools", {
|
|
1122
|
+
platforms: ["darwin"],
|
|
1123
|
+
label: "Application category type",
|
|
1124
|
+
description: "The category type of the application",
|
|
1125
|
+
required: false
|
|
1126
|
+
}),
|
|
1127
|
+
width: createNumberParam(800, {
|
|
1128
|
+
label: "Window width",
|
|
1129
|
+
description: "The width of the window",
|
|
1130
|
+
required: false
|
|
1131
|
+
}),
|
|
1132
|
+
height: createNumberParam(600, {
|
|
1133
|
+
label: "Window height",
|
|
1134
|
+
description: "The height of the window",
|
|
1135
|
+
required: false
|
|
1136
|
+
}),
|
|
1137
|
+
fullscreen: {
|
|
1138
|
+
label: "Fullscreen",
|
|
1139
|
+
value: false,
|
|
1140
|
+
description: "Whether to start the application in fullscreen mode",
|
|
1141
|
+
required: false,
|
|
1142
|
+
control: { type: "boolean" }
|
|
1143
|
+
},
|
|
1144
|
+
frame: {
|
|
1145
|
+
label: "Frame",
|
|
1146
|
+
value: true,
|
|
1147
|
+
description: "Whether to show the window frame",
|
|
1148
|
+
required: false,
|
|
1149
|
+
control: { type: "boolean" }
|
|
1150
|
+
},
|
|
1151
|
+
transparent: {
|
|
1152
|
+
label: "Transparent",
|
|
1153
|
+
value: false,
|
|
1154
|
+
description: "Whether to make the window transparent",
|
|
1155
|
+
required: false,
|
|
1156
|
+
control: { type: "boolean" }
|
|
1157
|
+
},
|
|
1158
|
+
toolbar: {
|
|
1159
|
+
label: "Toolbar",
|
|
1160
|
+
value: true,
|
|
1161
|
+
description: "Whether to show the toolbar",
|
|
1162
|
+
required: false,
|
|
1163
|
+
control: { type: "boolean" }
|
|
1164
|
+
},
|
|
1165
|
+
alwaysOnTop: {
|
|
1166
|
+
label: "Always on top",
|
|
1167
|
+
value: false,
|
|
1168
|
+
description: "Whether to always keep the window on top",
|
|
1169
|
+
required: false,
|
|
1170
|
+
control: { type: "boolean" }
|
|
1171
|
+
},
|
|
1172
|
+
tauriVersion: createStringParam("", {
|
|
1173
|
+
label: "Tauri version",
|
|
1174
|
+
description: "The version of Tauri to use. If no version specified, it will use the latest one.",
|
|
1175
|
+
required: false
|
|
1176
|
+
}),
|
|
1177
|
+
enableExtraLogging: {
|
|
1178
|
+
required: false,
|
|
1179
|
+
label: "Enable extra logging",
|
|
1180
|
+
value: false,
|
|
1181
|
+
control: { type: "boolean" },
|
|
1182
|
+
description: "Whether to enable extra logging of internal tools while bundling"
|
|
1183
|
+
},
|
|
1184
|
+
openDevtoolsOnStart: createBooleanParam(false, {
|
|
1185
|
+
label: "Open devtools on app start",
|
|
1186
|
+
required: false,
|
|
1187
|
+
description: "Whether to open devtools on app start"
|
|
1188
|
+
}),
|
|
1189
|
+
websocketApi: {
|
|
1190
|
+
required: false,
|
|
1191
|
+
label: "WebSocket APIs to allow (empty = all)",
|
|
1192
|
+
value: "[]",
|
|
1193
|
+
control: {
|
|
1194
|
+
type: "array",
|
|
1195
|
+
options: { kind: "text" }
|
|
1196
|
+
}
|
|
1197
|
+
},
|
|
1198
|
+
ignore: createArray(`[
|
|
1199
|
+
// use 'src/app/' as starting point
|
|
1200
|
+
]`, {
|
|
1201
|
+
required: false,
|
|
1202
|
+
label: "Folders to ignore",
|
|
1203
|
+
description: "An array of string or Regex that allow ignoring certain files or folders from being packaged",
|
|
1204
|
+
control: {
|
|
1205
|
+
type: "array",
|
|
1206
|
+
options: { kind: "text" }
|
|
1207
|
+
}
|
|
1208
|
+
}),
|
|
1209
|
+
enableSteamSupport: {
|
|
1210
|
+
required: false,
|
|
1211
|
+
label: "Enable steam support",
|
|
1212
|
+
description: "Whether to enable Steam support",
|
|
1213
|
+
value: false,
|
|
1214
|
+
control: { type: "boolean" }
|
|
1215
|
+
},
|
|
1216
|
+
steamGameId: createNumberParam(480, {
|
|
1217
|
+
required: false,
|
|
1218
|
+
label: "Steam game ID",
|
|
1219
|
+
description: "The Steam game ID"
|
|
1220
|
+
}),
|
|
1221
|
+
enableDiscordSupport: {
|
|
1222
|
+
required: false,
|
|
1223
|
+
label: "Enable Discord support",
|
|
1224
|
+
description: "Whether to enable Discord support",
|
|
1225
|
+
value: false,
|
|
1226
|
+
control: { type: "boolean" }
|
|
1227
|
+
},
|
|
1228
|
+
discordAppId: createStringParam("", {
|
|
1229
|
+
required: false,
|
|
1230
|
+
label: "Discord application ID",
|
|
1231
|
+
description: "The Discord application ID"
|
|
1232
|
+
})
|
|
1233
|
+
};
|
|
1234
|
+
const outputs = {
|
|
1235
|
+
output: {
|
|
1236
|
+
label: "Output",
|
|
1237
|
+
value: "",
|
|
1238
|
+
control: {
|
|
1239
|
+
type: "path",
|
|
1240
|
+
options: { properties: ["openDirectory"] }
|
|
1241
|
+
}
|
|
1242
|
+
},
|
|
1243
|
+
binary: {
|
|
1244
|
+
label: "Binary",
|
|
1245
|
+
value: "",
|
|
1246
|
+
control: {
|
|
1247
|
+
type: "path",
|
|
1248
|
+
options: { properties: ["openFile"] }
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
};
|
|
1252
|
+
const createMakeProps = (id, name, description, icon, displayString) => createAction({
|
|
1253
|
+
id,
|
|
1254
|
+
name,
|
|
1255
|
+
description,
|
|
1256
|
+
icon,
|
|
1257
|
+
displayString,
|
|
1258
|
+
meta: {},
|
|
1259
|
+
params: {
|
|
1260
|
+
...params,
|
|
1261
|
+
...paramsInputFolder
|
|
1262
|
+
},
|
|
1263
|
+
outputs
|
|
1264
|
+
});
|
|
1265
|
+
const createPackageV2Props = (id, name, description, icon, displayString, advanced, deprecated, deprecatedMessage, disabled, updateAvailable) => {
|
|
1266
|
+
const { arch, platform } = params;
|
|
1267
|
+
return createAction({
|
|
1268
|
+
id,
|
|
1269
|
+
name,
|
|
1270
|
+
description,
|
|
1271
|
+
icon,
|
|
1272
|
+
displayString,
|
|
1273
|
+
meta: {},
|
|
1274
|
+
advanced,
|
|
1275
|
+
deprecated,
|
|
1276
|
+
deprecatedMessage,
|
|
1277
|
+
disabled,
|
|
1278
|
+
updateAvailable,
|
|
1279
|
+
params: {
|
|
1280
|
+
arch,
|
|
1281
|
+
platform,
|
|
1282
|
+
...paramsInputFolder,
|
|
1283
|
+
...configureParams
|
|
1284
|
+
},
|
|
1285
|
+
outputs
|
|
1286
|
+
});
|
|
1287
|
+
};
|
|
1288
|
+
const createPreviewProps = (id, name, description, icon, displayString) => createAction({
|
|
1289
|
+
id,
|
|
1290
|
+
name,
|
|
1291
|
+
description,
|
|
1292
|
+
icon,
|
|
1293
|
+
displayString,
|
|
1294
|
+
meta: {},
|
|
1295
|
+
params: {
|
|
1296
|
+
...params,
|
|
1297
|
+
...paramsInputURL
|
|
1298
|
+
},
|
|
1299
|
+
outputs
|
|
1300
|
+
});
|
|
1301
|
+
const tauri = async (action, appFolder, { cwd, log, inputs, setOutput, paths, abortSignal, context }, completeConfiguration) => {
|
|
1302
|
+
console.log("appFolder", appFolder);
|
|
1303
|
+
log("Building tauri");
|
|
1304
|
+
if (action !== "preview") await detectRuntime(appFolder);
|
|
1305
|
+
const { modules, cache, node } = paths;
|
|
1306
|
+
const destinationFolder = join(cwd, "build");
|
|
1307
|
+
await cp(join(await fetchPipelabAsset("@pipelab/asset-tauri", "^1.0.0", { context }), "template"), destinationFolder, {
|
|
1308
|
+
recursive: true,
|
|
1309
|
+
filter: (src) => {
|
|
1310
|
+
return basename(src) !== "node_modules" && !src.includes("src-tauri\\target") && !src.includes("src-tauri\\gen");
|
|
1311
|
+
}
|
|
1312
|
+
});
|
|
1313
|
+
const placeAppFolder = join(destinationFolder, "src", "app");
|
|
1314
|
+
if (appFolder && action !== "preview") await cp(appFolder, placeAppFolder, { recursive: true });
|
|
1315
|
+
writeFile$1(join(destinationFolder, "config.cjs"), `module.exports = ${JSON.stringify(completeConfiguration, void 0, 2)}`, "utf8");
|
|
1316
|
+
const sanitizedName = kebabCase(completeConfiguration.name);
|
|
1317
|
+
log("Package.json update");
|
|
1318
|
+
const pkgJSONPath = join(destinationFolder, "package.json");
|
|
1319
|
+
const pkgJSONContent = await readFile(pkgJSONPath, "utf8");
|
|
1320
|
+
const pkgJSON = JSON.parse(pkgJSONContent);
|
|
1321
|
+
log("Setting name to", sanitizedName);
|
|
1322
|
+
pkgJSON.name = sanitizedName;
|
|
1323
|
+
log("Setting productName to", completeConfiguration.name);
|
|
1324
|
+
pkgJSON.productName = completeConfiguration.name;
|
|
1325
|
+
await writeFile(pkgJSONPath, JSON.stringify(pkgJSON, null, 2));
|
|
1326
|
+
log("Cargo.toml update");
|
|
1327
|
+
const cargoTomlPath = join(destinationFolder, "src-tauri", "Cargo.toml");
|
|
1328
|
+
const cargoToml = i(await readFile$1(cargoTomlPath, "utf8"));
|
|
1329
|
+
log("Setting name to", sanitizedName);
|
|
1330
|
+
console.log("cargoToml", cargoToml);
|
|
1331
|
+
cargoToml.name = sanitizedName;
|
|
1332
|
+
log("Setting version to", completeConfiguration.appVersion);
|
|
1333
|
+
cargoToml.version = completeConfiguration.appVersion;
|
|
1334
|
+
console.log("cargoToml", a(cargoToml));
|
|
1335
|
+
await writeFile$1(cargoTomlPath, a(cargoToml));
|
|
1336
|
+
log("Tauri.conf.json update");
|
|
1337
|
+
const tauriConfJSONPath = join(destinationFolder, "src-tauri", "tauri.conf.json");
|
|
1338
|
+
const tauriConfJSONContent = await readFile(tauriConfJSONPath, "utf8");
|
|
1339
|
+
const tauriConfJSON = JSON.parse(tauriConfJSONContent);
|
|
1340
|
+
log("Setting productName to", completeConfiguration.name);
|
|
1341
|
+
tauriConfJSON.productName = completeConfiguration.name;
|
|
1342
|
+
log("Setting version to", completeConfiguration.appVersion);
|
|
1343
|
+
tauriConfJSON.version = completeConfiguration.appVersion;
|
|
1344
|
+
log("Setting identifier to", completeConfiguration.appBundleId);
|
|
1345
|
+
tauriConfJSON.identifier = completeConfiguration.appBundleId;
|
|
1346
|
+
if (action === "preview") {
|
|
1347
|
+
log("Setting build.devUrl to", appFolder);
|
|
1348
|
+
tauriConfJSON.build.devUrl = appFolder;
|
|
1349
|
+
await writeFile$1(tauriConfJSONPath, JSON.stringify(tauriConfJSON, null, 2));
|
|
1350
|
+
}
|
|
1351
|
+
log("Installing packages");
|
|
1352
|
+
const { all } = await runPnpm(destinationFolder, {
|
|
1353
|
+
signal: abortSignal,
|
|
1354
|
+
context
|
|
1355
|
+
});
|
|
1356
|
+
if (all) log(all);
|
|
1357
|
+
const inputPlatform = inputs.platform === "" ? void 0 : inputs.platform;
|
|
1358
|
+
const inputArch = inputs.arch === "" ? void 0 : inputs.arch;
|
|
1359
|
+
try {
|
|
1360
|
+
log("typeof inputs.platform", typeof inputs.platform);
|
|
1361
|
+
const finalPlatform = inputPlatform ?? platform();
|
|
1362
|
+
log("finalPlatform", finalPlatform);
|
|
1363
|
+
const finalArch = inputArch ?? arch();
|
|
1364
|
+
log("finalArch", finalArch);
|
|
1365
|
+
let tauriPlatform = "";
|
|
1366
|
+
if (finalPlatform === "win32") tauriPlatform = "pc-windows-msvc";
|
|
1367
|
+
else if (finalPlatform === "linux") tauriPlatform = "unknown-linux-gnu";
|
|
1368
|
+
else throw new Error("Unsupported platform");
|
|
1369
|
+
let tauriArch = "";
|
|
1370
|
+
if (finalArch === "x64") tauriArch = "x86_64";
|
|
1371
|
+
else throw new Error("Unsupported arch");
|
|
1372
|
+
const target = `${tauriArch}-${tauriPlatform}`;
|
|
1373
|
+
const cargo = await resolveCargoPath();
|
|
1374
|
+
const cargoBinDir = dirname(cargo);
|
|
1375
|
+
log("cargoBinDir", cargoBinDir);
|
|
1376
|
+
console.log("cargo", cargo);
|
|
1377
|
+
log("destinationFolder", destinationFolder);
|
|
1378
|
+
const cargoTargetDir = join(cache, "cargo", "target", completeConfiguration.appBundleId);
|
|
1379
|
+
const cargoOutputPath = join(cargoTargetDir, target, "release");
|
|
1380
|
+
log("cargoTargetDir", cargoTargetDir);
|
|
1381
|
+
log("cargoOutputPath", cargoOutputPath);
|
|
1382
|
+
log("Starting compiling");
|
|
1383
|
+
await runWithLiveLogs(cargo, [
|
|
1384
|
+
"install",
|
|
1385
|
+
"tauri-cli",
|
|
1386
|
+
"--version",
|
|
1387
|
+
"^2.0.0",
|
|
1388
|
+
"--locked"
|
|
1389
|
+
], {
|
|
1390
|
+
cwd: join(destinationFolder, "src-tauri"),
|
|
1391
|
+
env: {
|
|
1392
|
+
...process.env,
|
|
1393
|
+
DEBUG: completeConfiguration.enableExtraLogging ? "*" : "",
|
|
1394
|
+
ELECTRON_NO_ASAR: "1",
|
|
1395
|
+
CARGO_TARGET_DIR: cargoTargetDir,
|
|
1396
|
+
PATH: `${cargoBinDir}${delimiter}${dirname(node)}${delimiter}${process.env.PATH}`
|
|
1397
|
+
},
|
|
1398
|
+
cancelSignal: abortSignal
|
|
1399
|
+
}, log, {
|
|
1400
|
+
onStderr(data) {
|
|
1401
|
+
if (!process.env.CI) log(data);
|
|
1402
|
+
},
|
|
1403
|
+
onStdout(data) {
|
|
1404
|
+
if (!process.env.CI) log(data);
|
|
1405
|
+
}
|
|
1406
|
+
});
|
|
1407
|
+
if (action === "preview") await runWithLiveLogs(cargo, [
|
|
1408
|
+
"tauri",
|
|
1409
|
+
"dev",
|
|
1410
|
+
"--target",
|
|
1411
|
+
target
|
|
1412
|
+
], {
|
|
1413
|
+
cwd: join(destinationFolder, "src-tauri"),
|
|
1414
|
+
env: {
|
|
1415
|
+
...process.env,
|
|
1416
|
+
DEBUG: completeConfiguration.enableExtraLogging ? "*" : "",
|
|
1417
|
+
ELECTRON_NO_ASAR: "1",
|
|
1418
|
+
CARGO_TARGET_DIR: cargoTargetDir,
|
|
1419
|
+
PATH: `${cargoBinDir}${delimiter}${dirname(node)}${delimiter}${process.env.PATH}`
|
|
1420
|
+
},
|
|
1421
|
+
cancelSignal: abortSignal
|
|
1422
|
+
}, log, {
|
|
1423
|
+
onStderr(data) {
|
|
1424
|
+
log(data);
|
|
1425
|
+
},
|
|
1426
|
+
onStdout(data) {
|
|
1427
|
+
log(data);
|
|
1428
|
+
}
|
|
1429
|
+
});
|
|
1430
|
+
else {
|
|
1431
|
+
await runWithLiveLogs(cargo, [
|
|
1432
|
+
"tauri",
|
|
1433
|
+
"build",
|
|
1434
|
+
"--target",
|
|
1435
|
+
target,
|
|
1436
|
+
"--no-bundle"
|
|
1437
|
+
], {
|
|
1438
|
+
cwd: join(destinationFolder, "src-tauri"),
|
|
1439
|
+
env: {
|
|
1440
|
+
...process.env,
|
|
1441
|
+
DEBUG: completeConfiguration.enableExtraLogging ? "*" : "",
|
|
1442
|
+
ELECTRON_NO_ASAR: "1",
|
|
1443
|
+
CARGO_TARGET_DIR: cargoTargetDir,
|
|
1444
|
+
PATH: `${cargoBinDir}${delimiter}${dirname(node)}${delimiter}${process.env.PATH}`
|
|
1445
|
+
},
|
|
1446
|
+
cancelSignal: abortSignal
|
|
1447
|
+
}, log, {
|
|
1448
|
+
onStderr(data) {
|
|
1449
|
+
if (!process.env.CI) log(data);
|
|
1450
|
+
},
|
|
1451
|
+
onStdout(data) {
|
|
1452
|
+
if (!process.env.CI) log(data);
|
|
1453
|
+
}
|
|
1454
|
+
});
|
|
1455
|
+
if (action === "make") await runWithLiveLogs(cargo, [
|
|
1456
|
+
"tauri",
|
|
1457
|
+
"bundle",
|
|
1458
|
+
"--",
|
|
1459
|
+
"--bundles",
|
|
1460
|
+
"appimage"
|
|
1461
|
+
], {
|
|
1462
|
+
cwd: join(destinationFolder, "src-tauri"),
|
|
1463
|
+
env: {
|
|
1464
|
+
DEBUG: completeConfiguration.enableExtraLogging ? "*" : "",
|
|
1465
|
+
ELECTRON_NO_ASAR: "1",
|
|
1466
|
+
CARGO_TARGET_DIR: cargoTargetDir,
|
|
1467
|
+
PATH: `${cargoBinDir}${delimiter}${dirname(node)}${delimiter}${process.env.PATH}`
|
|
1468
|
+
},
|
|
1469
|
+
cancelSignal: abortSignal
|
|
1470
|
+
}, log, {
|
|
1471
|
+
onStderr(data) {
|
|
1472
|
+
log(data);
|
|
1473
|
+
},
|
|
1474
|
+
onStdout(data) {
|
|
1475
|
+
log(data);
|
|
1476
|
+
}
|
|
1477
|
+
});
|
|
1478
|
+
}
|
|
1479
|
+
if (action === "package") {
|
|
1480
|
+
const binName = getBinName(sanitizedName);
|
|
1481
|
+
log("cargoOutputPath", cargoOutputPath);
|
|
1482
|
+
setOutput("output", cargoOutputPath);
|
|
1483
|
+
setOutput("binary", join(cargoOutputPath, binName));
|
|
1484
|
+
return {
|
|
1485
|
+
folder: cargoOutputPath,
|
|
1486
|
+
binary: join(cargoOutputPath, binName)
|
|
1487
|
+
};
|
|
1488
|
+
} else if (action === "make") throw new Error("Unsupported action");
|
|
1489
|
+
else if (action === "preview") {} else throw new Error("Unsupported action");
|
|
1490
|
+
} catch (e) {
|
|
1491
|
+
if (e instanceof Error) {
|
|
1492
|
+
if (e.name === "RequestError") log("Request error");
|
|
1493
|
+
if (e.name === "RequestError") log("Request error");
|
|
1494
|
+
throw e;
|
|
1495
|
+
}
|
|
1496
|
+
log(e);
|
|
1497
|
+
return;
|
|
1498
|
+
}
|
|
1499
|
+
};
|
|
1500
|
+
//#endregion
|
|
1501
|
+
//#region src/utils.ts
|
|
1502
|
+
const defaultTauriConfig = {
|
|
1503
|
+
alwaysOnTop: false,
|
|
1504
|
+
appBundleId: "com.pipelab.app",
|
|
1505
|
+
appCategoryType: "",
|
|
1506
|
+
appCopyright: "Copyright © 2024 Pipelab",
|
|
1507
|
+
appVersion: "1.0.0",
|
|
1508
|
+
author: "Pipelab",
|
|
1509
|
+
description: "A simple Electron application",
|
|
1510
|
+
tauriVersion: "",
|
|
1511
|
+
enableExtraLogging: false,
|
|
1512
|
+
clearServiceWorkerOnBoot: false,
|
|
1513
|
+
frame: true,
|
|
1514
|
+
fullscreen: false,
|
|
1515
|
+
icon: "",
|
|
1516
|
+
height: 600,
|
|
1517
|
+
name: "Pipelab",
|
|
1518
|
+
toolbar: true,
|
|
1519
|
+
transparent: false,
|
|
1520
|
+
width: 800,
|
|
1521
|
+
enableSteamSupport: false,
|
|
1522
|
+
steamGameId: 480,
|
|
1523
|
+
enableDiscordSupport: false,
|
|
1524
|
+
discordAppId: "",
|
|
1525
|
+
ignore: [],
|
|
1526
|
+
backgroundColor: "#FFF",
|
|
1527
|
+
openDevtoolsOnStart: false
|
|
1528
|
+
};
|
|
1529
|
+
//#endregion
|
|
1530
|
+
//#region src/make.ts
|
|
1531
|
+
const makeRunner = createActionRunner(async (options) => {
|
|
1532
|
+
const appFolder = options.inputs["input-folder"];
|
|
1533
|
+
if (!options.inputs.configuration) throw new Error("Missing tauri configuration");
|
|
1534
|
+
await tauri("make", appFolder, options, merge(defaultTauriConfig, options.inputs.configuration));
|
|
1535
|
+
});
|
|
1536
|
+
//#endregion
|
|
1537
|
+
//#region src/preview.ts
|
|
1538
|
+
const previewRunner = createActionRunner(async (options) => {
|
|
1539
|
+
const url = options.inputs["input-url"];
|
|
1540
|
+
if (url === "") throw new Error("URL can't be empty");
|
|
1541
|
+
if (!options.inputs.configuration) throw new Error("Missing tauri configuration");
|
|
1542
|
+
const completeConfiguration = merge(defaultTauriConfig, {
|
|
1543
|
+
alwaysOnTop: options.inputs.configuration["alwaysOnTop"],
|
|
1544
|
+
appBundleId: options.inputs.configuration["appBundleId"],
|
|
1545
|
+
appCategoryType: options.inputs.configuration["appCategoryType"],
|
|
1546
|
+
appCopyright: options.inputs.configuration["appCopyright"],
|
|
1547
|
+
appVersion: options.inputs.configuration["appVersion"],
|
|
1548
|
+
author: options.inputs.configuration["author"],
|
|
1549
|
+
description: options.inputs.configuration["description"],
|
|
1550
|
+
tauriVersion: options.inputs.configuration["tauriVersion"],
|
|
1551
|
+
enableExtraLogging: options.inputs.configuration["enableExtraLogging"],
|
|
1552
|
+
clearServiceWorkerOnBoot: options.inputs.configuration["clearServiceWorkerOnBoot"],
|
|
1553
|
+
frame: options.inputs.configuration["frame"],
|
|
1554
|
+
fullscreen: options.inputs.configuration["fullscreen"],
|
|
1555
|
+
icon: options.inputs.configuration["icon"],
|
|
1556
|
+
height: options.inputs.configuration["height"],
|
|
1557
|
+
name: options.inputs.configuration["name"],
|
|
1558
|
+
toolbar: options.inputs.configuration["toolbar"],
|
|
1559
|
+
transparent: options.inputs.configuration["transparent"],
|
|
1560
|
+
width: options.inputs.configuration["width"],
|
|
1561
|
+
enableSteamSupport: options.inputs.configuration["enableSteamSupport"],
|
|
1562
|
+
steamGameId: options.inputs.configuration["steamGameId"],
|
|
1563
|
+
ignore: options.inputs.configuration["ignore"],
|
|
1564
|
+
openDevtoolsOnStart: options.inputs.configuration["openDevtoolsOnStart"],
|
|
1565
|
+
enableDiscordSupport: options.inputs.configuration["enableDiscordSupport"],
|
|
1566
|
+
discordAppId: options.inputs.configuration["discordAppId"],
|
|
1567
|
+
customPackages: options.inputs.configuration["customPackages"],
|
|
1568
|
+
backgroundColor: options.inputs.configuration["backgroundColor"]
|
|
1569
|
+
});
|
|
1570
|
+
console.log("completeConfiguration", completeConfiguration);
|
|
1571
|
+
await tauri("preview", url, options, completeConfiguration);
|
|
1572
|
+
});
|
|
1573
|
+
//#endregion
|
|
1574
|
+
//#region src/configure.ts
|
|
1575
|
+
const props = createAction({
|
|
1576
|
+
id: "tauri:configure",
|
|
1577
|
+
description: "Configure tauri",
|
|
1578
|
+
displayString: "'Configure Tauri'",
|
|
1579
|
+
icon: "",
|
|
1580
|
+
meta: {},
|
|
1581
|
+
name: "Configure Tauri",
|
|
1582
|
+
advanced: true,
|
|
1583
|
+
outputs: { configuration: {
|
|
1584
|
+
label: "Configuration",
|
|
1585
|
+
value: {}
|
|
1586
|
+
} },
|
|
1587
|
+
params: configureParams
|
|
1588
|
+
});
|
|
1589
|
+
const configureRunner = createActionRunner(async ({ setOutput, inputs }) => {
|
|
1590
|
+
setOutput("configuration", inputs);
|
|
1591
|
+
});
|
|
1592
|
+
//#endregion
|
|
1593
|
+
//#region src/package.ts
|
|
1594
|
+
const packageV2Runner = createActionRunner(async (options) => {
|
|
1595
|
+
const appFolder = options.inputs["input-folder"];
|
|
1596
|
+
const completeConfiguration = merge(defaultTauriConfig, {
|
|
1597
|
+
alwaysOnTop: options.inputs["alwaysOnTop"],
|
|
1598
|
+
appBundleId: options.inputs["appBundleId"],
|
|
1599
|
+
appCategoryType: options.inputs["appCategoryType"],
|
|
1600
|
+
appCopyright: options.inputs["appCopyright"],
|
|
1601
|
+
appVersion: options.inputs["appVersion"],
|
|
1602
|
+
author: options.inputs["author"],
|
|
1603
|
+
description: options.inputs["description"],
|
|
1604
|
+
tauriVersion: options.inputs["tauriVersion"],
|
|
1605
|
+
enableExtraLogging: options.inputs["enableExtraLogging"],
|
|
1606
|
+
clearServiceWorkerOnBoot: options.inputs["clearServiceWorkerOnBoot"],
|
|
1607
|
+
frame: options.inputs["frame"],
|
|
1608
|
+
fullscreen: options.inputs["fullscreen"],
|
|
1609
|
+
icon: options.inputs["icon"],
|
|
1610
|
+
height: options.inputs["height"],
|
|
1611
|
+
name: options.inputs["name"],
|
|
1612
|
+
toolbar: options.inputs["toolbar"],
|
|
1613
|
+
transparent: options.inputs["transparent"],
|
|
1614
|
+
width: options.inputs["width"],
|
|
1615
|
+
enableSteamSupport: options.inputs["enableSteamSupport"],
|
|
1616
|
+
steamGameId: options.inputs["steamGameId"],
|
|
1617
|
+
ignore: options.inputs["ignore"],
|
|
1618
|
+
openDevtoolsOnStart: options.inputs["openDevtoolsOnStart"],
|
|
1619
|
+
enableDiscordSupport: options.inputs["enableDiscordSupport"],
|
|
1620
|
+
discordAppId: options.inputs["discordAppId"],
|
|
1621
|
+
customPackages: options.inputs["customPackages"],
|
|
1622
|
+
backgroundColor: options.inputs["backgroundColor"]
|
|
1623
|
+
});
|
|
1624
|
+
console.log("completeConfiguration", completeConfiguration);
|
|
1625
|
+
await tauri("package", appFolder, options, completeConfiguration);
|
|
1626
|
+
});
|
|
1627
|
+
//#endregion
|
|
1628
|
+
//#region src/index.ts
|
|
1629
|
+
const icon = new URL("./public/tauri.webp", import.meta.url).href;
|
|
1630
|
+
var src_default = createNodeDefinition({
|
|
1631
|
+
description: "Tauri",
|
|
1632
|
+
name: "Tauri",
|
|
1633
|
+
id: "tauri",
|
|
1634
|
+
icon: {
|
|
1635
|
+
type: "image",
|
|
1636
|
+
image: icon
|
|
1637
|
+
},
|
|
1638
|
+
nodes: [
|
|
1639
|
+
{
|
|
1640
|
+
node: createMakeProps(IDMake, "Create Installer", "Create a distributable installer for your chosen platform", "", "`Build package for ${fmt.param(params['input-folder'], 'primary', 'Input folder not set')}`"),
|
|
1641
|
+
runner: makeRunner
|
|
1642
|
+
},
|
|
1643
|
+
{
|
|
1644
|
+
node: createPackageV2Props(IDPackageV2, "Package app with configuration", "Gather all necessary files and prepare your app for distribution, creating a platform-specific bundle.", "", "`Package app from ${fmt.param(params['input-folder'], 'primary', 'Input folder not set')}`", false, false, void 0, false, false),
|
|
1645
|
+
runner: packageV2Runner
|
|
1646
|
+
},
|
|
1647
|
+
{
|
|
1648
|
+
node: createPreviewProps(IDPreview, "Preview app", "Package and preview your app from an URL", "", "`Preview app from ${fmt.param(params['input-url'], 'primary', 'Input folder not set')}`"),
|
|
1649
|
+
runner: previewRunner
|
|
1650
|
+
},
|
|
1651
|
+
{
|
|
1652
|
+
node: props,
|
|
1653
|
+
runner: configureRunner
|
|
1654
|
+
}
|
|
1655
|
+
]
|
|
1656
|
+
});
|
|
1657
|
+
//#endregion
|
|
1658
|
+
export { src_default as default };
|
|
1659
|
+
|
|
1660
|
+
//# sourceMappingURL=index.mjs.map
|