@tixyel/cli 2.6.4 → 2.6.6
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/widget.js +4 -4
- package/dist/widget.test.d.ts +1 -0
- package/dist/widget.test.js +14 -0
- package/package.json +4 -2
package/dist/widget.js
CHANGED
|
@@ -378,8 +378,8 @@ export async function processBuild(widget, workspaceConfig, verbose = false) {
|
|
|
378
378
|
try {
|
|
379
379
|
const transpiled = transformSync(content, {
|
|
380
380
|
loader: 'ts',
|
|
381
|
-
target: '
|
|
382
|
-
format: '
|
|
381
|
+
target: 'es2020',
|
|
382
|
+
format: 'cjs',
|
|
383
383
|
});
|
|
384
384
|
mergedTS += transpiled.code + '\n';
|
|
385
385
|
}
|
|
@@ -394,10 +394,10 @@ export async function processBuild(widget, workspaceConfig, verbose = false) {
|
|
|
394
394
|
// Obfuscate the compiled JavaScript
|
|
395
395
|
const obfuscated = JavaScriptObfuscator.obfuscate(mergedTS.trim(), workspaceConfig.build?.obfuscation?.javascript);
|
|
396
396
|
if (processed.has('html')) {
|
|
397
|
-
result = result += `<script>${obfuscated.getObfuscatedCode()}</script
|
|
397
|
+
result = result += `<script>${obfuscated.getObfuscatedCode()}</script>\n`;
|
|
398
398
|
}
|
|
399
399
|
else
|
|
400
|
-
result += obfuscated.getObfuscatedCode();
|
|
400
|
+
result += obfuscated.getObfuscatedCode() + '\n';
|
|
401
401
|
processed.add('typescript');
|
|
402
402
|
}
|
|
403
403
|
if (check(['script', 'js', 'javascript'], '.js')) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test';
|
|
2
|
+
import { transformSync } from 'esbuild';
|
|
3
|
+
describe('Should parse typescript into javascript', () => {
|
|
4
|
+
const tsContent = `function wait(ms: number) { return new Promise((resolve) => setTimeout(resolve, ms));}`;
|
|
5
|
+
const transpiled = transformSync(tsContent, {
|
|
6
|
+
loader: 'ts',
|
|
7
|
+
target: 'es2020',
|
|
8
|
+
format: 'cjs',
|
|
9
|
+
});
|
|
10
|
+
it('should transpile TypeScript to JavaScript', () => {
|
|
11
|
+
expect(transpiled.code).toContain('function wait(ms) {');
|
|
12
|
+
expect(transpiled.code).toContain('return new Promise((resolve) => setTimeout(resolve, ms));');
|
|
13
|
+
});
|
|
14
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tixyel/cli",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.6",
|
|
4
4
|
"description": "CLI tool for streamelements widgets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "cross-env TIXYEL_VERSION=$npm_package_version tsc",
|
|
52
52
|
"dev": "cross-env TIXYEL_VERSION=$npm_package_version tsc --watch",
|
|
53
|
-
"check-types": "tsc --noEmit"
|
|
53
|
+
"check-types": "tsc --noEmit",
|
|
54
|
+
"test": "bun test"
|
|
54
55
|
},
|
|
55
56
|
"dependencies": {
|
|
56
57
|
"autoprefixer": "^10.4.22",
|
|
@@ -72,6 +73,7 @@
|
|
|
72
73
|
"ws": "^8.18.0"
|
|
73
74
|
},
|
|
74
75
|
"devDependencies": {
|
|
76
|
+
"@types/bun": "^1.3.5",
|
|
75
77
|
"@types/html-minifier": "^4.0.6",
|
|
76
78
|
"@types/html-minifier-terser": "^7.0.2",
|
|
77
79
|
"@types/inquirer": "^9.0.9",
|