@inglorious/vite-plugin-jsx 1.0.0 โ†’ 1.1.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.
@@ -1,3 +1,5 @@
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
+
2
+ 
3
+ > @inglorious/vite-plugin-jsx@1.1.1 lint /Users/iceonfire/Projects/ic/inglorious-forge/packages/vite-plugin-jsx
4
+ > eslint .
5
+
@@ -1,57 +1,72 @@
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
5
- ยท 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
13
- โœ“ does not change parameters if api is already the last argument
14
- โœ“ moves api parameter to the end when it is in the middle
15
- โœ“ does not inject api if no capitalized component is used
16
- โœ“ does not inject api if component is not inside a 'render' method
17
- โœ“ throws an error when trying to inject api with a rest parameter present
18
- โœ“ injects api argument when component is nested inside a Fragment
19
- โœ“ 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
23
- โœ“ injects the html import only when JSX is present
24
- โœ“ transforms className to class
25
- โœ“ handles event listeners (@event syntax)
26
- โœ“ handles boolean attributes
27
- โœ“ 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
- 
1
+
2
+ 
3
+ > @inglorious/vite-plugin-jsx@1.1.0 test /Users/iceonfire/Projects/ic/inglorious-forge/packages/vite-plugin-jsx
4
+ > vitest run
5
+
6
+
7
+  RUN  v2.1.9 /Users/iceonfire/Projects/ic/inglorious-forge/packages/vite-plugin-jsx
8
+
9
+ [?25l ยท handles SVG self-closing tags correctly
10
+ ยท expands self-closing non-void HTML tags
11
+ ยท ignores empty expressions and comments
12
+ ยท transforms capitalized components to api.render calls
13
+ ยท injects api argument into render function if missing when using components
14
+ ยท moves api parameter to the end if it is not the last one
15
+ ยท does not change parameters if api is already the last argument
16
+ ยท moves api parameter to the end when it is in the middle
17
+ ยท does not inject api if no capitalized component is used
18
+ ยท does not inject api if component is not inside a 'render' method
19
+ ยท throws an error when trying to inject api with a rest parameter present
20
+ ยท injects api argument when component is nested inside a Fragment
21
+ ยท injects api argument when component is nested inside standard elements
22
+ [?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l โœ“ handles SVG self-closing tags correctly
23
+ โœ“ expands self-closing non-void HTML tags
24
+ โœ“ ignores empty expressions and comments
25
+ โœ“ transforms capitalized components to api.render calls
26
+ โœ“ injects api argument into render function if missing when using components
27
+ โœ“ moves api parameter to the end if it is not the last one
28
+ โœ“ does not change parameters if api is already the last argument
29
+ โœ“ moves api parameter to the end when it is in the middle
30
+ โœ“ does not inject api if no capitalized component is used
31
+ โœ“ does not inject api if component is not inside a 'render' method
32
+ โœ“ throws an error when trying to inject api with a rest parameter present
33
+ โœ“ injects api argument when component is nested inside a Fragment
34
+ โœ“ injects api argument when component is nested inside standard elements
35
+ [?25l โœ“ src/index.test.js (29) 457ms
36
+ โœ“ vite-plugin-jsx (29) 457ms
37
+ โœ“ transforms basic JSX elements
38
+ โœ“ injects the html import only when JSX is present
39
+ โœ“ transforms className to class
40
+ โœ“ handles event listeners (@event syntax)
41
+ โœ“ handles boolean attributes
42
+ โœ“ distinguishes between properties (.) and attributes
43
+ โœ“ handles fragments
44
+ โœ“ handles nested expressions and elements
45
+ โœ“ transforms Array.map to repeat directive
46
+ โœ“ transforms Array.map with key to keyed repeat directive
47
+ โœ“ transforms ternary operators to when directive
48
+ โœ“ transforms logical AND to when directive
49
+ โœ“ merges imports if @inglorious/web is already imported
50
+ โœ“ throws error for missing event handler expression
51
+ โœ“ throws error for string literal event handler
52
+ โœ“ does not generate closing tag for void elements
53
+ โœ“ handles SVG self-closing tags correctly
54
+ โœ“ expands self-closing non-void HTML tags
55
+ โœ“ ignores empty expressions and comments
56
+ โœ“ transforms capitalized components to api.render calls
57
+ โœ“ injects api argument into render function if missing when using components
58
+ โœ“ moves api parameter to the end if it is not the last one
59
+ โœ“ does not change parameters if api is already the last argument
60
+ โœ“ moves api parameter to the end when it is in the middle
61
+ โœ“ does not inject api if no capitalized component is used
62
+ โœ“ does not inject api if component is not inside a 'render' method
63
+ โœ“ throws an error when trying to inject api with a rest parameter present
64
+ โœ“ injects api argument when component is nested inside a Fragment
65
+ โœ“ injects api argument when component is nested inside standard elements
66
+
67
+  Test Files  1 passed (1)
68
+  Tests  29 passed (29)
69
+  Start at  19:00:07
70
+  Duration  3.23s (transform 66ms, setup 0ms, collect 1.26s, tests 457ms, environment 0ms, prepare 344ms)
71
+
72
+ [?25h[?25h
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @inglorious/vite-plugin-jsx
2
2
 
3
+ ## 1.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Decrease bundles size
8
+
9
+ ## 1.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Add TSX web todomvc example
14
+
3
15
  ## 1.0.0
4
16
 
5
17
  ### Major Changes
package/README.md CHANGED
@@ -64,7 +64,7 @@ function render(entity, api) {
64
64
  {entity.visible && <h2>{entity.title}</h2>}
65
65
 
66
66
  {entity.items.map((item) => (
67
- <p key={item.id} onClick={() => api.select(item)}>
67
+ <p key={item.id} onClick={() => api.notify("select", item)}>
68
68
  {item.name}
69
69
  </p>
70
70
  ))}
@@ -83,7 +83,8 @@ function render(entity, api) {
83
83
  ${repeat(
84
84
  entity.items,
85
85
  (item) => item.id,
86
- (item) => html`<p @click=${() => api.select(item)}>${item.name}</p>`,
86
+ (item) =>
87
+ html`<p @click=${() => api.notify("select", item)}>${item.name}</p>`,
87
88
  )}
88
89
  </div>
89
90
  `
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.1",
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",
@@ -25,6 +25,7 @@
25
25
  "publishConfig": {
26
26
  "access": "public"
27
27
  },
28
+ "sideEffects": false,
28
29
  "dependencies": {
29
30
  "@babel/core": "^7.28.5",
30
31
  "@babel/plugin-syntax-jsx": "^7.28.6",
@@ -32,14 +33,14 @@
32
33
  },
33
34
  "devDependencies": {
34
35
  "vitest": "^2.0.4",
35
- "@inglorious/eslint-config": "1.1.1"
36
+ "@inglorious/eslint-config": "1.1.2"
36
37
  },
37
38
  "engines": {
38
39
  "node": ">= 22"
39
40
  },
40
41
  "scripts": {
41
- "format": "prettier --write '**/*.{js,jsx}'",
42
- "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
42
+ "format": "prettier --write .",
43
+ "lint": "eslint .",
43
44
  "test:watch": "vitest",
44
45
  "test": "vitest run"
45
46
  }
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