File tree Expand file tree Collapse file tree
elements-react/complex-rubric/src/author Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ function packageSpecifier(
3636 entryPoint : 'delivery' | 'controller' | 'author' | 'print'
3737) : string {
3838 if ( entryPoint === 'delivery' ) {
39- return `@pie-element/${ elementName } ` ;
39+ return `@pie-element/${ elementName } /delivery ` ;
4040 }
4141 return `@pie-element/${ elementName } /${ entryPoint } ` ;
4242}
Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ const CRITICAL_CONSOLE_PATTERNS = [
3535 / w i n d o w \. p i e n o t f o u n d / i,
3636 / M o d u l e n o t f o u n d : / i,
3737 / C a n ' t r e s o l v e / i,
38+ / F a i l e d t o r e s o l v e m o d u l e s p e c i f i e r / i,
39+ / \[ e l e m e n t - p l a y e r \/ d e m o \] F a i l e d r e g i s t r y i m p o r t / i,
40+ / \[ e l e m e n t - l o a d e r \] F a i l e d t o l o a d e l e m e n t / i,
3841 / C a n n o t u p d a t e a n u n m o u n t e d r o o t / i,
3942] ;
4043
Original file line number Diff line number Diff line change @@ -118,6 +118,22 @@ export default defineConfig({
118118 // Force Vite to use the main field (lib/index.js) instead
119119 '@pie-framework/math-validation' : '@pie-framework/math-validation/lib/index.js' ,
120120 } ,
121+ // Keep a single ProseMirror instance across workspace packages.
122+ // Without this, mixed tiptap/prosemirror imports can register duplicate
123+ // selection IDs (e.g. gapcursor) and crash module evaluation.
124+ dedupe : [
125+ '@tiptap/pm' ,
126+ 'prosemirror-state' ,
127+ 'prosemirror-model' ,
128+ 'prosemirror-view' ,
129+ 'prosemirror-transform' ,
130+ 'prosemirror-history' ,
131+ 'prosemirror-commands' ,
132+ 'prosemirror-keymap' ,
133+ 'prosemirror-inputrules' ,
134+ 'prosemirror-gapcursor' ,
135+ 'prosemirror-schema-list' ,
136+ ] ,
121137 } ,
122138
123139 server : {
Original file line number Diff line number Diff line change @@ -44,7 +44,11 @@ async function resolveModule(
4444 const modulePath = request . cdnUrl
4545 ? `${ request . cdnUrl } /${ request . packagePath } `
4646 : request . packagePath ;
47- return import ( /* @vite -ignore */ modulePath ) ;
47+ if ( request . cdnUrl ) {
48+ return import ( /* @vite -ignore */ modulePath ) ;
49+ }
50+ // Let Vite resolve local workspace specifiers in ESM mode.
51+ return import ( modulePath ) ;
4852}
4953
5054/**
Original file line number Diff line number Diff line change 1111import { ModelUpdatedEvent } from '@pie-element/shared-configure-events' ;
1212import React from 'react' ;
1313import { createRoot } from 'react-dom/client' ;
14- import RubricConfigure from '@pie-element/rubric' ;
15- import MultiTraitRubricConfigure from '@pie-element/multi-trait-rubric' ;
14+ import RubricConfigure from '@pie-element/rubric/author ' ;
15+ import MultiTraitRubricConfigure from '@pie-element/multi-trait-rubric/author ' ;
1616import debug from 'debug' ;
1717import { defaults } from 'lodash-es' ;
1818import Main from './main.js' ;
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ export class Main extends React.Component {
8888 switch ( rubricType ) {
8989 case RUBRIC_TYPES . SIMPLE_RUBRIC :
9090 default :
91- rubricTag: any = (
91+ rubricTag = (
9292 < rubric-configure
9393 id = "simpleRubric"
9494 key = "simple-rubric"
@@ -104,7 +104,7 @@ export class Main extends React.Component {
104104 break ;
105105
106106 case RUBRIC_TYPES . MULTI_TRAIT_RUBRIC :
107- rubricTag: any = (
107+ rubricTag = (
108108 < multi-trait-rubric-configure
109109 id = "multiTraitRubric"
110110 key = "multi-trait-rubric"
@@ -121,7 +121,7 @@ export class Main extends React.Component {
121121 break ;
122122
123123 case RUBRIC_TYPES . RUBRICLESS :
124- rubricTag: any = (
124+ rubricTag = (
125125 < rubric-configure
126126 id = "rubricless"
127127 key = "rubricless"
Original file line number Diff line number Diff line change @@ -821,12 +821,11 @@ export function fixStyledComponentTypes(content: string): string {
821821 const constStyledRegex = / c o n s t ( \w + ) = s t y l e d \( / g;
822822 transformed = transformed . replace ( constStyledRegex , 'const $1: any = styled(' ) ;
823823
824- // Pattern 3: Class methods/arrow functions that might return styled components
825- // Add `: any` return type to methods that are missing type annotations
826- // Match: methodName = () => { or methodName = (params) => {
827- // But only at start of line (class methods), not property assignments like reader.onload =
828- // And only if they don't already have a type annotation
829- const methodRegex = / ^ ( \s * ) ( \w + ) \s * = \s * \( [ ^ ) ] * \) \s * = > \s * \{ / gm;
824+ // Pattern 3: Class field arrow functions that might return styled components
825+ // Add `: any` return type to class fields missing type annotations.
826+ // IMPORTANT: keep this line-scoped so we do not accidentally match multiline JSX
827+ // assignments such as `foo = (<Component ref={(r) => { ... }} />)`.
828+ const methodRegex = / ^ ( \s * ) ( \w + ) \s * = \s * \( [ ^ ) \n ] * \) \s * = > \s * \{ / gm;
830829 transformed = transformed . replace ( methodRegex , ( match ) => {
831830 // Check if already has type annotation (: type = )
832831 const hasTypeAnnotation = match . includes ( ':' ) ;
Original file line number Diff line number Diff line change 11import { describe , expect , it } from 'vitest' ;
22import {
3+ fixStyledComponentTypes ,
34 transformConfigureUtilsImports ,
45 transformLegacyConfigureLibImports ,
56 transformSelfReferentialImports ,
@@ -65,3 +66,35 @@ import { FractionModelChart } from '@pie-element/fraction-model';
6566 expect ( output ) . toContain ( "from '../delivery/index.js'" ) ;
6667 } ) ;
6768} ) ;
69+
70+ describe ( 'fixStyledComponentTypes' , ( ) => {
71+ it ( 'does not rewrite multiline JSX assignments that contain inline arrow functions' , ( ) => {
72+ const input = `
73+ class Main {
74+ onModelChanged = (model) => {
75+ return model;
76+ };
77+
78+ render() {
79+ let rubricTag = '';
80+ rubricTag = (
81+ <rubric-configure
82+ ref={(ref) => {
83+ if (ref) {
84+ this.simpleRubric = ref;
85+ }
86+ }}
87+ />
88+ );
89+ return rubricTag;
90+ }
91+ }
92+ ` ;
93+
94+ const output = fixStyledComponentTypes ( input ) ;
95+
96+ expect ( output ) . toContain ( 'onModelChanged: any = (model) => {' ) ;
97+ expect ( output ) . toContain ( 'rubricTag = (' ) ;
98+ expect ( output ) . not . toContain ( 'rubricTag: any = (' ) ;
99+ } ) ;
100+ } ) ;
You can’t perform that action at this time.
0 commit comments