@triflare/fx 1.0.3 → 2.1.0-beta.1

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 (68) hide show
  1. package/README.md +59 -0
  2. package/bin/fx.js +4 -1162
  3. package/package.json +8 -4
  4. package/product.yml +1 -1
  5. package/src/brand.js +9 -3
  6. package/src/catalog.js +103 -0
  7. package/src/cli/commands/build.js +98 -0
  8. package/src/cli/commands/catalog.js +42 -0
  9. package/src/cli/commands/check.js +44 -0
  10. package/src/cli/commands/completion.js +54 -0
  11. package/src/cli/commands/decompile.js +266 -0
  12. package/src/cli/commands/dev.js +179 -0
  13. package/src/cli/commands/extension.js +110 -0
  14. package/src/cli/commands/feature.js +114 -0
  15. package/src/cli/commands/fmt.js +173 -0
  16. package/src/cli/commands/index.js +45 -0
  17. package/src/cli/commands/init.js +169 -0
  18. package/src/cli/commands/lint.js +270 -0
  19. package/src/cli/commands/package.js +137 -0
  20. package/src/cli/commands/sprite/add.js +85 -0
  21. package/src/cli/commands/sprite/build.js +62 -0
  22. package/src/cli/commands/sprite/helpers.js +66 -0
  23. package/src/cli/commands/sprite/index.js +29 -0
  24. package/src/cli/commands/sprite/list.js +31 -0
  25. package/src/cli/commands/sprite/remove.js +51 -0
  26. package/src/cli/commands/vendor/add.js +98 -0
  27. package/src/cli/commands/vendor/helpers.js +50 -0
  28. package/src/cli/commands/vendor/index.js +39 -0
  29. package/src/cli/commands/vendor/install.js +64 -0
  30. package/src/cli/commands/vendor/list.js +45 -0
  31. package/src/cli/commands/vendor/migrate.js +47 -0
  32. package/src/cli/commands/vendor/outdated.js +51 -0
  33. package/src/cli/commands/vendor/remove.js +34 -0
  34. package/src/cli/commands/vendor/update.js +49 -0
  35. package/src/cli/commands/vendor/verify.js +44 -0
  36. package/src/cli/completion/bash.js +10 -0
  37. package/src/cli/completion/fish.js +9 -0
  38. package/src/cli/completion/index.js +97 -0
  39. package/src/cli/completion/zsh.js +11 -0
  40. package/src/cli/context.js +270 -0
  41. package/src/cli/define-command.js +147 -0
  42. package/src/cli/errors.js +111 -0
  43. package/src/cli/format.js +31 -0
  44. package/src/cli/prompts.js +183 -0
  45. package/src/cli/reporter.js +203 -0
  46. package/src/cli/run.js +248 -0
  47. package/src/cli/templates/index.js +112 -0
  48. package/src/cli/theme.js +84 -0
  49. package/src/compiler.js +133 -0
  50. package/src/config-edit.js +399 -1
  51. package/src/config.js +174 -4
  52. package/src/decompiler.js +45 -0
  53. package/src/extensions.js +72 -19
  54. package/src/features.js +339 -0
  55. package/src/formatter.js +499 -0
  56. package/src/index.js +31 -0
  57. package/src/lexer.js +45 -4
  58. package/src/lint/analyze.js +1414 -0
  59. package/src/lint/config-file.js +97 -0
  60. package/src/lint/config.js +174 -0
  61. package/src/lint/rules.js +461 -0
  62. package/src/linter.js +220 -0
  63. package/src/merge.js +109 -0
  64. package/src/parser.js +53 -13
  65. package/src/project.js +7 -87
  66. package/src/vendor.js +1323 -0
  67. package/vendor/pm-packager-dist/.fx-build.json +1 -1
  68. package/vendor/tempvars/fx-tempvars.js +321 -0
package/README.md CHANGED
@@ -16,6 +16,8 @@ Code PenguinMod projects with text.
16
16
  - [Highlights](#highlights)
17
17
  - [Overview](#overview)
18
18
  - [Usage](#usage)
19
+ - [Formatting](#formatting)
20
+ - [Vendoring Extensions](#vendoring-extensions)
19
21
  - [Installation](#installation)
20
22
  - [Feedback and Contributing](#feedback-and-contributing)
21
23
 
@@ -53,6 +55,63 @@ $ fx build
53
55
  extensions: (none)
54
56
  ```
55
57
 
58
+ <!-- coderabbit-ai-generated:v1 -->
59
+
60
+ <!-- coderabbit-ai-generated-section:v1:1f825081f9f722158035083df5b16f42120cc5fbd7d56eb25c770f3c64e339b2 -->
61
+
62
+ ## Formatting
63
+
64
+ Run `fx fmt` to format every `.tfx` source in the current directory, or pass a file or directory:
65
+
66
+ ```bash
67
+ fx fmt
68
+ fx fmt src/main.tfx
69
+ fx fmt src/ --check
70
+ cat src/main.tfx | fx fmt --stdin
71
+ fx fmt src/main.tfx --stdout
72
+ fx fmt --check --json
73
+ ```
74
+
75
+ - `--check` leaves files untouched and exits with status 1 if formatting is needed (0 if already formatted).
76
+ - `--stdin` reads source from standard input and writes formatted source to standard output; it takes no file argument. With `--check`, it checks the input instead.
77
+ - `--stdout` writes formatted source for a single file to standard output without changing the file. It cannot be combined with `--check`.
78
+ - `--json` returns a structured result, including formatted code for `--stdin` and `--stdout` output.
79
+
80
+ Formatting is idempotent: running it twice produces no further changes. It preserves comments, declaration order, and project data, normalizes whitespace and line endings, and does not compile the project. Files with parse errors are left untouched.
81
+
82
+ ## Vendoring Extensions
83
+
84
+ <!-- /coderabbit-ai-generated:v1 -->
85
+
86
+ Extension URLs are mutable and can disappear, so Fx can commit a verified copy of every extension instead. Declare them under `vendor:` in `fx.yml`; order is load order:
87
+
88
+ ```yaml
89
+ vendorDir: extensions # default
90
+ vendor:
91
+ signals: https://example.com/signals.js
92
+ xterm:
93
+ url: http://localhost:8080/xterm.js
94
+ volatile: true
95
+ mything: ./src/mything.js
96
+ ```
97
+
98
+ `fx vendor install <url|path> --as <name>` copies the source to `extensions/`, records its SHA-256 in `fx.lock`, and adds it to `fx.yml`. Builds load the vendored copy and embed its source, so no network access is needed after installation. Remote entries fail if their hash changes; `volatile` entries (such as localhost URLs) warn instead. Local paths remain the source of truth and are re-copied on each build with a generated-file header.
99
+
100
+ `vendorDir` must be a directory inside the project directory.
101
+
102
+ ```bash
103
+ fx vendor install # restore from fx.lock, fetching only missing files
104
+ fx vendor update [name] # show a diff and write updated files and fx.lock
105
+ fx vendor update [name] --dry-run # preview changes without writing
106
+ fx vendor outdated # compare upstream with fx.lock
107
+ fx vendor verify # check files against fx.lock, offline
108
+ fx vendor remove <name>
109
+ fx vendor list [--json]
110
+ fx vendor migrate # move project.extensions under vendor:
111
+ ```
112
+
113
+ `fx vendor migrate` writes `fx.yml.bak` first and shows the config diff. Builds only offer migration when running in a terminal; use `--no-upgrade-prompt` or `FX_NO_PROMPT=1` to keep the legacy `project.extensions` behavior.
114
+
56
115
  ## Installation
57
116
 
58
117
  **Requirements:**