@inglorious/vite-plugin-jsx 1.0.0 → 1.1.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.
@@ -1,3 +1,2 @@
1
- [?9001h[?1004h[?25l]0;C:\WINDOWS\system32\cmd.exe [?25h[?25l
2
- > @inglorious/vite-plugin-jsx@1.0.0 lint C:\Users\anton\Projects\ic\inglorious-forge\packages\vite-plugin-jsx
3
- > eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0[?25h[?9001l[?1004l
1
+ [?9001h[?1004h[?25l> @inglorious/vite-plugin-jsx@1.1.0 lint C:\Users\anton\Projects\ic\inglorious-forge\packages\vite-plugin-jsx
2
+ > eslint .]0;C:\WINDOWS\system32\cmd.exe[?25h[?9001l[?1004l
@@ -1,15 +1,14 @@
1
- [?9001h[?1004h[?25l]0;C:\WINDOWS\system32\cmd.exe [?25h[?25l
2
- > @inglorious/vite-plugin-jsx@0.1.0 test C:\Users\anton\Projects\ic\inglorious-forge\packages\vite-plugin-jsx
3
- > vitest run[?25h]0;node (vitest)
4
- [?25l RUN  v2.1.9 C:/Users/anton/Projects/ic/inglorious-forge/packages/vite-plugin-jsx[?25h]0;node (vitest 3)]0;node (vitest 1)]0;node (vitest 2)]0;node (vitest 5)]0;node (vitest 6)]0;node (vitest 7)]0;node (vitest 4)]0;node (vitest 9)]0;node (vitest 8)]0;node (vitest 10)]0;node (vitest 11)[?25l · moves api parameter to the end if it is not the last one
1
+ [?9001h[?1004h[?25l> @inglorious/vite-plugin-jsx@1.0.0 test C:\Users\anton\Projects\ic\inglorious-forge\packages\vite-plugin-jsx
2
+ > vitest run]0;C:\WINDOWS\system32\cmd.exe[?25h]0;node (vitest)
3
+ [?25l RUN  v2.1.9 C:/Users/anton/Projects/ic/inglorious-forge/packages/vite-plugin-jsx[?25h]0;node (vitest 1)]0;node (vitest 3)]0;node (vitest 11)]0;node (vitest 5)]0;node (vitest 2)]0;node (vitest 4)]0;node (vitest 12)]0;node (vitest 10)]0;node (vitest 15)]0;node (vitest 9)]0;node (vitest 17)]0;node (vitest 6)]0;node (vitest 18)]0;node (vitest 7)]0;node (vitest 13)]0;node (vitest 19)]0;node (vitest 8)]0;node (vitest 14)]0;node (vitest 16)[?25l · moves api parameter to the end if it is not the last one
5
4
  · does not change parameters if api is already the last argument
6
- · moves api parameter to the end when it is in the middle
7
- · does not inject api if no capitalized component is used
8
- · does not inject api if component is not inside a 'render' method
9
- · throws an error when trying to inject api with a rest parameter present
10
- · injects api argument when component is nested inside a Fragment
11
- · injects api argument when component is nested inside standard elements
12
-  ✓ moves api parameter to the end if it is not the last one
5
+ · moves api parameter to the end when it is in the middle
6
+ · does not inject api if no capitalized component is used
7
+ · does not inject api if component is not inside a 'render' method
8
+ · throws an error when trying to inject api with a rest parameter present
9
+ · injects api argument when component is nested inside a Fragment
10
+ · injects api argument when component is nested inside standard elements
11
+  ✓ moves api parameter to the end if it is not the last one
13
12
  ✓ does not change parameters if api is already the last argument
14
13
  ✓ moves api parameter to the end when it is in the middle
15
14
  ✓ does not inject api if no capitalized component is used
@@ -17,41 +16,41 @@
17
16
  ✓ throws an error when trying to inject api with a rest parameter present
18
17
  ✓ injects api argument when component is nested inside a Fragment
19
18
  ✓ injects api argument when component is nested inside standard elements
20
-  ✓ src/index.test.js (29) 737ms
21
- ✓ vite-plugin-jsx (29) 736ms
22
- ✓ transforms basic JSX elements 411ms
19
+  ✓ src/index.test.js (29) 591ms
20
+ ✓ vite-plugin-jsx (29) 590ms
21
+ ✓ transforms basic JSX elements
23
22
  ✓ injects the html import only when JSX is present
24
23
  ✓ transforms className to class
25
24
  ✓ handles event listeners (@event syntax)
26
25
  ✓ handles boolean attributes
27
26
  ✓ distinguishes between properties (.) and attributes
28
- ✓ handles fragments
29
- ✓ handles nested expressions and elements
30
- ✓ transforms Array.map to repeat directive
31
- ✓ transforms Array.map with key to keyed repeat directive
32
- ✓ transforms ternary operators to when directive
33
- ✓ transforms logical AND to when directive
34
- ✓ merges imports if @inglorious/web is already imported
35
- ✓ throws error for missing event handler expression
36
- ✓ throws error for string literal event handler
37
- ✓ does not generate closing tag for void elements
38
- ✓ handles SVG self-closing tags correctly
39
- ✓ expands self-closing non-void HTML tags
40
- ✓ ignores empty expressions and comments
41
- ✓ transforms capitalized components to api.render calls
42
- ✓ injects api argument into render function if missing when using components
43
- ✓ moves api parameter to the end if it is not the last one
44
- ✓ does not change parameters if api is already the last argument
45
- ✓ moves api parameter to the end when it is in the middle
46
- ✓ does not inject api if no capitalized component is used
47
- ✓ does not inject api if component is not inside a 'render' method
48
- ✓ throws an error when trying to inject api with a rest parameter present
49
- ✓ injects api argument when component is nested inside a Fragment
50
- ✓ injects api argument when component is nested inside standard elements
51
- 
52
-  Test Files  1 passed (1)
53
-  Tests  29 passed (29)
54
-  Start at  20:22:47
55
-  Duration  4.54s (transform 214ms, setup 0ms, collect 1.40s, tests 737ms, environment 0ms, prepare 1.08s)
56
- 
57
- 
27
+ ✓ handles fragments
28
+ ✓ handles nested expressions and elements
29
+ ✓ transforms Array.map to repeat directive
30
+ ✓ transforms Array.map with key to keyed repeat directive
31
+ ✓ transforms ternary operators to when directive
32
+ ✓ transforms logical AND to when directive
33
+ ✓ merges imports if @inglorious/web is already imported
34
+ ✓ throws error for missing event handler expression
35
+ ✓ throws error for string literal event handler
36
+ ✓ does not generate closing tag for void elements
37
+ ✓ handles SVG self-closing tags correctly
38
+ ✓ expands self-closing non-void HTML tags
39
+ ✓ ignores empty expressions and comments
40
+ ✓ transforms capitalized components to api.render calls
41
+ ✓ injects api argument into render function if missing when using components
42
+ ✓ moves api parameter to the end if it is not the last one
43
+ ✓ does not change parameters if api is already the last argument
44
+ ✓ moves api parameter to the end when it is in the middle
45
+ ✓ does not inject api if no capitalized component is used
46
+ ✓ does not inject api if component is not inside a 'render' method
47
+ ✓ throws an error when trying to inject api with a rest parameter present
48
+ ✓ injects api argument when component is nested inside a Fragment
49
+ ✓ injects api argument when component is nested inside standard elements
50
+ 
51
+ 
58
52
  Test Files  1 passed (1)
53
+  Tests  29 passed (29)
54
+  Start at  22:22:50
55
+  Duration  4.70s (transform 100ms, setup 0ms, collect 1.29s, tests 591ms, environment 0ms, prepare 1.50s)
56
+ 
57
+ 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @inglorious/vite-plugin-jsx
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add TSX web todomvc example
8
+
3
9
  ## 1.0.0
4
10
 
5
11
  ### Major Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inglorious/vite-plugin-jsx",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "A Vite plugin that transforms JSX into lit-html syntax.",
5
5
  "author": "IceOnFire <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
6
6
  "license": "MIT",
@@ -38,8 +38,8 @@
38
38
  "node": ">= 22"
39
39
  },
40
40
  "scripts": {
41
- "format": "prettier --write '**/*.{js,jsx}'",
42
- "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
41
+ "format": "prettier --write .",
42
+ "lint": "eslint .",
43
43
  "test:watch": "vitest",
44
44
  "test": "vitest run"
45
45
  }
package/src/index.js CHANGED
@@ -31,6 +31,7 @@ const VOID_TAGS = [
31
31
  export function jsx() {
32
32
  return {
33
33
  name: "@inglorious/vite-plugin-jsx",
34
+ enforce: "pre", // runs before esbuild
34
35
 
35
36
  async transform(code, id) {
36
37
  if (!/\.[jt]sx$/.test(id)) return null