@powerlines/plugin-react 0.1.419 → 0.1.422

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 (37) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +29 -0
  2. package/dist/_virtual/_rolldown/runtime.mjs +3 -0
  3. package/dist/components/index.cjs +4 -0
  4. package/dist/components/index.d.cts +2 -0
  5. package/dist/components/index.d.mts +2 -0
  6. package/dist/components/index.mjs +3 -0
  7. package/dist/components/react-optimized.cjs +50 -0
  8. package/dist/components/react-optimized.d.cts +15 -0
  9. package/dist/components/react-optimized.d.cts.map +1 -0
  10. package/dist/components/react-optimized.d.mts +15 -0
  11. package/dist/components/react-optimized.d.mts.map +1 -0
  12. package/dist/components/react-optimized.mjs +48 -0
  13. package/dist/components/react-optimized.mjs.map +1 -0
  14. package/dist/index.cjs +106 -0
  15. package/dist/index.d.cts +18 -0
  16. package/dist/index.d.cts.map +1 -0
  17. package/dist/index.d.mts +18 -0
  18. package/dist/index.d.mts.map +1 -0
  19. package/dist/index.mjs +99 -0
  20. package/dist/index.mjs.map +1 -0
  21. package/dist/types/index.cjs +0 -0
  22. package/dist/types/index.d.cts +3 -0
  23. package/dist/types/index.d.mts +3 -0
  24. package/dist/types/index.mjs +1 -0
  25. package/dist/types/plugin.cjs +0 -0
  26. package/dist/types/plugin.d.cts +74 -0
  27. package/dist/types/plugin.d.cts.map +1 -0
  28. package/dist/types/plugin.d.mts +74 -0
  29. package/dist/types/plugin.d.mts.map +1 -0
  30. package/dist/types/plugin.mjs +1 -0
  31. package/dist/types/runtime.cjs +0 -0
  32. package/dist/types/runtime.d.cts +16 -0
  33. package/dist/types/runtime.d.cts.map +1 -0
  34. package/dist/types/runtime.d.mts +16 -0
  35. package/dist/types/runtime.d.mts.map +1 -0
  36. package/dist/types/runtime.mjs +1 -0
  37. package/package.json +9 -9
@@ -0,0 +1,29 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+
29
+ exports.__toESM = __toESM;
@@ -0,0 +1,3 @@
1
+ import "node:module";
2
+
3
+ export { };
@@ -0,0 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_components_react_optimized = require('./react-optimized.cjs');
3
+
4
+ exports.ReactOptimizedBuiltin = require_components_react_optimized.ReactOptimizedBuiltin;
@@ -0,0 +1,2 @@
1
+ import { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps, __ΩReactOptimizedBuiltinProps } from "./react-optimized.cjs";
2
+ export { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps, __ΩReactOptimizedBuiltinProps };
@@ -0,0 +1,2 @@
1
+ import { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps, __ΩReactOptimizedBuiltinProps } from "./react-optimized.mjs";
2
+ export { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps, __ΩReactOptimizedBuiltinProps };
@@ -0,0 +1,3 @@
1
+ import { ReactOptimizedBuiltin } from "./react-optimized.mjs";
2
+
3
+ export { ReactOptimizedBuiltin };
@@ -0,0 +1,50 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
4
+ let defu = require("defu");
5
+ defu = require_runtime.__toESM(defu);
6
+ let _alloy_js_core = require("@alloy-js/core");
7
+ let _alloy_js_typescript = require("@alloy-js/typescript");
8
+ let _powerlines_plugin_alloy_helpers_refkey = require("@powerlines/plugin-alloy/helpers/refkey");
9
+ let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
10
+ let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
11
+
12
+ //#region src/components/react-optimized.tsx
13
+ const isOptimizationEnabledRefkey = (0, _powerlines_plugin_alloy_helpers_refkey.refkey)("isOptimizationEnabled");
14
+ /**
15
+ * Generates the `react/optimized` builtin module for the Powerlines project.
16
+ */
17
+ function ReactOptimizedBuiltin(props) {
18
+ const [{ override }, rest] = (0, _alloy_js_core.splitProps)(props, ["override"]);
19
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
20
+ id: "react/optimized",
21
+ description: "A built-in module to provide access to environment configuration to determine React optimizations.",
22
+ get builtinImports() {
23
+ return (0, defu.default)({ env: ["env", "isDevelopment"] }, rest.builtinImports ?? {});
24
+ },
25
+ get children() {
26
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
27
+ heading: "A gating function to determine if the optimized [React compiler](https://react.dev/reference/react-compiler) source code should be used.",
28
+ get children() {
29
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://react.dev/reference/react-compiler/gating` }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `A boolean indicating if the React compiler's optimizations should be used.` })];
30
+ }
31
+ }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
32
+ refkey: isOptimizationEnabledRefkey,
33
+ async: false,
34
+ "export": true,
35
+ name: "isOptimizationEnabled",
36
+ returnType: "boolean",
37
+ get children() {
38
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
39
+ when: override !== void 0,
40
+ fallback: _alloy_js_core.code`return !env.DISABLE_REACT_COMPILER && !isDevelopment; `,
41
+ children: _alloy_js_core.code`return ${override};`
42
+ }), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
43
+ }
44
+ })];
45
+ }
46
+ }));
47
+ }
48
+
49
+ //#endregion
50
+ exports.ReactOptimizedBuiltin = ReactOptimizedBuiltin;
@@ -0,0 +1,15 @@
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
+ import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
3
+
4
+ //#region src/components/react-optimized.d.ts
5
+ interface ReactOptimizedBuiltinProps extends Omit<BuiltinFileProps, "id"> {
6
+ override?: boolean;
7
+ }
8
+ /**
9
+ * Generates the `react/optimized` builtin module for the Powerlines project.
10
+ */
11
+ declare function ReactOptimizedBuiltin(props: ReactOptimizedBuiltinProps): _alloy_js_core0.Children;
12
+ declare type __ΩReactOptimizedBuiltinProps = any[];
13
+ //#endregion
14
+ export { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps, __ΩReactOptimizedBuiltinProps };
15
+ //# sourceMappingURL=react-optimized.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-optimized.d.cts","names":[],"sources":["../../src/components/react-optimized.tsx"],"mappings":";;;;UAgCiB,0BAAA,SAAmC,IAAA,CAClD,gBAAA;EAGA,QAAA;AAAA;AAJF;;;AAAA,iBAYgB,qBAAA,CAAsB,KAAA,EAAO,0BAAA,GAA0B,eAAA,CAAA,QAAA;AAAA"}
@@ -0,0 +1,15 @@
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
+ import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
3
+
4
+ //#region src/components/react-optimized.d.ts
5
+ interface ReactOptimizedBuiltinProps extends Omit<BuiltinFileProps, "id"> {
6
+ override?: boolean;
7
+ }
8
+ /**
9
+ * Generates the `react/optimized` builtin module for the Powerlines project.
10
+ */
11
+ declare function ReactOptimizedBuiltin(props: ReactOptimizedBuiltinProps): _alloy_js_core0.Children;
12
+ declare type __ΩReactOptimizedBuiltinProps = any[];
13
+ //#endregion
14
+ export { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps, __ΩReactOptimizedBuiltinProps };
15
+ //# sourceMappingURL=react-optimized.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-optimized.d.mts","names":[],"sources":["../../src/components/react-optimized.tsx"],"mappings":";;;;UAgCiB,0BAAA,SAAmC,IAAA,CAClD,gBAAA;EAGA,QAAA;AAAA;AAJF;;;AAAA,iBAYgB,qBAAA,CAAsB,KAAA,EAAO,0BAAA,GAA0B,eAAA,CAAA,QAAA;AAAA"}
@@ -0,0 +1,48 @@
1
+ import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
2
+ import defu from "defu";
3
+ import { Show, code, splitProps } from "@alloy-js/core";
4
+ import { FunctionDeclaration } from "@alloy-js/typescript";
5
+ import { refkey } from "@powerlines/plugin-alloy/helpers/refkey";
6
+ import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
7
+ import { TSDoc, TSDocLink, TSDocReturns } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
8
+
9
+ //#region src/components/react-optimized.tsx
10
+ const isOptimizationEnabledRefkey = refkey("isOptimizationEnabled");
11
+ /**
12
+ * Generates the `react/optimized` builtin module for the Powerlines project.
13
+ */
14
+ function ReactOptimizedBuiltin(props) {
15
+ const [{ override }, rest] = splitProps(props, ["override"]);
16
+ return createComponent(BuiltinFile, mergeProps(rest, {
17
+ id: "react/optimized",
18
+ description: "A built-in module to provide access to environment configuration to determine React optimizations.",
19
+ get builtinImports() {
20
+ return defu({ env: ["env", "isDevelopment"] }, rest.builtinImports ?? {});
21
+ },
22
+ get children() {
23
+ return [createComponent(TSDoc, {
24
+ heading: "A gating function to determine if the optimized [React compiler](https://react.dev/reference/react-compiler) source code should be used.",
25
+ get children() {
26
+ return [createComponent(TSDocLink, { children: `https://react.dev/reference/react-compiler/gating` }), createComponent(TSDocReturns, { children: `A boolean indicating if the React compiler's optimizations should be used.` })];
27
+ }
28
+ }), createComponent(FunctionDeclaration, {
29
+ refkey: isOptimizationEnabledRefkey,
30
+ async: false,
31
+ "export": true,
32
+ name: "isOptimizationEnabled",
33
+ returnType: "boolean",
34
+ get children() {
35
+ return [createComponent(Show, {
36
+ when: override !== void 0,
37
+ fallback: code`return !env.DISABLE_REACT_COMPILER && !isDevelopment; `,
38
+ children: code`return ${override};`
39
+ }), createIntrinsic("hbr", {})];
40
+ }
41
+ })];
42
+ }
43
+ }));
44
+ }
45
+
46
+ //#endregion
47
+ export { ReactOptimizedBuiltin };
48
+ //# sourceMappingURL=react-optimized.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-optimized.mjs","names":[],"sources":["../../src/components/react-optimized.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show, splitProps } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { refkey } from \"@powerlines/plugin-alloy/helpers/refkey\";\nimport {\n BuiltinFile,\n BuiltinFileProps\n} from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport {\n TSDoc,\n TSDocLink,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport defu from \"defu\";\n\nexport interface ReactOptimizedBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\"\n> {\n override?: boolean;\n}\n\nconst isOptimizationEnabledRefkey = refkey(\"isOptimizationEnabled\");\n\n/**\n * Generates the `react/optimized` builtin module for the Powerlines project.\n */\nexport function ReactOptimizedBuiltin(props: ReactOptimizedBuiltinProps) {\n const [{ override }, rest] = splitProps(props, [\"override\"]);\n\n return (\n <BuiltinFile\n {...rest}\n id=\"react/optimized\"\n description=\"A built-in module to provide access to environment configuration to determine React optimizations.\"\n builtinImports={defu(\n { env: [\"env\", \"isDevelopment\"] },\n rest.builtinImports ?? {}\n )}>\n <TSDoc heading=\"A gating function to determine if the optimized [React compiler](https://react.dev/reference/react-compiler) source code should be used.\">\n <TSDocLink>\n {`https://react.dev/reference/react-compiler/gating`}\n </TSDocLink>\n <TSDocReturns>\n {`A boolean indicating if the React compiler's optimizations should be used.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n refkey={isOptimizationEnabledRefkey}\n async={false}\n export={true}\n name=\"isOptimizationEnabled\"\n returnType=\"boolean\">\n <Show\n when={override !== undefined}\n fallback={code`return !env.DISABLE_REACT_COMPILER && !isDevelopment; `}>{code`return ${override};`}</Show>\n <hbr />\n </FunctionDeclaration>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;AA4BA,MAAE,8BAAA,OAAA,wBAAA;;;;AAKF,SAAE,sBAAgB,OAAA;CAChB,MAAG,CAAA,EACH,YACA,QAAW,WAAO,OAAA,CAAA,WAAA,CAAA;AACpB,QAAA,gBAAA,aAAA,WAAA,MAAA;;EAEA,aAAM;;AAEJ,UAAA,KAAA,EACC,KAAU,CAAA,OAAK,gBAAiB,EACjC,EAAA,KAAA,kBAAA,EAAA,CAAA;;EAEA,IAAM,WAAW;;IAEX,SAAC;IACJ,IAAA,WAAA;AACK,YAAI,CAAA,gBAAA,WAAA,EACJ,UAAM,qDACV,CAAA,EAAA,gBAAwB,cAAU,EAClC,UAAgB,8EACZ,CAAA,CAAG;;IAEN,CAAC,EAAA,gBAAA,qBAAA;IACD,QAAM;IACL,OAAC;IACD,UAAU;IACV,MAAE;IACF,YAAC;IACD,IAAI,WAAU;AACZ,YAAA,CAAA,gBAAY,MAAA;MACd,MAAK,aAAA;MACN,UAAA,IAAA;MACC,UAAQ,IAAA,UAAA,SAA2B;MACnC,CAAA,EAAM,gBAAM,OAAA,EAAA,CAAA,CAAA;;IAEb,CAAC,CAAA;;EAEL,CAAC,CAAC"}
package/dist/index.cjs ADDED
@@ -0,0 +1,106 @@
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_components_react_optimized = require('./components/react-optimized.cjs');
4
+ require('./components/index.cjs');
5
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
+ let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
7
+ let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
8
+ let _powerlines_plugin_babel = require("@powerlines/plugin-babel");
9
+ _powerlines_plugin_babel = require_runtime.__toESM(_powerlines_plugin_babel);
10
+ let _powerlines_plugin_env = require("@powerlines/plugin-env");
11
+ _powerlines_plugin_env = require_runtime.__toESM(_powerlines_plugin_env);
12
+ let _storm_software_config_tools_types = require("@storm-software/config-tools/types");
13
+ let _vitejs_plugin_react = require("@vitejs/plugin-react");
14
+ _vitejs_plugin_react = require_runtime.__toESM(_vitejs_plugin_react);
15
+ let defu = require("defu");
16
+ defu = require_runtime.__toESM(defu);
17
+ let powerlines_typescript_tsconfig = require("powerlines/typescript/tsconfig");
18
+
19
+ //#region src/index.tsx
20
+ /**
21
+ * A package containing a Powerlines plugin for building a React application.
22
+ */
23
+ const plugin = (options = {}) => {
24
+ return [
25
+ (0, _powerlines_plugin_babel.default)(options.babel),
26
+ (0, _powerlines_plugin_env.default)(options.env),
27
+ {
28
+ name: "react",
29
+ config() {
30
+ return (0, defu.default)({ react: options }, { react: { jsxImportSource: this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource } }, { react: {
31
+ jsxRuntime: "automatic",
32
+ jsxImportSource: "react",
33
+ compiler: {
34
+ target: "19",
35
+ compilationMode: "infer",
36
+ gating: {
37
+ source: `${this.config.framework}:react/optimized`,
38
+ importSpecifierName: "isOptimizationEnabled"
39
+ },
40
+ enableReanimatedCheck: true,
41
+ logger: { logEvent: (filename, event) => {
42
+ this.log(event.kind === "CompileSuccess" ? _storm_software_config_tools_types.LogLevelLabel.SUCCESS : event.kind === "AutoDepsEligible" || event.kind === "AutoDepsDecorations" ? _storm_software_config_tools_types.LogLevelLabel.INFO : event.kind === "CompileSkip" || event.kind === "CompileDiagnostic" ? _storm_software_config_tools_types.LogLevelLabel.DEBUG : event.kind === "Timing" ? _storm_software_config_tools_types.LogLevelLabel.TRACE : _storm_software_config_tools_types.LogLevelLabel.ERROR, `(${filename}) ${event.kind === "CompileSuccess" ? `React Compiler Success` : event.kind === "AutoDepsEligible" ? `React AutoDeps Eligible - ${event.depArrayLoc.identifierName || "No identifier"}` : event.kind === "AutoDepsDecorations" ? `React AutoDeps Decorations - ${event.decorations.filter((dec) => dec.identifierName).map((dec) => dec.identifierName).join(", ")}` : event.kind === "CompileSkip" ? `React Compile Skip - ${event.reason}` : event.kind === "CompileDiagnostic" ? `React Compile Diagnostic - (Category: ${event.detail.category}) ${event.detail.reason}${event.detail.description ? `\n${event.detail.description}` : ""}` : event.kind === "Timing" ? `React ${event.measurement.entryType} Timing (${event.measurement.name}) - ${event.measurement.duration}ms` : `React Compiler Error - ${event.fnLoc?.identifierName || "unknown location"}`}`);
43
+ } }
44
+ }
45
+ } });
46
+ },
47
+ configResolved() {
48
+ this.dependencies.react = "^19.2.3";
49
+ this.dependencies["react-dom"] = "^19.2.3";
50
+ this.devDependencies["@types/react"] = "^19.2.3";
51
+ this.devDependencies["@types/react-dom"] = "^19.2.3";
52
+ if (this.config.react.compiler !== false) {
53
+ this.config.babel ??= {};
54
+ this.config.babel.plugins ??= [];
55
+ this.config.babel.plugins.push(["babel-plugin-react-compiler", this.config.react.compiler]);
56
+ }
57
+ this.tsconfig.tsconfigJson.compilerOptions ??= {};
58
+ this.tsconfig.tsconfigJson.compilerOptions.lib ??= [];
59
+ this.tsconfig.tsconfigJson.compilerOptions.module ??= "esnext";
60
+ this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = this.config.react.jsxImportSource;
61
+ if (this.tsconfig.options.jsxImportSource === "react") this.tsconfig.tsconfigJson.compilerOptions.jsx ??= "react-jsx";
62
+ else this.tsconfig.tsconfigJson.compilerOptions.jsx ??= "preserve";
63
+ if (this.environment.consumer === "client") {
64
+ if (!(0, powerlines_typescript_tsconfig.isMatchFound)("dom", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM");
65
+ if (!(0, powerlines_typescript_tsconfig.isMatchFound)("dom.iterable", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM.Iterable");
66
+ }
67
+ if (!(0, powerlines_typescript_tsconfig.isMatchFound)("esnext", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("ESNext");
68
+ if (this.tsconfig.options.resolveJsonModule !== true) this.tsconfig.tsconfigJson.compilerOptions.resolveJsonModule = true;
69
+ if (this.config.vite) {
70
+ this.tsconfig.tsconfigJson.compilerOptions.types ??= [];
71
+ if (!(0, powerlines_typescript_tsconfig.isMatchFound)("vite/client", this.tsconfig.tsconfigJson.compilerOptions.types)) this.tsconfig.tsconfigJson.compilerOptions.types.push("vite/client");
72
+ const viteBuildConfig = this.config.vite;
73
+ viteBuildConfig.build ??= {};
74
+ viteBuildConfig.build.target = "chrome95";
75
+ viteBuildConfig.plugins ??= [];
76
+ viteBuildConfig.plugins.unshift((0, _vitejs_plugin_react.default)({
77
+ babel: this.config.babel,
78
+ jsxImportSource: this.config.react.jsxImportSource,
79
+ jsxRuntime: this.config.react.jsxRuntime,
80
+ reactRefreshHost: this.config.react.reactRefreshHost
81
+ }));
82
+ }
83
+ if (this.env?.types?.env && !this.env.types.env.hasProperty("DISABLE_REACT_COMPILER")) this.env.types.env.addProperty({
84
+ name: "DISABLE_REACT_COMPILER",
85
+ optional: true,
86
+ readonly: true,
87
+ description: "Disables the React compiler optimizations.",
88
+ visibility: _powerlines_deepkit_vendor_type.ReflectionVisibility.public,
89
+ type: { kind: _powerlines_deepkit_vendor_type.ReflectionKind.boolean },
90
+ default: false
91
+ });
92
+ },
93
+ async prepare() {
94
+ const _self$ = this;
95
+ return (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_react_optimized.ReactOptimizedBuiltin, { get override() {
96
+ return _self$.config.react.compiler === false ? false : void 0;
97
+ } }));
98
+ }
99
+ }
100
+ ];
101
+ };
102
+
103
+ //#endregion
104
+ exports.ReactOptimizedBuiltin = require_components_react_optimized.ReactOptimizedBuiltin;
105
+ exports.default = plugin;
106
+ exports.plugin = plugin;
@@ -0,0 +1,18 @@
1
+ import { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps, __ΩReactOptimizedBuiltinProps } from "./components/react-optimized.cjs";
2
+ import { ReactCompilerOptions, ReactPluginContext, ReactPluginOptions, ReactPluginResolvedConfig, ReactPluginUserConfig, __ΩReactCompilerOptions, __ΩReactPluginContext, __ΩReactPluginOptions, __ΩReactPluginResolvedConfig, __ΩReactPluginUserConfig } from "./types/plugin.cjs";
3
+ import { ReactEnvInterface, __ΩReactEnvInterface } from "./types/runtime.cjs";
4
+ import { Plugin } from "powerlines";
5
+
6
+ //#region src/index.d.ts
7
+ declare module "powerlines" {
8
+ interface Config {
9
+ react?: ReactPluginOptions;
10
+ }
11
+ }
12
+ /**
13
+ * A package containing a Powerlines plugin for building a React application.
14
+ */
15
+ declare const plugin: <TContext extends ReactPluginContext = ReactPluginContext>(options?: ReactPluginOptions) => Plugin<TContext>[];
16
+ //#endregion
17
+ export { ReactCompilerOptions, ReactEnvInterface, ReactOptimizedBuiltin, ReactOptimizedBuiltinProps, ReactPluginContext, ReactPluginOptions, ReactPluginResolvedConfig, ReactPluginUserConfig, __ΩReactCompilerOptions, __ΩReactEnvInterface, __ΩReactOptimizedBuiltinProps, __ΩReactPluginContext, __ΩReactPluginOptions, __ΩReactPluginResolvedConfig, __ΩReactPluginUserConfig, plugin as default, plugin };
18
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;YAuCY,MAAA;IACR,KAAA,GAAQ,kBAAA;EAAA;AAAA;;;;cAOC,MAAA,oBACM,kBAAA,GAAqB,kBAAA,EAEtC,OAAA,GAAS,kBAAA,KAoMJ,MAAA,CAAO,QAAA"}
@@ -0,0 +1,18 @@
1
+ import { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps, __ΩReactOptimizedBuiltinProps } from "./components/react-optimized.mjs";
2
+ import { ReactCompilerOptions, ReactPluginContext, ReactPluginOptions, ReactPluginResolvedConfig, ReactPluginUserConfig, __ΩReactCompilerOptions, __ΩReactPluginContext, __ΩReactPluginOptions, __ΩReactPluginResolvedConfig, __ΩReactPluginUserConfig } from "./types/plugin.mjs";
3
+ import { ReactEnvInterface, __ΩReactEnvInterface } from "./types/runtime.mjs";
4
+ import { Plugin } from "powerlines";
5
+
6
+ //#region src/index.d.ts
7
+ declare module "powerlines" {
8
+ interface Config {
9
+ react?: ReactPluginOptions;
10
+ }
11
+ }
12
+ /**
13
+ * A package containing a Powerlines plugin for building a React application.
14
+ */
15
+ declare const plugin: <TContext extends ReactPluginContext = ReactPluginContext>(options?: ReactPluginOptions) => Plugin<TContext>[];
16
+ //#endregion
17
+ export { ReactCompilerOptions, ReactEnvInterface, ReactOptimizedBuiltin, ReactOptimizedBuiltinProps, ReactPluginContext, ReactPluginOptions, ReactPluginResolvedConfig, ReactPluginUserConfig, __ΩReactCompilerOptions, __ΩReactEnvInterface, __ΩReactOptimizedBuiltinProps, __ΩReactPluginContext, __ΩReactPluginOptions, __ΩReactPluginResolvedConfig, __ΩReactPluginUserConfig, plugin as default, plugin };
18
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;YAuCY,MAAA;IACR,KAAA,GAAQ,kBAAA;EAAA;AAAA;;;;cAOC,MAAA,oBACM,kBAAA,GAAqB,kBAAA,EAEtC,OAAA,GAAS,kBAAA,KAoMJ,MAAA,CAAO,QAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,99 @@
1
+ import { ReactOptimizedBuiltin } from "./components/react-optimized.mjs";
2
+ import "./components/index.mjs";
3
+ import { createComponent } from "@alloy-js/core/jsx-runtime";
4
+ import { ReflectionKind, ReflectionVisibility } from "@powerlines/deepkit/vendor/type";
5
+ import { render } from "@powerlines/plugin-alloy/render";
6
+ import babel from "@powerlines/plugin-babel";
7
+ import env from "@powerlines/plugin-env";
8
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
9
+ import viteReactPlugin from "@vitejs/plugin-react";
10
+ import defu from "defu";
11
+ import { isMatchFound } from "powerlines/typescript/tsconfig";
12
+
13
+ //#region src/index.tsx
14
+ /**
15
+ * A package containing a Powerlines plugin for building a React application.
16
+ */
17
+ const plugin = (options = {}) => {
18
+ return [
19
+ babel(options.babel),
20
+ env(options.env),
21
+ {
22
+ name: "react",
23
+ config() {
24
+ return defu({ react: options }, { react: { jsxImportSource: this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource } }, { react: {
25
+ jsxRuntime: "automatic",
26
+ jsxImportSource: "react",
27
+ compiler: {
28
+ target: "19",
29
+ compilationMode: "infer",
30
+ gating: {
31
+ source: `${this.config.framework}:react/optimized`,
32
+ importSpecifierName: "isOptimizationEnabled"
33
+ },
34
+ enableReanimatedCheck: true,
35
+ logger: { logEvent: (filename, event) => {
36
+ this.log(event.kind === "CompileSuccess" ? LogLevelLabel.SUCCESS : event.kind === "AutoDepsEligible" || event.kind === "AutoDepsDecorations" ? LogLevelLabel.INFO : event.kind === "CompileSkip" || event.kind === "CompileDiagnostic" ? LogLevelLabel.DEBUG : event.kind === "Timing" ? LogLevelLabel.TRACE : LogLevelLabel.ERROR, `(${filename}) ${event.kind === "CompileSuccess" ? `React Compiler Success` : event.kind === "AutoDepsEligible" ? `React AutoDeps Eligible - ${event.depArrayLoc.identifierName || "No identifier"}` : event.kind === "AutoDepsDecorations" ? `React AutoDeps Decorations - ${event.decorations.filter((dec) => dec.identifierName).map((dec) => dec.identifierName).join(", ")}` : event.kind === "CompileSkip" ? `React Compile Skip - ${event.reason}` : event.kind === "CompileDiagnostic" ? `React Compile Diagnostic - (Category: ${event.detail.category}) ${event.detail.reason}${event.detail.description ? `\n${event.detail.description}` : ""}` : event.kind === "Timing" ? `React ${event.measurement.entryType} Timing (${event.measurement.name}) - ${event.measurement.duration}ms` : `React Compiler Error - ${event.fnLoc?.identifierName || "unknown location"}`}`);
37
+ } }
38
+ }
39
+ } });
40
+ },
41
+ configResolved() {
42
+ this.dependencies.react = "^19.2.3";
43
+ this.dependencies["react-dom"] = "^19.2.3";
44
+ this.devDependencies["@types/react"] = "^19.2.3";
45
+ this.devDependencies["@types/react-dom"] = "^19.2.3";
46
+ if (this.config.react.compiler !== false) {
47
+ this.config.babel ??= {};
48
+ this.config.babel.plugins ??= [];
49
+ this.config.babel.plugins.push(["babel-plugin-react-compiler", this.config.react.compiler]);
50
+ }
51
+ this.tsconfig.tsconfigJson.compilerOptions ??= {};
52
+ this.tsconfig.tsconfigJson.compilerOptions.lib ??= [];
53
+ this.tsconfig.tsconfigJson.compilerOptions.module ??= "esnext";
54
+ this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = this.config.react.jsxImportSource;
55
+ if (this.tsconfig.options.jsxImportSource === "react") this.tsconfig.tsconfigJson.compilerOptions.jsx ??= "react-jsx";
56
+ else this.tsconfig.tsconfigJson.compilerOptions.jsx ??= "preserve";
57
+ if (this.environment.consumer === "client") {
58
+ if (!isMatchFound("dom", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM");
59
+ if (!isMatchFound("dom.iterable", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM.Iterable");
60
+ }
61
+ if (!isMatchFound("esnext", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("ESNext");
62
+ if (this.tsconfig.options.resolveJsonModule !== true) this.tsconfig.tsconfigJson.compilerOptions.resolveJsonModule = true;
63
+ if (this.config.vite) {
64
+ this.tsconfig.tsconfigJson.compilerOptions.types ??= [];
65
+ if (!isMatchFound("vite/client", this.tsconfig.tsconfigJson.compilerOptions.types)) this.tsconfig.tsconfigJson.compilerOptions.types.push("vite/client");
66
+ const viteBuildConfig = this.config.vite;
67
+ viteBuildConfig.build ??= {};
68
+ viteBuildConfig.build.target = "chrome95";
69
+ viteBuildConfig.plugins ??= [];
70
+ viteBuildConfig.plugins.unshift(viteReactPlugin({
71
+ babel: this.config.babel,
72
+ jsxImportSource: this.config.react.jsxImportSource,
73
+ jsxRuntime: this.config.react.jsxRuntime,
74
+ reactRefreshHost: this.config.react.reactRefreshHost
75
+ }));
76
+ }
77
+ if (this.env?.types?.env && !this.env.types.env.hasProperty("DISABLE_REACT_COMPILER")) this.env.types.env.addProperty({
78
+ name: "DISABLE_REACT_COMPILER",
79
+ optional: true,
80
+ readonly: true,
81
+ description: "Disables the React compiler optimizations.",
82
+ visibility: ReflectionVisibility.public,
83
+ type: { kind: ReflectionKind.boolean },
84
+ default: false
85
+ });
86
+ },
87
+ async prepare() {
88
+ const _self$ = this;
89
+ return render(this, createComponent(ReactOptimizedBuiltin, { get override() {
90
+ return _self$.config.react.compiler === false ? false : void 0;
91
+ } }));
92
+ }
93
+ }
94
+ ];
95
+ };
96
+
97
+ //#endregion
98
+ export { ReactOptimizedBuiltin, plugin as default, plugin };
99
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n ReflectionKind,\n ReflectionVisibility\n} from \"@powerlines/deepkit/vendor/type\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport babel, { BabelPluginResolvedConfig } from \"@powerlines/plugin-babel\";\nimport env from \"@powerlines/plugin-env\";\nimport { VitePluginResolvedConfig } from \"@powerlines/plugin-vite/types/plugin\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport viteReactPlugin from \"@vitejs/plugin-react\";\nimport type { LoggerEvent } from \"babel-plugin-react-compiler\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport { isMatchFound } from \"powerlines/typescript/tsconfig\";\nimport { ReactOptimizedBuiltin } from \"./components/react-optimized\";\nimport type { ReactPluginContext, ReactPluginOptions } from \"./types/plugin\";\n\nexport * from \"./components\";\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n react?: ReactPluginOptions;\n }\n}\n\n/**\n * A package containing a Powerlines plugin for building a React application.\n */\nexport const plugin = <\n TContext extends ReactPluginContext = ReactPluginContext\n>(\n options: ReactPluginOptions = {}\n) => {\n return [\n babel(options.babel),\n env(options.env),\n {\n name: \"react\",\n config() {\n return defu(\n {\n react: options\n },\n {\n react: {\n jsxImportSource: this.tsconfig.tsconfigJson.compilerOptions\n ?.jsxImportSource as string\n }\n },\n {\n react: {\n jsxRuntime: \"automatic\",\n jsxImportSource: \"react\",\n compiler: {\n target: \"19\",\n compilationMode: \"infer\",\n gating: {\n source: `${this.config.framework}:react/optimized`,\n importSpecifierName: \"isOptimizationEnabled\"\n },\n enableReanimatedCheck: true,\n logger: {\n logEvent: (filename: string | null, event: LoggerEvent) => {\n this.log(\n event.kind === \"CompileSuccess\"\n ? LogLevelLabel.SUCCESS\n : event.kind === \"AutoDepsEligible\" ||\n event.kind === \"AutoDepsDecorations\"\n ? LogLevelLabel.INFO\n : event.kind === \"CompileSkip\" ||\n event.kind === \"CompileDiagnostic\"\n ? LogLevelLabel.DEBUG\n : event.kind === \"Timing\"\n ? LogLevelLabel.TRACE\n : LogLevelLabel.ERROR,\n `(${filename}) ${\n event.kind === \"CompileSuccess\"\n ? `React Compiler Success`\n : event.kind === \"AutoDepsEligible\"\n ? `React AutoDeps Eligible - ${\n event.depArrayLoc.identifierName ||\n \"No identifier\"\n }`\n : event.kind === \"AutoDepsDecorations\"\n ? `React AutoDeps Decorations - ${event.decorations\n .filter(dec => dec.identifierName)\n .map(dec => dec.identifierName)\n .join(\", \")}`\n : event.kind === \"CompileSkip\"\n ? `React Compile Skip - ${event.reason}`\n : event.kind === \"CompileDiagnostic\"\n ? `React Compile Diagnostic - (Category: ${\n event.detail.category\n }) ${event.detail.reason}${\n event.detail.description\n ? `\\n${event.detail.description}`\n : \"\"\n }`\n : event.kind === \"Timing\"\n ? `React ${event.measurement.entryType} Timing (${event.measurement.name}) - ${event.measurement.duration}ms`\n : `React Compiler Error - ${event.fnLoc?.identifierName || \"unknown location\"}`\n }`\n );\n }\n }\n }\n } as ReactPluginOptions\n }\n );\n },\n configResolved() {\n this.dependencies.react = \"^19.2.3\";\n this.dependencies[\"react-dom\"] = \"^19.2.3\";\n\n this.devDependencies[\"@types/react\"] = \"^19.2.3\";\n this.devDependencies[\"@types/react-dom\"] = \"^19.2.3\";\n\n if (this.config.react.compiler !== false) {\n (this.config as BabelPluginResolvedConfig).babel ??=\n {} as BabelPluginResolvedConfig[\"babel\"];\n\n this.config.babel.plugins ??= [];\n this.config.babel.plugins.push([\n \"babel-plugin-react-compiler\",\n this.config.react.compiler\n ]);\n }\n\n this.tsconfig.tsconfigJson.compilerOptions ??= {};\n this.tsconfig.tsconfigJson.compilerOptions.lib ??= [];\n this.tsconfig.tsconfigJson.compilerOptions.module ??= \"esnext\";\n this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource =\n this.config.react.jsxImportSource;\n\n if (this.tsconfig.options.jsxImportSource === \"react\") {\n this.tsconfig.tsconfigJson.compilerOptions.jsx ??= \"react-jsx\";\n } else {\n this.tsconfig.tsconfigJson.compilerOptions.jsx ??= \"preserve\";\n }\n\n // Client platform\n if (this.environment.consumer === \"client\") {\n if (\n !isMatchFound(\"dom\", this.tsconfig.tsconfigJson.compilerOptions.lib)\n ) {\n this.tsconfig.tsconfigJson.compilerOptions.lib.push(\"DOM\");\n }\n\n if (\n !isMatchFound(\n \"dom.iterable\",\n this.tsconfig.tsconfigJson.compilerOptions.lib\n )\n ) {\n this.tsconfig.tsconfigJson.compilerOptions.lib.push(\"DOM.Iterable\");\n }\n }\n\n if (\n !isMatchFound(\n \"esnext\",\n this.tsconfig.tsconfigJson.compilerOptions.lib\n )\n ) {\n this.tsconfig.tsconfigJson.compilerOptions.lib.push(\"ESNext\");\n }\n\n if (this.tsconfig.options.resolveJsonModule !== true) {\n this.tsconfig.tsconfigJson.compilerOptions.resolveJsonModule = true;\n }\n\n if ((this.config as VitePluginResolvedConfig).vite) {\n this.tsconfig.tsconfigJson.compilerOptions.types ??= [];\n\n if (\n !isMatchFound(\n \"vite/client\",\n this.tsconfig.tsconfigJson.compilerOptions.types\n )\n ) {\n this.tsconfig.tsconfigJson.compilerOptions.types.push(\n \"vite/client\"\n );\n }\n\n const viteBuildConfig = (this.config as VitePluginResolvedConfig)\n .vite;\n viteBuildConfig.build ??= {};\n viteBuildConfig.build.target = \"chrome95\";\n\n viteBuildConfig.plugins ??= [];\n viteBuildConfig.plugins.unshift(\n viteReactPlugin({\n babel: (this.config as BabelPluginResolvedConfig).babel,\n jsxImportSource: this.config.react.jsxImportSource,\n jsxRuntime: this.config.react.jsxRuntime,\n reactRefreshHost: this.config.react.reactRefreshHost\n })\n );\n }\n\n if (\n this.env?.types?.env &&\n !this.env.types.env.hasProperty(\"DISABLE_REACT_COMPILER\")\n ) {\n this.env.types.env.addProperty({\n name: \"DISABLE_REACT_COMPILER\",\n optional: true,\n readonly: true,\n description: \"Disables the React compiler optimizations.\",\n visibility: ReflectionVisibility.public,\n type: {\n kind: ReflectionKind.boolean\n },\n default: false\n });\n }\n },\n async prepare() {\n return render(\n this,\n <ReactOptimizedBuiltin\n override={this.config.react.compiler === false ? false : undefined}\n />\n );\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":"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"}
File without changes
@@ -0,0 +1,3 @@
1
+ import { ReactCompilerOptions, ReactPluginContext, ReactPluginOptions, ReactPluginResolvedConfig, ReactPluginUserConfig, __ΩReactCompilerOptions, __ΩReactPluginContext, __ΩReactPluginOptions, __ΩReactPluginResolvedConfig, __ΩReactPluginUserConfig } from "./plugin.cjs";
2
+ import { ReactEnvInterface, __ΩReactEnvInterface } from "./runtime.cjs";
3
+ export { ReactCompilerOptions, ReactEnvInterface, ReactPluginContext, ReactPluginOptions, ReactPluginResolvedConfig, ReactPluginUserConfig, __ΩReactCompilerOptions, __ΩReactEnvInterface, __ΩReactPluginContext, __ΩReactPluginOptions, __ΩReactPluginResolvedConfig, __ΩReactPluginUserConfig };
@@ -0,0 +1,3 @@
1
+ import { ReactCompilerOptions, ReactPluginContext, ReactPluginOptions, ReactPluginResolvedConfig, ReactPluginUserConfig, __ΩReactCompilerOptions, __ΩReactPluginContext, __ΩReactPluginOptions, __ΩReactPluginResolvedConfig, __ΩReactPluginUserConfig } from "./plugin.mjs";
2
+ import { ReactEnvInterface, __ΩReactEnvInterface } from "./runtime.mjs";
3
+ export { ReactCompilerOptions, ReactEnvInterface, ReactPluginContext, ReactPluginOptions, ReactPluginResolvedConfig, ReactPluginUserConfig, __ΩReactCompilerOptions, __ΩReactEnvInterface, __ΩReactPluginContext, __ΩReactPluginOptions, __ΩReactPluginResolvedConfig, __ΩReactPluginUserConfig };
@@ -0,0 +1 @@
1
+ export { };
File without changes
@@ -0,0 +1,74 @@
1
+ import { BabelPluginOptions } from "@powerlines/plugin-babel/types/plugin";
2
+ import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig } from "@powerlines/plugin-env/types/plugin";
3
+ import { PluginOptions } from "babel-plugin-react-compiler";
4
+
5
+ //#region src/types/plugin.d.ts
6
+ type ReactCompilerOptions = Omit<PluginOptions, "logger">;
7
+ interface ReactPluginOptions {
8
+ /**
9
+ * Control where the JSX factory is imported from.
10
+ *
11
+ * @see https://esbuild.github.io/api/#jsx-import-source
12
+ *
13
+ * @defaultValue "react"
14
+ */
15
+ jsxImportSource?: string;
16
+ /**
17
+ * Control how JSX is transformed.
18
+ *
19
+ * @remarks
20
+ * Skipping React import with classic runtime is not supported from v4
21
+ *
22
+ * @defaultValue "automatic"
23
+ */
24
+ jsxRuntime?: "classic" | "automatic";
25
+ /**
26
+ * Options provided to the [React Compiler](https://npmjs.com/package/babel-plugin-react-compiler).
27
+ *
28
+ * @see https://github.com/facebook/react/blob/main/compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Options.ts#L55
29
+ * @see https://react.dev/blog/2025/04/21/react-compiler-rc
30
+ *
31
+ * @remarks
32
+ * Set to `false` to disable the React Compiler. By default, the React Compiler is enabled and target is set to React 19.
33
+ */
34
+ compiler?: ReactCompilerOptions | false;
35
+ /**
36
+ * React Fast Refresh runtime URL prefix.
37
+ *
38
+ * @remarks
39
+ * Useful in a module federation context to enable HMR by specifying the host application URL in the Vite config of a remote application.
40
+ *
41
+ * @example
42
+ * reactRefreshHost: 'http://localhost:3000'
43
+ */
44
+ reactRefreshHost?: string;
45
+ /**
46
+ * Options to pass to the [Babel plugin](https://npmjs.com/package/\@powerlines/plugin-babel).
47
+ */
48
+ babel?: Partial<BabelPluginOptions>;
49
+ /**
50
+ * Options to pass to the [Env plugin](https://npmjs.com/package/\@powerlines/plugin-env).
51
+ */
52
+ env?: Partial<Omit<EnvPluginOptions, "babel">>;
53
+ }
54
+ type ReactPluginUserConfig = EnvPluginUserConfig & {
55
+ /**
56
+ * Options for the React plugin.
57
+ */
58
+ react?: ReactPluginOptions;
59
+ };
60
+ type ReactPluginResolvedConfig = EnvPluginResolvedConfig & {
61
+ /**
62
+ * Options for the React plugin.
63
+ */
64
+ react: ReactPluginOptions;
65
+ };
66
+ interface ReactPluginContext<TResolvedConfig extends ReactPluginResolvedConfig = ReactPluginResolvedConfig> extends EnvPluginContext<TResolvedConfig> {}
67
+ declare type __ΩReactCompilerOptions = any[];
68
+ declare type __ΩReactPluginOptions = any[];
69
+ declare type __ΩReactPluginUserConfig = any[];
70
+ declare type __ΩReactPluginResolvedConfig = any[];
71
+ declare type __ΩReactPluginContext = any[];
72
+ //#endregion
73
+ export { ReactCompilerOptions, ReactPluginContext, ReactPluginOptions, ReactPluginResolvedConfig, ReactPluginUserConfig, __ΩReactCompilerOptions, __ΩReactPluginContext, __ΩReactPluginOptions, __ΩReactPluginResolvedConfig, __ΩReactPluginUserConfig };
74
+ //# sourceMappingURL=plugin.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;KA2BY,oBAAA,GAAuB,IAAA,CAAK,aAAA;AAAA,UAEvB,kBAAA;EAFL;;;;;AAEZ;;EAQE,eAAA;EAqBW;;;;;;;;EAXX,UAAA;EAAA;;;;;;;;;EAWA,QAAA,GAAW,oBAAA;EAqBQ;;;AAGrB;;;;;;EAbE,gBAAA;EAiB0B;;AAG5B;EAfE,KAAA,GAAQ,OAAA,CAAQ,kBAAA;;;;EAKhB,GAAA,GAAM,OAAA,CAAQ,IAAA,CAAK,gBAAA;AAAA;AAAA,KAGT,qBAAA,GAAwB,mBAAA;EAWT;AAG3B;;EAVE,KAAA,GAAQ,kBAAA;AAAA;AAAA,KAGE,yBAAA,GAA4B,uBAAA;EASb;;;EALzB,KAAA,EAAO,kBAAA;AAAA;AAAA,UAGQ,kBAAA,yBACS,yBAAA,GAA4B,yBAAA,UAC5C,gBAAA,CAAiB,eAAA;AAAA"}
@@ -0,0 +1,74 @@
1
+ import { BabelPluginOptions } from "@powerlines/plugin-babel/types/plugin";
2
+ import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig } from "@powerlines/plugin-env/types/plugin";
3
+ import { PluginOptions } from "babel-plugin-react-compiler";
4
+
5
+ //#region src/types/plugin.d.ts
6
+ type ReactCompilerOptions = Omit<PluginOptions, "logger">;
7
+ interface ReactPluginOptions {
8
+ /**
9
+ * Control where the JSX factory is imported from.
10
+ *
11
+ * @see https://esbuild.github.io/api/#jsx-import-source
12
+ *
13
+ * @defaultValue "react"
14
+ */
15
+ jsxImportSource?: string;
16
+ /**
17
+ * Control how JSX is transformed.
18
+ *
19
+ * @remarks
20
+ * Skipping React import with classic runtime is not supported from v4
21
+ *
22
+ * @defaultValue "automatic"
23
+ */
24
+ jsxRuntime?: "classic" | "automatic";
25
+ /**
26
+ * Options provided to the [React Compiler](https://npmjs.com/package/babel-plugin-react-compiler).
27
+ *
28
+ * @see https://github.com/facebook/react/blob/main/compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Options.ts#L55
29
+ * @see https://react.dev/blog/2025/04/21/react-compiler-rc
30
+ *
31
+ * @remarks
32
+ * Set to `false` to disable the React Compiler. By default, the React Compiler is enabled and target is set to React 19.
33
+ */
34
+ compiler?: ReactCompilerOptions | false;
35
+ /**
36
+ * React Fast Refresh runtime URL prefix.
37
+ *
38
+ * @remarks
39
+ * Useful in a module federation context to enable HMR by specifying the host application URL in the Vite config of a remote application.
40
+ *
41
+ * @example
42
+ * reactRefreshHost: 'http://localhost:3000'
43
+ */
44
+ reactRefreshHost?: string;
45
+ /**
46
+ * Options to pass to the [Babel plugin](https://npmjs.com/package/\@powerlines/plugin-babel).
47
+ */
48
+ babel?: Partial<BabelPluginOptions>;
49
+ /**
50
+ * Options to pass to the [Env plugin](https://npmjs.com/package/\@powerlines/plugin-env).
51
+ */
52
+ env?: Partial<Omit<EnvPluginOptions, "babel">>;
53
+ }
54
+ type ReactPluginUserConfig = EnvPluginUserConfig & {
55
+ /**
56
+ * Options for the React plugin.
57
+ */
58
+ react?: ReactPluginOptions;
59
+ };
60
+ type ReactPluginResolvedConfig = EnvPluginResolvedConfig & {
61
+ /**
62
+ * Options for the React plugin.
63
+ */
64
+ react: ReactPluginOptions;
65
+ };
66
+ interface ReactPluginContext<TResolvedConfig extends ReactPluginResolvedConfig = ReactPluginResolvedConfig> extends EnvPluginContext<TResolvedConfig> {}
67
+ declare type __ΩReactCompilerOptions = any[];
68
+ declare type __ΩReactPluginOptions = any[];
69
+ declare type __ΩReactPluginUserConfig = any[];
70
+ declare type __ΩReactPluginResolvedConfig = any[];
71
+ declare type __ΩReactPluginContext = any[];
72
+ //#endregion
73
+ export { ReactCompilerOptions, ReactPluginContext, ReactPluginOptions, ReactPluginResolvedConfig, ReactPluginUserConfig, __ΩReactCompilerOptions, __ΩReactPluginContext, __ΩReactPluginOptions, __ΩReactPluginResolvedConfig, __ΩReactPluginUserConfig };
74
+ //# sourceMappingURL=plugin.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;KA2BY,oBAAA,GAAuB,IAAA,CAAK,aAAA;AAAA,UAEvB,kBAAA;EAFL;;;;;AAEZ;;EAQE,eAAA;EAqBW;;;;;;;;EAXX,UAAA;EAAA;;;;;;;;;EAWA,QAAA,GAAW,oBAAA;EAqBQ;;;AAGrB;;;;;;EAbE,gBAAA;EAiB0B;;AAG5B;EAfE,KAAA,GAAQ,OAAA,CAAQ,kBAAA;;;;EAKhB,GAAA,GAAM,OAAA,CAAQ,IAAA,CAAK,gBAAA;AAAA;AAAA,KAGT,qBAAA,GAAwB,mBAAA;EAWT;AAG3B;;EAVE,KAAA,GAAQ,kBAAA;AAAA;AAAA,KAGE,yBAAA,GAA4B,uBAAA;EASb;;;EALzB,KAAA,EAAO,kBAAA;AAAA;AAAA,UAGQ,kBAAA,yBACS,yBAAA,GAA4B,yBAAA,UAC5C,gBAAA,CAAiB,eAAA;AAAA"}
@@ -0,0 +1 @@
1
+ export { };
File without changes
@@ -0,0 +1,16 @@
1
+ import { EnvInterface } from "@powerlines/plugin-env/types/runtime";
2
+
3
+ //#region src/types/runtime.d.ts
4
+ interface ReactEnvInterface extends EnvInterface {
5
+ /**
6
+ * Disables the React compiler optimizations when set to true.
7
+ *
8
+ * @remarks
9
+ * This environment variable can be used to turn off the optimizations provided by the React compiler, which may be useful for debugging or development purposes.
10
+ */
11
+ DISABLE_REACT_COMPILER: boolean;
12
+ }
13
+ declare type __ΩReactEnvInterface = any[];
14
+ //#endregion
15
+ export { ReactEnvInterface, __ΩReactEnvInterface };
16
+ //# sourceMappingURL=runtime.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.cts","names":[],"sources":["../../src/types/runtime.ts"],"mappings":";;;UAoBiB,iBAAA,SAA0B,YAAA;;AAA3C;;;;;EAOE,sBAAA;AAAA;AAAA"}
@@ -0,0 +1,16 @@
1
+ import { EnvInterface } from "@powerlines/plugin-env/types/runtime";
2
+
3
+ //#region src/types/runtime.d.ts
4
+ interface ReactEnvInterface extends EnvInterface {
5
+ /**
6
+ * Disables the React compiler optimizations when set to true.
7
+ *
8
+ * @remarks
9
+ * This environment variable can be used to turn off the optimizations provided by the React compiler, which may be useful for debugging or development purposes.
10
+ */
11
+ DISABLE_REACT_COMPILER: boolean;
12
+ }
13
+ declare type __ΩReactEnvInterface = any[];
14
+ //#endregion
15
+ export { ReactEnvInterface, __ΩReactEnvInterface };
16
+ //# sourceMappingURL=runtime.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.mts","names":[],"sources":["../../src/types/runtime.ts"],"mappings":";;;UAoBiB,iBAAA,SAA0B,YAAA;;AAA3C;;;;;EAOE,sBAAA;AAAA;AAAA"}
@@ -0,0 +1 @@
1
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-react",
3
- "version": "0.1.419",
3
+ "version": "0.1.422",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin for building a React application.",
6
6
  "repository": {
@@ -141,11 +141,11 @@
141
141
  "@alloy-js/markdown": "0.23.0-dev.1",
142
142
  "@alloy-js/typescript": "0.23.0-dev.4",
143
143
  "@babel/core": "^7.29.0",
144
- "@powerlines/plugin-vite": "^0.14.361",
145
- "@powerlines/plugin-alloy": "^0.25.49",
146
- "@powerlines/plugin-babel": "^0.12.365",
147
- "@powerlines/plugin-env": "^0.16.84",
148
- "@storm-software/config-tools": "^1.189.39",
144
+ "@powerlines/plugin-vite": "^0.14.364",
145
+ "@powerlines/plugin-alloy": "^0.25.52",
146
+ "@powerlines/plugin-babel": "^0.12.368",
147
+ "@powerlines/plugin-env": "^0.16.87",
148
+ "@storm-software/config-tools": "^1.189.41",
149
149
  "@stryke/cli": "^0.13.35",
150
150
  "@stryke/convert": "^0.6.56",
151
151
  "@stryke/fs": "^0.33.63",
@@ -153,15 +153,15 @@
153
153
  "@vitejs/plugin-react": "^5.2.0",
154
154
  "babel-plugin-react-compiler": "^1.0.0",
155
155
  "defu": "^6.1.4",
156
- "powerlines": "^0.42.4"
156
+ "powerlines": "^0.42.7"
157
157
  },
158
158
  "devDependencies": {
159
- "@powerlines/plugin-plugin": "^0.12.314",
159
+ "@powerlines/plugin-plugin": "^0.12.317",
160
160
  "@types/node": "^25.5.0",
161
161
  "@types/react": "^19.2.14",
162
162
  "@types/react-dom": "^19.2.3"
163
163
  },
164
164
  "publishConfig": { "access": "public" },
165
165
  "types": "./dist/index.d.cts",
166
- "gitHead": "c3243c1ec0fbacb4afd4bd3db20432f443334076"
166
+ "gitHead": "8c25b27c36407abbd22351d8a9afba5bce5abc08"
167
167
  }