@triflare/fx 1.0.2 → 2.0.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.
Files changed (54) hide show
  1. package/README.md +32 -0
  2. package/bin/fx.js +4 -1160
  3. package/package.json +9 -3
  4. package/product.yml +1 -1
  5. package/src/brand.js +9 -3
  6. package/src/build.js +2 -1
  7. package/src/catalog.js +117 -140
  8. package/src/cli/commands/build.js +98 -0
  9. package/src/cli/commands/catalog.js +42 -0
  10. package/src/cli/commands/check.js +44 -0
  11. package/src/cli/commands/completion.js +54 -0
  12. package/src/cli/commands/decompile.js +266 -0
  13. package/src/cli/commands/dev.js +179 -0
  14. package/src/cli/commands/extension.js +110 -0
  15. package/src/cli/commands/index.js +39 -0
  16. package/src/cli/commands/init.js +169 -0
  17. package/src/cli/commands/package.js +137 -0
  18. package/src/cli/commands/sprite/add.js +85 -0
  19. package/src/cli/commands/sprite/build.js +62 -0
  20. package/src/cli/commands/sprite/helpers.js +66 -0
  21. package/src/cli/commands/sprite/index.js +29 -0
  22. package/src/cli/commands/sprite/list.js +31 -0
  23. package/src/cli/commands/sprite/remove.js +51 -0
  24. package/src/cli/commands/vendor/add.js +98 -0
  25. package/src/cli/commands/vendor/helpers.js +50 -0
  26. package/src/cli/commands/vendor/index.js +39 -0
  27. package/src/cli/commands/vendor/install.js +64 -0
  28. package/src/cli/commands/vendor/list.js +45 -0
  29. package/src/cli/commands/vendor/migrate.js +47 -0
  30. package/src/cli/commands/vendor/outdated.js +51 -0
  31. package/src/cli/commands/vendor/remove.js +34 -0
  32. package/src/cli/commands/vendor/update.js +49 -0
  33. package/src/cli/commands/vendor/verify.js +44 -0
  34. package/src/cli/completion/bash.js +10 -0
  35. package/src/cli/completion/fish.js +9 -0
  36. package/src/cli/completion/index.js +97 -0
  37. package/src/cli/completion/zsh.js +11 -0
  38. package/src/cli/context.js +257 -0
  39. package/src/cli/define-command.js +140 -0
  40. package/src/cli/errors.js +111 -0
  41. package/src/cli/format.js +31 -0
  42. package/src/cli/prompts.js +183 -0
  43. package/src/cli/reporter.js +194 -0
  44. package/src/cli/run.js +248 -0
  45. package/src/cli/templates/index.js +112 -0
  46. package/src/cli/theme.js +84 -0
  47. package/src/compiler.js +32 -3
  48. package/src/config-edit.js +280 -1
  49. package/src/config.js +137 -3
  50. package/src/decompiler.js +12 -2
  51. package/src/extensions.js +311 -48
  52. package/src/index.js +21 -0
  53. package/src/vendor.js +1323 -0
  54. package/vendor/pm-packager-dist/.fx-build.json +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triflare/fx",
3
- "version": "1.0.2",
3
+ "version": "2.0.0",
4
4
  "description": "Code PenguinMod projects with text.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -8,6 +8,10 @@
8
8
  "bin": {
9
9
  "fx": "bin/fx.js"
10
10
  },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/triflare/fx.git"
14
+ },
11
15
  "exports": {
12
16
  ".": "./src/index.js",
13
17
  "./catalog": "./src/catalog.js",
@@ -36,12 +40,14 @@
36
40
  "prepack": "node scripts/build-packager.js --if-missing"
37
41
  },
38
42
  "dependencies": {
39
- "js-yaml": "^5.4.3",
40
- "quickjs-emscripten": "^0.32.0",
43
+ "@clack/prompts": "^1.8.1",
41
44
  "@fiahfy/icns": "0.0.7",
42
45
  "@turbowarp/sbdl": "^7.0.0",
46
+ "commander": "^15.0.0",
43
47
  "cross-fetch": "^4.1.0",
48
+ "js-yaml": "^5.4.3",
44
49
  "jszip": "^3.10.1",
50
+ "quickjs-emscripten": "^0.32.0",
45
51
  "sha.js": "^2.4.12"
46
52
  },
47
53
  "devDependencies": {
package/product.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  # Identity
2
2
  name: "Triflare Fx"
3
3
  command: "fx"
4
- version: "1.0.2"
4
+ version: "2.0.0"
5
5
  tagline: "Code PenguinMod projects with text."
6
6
  author: "Triflare"
7
7
  homepage: "https://github.com/triflare/fx"
package/src/brand.js CHANGED
@@ -62,9 +62,10 @@ const HEX_COLOR = /^#(?:[\da-f]{3}|[\da-f]{6})$/i;
62
62
  // styleText only learned hex colors in Node 24.16, and engines allow any 22, so
63
63
  // the truecolor escape is built here. The gate is styleText's own: ask it to
64
64
  // color a marker, and stay plain when it comes back untouched.
65
- function colorize(text, color, stream) {
65
+ function colorize(text, color, stream, force = false) {
66
66
  if (!HEX_COLOR.test(color)) return styleText(color, text, { stream });
67
- if (!styleText("red", "\u0000", { stream }).includes("\u001b")) return text;
67
+ if (!force && !styleText("red", "\u0000", { stream }).includes("\u001b"))
68
+ return text;
68
69
  const digits =
69
70
  color.length === 4 ? color.slice(1).replace(/./g, "$&$&") : color.slice(1);
70
71
  const [red, green, blue] = digits
@@ -76,7 +77,11 @@ function colorize(text, color, stream) {
76
77
  // Paints a product name or command in three equal bands taken straight from the
77
78
  // logo palette. The colors disappear when the stream can't render them, so
78
79
  // piped output and CI logs stay plain text.
79
- export function brandText(text, stream = process.stdout) {
80
+ export function brandText(
81
+ text,
82
+ stream = process.stdout,
83
+ { force = false } = {},
84
+ ) {
80
85
  const { primary, secondary, tertiary } = brandingColors();
81
86
  const palette = [primary, secondary, tertiary];
82
87
  const chars = Array.from(text);
@@ -96,6 +101,7 @@ export function brandText(text, stream = process.stdout) {
96
101
  chars.slice(start, index).join(""),
97
102
  palette[bandFor(start)],
98
103
  stream,
104
+ force,
99
105
  ),
100
106
  );
101
107
  start = index;
package/src/build.js CHANGED
@@ -98,7 +98,7 @@ function resolveSources(options) {
98
98
 
99
99
  /**
100
100
  * @param {BuildOptions} [options]
101
- * @returns {{project: object, assets: Map<string, Buffer>, sb3: Buffer, config: object, fx: object, ast: object, files: string[]}}
101
+ * @returns {{project: object, assets: Map<string, Buffer>, sb3: Buffer, config: object, fx: object, ast: object, files: string[], warnings: string[]}}
102
102
  */
103
103
  export function build(options = {}) {
104
104
  const { dir, entries } = resolveSources(options);
@@ -155,6 +155,7 @@ export function build(options = {}) {
155
155
  fx: fxConfig,
156
156
  ast,
157
157
  files: entries.map((e) => e.file),
158
+ warnings: compiler.warnings,
158
159
  };
159
160
  }
160
161