@powerlines/plugin-react 0.1.611 → 0.1.613
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/components/react-optimized.d.cts +1 -1
- package/dist/components/react-optimized.d.cts.map +1 -1
- package/dist/components/react-optimized.d.mts +1 -1
- package/dist/components/react-optimized.d.mts.map +1 -1
- package/dist/index.cjs +7 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +7 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -13
|
@@ -7,7 +7,7 @@ interface ReactOptimizedBuiltinProps extends Omit<BuiltinFileProps, "id"> {
|
|
|
7
7
|
/**
|
|
8
8
|
* Generates the `react/optimized` builtin module for the Powerlines project.
|
|
9
9
|
*/
|
|
10
|
-
declare function ReactOptimizedBuiltin(props: ReactOptimizedBuiltinProps): import("
|
|
10
|
+
declare function ReactOptimizedBuiltin(props: ReactOptimizedBuiltinProps): import("@alloy-js/core").Children;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps };
|
|
13
13
|
//# sourceMappingURL=react-optimized.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-optimized.d.cts","names":[],"sources":["../../src/components/react-optimized.tsx"],"mappings":";;;UAgCiB,0BAAA,SAAmC,IAAI,CACtD,gBAAA;EAGA,QAAA;AAAA;;;;iBAQc,qBAAA,CAAsB,KAAA,EAAO,0BAA0B,
|
|
1
|
+
{"version":3,"file":"react-optimized.d.cts","names":[],"sources":["../../src/components/react-optimized.tsx"],"mappings":";;;UAgCiB,0BAAA,SAAmC,IAAI,CACtD,gBAAA;EAGA,QAAA;AAAA;;;;iBAQc,qBAAA,CAAsB,KAAA,EAAO,0BAA0B,4BAAA,QAAA"}
|
|
@@ -7,7 +7,7 @@ interface ReactOptimizedBuiltinProps extends Omit<BuiltinFileProps, "id"> {
|
|
|
7
7
|
/**
|
|
8
8
|
* Generates the `react/optimized` builtin module for the Powerlines project.
|
|
9
9
|
*/
|
|
10
|
-
declare function ReactOptimizedBuiltin(props: ReactOptimizedBuiltinProps): import("
|
|
10
|
+
declare function ReactOptimizedBuiltin(props: ReactOptimizedBuiltinProps): import("@alloy-js/core").Children;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps };
|
|
13
13
|
//# sourceMappingURL=react-optimized.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-optimized.d.mts","names":[],"sources":["../../src/components/react-optimized.tsx"],"mappings":";;;UAgCiB,0BAAA,SAAmC,IAAI,CACtD,gBAAA;EAGA,QAAA;AAAA;;;;iBAQc,qBAAA,CAAsB,KAAA,EAAO,0BAA0B,
|
|
1
|
+
{"version":3,"file":"react-optimized.d.mts","names":[],"sources":["../../src/components/react-optimized.tsx"],"mappings":";;;UAgCiB,0BAAA,SAAmC,IAAI,CACtD,gBAAA;EAGA,QAAA;AAAA;;;;iBAQc,qBAAA,CAAsB,KAAA,EAAO,0BAA0B,4BAAA,QAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -4,12 +4,13 @@ const require_components_react_optimized = require('./components/react-optimized
|
|
|
4
4
|
require('./components/index.cjs');
|
|
5
5
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
6
|
let _powerlines_core_lib_typescript = require("@powerlines/core/lib/typescript");
|
|
7
|
-
let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
8
7
|
let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
9
8
|
let _powerlines_plugin_babel = require("@powerlines/plugin-babel");
|
|
10
9
|
_powerlines_plugin_babel = require_runtime.__toESM(_powerlines_plugin_babel);
|
|
11
10
|
let _powerlines_plugin_env = require("@powerlines/plugin-env");
|
|
12
11
|
_powerlines_plugin_env = require_runtime.__toESM(_powerlines_plugin_env);
|
|
12
|
+
let _powerlines_schema = require("@powerlines/schema");
|
|
13
|
+
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
13
14
|
let _vitejs_plugin_react = require("@vitejs/plugin-react");
|
|
14
15
|
_vitejs_plugin_react = require_runtime.__toESM(_vitejs_plugin_react);
|
|
15
16
|
let defu = require("defu");
|
|
@@ -33,7 +34,7 @@ const plugin = (options = {}) => {
|
|
|
33
34
|
target: "19",
|
|
34
35
|
compilationMode: "infer",
|
|
35
36
|
gating: {
|
|
36
|
-
source: `${this.config.framework}:react/optimized`,
|
|
37
|
+
source: `${(0, _stryke_string_format_kebab_case.kebabCase)(this.config.framework?.name) || "powerlines"}:react/optimized`,
|
|
37
38
|
importSpecifierName: "isOptimizationEnabled"
|
|
38
39
|
},
|
|
39
40
|
enableReanimatedCheck: true,
|
|
@@ -59,7 +60,7 @@ const plugin = (options = {}) => {
|
|
|
59
60
|
this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = this.config.react.jsxImportSource;
|
|
60
61
|
if (this.tsconfig.options.jsxImportSource === "react") this.tsconfig.tsconfigJson.compilerOptions.jsx ??= "react-jsx";
|
|
61
62
|
else this.tsconfig.tsconfigJson.compilerOptions.jsx ??= "preserve";
|
|
62
|
-
if (this.environment.consumer === "client") {
|
|
63
|
+
if (this.config.environment.consumer === "client") {
|
|
63
64
|
if (!(0, _powerlines_core_lib_typescript.isMatchFound)("dom", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM");
|
|
64
65
|
if (!(0, _powerlines_core_lib_typescript.isMatchFound)("dom.iterable", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM.Iterable");
|
|
65
66
|
}
|
|
@@ -79,13 +80,11 @@ const plugin = (options = {}) => {
|
|
|
79
80
|
reactRefreshHost: this.config.react.reactRefreshHost
|
|
80
81
|
}));
|
|
81
82
|
}
|
|
82
|
-
if (this.env?.
|
|
83
|
+
if (this.env?.config && !this.env?.config.schema?.properties?.DISABLE_REACT_COMPILER) (0, _powerlines_schema.addProperty)(this.env?.config, "DISABLE_REACT_COMPILER", {
|
|
83
84
|
name: "DISABLE_REACT_COMPILER",
|
|
84
|
-
|
|
85
|
-
readonly: true,
|
|
85
|
+
readOnly: true,
|
|
86
86
|
description: "Disables the React compiler optimizations.",
|
|
87
|
-
|
|
88
|
-
type: { kind: _powerlines_deepkit_vendor_type.ReflectionKind.boolean },
|
|
87
|
+
type: "boolean",
|
|
89
88
|
default: false
|
|
90
89
|
});
|
|
91
90
|
},
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;YAqCY,MAAA;IACR,KAAA,GAAQ,kBAAkB;EAAA;AAAA;;;;cAOjB,MAAA,oBACM,kBAAA,GAAqB,kBAAA,EAEtC,OAAA,GAAS,kBAAA,KA0MJ,MAAA,CAAO,QAAA"}
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;YAqCY,MAAA;IACR,KAAA,GAAQ,kBAAkB;EAAA;AAAA;;;;cAOjB,MAAA,oBACM,kBAAA,GAAqB,kBAAA,EAEtC,OAAA,GAAS,kBAAA,KA0MJ,MAAA,CAAO,QAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -2,10 +2,11 @@ import { ReactOptimizedBuiltin } from "./components/react-optimized.mjs";
|
|
|
2
2
|
import "./components/index.mjs";
|
|
3
3
|
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
4
4
|
import { isMatchFound } from "@powerlines/core/lib/typescript";
|
|
5
|
-
import { ReflectionKind, ReflectionVisibility } from "@powerlines/deepkit/vendor/type";
|
|
6
5
|
import { render } from "@powerlines/plugin-alloy/render";
|
|
7
6
|
import babel from "@powerlines/plugin-babel";
|
|
8
7
|
import env from "@powerlines/plugin-env";
|
|
8
|
+
import { addProperty } from "@powerlines/schema";
|
|
9
|
+
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
9
10
|
import viteReactPlugin from "@vitejs/plugin-react";
|
|
10
11
|
import defu from "defu";
|
|
11
12
|
|
|
@@ -27,7 +28,7 @@ const plugin = (options = {}) => {
|
|
|
27
28
|
target: "19",
|
|
28
29
|
compilationMode: "infer",
|
|
29
30
|
gating: {
|
|
30
|
-
source: `${this.config.framework}:react/optimized`,
|
|
31
|
+
source: `${kebabCase(this.config.framework?.name) || "powerlines"}:react/optimized`,
|
|
31
32
|
importSpecifierName: "isOptimizationEnabled"
|
|
32
33
|
},
|
|
33
34
|
enableReanimatedCheck: true,
|
|
@@ -53,7 +54,7 @@ const plugin = (options = {}) => {
|
|
|
53
54
|
this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = this.config.react.jsxImportSource;
|
|
54
55
|
if (this.tsconfig.options.jsxImportSource === "react") this.tsconfig.tsconfigJson.compilerOptions.jsx ??= "react-jsx";
|
|
55
56
|
else this.tsconfig.tsconfigJson.compilerOptions.jsx ??= "preserve";
|
|
56
|
-
if (this.environment.consumer === "client") {
|
|
57
|
+
if (this.config.environment.consumer === "client") {
|
|
57
58
|
if (!isMatchFound("dom", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM");
|
|
58
59
|
if (!isMatchFound("dom.iterable", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM.Iterable");
|
|
59
60
|
}
|
|
@@ -73,13 +74,11 @@ const plugin = (options = {}) => {
|
|
|
73
74
|
reactRefreshHost: this.config.react.reactRefreshHost
|
|
74
75
|
}));
|
|
75
76
|
}
|
|
76
|
-
if (this.env?.
|
|
77
|
+
if (this.env?.config && !this.env?.config.schema?.properties?.DISABLE_REACT_COMPILER) addProperty(this.env?.config, "DISABLE_REACT_COMPILER", {
|
|
77
78
|
name: "DISABLE_REACT_COMPILER",
|
|
78
|
-
|
|
79
|
-
readonly: true,
|
|
79
|
+
readOnly: true,
|
|
80
80
|
description: "Disables the React compiler optimizations.",
|
|
81
|
-
|
|
82
|
-
type: { kind: ReflectionKind.boolean },
|
|
81
|
+
type: "boolean",
|
|
83
82
|
default: false
|
|
84
83
|
});
|
|
85
84
|
},
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +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 { isMatchFound } from \"@powerlines/core/lib/typescript\";\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 viteReactPlugin, { BabelOptions } from \"@vitejs/plugin-react\";\nimport type { LoggerEvent } from \"babel-plugin-react-compiler\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\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.logger.log(\n event.kind === \"CompileSuccess\" ||\n event.kind === \"AutoDepsEligible\" ||\n event.kind === \"AutoDepsDecorations\"\n ? \"info\"\n : event.kind === \"CompileSkip\" ||\n event.kind === \"CompileDiagnostic\"\n ? \"debug\"\n : event.kind === \"Timing\"\n ? \"trace\"\n : \"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 ${\n event.measurement.entryType\n } Timing (${event.measurement.name}) - ${\n event.measurement.duration\n }ms`\n : `React Compiler Error - ${\n event.fnLoc?.identifierName ||\n \"unknown location\"\n }`\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)\n .babel as BabelOptions,\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":";;;;;;;;;;;;;;;AAkCA,MAAa,UAAI,UAAW,CAAA,MAAA;CAC5B,OAAS;EAAA,MAAO,QAAO,KAAA;EAAA,IAAA,QAAA,GAAA;EAAA;;GAEvB,SAAQ;IACN,OAAU,KAAM,EACd,OAAQ,QACV,GAAA,EACF,OAAA,+EAEE,EACG,GAAA,EACH,OAAA;KACK,YAAe;KACZ,iBAAS;KAClB,UAAA;MACU,QAAA;MACN,iBAAA;MACI,QAAA;OACC,QAAQ,GAAM,KAAA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N,UAAU;KACV,UAAU;KACV,aAAa;KACb,YAAY,qBAAkB;KAC9B,MAAM,EACJ,MAAM,eAAe,QACvB;KACA,SAAS;IACX,CAAC;GAEL;GACA,MAAM,UAAO;IACX,MAAI,SAAA;IACJ,OAAG,OAAA,MAAA,gBAAA,uBAAA,EACF,IAAA,WAAA;KACD,OAAA,OAAiB,OAAA,MAAA,aAAA,QAAA,QAAA;IACf,EACF,CAAC,CAAC;;EAEN;CAAC;AACH"}
|
|
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 { isMatchFound } from \"@powerlines/core/lib/typescript\";\n\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 { addProperty } from \"@powerlines/schema\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport viteReactPlugin, { BabelOptions } from \"@vitejs/plugin-react\";\nimport type { LoggerEvent } from \"babel-plugin-react-compiler\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\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: `${\n kebabCase(this.config.framework?.name) || \"powerlines\"\n }:react/optimized`,\n importSpecifierName: \"isOptimizationEnabled\"\n },\n enableReanimatedCheck: true,\n logger: {\n logEvent: (filename: string | null, event: LoggerEvent) => {\n this.logger.log(\n event.kind === \"CompileSuccess\" ||\n event.kind === \"AutoDepsEligible\" ||\n event.kind === \"AutoDepsDecorations\"\n ? \"info\"\n : event.kind === \"CompileSkip\" ||\n event.kind === \"CompileDiagnostic\"\n ? \"debug\"\n : event.kind === \"Timing\"\n ? \"trace\"\n : \"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 ${\n event.measurement.entryType\n } Timing (${event.measurement.name}) - ${\n event.measurement.duration\n }ms`\n : `React Compiler Error - ${\n event.fnLoc?.identifierName ||\n \"unknown location\"\n }`\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.config.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 unknown 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 = (\n this.config as unknown 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)\n .babel as BabelOptions,\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?.config &&\n !this.env?.config.schema?.properties?.DISABLE_REACT_COMPILER\n ) {\n addProperty(this.env?.config, \"DISABLE_REACT_COMPILER\", {\n name: \"DISABLE_REACT_COMPILER\",\n readOnly: true,\n description: \"Disables the React compiler optimizations.\",\n type: \"boolean\",\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":";;;;;;;;;;;;;;;;;CAoCA,OAAQ;EAAA,MAAQ,QAAA,KAAY;EAAA,IAAA,QAAA,GAAA;EAAA;GAC1B,MAAA;GACE,SAAQ;IACV,OAAA,KAAA,EACF,OAAA,aAEE,OAAA,EACG,iBAAqB,KAAA,SAAW,aAAW,iBAAiB,gBAC/D,EACI,GAAC,EACL,OAAS;KACV,YAAA;KACS,iBAAC;KACN,UAAA;MACI,QAAA;MACC,iBAAc;MAChB,QAAY;OAChB,QAAA,GAAA,UAAA,KAAA,OAAA,WAAA,IAAA,KAAA,aAAA;OACS,qBAAM;MACP;MACJ,uBAAW;MACT,QAAA,EACE,WAAO,UAAA,UAAA;OACR,KAAA,OAAA,IAAA,MAAA,SAAA,oBAAA,MAAA,SA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IAAI,WAAE;KACJ,OAAO,OAAA,OAAA,MAAA,aAAA,QAAA,QAAA;IACT,EACF,CAAC,CAAC;GACJ;EACF;CAAC;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.613",
|
|
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"],
|
|
@@ -74,23 +74,24 @@
|
|
|
74
74
|
"@alloy-js/markdown": "^0.23.0",
|
|
75
75
|
"@alloy-js/typescript": "^0.23.0",
|
|
76
76
|
"@babel/core": "8.0.0-rc.6",
|
|
77
|
-
"@powerlines/core": "^0.48.
|
|
78
|
-
"@powerlines/plugin-alloy": "
|
|
79
|
-
"@powerlines/plugin-babel": "^0.13.
|
|
80
|
-
"@powerlines/plugin-env": "
|
|
81
|
-
"@powerlines/plugin-vite": "^0.14.
|
|
77
|
+
"@powerlines/core": "^0.48.19",
|
|
78
|
+
"@powerlines/plugin-alloy": "0.26.167",
|
|
79
|
+
"@powerlines/plugin-babel": "^0.13.72",
|
|
80
|
+
"@powerlines/plugin-env": "0.16.278",
|
|
81
|
+
"@powerlines/plugin-vite": "^0.14.530",
|
|
82
82
|
"@storm-software/config-tools": "^1.190.33",
|
|
83
|
-
"@stryke/cli": "^0.13.
|
|
84
|
-
"@stryke/convert": "^0.7.
|
|
85
|
-
"@stryke/fs": "^0.33.
|
|
86
|
-
"@stryke/path": "^0.29.
|
|
83
|
+
"@stryke/cli": "^0.13.50",
|
|
84
|
+
"@stryke/convert": "^0.7.9",
|
|
85
|
+
"@stryke/fs": "^0.33.78",
|
|
86
|
+
"@stryke/path": "^0.29.5",
|
|
87
|
+
"@stryke/string-format": "^0.17.20",
|
|
87
88
|
"@vitejs/plugin-react": "^5.2.0",
|
|
88
89
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
89
90
|
"defu": "^6.1.7",
|
|
90
|
-
"powerlines": "^0.47.
|
|
91
|
+
"powerlines": "^0.47.76"
|
|
91
92
|
},
|
|
92
93
|
"devDependencies": {
|
|
93
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
94
|
+
"@powerlines/plugin-plugin": "^0.12.488",
|
|
94
95
|
"@types/node": "^25.9.1",
|
|
95
96
|
"@types/react": "^19.2.15",
|
|
96
97
|
"@types/react-dom": "^19.2.3"
|
|
@@ -101,5 +102,5 @@
|
|
|
101
102
|
"react-dom": { "optional": false }
|
|
102
103
|
},
|
|
103
104
|
"publishConfig": { "access": "public" },
|
|
104
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "3c8e1ad5b1a50860626e97aed87ea56db57981b3"
|
|
105
106
|
}
|