jac-client 0.2.12__py3-none-any.whl → 0.2.13__py3-none-any.whl
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.
- jac_client/plugin/cli.jac +3 -3
- jac_client/plugin/client_runtime.cl.jac +3 -2
- jac_client/plugin/impl/client_runtime.impl.jac +17 -6
- jac_client/plugin/src/compiler.jac +4 -0
- jac_client/plugin/src/config_loader.jac +1 -0
- jac_client/plugin/src/impl/compiler.impl.jac +16 -39
- jac_client/plugin/src/impl/config_loader.impl.jac +8 -0
- jac_client/plugin/src/impl/vite_bundler.impl.jac +39 -4
- jac_client/plugin/src/targets/desktop/sidecar/main.py +42 -23
- jac_client/plugin/src/targets/desktop_target.jac +4 -2
- jac_client/plugin/src/targets/impl/desktop_target.impl.jac +324 -112
- jac_client/plugin/src/vite_bundler.jac +18 -3
- jac_client/tests/test_cli.py +74 -0
- jac_client/tests/test_desktop_api_url.py +854 -0
- jac_client/tests/test_e2e.py +12 -12
- jac_client/tests/test_it.py +209 -11
- {jac_client-0.2.12.dist-info → jac_client-0.2.13.dist-info}/METADATA +2 -2
- {jac_client-0.2.12.dist-info → jac_client-0.2.13.dist-info}/RECORD +21 -20
- {jac_client-0.2.12.dist-info → jac_client-0.2.13.dist-info}/WHEEL +0 -0
- {jac_client-0.2.12.dist-info → jac_client-0.2.13.dist-info}/entry_points.txt +0 -0
- {jac_client-0.2.12.dist-info → jac_client-0.2.13.dist-info}/top_level.txt +0 -0
jac_client/tests/test_cli.py
CHANGED
|
@@ -988,3 +988,77 @@ def test_vite_build_prompts_for_missing_client_deps() -> None:
|
|
|
988
988
|
|
|
989
989
|
assert pkg["dependencies"].get("react"), "package.json should have react"
|
|
990
990
|
assert pkg["devDependencies"].get("vite"), "package.json should have vite"
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
def test_start_dev_with_client_does_initial_compilation() -> None:
|
|
994
|
+
"""Test that `jac start --dev` with client enabled performs initial compilation."""
|
|
995
|
+
import time
|
|
996
|
+
|
|
997
|
+
test_project_name = "test-start-dev-client"
|
|
998
|
+
with tempfile.TemporaryDirectory() as temp_dir:
|
|
999
|
+
original_cwd = os.getcwd()
|
|
1000
|
+
try:
|
|
1001
|
+
os.chdir(temp_dir)
|
|
1002
|
+
# Create a client project
|
|
1003
|
+
process = Popen(
|
|
1004
|
+
["jac", "create", "--use", "client", test_project_name],
|
|
1005
|
+
stdin=PIPE,
|
|
1006
|
+
stdout=PIPE,
|
|
1007
|
+
stderr=PIPE,
|
|
1008
|
+
text=True,
|
|
1009
|
+
)
|
|
1010
|
+
stdout, stderr = process.communicate()
|
|
1011
|
+
assert process.returncode == 0
|
|
1012
|
+
# Change to project directory
|
|
1013
|
+
os.chdir(test_project_name)
|
|
1014
|
+
# Install dependencies
|
|
1015
|
+
install_process = Popen(
|
|
1016
|
+
["jac", "install", "--dev"],
|
|
1017
|
+
stdout=PIPE,
|
|
1018
|
+
stderr=PIPE,
|
|
1019
|
+
text=True,
|
|
1020
|
+
)
|
|
1021
|
+
install_stdout, install_stderr = install_process.communicate()
|
|
1022
|
+
assert install_process.returncode == 0, (
|
|
1023
|
+
f"jac install --dev failed: {install_stderr}"
|
|
1024
|
+
)
|
|
1025
|
+
# Run jac start --dev main.jac
|
|
1026
|
+
process = Popen(
|
|
1027
|
+
["jac", "start", "--dev", "main.jac"],
|
|
1028
|
+
stdout=PIPE,
|
|
1029
|
+
stderr=PIPE,
|
|
1030
|
+
text=True,
|
|
1031
|
+
)
|
|
1032
|
+
# Wait for the initial compilation message or timeout
|
|
1033
|
+
start_time = time.time()
|
|
1034
|
+
output = ""
|
|
1035
|
+
found_message = False
|
|
1036
|
+
while time.time() - start_time < 30: # 30 seconds timeout
|
|
1037
|
+
if process.poll() is not None:
|
|
1038
|
+
break
|
|
1039
|
+
if process.stdout is None:
|
|
1040
|
+
break
|
|
1041
|
+
line = process.stdout.readline()
|
|
1042
|
+
if not line:
|
|
1043
|
+
time.sleep(0.1)
|
|
1044
|
+
continue
|
|
1045
|
+
output += line
|
|
1046
|
+
if "Initial client compilation completed" in output:
|
|
1047
|
+
found_message = True
|
|
1048
|
+
break
|
|
1049
|
+
# Terminate the process
|
|
1050
|
+
process.terminate()
|
|
1051
|
+
try:
|
|
1052
|
+
process.wait(timeout=5)
|
|
1053
|
+
except Exception:
|
|
1054
|
+
process.kill()
|
|
1055
|
+
# Close pipes
|
|
1056
|
+
if process.stdout:
|
|
1057
|
+
process.stdout.close()
|
|
1058
|
+
if process.stderr:
|
|
1059
|
+
process.stderr.close()
|
|
1060
|
+
assert found_message, (
|
|
1061
|
+
f"Expected 'Initial client compilation completed' in output, but got: {output}"
|
|
1062
|
+
)
|
|
1063
|
+
finally:
|
|
1064
|
+
os.chdir(original_cwd)
|