@esportsplus/reactivity 0.23.5 → 0.24.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.
@@ -1,5 +1,5 @@
1
1
  import { mightNeedTransform as checkTransform } from '@esportsplus/typescript/transformer';
2
- import ts from 'typescript';
2
+ import { ts } from '@esportsplus/typescript';
3
3
  const REACTIVE_REGEX = /\breactive\b/;
4
4
  function visit(ctx, node) {
5
5
  if (ctx.hasImport && ctx.hasUsage) {
@@ -1,6 +1,6 @@
1
1
  import type { TransformResult } from '../types.js';
2
2
  import { mightNeedTransform } from './detector.js';
3
- import ts from 'typescript';
3
+ import { ts } from '@esportsplus/typescript';
4
4
  declare const createTransformer: () => ts.TransformerFactory<ts.SourceFile>;
5
5
  declare const transform: (sourceFile: ts.SourceFile) => TransformResult;
6
6
  export { createTransformer, mightNeedTransform, transform };
@@ -2,7 +2,7 @@ import { mightNeedTransform } from './detector.js';
2
2
  import { transformReactiveArrays } from './transforms/array.js';
3
3
  import { transformReactiveObjects } from './transforms/object.js';
4
4
  import { transformReactivePrimitives } from './transforms/primitives.js';
5
- import ts from 'typescript';
5
+ import { ts } from '@esportsplus/typescript';
6
6
  const createTransformer = () => {
7
7
  return () => {
8
8
  return (sourceFile) => {
@@ -1,3 +1,3 @@
1
- import ts from 'typescript';
1
+ import { ts } from '@esportsplus/typescript';
2
2
  declare const _default: (_program: ts.Program) => ts.TransformerFactory<ts.SourceFile>;
3
3
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { TRANSFORM_PATTERN } from '@esportsplus/typescript/transformer';
2
2
  import { mightNeedTransform, transform } from '../../transformer/index.js';
3
- import ts from 'typescript';
3
+ import { ts } from '@esportsplus/typescript';
4
4
  export default () => {
5
5
  return {
6
6
  enforce: 'pre',
@@ -1,4 +1,4 @@
1
1
  import type { Bindings } from '../../types.js';
2
- import ts from 'typescript';
2
+ import { ts } from '@esportsplus/typescript';
3
3
  declare const transformReactiveArrays: (sourceFile: ts.SourceFile, bindings: Bindings) => string;
4
4
  export { transformReactiveArrays };
@@ -1,5 +1,5 @@
1
1
  import { applyReplacements } from './utilities.js';
2
- import ts from 'typescript';
2
+ import { ts } from '@esportsplus/typescript';
3
3
  function getExpressionName(node) {
4
4
  if (ts.isIdentifier(node)) {
5
5
  return node.text;
@@ -1,4 +1,4 @@
1
1
  import type { Bindings } from '../../types.js';
2
- import ts from 'typescript';
2
+ import { ts } from '@esportsplus/typescript';
3
3
  declare const transformReactiveObjects: (sourceFile: ts.SourceFile, bindings: Bindings) => string;
4
4
  export { transformReactiveObjects };
@@ -1,6 +1,6 @@
1
1
  import { uid } from '@esportsplus/typescript/transformer';
2
2
  import { addMissingImports, applyReplacements } from './utilities.js';
3
- import ts from 'typescript';
3
+ import { ts } from '@esportsplus/typescript';
4
4
  const CLASS_NAME_REGEX = /class (\w+)/;
5
5
  const EXTRA_IMPORTS = [
6
6
  { module: '@esportsplus/reactivity/constants', specifier: 'REACTIVE_OBJECT' },
@@ -1,4 +1,4 @@
1
1
  import type { Bindings } from '../../types.js';
2
- import ts from 'typescript';
2
+ import { ts } from '@esportsplus/typescript';
3
3
  declare const transformReactivePrimitives: (sourceFile: ts.SourceFile, bindings: Bindings) => string;
4
4
  export { transformReactivePrimitives };
@@ -1,6 +1,6 @@
1
1
  import { uid } from '@esportsplus/typescript/transformer';
2
2
  import { addMissingImports, applyReplacements } from './utilities.js';
3
- import ts from 'typescript';
3
+ import { ts } from '@esportsplus/typescript';
4
4
  function classifyReactiveArg(arg) {
5
5
  if (ts.isArrowFunction(arg) || ts.isFunctionExpression(arg)) {
6
6
  return 'computed';
package/build/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { COMPUTED, SIGNAL, STATE_CHECK, STATE_DIRTY, STATE_IN_HEAP, STATE_NONE, STATE_RECOMPUTING } from './constants.js';
2
2
  import { ReactiveArray, ReactiveObject } from './reactive/index.js';
3
- import ts from 'typescript';
3
+ import { ts } from '@esportsplus/typescript';
4
4
  type BindingType = 'array' | 'computed' | 'object' | 'signal';
5
5
  type Bindings = Map<string, BindingType>;
6
6
  interface Computed<T> {
package/package.json CHANGED
@@ -4,10 +4,8 @@
4
4
  "@esportsplus/utilities": "^0.27.2"
5
5
  },
6
6
  "devDependencies": {
7
- "@esportsplus/typescript": "^0.13.0",
7
+ "@esportsplus/typescript": "^0.15.0",
8
8
  "@types/node": "^25.0.3",
9
- "esbuild": "^0.27.2",
10
- "typescript": "^5.9.3",
11
9
  "vite": "^7.3.0"
12
10
  },
13
11
  "exports": {
@@ -19,10 +17,6 @@
19
17
  "import": "./build/constants.js",
20
18
  "types": "./build/constants.d.ts"
21
19
  },
22
- "./plugins/esbuild": {
23
- "import": "./build/transformer/plugins/esbuild.js",
24
- "types": "./build/transformer/plugins/esbuild.d.ts"
25
- },
26
20
  "./plugins/tsc": {
27
21
  "import": "./build/transformer/plugins/tsc.js",
28
22
  "require": "./build/transformer/plugins/tsc.js",
@@ -42,9 +36,9 @@
42
36
  },
43
37
  "type": "module",
44
38
  "types": "build/index.d.ts",
45
- "version": "0.23.5",
39
+ "version": "0.24.0",
46
40
  "scripts": {
47
- "build": "tsc && tsc-alias",
41
+ "build": "tsc",
48
42
  "build:test": "pnpm build && vite build --config test/vite.config.ts",
49
43
  "-": "-"
50
44
  }
@@ -1,5 +1,5 @@
1
1
  import { mightNeedTransform as checkTransform } from '@esportsplus/typescript/transformer';
2
- import ts from 'typescript';
2
+ import { ts } from '@esportsplus/typescript';
3
3
 
4
4
 
5
5
  interface DetectContext {
@@ -3,7 +3,7 @@ import { mightNeedTransform } from './detector';
3
3
  import { transformReactiveArrays } from './transforms/array';
4
4
  import { transformReactiveObjects } from './transforms/object';
5
5
  import { transformReactivePrimitives } from './transforms/primitives';
6
- import ts from 'typescript';
6
+ import { ts } from '@esportsplus/typescript';
7
7
 
8
8
 
9
9
  const createTransformer = (): ts.TransformerFactory<ts.SourceFile> => {
@@ -1,5 +1,5 @@
1
1
  import { createTransformer } from '~/transformer';
2
- import ts from 'typescript';
2
+ import { ts } from '@esportsplus/typescript';
3
3
 
4
4
 
5
5
  // TypeScript custom transformers API requires program parameter, but we don't use it
@@ -1,7 +1,7 @@
1
1
  import { TRANSFORM_PATTERN } from '@esportsplus/typescript/transformer';
2
2
  import { mightNeedTransform, transform } from '~/transformer';
3
3
  import type { Plugin } from 'vite';
4
- import ts from 'typescript';
4
+ import { ts } from '@esportsplus/typescript';
5
5
 
6
6
 
7
7
  export default (): Plugin => {
@@ -1,6 +1,6 @@
1
1
  import type { Bindings } from '~/types';
2
2
  import { applyReplacements, Replacement } from './utilities';
3
- import ts from 'typescript';
3
+ import { ts } from '@esportsplus/typescript';
4
4
 
5
5
 
6
6
  interface TransformContext {
@@ -1,7 +1,7 @@
1
1
  import { uid } from '@esportsplus/typescript/transformer';
2
2
  import type { Bindings } from '~/types';
3
3
  import { addMissingImports, applyReplacements, ExtraImport, Replacement } from './utilities';
4
- import ts from 'typescript';
4
+ import { ts } from '@esportsplus/typescript';
5
5
 
6
6
 
7
7
  const CLASS_NAME_REGEX = /class (\w+)/;
@@ -1,7 +1,7 @@
1
1
  import { uid, type Range } from '@esportsplus/typescript/transformer';
2
2
  import type { BindingType, Bindings } from '~/types';
3
3
  import { addMissingImports, applyReplacements, Replacement } from './utilities';
4
- import ts from 'typescript';
4
+ import { ts } from '@esportsplus/typescript';
5
5
 
6
6
 
7
7
  interface ArgContext {
package/src/types.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { COMPUTED, SIGNAL, STATE_CHECK, STATE_DIRTY, STATE_IN_HEAP, STATE_NONE, STATE_RECOMPUTING } from './constants';
2
2
  import { ReactiveArray, ReactiveObject } from './reactive';
3
- import ts from 'typescript';
3
+ import { ts } from '@esportsplus/typescript';
4
4
 
5
5
 
6
6
  type BindingType = 'array' | 'computed' | 'object' | 'signal';
@@ -1,3 +0,0 @@
1
- import type { Plugin } from 'esbuild';
2
- declare const _default: () => Plugin;
3
- export default _default;
@@ -1,31 +0,0 @@
1
- import { TRANSFORM_PATTERN } from '@esportsplus/typescript/transformer';
2
- import { mightNeedTransform, transform } from '../../transformer/index.js';
3
- import fs from 'fs';
4
- import ts from 'typescript';
5
- export default () => {
6
- return {
7
- name: '@esportsplus/reactivity/plugin-esbuild',
8
- setup(build) {
9
- build.onLoad({ filter: TRANSFORM_PATTERN }, async (args) => {
10
- let code = await fs.promises.readFile(args.path, 'utf8');
11
- if (!mightNeedTransform(code)) {
12
- return null;
13
- }
14
- try {
15
- let sourceFile = ts.createSourceFile(args.path, code, ts.ScriptTarget.Latest, true), result = transform(sourceFile);
16
- if (!result.transformed) {
17
- return null;
18
- }
19
- return {
20
- contents: result.code,
21
- loader: args.path.endsWith('x') ? 'tsx' : 'ts'
22
- };
23
- }
24
- catch (error) {
25
- console.error(`@esportsplus/reactivity: Error transforming ${args.path}:`, error);
26
- return null;
27
- }
28
- });
29
- }
30
- };
31
- };
@@ -1,45 +0,0 @@
1
- import { TRANSFORM_PATTERN } from '@esportsplus/typescript/transformer';
2
- import { mightNeedTransform, transform } from '~/transformer';
3
- import type { OnLoadArgs, Plugin, PluginBuild } from 'esbuild';
4
- import fs from 'fs';
5
- import ts from 'typescript';
6
-
7
-
8
- export default (): Plugin => {
9
- return {
10
- name: '@esportsplus/reactivity/plugin-esbuild',
11
-
12
- setup(build: PluginBuild) {
13
- build.onLoad({ filter: TRANSFORM_PATTERN }, async (args: OnLoadArgs) => {
14
- let code = await fs.promises.readFile(args.path, 'utf8');
15
-
16
- if (!mightNeedTransform(code)) {
17
- return null;
18
- }
19
-
20
- try {
21
- let sourceFile = ts.createSourceFile(
22
- args.path,
23
- code,
24
- ts.ScriptTarget.Latest,
25
- true
26
- ),
27
- result = transform(sourceFile);
28
-
29
- if (!result.transformed) {
30
- return null;
31
- }
32
-
33
- return {
34
- contents: result.code,
35
- loader: args.path.endsWith('x') ? 'tsx' : 'ts'
36
- };
37
- }
38
- catch (error) {
39
- console.error(`@esportsplus/reactivity: Error transforming ${args.path}:`, error);
40
- return null;
41
- }
42
- });
43
- }
44
- };
45
- };