fastled 1.2.88__tar.gz → 1.2.91__tar.gz

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 (137) hide show
  1. {fastled-1.2.88 → fastled-1.2.91}/.gitignore +1 -0
  2. fastled-1.2.91/Dockerfile +85 -0
  3. {fastled-1.2.88 → fastled-1.2.91}/PKG-INFO +2 -3
  4. {fastled-1.2.88 → fastled-1.2.91}/README.md +0 -1
  5. {fastled-1.2.88 → fastled-1.2.91}/RELEASE.md +1 -1
  6. {fastled-1.2.88 → fastled-1.2.91}/build_local_docker.py +1 -6
  7. {fastled-1.2.88 → fastled-1.2.91}/compiler/compile.py +19 -79
  8. {fastled-1.2.88 → fastled-1.2.91}/compiler/init_runtime.py +4 -10
  9. {fastled-1.2.88 → fastled-1.2.91}/compiler/prewarm.sh +2 -3
  10. {fastled-1.2.88 → fastled-1.2.91}/compiler/pyproject.toml +1 -1
  11. {fastled-1.2.88 → fastled-1.2.91}/compiler/run.py +3 -3
  12. {fastled-1.2.88 → fastled-1.2.91}/docker-compose.yml +1 -1
  13. {fastled-1.2.88 → fastled-1.2.91}/pyproject.toml +2 -2
  14. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/__init__.py +1 -1
  15. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/app.py +34 -0
  16. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/parse_args.py +5 -2
  17. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/server_flask.py +1 -1
  18. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/sketch.py +4 -2
  19. {fastled-1.2.88 → fastled-1.2.91}/src/fastled.egg-info/PKG-INFO +2 -3
  20. {fastled-1.2.88 → fastled-1.2.91}/src/fastled.egg-info/SOURCES.txt +7 -14
  21. {fastled-1.2.88 → fastled-1.2.91}/src/fastled.egg-info/requires.txt +1 -1
  22. fastled-1.2.91/tests/unit/test_cli.py +38 -0
  23. fastled-1.2.91/tests/unit/test_ino/bad_platformio/platformio.ini +97 -0
  24. fastled-1.2.91/vscode-plugin/readme +17 -0
  25. fastled-1.2.88/Dockerfile +0 -208
  26. fastled-1.2.88/compiler/__init__.py +0 -0
  27. fastled-1.2.88/compiler/code_sync.py +0 -106
  28. fastled-1.2.88/compiler/compile_lock.py +0 -3
  29. fastled-1.2.88/compiler/paths.py +0 -19
  30. fastled-1.2.88/compiler/process_extended.py +0 -109
  31. fastled-1.2.88/compiler/server.py +0 -882
  32. fastled-1.2.88/compiler/sketch_hasher.py +0 -255
  33. fastled-1.2.88/compiler/wasm_compiler_flags.py +0 -157
  34. fastled-1.2.88/tests/unit/test_cli.py +0 -26
  35. fastled-1.2.88/tests/unit/test_ino/bad_platformio/platformio.ini +0 -41
  36. {fastled-1.2.88 → fastled-1.2.91}/.aiderignore +0 -0
  37. {fastled-1.2.88 → fastled-1.2.91}/.dockerignore +0 -0
  38. {fastled-1.2.88 → fastled-1.2.91}/.github/workflows/build_multi_docker_image.yml +0 -0
  39. {fastled-1.2.88 → fastled-1.2.91}/.github/workflows/build_webpage.yml +0 -0
  40. {fastled-1.2.88 → fastled-1.2.91}/.github/workflows/lint.yml +0 -0
  41. {fastled-1.2.88 → fastled-1.2.91}/.github/workflows/publish_release.yml +0 -0
  42. {fastled-1.2.88 → fastled-1.2.91}/.github/workflows/template_build_docker_image.yml +0 -0
  43. {fastled-1.2.88 → fastled-1.2.91}/.github/workflows/test_build_exe.yml +0 -0
  44. {fastled-1.2.88 → fastled-1.2.91}/.github/workflows/test_macos.yml +0 -0
  45. {fastled-1.2.88 → fastled-1.2.91}/.github/workflows/test_ubuntu.yml +0 -0
  46. {fastled-1.2.88 → fastled-1.2.91}/.github/workflows/test_win.yml +0 -0
  47. {fastled-1.2.88 → fastled-1.2.91}/.pylintrc +0 -0
  48. {fastled-1.2.88 → fastled-1.2.91}/.vscode/launch.json +0 -0
  49. {fastled-1.2.88 → fastled-1.2.91}/.vscode/settings.json +0 -0
  50. {fastled-1.2.88 → fastled-1.2.91}/.vscode/tasks.json +0 -0
  51. {fastled-1.2.88 → fastled-1.2.91}/LICENSE +0 -0
  52. {fastled-1.2.88 → fastled-1.2.91}/MANIFEST.in +0 -0
  53. {fastled-1.2.88 → fastled-1.2.91}/TODO.md +0 -0
  54. {fastled-1.2.88 → fastled-1.2.91}/build_exe.py +0 -0
  55. {fastled-1.2.88 → fastled-1.2.91}/build_site.py +0 -0
  56. {fastled-1.2.88 → fastled-1.2.91}/clean +0 -0
  57. {fastled-1.2.88 → fastled-1.2.91}/compiler/CMakeLists.txt +0 -0
  58. {fastled-1.2.88 → fastled-1.2.91}/compiler/arduino-pre-process.sh +0 -0
  59. {fastled-1.2.88 → fastled-1.2.91}/compiler/build.sh +0 -0
  60. {fastled-1.2.88 → fastled-1.2.91}/compiler/build_archive.sh +0 -0
  61. {fastled-1.2.88 → fastled-1.2.91}/compiler/build_fast.sh +0 -0
  62. {fastled-1.2.88 → fastled-1.2.91}/compiler/debug.sh +0 -0
  63. {fastled-1.2.88 → fastled-1.2.91}/compiler/entrypoint.sh +0 -0
  64. {fastled-1.2.88 → fastled-1.2.91}/compiler/final_prewarm.sh +0 -0
  65. {fastled-1.2.88 → fastled-1.2.91}/compiler/install-arduino-cli.sh +0 -0
  66. {fastled-1.2.88 → fastled-1.2.91}/compiler/libcompile/CMakeLists.txt +0 -0
  67. {fastled-1.2.88 → fastled-1.2.91}/compiler/pre-process.sh +0 -0
  68. {fastled-1.2.88 → fastled-1.2.91}/compiler/process-ino.py +0 -0
  69. {fastled-1.2.88/compiler/extra → fastled-1.2.91/demo}/100dots.html +0 -0
  70. {fastled-1.2.88/compiler/extra → fastled-1.2.91/demo}/demo_threejs.html +0 -0
  71. {fastled-1.2.88/compiler/extra → fastled-1.2.91/demo}/micdemo.html +0 -0
  72. {fastled-1.2.88/compiler/extra → fastled-1.2.91/demo}/mp3upload.html +0 -0
  73. {fastled-1.2.88/compiler/extra → fastled-1.2.91/demo}/webgl_postprocessing_unreal_bloom.html +0 -0
  74. {fastled-1.2.88 → fastled-1.2.91}/install +0 -0
  75. {fastled-1.2.88 → fastled-1.2.91}/install_linux.sh +0 -0
  76. {fastled-1.2.88 → fastled-1.2.91}/lint +0 -0
  77. {fastled-1.2.88 → fastled-1.2.91}/requirements.testing.txt +0 -0
  78. {fastled-1.2.88 → fastled-1.2.91}/setup.cfg +0 -0
  79. {fastled-1.2.88 → fastled-1.2.91}/setup.py +0 -0
  80. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/assets/example.txt +0 -0
  81. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/assets/localhost-key.pem +0 -0
  82. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/assets/localhost.pem +0 -0
  83. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/cli.py +0 -0
  84. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/cli_test.py +0 -0
  85. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/cli_test_interactive.py +0 -0
  86. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/client_server.py +0 -0
  87. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/compile_server.py +0 -0
  88. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/compile_server_impl.py +0 -0
  89. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/docker_manager.py +0 -0
  90. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/filewatcher.py +0 -0
  91. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/keyboard.py +0 -0
  92. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/keyz.py +0 -0
  93. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/live_client.py +0 -0
  94. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/open_browser.py +0 -0
  95. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/paths.py +0 -0
  96. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/print_filter.py +0 -0
  97. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/project_init.py +0 -0
  98. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/select_sketch_directory.py +0 -0
  99. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/server_start.py +0 -0
  100. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/settings.py +0 -0
  101. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/site/build.py +0 -0
  102. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/site/examples.py +0 -0
  103. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/spinner.py +0 -0
  104. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/string_diff.py +0 -0
  105. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/test/can_run_local_docker_tests.py +0 -0
  106. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/test/examples.py +0 -0
  107. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/types.py +0 -0
  108. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/util.py +0 -0
  109. {fastled-1.2.88 → fastled-1.2.91}/src/fastled/web_compile.py +0 -0
  110. {fastled-1.2.88 → fastled-1.2.91}/src/fastled.egg-info/dependency_links.txt +0 -0
  111. {fastled-1.2.88 → fastled-1.2.91}/src/fastled.egg-info/entry_points.txt +0 -0
  112. {fastled-1.2.88 → fastled-1.2.91}/src/fastled.egg-info/top_level.txt +0 -0
  113. {fastled-1.2.88 → fastled-1.2.91}/test +0 -0
  114. {fastled-1.2.88 → fastled-1.2.91}/tests/integration/test_build_examples.py +0 -0
  115. {fastled-1.2.88 → fastled-1.2.91}/tests/integration/test_examples.py +0 -0
  116. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/html/index.html +0 -0
  117. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_api.py +0 -0
  118. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_bad_ino.py +0 -0
  119. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_compile_server.py +0 -0
  120. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_docker_linux_on_windows.py +0 -0
  121. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_embedded_data.py +0 -0
  122. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_experimental_cpp_filter.py +0 -0
  123. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_fetch_source_files.py +0 -0
  124. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_filechanger.py +0 -0
  125. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_http_server.py +0 -0
  126. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_ino/bad/bad.ino +0 -0
  127. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_ino/bad_platformio/bad_platformio.ino +0 -0
  128. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_ino/embedded/data/bigdata.dat +0 -0
  129. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_ino/embedded/wasm.ino +0 -0
  130. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_ino/wasm/wasm.ino +0 -0
  131. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_print_filter.py +0 -0
  132. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_project_init.py +0 -0
  133. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_server_and_client_seperatly.py +0 -0
  134. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_string_diff.py +0 -0
  135. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_version.py +0 -0
  136. {fastled-1.2.88 → fastled-1.2.91}/tests/unit/test_webcompile.py +0 -0
  137. {fastled-1.2.88 → fastled-1.2.91}/upload_package.sh +0 -0
@@ -151,3 +151,4 @@ cache/
151
151
  dist/
152
152
  /fastled/
153
153
  logs
154
+ vscode-plugin
@@ -0,0 +1,85 @@
1
+
2
+ # The only reason we use docker is because of the fastled-wasm-compiler.
3
+ FROM niteris/fastled-wasm-compiler:latest
4
+
5
+
6
+ # Get the compiler requirements and install them.
7
+ COPY compiler/pyproject.toml /install/pyproject.toml
8
+ RUN uv pip install --system -r /install/pyproject.toml
9
+
10
+ # FIRST PRE-WARM CYCLE and initial setup: Download the fastled repo from the github and pre-warm the cache with a compilation.
11
+ # This is by far the most expensive part of the build, because platformio needs to download initial tools. This
12
+ # pre-warm cycle is "sticky" and tends to stay in the cache for a long time since docker is very relaxed about
13
+ # invalidating cache layers that clone a github repo.
14
+
15
+ RUN echo "force update4"
16
+ ARG FASTLED_BUILD_DAY=echo $(date +'%Y-%m-%d')
17
+ ENV FASTLED_BUILD_DAY=${FASTLED_BUILD_DAY}
18
+
19
+ ARG FASTLED_VERSION=master
20
+ ENV FASTLED_VERSION=${FASTLED_VERSION}
21
+ RUN mkdir -p /js/fastled && \
22
+ rsync -a /git/fastled/ /js/fastled/ --exclude='.git'
23
+
24
+ # Create symlinks for wasm platform files.
25
+ COPY compiler/init_runtime.py /js/init_runtime.py
26
+ COPY compiler/prewarm.sh /js/prewarm.sh
27
+
28
+ WORKDIR /js
29
+
30
+ ARG NO_PREWARM=0
31
+ ENV NO_PREWARM=${NO_PREWARM}
32
+
33
+ RUN python /js/init_runtime.py || true
34
+
35
+
36
+ # First pre-warm cycle - always do it as part of the build.
37
+ RUN mkdir -p /logs
38
+
39
+ # Force a build if the compiler flags change.
40
+ COPY compiler/CMakeLists.txt /trash/CMakeLists.txt
41
+ RUN rm -rf /trash
42
+
43
+ RUN chmod +x /js/prewarm.sh && \
44
+ cat /js/prewarm.sh >> /logs/prewarm.log.0
45
+ RUN /js/prewarm.sh --force >> /logs/prewarm.log.1 || true
46
+
47
+
48
+
49
+ # # Copy the fastled repo from the host machine and prepare for pre-warm
50
+ # # Make sure and delete files that have been removed so that we don't get
51
+ # # duplicate symbols from stale files.
52
+ # COPY *.json /host/fastled/
53
+ # COPY src/*.* /host/fastled/src/
54
+ # COPY examples /host/fastled/examples
55
+ # COPY src/fx /host/fastled/src/fx
56
+ # COPY src/fl /host/fastled/src/fl
57
+ # COPY src/lib8tion /host/fastled/src/lib8tion
58
+ # COPY src/third_party /host/fastled/src/third_party
59
+ # COPY src/sensors /host/fastled/src/sensors
60
+ # COPY src/platforms /host/fastled/src/platforms
61
+
62
+ RUN echo "force update"
63
+ COPY compiler /js/compiler
64
+
65
+ COPY compiler/entrypoint.sh /entrypoint.sh
66
+ RUN chmod +x /entrypoint.sh && dos2unix /entrypoint.sh
67
+
68
+ # RSYNC DISABLED FOR NOW
69
+ # now sync local to the source directory.
70
+ # RUN rsync -av /host/fastled/ /js/fastled/ && rm -rf /host/fastled
71
+
72
+ RUN python /js/init_runtime.py || true
73
+
74
+
75
+ # SECOND PRE-WARM CYCLE: Copy the fastled repo from the host machine and pre-warm the cache with that compilation. This will
76
+ # be much quicker than the first pre-warm cycle.
77
+ RUN /js/prewarm.sh --force > /logs/prewarm.log.2 || true
78
+
79
+ # Now timestamp the image and store it at the end of the build.
80
+ RUN date > /image_timestamp.txt
81
+
82
+ ENTRYPOINT ["/entrypoint.sh"]
83
+ CMD ["python", "/js/run.py", "server"]
84
+
85
+ # CMD ["/bin/bash", "/entrypoint.sh"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastled
3
- Version: 1.2.88
3
+ Version: 1.2.91
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -14,13 +14,13 @@ Requires-Dist: docker>=7.1.0
14
14
  Requires-Dist: httpx>=0.28.1
15
15
  Requires-Dist: watchdog>=6.0.0
16
16
  Requires-Dist: filelock>=3.16.1
17
- Requires-Dist: disklru>=2.0.1
18
17
  Requires-Dist: appdirs>=1.4.4
19
18
  Requires-Dist: rapidfuzz>=3.10.1
20
19
  Requires-Dist: progress>=1.6
21
20
  Requires-Dist: watchfiles>=1.0.5
22
21
  Requires-Dist: Flask>=3.0.0
23
22
  Requires-Dist: livereload
23
+ Requires-Dist: fastled-wasm-server>=1.0.5
24
24
  Dynamic: home-page
25
25
  Dynamic: license-file
26
26
  Dynamic: maintainer
@@ -38,7 +38,6 @@ Dynamic: maintainer
38
38
  [![Build Webpage](https://github.com/zackees/fastled-wasm/actions/workflows/build_webpage.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/build_webpage.yml)
39
39
 
40
40
 
41
-
42
41
  ## Compile your FastLED sketch and run it on the Browser!!
43
42
 
44
43
  ![image](https://github.com/user-attachments/assets/243aeb4d-e42f-4cc3-9c31-0af51271f3e0)
@@ -11,7 +11,6 @@
11
11
  [![Build Webpage](https://github.com/zackees/fastled-wasm/actions/workflows/build_webpage.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/build_webpage.yml)
12
12
 
13
13
 
14
-
15
14
  ## Compile your FastLED sketch and run it on the Browser!!
16
15
 
17
16
  ![image](https://github.com/user-attachments/assets/243aeb4d-e42f-4cc3-9c31-0af51271f3e0)
@@ -5,4 +5,4 @@ Go to src/fastled/__init__.py and increase the version number.
5
5
  Make sure this is the ONLY change in your repo (or the release will fail
6
6
  for unknown reasons) and commit and then push. Github builders will do all the rest.
7
7
 
8
- Make sure and watch the jobs to verify that it worked.
8
+ Make sure and watch the jobs to verify that it worked.
@@ -37,11 +37,6 @@ for line in images.strip().splitlines():
37
37
  # Step 4: Optionally remove volumes
38
38
  # _exec("docker volume prune -f") # Uncomment if you want to purge volumes too
39
39
 
40
- # Step 5: Remove local build artifacts (e.g., PlatformIO)
41
- if os.path.exists("build"):
42
- print("Removing local build/ directory")
43
- shutil.rmtree("build")
44
40
 
45
-
46
- # Step 6: Rebuild images
41
+ # Step 5: Rebuild images
47
42
  _exec("docker compose build")
@@ -24,16 +24,17 @@ import traceback # noqa: E402
24
24
  import warnings # noqa: E402
25
25
  from dataclasses import dataclass # noqa: E402
26
26
  from datetime import datetime # noqa: E402
27
- from enum import Enum # noqa: E402
28
27
  from pathlib import Path # noqa: E402
29
28
  from typing import List # noqa: E402
30
29
 
31
- from paths import ( # noqa: E402
30
+ from fastled_wasm_server.paths import ( # noqa: E402
32
31
  COMPILER_ROOT,
33
32
  FASTLED_COMPILER_DIR,
34
33
  PIO_BUILD_DIR,
35
34
  SKETCH_SRC,
36
35
  )
36
+ from fastled_wasm_server.print_banner import banner # noqa: E402
37
+ from fastled_wasm_server.types import BuildMode # noqa: E402
37
38
 
38
39
  print("Finished imports...")
39
40
 
@@ -55,20 +56,6 @@ _FASTLED_OUTPUT_DIR_NAME = "fastled_js"
55
56
  # DateLine class removed as it's no longer needed with streaming timestamps
56
57
 
57
58
 
58
- class BuildMode(Enum):
59
- DEBUG = "DEBUG"
60
- QUICK = "QUICK"
61
- RELEASE = "RELEASE"
62
-
63
- @classmethod
64
- def from_string(cls, mode_str: str) -> "BuildMode":
65
- try:
66
- return cls[mode_str.upper()]
67
- except KeyError:
68
- valid_modes = [mode.name for mode in cls]
69
- raise ValueError(f"BUILD_MODE must be one of {valid_modes}, got {mode_str}")
70
-
71
-
72
59
  @dataclass
73
60
  class SyntaxCheckResult:
74
61
  file_path: Path
@@ -78,66 +65,19 @@ class SyntaxCheckResult:
78
65
 
79
66
  def copy_files(src_dir: Path, js_src: Path) -> None:
80
67
  print("Copying files from mapped directory to container...")
68
+ found = False
81
69
  for item in src_dir.iterdir():
70
+ found = True
82
71
  if item.is_dir():
83
72
  print(f"Copying directory: {item}")
84
73
  shutil.copytree(item, js_src / item.name, dirs_exist_ok=True)
85
74
  else:
86
75
  print(f"Copying file: {item}")
87
76
  shutil.copy2(item, js_src / item.name)
88
- else:
77
+ if not found:
89
78
  warnings.warn(f"No files found in the mapped directory: {src_dir.absolute()}")
90
79
 
91
80
 
92
- def _banner(msg: str) -> str:
93
- """
94
- Create a banner for the given message.
95
- Example:
96
- msg = "Hello, World!"
97
- print -> "#################"
98
- "# Hello, World! #"
99
- "#################"
100
- """
101
- lines = msg.split("\n")
102
- # Find the width of the widest line
103
- max_width = max(len(line) for line in lines)
104
- width = max_width + 4 # Add 4 for "# " and " #"
105
-
106
- # Create the top border
107
- banner = "\n" + "#" * width + "\n"
108
-
109
- # Add each line with proper padding
110
- for line in lines:
111
- padding = max_width - len(line)
112
- banner += f"# {line}{' ' * padding} #\n"
113
-
114
- # Add the bottom border
115
- banner += "#" * width + "\n"
116
- return banner
117
-
118
-
119
- def _print_banner(msg: str) -> None:
120
- """Prints a banner with the given message."""
121
- print(_banner(msg))
122
-
123
-
124
- def _chunked_print(text: str, lines_per_print: int = 10) -> None:
125
- """Prints the text in chunks of the specified size."""
126
- lines = text.splitlines()
127
- buffer: list[str] = []
128
-
129
- def flush() -> None:
130
- if buffer:
131
- print("\n".join(buffer))
132
- buffer.clear()
133
-
134
- for line in lines:
135
- buffer.append(line)
136
- if len(buffer) >= lines_per_print:
137
- flush()
138
- flush()
139
-
140
-
141
81
  def compile(
142
82
  compiler_root: Path, build_mode: BuildMode, auto_clean: bool, no_platformio: bool
143
83
  ) -> int:
@@ -145,7 +85,7 @@ def compile(
145
85
  max_attempts = 1
146
86
  env = os.environ.copy()
147
87
  env["BUILD_MODE"] = build_mode.name
148
- print(_banner(f"WASM is building in mode: {build_mode.name}"))
88
+ print(banner(f"WASM is building in mode: {build_mode.name}"))
149
89
  cmd_list: list[str] = []
150
90
  if no_platformio:
151
91
  # execute build_archive.syh
@@ -163,7 +103,7 @@ def compile(
163
103
 
164
104
  def _open_process(cmd_list: list[str] = cmd_list) -> subprocess.Popen:
165
105
  print(
166
- _banner(
106
+ banner(
167
107
  "Build started with command:\n " + subprocess.list2cmdline(cmd_list)
168
108
  )
169
109
  )
@@ -194,7 +134,7 @@ def compile(
194
134
 
195
135
  process.wait()
196
136
 
197
- print(_banner("Compilation process Finsished."))
137
+ print(banner("Compilation process Finsished."))
198
138
 
199
139
  if process.returncode == 0:
200
140
  print("\nCompilation successful.\n")
@@ -202,7 +142,7 @@ def compile(
202
142
  else:
203
143
  raise subprocess.CalledProcessError(process.returncode, ["pio", "run"])
204
144
  except subprocess.CalledProcessError:
205
- print(_banner(f"Compilation failed on attempt {attempt}"))
145
+ print(banner(f"Compilation failed on attempt {attempt}"))
206
146
  if attempt == max_attempts:
207
147
  print("Max attempts reached. Compilation failed.")
208
148
  return 1
@@ -258,7 +198,7 @@ def transform_to_cpp(src_dir: Path) -> None:
258
198
  def insert_headers(
259
199
  src_dir: Path, exclusion_folders: List[Path], file_extensions: List[str]
260
200
  ) -> None:
261
- print(_banner("Inserting headers in source files..."))
201
+ print(banner("Inserting headers in source files..."))
262
202
  for file in src_dir.rglob("*"):
263
203
  if (
264
204
  file.suffix in file_extensions
@@ -272,7 +212,7 @@ def process_ino_files(src_dir: Path) -> None:
272
212
  transform_to_cpp(src_dir)
273
213
  exclusion_folders: List[Path] = []
274
214
  insert_headers(src_dir, exclusion_folders, _FILE_EXTENSIONS)
275
- print(_banner("Transform to cpp and insert header operations completed."))
215
+ print(banner("Transform to cpp and insert header operations completed."))
276
216
 
277
217
 
278
218
  class StreamingTimestamper:
@@ -414,7 +354,7 @@ def process_compile(
414
354
  if rtn != 0:
415
355
  print("Compilation failed.")
416
356
  raise RuntimeError("Compilation failed.")
417
- print(_banner("Compilation successful."))
357
+ print(banner("Compilation successful."))
418
358
 
419
359
 
420
360
  def cleanup(args: Args, js_src: Path) -> None:
@@ -455,12 +395,12 @@ def run(args: Args) -> int:
455
395
  print(f"Using mapped directory: {args.mapped_dir}")
456
396
 
457
397
  if args.profile:
458
- print(_banner("Enabling profiling for compilation."))
398
+ print(banner("Enabling profiling for compilation."))
459
399
  # Profile linking
460
400
  os.environ["EMPROFILE"] = "2"
461
401
  else:
462
402
  print(
463
- _banner(
403
+ banner(
464
404
  "Build process profiling is disabled\nuse --profile to get metrics on how long the build process took."
465
405
  )
466
406
  )
@@ -534,7 +474,7 @@ def run(args: Args) -> int:
534
474
  else:
535
475
  build_dir = _get_build_dir_platformio()
536
476
 
537
- print(_banner("Copying output files..."))
477
+ print(banner("Copying output files..."))
538
478
  out_dir: Path = src_dir / _FASTLED_OUTPUT_DIR_NAME
539
479
  out_dir.mkdir(parents=True, exist_ok=True)
540
480
 
@@ -595,7 +535,7 @@ def run(args: Args) -> int:
595
535
  if _file.is_file(): # Only copy files, not directories
596
536
  filename: str = _file.name
597
537
  if filename.endswith(".embedded.json"):
598
- print(_banner("Embedding data file"))
538
+ print(banner("Embedding data file"))
599
539
  filename_no_embedded = filename.replace(
600
540
  ".embedded.json", ""
601
541
  )
@@ -626,13 +566,13 @@ def run(args: Args) -> int:
626
566
  )
627
567
 
628
568
  # Write manifest file even if empty
629
- print(_banner("Writing manifest files.json"))
569
+ print(banner("Writing manifest files.json"))
630
570
  manifest_json_str = json.dumps(manifest, indent=2, sort_keys=True)
631
571
  with open(out_dir / "files.json", "w") as f:
632
572
  f.write(manifest_json_str)
633
573
  cleanup(args, SKETCH_SRC)
634
574
 
635
- print(_banner("Compilation process completed successfully"))
575
+ print(banner("Compilation process completed successfully"))
636
576
  return 0
637
577
 
638
578
  except Exception as e:
@@ -79,24 +79,18 @@ def make_links() -> None:
79
79
  "*.h",
80
80
  "*.hpp",
81
81
  "*.cpp",
82
- "*.py",
83
82
  "*.sh",
84
83
  "*.ino",
85
- "*.ini",
86
84
  "*.txt",
87
85
  ]
88
86
 
89
87
  # Get all matching files in compiler directory
90
88
  tasks = _collect_docker_compile_files(globs=patterns)
91
89
  tasks += _collect_fastled_compile_files(globs=patterns)
92
-
93
- for pattern in patterns:
94
- for file_path in glob.glob(str(FASTLED_COMPILER_DIR / pattern)):
95
- src = Path(file_path)
96
- if "entrypoint.sh" in str(src):
97
- continue
98
- dst = COMPILER_ROOT / src.name
99
- tasks.append((src, dst))
90
+ tasks += [
91
+ ("/platformio/wasm_compiler_flags.py", COMPILER_ROOT / "wasm_compiler_flags.py")
92
+ ]
93
+ tasks += [("/platformio/fastled.json", COMPILER_ROOT / "fastled.json")]
100
94
 
101
95
  # Process files in parallel using ThreadPoolExecutor
102
96
  with ThreadPoolExecutor(max_workers=16) as executor:
@@ -32,12 +32,11 @@ mkdir -p /prewarm && cp -r /js/fastled/examples/wasm /prewarm/wasm
32
32
  python /js/compile.py --quick --mapped-dir /prewarm && rm -rf /js/.pio/build/wasm/src/wasm.ino.o || echo "failed to delete wasm.ino.o"
33
33
  rm -rf /prewarm
34
34
 
35
- mkdir -p /prewarm && cp -r /js/fastled/examples/wasm /prewarm/wasm
36
- python /js/compile.py --release --mapped-dir /prewarm && rm -rf /js/.pio/build/wasm/src/wasm.ino.o || echo "failed to delete wasm.ino.o"
37
- rm -rf /prewarm
38
35
 
39
36
  mkdir -p /prewarm && cp -r /js/fastled/examples/wasm /prewarm/wasm
40
37
  cd /js
41
38
  python compile.py --no-platformio --mapped-dir /prewarm # 60 seconds -> 5 seconds
42
39
  python compile.py --no-platformio --mapped-dir /prewarm # 5 seconds -> 0.5 seconds
43
40
  rm -rf /prewarm
41
+
42
+ # I think delete wasm is missing here
@@ -9,13 +9,13 @@ description = "FastLED Server"
9
9
  requires-python = ">=3.10"
10
10
 
11
11
  dependencies = [
12
- "platformio==6.1.17",
13
12
  "fastapi==0.115.11",
14
13
  "uvicorn[standard]==0.34.0",
15
14
  "python-multipart==0.0.20",
16
15
  "disklru==2.0.0",
17
16
  "psutil==6.1.1",
18
17
  "wormhole-tx",
18
+ "fastled-wasm-server>=1.0.4",
19
19
  ]
20
20
 
21
21
  [tool.setuptools]
@@ -6,8 +6,8 @@ import warnings
6
6
  from pathlib import Path
7
7
  from typing import Tuple
8
8
 
9
- from code_sync import CodeSync
10
- from paths import FASTLED_SRC, VOLUME_MAPPED_SRC
9
+ from fastled_wasm_server.code_sync import CodeSync
10
+ from fastled_wasm_server.paths import FASTLED_SRC, VOLUME_MAPPED_SRC
11
11
 
12
12
  _PORT = os.environ.get("PORT", 80)
13
13
 
@@ -72,7 +72,7 @@ def _run_server(unknown_args: list[str]) -> int:
72
72
  unknown_args = []
73
73
  cmd_list = [
74
74
  "uvicorn",
75
- "server:app",
75
+ "fastled_wasm_server.server:app",
76
76
  "--host",
77
77
  "0.0.0.0",
78
78
  "--workers",
@@ -7,4 +7,4 @@ services:
7
7
  - "8234:80"
8
8
  environment:
9
9
  - ENVIRONMENT=dev
10
- image: niteris/fastled-wasm:latest
10
+ image: niteris/fastled-wasm:local
@@ -16,7 +16,6 @@ dependencies = [
16
16
  "watchdog>=6.0.0",
17
17
  ########## Begin Docker Manager Dependencies
18
18
  "filelock>=3.16.1",
19
- "disklru>=2.0.1",
20
19
  "appdirs>=1.4.4",
21
20
  "rapidfuzz>=3.10.1",
22
21
  "progress>=1.6",
@@ -24,11 +23,12 @@ dependencies = [
24
23
  "watchfiles>=1.0.5",
25
24
  "Flask>=3.0.0",
26
25
  "livereload",
26
+ ###### WASM SERVER ######
27
+ "fastled-wasm-server>=1.0.5", # This version can float upwards, while the docker is pinned.
27
28
  ]
28
29
 
29
30
  dynamic = ["version"]
30
31
 
31
-
32
32
  [tool.setuptools]
33
33
  package-dir = {"" = "src"}
34
34
 
@@ -14,7 +14,7 @@ from .types import BuildMode, CompileResult, CompileServerError, FileResponse
14
14
  # IMPORTANT! There's a bug in github which will REJECT any version update
15
15
  # that has any other change in the repo. Please bump the version as the
16
16
  # ONLY change in a commit, or else the pypi update and the release will fail.
17
- __version__ = "1.2.88"
17
+ __version__ = "1.2.91"
18
18
 
19
19
 
20
20
  class Api:
@@ -10,6 +10,13 @@ from fastled.client_server import run_client_server
10
10
  from fastled.compile_server import CompileServer
11
11
  from fastled.filewatcher import file_watcher_set
12
12
  from fastled.parse_args import Args, parse_args
13
+ from fastled.sketch import find_sketch_directories, looks_like_fastled_repo
14
+
15
+ # from fastled.sketch import (
16
+ # find_sketch_directories,
17
+ # looks_like_fastled_repo,
18
+ # looks_like_sketch_directory,
19
+ # )
13
20
 
14
21
 
15
22
  def run_server(args: Args) -> int:
@@ -53,10 +60,37 @@ def main() -> int:
53
60
  just_compile: bool = args.just_compile
54
61
  # directory: Path | None = Path(args.directory).absolute() if args.directory else None
55
62
  directory: Path | None = Path(args.directory) if args.directory else None
63
+ cwd_looks_like_fastled_repo = looks_like_fastled_repo()
56
64
 
57
65
  # now it is safe to print out the version
58
66
  print(f"FastLED version: {__version__}")
59
67
 
68
+ # Resolve some of the last interactive arguments
69
+ # 1. If interactive is set and the sketch directory is not given,
70
+ # then prompt the user for a sketch directory.
71
+ # 2. Tell the user they can use --server --interactive to
72
+ # skip this prompt.
73
+
74
+ from fastled.select_sketch_directory import select_sketch_directory
75
+
76
+ if interactive and cwd_looks_like_fastled_repo and directory is None:
77
+ answer = input(
78
+ "No sketch directory selected, would you like to select one? (y/n): "
79
+ )
80
+ if answer.lower() == "y":
81
+ sketch_list: list[Path] = find_sketch_directories()
82
+ if sketch_list:
83
+ maybe_dir: str | None = select_sketch_directory(
84
+ sketch_list, cwd_looks_like_fastled_repo
85
+ )
86
+ if maybe_dir is not None:
87
+ directory = Path(maybe_dir)
88
+ if not directory.exists():
89
+ print(
90
+ f"Directory {directory} does not exist, entering interactive mode without project mapped in."
91
+ )
92
+ directory = None
93
+
60
94
  if update:
61
95
  # Force auto_update to ensure update check happens
62
96
  compile_server = CompileServer(interactive=False, auto_updates=True)
@@ -30,9 +30,7 @@ FastLED WASM Compiler - Useful options:
30
30
  --init [example] Initialize one of the top tier WASM examples
31
31
  --web [url] Use web compiler
32
32
  --server Run the compiler server
33
- --debug Build with debug symbols for dev-tools debugging
34
33
  --quick Build in quick mode (default)
35
- --release Build in optimized release mode
36
34
  --profile Enable profiling the C++ build system
37
35
  --update Update the docker image for the wasm compiler
38
36
  --purge Remove all FastLED containers and images
@@ -44,6 +42,11 @@ Examples:
44
42
  fastled my_sketch --web (compiles using the web compiler only)
45
43
  fastled --init Blink (initializes a new sketch directory with the Blink example)
46
44
  fastled --server (runs the compiler server in the current directory)
45
+
46
+ For those using Docker:
47
+ --debug Build with debug symbols for dev-tools debugging
48
+
49
+ --release Build in optimized release mode
47
50
  """
48
51
 
49
52
 
@@ -8,7 +8,7 @@ import httpx
8
8
  from livereload import Server
9
9
 
10
10
  # Logging configuration
11
- _ENABLE_LOGGING = True # Set to False to disable logging
11
+ _ENABLE_LOGGING = False # Set to False to disable logging
12
12
 
13
13
  if _ENABLE_LOGGING:
14
14
  logging.basicConfig(
@@ -4,7 +4,9 @@ from pathlib import Path
4
4
  _MAX_FILES_SEARCH_LIMIT = 10000
5
5
 
6
6
 
7
- def find_sketch_directories(directory: Path) -> list[Path]:
7
+ def find_sketch_directories(directory: Path | None = None) -> list[Path]:
8
+ if directory is None:
9
+ directory = Path(".")
8
10
  file_count = 0
9
11
  sketch_directories: list[Path] = []
10
12
  # search all the paths one level deep
@@ -60,7 +62,7 @@ def get_sketch_files(directory: Path) -> list[Path]:
60
62
  return files
61
63
 
62
64
 
63
- def looks_like_fastled_repo(directory: Path) -> bool:
65
+ def looks_like_fastled_repo(directory: Path = Path(".")) -> bool:
64
66
  libprops = directory / "library.properties"
65
67
  if not libprops.exists():
66
68
  return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastled
3
- Version: 1.2.88
3
+ Version: 1.2.91
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -14,13 +14,13 @@ Requires-Dist: docker>=7.1.0
14
14
  Requires-Dist: httpx>=0.28.1
15
15
  Requires-Dist: watchdog>=6.0.0
16
16
  Requires-Dist: filelock>=3.16.1
17
- Requires-Dist: disklru>=2.0.1
18
17
  Requires-Dist: appdirs>=1.4.4
19
18
  Requires-Dist: rapidfuzz>=3.10.1
20
19
  Requires-Dist: progress>=1.6
21
20
  Requires-Dist: watchfiles>=1.0.5
22
21
  Requires-Dist: Flask>=3.0.0
23
22
  Requires-Dist: livereload
23
+ Requires-Dist: fastled-wasm-server>=1.0.5
24
24
  Dynamic: home-page
25
25
  Dynamic: license-file
26
26
  Dynamic: maintainer
@@ -38,7 +38,6 @@ Dynamic: maintainer
38
38
  [![Build Webpage](https://github.com/zackees/fastled-wasm/actions/workflows/build_webpage.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/build_webpage.yml)
39
39
 
40
40
 
41
-
42
41
  ## Compile your FastLED sketch and run it on the Browser!!
43
42
 
44
43
  ![image](https://github.com/user-attachments/assets/243aeb4d-e42f-4cc3-9c31-0af51271f3e0)