@powerlines/plugin-react 0.1.677 → 0.1.679

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.
package/dist/index.cjs CHANGED
@@ -10,9 +10,13 @@ _powerlines_plugin_babel = require_runtime.__toESM(_powerlines_plugin_babel, 1);
10
10
  let _powerlines_plugin_env = require("@powerlines/plugin-env");
11
11
  _powerlines_plugin_env = require_runtime.__toESM(_powerlines_plugin_env, 1);
12
12
  let _powerlines_schema = require("@powerlines/schema");
13
+ let _rolldown_plugin_babel = require("@rolldown/plugin-babel");
14
+ _rolldown_plugin_babel = require_runtime.__toESM(_rolldown_plugin_babel, 1);
13
15
  let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
14
16
  let _vitejs_plugin_react = require("@vitejs/plugin-react");
15
17
  _vitejs_plugin_react = require_runtime.__toESM(_vitejs_plugin_react, 1);
18
+ let babel_plugin_react_compiler = require("babel-plugin-react-compiler");
19
+ babel_plugin_react_compiler = require_runtime.__toESM(babel_plugin_react_compiler, 1);
16
20
  let defu = require("defu");
17
21
  defu = require_runtime.__toESM(defu, 1);
18
22
 
@@ -49,7 +53,8 @@ const plugin = (options = {}) => {
49
53
  this.dependencies["react-dom"] = "^19.2.3";
50
54
  this.devDependencies["@types/react"] = "^19.2.3";
51
55
  this.devDependencies["@types/react-dom"] = "^19.2.3";
52
- if (this.config.react.compiler !== false) {
56
+ const usesVite = Boolean(this.config.vite);
57
+ if (this.config.react.compiler !== false && !usesVite) {
53
58
  this.config.babel ??= {};
54
59
  this.config.babel.plugins ??= [];
55
60
  this.config.babel.plugins.push(["babel-plugin-react-compiler", this.config.react.compiler ?? {}]);
@@ -66,7 +71,7 @@ const plugin = (options = {}) => {
66
71
  }
67
72
  if (!(0, _powerlines_core_lib_typescript.isMatchFound)("esnext", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("ESNext");
68
73
  if (this.tsconfig.options.resolveJsonModule !== true) this.tsconfig.tsconfigJson.compilerOptions.resolveJsonModule = true;
69
- if (this.config.vite) {
74
+ if (usesVite) {
70
75
  this.tsconfig.tsconfigJson.compilerOptions.types ??= [];
71
76
  if (!(0, _powerlines_core_lib_typescript.isMatchFound)("vite/client", this.tsconfig.tsconfigJson.compilerOptions.types)) this.tsconfig.tsconfigJson.compilerOptions.types.push("vite/client");
72
77
  const viteBuildConfig = this.config.vite;
@@ -74,11 +79,14 @@ const plugin = (options = {}) => {
74
79
  viteBuildConfig.build.target = "chrome95";
75
80
  viteBuildConfig.plugins ??= [];
76
81
  viteBuildConfig.plugins.unshift((0, _vitejs_plugin_react.default)({
77
- babel: this.config.babel,
78
82
  jsxImportSource: this.config.react.jsxImportSource,
79
83
  jsxRuntime: this.config.react.jsxRuntime,
80
84
  reactRefreshHost: this.config.react.reactRefreshHost
81
85
  }));
86
+ if (this.config.react.compiler !== false) viteBuildConfig.plugins.push((0, _rolldown_plugin_babel.default)({
87
+ ...this.config.react.compiler ?? {},
88
+ presets: [babel_plugin_react_compiler.default]
89
+ }));
82
90
  }
83
91
  if (this.env?.config && !this.env?.config.schema?.properties?.DISABLE_REACT_COMPILER) (0, _powerlines_schema.addProperty)(this.env?.config, "DISABLE_REACT_COMPILER", {
84
92
  name: "DISABLE_REACT_COMPILER",
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;YAoCY,MAAA;IACR,KAAA,GAAQ,kBAAkB;EAAA;AAAA;;;;cAOjB,MAAA,oBACM,kBAAA,GAAqB,kBAAA,EAEtC,OAAA,GAAS,kBAAA,KA0MJ,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;YAsCY,MAAA;IACR,KAAA,GAAQ,kBAAkB;EAAA;AAAA;;;;cAOjB,MAAA,oBACM,kBAAA,GAAqB,kBAAA,EAEtC,OAAA,GAAS,kBAAA,KAqNJ,MAAA,CAAO,QAAA"}
package/dist/index.mjs CHANGED
@@ -6,8 +6,10 @@ import { render } from "@powerlines/plugin-alloy/render";
6
6
  import babel from "@powerlines/plugin-babel";
7
7
  import env from "@powerlines/plugin-env";
8
8
  import { addProperty } from "@powerlines/schema";
9
+ import rolldownBabel from "@rolldown/plugin-babel";
9
10
  import { kebabCase } from "@stryke/string-format/kebab-case";
10
11
  import viteReactPlugin from "@vitejs/plugin-react";
12
+ import reactCompilerPreset from "babel-plugin-react-compiler";
11
13
  import defu from "defu";
12
14
 
13
15
  //#region src/index.tsx
@@ -43,7 +45,8 @@ const plugin = (options = {}) => {
43
45
  this.dependencies["react-dom"] = "^19.2.3";
44
46
  this.devDependencies["@types/react"] = "^19.2.3";
45
47
  this.devDependencies["@types/react-dom"] = "^19.2.3";
46
- if (this.config.react.compiler !== false) {
48
+ const usesVite = Boolean(this.config.vite);
49
+ if (this.config.react.compiler !== false && !usesVite) {
47
50
  this.config.babel ??= {};
48
51
  this.config.babel.plugins ??= [];
49
52
  this.config.babel.plugins.push(["babel-plugin-react-compiler", this.config.react.compiler ?? {}]);
@@ -60,7 +63,7 @@ const plugin = (options = {}) => {
60
63
  }
61
64
  if (!isMatchFound("esnext", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("ESNext");
62
65
  if (this.tsconfig.options.resolveJsonModule !== true) this.tsconfig.tsconfigJson.compilerOptions.resolveJsonModule = true;
63
- if (this.config.vite) {
66
+ if (usesVite) {
64
67
  this.tsconfig.tsconfigJson.compilerOptions.types ??= [];
65
68
  if (!isMatchFound("vite/client", this.tsconfig.tsconfigJson.compilerOptions.types)) this.tsconfig.tsconfigJson.compilerOptions.types.push("vite/client");
66
69
  const viteBuildConfig = this.config.vite;
@@ -68,11 +71,14 @@ const plugin = (options = {}) => {
68
71
  viteBuildConfig.build.target = "chrome95";
69
72
  viteBuildConfig.plugins ??= [];
70
73
  viteBuildConfig.plugins.unshift(viteReactPlugin({
71
- babel: this.config.babel,
72
74
  jsxImportSource: this.config.react.jsxImportSource,
73
75
  jsxRuntime: this.config.react.jsxRuntime,
74
76
  reactRefreshHost: this.config.react.reactRefreshHost
75
77
  }));
78
+ if (this.config.react.compiler !== false) viteBuildConfig.plugins.push(rolldownBabel({
79
+ ...this.config.react.compiler ?? {},
80
+ presets: [reactCompilerPreset]
81
+ }));
76
82
  }
77
83
  if (this.env?.config && !this.env?.config.schema?.properties?.DISABLE_REACT_COMPILER) addProperty(this.env?.config, "DISABLE_REACT_COMPILER", {
78
84
  name: "DISABLE_REACT_COMPILER",
@@ -1,6 +1,6 @@
1
+ import { PluginOptions } from "babel-plugin-react-compiler";
1
2
  import { BabelPluginOptions } from "@powerlines/plugin-babel/types/plugin";
2
3
  import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig } from "@powerlines/plugin-env/types/plugin";
3
- import { PluginOptions } from "babel-plugin-react-compiler";
4
4
 
5
5
  //#region src/types/plugin.d.ts
6
6
  type ReactCompilerOptions = Omit<PluginOptions, "logger">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-react",
3
- "version": "0.1.677",
3
+ "version": "0.1.679",
4
4
  "private": false,
5
5
  "description": "A package containing a Powerlines plugin for building a React application.",
6
6
  "keywords": ["react", "powerlines", "storm-software", "powerlines-plugin"],
@@ -136,28 +136,31 @@
136
136
  "@alloy-js/json": "^0.23.0",
137
137
  "@alloy-js/markdown": "^0.23.0",
138
138
  "@alloy-js/typescript": "^0.23.0",
139
- "@babel/core": "8.0.0-rc.6",
140
- "@powerlines/core": "0.48.60",
141
- "@powerlines/plugin-alloy": "0.26.231",
142
- "@powerlines/plugin-babel": "0.13.134",
143
- "@powerlines/plugin-env": "0.16.342",
144
- "@powerlines/plugin-vite": "0.14.592",
145
- "@storm-software/config-tools": "^1.190.69",
146
- "@stryke/cli": "^0.13.58",
147
- "@stryke/convert": "^0.7.16",
148
- "@stryke/fs": "^0.33.86",
149
- "@stryke/path": "^0.29.12",
150
- "@stryke/string-format": "^0.17.27",
151
- "@vitejs/plugin-react": "^5.2.0",
139
+ "@babel/core": "^8.0.1",
140
+ "@powerlines/core": "^0.48.61",
141
+ "@powerlines/plugin-alloy": "^0.26.233",
142
+ "@powerlines/plugin-babel": "^0.13.136",
143
+ "@powerlines/plugin-env": "^0.16.344",
144
+ "@powerlines/plugin-vite": "^0.14.594",
145
+ "@rolldown/plugin-babel": "^0.2.3",
146
+ "@storm-software/config-tools": "^1.190.83",
147
+ "@stryke/cli": "^0.13.67",
148
+ "@stryke/convert": "^0.7.25",
149
+ "@stryke/fs": "^0.33.95",
150
+ "@stryke/path": "^0.29.21",
151
+ "@stryke/string-format": "^0.17.36",
152
+ "@vitejs/plugin-react": "^6.0.0",
152
153
  "babel-plugin-react-compiler": "^1.0.0",
153
154
  "defu": "^6.1.7",
154
- "powerlines": "0.47.138"
155
+ "powerlines": "^0.47.140"
155
156
  },
156
157
  "devDependencies": {
157
- "@powerlines/plugin-plugin": "0.12.550",
158
- "@types/node": "^25.9.3",
158
+ "@powerlines/plugin-plugin": "^0.12.552",
159
+ "@types/node": "^25.9.4",
159
160
  "@types/react": "^19.2.17",
160
- "@types/react-dom": "^19.2.3"
161
+ "@types/react-dom": "^19.2.3",
162
+ "react": "^19.2.3",
163
+ "react-dom": "^19.2.3"
161
164
  },
162
165
  "peerDependencies": { "react": ">=19.2.0", "react-dom": ">=19.2.0" },
163
166
  "peerDependenciesMeta": {
@@ -165,5 +168,5 @@
165
168
  "react-dom": { "optional": false }
166
169
  },
167
170
  "publishConfig": { "access": "public" },
168
- "gitHead": "2378e0896bcd3f99c735faa3be578440c7ce0d2a"
171
+ "gitHead": "620d5b7c51f4d8b58e79ec602b222311439e7f33"
169
172
  }