@steambrew/ttc 3.2.3 → 3.2.5
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/index.js +281 -43
- package/package.json +2 -2
- package/rollup.config.js +6 -1
- package/src/check-health.ts +30 -0
- package/src/index.ts +31 -1
- package/src/logger.ts +34 -2
- package/src/plugin-api.ts +30 -0
- package/src/plugin-json.d.ts +30 -0
- package/src/query-parser.ts +30 -0
- package/src/static-embed.ts +78 -44
- package/src/transpiler.ts +31 -1
- package/src/version-control.ts +30 -0
- package/.claude/settings.local.json +0 -10
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin / env node
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import fs, { readFileSync, existsSync, readFile as readFile$1 } from 'fs';
|
|
4
4
|
import path, { dirname } from 'path';
|
|
@@ -28,6 +28,35 @@ import * as glob from 'glob';
|
|
|
28
28
|
import MagicString from 'magic-string';
|
|
29
29
|
import _traverse from '@babel/traverse';
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* ==================================================
|
|
33
|
+
* _____ _ _ _ _
|
|
34
|
+
* | |_| | |___ ___ ___|_|_ _ _____
|
|
35
|
+
* | | | | | | | -_| | | | | | |
|
|
36
|
+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
|
|
37
|
+
*
|
|
38
|
+
* ==================================================
|
|
39
|
+
*
|
|
40
|
+
* Copyright (c) 2026 Project Millennium
|
|
41
|
+
*
|
|
42
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
43
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
44
|
+
* in the Software without restriction, including without limitation the rights
|
|
45
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
46
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
47
|
+
* furnished to do so, subject to the following conditions:
|
|
48
|
+
*
|
|
49
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
50
|
+
* copies or substantial portions of the Software.
|
|
51
|
+
*
|
|
52
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
53
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
54
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
55
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
56
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
57
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
58
|
+
* SOFTWARE.
|
|
59
|
+
*/
|
|
31
60
|
const version = JSON.parse(readFileSync(path.resolve(dirname(fileURLToPath(import.meta.url)), '../package.json'), 'utf8')).version;
|
|
32
61
|
const Logger = {
|
|
33
62
|
warn(message, loc) {
|
|
@@ -52,14 +81,14 @@ const Logger = {
|
|
|
52
81
|
},
|
|
53
82
|
done({ elapsedMs, buildType, sysfsCount, envCount }) {
|
|
54
83
|
const elapsed = `${(elapsedMs / 1000).toFixed(2)}s`;
|
|
55
|
-
const meta = [`ttc v${version}`];
|
|
84
|
+
const meta = [`ttc v${version} (${"17fd3c99"})`];
|
|
56
85
|
if (buildType === 'dev')
|
|
57
86
|
meta.push('no type checking');
|
|
58
87
|
if (sysfsCount)
|
|
59
88
|
meta.push(`${sysfsCount} bundled file${sysfsCount > 1 ? 's' : ''}`);
|
|
60
89
|
if (envCount)
|
|
61
90
|
meta.push(`${envCount} env var${envCount > 1 ? 's' : ''}`);
|
|
62
|
-
console.log(`${chalk.green('Finished')} ${buildType} in ${elapsed} ` + chalk.dim(
|
|
91
|
+
console.log(`${chalk.green('Finished')} ${buildType} in ${elapsed} ` + chalk.dim(meta.join(', ')));
|
|
63
92
|
},
|
|
64
93
|
failed({ elapsedMs, buildType }) {
|
|
65
94
|
const elapsed = `${(elapsedMs / 1000).toFixed(2)}s`;
|
|
@@ -67,6 +96,35 @@ const Logger = {
|
|
|
67
96
|
},
|
|
68
97
|
};
|
|
69
98
|
|
|
99
|
+
/**
|
|
100
|
+
* ==================================================
|
|
101
|
+
* _____ _ _ _ _
|
|
102
|
+
* | |_| | |___ ___ ___|_|_ _ _____
|
|
103
|
+
* | | | | | | | -_| | | | | | |
|
|
104
|
+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
|
|
105
|
+
*
|
|
106
|
+
* ==================================================
|
|
107
|
+
*
|
|
108
|
+
* Copyright (c) 2026 Project Millennium
|
|
109
|
+
*
|
|
110
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
111
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
112
|
+
* in the Software without restriction, including without limitation the rights
|
|
113
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
114
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
115
|
+
* furnished to do so, subject to the following conditions:
|
|
116
|
+
*
|
|
117
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
118
|
+
* copies or substantial portions of the Software.
|
|
119
|
+
*
|
|
120
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
121
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
122
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
123
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
124
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
125
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
126
|
+
* SOFTWARE.
|
|
127
|
+
*/
|
|
70
128
|
const PrintParamHelp = () => {
|
|
71
129
|
console.log([
|
|
72
130
|
'',
|
|
@@ -135,6 +193,35 @@ const ValidateParameters = (args) => {
|
|
|
135
193
|
};
|
|
136
194
|
};
|
|
137
195
|
|
|
196
|
+
/**
|
|
197
|
+
* ==================================================
|
|
198
|
+
* _____ _ _ _ _
|
|
199
|
+
* | |_| | |___ ___ ___|_|_ _ _____
|
|
200
|
+
* | | | | | | | -_| | | | | | |
|
|
201
|
+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
|
|
202
|
+
*
|
|
203
|
+
* ==================================================
|
|
204
|
+
*
|
|
205
|
+
* Copyright (c) 2026 Project Millennium
|
|
206
|
+
*
|
|
207
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
208
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
209
|
+
* in the Software without restriction, including without limitation the rights
|
|
210
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
211
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
212
|
+
* furnished to do so, subject to the following conditions:
|
|
213
|
+
*
|
|
214
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
215
|
+
* copies or substantial portions of the Software.
|
|
216
|
+
*
|
|
217
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
218
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
219
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
220
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
221
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
222
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
223
|
+
* SOFTWARE.
|
|
224
|
+
*/
|
|
138
225
|
async function fileExists(filePath) {
|
|
139
226
|
return access(filePath).then(() => true).catch(() => false);
|
|
140
227
|
}
|
|
@@ -182,6 +269,35 @@ const CheckForUpdates = async () => {
|
|
|
182
269
|
return false;
|
|
183
270
|
};
|
|
184
271
|
|
|
272
|
+
/**
|
|
273
|
+
* ==================================================
|
|
274
|
+
* _____ _ _ _ _
|
|
275
|
+
* | |_| | |___ ___ ___|_|_ _ _____
|
|
276
|
+
* | | | | | | | -_| | | | | | |
|
|
277
|
+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
|
|
278
|
+
*
|
|
279
|
+
* ==================================================
|
|
280
|
+
*
|
|
281
|
+
* Copyright (c) 2026 Project Millennium
|
|
282
|
+
*
|
|
283
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
284
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
285
|
+
* in the Software without restriction, including without limitation the rights
|
|
286
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
287
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
288
|
+
* furnished to do so, subject to the following conditions:
|
|
289
|
+
*
|
|
290
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
291
|
+
* copies or substantial portions of the Software.
|
|
292
|
+
*
|
|
293
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
294
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
295
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
296
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
297
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
298
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
299
|
+
* SOFTWARE.
|
|
300
|
+
*/
|
|
185
301
|
const ValidatePlugin = (bIsMillennium, target) => {
|
|
186
302
|
return new Promise((resolve, reject) => {
|
|
187
303
|
if (!existsSync(target)) {
|
|
@@ -229,6 +345,35 @@ const ValidatePlugin = (bIsMillennium, target) => {
|
|
|
229
345
|
});
|
|
230
346
|
};
|
|
231
347
|
|
|
348
|
+
/**
|
|
349
|
+
* ==================================================
|
|
350
|
+
* _____ _ _ _ _
|
|
351
|
+
* | |_| | |___ ___ ___|_|_ _ _____
|
|
352
|
+
* | | | | | | | -_| | | | | | |
|
|
353
|
+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
|
|
354
|
+
*
|
|
355
|
+
* ==================================================
|
|
356
|
+
*
|
|
357
|
+
* Copyright (c) 2026 Project Millennium
|
|
358
|
+
*
|
|
359
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
360
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
361
|
+
* in the Software without restriction, including without limitation the rights
|
|
362
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
363
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
364
|
+
* furnished to do so, subject to the following conditions:
|
|
365
|
+
*
|
|
366
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
367
|
+
* copies or substantial portions of the Software.
|
|
368
|
+
*
|
|
369
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
370
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
371
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
372
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
373
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
374
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
375
|
+
* SOFTWARE.
|
|
376
|
+
*/
|
|
232
377
|
/**
|
|
233
378
|
* @description Append the active plugin to the global plugin
|
|
234
379
|
* list and notify that the frontend Loaded.
|
|
@@ -263,11 +408,41 @@ function InitializePlugins() {
|
|
|
263
408
|
window.MILLENNIUM_SIDEBAR_NAVIGATION_PANELS || (window.MILLENNIUM_SIDEBAR_NAVIGATION_PANELS = {});
|
|
264
409
|
}
|
|
265
410
|
|
|
411
|
+
/**
|
|
412
|
+
* ==================================================
|
|
413
|
+
* _____ _ _ _ _
|
|
414
|
+
* | |_| | |___ ___ ___|_|_ _ _____
|
|
415
|
+
* | | | | | | | -_| | | | | | |
|
|
416
|
+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
|
|
417
|
+
*
|
|
418
|
+
* ==================================================
|
|
419
|
+
*
|
|
420
|
+
* Copyright (c) 2026 Project Millennium
|
|
421
|
+
*
|
|
422
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
423
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
424
|
+
* in the Software without restriction, including without limitation the rights
|
|
425
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
426
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
427
|
+
* furnished to do so, subject to the following conditions:
|
|
428
|
+
*
|
|
429
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
430
|
+
* copies or substantial portions of the Software.
|
|
431
|
+
*
|
|
432
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
433
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
434
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
435
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
436
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
437
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
438
|
+
* SOFTWARE.
|
|
439
|
+
*/
|
|
266
440
|
const traverse = _traverse.default;
|
|
267
441
|
function constSysfsExpr(options = {}) {
|
|
268
442
|
const filter = createFilter(options.include, options.exclude);
|
|
269
443
|
const pluginName = 'millennium-const-sysfs-expr';
|
|
270
444
|
let count = 0;
|
|
445
|
+
const globCache = new Map();
|
|
271
446
|
const plugin = {
|
|
272
447
|
name: pluginName,
|
|
273
448
|
transform(code, id) {
|
|
@@ -311,8 +486,6 @@ function constSysfsExpr(options = {}) {
|
|
|
311
486
|
}
|
|
312
487
|
}
|
|
313
488
|
},
|
|
314
|
-
});
|
|
315
|
-
traverse(ast, {
|
|
316
489
|
CallExpression: (nodePath) => {
|
|
317
490
|
const node = nodePath.node;
|
|
318
491
|
if (node.callee.type === 'Identifier' && node.callee.name === 'constSysfsExpr') {
|
|
@@ -432,53 +605,60 @@ function constSysfsExpr(options = {}) {
|
|
|
432
605
|
? path.dirname(pathOrPattern)
|
|
433
606
|
: path.resolve(path.dirname(id), path.dirname(pathOrPattern));
|
|
434
607
|
let embeddedContent;
|
|
435
|
-
const
|
|
436
|
-
if (
|
|
437
|
-
|
|
438
|
-
fs.statSync(path.resolve(searchBasePath, pathOrPattern)).isFile()) {
|
|
439
|
-
const singleFilePath = path.resolve(searchBasePath, pathOrPattern);
|
|
440
|
-
try {
|
|
441
|
-
const rawContent = fs.readFileSync(singleFilePath, callOptions.encoding);
|
|
442
|
-
const contentString = rawContent.toString();
|
|
443
|
-
const fileInfo = {
|
|
444
|
-
content: contentString,
|
|
445
|
-
filePath: singleFilePath,
|
|
446
|
-
fileName: path.relative(searchBasePath, singleFilePath),
|
|
447
|
-
};
|
|
448
|
-
embeddedContent = JSON.stringify(fileInfo);
|
|
449
|
-
this.addWatchFile(singleFilePath);
|
|
450
|
-
}
|
|
451
|
-
catch (fileError) {
|
|
452
|
-
let message = String(fileError instanceof Error ? fileError.message : (fileError ?? 'Unknown file read error'));
|
|
453
|
-
this.error(`Error reading file ${singleFilePath}: ${message}`, node.loc?.start.index);
|
|
454
|
-
return;
|
|
455
|
-
}
|
|
608
|
+
const cacheKey = `${searchBasePath}\0${pathOrPattern}\0${callOptions.encoding}`;
|
|
609
|
+
if (globCache.has(cacheKey)) {
|
|
610
|
+
embeddedContent = globCache.get(cacheKey);
|
|
456
611
|
}
|
|
457
612
|
else {
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
const fileInfoArray = [];
|
|
464
|
-
for (const fullPath of matchingFiles) {
|
|
613
|
+
const isPotentialPattern = /[?*+!@()[\]{}]/.test(pathOrPattern);
|
|
614
|
+
if (!isPotentialPattern &&
|
|
615
|
+
fs.existsSync(path.resolve(searchBasePath, pathOrPattern)) &&
|
|
616
|
+
fs.statSync(path.resolve(searchBasePath, pathOrPattern)).isFile()) {
|
|
617
|
+
const singleFilePath = path.resolve(searchBasePath, pathOrPattern);
|
|
465
618
|
try {
|
|
466
|
-
const rawContent = fs.readFileSync(
|
|
619
|
+
const rawContent = fs.readFileSync(singleFilePath, callOptions.encoding);
|
|
467
620
|
const contentString = rawContent.toString();
|
|
468
|
-
|
|
621
|
+
const fileInfo = {
|
|
469
622
|
content: contentString,
|
|
470
|
-
filePath:
|
|
471
|
-
fileName: path.relative(searchBasePath,
|
|
472
|
-
}
|
|
473
|
-
|
|
623
|
+
filePath: singleFilePath,
|
|
624
|
+
fileName: path.relative(searchBasePath, singleFilePath),
|
|
625
|
+
};
|
|
626
|
+
embeddedContent = JSON.stringify(fileInfo);
|
|
627
|
+
this.addWatchFile(singleFilePath);
|
|
474
628
|
}
|
|
475
629
|
catch (fileError) {
|
|
476
630
|
let message = String(fileError instanceof Error ? fileError.message : (fileError ?? 'Unknown file read error'));
|
|
477
|
-
this.
|
|
631
|
+
this.error(`Error reading file ${singleFilePath}: ${message}`, node.loc?.start.index);
|
|
632
|
+
return;
|
|
478
633
|
}
|
|
479
634
|
}
|
|
480
|
-
|
|
481
|
-
|
|
635
|
+
else {
|
|
636
|
+
const matchingFiles = glob.sync(pathOrPattern, {
|
|
637
|
+
cwd: searchBasePath,
|
|
638
|
+
nodir: true,
|
|
639
|
+
absolute: true,
|
|
640
|
+
});
|
|
641
|
+
const fileInfoArray = [];
|
|
642
|
+
for (const fullPath of matchingFiles) {
|
|
643
|
+
try {
|
|
644
|
+
const rawContent = fs.readFileSync(fullPath, callOptions.encoding);
|
|
645
|
+
const contentString = rawContent.toString();
|
|
646
|
+
fileInfoArray.push({
|
|
647
|
+
content: contentString,
|
|
648
|
+
filePath: fullPath,
|
|
649
|
+
fileName: path.relative(searchBasePath, fullPath),
|
|
650
|
+
});
|
|
651
|
+
this.addWatchFile(fullPath);
|
|
652
|
+
}
|
|
653
|
+
catch (fileError) {
|
|
654
|
+
let message = String(fileError instanceof Error ? fileError.message : (fileError ?? 'Unknown file read error'));
|
|
655
|
+
this.warn(`Error reading file ${fullPath}: ${message}`);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
embeddedContent = JSON.stringify(fileInfoArray);
|
|
659
|
+
}
|
|
660
|
+
globCache.set(cacheKey, embeddedContent);
|
|
661
|
+
} // end cache miss
|
|
482
662
|
// Replace the call expression with the generated content string
|
|
483
663
|
magicString.overwrite(node.start, node.end, embeddedContent);
|
|
484
664
|
hasReplaced = true;
|
|
@@ -530,6 +710,35 @@ function constSysfsExpr(options = {}) {
|
|
|
530
710
|
return { plugin, getCount: () => count };
|
|
531
711
|
}
|
|
532
712
|
|
|
713
|
+
/**
|
|
714
|
+
* ==================================================
|
|
715
|
+
* _____ _ _ _ _
|
|
716
|
+
* | |_| | |___ ___ ___|_|_ _ _____
|
|
717
|
+
* | | | | | | | -_| | | | | | |
|
|
718
|
+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
|
|
719
|
+
*
|
|
720
|
+
* ==================================================
|
|
721
|
+
*
|
|
722
|
+
* Copyright (c) 2026 Project Millennium
|
|
723
|
+
*
|
|
724
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
725
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
726
|
+
* in the Software without restriction, including without limitation the rights
|
|
727
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
728
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
729
|
+
* furnished to do so, subject to the following conditions:
|
|
730
|
+
*
|
|
731
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
732
|
+
* copies or substantial portions of the Software.
|
|
733
|
+
*
|
|
734
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
735
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
736
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
737
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
738
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
739
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
740
|
+
* SOFTWARE.
|
|
741
|
+
*/
|
|
533
742
|
const env = dotenv.config().parsed ?? {};
|
|
534
743
|
var BuildTarget;
|
|
535
744
|
(function (BuildTarget) {
|
|
@@ -618,7 +827,7 @@ function tsconfigPathsPlugin(tsconfigPath) {
|
|
|
618
827
|
const paths = options.paths ?? {};
|
|
619
828
|
function resolveWithExtensions(base) {
|
|
620
829
|
for (const ext of ['', '.ts', '.tsx', '.js', '.jsx', '/index.ts', '/index.tsx']) {
|
|
621
|
-
if (fs.existsSync(base + ext))
|
|
830
|
+
if (fs.existsSync(base + ext) && fs.statSync(base + ext).isFile())
|
|
622
831
|
return base + ext;
|
|
623
832
|
}
|
|
624
833
|
return null;
|
|
@@ -877,6 +1086,35 @@ const TranspilerPluginComponent = async (pluginJson, props) => {
|
|
|
877
1086
|
}
|
|
878
1087
|
};
|
|
879
1088
|
|
|
1089
|
+
/**
|
|
1090
|
+
* ==================================================
|
|
1091
|
+
* _____ _ _ _ _
|
|
1092
|
+
* | |_| | |___ ___ ___|_|_ _ _____
|
|
1093
|
+
* | | | | | | | -_| | | | | | |
|
|
1094
|
+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
|
|
1095
|
+
*
|
|
1096
|
+
* ==================================================
|
|
1097
|
+
*
|
|
1098
|
+
* Copyright (c) 2026 Project Millennium
|
|
1099
|
+
*
|
|
1100
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1101
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
1102
|
+
* in the Software without restriction, including without limitation the rights
|
|
1103
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1104
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
1105
|
+
* furnished to do so, subject to the following conditions:
|
|
1106
|
+
*
|
|
1107
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
1108
|
+
* copies or substantial portions of the Software.
|
|
1109
|
+
*
|
|
1110
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1111
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1112
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1113
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1114
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1115
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1116
|
+
* SOFTWARE.
|
|
1117
|
+
*/
|
|
880
1118
|
/**
|
|
881
1119
|
* this component serves as:
|
|
882
1120
|
* - typescript transpiler
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steambrew/ttc",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "rollup -c",
|
|
12
12
|
"dev": "rollup -c -w",
|
|
13
|
-
"
|
|
13
|
+
"prepublishOnly": "bun run build"
|
|
14
14
|
},
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|
package/rollup.config.js
CHANGED
|
@@ -2,17 +2,22 @@ import commonjs from '@rollup/plugin-commonjs';
|
|
|
2
2
|
import typescript from '@rollup/plugin-typescript';
|
|
3
3
|
import json from '@rollup/plugin-json';
|
|
4
4
|
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
5
|
+
import replace from '@rollup/plugin-replace';
|
|
5
6
|
import { readFileSync } from 'fs';
|
|
7
|
+
import { execSync } from 'child_process';
|
|
6
8
|
|
|
7
9
|
const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'));
|
|
8
10
|
|
|
11
|
+
let gitCommit = 'unknown';
|
|
12
|
+
try { gitCommit = execSync('git rev-parse --short HEAD', { encoding: 'utf8' }).trim(); } catch {}
|
|
13
|
+
|
|
9
14
|
export default {
|
|
10
15
|
input: 'src/index.ts',
|
|
11
16
|
context: 'window',
|
|
12
17
|
output: {
|
|
13
18
|
file: 'dist/index.js',
|
|
14
19
|
},
|
|
15
|
-
plugins: [commonjs(), typescript(), json(), nodeResolve()],
|
|
20
|
+
plugins: [replace({ __GIT_COMMIT__: JSON.stringify(gitCommit), preventAssignment: true }), commonjs(), typescript(), json(), nodeResolve()],
|
|
16
21
|
external: [
|
|
17
22
|
...Object.keys(pkg.dependencies || {}),
|
|
18
23
|
...Object.keys(pkg.peerDependencies || {}),
|
package/src/check-health.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==================================================
|
|
3
|
+
* _____ _ _ _ _
|
|
4
|
+
* | |_| | |___ ___ ___|_|_ _ _____
|
|
5
|
+
* | | | | | | | -_| | | | | | |
|
|
6
|
+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
|
|
7
|
+
*
|
|
8
|
+
* ==================================================
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2026 Project Millennium
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
1
31
|
import path from 'path';
|
|
2
32
|
import { existsSync, readFile } from 'fs';
|
|
3
33
|
import { Logger } from './logger';
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,34 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin / env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ==================================================
|
|
5
|
+
* _____ _ _ _ _
|
|
6
|
+
* | |_| | |___ ___ ___|_|_ _ _____
|
|
7
|
+
* | | | | | | | -_| | | | | | |
|
|
8
|
+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
|
|
9
|
+
*
|
|
10
|
+
* ==================================================
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) 2026 Project Millennium
|
|
13
|
+
*
|
|
14
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
* in the Software without restriction, including without limitation the rights
|
|
17
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
* furnished to do so, subject to the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
* copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
* SOFTWARE.
|
|
31
|
+
*/
|
|
2
32
|
|
|
3
33
|
/**
|
|
4
34
|
* this component serves as:
|
package/src/logger.ts
CHANGED
|
@@ -1,8 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==================================================
|
|
3
|
+
* _____ _ _ _ _
|
|
4
|
+
* | |_| | |___ ___ ___|_|_ _ _____
|
|
5
|
+
* | | | | | | | -_| | | | | | |
|
|
6
|
+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
|
|
7
|
+
*
|
|
8
|
+
* ==================================================
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2026 Project Millennium
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
1
31
|
import chalk from 'chalk';
|
|
2
32
|
import { readFileSync } from 'fs';
|
|
3
33
|
import path, { dirname } from 'path';
|
|
4
34
|
import { fileURLToPath } from 'url';
|
|
5
35
|
|
|
36
|
+
declare const __GIT_COMMIT__: string;
|
|
37
|
+
|
|
6
38
|
const version: string = JSON.parse(readFileSync(path.resolve(dirname(fileURLToPath(import.meta.url)), '../package.json'), 'utf8')).version;
|
|
7
39
|
|
|
8
40
|
interface DoneOptions {
|
|
@@ -36,11 +68,11 @@ const Logger = {
|
|
|
36
68
|
|
|
37
69
|
done({ elapsedMs, buildType, sysfsCount, envCount }: DoneOptions) {
|
|
38
70
|
const elapsed = `${(elapsedMs / 1000).toFixed(2)}s`;
|
|
39
|
-
const meta: string[] = [`ttc v${version}`];
|
|
71
|
+
const meta: string[] = [`ttc v${version} (${__GIT_COMMIT__})`];
|
|
40
72
|
if (buildType === 'dev') meta.push('no type checking');
|
|
41
73
|
if (sysfsCount) meta.push(`${sysfsCount} bundled file${sysfsCount > 1 ? 's' : ''}`);
|
|
42
74
|
if (envCount) meta.push(`${envCount} env var${envCount > 1 ? 's' : ''}`);
|
|
43
|
-
console.log(`${chalk.green('Finished')} ${buildType} in ${elapsed} ` + chalk.dim(
|
|
75
|
+
console.log(`${chalk.green('Finished')} ${buildType} in ${elapsed} ` + chalk.dim(meta.join(', ')));
|
|
44
76
|
},
|
|
45
77
|
|
|
46
78
|
failed({ elapsedMs, buildType }: Pick<DoneOptions, 'elapsedMs' | 'buildType'>) {
|
package/src/plugin-api.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==================================================
|
|
3
|
+
* _____ _ _ _ _
|
|
4
|
+
* | |_| | |___ ___ ___|_|_ _ _____
|
|
5
|
+
* | | | | | | | -_| | | | | | |
|
|
6
|
+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
|
|
7
|
+
*
|
|
8
|
+
* ==================================================
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2026 Project Millennium
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
1
31
|
declare global {
|
|
2
32
|
interface Window {
|
|
3
33
|
/**
|
package/src/plugin-json.d.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==================================================
|
|
3
|
+
* _____ _ _ _ _
|
|
4
|
+
* | |_| | |___ ___ ___|_|_ _ _____
|
|
5
|
+
* | | | | | | | -_| | | | | | |
|
|
6
|
+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
|
|
7
|
+
*
|
|
8
|
+
* ==================================================
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2026 Project Millennium
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
1
31
|
/**
|
|
2
32
|
* generated from https://raw.githubusercontent.com/SteamClientHomebrew/Millennium/main/src/sys/plugin-schema.json
|
|
3
33
|
*/
|
package/src/query-parser.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==================================================
|
|
3
|
+
* _____ _ _ _ _
|
|
4
|
+
* | |_| | |___ ___ ___|_|_ _ _____
|
|
5
|
+
* | | | | | | | -_| | | | | | |
|
|
6
|
+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
|
|
7
|
+
*
|
|
8
|
+
* ==================================================
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2026 Project Millennium
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
1
31
|
import { Logger } from './logger';
|
|
2
32
|
|
|
3
33
|
export const PrintParamHelp = () => {
|
package/src/static-embed.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==================================================
|
|
3
|
+
* _____ _ _ _ _
|
|
4
|
+
* | |_| | |___ ___ ___|_|_ _ _____
|
|
5
|
+
* | | | | | | | -_| | | | | | |
|
|
6
|
+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
|
|
7
|
+
*
|
|
8
|
+
* ==================================================
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2026 Project Millennium
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
1
31
|
import * as parser from '@babel/parser';
|
|
2
32
|
import { createFilter } from '@rollup/pluginutils';
|
|
3
33
|
import fs from 'fs';
|
|
@@ -47,6 +77,7 @@ export default function constSysfsExpr(options: EmbedPluginOptions = {}): SysfsP
|
|
|
47
77
|
const filter = createFilter(options.include, options.exclude);
|
|
48
78
|
const pluginName = 'millennium-const-sysfs-expr';
|
|
49
79
|
let count = 0;
|
|
80
|
+
const globCache = new Map<string, string>();
|
|
50
81
|
|
|
51
82
|
const plugin: Plugin = {
|
|
52
83
|
name: pluginName,
|
|
@@ -97,9 +128,6 @@ export default function constSysfsExpr(options: EmbedPluginOptions = {}): SysfsP
|
|
|
97
128
|
}
|
|
98
129
|
}
|
|
99
130
|
},
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
traverse(ast, {
|
|
103
131
|
CallExpression: (nodePath) => {
|
|
104
132
|
const node = nodePath.node;
|
|
105
133
|
if (node.callee.type === 'Identifier' && node.callee.name === 'constSysfsExpr') {
|
|
@@ -220,55 +248,61 @@ export default function constSysfsExpr(options: EmbedPluginOptions = {}): SysfsP
|
|
|
220
248
|
|
|
221
249
|
let embeddedContent: string;
|
|
222
250
|
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
!isPotentialPattern &&
|
|
227
|
-
fs.existsSync(path.resolve(searchBasePath, pathOrPattern)) &&
|
|
228
|
-
fs.statSync(path.resolve(searchBasePath, pathOrPattern)).isFile()
|
|
229
|
-
) {
|
|
230
|
-
const singleFilePath = path.resolve(searchBasePath, pathOrPattern);
|
|
231
|
-
|
|
232
|
-
try {
|
|
233
|
-
const rawContent: string | Buffer = fs.readFileSync(singleFilePath, callOptions.encoding);
|
|
234
|
-
const contentString = rawContent.toString();
|
|
235
|
-
const fileInfo: FileInfo = {
|
|
236
|
-
content: contentString,
|
|
237
|
-
filePath: singleFilePath,
|
|
238
|
-
fileName: path.relative(searchBasePath, singleFilePath),
|
|
239
|
-
};
|
|
240
|
-
embeddedContent = JSON.stringify(fileInfo);
|
|
241
|
-
this.addWatchFile(singleFilePath);
|
|
242
|
-
} catch (fileError: unknown) {
|
|
243
|
-
let message = String(fileError instanceof Error ? fileError.message : (fileError ?? 'Unknown file read error'));
|
|
244
|
-
this.error(`Error reading file ${singleFilePath}: ${message}`, node.loc?.start.index);
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
251
|
+
const cacheKey = `${searchBasePath}\0${pathOrPattern}\0${callOptions.encoding}`;
|
|
252
|
+
if (globCache.has(cacheKey)) {
|
|
253
|
+
embeddedContent = globCache.get(cacheKey)!;
|
|
247
254
|
} else {
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
255
|
+
const isPotentialPattern = /[?*+!@()[\]{}]/.test(pathOrPattern);
|
|
256
|
+
|
|
257
|
+
if (
|
|
258
|
+
!isPotentialPattern &&
|
|
259
|
+
fs.existsSync(path.resolve(searchBasePath, pathOrPattern)) &&
|
|
260
|
+
fs.statSync(path.resolve(searchBasePath, pathOrPattern)).isFile()
|
|
261
|
+
) {
|
|
262
|
+
const singleFilePath = path.resolve(searchBasePath, pathOrPattern);
|
|
263
|
+
|
|
256
264
|
try {
|
|
257
|
-
const rawContent: string | Buffer = fs.readFileSync(
|
|
265
|
+
const rawContent: string | Buffer = fs.readFileSync(singleFilePath, callOptions.encoding);
|
|
258
266
|
const contentString = rawContent.toString();
|
|
259
|
-
|
|
267
|
+
const fileInfo: FileInfo = {
|
|
260
268
|
content: contentString,
|
|
261
|
-
filePath:
|
|
262
|
-
fileName: path.relative(searchBasePath,
|
|
263
|
-
}
|
|
264
|
-
|
|
269
|
+
filePath: singleFilePath,
|
|
270
|
+
fileName: path.relative(searchBasePath, singleFilePath),
|
|
271
|
+
};
|
|
272
|
+
embeddedContent = JSON.stringify(fileInfo);
|
|
273
|
+
this.addWatchFile(singleFilePath);
|
|
265
274
|
} catch (fileError: unknown) {
|
|
266
275
|
let message = String(fileError instanceof Error ? fileError.message : (fileError ?? 'Unknown file read error'));
|
|
267
|
-
this.
|
|
276
|
+
this.error(`Error reading file ${singleFilePath}: ${message}`, node.loc?.start.index);
|
|
277
|
+
return;
|
|
268
278
|
}
|
|
279
|
+
} else {
|
|
280
|
+
const matchingFiles = glob.sync(pathOrPattern, {
|
|
281
|
+
cwd: searchBasePath,
|
|
282
|
+
nodir: true,
|
|
283
|
+
absolute: true,
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
const fileInfoArray: FileInfo[] = [];
|
|
287
|
+
for (const fullPath of matchingFiles) {
|
|
288
|
+
try {
|
|
289
|
+
const rawContent: string | Buffer = fs.readFileSync(fullPath, callOptions.encoding);
|
|
290
|
+
const contentString = rawContent.toString();
|
|
291
|
+
fileInfoArray.push({
|
|
292
|
+
content: contentString,
|
|
293
|
+
filePath: fullPath,
|
|
294
|
+
fileName: path.relative(searchBasePath, fullPath),
|
|
295
|
+
});
|
|
296
|
+
this.addWatchFile(fullPath);
|
|
297
|
+
} catch (fileError: unknown) {
|
|
298
|
+
let message = String(fileError instanceof Error ? fileError.message : (fileError ?? 'Unknown file read error'));
|
|
299
|
+
this.warn(`Error reading file ${fullPath}: ${message}`);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
embeddedContent = JSON.stringify(fileInfoArray);
|
|
269
303
|
}
|
|
270
|
-
|
|
271
|
-
}
|
|
304
|
+
globCache.set(cacheKey, embeddedContent);
|
|
305
|
+
} // end cache miss
|
|
272
306
|
|
|
273
307
|
// Replace the call expression with the generated content string
|
|
274
308
|
magicString.overwrite(node.start, node.end, embeddedContent);
|
package/src/transpiler.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==================================================
|
|
3
|
+
* _____ _ _ _ _
|
|
4
|
+
* | |_| | |___ ___ ___|_|_ _ _____
|
|
5
|
+
* | | | | | | | -_| | | | | | |
|
|
6
|
+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
|
|
7
|
+
*
|
|
8
|
+
* ==================================================
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2026 Project Millennium
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
1
31
|
import babel from '@rollup/plugin-babel';
|
|
2
32
|
import commonjs from '@rollup/plugin-commonjs';
|
|
3
33
|
import json from '@rollup/plugin-json';
|
|
@@ -152,7 +182,7 @@ function tsconfigPathsPlugin(tsconfigPath: string): InputPluginOption {
|
|
|
152
182
|
|
|
153
183
|
function resolveWithExtensions(base: string): string | null {
|
|
154
184
|
for (const ext of ['', '.ts', '.tsx', '.js', '.jsx', '/index.ts', '/index.tsx']) {
|
|
155
|
-
|
|
185
|
+
if (fs.existsSync(base + ext) && fs.statSync(base + ext).isFile()) return base + ext;
|
|
156
186
|
}
|
|
157
187
|
return null;
|
|
158
188
|
}
|
package/src/version-control.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==================================================
|
|
3
|
+
* _____ _ _ _ _
|
|
4
|
+
* | |_| | |___ ___ ___|_|_ _ _____
|
|
5
|
+
* | | | | | | | -_| | | | | | |
|
|
6
|
+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
|
|
7
|
+
*
|
|
8
|
+
* ==================================================
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2026 Project Millennium
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
1
31
|
import path from 'path';
|
|
2
32
|
import { fileURLToPath } from 'url';
|
|
3
33
|
import { readFile, access } from 'fs/promises';
|