@powerlines/plugin-react 0.1.526 → 0.1.530

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,4 @@
1
+ import * as _$react from "react";
1
2
  import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
2
3
 
3
4
  //#region src/components/react-optimized.d.ts
@@ -7,7 +8,7 @@ interface ReactOptimizedBuiltinProps extends Omit<BuiltinFileProps, "id"> {
7
8
  /**
8
9
  * Generates the `react/optimized` builtin module for the Powerlines project.
9
10
  */
10
- declare function ReactOptimizedBuiltin(props: ReactOptimizedBuiltinProps): any;
11
+ declare function ReactOptimizedBuiltin(props: ReactOptimizedBuiltinProps): _$react.JSX.Element;
11
12
  declare type __ΩReactOptimizedBuiltinProps = any[];
12
13
  //#endregion
13
14
  export { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps, __ΩReactOptimizedBuiltinProps };
@@ -1 +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;;;;iBAQc,qBAAA,CAAsB,KAAA,EAAO,0BAAA;AAAA"}
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,OAAA,CAAA,GAAA,CAAA,OAAA;AAAA"}
@@ -1,4 +1,5 @@
1
1
  import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
2
+ import * as _$react from "react";
2
3
 
3
4
  //#region src/components/react-optimized.d.ts
4
5
  interface ReactOptimizedBuiltinProps extends Omit<BuiltinFileProps, "id"> {
@@ -7,7 +8,7 @@ interface ReactOptimizedBuiltinProps extends Omit<BuiltinFileProps, "id"> {
7
8
  /**
8
9
  * Generates the `react/optimized` builtin module for the Powerlines project.
9
10
  */
10
- declare function ReactOptimizedBuiltin(props: ReactOptimizedBuiltinProps): any;
11
+ declare function ReactOptimizedBuiltin(props: ReactOptimizedBuiltinProps): _$react.JSX.Element;
11
12
  declare type __ΩReactOptimizedBuiltinProps = any[];
12
13
  //#endregion
13
14
  export { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps, __ΩReactOptimizedBuiltinProps };
@@ -1 +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;;;;iBAQc,qBAAA,CAAsB,KAAA,EAAO,0BAAA;AAAA"}
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,OAAA,CAAA,GAAA,CAAA,OAAA;AAAA"}
package/dist/index.cjs CHANGED
@@ -3,6 +3,7 @@ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_components_react_optimized = require('./components/react-optimized.cjs');
4
4
  require('./components/index.cjs');
5
5
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
+ let _powerlines_core_lib_typescript = require("@powerlines/core/lib/typescript");
6
7
  let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
7
8
  let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
8
9
  let _powerlines_plugin_babel = require("@powerlines/plugin-babel");
@@ -13,7 +14,6 @@ let _vitejs_plugin_react = require("@vitejs/plugin-react");
13
14
  _vitejs_plugin_react = require_runtime.__toESM(_vitejs_plugin_react);
14
15
  let defu = require("defu");
15
16
  defu = require_runtime.__toESM(defu);
16
- let powerlines_typescript = require("powerlines/typescript");
17
17
 
18
18
  //#region src/index.tsx
19
19
  /**
@@ -60,14 +60,14 @@ const plugin = (options = {}) => {
60
60
  if (this.tsconfig.options.jsxImportSource === "react") this.tsconfig.tsconfigJson.compilerOptions.jsx ??= "react-jsx";
61
61
  else this.tsconfig.tsconfigJson.compilerOptions.jsx ??= "preserve";
62
62
  if (this.environment.consumer === "client") {
63
- if (!(0, powerlines_typescript.isMatchFound)("dom", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM");
64
- if (!(0, powerlines_typescript.isMatchFound)("dom.iterable", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM.Iterable");
63
+ if (!(0, _powerlines_core_lib_typescript.isMatchFound)("dom", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM");
64
+ if (!(0, _powerlines_core_lib_typescript.isMatchFound)("dom.iterable", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM.Iterable");
65
65
  }
66
- if (!(0, powerlines_typescript.isMatchFound)("esnext", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("ESNext");
66
+ if (!(0, _powerlines_core_lib_typescript.isMatchFound)("esnext", this.tsconfig.tsconfigJson.compilerOptions.lib)) this.tsconfig.tsconfigJson.compilerOptions.lib.push("ESNext");
67
67
  if (this.tsconfig.options.resolveJsonModule !== true) this.tsconfig.tsconfigJson.compilerOptions.resolveJsonModule = true;
68
68
  if (this.config.vite) {
69
69
  this.tsconfig.tsconfigJson.compilerOptions.types ??= [];
70
- if (!(0, powerlines_typescript.isMatchFound)("vite/client", this.tsconfig.tsconfigJson.compilerOptions.types)) this.tsconfig.tsconfigJson.compilerOptions.types.push("vite/client");
70
+ if (!(0, _powerlines_core_lib_typescript.isMatchFound)("vite/client", this.tsconfig.tsconfigJson.compilerOptions.types)) this.tsconfig.tsconfigJson.compilerOptions.types.push("vite/client");
71
71
  const viteBuildConfig = this.config.vite;
72
72
  viteBuildConfig.build ??= {};
73
73
  viteBuildConfig.build.target = "chrome95";
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import { ReactOptimizedBuiltin } from "./components/react-optimized.mjs";
2
2
  import "./components/index.mjs";
3
3
  import { createComponent } from "@alloy-js/core/jsx-runtime";
4
+ import { isMatchFound } from "@powerlines/core/lib/typescript";
4
5
  import { ReflectionKind, ReflectionVisibility } from "@powerlines/deepkit/vendor/type";
5
6
  import { render } from "@powerlines/plugin-alloy/render";
6
7
  import babel from "@powerlines/plugin-babel";
7
8
  import env from "@powerlines/plugin-env";
8
9
  import viteReactPlugin from "@vitejs/plugin-react";
9
10
  import defu from "defu";
10
- import { isMatchFound } from "powerlines/typescript";
11
11
 
12
12
  //#region src/index.tsx
13
13
  /**
@@ -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 {\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 { isMatchFound } from \"powerlines/typescript\";\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,EAAA,KAAA;AAC5B,QAAS;EAAA,MAAO,QAAO,MAAA;EAAA,IAAA,QAAA,IAAA;EAAA;;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B,KAAK,OAAO,MAAG;MAClC,CAAC,CAAC;;AAEL,QAAI,KAAK,KAAK,OAAO,OAAO,CAAC,KAAI,IAAK,MAAE,IAAA,YAAA,yBAAA,CACtC,MAAK,IAAI,MAAM,IAAI,YAAY;KAC7B,MAAM;KACN,UAAU;KACV,UAAU;KACV,aAAa;KACb,YAAY,qBAAkB;KAC9B,MAAM,EACJ,MAAM,eAAe,SACtB;KACD,SAAS;KACV,CAAC;;GAGN,MAAM,UAAO;IACX,MAAI,SAAA;AACJ,WAAG,OAAA,MAAA,gBAAA,uBAAA,EACF,IAAA,WAAA;AACD,YAAA,OAAiB,OAAA,MAAA,aAAA,QAAA,QAAA;OAEhB,CAAC,CAAA;;GAEL;EAAC"}
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,EAAA,KAAA;AAC5B,QAAS;EAAA,MAAO,QAAO,MAAA;EAAA,IAAA,QAAA,IAAA;EAAA;;GAEvB,SAAQ;AACN,WAAU,KAAM,EACd,OAAQ,SACV,EAAA,EACF,OAAA,gFAEE,EACG,EAAA,EACH,OAAA;KACK,YAAe;KACZ,iBAAS;KAClB,UAAA;MACU,QAAA;MACN,iBAAA;MACI,QAAA;OACC,QAAQ,GAAM,KAAA,OAAA,UAAA;OAChB,qBAA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,qBAAkB;KAC9B,MAAM,EACJ,MAAM,eAAe,SACtB;KACD,SAAS;KACV,CAAC;;GAGN,MAAM,UAAO;IACX,MAAI,SAAA;AACJ,WAAG,OAAA,MAAA,gBAAA,uBAAA,EACF,IAAA,WAAA;AACD,YAAA,OAAiB,OAAA,MAAA,aAAA,QAAA,QAAA;OAEhB,CAAC,CAAA;;GAEL;EAAC"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-react",
3
- "version": "0.1.526",
3
+ "version": "0.1.530",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin for building a React application.",
6
6
  "repository": {
7
7
  "type": "github",
8
8
  "url": "https://github.com/storm-software/powerlines.git",
9
- "directory": "packages/plugin-react"
9
+ "directory": "packages/plugins/plugin-react"
10
10
  },
11
11
  "homepage": "https://stormsoftware.com",
12
12
  "bugs": {
@@ -42,91 +42,28 @@
42
42
  "main": "./dist/index.cjs",
43
43
  "module": "./dist/index.mjs",
44
44
  "exports": {
45
- ".": {
46
- "require": {
47
- "types": "./dist/index.d.cts",
48
- "default": "./dist/index.cjs"
49
- },
50
- "import": {
51
- "types": "./dist/index.d.mts",
52
- "default": "./dist/index.mjs"
53
- },
54
- "default": {
55
- "types": "./dist/index.d.mts",
56
- "default": "./dist/index.mjs"
57
- }
58
- },
45
+ ".": { "import": "./dist/index.mjs", "require": "./dist/index.cjs" },
59
46
  "./components": {
60
- "require": {
61
- "types": "./dist/components/index.d.cts",
62
- "default": "./dist/components/index.cjs"
63
- },
64
- "import": {
65
- "types": "./dist/components/index.d.mts",
66
- "default": "./dist/components/index.mjs"
67
- },
68
- "default": {
69
- "types": "./dist/components/index.d.mts",
70
- "default": "./dist/components/index.mjs"
71
- }
47
+ "import": "./dist/components/index.mjs",
48
+ "require": "./dist/components/index.cjs"
72
49
  },
73
50
  "./components/react-optimized": {
74
- "require": {
75
- "types": "./dist/components/react-optimized.d.cts",
76
- "default": "./dist/components/react-optimized.cjs"
77
- },
78
- "import": {
79
- "types": "./dist/components/react-optimized.d.mts",
80
- "default": "./dist/components/react-optimized.mjs"
81
- },
82
- "default": {
83
- "types": "./dist/components/react-optimized.d.mts",
84
- "default": "./dist/components/react-optimized.mjs"
85
- }
51
+ "import": "./dist/components/react-optimized.mjs",
52
+ "require": "./dist/components/react-optimized.cjs"
86
53
  },
87
- "./package.json": "./package.json",
88
54
  "./types": {
89
- "require": {
90
- "types": "./dist/types/index.d.cts",
91
- "default": "./dist/types/index.cjs"
92
- },
93
- "import": {
94
- "types": "./dist/types/index.d.mts",
95
- "default": "./dist/types/index.mjs"
96
- },
97
- "default": {
98
- "types": "./dist/types/index.d.mts",
99
- "default": "./dist/types/index.mjs"
100
- }
55
+ "import": "./dist/types/index.mjs",
56
+ "require": "./dist/types/index.cjs"
101
57
  },
102
58
  "./types/env": {
103
- "require": {
104
- "types": "./dist/types/env.d.cts",
105
- "default": "./dist/types/env.cjs"
106
- },
107
- "import": {
108
- "types": "./dist/types/env.d.mts",
109
- "default": "./dist/types/env.mjs"
110
- },
111
- "default": {
112
- "types": "./dist/types/env.d.mts",
113
- "default": "./dist/types/env.mjs"
114
- }
59
+ "import": "./dist/types/env.mjs",
60
+ "require": "./dist/types/env.cjs"
115
61
  },
116
62
  "./types/plugin": {
117
- "require": {
118
- "types": "./dist/types/plugin.d.cts",
119
- "default": "./dist/types/plugin.cjs"
120
- },
121
- "import": {
122
- "types": "./dist/types/plugin.d.mts",
123
- "default": "./dist/types/plugin.mjs"
124
- },
125
- "default": {
126
- "types": "./dist/types/plugin.d.mts",
127
- "default": "./dist/types/plugin.mjs"
128
- }
129
- }
63
+ "import": "./dist/types/plugin.mjs",
64
+ "require": "./dist/types/plugin.cjs"
65
+ },
66
+ "./package.json": "./package.json"
130
67
  },
131
68
  "files": ["dist/**/*"],
132
69
  "keywords": ["react", "powerlines", "storm-software", "powerlines-plugin"],
@@ -140,28 +77,28 @@
140
77
  "@alloy-js/json": "0.23.0-dev.2",
141
78
  "@alloy-js/markdown": "0.23.0-dev.1",
142
79
  "@alloy-js/typescript": "0.23.0-dev.4",
143
- "@babel/core": "8.0.0-rc.4",
144
- "@powerlines/plugin-vite": "^0.14.458",
145
- "@powerlines/plugin-alloy": "^0.26.83",
146
- "@powerlines/plugin-babel": "^0.13.0",
147
- "@powerlines/plugin-env": "^0.16.191",
148
- "@storm-software/config-tools": "^1.190.1",
149
- "@stryke/cli": "^0.13.42",
150
- "@stryke/convert": "^0.7.3",
151
- "@stryke/fs": "^0.33.70",
152
- "@stryke/path": "^0.28.2",
80
+ "@babel/core": "8.0.0-rc.5",
81
+ "@powerlines/plugin-vite": "^0.14.462",
82
+ "@powerlines/plugin-alloy": "^0.26.87",
83
+ "@powerlines/plugin-babel": "^0.13.4",
84
+ "@powerlines/plugin-env": "^0.16.195",
85
+ "@storm-software/config-tools": "^1.190.2",
86
+ "@stryke/cli": "^0.13.47",
87
+ "@stryke/convert": "^0.7.6",
88
+ "@stryke/fs": "^0.33.75",
89
+ "@stryke/path": "^0.29.2",
153
90
  "@vitejs/plugin-react": "^5.2.0",
154
91
  "babel-plugin-react-compiler": "^1.0.0",
155
92
  "defu": "^6.1.7",
156
- "powerlines": "^0.47.3"
93
+ "powerlines": "^0.47.7"
157
94
  },
158
95
  "devDependencies": {
159
- "@powerlines/plugin-plugin": "^0.12.415",
160
- "@types/node": "^25.6.0",
96
+ "@powerlines/plugin-plugin": "^0.12.419",
97
+ "@types/node": "^25.7.0",
161
98
  "@types/react": "^19.2.14",
162
99
  "@types/react-dom": "^19.2.3"
163
100
  },
164
101
  "publishConfig": { "access": "public" },
165
102
  "types": "./dist/index.d.cts",
166
- "gitHead": "9c4b3c8956edda9e5f0f3354226077b0c25b09a2"
103
+ "gitHead": "3c5c701e16af74006dd70b965009d41eb22ace2a"
167
104
  }