jac-client 0.2.2__py3-none-any.whl → 0.2.6__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.
Files changed (202) hide show
  1. jac_client/examples/all-in-one/assets/workers/worker.py +5 -0
  2. jac_client/examples/all-in-one/src/app.jac +841 -0
  3. jac_client/examples/all-in-one/{button.jac → src/button.jac} +1 -1
  4. jac_client/examples/all-in-one/{components → src/components}/button.jac +1 -1
  5. jac_client/examples/asset-serving/css-with-image/{app.jac → src/app.jac} +2 -2
  6. jac_client/examples/asset-serving/image-asset/{app.jac → src/app.jac} +2 -2
  7. jac_client/examples/asset-serving/import-alias/{app.jac → src/app.jac} +7 -7
  8. jac_client/examples/basic/{app.jac → src/app.jac} +2 -2
  9. jac_client/examples/basic-auth/src/app.jac +377 -0
  10. jac_client/examples/basic-auth-with-router/{app.jac → src/app.jac} +18 -18
  11. jac_client/examples/basic-full-stack/{app.jac → src/app.jac} +175 -130
  12. jac_client/examples/css-styling/js-styling/{app.jac → src/app.jac} +6 -6
  13. jac_client/examples/css-styling/material-ui/{app.jac → src/app.jac} +5 -5
  14. jac_client/examples/css-styling/pure-css/{app.jac → src/app.jac} +6 -6
  15. jac_client/examples/css-styling/sass-example/{app.jac → src/app.jac} +6 -6
  16. jac_client/examples/css-styling/styled-components/{app.jac → src/app.jac} +5 -5
  17. jac_client/examples/css-styling/tailwind-example/{app.jac → src/app.jac} +6 -6
  18. jac_client/examples/full-stack-with-auth/{app.jac → src/app.jac} +37 -37
  19. jac_client/examples/little-x/{app.jac → src/app.jac} +27 -32
  20. jac_client/examples/little-x/src/submit-button.jac +16 -0
  21. jac_client/examples/nested-folders/nested-advance/{ButtonRoot.jac → src/ButtonRoot.jac} +1 -1
  22. jac_client/examples/nested-folders/nested-advance/{app.jac → src/app.jac} +1 -1
  23. jac_client/examples/nested-folders/nested-advance/{level1 → src/level1}/ButtonSecondL.jac +1 -1
  24. jac_client/examples/nested-folders/nested-advance/{level1 → src/level1}/Card.jac +1 -1
  25. jac_client/examples/nested-folders/nested-advance/{level1 → src/level1}/level2/ButtonThirdL.jac +1 -1
  26. jac_client/examples/nested-folders/nested-basic/{app.jac → src/app.jac} +2 -2
  27. jac_client/examples/nested-folders/nested-basic/{button.jac → src/button.jac} +1 -1
  28. jac_client/examples/nested-folders/nested-basic/{components → src/components}/button.jac +1 -1
  29. jac_client/examples/ts-support/src/app.jac +35 -0
  30. jac_client/examples/with-router/{app.jac → src/app.jac} +11 -11
  31. jac_client/plugin/cli.jac +547 -0
  32. jac_client/plugin/client.jac +52 -0
  33. jac_client/plugin/client_runtime.cl.jac +38 -0
  34. jac_client/plugin/impl/client.impl.jac +134 -0
  35. jac_client/plugin/impl/client_runtime.impl.jac +177 -0
  36. jac_client/plugin/impl/vite_client_bundle.impl.jac +72 -0
  37. jac_client/plugin/plugin_config.jac +195 -0
  38. jac_client/plugin/src/__init__.jac +20 -0
  39. jac_client/plugin/src/asset_processor.jac +33 -0
  40. jac_client/plugin/src/babel_processor.jac +18 -0
  41. jac_client/plugin/src/compiler.jac +66 -0
  42. jac_client/plugin/src/config_loader.jac +32 -0
  43. jac_client/plugin/src/impl/asset_processor.impl.jac +127 -0
  44. jac_client/plugin/src/impl/babel_processor.impl.jac +84 -0
  45. jac_client/plugin/src/impl/compiler.impl.jac +251 -0
  46. jac_client/plugin/src/impl/config_loader.impl.jac +119 -0
  47. jac_client/plugin/src/impl/import_processor.impl.jac +33 -0
  48. jac_client/plugin/src/impl/jac_to_js.impl.jac +41 -0
  49. jac_client/plugin/src/impl/package_installer.impl.jac +105 -0
  50. jac_client/plugin/src/impl/vite_bundler.impl.jac +513 -0
  51. jac_client/plugin/src/import_processor.jac +19 -0
  52. jac_client/plugin/src/jac_to_js.jac +35 -0
  53. jac_client/plugin/src/package_installer.jac +26 -0
  54. jac_client/plugin/src/vite_bundler.jac +36 -0
  55. jac_client/plugin/vite_client_bundle.jac +31 -0
  56. jac_client/tests/conftest.py +281 -0
  57. jac_client/tests/fixtures/basic-app/app.jac +2 -2
  58. jac_client/tests/fixtures/cl_file/app.cl.jac +2 -2
  59. jac_client/tests/fixtures/client_app_with_antd/app.jac +1 -1
  60. jac_client/tests/fixtures/js_import/app.jac +5 -5
  61. jac_client/tests/fixtures/spawn_test/app.jac +7 -7
  62. jac_client/tests/fixtures/with-ts/app.jac +35 -0
  63. jac_client/tests/test_cli.py +755 -0
  64. jac_client/tests/test_it.py +347 -67
  65. {jac_client-0.2.2.dist-info → jac_client-0.2.6.dist-info}/METADATA +30 -24
  66. jac_client-0.2.6.dist-info/RECORD +74 -0
  67. {jac_client-0.2.2.dist-info → jac_client-0.2.6.dist-info}/WHEEL +2 -1
  68. jac_client-0.2.6.dist-info/entry_points.txt +4 -0
  69. jac_client-0.2.6.dist-info/top_level.txt +1 -0
  70. jac_client/docs/README.md +0 -689
  71. jac_client/docs/advanced-state.md +0 -1265
  72. jac_client/docs/asset-serving/intro.md +0 -209
  73. jac_client/docs/assets/pipe_line-v2.svg +0 -32
  74. jac_client/docs/assets/pipe_line.png +0 -0
  75. jac_client/docs/file-system/app.jac.md +0 -121
  76. jac_client/docs/file-system/backend-frontend.md +0 -217
  77. jac_client/docs/file-system/intro.md +0 -72
  78. jac_client/docs/file-system/nested-imports.md +0 -348
  79. jac_client/docs/guide-example/intro.md +0 -115
  80. jac_client/docs/guide-example/step-01-setup.md +0 -270
  81. jac_client/docs/guide-example/step-02-components.md +0 -416
  82. jac_client/docs/guide-example/step-03-styling.md +0 -478
  83. jac_client/docs/guide-example/step-04-todo-ui.md +0 -477
  84. jac_client/docs/guide-example/step-05-local-state.md +0 -530
  85. jac_client/docs/guide-example/step-06-events.md +0 -749
  86. jac_client/docs/guide-example/step-07-effects.md +0 -468
  87. jac_client/docs/guide-example/step-08-walkers.md +0 -534
  88. jac_client/docs/guide-example/step-09-authentication.md +0 -586
  89. jac_client/docs/guide-example/step-10-routing.md +0 -539
  90. jac_client/docs/guide-example/step-11-final.md +0 -963
  91. jac_client/docs/imports.md +0 -1141
  92. jac_client/docs/lifecycle-hooks.md +0 -773
  93. jac_client/docs/routing.md +0 -659
  94. jac_client/docs/styling/intro.md +0 -249
  95. jac_client/docs/styling/js-styling.md +0 -367
  96. jac_client/docs/styling/material-ui.md +0 -341
  97. jac_client/docs/styling/pure-css.md +0 -299
  98. jac_client/docs/styling/sass.md +0 -403
  99. jac_client/docs/styling/styled-components.md +0 -395
  100. jac_client/docs/styling/tailwind.md +0 -298
  101. jac_client/examples/all-in-one/.babelrc +0 -9
  102. jac_client/examples/all-in-one/README.md +0 -16
  103. jac_client/examples/all-in-one/app.jac +0 -426
  104. jac_client/examples/all-in-one/assets/burger.png +0 -0
  105. jac_client/examples/all-in-one/package.json +0 -29
  106. jac_client/examples/all-in-one/styles.css +0 -26
  107. jac_client/examples/all-in-one/vite.config.js +0 -28
  108. jac_client/examples/asset-serving/css-with-image/.babelrc +0 -9
  109. jac_client/examples/asset-serving/css-with-image/README.md +0 -91
  110. jac_client/examples/asset-serving/css-with-image/assets/burger.png +0 -0
  111. jac_client/examples/asset-serving/css-with-image/package.json +0 -28
  112. jac_client/examples/asset-serving/css-with-image/styles.css +0 -26
  113. jac_client/examples/asset-serving/css-with-image/vite.config.js +0 -28
  114. jac_client/examples/asset-serving/image-asset/.babelrc +0 -9
  115. jac_client/examples/asset-serving/image-asset/README.md +0 -119
  116. jac_client/examples/asset-serving/image-asset/assets/burger.png +0 -0
  117. jac_client/examples/asset-serving/image-asset/package.json +0 -28
  118. jac_client/examples/asset-serving/image-asset/styles.css +0 -26
  119. jac_client/examples/asset-serving/image-asset/vite.config.js +0 -28
  120. jac_client/examples/asset-serving/import-alias/.babelrc +0 -9
  121. jac_client/examples/asset-serving/import-alias/README.md +0 -83
  122. jac_client/examples/asset-serving/import-alias/assets/burger.png +0 -0
  123. jac_client/examples/asset-serving/import-alias/package.json +0 -28
  124. jac_client/examples/asset-serving/import-alias/vite.config.js +0 -28
  125. jac_client/examples/basic/.babelrc +0 -9
  126. jac_client/examples/basic/README.md +0 -16
  127. jac_client/examples/basic/package.json +0 -27
  128. jac_client/examples/basic/vite.config.js +0 -27
  129. jac_client/examples/basic-auth/.babelrc +0 -9
  130. jac_client/examples/basic-auth/README.md +0 -16
  131. jac_client/examples/basic-auth/app.jac +0 -308
  132. jac_client/examples/basic-auth/package.json +0 -27
  133. jac_client/examples/basic-auth/vite.config.js +0 -27
  134. jac_client/examples/basic-auth-with-router/.babelrc +0 -9
  135. jac_client/examples/basic-auth-with-router/README.md +0 -60
  136. jac_client/examples/basic-auth-with-router/package.json +0 -28
  137. jac_client/examples/basic-auth-with-router/vite.config.js +0 -27
  138. jac_client/examples/basic-full-stack/.babelrc +0 -9
  139. jac_client/examples/basic-full-stack/README.md +0 -18
  140. jac_client/examples/basic-full-stack/package.json +0 -28
  141. jac_client/examples/basic-full-stack/vite.config.js +0 -27
  142. jac_client/examples/css-styling/js-styling/.babelrc +0 -9
  143. jac_client/examples/css-styling/js-styling/README.md +0 -183
  144. jac_client/examples/css-styling/js-styling/package.json +0 -28
  145. jac_client/examples/css-styling/js-styling/styles.js +0 -100
  146. jac_client/examples/css-styling/js-styling/vite.config.js +0 -27
  147. jac_client/examples/css-styling/material-ui/.babelrc +0 -9
  148. jac_client/examples/css-styling/material-ui/README.md +0 -16
  149. jac_client/examples/css-styling/material-ui/package.json +0 -32
  150. jac_client/examples/css-styling/material-ui/vite.config.js +0 -27
  151. jac_client/examples/css-styling/pure-css/.babelrc +0 -9
  152. jac_client/examples/css-styling/pure-css/README.md +0 -16
  153. jac_client/examples/css-styling/pure-css/package.json +0 -28
  154. jac_client/examples/css-styling/pure-css/styles.css +0 -111
  155. jac_client/examples/css-styling/pure-css/vite.config.js +0 -27
  156. jac_client/examples/css-styling/sass-example/.babelrc +0 -9
  157. jac_client/examples/css-styling/sass-example/README.md +0 -16
  158. jac_client/examples/css-styling/sass-example/package.json +0 -29
  159. jac_client/examples/css-styling/sass-example/styles.scss +0 -153
  160. jac_client/examples/css-styling/sass-example/vite.config.js +0 -27
  161. jac_client/examples/css-styling/styled-components/.babelrc +0 -9
  162. jac_client/examples/css-styling/styled-components/README.md +0 -16
  163. jac_client/examples/css-styling/styled-components/package.json +0 -29
  164. jac_client/examples/css-styling/styled-components/styled.js +0 -90
  165. jac_client/examples/css-styling/styled-components/vite.config.js +0 -27
  166. jac_client/examples/css-styling/tailwind-example/.babelrc +0 -9
  167. jac_client/examples/css-styling/tailwind-example/README.md +0 -16
  168. jac_client/examples/css-styling/tailwind-example/global.css +0 -1
  169. jac_client/examples/css-styling/tailwind-example/package.json +0 -30
  170. jac_client/examples/css-styling/tailwind-example/vite.config.js +0 -29
  171. jac_client/examples/full-stack-with-auth/.babelrc +0 -9
  172. jac_client/examples/full-stack-with-auth/README.md +0 -16
  173. jac_client/examples/full-stack-with-auth/package.json +0 -28
  174. jac_client/examples/full-stack-with-auth/vite.config.js +0 -29
  175. jac_client/examples/little-x/package.json +0 -23
  176. jac_client/examples/little-x/submit-button.jac +0 -8
  177. jac_client/examples/nested-folders/nested-advance/.babelrc +0 -9
  178. jac_client/examples/nested-folders/nested-advance/README.md +0 -77
  179. jac_client/examples/nested-folders/nested-advance/package.json +0 -29
  180. jac_client/examples/nested-folders/nested-advance/vite.config.js +0 -28
  181. jac_client/examples/nested-folders/nested-basic/.babelrc +0 -9
  182. jac_client/examples/nested-folders/nested-basic/README.md +0 -183
  183. jac_client/examples/nested-folders/nested-basic/app.js +0 -7
  184. jac_client/examples/nested-folders/nested-basic/package.json +0 -28
  185. jac_client/examples/nested-folders/nested-basic/vite.config.js +0 -27
  186. jac_client/examples/with-router/.babelrc +0 -9
  187. jac_client/examples/with-router/README.md +0 -17
  188. jac_client/examples/with-router/package.json +0 -28
  189. jac_client/examples/with-router/vite.config.js +0 -27
  190. jac_client/plugin/cli.py +0 -244
  191. jac_client/plugin/client.py +0 -152
  192. jac_client/plugin/client_runtime.jac +0 -234
  193. jac_client/plugin/vite_client_bundle.py +0 -503
  194. jac_client/tests/fixtures/js_import/utils.js +0 -21
  195. jac_client/tests/fixtures/package-lock.json +0 -329
  196. jac_client/tests/fixtures/package.json +0 -11
  197. jac_client/tests/test_asset_examples.py +0 -322
  198. jac_client/tests/test_cl.py +0 -530
  199. jac_client/tests/test_create_jac_app.py +0 -131
  200. jac_client/tests/test_nested_file.py +0 -374
  201. jac_client-0.2.2.dist-info/RECORD +0 -171
  202. jac_client-0.2.2.dist-info/entry_points.txt +0 -4
@@ -1,329 +0,0 @@
1
- {
2
- "name": "test-client",
3
- "version": "0.0.1",
4
- "lockfileVersion": 3,
5
- "requires": true,
6
- "packages": {
7
- "": {
8
- "name": "test-client",
9
- "version": "0.0.1",
10
- "dependencies": {
11
- "react": "^18.0.0",
12
- "react-dom": "^18.0.0"
13
- },
14
- "devDependencies": {
15
- "vite": "^5.0.0"
16
- }
17
- },
18
- "node_modules/@esbuild/linux-x64": {
19
- "version": "0.21.5",
20
- "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz",
21
- "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==",
22
- "cpu": [
23
- "x64"
24
- ],
25
- "dev": true,
26
- "license": "MIT",
27
- "optional": true,
28
- "os": [
29
- "linux"
30
- ],
31
- "engines": {
32
- "node": ">=12"
33
- }
34
- },
35
- "node_modules/@rollup/rollup-linux-x64-gnu": {
36
- "version": "4.52.5",
37
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.52.5.tgz",
38
- "integrity": "sha512-hXGLYpdhiNElzN770+H2nlx+jRog8TyynpTVzdlc6bndktjKWyZyiCsuDAlpd+j+W+WNqfcyAWz9HxxIGfZm1Q==",
39
- "cpu": [
40
- "x64"
41
- ],
42
- "dev": true,
43
- "license": "MIT",
44
- "optional": true,
45
- "os": [
46
- "linux"
47
- ]
48
- },
49
- "node_modules/@rollup/rollup-linux-x64-musl": {
50
- "version": "4.52.5",
51
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.52.5.tgz",
52
- "integrity": "sha512-arCGIcuNKjBoKAXD+y7XomR9gY6Mw7HnFBv5Rw7wQRvwYLR7gBAgV7Mb2QTyjXfTveBNFAtPt46/36vV9STLNg==",
53
- "cpu": [
54
- "x64"
55
- ],
56
- "dev": true,
57
- "license": "MIT",
58
- "optional": true,
59
- "os": [
60
- "linux"
61
- ]
62
- },
63
- "node_modules/@types/estree": {
64
- "version": "1.0.8",
65
- "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
66
- "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
67
- "dev": true,
68
- "license": "MIT"
69
- },
70
- "node_modules/esbuild": {
71
- "version": "0.21.5",
72
- "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz",
73
- "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==",
74
- "dev": true,
75
- "hasInstallScript": true,
76
- "license": "MIT",
77
- "bin": {
78
- "esbuild": "bin/esbuild"
79
- },
80
- "engines": {
81
- "node": ">=12"
82
- },
83
- "optionalDependencies": {
84
- "@esbuild/aix-ppc64": "0.21.5",
85
- "@esbuild/android-arm": "0.21.5",
86
- "@esbuild/android-arm64": "0.21.5",
87
- "@esbuild/android-x64": "0.21.5",
88
- "@esbuild/darwin-arm64": "0.21.5",
89
- "@esbuild/darwin-x64": "0.21.5",
90
- "@esbuild/freebsd-arm64": "0.21.5",
91
- "@esbuild/freebsd-x64": "0.21.5",
92
- "@esbuild/linux-arm": "0.21.5",
93
- "@esbuild/linux-arm64": "0.21.5",
94
- "@esbuild/linux-ia32": "0.21.5",
95
- "@esbuild/linux-loong64": "0.21.5",
96
- "@esbuild/linux-mips64el": "0.21.5",
97
- "@esbuild/linux-ppc64": "0.21.5",
98
- "@esbuild/linux-riscv64": "0.21.5",
99
- "@esbuild/linux-s390x": "0.21.5",
100
- "@esbuild/linux-x64": "0.21.5",
101
- "@esbuild/netbsd-x64": "0.21.5",
102
- "@esbuild/openbsd-x64": "0.21.5",
103
- "@esbuild/sunos-x64": "0.21.5",
104
- "@esbuild/win32-arm64": "0.21.5",
105
- "@esbuild/win32-ia32": "0.21.5",
106
- "@esbuild/win32-x64": "0.21.5"
107
- }
108
- },
109
- "node_modules/js-tokens": {
110
- "version": "4.0.0",
111
- "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
112
- "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
113
- "license": "MIT"
114
- },
115
- "node_modules/loose-envify": {
116
- "version": "1.4.0",
117
- "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
118
- "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
119
- "license": "MIT",
120
- "dependencies": {
121
- "js-tokens": "^3.0.0 || ^4.0.0"
122
- },
123
- "bin": {
124
- "loose-envify": "cli.js"
125
- }
126
- },
127
- "node_modules/nanoid": {
128
- "version": "3.3.11",
129
- "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
130
- "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
131
- "dev": true,
132
- "funding": [
133
- {
134
- "type": "github",
135
- "url": "https://github.com/sponsors/ai"
136
- }
137
- ],
138
- "license": "MIT",
139
- "bin": {
140
- "nanoid": "bin/nanoid.cjs"
141
- },
142
- "engines": {
143
- "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
144
- }
145
- },
146
- "node_modules/picocolors": {
147
- "version": "1.1.1",
148
- "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
149
- "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
150
- "dev": true,
151
- "license": "ISC"
152
- },
153
- "node_modules/postcss": {
154
- "version": "8.5.6",
155
- "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",
156
- "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==",
157
- "dev": true,
158
- "funding": [
159
- {
160
- "type": "opencollective",
161
- "url": "https://opencollective.com/postcss/"
162
- },
163
- {
164
- "type": "tidelift",
165
- "url": "https://tidelift.com/funding/github/npm/postcss"
166
- },
167
- {
168
- "type": "github",
169
- "url": "https://github.com/sponsors/ai"
170
- }
171
- ],
172
- "license": "MIT",
173
- "dependencies": {
174
- "nanoid": "^3.3.11",
175
- "picocolors": "^1.1.1",
176
- "source-map-js": "^1.2.1"
177
- },
178
- "engines": {
179
- "node": "^10 || ^12 || >=14"
180
- }
181
- },
182
- "node_modules/react": {
183
- "version": "18.3.1",
184
- "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
185
- "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
186
- "license": "MIT",
187
- "dependencies": {
188
- "loose-envify": "^1.1.0"
189
- },
190
- "engines": {
191
- "node": ">=0.10.0"
192
- }
193
- },
194
- "node_modules/react-dom": {
195
- "version": "18.3.1",
196
- "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
197
- "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
198
- "license": "MIT",
199
- "dependencies": {
200
- "loose-envify": "^1.1.0",
201
- "scheduler": "^0.23.2"
202
- },
203
- "peerDependencies": {
204
- "react": "^18.3.1"
205
- }
206
- },
207
- "node_modules/rollup": {
208
- "version": "4.52.5",
209
- "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.52.5.tgz",
210
- "integrity": "sha512-3GuObel8h7Kqdjt0gxkEzaifHTqLVW56Y/bjN7PSQtkKr0w3V/QYSdt6QWYtd7A1xUtYQigtdUfgj1RvWVtorw==",
211
- "dev": true,
212
- "license": "MIT",
213
- "dependencies": {
214
- "@types/estree": "1.0.8"
215
- },
216
- "bin": {
217
- "rollup": "dist/bin/rollup"
218
- },
219
- "engines": {
220
- "node": ">=18.0.0",
221
- "npm": ">=8.0.0"
222
- },
223
- "optionalDependencies": {
224
- "@rollup/rollup-android-arm-eabi": "4.52.5",
225
- "@rollup/rollup-android-arm64": "4.52.5",
226
- "@rollup/rollup-darwin-arm64": "4.52.5",
227
- "@rollup/rollup-darwin-x64": "4.52.5",
228
- "@rollup/rollup-freebsd-arm64": "4.52.5",
229
- "@rollup/rollup-freebsd-x64": "4.52.5",
230
- "@rollup/rollup-linux-arm-gnueabihf": "4.52.5",
231
- "@rollup/rollup-linux-arm-musleabihf": "4.52.5",
232
- "@rollup/rollup-linux-arm64-gnu": "4.52.5",
233
- "@rollup/rollup-linux-arm64-musl": "4.52.5",
234
- "@rollup/rollup-linux-loong64-gnu": "4.52.5",
235
- "@rollup/rollup-linux-ppc64-gnu": "4.52.5",
236
- "@rollup/rollup-linux-riscv64-gnu": "4.52.5",
237
- "@rollup/rollup-linux-riscv64-musl": "4.52.5",
238
- "@rollup/rollup-linux-s390x-gnu": "4.52.5",
239
- "@rollup/rollup-linux-x64-gnu": "4.52.5",
240
- "@rollup/rollup-linux-x64-musl": "4.52.5",
241
- "@rollup/rollup-openharmony-arm64": "4.52.5",
242
- "@rollup/rollup-win32-arm64-msvc": "4.52.5",
243
- "@rollup/rollup-win32-ia32-msvc": "4.52.5",
244
- "@rollup/rollup-win32-x64-gnu": "4.52.5",
245
- "@rollup/rollup-win32-x64-msvc": "4.52.5",
246
- "fsevents": "~2.3.2"
247
- }
248
- },
249
- "node_modules/scheduler": {
250
- "version": "0.23.2",
251
- "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz",
252
- "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==",
253
- "license": "MIT",
254
- "dependencies": {
255
- "loose-envify": "^1.1.0"
256
- }
257
- },
258
- "node_modules/source-map-js": {
259
- "version": "1.2.1",
260
- "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
261
- "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
262
- "dev": true,
263
- "license": "BSD-3-Clause",
264
- "engines": {
265
- "node": ">=0.10.0"
266
- }
267
- },
268
- "node_modules/vite": {
269
- "version": "5.4.21",
270
- "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz",
271
- "integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",
272
- "dev": true,
273
- "license": "MIT",
274
- "dependencies": {
275
- "esbuild": "^0.21.3",
276
- "postcss": "^8.4.43",
277
- "rollup": "^4.20.0"
278
- },
279
- "bin": {
280
- "vite": "bin/vite.js"
281
- },
282
- "engines": {
283
- "node": "^18.0.0 || >=20.0.0"
284
- },
285
- "funding": {
286
- "url": "https://github.com/vitejs/vite?sponsor=1"
287
- },
288
- "optionalDependencies": {
289
- "fsevents": "~2.3.3"
290
- },
291
- "peerDependencies": {
292
- "@types/node": "^18.0.0 || >=20.0.0",
293
- "less": "*",
294
- "lightningcss": "^1.21.0",
295
- "sass": "*",
296
- "sass-embedded": "*",
297
- "stylus": "*",
298
- "sugarss": "*",
299
- "terser": "^5.4.0"
300
- },
301
- "peerDependenciesMeta": {
302
- "@types/node": {
303
- "optional": true
304
- },
305
- "less": {
306
- "optional": true
307
- },
308
- "lightningcss": {
309
- "optional": true
310
- },
311
- "sass": {
312
- "optional": true
313
- },
314
- "sass-embedded": {
315
- "optional": true
316
- },
317
- "stylus": {
318
- "optional": true
319
- },
320
- "sugarss": {
321
- "optional": true
322
- },
323
- "terser": {
324
- "optional": true
325
- }
326
- }
327
- }
328
- }
329
- }
@@ -1,11 +0,0 @@
1
- {
2
- "name": "test-client",
3
- "version": "0.0.1",
4
- "dependencies": {
5
- "react": "^18.0.0",
6
- "react-dom": "^18.0.0"
7
- },
8
- "devDependencies": {
9
- "vite": "^5.0.0"
10
- }
11
- }
@@ -1,322 +0,0 @@
1
- """Tests for asset-serving and css-styling examples."""
2
-
3
- from __future__ import annotations
4
-
5
- import json
6
- import shutil
7
- import subprocess
8
- import tempfile
9
- from pathlib import Path
10
-
11
- import pytest
12
-
13
- from jac_client.plugin.vite_client_bundle import ViteClientBundleBuilder
14
- from jaclang.runtimelib.runtime import JacRuntime as Jac
15
-
16
-
17
- @pytest.fixture(autouse=True)
18
- def reset_jac_machine():
19
- """Reset Jac machine before and after each test."""
20
- Jac.reset_machine()
21
- yield
22
- Jac.reset_machine()
23
-
24
-
25
- def _create_test_project_with_vite(
26
- temp_path: Path, include_assets: bool = False
27
- ) -> tuple[Path, Path]:
28
- """Create a minimal test project with Vite installed.
29
-
30
- Args:
31
- temp_path: Path to the temporary directory
32
- include_assets: If True, includes asset handling setup
33
- """
34
- # Create package.json with base dependencies
35
- package_data = {
36
- "name": "test-client",
37
- "version": "0.0.1",
38
- "type": "module",
39
- "scripts": {
40
- "build": "npm run compile && vite build",
41
- "dev": "vite dev",
42
- "preview": "vite preview",
43
- "compile": 'babel src --out-dir build --extensions ".jsx,.js" --out-file-extension .js',
44
- },
45
- "dependencies": {
46
- "react": "^19.2.0",
47
- "react-dom": "^19.2.0",
48
- "react-router-dom": "^7.3.0",
49
- },
50
- "devDependencies": {
51
- "vite": "^6.4.1",
52
- "@babel/cli": "^7.28.3",
53
- "@babel/core": "^7.28.5",
54
- "@babel/preset-env": "^7.28.5",
55
- "@babel/preset-react": "^7.28.5",
56
- },
57
- }
58
-
59
- package_json = temp_path / "package.json"
60
- with package_json.open("w", encoding="utf-8") as f:
61
- json.dump(package_data, f, indent=2)
62
-
63
- # Create .babelrc file
64
- babelrc = temp_path / ".babelrc"
65
- babelrc.write_text(
66
- """{
67
- "presets": [[
68
- "@babel/preset-env",
69
- {
70
- "modules": false
71
- }
72
- ], "@babel/preset-react"]
73
- }
74
- """,
75
- encoding="utf-8",
76
- )
77
-
78
- # Create vite.config.js file
79
- vite_config = temp_path / "vite.config.js"
80
- if include_assets:
81
- vite_config.write_text(
82
- """import { defineConfig } from "vite";
83
- import path from "path";
84
- import { fileURLToPath } from "url";
85
-
86
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
87
-
88
- export default defineConfig({
89
- root: ".",
90
- build: {
91
- rollupOptions: {
92
- input: "build/main.js",
93
- output: {
94
- entryFileNames: "client.[hash].js",
95
- assetFileNames: "[name].[ext]",
96
- },
97
- },
98
- outDir: "dist",
99
- emptyOutDir: true,
100
- minify: false,
101
- },
102
- publicDir: false,
103
- resolve: {
104
- alias: {
105
- "@jac-client/utils": path.resolve(__dirname, "src/client_runtime.js"),
106
- "@jac-client/assets": path.resolve(__dirname, "src/assets"),
107
- },
108
- },
109
- });
110
- """,
111
- encoding="utf-8",
112
- )
113
- else:
114
- vite_config.write_text(
115
- """import { defineConfig } from "vite";
116
- import path from "path";
117
- import { fileURLToPath } from "url";
118
-
119
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
120
-
121
- export default defineConfig({
122
- root: ".",
123
- build: {
124
- rollupOptions: {
125
- input: "build/main.js",
126
- output: {
127
- entryFileNames: "client.[hash].js",
128
- assetFileNames: "[name].[ext]",
129
- },
130
- },
131
- outDir: "dist",
132
- emptyOutDir: true,
133
- minify: false,
134
- },
135
- publicDir: false,
136
- resolve: {
137
- alias: {
138
- "@jac-client/utils": path.resolve(__dirname, "src/client_runtime.js"),
139
- },
140
- },
141
- });
142
- """,
143
- encoding="utf-8",
144
- )
145
-
146
- # Install dependencies
147
- result = subprocess.run(
148
- ["npm", "install"],
149
- cwd=temp_path,
150
- check=False,
151
- capture_output=True,
152
- text=True,
153
- )
154
- if result.returncode != 0:
155
- error_msg = f"npm install failed with exit code {result.returncode}\n"
156
- error_msg += f"stdout: {result.stdout}\n"
157
- error_msg += f"stderr: {result.stderr}\n"
158
- raise RuntimeError(error_msg)
159
-
160
- # Create output directory
161
- output_dir = temp_path / "dist"
162
- output_dir.mkdir(parents=True, exist_ok=True)
163
-
164
- src_dir = temp_path / "src"
165
- src_dir.mkdir(parents=True, exist_ok=True)
166
-
167
- build_dir = temp_path / "build"
168
- build_dir.mkdir(parents=True, exist_ok=True)
169
-
170
- return package_json, output_dir
171
-
172
-
173
- def test_image_asset_example() -> None:
174
- """Test image-asset example with static asset paths."""
175
- with tempfile.TemporaryDirectory() as temp_dir:
176
- temp_path = Path(temp_dir)
177
-
178
- package_json, output_dir = _create_test_project_with_vite(
179
- temp_path, include_assets=True
180
- )
181
- runtime_path = Path(__file__).parent.parent / "plugin" / "client_runtime.jac"
182
-
183
- # Initialize the Vite builder
184
- builder = ViteClientBundleBuilder(
185
- runtime_path=runtime_path,
186
- vite_package_json=package_json,
187
- vite_output_dir=output_dir,
188
- vite_minify=False,
189
- )
190
-
191
- # Import the image-asset example
192
- examples_dir = (
193
- Path(__file__).parent.parent / "examples" / "asset-serving" / "image-asset"
194
- )
195
- (module,) = Jac.jac_import("app", str(examples_dir))
196
-
197
- # Build the bundle
198
- bundle = builder.build(module, force=True)
199
-
200
- # Verify bundle structure
201
- assert bundle is not None
202
- assert bundle.module_name == "app"
203
- assert "app" in bundle.client_functions
204
-
205
- # Verify image path is in the bundle
206
- assert "/static/assets/burger.png" in bundle.code
207
-
208
- # Verify bundle was written to output directory
209
- bundle_files = list(output_dir.glob("client.*.js"))
210
- assert len(bundle_files) > 0, "Expected at least one bundle file"
211
-
212
- # Cleanup
213
- builder.cleanup_temp_dir()
214
-
215
-
216
- def test_css_with_image_example() -> None:
217
- """Test css-with-image example with CSS and image assets."""
218
- with tempfile.TemporaryDirectory() as temp_dir:
219
- temp_path = Path(temp_dir)
220
-
221
- package_json, output_dir = _create_test_project_with_vite(
222
- temp_path, include_assets=True
223
- )
224
- runtime_path = Path(__file__).parent.parent / "plugin" / "client_runtime.jac"
225
-
226
- # Initialize the Vite builder
227
- builder = ViteClientBundleBuilder(
228
- runtime_path=runtime_path,
229
- vite_package_json=package_json,
230
- vite_output_dir=output_dir,
231
- vite_minify=False,
232
- )
233
-
234
- # Import the css-with-image example
235
- examples_dir = (
236
- Path(__file__).parent.parent
237
- / "examples"
238
- / "asset-serving"
239
- / "css-with-image"
240
- )
241
- (module,) = Jac.jac_import("app", str(examples_dir))
242
-
243
- # Build the bundle
244
- bundle = builder.build(module, force=True)
245
-
246
- # Verify bundle structure
247
- assert bundle is not None
248
- assert bundle.module_name == "app"
249
- assert "app" in bundle.client_functions
250
-
251
- # Verify CSS import is present (CSS should be extracted to separate file)
252
- # The bundle should reference the CSS file
253
- assert "import" in bundle.code.lower()
254
-
255
- # Verify image paths are in the bundle
256
- assert "/static/assets/burger.png" in bundle.code
257
-
258
- # Verify CSS file was extracted
259
- css_files = list(output_dir.glob("*.css"))
260
- assert len(css_files) > 0, "Expected at least one CSS file"
261
-
262
- # Verify bundle was written to output directory
263
- bundle_files = list(output_dir.glob("client.*.js"))
264
- assert len(bundle_files) > 0, "Expected at least one bundle file"
265
-
266
- # Cleanup
267
- builder.cleanup_temp_dir()
268
-
269
-
270
- def test_import_alias_example() -> None:
271
- """Test import-alias example with @jac-client/assets alias."""
272
- with tempfile.TemporaryDirectory() as temp_dir:
273
- temp_path = Path(temp_dir)
274
- package_json, output_dir = _create_test_project_with_vite(
275
- temp_path, include_assets=True
276
- )
277
- runtime_path = Path(__file__).parent.parent / "plugin" / "client_runtime.jac"
278
-
279
- # Initialize the Vite builder
280
- builder = ViteClientBundleBuilder(
281
- runtime_path=runtime_path,
282
- vite_package_json=package_json,
283
- vite_output_dir=output_dir,
284
- vite_minify=False,
285
- )
286
-
287
- # Import the import-alias example
288
- examples_dir = (
289
- Path(__file__).parent.parent / "examples" / "asset-serving" / "import-alias"
290
- )
291
- (module,) = Jac.jac_import("app", str(examples_dir))
292
-
293
- # Copy assets from example directory to temp project's src/assets/
294
- # This is needed because @jac-client/assets alias points to src/assets
295
- example_assets_dir = examples_dir / "assets"
296
- temp_assets_dir = temp_path / "src" / "assets"
297
- if example_assets_dir.exists():
298
- temp_assets_dir.mkdir(parents=True, exist_ok=True)
299
- # Copy all files from example assets to temp assets
300
- for asset_file in example_assets_dir.iterdir():
301
- if asset_file.is_file():
302
- shutil.copy2(asset_file, temp_assets_dir / asset_file.name)
303
-
304
- # Build the bundle
305
- bundle = builder.build(module, force=True)
306
-
307
- # Verify bundle structure
308
- assert bundle is not None
309
- assert bundle.module_name == "app"
310
- assert "app" in bundle.client_functions
311
-
312
- # Verify the import alias was processed by Vite
313
- # Vite should have resolved the asset import
314
- # The bundle should contain the processed asset URL
315
- assert "burgerImage" in bundle.code
316
-
317
- # Verify bundle was written to output directory
318
- bundle_files = list(output_dir.glob("client.*.js"))
319
- assert len(bundle_files) > 0, "Expected at least one bundle file"
320
-
321
- # Cleanup
322
- builder.cleanup_temp_dir()