@powerlines/plugin-react 0.1.0
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/LICENSE +201 -0
- package/README.md +294 -0
- package/dist/chunk-FBBMZ4NC.cjs +7 -0
- package/dist/chunk-UCUR73HG.js +7 -0
- package/dist/components/index.cjs +1 -0
- package/dist/components/index.d.cts +8 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.js +1 -0
- package/dist/components/react-optimized.cjs +8 -0
- package/dist/components/react-optimized.d.cts +96 -0
- package/dist/components/react-optimized.d.ts +96 -0
- package/dist/components/react-optimized.js +8 -0
- package/dist/index.cjs +8 -0
- package/dist/index.d.cts +64 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.js +8 -0
- package/dist/runtime-DQYHDea3.d.ts +1752 -0
- package/dist/runtime-Ft55bXzz.d.cts +1752 -0
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.d.cts +31 -0
- package/dist/types/index.d.ts +31 -0
- package/dist/types/index.js +1 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +1789 -0
- package/dist/types/plugin.d.ts +1789 -0
- package/dist/types/plugin.js +0 -0
- package/dist/types/runtime.cjs +1 -0
- package/dist/types/runtime.d.cts +36 -0
- package/dist/types/runtime.d.ts +36 -0
- package/dist/types/runtime.js +0 -0
- package/dist/vfs-Bl84Hw2V.d.cts +393 -0
- package/dist/vfs-Bl84Hw2V.d.ts +393 -0
- package/package.json +148 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as _alloy_js_core from '@alloy-js/core';
|
|
2
|
+
import { Children as Children$1, SourceFileProps as SourceFileProps$1 } from '@alloy-js/core';
|
|
3
|
+
import { Children } from '@alloy-js/core/jsx-runtime';
|
|
4
|
+
import { O as OutputModeType } from '../vfs-Bl84Hw2V.js';
|
|
5
|
+
import '@stryke/json/types';
|
|
6
|
+
import 'memfs';
|
|
7
|
+
import 'node:fs';
|
|
8
|
+
import 'unionfs';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A type that represents the props of a component that can have children.
|
|
12
|
+
*/
|
|
13
|
+
interface ComponentProps {
|
|
14
|
+
children?: Children;
|
|
15
|
+
}
|
|
16
|
+
interface TypescriptFileImportItem {
|
|
17
|
+
name: string;
|
|
18
|
+
default?: boolean;
|
|
19
|
+
alias?: string;
|
|
20
|
+
type?: boolean;
|
|
21
|
+
}
|
|
22
|
+
type TypescriptFileImports = Record<string, null | Array<TypescriptFileImportItem | string>>;
|
|
23
|
+
|
|
24
|
+
interface TSDocModuleProps extends ComponentProps {
|
|
25
|
+
/**
|
|
26
|
+
* the prefix for the builtin module name
|
|
27
|
+
*
|
|
28
|
+
* @defaultValue "storm"
|
|
29
|
+
*/
|
|
30
|
+
prefix?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The name of the module
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* This will be used in the `@module` tag as well as the import path for the module, e.g. `storm:<name>`.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { MyModule } from "storm:my-module";
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
name: Children$1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
type SourceFileProps = SourceFileProps$1 & ComponentProps & {
|
|
46
|
+
/**
|
|
47
|
+
* If true, indicates that the file is virtual and should not be written to disk.
|
|
48
|
+
*
|
|
49
|
+
* @defaultValue false
|
|
50
|
+
*/
|
|
51
|
+
mode?: OutputModeType;
|
|
52
|
+
/**
|
|
53
|
+
* The metadata associated with the source file.
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* The values stored in the metadata will be available in the rendering context.
|
|
57
|
+
*/
|
|
58
|
+
meta?: Record<string, any>;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
type TypescriptFileProps = Omit<SourceFileProps, "filetype"> & ComponentProps & {
|
|
62
|
+
header?: Children$1;
|
|
63
|
+
imports?: TypescriptFileImports;
|
|
64
|
+
export?: boolean | string;
|
|
65
|
+
tsx?: boolean;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
type BuiltinFileProps = Omit<TypescriptFileProps, "path"> & Omit<TSDocModuleProps, "name"> & {
|
|
69
|
+
/**
|
|
70
|
+
* The runtime module identifier.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* This value will be included after the \`storm:\` prefix in the import statement.
|
|
74
|
+
*/
|
|
75
|
+
id: string;
|
|
76
|
+
/**
|
|
77
|
+
* The description for the builtin module.
|
|
78
|
+
*/
|
|
79
|
+
description?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Whether the file is a TSX file.
|
|
82
|
+
*
|
|
83
|
+
* @defaultValue false
|
|
84
|
+
*/
|
|
85
|
+
tsx?: boolean;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
interface ReactOptimizedBuiltinProps extends Omit<BuiltinFileProps, "id"> {
|
|
89
|
+
override?: boolean;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Generates the `react/optimized` builtin module for the Powerlines project.
|
|
93
|
+
*/
|
|
94
|
+
declare function ReactOptimizedBuiltin(props: ReactOptimizedBuiltinProps): _alloy_js_core.Children;
|
|
95
|
+
|
|
96
|
+
export { ReactOptimizedBuiltin, type ReactOptimizedBuiltinProps };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import {a}from'../chunk-UCUR73HG.js';import {createComponent,mergeProps}from'@alloy-js/core/jsx-runtime';import {splitProps,code}from'@alloy-js/core';import {FunctionDeclaration}from'@alloy-js/typescript';import {usePowerlines}from'@powerlines/alloy/core/contexts/context';import {refkey}from'@powerlines/alloy/helpers/refkey';import {BuiltinFile}from'@powerlines/alloy/typescript/components/builtin-file';import {TSDoc,TSDocLink,TSDocReturns}from'@powerlines/alloy/typescript/components/tsdoc';import h from'defu';/*****************************************
|
|
2
|
+
*
|
|
3
|
+
* ⚡ Built by Storm Software
|
|
4
|
+
*
|
|
5
|
+
*****************************************/
|
|
6
|
+
|
|
7
|
+
const v=refkey("isOptimizationEnabled");function k(n){const[{override:t},i]=splitProps(n,["override"]),c=usePowerlines();return createComponent(BuiltinFile,mergeProps(i,{id:"react/optimized",description:"A built-in module to provide access to environment configuration to determine React optimizations.",get imports(){return h({[`${c?.config.output.builtinPrefix}:env`]:["env","isDevelopment"]},i.imports??{})},get children(){return [createComponent(TSDoc,{heading:"A gating function to determine if the optimized [React compiler](https://react.dev/reference/react-compiler) source code should be used.",get children(){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."})]}}),createComponent(FunctionDeclaration,{refkey:v,async:false,export:true,name:"isOptimizationEnabled",returnType:"boolean",children:t!==void 0?code`return ${t};`:code`return !env.DISABLE_REACT_COMPILER && !isDevelopment; `})]}}))}a(k,"ReactOptimizedBuiltin");
|
|
8
|
+
export{k as ReactOptimizedBuiltin};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkFBBMZ4NC_cjs=require('./chunk-FBBMZ4NC.cjs'),jsxRuntime=require('@alloy-js/core/jsx-runtime'),createPlugin=require('@powerlines/alloy/create-plugin'),type=require('@powerlines/deepkit/vendor/type'),m=require('@powerlines/plugin-babel'),f=require('@powerlines/plugin-env'),types$1=require('@storm-software/config-tools/types'),g=require('@vitejs/plugin-react'),d=require('defu'),tsconfig=require('powerlines/lib/typescript/tsconfig'),reactOptimized=require('./components/react-optimized'),components=require('./components'),types=require('./types');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var m__default=/*#__PURE__*/_interopDefault(m);var f__default=/*#__PURE__*/_interopDefault(f);var g__default=/*#__PURE__*/_interopDefault(g);var d__default=/*#__PURE__*/_interopDefault(d);/*****************************************
|
|
2
|
+
*
|
|
3
|
+
* ⚡ Built by Storm Software
|
|
4
|
+
*
|
|
5
|
+
*****************************************/
|
|
6
|
+
|
|
7
|
+
const h=createPlugin.createAlloyPlugin(s=>({name:"react",dependsOn:[m__default.default(s.babel),f__default.default(s.env)],config(){return d__default.default({react:s},{react:{jsxImportSource:this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource}},{react:{jsxRuntime:"automatic",jsxImportSource:"react",compiler:{target:"react19",compilationMode:"infer",gating:{source:`${this.config.output.builtinPrefix}:react/optimized`,importSpecifierName:"isOptimizationEnabled"},enableReanimatedCheck:true,logger:{logEvent:chunkFBBMZ4NC_cjs.a((o,i)=>{this.log(i.kind==="CompileSuccess"?types$1.LogLevelLabel.SUCCESS:i.kind==="AutoDepsEligible"||i.kind==="AutoDepsDecorations"?types$1.LogLevelLabel.INFO:i.kind==="CompileSkip"||i.kind==="CompileDiagnostic"?types$1.LogLevelLabel.DEBUG:i.kind==="Timing"?types$1.LogLevelLabel.TRACE:types$1.LogLevelLabel.ERROR,`(${o}) ${i.kind==="CompileSuccess"?"React Compiler Success":i.kind==="AutoDepsEligible"?`React AutoDeps Eligible - ${i.depArrayLoc.identifierName||"No identifier"}`:i.kind==="AutoDepsDecorations"?`React AutoDeps Decorations - ${i.decorations.filter(n=>n.identifierName).map(n=>n.identifierName).join(", ")}`:i.kind==="CompileSkip"?`React Compile Skip - ${i.reason}`:i.kind==="CompileDiagnostic"?`React Compile Diagnostic - (Category: ${i.detail.category}) ${i.detail.reason}${i.detail.description?`
|
|
8
|
+
${i.detail.description}`:""}`:i.kind==="Timing"?`React ${i.measurement.entryType} Timing (${i.measurement.name}) - ${i.measurement.duration}ms`:`React Compiler Error - ${i.fnLoc?.identifierName||"unknown location"}`}`);},"logEvent")}}}})},configResolved(){if(this.dependencies.react="^19.2.0",this.dependencies["react-dom"]="^19.2.0",this.devDependencies["@types/react"]="^19.2.2",this.devDependencies["@types/react-dom"]="^19.2.2",this.config.react.compiler!==false&&(this.config.transform.babel??={},this.config.transform.babel.plugins??=[],this.config.transform.babel.plugins.push(["babel-plugin-react-compiler",this.config.react.compiler])),this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.module??="esnext",this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=this.config.react.jsxImportSource,this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource==="react"?this.tsconfig.tsconfigJson.compilerOptions.jsx??="react-jsx":this.tsconfig.tsconfigJson.compilerOptions.jsx??="preserve",this.tsconfig.tsconfigJson.compilerOptions.lib=[],tsconfig.isMatchFound("dom",this.tsconfig.tsconfigJson.compilerOptions.lib)||this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM"),tsconfig.isMatchFound("dom.iterable",this.tsconfig.tsconfigJson.compilerOptions.lib)||this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM.Iterable"),tsconfig.isMatchFound("esnext",this.tsconfig.tsconfigJson.compilerOptions.lib)||this.tsconfig.tsconfigJson.compilerOptions.lib.push("ESNext"),this.tsconfig.options.resolveJsonModule!==true&&(this.tsconfig.tsconfigJson.compilerOptions.resolveJsonModule=true),this.config.build.variant==="vite"){this.tsconfig.tsconfigJson.compilerOptions.types??=[],tsconfig.isMatchFound("vite/client",this.tsconfig.tsconfigJson.compilerOptions.types)||this.tsconfig.tsconfigJson.compilerOptions.types.push("vite/client");const o=this.config.build;o.build??={},o.build.target="chrome95",o.plugins??=[],o.plugins.unshift(g__default.default({babel:this.config.transform.babel,jsxImportSource:this.config.react.jsxImportSource,jsxRuntime:this.config.react.jsxRuntime,reactRefreshHost:this.config.react.reactRefreshHost}));}this.env?.types?.env&&!this.env.types.env.hasProperty("DISABLE_REACT_COMPILER")&&this.env.types.env.addProperty({name:"DISABLE_REACT_COMPILER",optional:true,readonly:true,description:"Disables the React compiler optimizations.",visibility:type.ReflectionVisibility.public,type:{kind:type.ReflectionKind.boolean},default:false});},render(){const o=this;return jsxRuntime.createComponent(reactOptimized.ReactOptimizedBuiltin,{get override(){return o.config.react.compiler===false?false:void 0}})}}));var j=h;exports.default=j;exports.plugin=h;Object.keys(components).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return components[k]}})});Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { P as PluginContext, a as Plugin } from './runtime-Ft55bXzz.cjs';
|
|
2
|
+
import { Children } from '@alloy-js/core/jsx-runtime';
|
|
3
|
+
import { PrintTreeOptions } from '@alloy-js/core';
|
|
4
|
+
import { ReactPluginContext } from './types/plugin.cjs';
|
|
5
|
+
export { ReactCompilerOptions, ReactPluginOptions, ReactPluginResolvedConfig, ReactPluginUserConfig } from './types/plugin.cjs';
|
|
6
|
+
export { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps } from './components/react-optimized.cjs';
|
|
7
|
+
export { ReactEnvInterface } from './types/runtime.cjs';
|
|
8
|
+
import '@stryke/env/get-env-paths';
|
|
9
|
+
import '@stryke/types/package-json';
|
|
10
|
+
import 'jiti';
|
|
11
|
+
import 'oxc-parser';
|
|
12
|
+
import 'semver';
|
|
13
|
+
import 'unplugin';
|
|
14
|
+
import '@babel/core';
|
|
15
|
+
import '@storm-software/build-tools/types';
|
|
16
|
+
import '@storm-software/config-tools/types';
|
|
17
|
+
import '@storm-software/config/types';
|
|
18
|
+
import '@stryke/types/base';
|
|
19
|
+
import '@stryke/types/configuration';
|
|
20
|
+
import '@stryke/types/file';
|
|
21
|
+
import 'vite';
|
|
22
|
+
import '@babel/helper-plugin-utils';
|
|
23
|
+
import '@stryke/types/array';
|
|
24
|
+
import '@stryke/types/tsconfig';
|
|
25
|
+
import 'typescript';
|
|
26
|
+
import './vfs-Bl84Hw2V.cjs';
|
|
27
|
+
import '@stryke/json/types';
|
|
28
|
+
import 'memfs';
|
|
29
|
+
import 'node:fs';
|
|
30
|
+
import 'unionfs';
|
|
31
|
+
import '@deepkit/type';
|
|
32
|
+
import '@stryke/capnp';
|
|
33
|
+
import '@stryke/env/types';
|
|
34
|
+
import 'babel-plugin-react-compiler';
|
|
35
|
+
|
|
36
|
+
type PluginPluginAlloyOptions = Partial<PrintTreeOptions> & {
|
|
37
|
+
/**
|
|
38
|
+
* If true, the Alloy framework is used to generate JSON output files.
|
|
39
|
+
*
|
|
40
|
+
* @defaultValue false
|
|
41
|
+
*/
|
|
42
|
+
generatesJson?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* If true, the Alloy framework is used to generate Markdown output files.
|
|
45
|
+
*
|
|
46
|
+
* @defaultValue false
|
|
47
|
+
*/
|
|
48
|
+
generatesMarkdown?: boolean;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
interface AlloyPluginOptions {
|
|
52
|
+
alloy?: PluginPluginAlloyOptions;
|
|
53
|
+
}
|
|
54
|
+
type AlloyPluginBuilderResult<TContext extends PluginContext = PluginContext> = Plugin<TContext> & {
|
|
55
|
+
render: (this: TContext) => Children;
|
|
56
|
+
};
|
|
57
|
+
type AlloyPluginBuilder<TContext extends PluginContext = PluginContext, TOptions = any> = (options: TOptions) => AlloyPluginBuilderResult<TContext>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A package containing a Powerlines plugin for building a React application.
|
|
61
|
+
*/
|
|
62
|
+
declare const plugin: (options: Parameters<AlloyPluginBuilder<ReactPluginContext>>[0] & AlloyPluginOptions) => Plugin<ReactPluginContext>;
|
|
63
|
+
|
|
64
|
+
export { ReactPluginContext, plugin as default, plugin };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { P as PluginContext, a as Plugin } from './runtime-DQYHDea3.js';
|
|
2
|
+
import { Children } from '@alloy-js/core/jsx-runtime';
|
|
3
|
+
import { PrintTreeOptions } from '@alloy-js/core';
|
|
4
|
+
import { ReactPluginContext } from './types/plugin.js';
|
|
5
|
+
export { ReactCompilerOptions, ReactPluginOptions, ReactPluginResolvedConfig, ReactPluginUserConfig } from './types/plugin.js';
|
|
6
|
+
export { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps } from './components/react-optimized.js';
|
|
7
|
+
export { ReactEnvInterface } from './types/runtime.js';
|
|
8
|
+
import '@stryke/env/get-env-paths';
|
|
9
|
+
import '@stryke/types/package-json';
|
|
10
|
+
import 'jiti';
|
|
11
|
+
import 'oxc-parser';
|
|
12
|
+
import 'semver';
|
|
13
|
+
import 'unplugin';
|
|
14
|
+
import '@babel/core';
|
|
15
|
+
import '@storm-software/build-tools/types';
|
|
16
|
+
import '@storm-software/config-tools/types';
|
|
17
|
+
import '@storm-software/config/types';
|
|
18
|
+
import '@stryke/types/base';
|
|
19
|
+
import '@stryke/types/configuration';
|
|
20
|
+
import '@stryke/types/file';
|
|
21
|
+
import 'vite';
|
|
22
|
+
import '@babel/helper-plugin-utils';
|
|
23
|
+
import '@stryke/types/array';
|
|
24
|
+
import '@stryke/types/tsconfig';
|
|
25
|
+
import 'typescript';
|
|
26
|
+
import './vfs-Bl84Hw2V.js';
|
|
27
|
+
import '@stryke/json/types';
|
|
28
|
+
import 'memfs';
|
|
29
|
+
import 'node:fs';
|
|
30
|
+
import 'unionfs';
|
|
31
|
+
import '@deepkit/type';
|
|
32
|
+
import '@stryke/capnp';
|
|
33
|
+
import '@stryke/env/types';
|
|
34
|
+
import 'babel-plugin-react-compiler';
|
|
35
|
+
|
|
36
|
+
type PluginPluginAlloyOptions = Partial<PrintTreeOptions> & {
|
|
37
|
+
/**
|
|
38
|
+
* If true, the Alloy framework is used to generate JSON output files.
|
|
39
|
+
*
|
|
40
|
+
* @defaultValue false
|
|
41
|
+
*/
|
|
42
|
+
generatesJson?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* If true, the Alloy framework is used to generate Markdown output files.
|
|
45
|
+
*
|
|
46
|
+
* @defaultValue false
|
|
47
|
+
*/
|
|
48
|
+
generatesMarkdown?: boolean;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
interface AlloyPluginOptions {
|
|
52
|
+
alloy?: PluginPluginAlloyOptions;
|
|
53
|
+
}
|
|
54
|
+
type AlloyPluginBuilderResult<TContext extends PluginContext = PluginContext> = Plugin<TContext> & {
|
|
55
|
+
render: (this: TContext) => Children;
|
|
56
|
+
};
|
|
57
|
+
type AlloyPluginBuilder<TContext extends PluginContext = PluginContext, TOptions = any> = (options: TOptions) => AlloyPluginBuilderResult<TContext>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A package containing a Powerlines plugin for building a React application.
|
|
61
|
+
*/
|
|
62
|
+
declare const plugin: (options: Parameters<AlloyPluginBuilder<ReactPluginContext>>[0] & AlloyPluginOptions) => Plugin<ReactPluginContext>;
|
|
63
|
+
|
|
64
|
+
export { ReactPluginContext, plugin as default, plugin };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import {a}from'./chunk-UCUR73HG.js';import {createComponent}from'@alloy-js/core/jsx-runtime';import {createAlloyPlugin}from'@powerlines/alloy/create-plugin';import {ReflectionKind,ReflectionVisibility}from'@powerlines/deepkit/vendor/type';import m from'@powerlines/plugin-babel';import f from'@powerlines/plugin-env';import {LogLevelLabel}from'@storm-software/config-tools/types';import g from'@vitejs/plugin-react';import d from'defu';import {isMatchFound}from'powerlines/lib/typescript/tsconfig';import {ReactOptimizedBuiltin}from'./components/react-optimized';export*from'./components';export*from'./types';/*****************************************
|
|
2
|
+
*
|
|
3
|
+
* ⚡ Built by Storm Software
|
|
4
|
+
*
|
|
5
|
+
*****************************************/
|
|
6
|
+
|
|
7
|
+
const h=createAlloyPlugin(s=>({name:"react",dependsOn:[m(s.babel),f(s.env)],config(){return d({react:s},{react:{jsxImportSource:this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource}},{react:{jsxRuntime:"automatic",jsxImportSource:"react",compiler:{target:"react19",compilationMode:"infer",gating:{source:`${this.config.output.builtinPrefix}:react/optimized`,importSpecifierName:"isOptimizationEnabled"},enableReanimatedCheck:true,logger:{logEvent:a((o,i)=>{this.log(i.kind==="CompileSuccess"?LogLevelLabel.SUCCESS:i.kind==="AutoDepsEligible"||i.kind==="AutoDepsDecorations"?LogLevelLabel.INFO:i.kind==="CompileSkip"||i.kind==="CompileDiagnostic"?LogLevelLabel.DEBUG:i.kind==="Timing"?LogLevelLabel.TRACE:LogLevelLabel.ERROR,`(${o}) ${i.kind==="CompileSuccess"?"React Compiler Success":i.kind==="AutoDepsEligible"?`React AutoDeps Eligible - ${i.depArrayLoc.identifierName||"No identifier"}`:i.kind==="AutoDepsDecorations"?`React AutoDeps Decorations - ${i.decorations.filter(n=>n.identifierName).map(n=>n.identifierName).join(", ")}`:i.kind==="CompileSkip"?`React Compile Skip - ${i.reason}`:i.kind==="CompileDiagnostic"?`React Compile Diagnostic - (Category: ${i.detail.category}) ${i.detail.reason}${i.detail.description?`
|
|
8
|
+
${i.detail.description}`:""}`:i.kind==="Timing"?`React ${i.measurement.entryType} Timing (${i.measurement.name}) - ${i.measurement.duration}ms`:`React Compiler Error - ${i.fnLoc?.identifierName||"unknown location"}`}`);},"logEvent")}}}})},configResolved(){if(this.dependencies.react="^19.2.0",this.dependencies["react-dom"]="^19.2.0",this.devDependencies["@types/react"]="^19.2.2",this.devDependencies["@types/react-dom"]="^19.2.2",this.config.react.compiler!==false&&(this.config.transform.babel??={},this.config.transform.babel.plugins??=[],this.config.transform.babel.plugins.push(["babel-plugin-react-compiler",this.config.react.compiler])),this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.module??="esnext",this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=this.config.react.jsxImportSource,this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource==="react"?this.tsconfig.tsconfigJson.compilerOptions.jsx??="react-jsx":this.tsconfig.tsconfigJson.compilerOptions.jsx??="preserve",this.tsconfig.tsconfigJson.compilerOptions.lib=[],isMatchFound("dom",this.tsconfig.tsconfigJson.compilerOptions.lib)||this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM"),isMatchFound("dom.iterable",this.tsconfig.tsconfigJson.compilerOptions.lib)||this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM.Iterable"),isMatchFound("esnext",this.tsconfig.tsconfigJson.compilerOptions.lib)||this.tsconfig.tsconfigJson.compilerOptions.lib.push("ESNext"),this.tsconfig.options.resolveJsonModule!==true&&(this.tsconfig.tsconfigJson.compilerOptions.resolveJsonModule=true),this.config.build.variant==="vite"){this.tsconfig.tsconfigJson.compilerOptions.types??=[],isMatchFound("vite/client",this.tsconfig.tsconfigJson.compilerOptions.types)||this.tsconfig.tsconfigJson.compilerOptions.types.push("vite/client");const o=this.config.build;o.build??={},o.build.target="chrome95",o.plugins??=[],o.plugins.unshift(g({babel:this.config.transform.babel,jsxImportSource:this.config.react.jsxImportSource,jsxRuntime:this.config.react.jsxRuntime,reactRefreshHost:this.config.react.reactRefreshHost}));}this.env?.types?.env&&!this.env.types.env.hasProperty("DISABLE_REACT_COMPILER")&&this.env.types.env.addProperty({name:"DISABLE_REACT_COMPILER",optional:true,readonly:true,description:"Disables the React compiler optimizations.",visibility:ReflectionVisibility.public,type:{kind:ReflectionKind.boolean},default:false});},render(){const o=this;return createComponent(ReactOptimizedBuiltin,{get override(){return o.config.react.compiler===false?false:void 0}})}}));var I=h;export{I as default,h as plugin};
|