@powerlines/plugin-react 0.1.661 → 0.1.663

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 +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,4BAAA,QAAA"}
1
+ {"version":3,"file":"react-optimized.d.mts","names":[],"sources":["../../src/components/react-optimized.tsx"],"mappings":""}
@@ -1 +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":";;;;;;;;;AAyBA,MAAM,8BAAC,OAAA,uBAAA;;;;AAKP,SAAgB,sBAAO,OAAA;UAEvB,YACE,QAAA,WAAgB,OAAA,CAAA,UAAA,CAAA;CAChB,OAAG,gBAAA,aAAA,WAAA,MAAA;EACH,IAAA;EACA,aAAW;EACb,IAAA,iBAAA;iBAEM,KAAA,CAAA,OAAA,eAA8B;EAElC;EACC,IAAA,WAAe;GAChB,OAAA,CAAA,gBAAA,OAAA;IACK,SAAS;IACR,IAAG,WAAY;0CAEd,UAAA,oDACJ,CAAA,GAAA,gBAAA,cAAA,EACK,UAAI,6EACJ,CAAA,CAAA;IACJ;GACA,CAAA,GAAA,gBAAoB,qBAAA;IAClB,QAAQ;IACR,OAAK;IACL,UAAA;IACD,MAAM;IACL,YAAU;IACV,IAAI,WAAQ;KACV,OAAA,CAAA,gBAAS,MAAA;MACV,MAAA,aAAY;MACT,UAAU,IAAA;MACZ,UAAY,IAAA,UAAA,SAAA;KACd,CAAA,GAAK,gBAAA,OAAA,CAAA,CAAA,CAAA;IACN;GACD,CAAC,CAAC;EACJ;CACF,CAAC,CAAC;AACJ"}
1
+ {"version":3,"file":"react-optimized.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;YAoCY,MAAA;IACR,KAAA,GAAQ,kBAAkB;EAAA;AAAA;;;;cAOjB,MAAA,oBACM,kBAAA,GAAqB,kBAAA,EAEtC,OAAA,GAAS,kBAAA,KA0MJ,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":""}
@@ -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 { render } from \"@powerlines/plugin-alloy/render\";\nimport babel, { BabelPluginResolvedConfig } from \"@powerlines/plugin-babel\";\nimport env from \"@powerlines/plugin-env\";\nimport type { 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 type { 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":";;;;;;;;;;;;;;;;AAiCA,MAAa,UAAU,UAAA,CAAA,MAAA;;;;;GAEvB,MAAQ;GACN,SAAU;IACR,OAAQ,KAAA,EACV,OAAA,QACF,GAAA,WAEE,iBAAA,KAAA,SAAA,aAAA,iBAAA,gBACG,EACH,GAAA,EACK,OAAM;KACH,YAAS;KAClB,iBAAA;KACS,UAAC;MACN,QAAA;MACI,iBAAA;MACC,QAAQ;OACV,QAAY,GAAA,UAAA,KAAA,OAAA,WAAA,IAA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AM;KACN,UAAU;KACV,aAAa;KACb,MAAM;KACN,SAAS;IACX,CAAC;GAEL;GACA,MAAM,UAAU;IACd,MAAM,SAAS;IACf,OAAO,OAAK,MAAA,gBAAA,uBAAA,EACV,IAAI,WAAI;KACN,OAAI,OAAA,OAAA,MAAA,aAAA,QAAA,QAAA;IACN,EACF,CAAC,CAAC;GACJ;EACF;CAAC;AACH"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.mts","names":[],"sources":["../../src/types/env.ts"],"mappings":";;;UAoBiB,QAAA,SAAiB,YAAY;;AAA9C;;;;AAOwB;EAAtB,sBAAsB;AAAA"}
1
+ {"version":3,"file":"env.d.mts","names":[],"sources":["../../src/types/env.ts"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;KA2BY,oBAAA,GAAuB,IAAI,CAAC,aAAA;AAAA,UAEvB,kBAAA;EAFL;;;;AAAwD;AAEpE;;EAQE,eAAA;EAqBW;;;;;;;;EAXX,UAAA;EAAA;;;;;;;;;EAWA,QAAA,GAAW,oBAAA;EAqBQ;;AAAgB;AAGrC;;;;;;EAbE,gBAAA;EAiB0B;AAAA;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,kBAAkB;AAAA;AAAA,KAGhB,yBAAA,GAA4B,uBAAA;EASb;;;EALzB,KAAA,EAAO,kBAAkB;AAAA;AAAA,UAGV,kBAAA,yBACS,yBAAA,GAA4B,yBAAA,UAC5C,gBAAA,CAAiB,eAAA"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-react",
3
- "version": "0.1.661",
3
+ "version": "0.1.663",
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"],
@@ -137,11 +137,11 @@
137
137
  "@alloy-js/markdown": "^0.23.0",
138
138
  "@alloy-js/typescript": "^0.23.0",
139
139
  "@babel/core": "8.0.0-rc.6",
140
- "@powerlines/core": "^0.48.45",
141
- "@powerlines/plugin-alloy": "0.26.215",
142
- "@powerlines/plugin-babel": "0.13.118",
143
- "@powerlines/plugin-env": "0.16.326",
144
- "@powerlines/plugin-vite": "0.14.576",
140
+ "@powerlines/core": "0.48.46",
141
+ "@powerlines/plugin-alloy": "0.26.217",
142
+ "@powerlines/plugin-babel": "0.13.120",
143
+ "@powerlines/plugin-env": "0.16.328",
144
+ "@powerlines/plugin-vite": "0.14.578",
145
145
  "@storm-software/config-tools": "^1.190.40",
146
146
  "@stryke/cli": "^0.13.57",
147
147
  "@stryke/convert": "^0.7.15",
@@ -151,10 +151,10 @@
151
151
  "@vitejs/plugin-react": "^5.2.0",
152
152
  "babel-plugin-react-compiler": "^1.0.0",
153
153
  "defu": "^6.1.7",
154
- "powerlines": "0.47.122"
154
+ "powerlines": "0.47.124"
155
155
  },
156
156
  "devDependencies": {
157
- "@powerlines/plugin-plugin": "0.12.534",
157
+ "@powerlines/plugin-plugin": "0.12.536",
158
158
  "@types/node": "^25.9.1",
159
159
  "@types/react": "^19.2.16",
160
160
  "@types/react-dom": "^19.2.3"
@@ -165,5 +165,5 @@
165
165
  "react-dom": { "optional": false }
166
166
  },
167
167
  "publishConfig": { "access": "public" },
168
- "gitHead": "c49560c5c534ab47aa13b2843f0fa401b6a4bb4d"
168
+ "gitHead": "1530c8cbb090f1f728d112475074eb3a86070557"
169
169
  }