@pie-element/cli 0.1.1
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/.compatibility/report.json +2491 -0
- package/.turbo/turbo-build.log +1 -0
- package/CHANGELOG.md +8 -0
- package/README.md +240 -0
- package/REFACTORING.md +131 -0
- package/bin/dev.js +5 -0
- package/bin/run.js +5 -0
- package/dist/commands/dev/demo/index.d.ts +33 -0
- package/dist/commands/dev/demo/index.d.ts.map +1 -0
- package/dist/commands/dev/demo/index.js +274 -0
- package/dist/commands/dev/demo/index.js.map +1 -0
- package/dist/commands/dev/test-bundler.d.ts +18 -0
- package/dist/commands/dev/test-bundler.d.ts.map +1 -0
- package/dist/commands/dev/test-bundler.js +284 -0
- package/dist/commands/dev/test-bundler.js.map +1 -0
- package/dist/commands/mathquill/migrate.d.ts +20 -0
- package/dist/commands/mathquill/migrate.d.ts.map +1 -0
- package/dist/commands/mathquill/migrate.js +240 -0
- package/dist/commands/mathquill/migrate.js.map +1 -0
- package/dist/commands/mathquill/status.d.ts +20 -0
- package/dist/commands/mathquill/status.d.ts.map +1 -0
- package/dist/commands/mathquill/status.js +231 -0
- package/dist/commands/mathquill/status.js.map +1 -0
- package/dist/commands/packages/create-controllers.d.ts +13 -0
- package/dist/commands/packages/create-controllers.d.ts.map +1 -0
- package/dist/commands/packages/create-controllers.js +103 -0
- package/dist/commands/packages/create-controllers.js.map +1 -0
- package/dist/commands/packages/create-lib-react.d.ts +17 -0
- package/dist/commands/packages/create-lib-react.d.ts.map +1 -0
- package/dist/commands/packages/create-lib-react.js +228 -0
- package/dist/commands/packages/create-lib-react.js.map +1 -0
- package/dist/commands/packages/create-react-elements.d.ts +16 -0
- package/dist/commands/packages/create-react-elements.d.ts.map +1 -0
- package/dist/commands/packages/create-react-elements.js +259 -0
- package/dist/commands/packages/create-react-elements.js.map +1 -0
- package/dist/commands/packages/enable-publishing.d.ts +11 -0
- package/dist/commands/packages/enable-publishing.d.ts.map +1 -0
- package/dist/commands/packages/enable-publishing.js +117 -0
- package/dist/commands/packages/enable-publishing.js.map +1 -0
- package/dist/commands/packages/init-synced-elements.d.ts +16 -0
- package/dist/commands/packages/init-synced-elements.d.ts.map +1 -0
- package/dist/commands/packages/init-synced-elements.js +204 -0
- package/dist/commands/packages/init-synced-elements.js.map +1 -0
- package/dist/commands/upstream/analyze-esm.d.ts +59 -0
- package/dist/commands/upstream/analyze-esm.d.ts.map +1 -0
- package/dist/commands/upstream/analyze-esm.js +1481 -0
- package/dist/commands/upstream/analyze-esm.js.map +1 -0
- package/dist/commands/upstream/check.d.ts +15 -0
- package/dist/commands/upstream/check.d.ts.map +1 -0
- package/dist/commands/upstream/check.js +165 -0
- package/dist/commands/upstream/check.js.map +1 -0
- package/dist/commands/upstream/deps.d.ts +15 -0
- package/dist/commands/upstream/deps.d.ts.map +1 -0
- package/dist/commands/upstream/deps.js +174 -0
- package/dist/commands/upstream/deps.js.map +1 -0
- package/dist/commands/upstream/sync-mathquill.d.ts +12 -0
- package/dist/commands/upstream/sync-mathquill.d.ts.map +1 -0
- package/dist/commands/upstream/sync-mathquill.js +97 -0
- package/dist/commands/upstream/sync-mathquill.js.map +1 -0
- package/dist/commands/upstream/sync.d.ts +25 -0
- package/dist/commands/upstream/sync.d.ts.map +1 -0
- package/dist/commands/upstream/sync.js +552 -0
- package/dist/commands/upstream/sync.js.map +1 -0
- package/dist/commands/upstream/track.d.ts +15 -0
- package/dist/commands/upstream/track.d.ts.map +1 -0
- package/dist/commands/upstream/track.js +115 -0
- package/dist/commands/upstream/track.js.map +1 -0
- package/dist/commands/upstream/update.d.ts +15 -0
- package/dist/commands/upstream/update.d.ts.map +1 -0
- package/dist/commands/upstream/update.js +98 -0
- package/dist/commands/upstream/update.js.map +1 -0
- package/dist/commands/verify/controllers.d.ts +12 -0
- package/dist/commands/verify/controllers.d.ts.map +1 -0
- package/dist/commands/verify/controllers.js +138 -0
- package/dist/commands/verify/controllers.js.map +1 -0
- package/dist/commands/verify/react-build.d.ts +13 -0
- package/dist/commands/verify/react-build.d.ts.map +1 -0
- package/dist/commands/verify/react-build.js +135 -0
- package/dist/commands/verify/react-build.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/mathquill/extension-generator.d.ts +9 -0
- package/dist/lib/mathquill/extension-generator.d.ts.map +1 -0
- package/dist/lib/mathquill/extension-generator.js +107 -0
- package/dist/lib/mathquill/extension-generator.js.map +1 -0
- package/dist/lib/mathquill/khan-extractor.d.ts +16 -0
- package/dist/lib/mathquill/khan-extractor.d.ts.map +1 -0
- package/dist/lib/mathquill/khan-extractor.js +148 -0
- package/dist/lib/mathquill/khan-extractor.js.map +1 -0
- package/dist/lib/mathquill/learnosity-extractor.d.ts +15 -0
- package/dist/lib/mathquill/learnosity-extractor.d.ts.map +1 -0
- package/dist/lib/mathquill/learnosity-extractor.js +170 -0
- package/dist/lib/mathquill/learnosity-extractor.js.map +1 -0
- package/dist/lib/mathquill/migration-orchestrator.d.ts +77 -0
- package/dist/lib/mathquill/migration-orchestrator.d.ts.map +1 -0
- package/dist/lib/mathquill/migration-orchestrator.js +391 -0
- package/dist/lib/mathquill/migration-orchestrator.js.map +1 -0
- package/dist/lib/mathquill/package-updater.d.ts +9 -0
- package/dist/lib/mathquill/package-updater.d.ts.map +1 -0
- package/dist/lib/mathquill/package-updater.js +103 -0
- package/dist/lib/mathquill/package-updater.js.map +1 -0
- package/dist/lib/mathquill/pie-extractor.d.ts +14 -0
- package/dist/lib/mathquill/pie-extractor.d.ts.map +1 -0
- package/dist/lib/mathquill/pie-extractor.js +167 -0
- package/dist/lib/mathquill/pie-extractor.js.map +1 -0
- package/dist/lib/upstream/repo-utils.d.ts +9 -0
- package/dist/lib/upstream/repo-utils.d.ts.map +1 -0
- package/dist/lib/upstream/repo-utils.js +10 -0
- package/dist/lib/upstream/repo-utils.js.map +1 -0
- package/dist/lib/upstream/sync-compatibility.d.ts +29 -0
- package/dist/lib/upstream/sync-compatibility.d.ts.map +1 -0
- package/dist/lib/upstream/sync-compatibility.js +70 -0
- package/dist/lib/upstream/sync-compatibility.js.map +1 -0
- package/dist/lib/upstream/sync-constants.d.ts +50 -0
- package/dist/lib/upstream/sync-constants.d.ts.map +1 -0
- package/dist/lib/upstream/sync-constants.js +66 -0
- package/dist/lib/upstream/sync-constants.js.map +1 -0
- package/dist/lib/upstream/sync-controllers-strategy.d.ts +18 -0
- package/dist/lib/upstream/sync-controllers-strategy.d.ts.map +1 -0
- package/dist/lib/upstream/sync-controllers-strategy.js +243 -0
- package/dist/lib/upstream/sync-controllers-strategy.js.map +1 -0
- package/dist/lib/upstream/sync-demo-metadata.d.ts +15 -0
- package/dist/lib/upstream/sync-demo-metadata.d.ts.map +1 -0
- package/dist/lib/upstream/sync-demo-metadata.js +165 -0
- package/dist/lib/upstream/sync-demo-metadata.js.map +1 -0
- package/dist/lib/upstream/sync-dev-exports.d.ts +13 -0
- package/dist/lib/upstream/sync-dev-exports.d.ts.map +1 -0
- package/dist/lib/upstream/sync-dev-exports.js +115 -0
- package/dist/lib/upstream/sync-dev-exports.js.map +1 -0
- package/dist/lib/upstream/sync-externals.d.ts +29 -0
- package/dist/lib/upstream/sync-externals.d.ts.map +1 -0
- package/dist/lib/upstream/sync-externals.js +164 -0
- package/dist/lib/upstream/sync-externals.js.map +1 -0
- package/dist/lib/upstream/sync-filesystem.d.ts +21 -0
- package/dist/lib/upstream/sync-filesystem.d.ts.map +1 -0
- package/dist/lib/upstream/sync-filesystem.js +64 -0
- package/dist/lib/upstream/sync-filesystem.js.map +1 -0
- package/dist/lib/upstream/sync-imports.d.ts +284 -0
- package/dist/lib/upstream/sync-imports.d.ts.map +1 -0
- package/dist/lib/upstream/sync-imports.js +816 -0
- package/dist/lib/upstream/sync-imports.js.map +1 -0
- package/dist/lib/upstream/sync-mathquill.d.ts +19 -0
- package/dist/lib/upstream/sync-mathquill.d.ts.map +1 -0
- package/dist/lib/upstream/sync-mathquill.js +160 -0
- package/dist/lib/upstream/sync-mathquill.js.map +1 -0
- package/dist/lib/upstream/sync-package-json.d.ts +28 -0
- package/dist/lib/upstream/sync-package-json.d.ts.map +1 -0
- package/dist/lib/upstream/sync-package-json.js +66 -0
- package/dist/lib/upstream/sync-package-json.js.map +1 -0
- package/dist/lib/upstream/sync-package-manager.d.ts +50 -0
- package/dist/lib/upstream/sync-package-manager.d.ts.map +1 -0
- package/dist/lib/upstream/sync-package-manager.js +570 -0
- package/dist/lib/upstream/sync-package-manager.js.map +1 -0
- package/dist/lib/upstream/sync-pielib-strategy.d.ts +26 -0
- package/dist/lib/upstream/sync-pielib-strategy.d.ts.map +1 -0
- package/dist/lib/upstream/sync-pielib-strategy.js +345 -0
- package/dist/lib/upstream/sync-pielib-strategy.js.map +1 -0
- package/dist/lib/upstream/sync-react-strategy.d.ts +54 -0
- package/dist/lib/upstream/sync-react-strategy.d.ts.map +1 -0
- package/dist/lib/upstream/sync-react-strategy.js +733 -0
- package/dist/lib/upstream/sync-react-strategy.js.map +1 -0
- package/dist/lib/upstream/sync-strategy.d.ts +49 -0
- package/dist/lib/upstream/sync-strategy.d.ts.map +1 -0
- package/dist/lib/upstream/sync-strategy.js +2 -0
- package/dist/lib/upstream/sync-strategy.js.map +1 -0
- package/dist/lib/upstream/sync-summary.d.ts +20 -0
- package/dist/lib/upstream/sync-summary.d.ts.map +1 -0
- package/dist/lib/upstream/sync-summary.js +157 -0
- package/dist/lib/upstream/sync-summary.js.map +1 -0
- package/dist/lib/upstream/sync-transforms.d.ts +60 -0
- package/dist/lib/upstream/sync-transforms.d.ts.map +1 -0
- package/dist/lib/upstream/sync-transforms.js +97 -0
- package/dist/lib/upstream/sync-transforms.js.map +1 -0
- package/dist/lib/upstream/sync-vite-config.d.ts +13 -0
- package/dist/lib/upstream/sync-vite-config.d.ts.map +1 -0
- package/dist/lib/upstream/sync-vite-config.js +231 -0
- package/dist/lib/upstream/sync-vite-config.js.map +1 -0
- package/dist/utils/compatibility.d.ts +129 -0
- package/dist/utils/compatibility.d.ts.map +1 -0
- package/dist/utils/compatibility.js +44 -0
- package/dist/utils/compatibility.js.map +1 -0
- package/dist/utils/conversion.d.ts +25 -0
- package/dist/utils/conversion.d.ts.map +1 -0
- package/dist/utils/conversion.js +123 -0
- package/dist/utils/conversion.js.map +1 -0
- package/dist/utils/git.d.ts +7 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +63 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/logger.d.ts +29 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +63 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/package-json.d.ts +12 -0
- package/dist/utils/package-json.d.ts.map +1 -0
- package/dist/utils/package-json.js +29 -0
- package/dist/utils/package-json.js.map +1 -0
- package/package.json +59 -0
- package/packages/cli/bin/dev.js +5 -0
- package/packages/cli/bin/run.js +5 -0
- package/src/commands/dev/demo/index.ts +313 -0
- package/src/commands/dev/test-bundler.ts +345 -0
- package/src/commands/mathquill/migrate.ts +269 -0
- package/src/commands/mathquill/status.ts +267 -0
- package/src/commands/packages/create-controllers.ts +127 -0
- package/src/commands/packages/create-lib-react.ts +279 -0
- package/src/commands/packages/create-react-elements.ts +306 -0
- package/src/commands/packages/enable-publishing.ts +161 -0
- package/src/commands/packages/init-synced-elements.ts +259 -0
- package/src/commands/upstream/README.md +444 -0
- package/src/commands/upstream/analyze-esm.ts +1973 -0
- package/src/commands/upstream/check.ts +228 -0
- package/src/commands/upstream/deps.ts +222 -0
- package/src/commands/upstream/sync-mathquill.ts +108 -0
- package/src/commands/upstream/sync.ts +687 -0
- package/src/commands/upstream/track.ts +145 -0
- package/src/commands/upstream/update.ts +110 -0
- package/src/commands/verify/controllers.ts +166 -0
- package/src/commands/verify/react-build.ts +171 -0
- package/src/index.ts +1 -0
- package/src/lib/mathquill/extension-generator.ts +111 -0
- package/src/lib/mathquill/khan-extractor.ts +175 -0
- package/src/lib/mathquill/learnosity-extractor.ts +198 -0
- package/src/lib/mathquill/migration-orchestrator.ts +513 -0
- package/src/lib/mathquill/package-updater.ts +120 -0
- package/src/lib/mathquill/pie-extractor.ts +194 -0
- package/src/lib/upstream/repo-utils.ts +18 -0
- package/src/lib/upstream/sync-compatibility.ts +89 -0
- package/src/lib/upstream/sync-constants.ts +77 -0
- package/src/lib/upstream/sync-controllers-strategy.ts +291 -0
- package/src/lib/upstream/sync-demo-metadata.ts +199 -0
- package/src/lib/upstream/sync-dev-exports.ts +151 -0
- package/src/lib/upstream/sync-externals.ts +159 -0
- package/src/lib/upstream/sync-filesystem.ts +87 -0
- package/src/lib/upstream/sync-imports.ts +992 -0
- package/src/lib/upstream/sync-mathquill.ts +194 -0
- package/src/lib/upstream/sync-package-json.ts +86 -0
- package/src/lib/upstream/sync-package-manager.ts +694 -0
- package/src/lib/upstream/sync-pielib-strategy.ts +441 -0
- package/src/lib/upstream/sync-react-strategy.ts +945 -0
- package/src/lib/upstream/sync-strategy.ts +61 -0
- package/src/lib/upstream/sync-summary.ts +194 -0
- package/src/lib/upstream/sync-transforms.ts +154 -0
- package/src/lib/upstream/sync-vite-config.ts +243 -0
- package/src/types/es-module-lexer.d.ts +4 -0
- package/src/utils/compatibility.ts +182 -0
- package/src/utils/conversion.ts +153 -0
- package/src/utils/git.ts +63 -0
- package/src/utils/logger.ts +69 -0
- package/src/utils/package-json.ts +43 -0
- package/tests/sync-package-manager.test.ts +112 -0
- package/tests/transform-assign-props.test.ts +101 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strategy pattern for sync operations
|
|
3
|
+
*/
|
|
4
|
+
import type { Logger } from '../../utils/logger.js';
|
|
5
|
+
import type { CompatibilityReport } from '../../utils/compatibility.js';
|
|
6
|
+
|
|
7
|
+
export interface SyncConfig {
|
|
8
|
+
pieElements: string;
|
|
9
|
+
pieLib: string;
|
|
10
|
+
pieElementsNg: string;
|
|
11
|
+
|
|
12
|
+
// What to sync
|
|
13
|
+
syncControllers: boolean;
|
|
14
|
+
syncReactComponents: boolean;
|
|
15
|
+
syncPieLib: boolean;
|
|
16
|
+
|
|
17
|
+
// Filters
|
|
18
|
+
pieLibPackages?: string[];
|
|
19
|
+
|
|
20
|
+
// Options
|
|
21
|
+
skipDemos: boolean;
|
|
22
|
+
upstreamCommit: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface SyncContext {
|
|
26
|
+
config: SyncConfig;
|
|
27
|
+
logger: Logger;
|
|
28
|
+
packageFilter?: string;
|
|
29
|
+
compatibilityReport?: CompatibilityReport;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface SyncResult {
|
|
33
|
+
count: number;
|
|
34
|
+
packageNames: string[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Base interface for sync strategies
|
|
39
|
+
*/
|
|
40
|
+
export interface SyncStrategy {
|
|
41
|
+
/**
|
|
42
|
+
* Get the name of this strategy
|
|
43
|
+
*/
|
|
44
|
+
getName(): string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Check if this strategy should run based on config
|
|
48
|
+
*/
|
|
49
|
+
shouldRun(config: SyncConfig): boolean;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Execute the sync operation
|
|
53
|
+
* @returns Sync result with count and package names
|
|
54
|
+
*/
|
|
55
|
+
execute(context: SyncContext): Promise<SyncResult>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get a human-readable description of what this strategy syncs
|
|
59
|
+
*/
|
|
60
|
+
getDescription(): string;
|
|
61
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Summary utilities for sync operations
|
|
3
|
+
*/
|
|
4
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import type { Logger } from '../../utils/logger.js';
|
|
7
|
+
import type { CompatibilityReport } from '../../utils/compatibility.js';
|
|
8
|
+
import { EXCLUDED_UPSTREAM_ELEMENTS } from './sync-constants.js';
|
|
9
|
+
|
|
10
|
+
export interface SyncSummary {
|
|
11
|
+
controllersSync: number;
|
|
12
|
+
reactComponentsSynced: number;
|
|
13
|
+
pieLibPackagesSynced: number;
|
|
14
|
+
totalPackagesSynced: number;
|
|
15
|
+
blockedElements: number;
|
|
16
|
+
blockedPieLib: number;
|
|
17
|
+
syncedPackageNames: string[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Get all currently synced elements from packages/elements-react directory
|
|
22
|
+
*/
|
|
23
|
+
function getAllSyncedElements(pieElementsNgPath: string): string[] {
|
|
24
|
+
try {
|
|
25
|
+
const elementsReactPath = join(pieElementsNgPath, 'packages', 'elements-react');
|
|
26
|
+
const entries = readdirSync(elementsReactPath, { withFileTypes: true });
|
|
27
|
+
return entries
|
|
28
|
+
.filter((entry) => {
|
|
29
|
+
if (!entry.isDirectory() || entry.name.startsWith('.')) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
if (
|
|
33
|
+
EXCLUDED_UPSTREAM_ELEMENTS.includes(
|
|
34
|
+
entry.name as (typeof EXCLUDED_UPSTREAM_ELEMENTS)[number]
|
|
35
|
+
)
|
|
36
|
+
) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
return existsSync(join(elementsReactPath, entry.name, 'package.json'));
|
|
40
|
+
})
|
|
41
|
+
.map((entry) => entry.name)
|
|
42
|
+
.sort();
|
|
43
|
+
} catch (error) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Print a concise summary of the sync operation
|
|
50
|
+
*/
|
|
51
|
+
export function printSyncSummary(
|
|
52
|
+
summary: SyncSummary,
|
|
53
|
+
compatibilityReport: CompatibilityReport | null,
|
|
54
|
+
pieElementsNgPath: string,
|
|
55
|
+
logger: Logger
|
|
56
|
+
): void {
|
|
57
|
+
logger.info('');
|
|
58
|
+
logger.info('─'.repeat(60));
|
|
59
|
+
logger.info('');
|
|
60
|
+
|
|
61
|
+
// Show changes from this sync run
|
|
62
|
+
if (summary.syncedPackageNames.length > 0) {
|
|
63
|
+
const elementCount = summary.syncedPackageNames.length;
|
|
64
|
+
logger.success(`${elementCount} element${elementCount > 1 ? 's' : ''} synced in this run`);
|
|
65
|
+
for (const pkg of summary.syncedPackageNames.sort()) {
|
|
66
|
+
logger.info(` • ${pkg}`);
|
|
67
|
+
}
|
|
68
|
+
logger.info('');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Show complete overview of all synced and blocked elements
|
|
72
|
+
logger.info('Complete Overview:');
|
|
73
|
+
logger.info('');
|
|
74
|
+
|
|
75
|
+
// All currently synced elements
|
|
76
|
+
const allSyncedElements = getAllSyncedElements(pieElementsNgPath);
|
|
77
|
+
if (allSyncedElements.length > 0) {
|
|
78
|
+
logger.success(`${allSyncedElements.length} elements currently synced`);
|
|
79
|
+
for (const element of allSyncedElements) {
|
|
80
|
+
logger.info(` • ${element}`);
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
logger.info('No elements synced');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const totalBlocked = summary.blockedElements + summary.blockedPieLib;
|
|
87
|
+
if (totalBlocked > 0 && compatibilityReport) {
|
|
88
|
+
logger.info('');
|
|
89
|
+
logger.warn(`${totalBlocked} packages blocked from sync (ESM incompatible)`);
|
|
90
|
+
|
|
91
|
+
// List blocked elements
|
|
92
|
+
const blockedElementNames = Object.keys(compatibilityReport.blockedElements).sort();
|
|
93
|
+
if (blockedElementNames.length > 0) {
|
|
94
|
+
logger.info('');
|
|
95
|
+
logger.info('Blocked elements:');
|
|
96
|
+
for (const element of blockedElementNames) {
|
|
97
|
+
const blockers = compatibilityReport.blockedElements[element];
|
|
98
|
+
const firstBlocker = blockers[0] || 'Unknown blocker';
|
|
99
|
+
logger.info(` • ${element}: ${firstBlocker}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// List blocked pie-lib packages
|
|
104
|
+
const blockedPieLibNames = Object.entries(compatibilityReport.pieLibDetails)
|
|
105
|
+
.filter(([, details]) => !details.compatible)
|
|
106
|
+
.map(([pkg]) => pkg)
|
|
107
|
+
.sort();
|
|
108
|
+
|
|
109
|
+
if (blockedPieLibNames.length > 0) {
|
|
110
|
+
logger.info('');
|
|
111
|
+
logger.info('Blocked @pie-lib packages:');
|
|
112
|
+
for (const pkg of blockedPieLibNames) {
|
|
113
|
+
const details = compatibilityReport.pieLibDetails[pkg];
|
|
114
|
+
const firstBlocker = details.blockers[0] || 'Unknown blocker';
|
|
115
|
+
logger.info(` • @pie-lib/${pkg}: ${firstBlocker}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Show summary of blocker types
|
|
120
|
+
if (logger.isVerbose()) {
|
|
121
|
+
logger.info('');
|
|
122
|
+
logger.info('Blocker summary by type:');
|
|
123
|
+
|
|
124
|
+
// Group blockers by type
|
|
125
|
+
const blockersByType = new Map<string, string[]>();
|
|
126
|
+
|
|
127
|
+
// Analyze element blockers
|
|
128
|
+
for (const [element, blockers] of Object.entries(compatibilityReport.blockedElements)) {
|
|
129
|
+
for (const blocker of blockers) {
|
|
130
|
+
const match = blocker.match(/^(.+?)\s*-\s*(.+)$/);
|
|
131
|
+
if (match) {
|
|
132
|
+
const [, dep, reason] = match;
|
|
133
|
+
const key = `${dep}: ${reason}`;
|
|
134
|
+
if (!blockersByType.has(key)) {
|
|
135
|
+
blockersByType.set(key, []);
|
|
136
|
+
}
|
|
137
|
+
const pkgList = blockersByType.get(key);
|
|
138
|
+
if (pkgList) {
|
|
139
|
+
pkgList.push(element);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Analyze pie-lib blockers
|
|
146
|
+
for (const [pkg, details] of Object.entries(compatibilityReport.pieLibDetails)) {
|
|
147
|
+
if (!details.compatible) {
|
|
148
|
+
for (const blocker of details.blockers) {
|
|
149
|
+
const match = blocker.match(/^(.+?)\s*-\s*(.+)$/);
|
|
150
|
+
if (match) {
|
|
151
|
+
const [, dep, reason] = match;
|
|
152
|
+
const key = `${dep}: ${reason}`;
|
|
153
|
+
if (!blockersByType.has(key)) {
|
|
154
|
+
blockersByType.set(key, []);
|
|
155
|
+
}
|
|
156
|
+
const pkgList = blockersByType.get(key);
|
|
157
|
+
if (pkgList) {
|
|
158
|
+
pkgList.push(`@pie-lib/${pkg}`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const sortedBlockers = Array.from(blockersByType.entries()).sort(
|
|
166
|
+
(a, b) => b[1].length - a[1].length
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
for (const [blocker, packages] of sortedBlockers) {
|
|
170
|
+
logger.info(` • ${packages.length} package${packages.length > 1 ? 's' : ''}: ${blocker}`);
|
|
171
|
+
for (const pkg of packages) {
|
|
172
|
+
logger.info(` - ${pkg}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
logger.info('');
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Create an empty summary
|
|
183
|
+
*/
|
|
184
|
+
export function createEmptySummary(): SyncSummary {
|
|
185
|
+
return {
|
|
186
|
+
controllersSync: 0,
|
|
187
|
+
reactComponentsSynced: 0,
|
|
188
|
+
pieLibPackagesSynced: 0,
|
|
189
|
+
totalPackagesSynced: 0,
|
|
190
|
+
blockedElements: 0,
|
|
191
|
+
blockedPieLib: 0,
|
|
192
|
+
syncedPackageNames: [],
|
|
193
|
+
};
|
|
194
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized transformation pipeline for upstream sync operations
|
|
3
|
+
*
|
|
4
|
+
* This module consolidates all source code transformations into a single,
|
|
5
|
+
* composable pipeline to reduce duplication and ensure consistent transformations
|
|
6
|
+
* across all sync strategies.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
transformLodashToLodashEs,
|
|
11
|
+
transformPieFrameworkEventImports,
|
|
12
|
+
transformControllerUtilsImports,
|
|
13
|
+
transformSharedPackageImports,
|
|
14
|
+
transformMathquillImports,
|
|
15
|
+
inlineEditableHtmlConstants,
|
|
16
|
+
reexportTokenTypes,
|
|
17
|
+
transformSsrRequireToReactLazy,
|
|
18
|
+
inlineConfigureDefaults,
|
|
19
|
+
transformConfigureUtilsImports,
|
|
20
|
+
transformSelfReferentialImports,
|
|
21
|
+
transformPackageJsonLodash,
|
|
22
|
+
transformPackageJsonRecharts,
|
|
23
|
+
transformPackageJsonPieEvents,
|
|
24
|
+
transformPackageJsonControllerUtils,
|
|
25
|
+
transformPackageJsonSharedPackages,
|
|
26
|
+
transformPackageJsonMathquill,
|
|
27
|
+
fixStyledComponentTypes,
|
|
28
|
+
fixExportedFunctionTypes,
|
|
29
|
+
transformMenuToInlineMenu,
|
|
30
|
+
addInlineMenuExport,
|
|
31
|
+
transformMathQuillInterface,
|
|
32
|
+
} from './sync-imports.js';
|
|
33
|
+
import type { PackageJson } from '../../utils/package-json.js';
|
|
34
|
+
|
|
35
|
+
export interface TransformOptions {
|
|
36
|
+
/** Path relative to package root (e.g., "configure/src/utils.js") */
|
|
37
|
+
relativePath?: string;
|
|
38
|
+
/** Source file path for context (e.g., "/path/to/file.js") */
|
|
39
|
+
sourcePath?: string;
|
|
40
|
+
/** Package name (e.g., "@pie-element/fraction-model") */
|
|
41
|
+
packageName?: string;
|
|
42
|
+
/** Whether to include configure-specific transforms */
|
|
43
|
+
includeConfigure?: boolean;
|
|
44
|
+
/** Whether to include pie-lib-specific transforms */
|
|
45
|
+
includePieLib?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Apply all standard source code transformations in the correct order
|
|
50
|
+
*
|
|
51
|
+
* This ensures consistent transformation across all sync strategies:
|
|
52
|
+
* 1. lodash → lodash-es (ESM compatibility)
|
|
53
|
+
* 2. @pie-framework event packages → internal packages
|
|
54
|
+
* 3. @pie-lib/controller-utils → @pie-framework/controller-utils
|
|
55
|
+
* 4. @pie-lib shared packages → @pie-element/shared-*
|
|
56
|
+
* 5. @pie-framework/mathquill → @pie-element/shared-mathquill
|
|
57
|
+
* 6. @mui/material/Menu → InlineMenu from @pie-lib/render-ui
|
|
58
|
+
* 7. Self-referential imports → relative imports
|
|
59
|
+
* 8. Configure-specific transforms (if enabled)
|
|
60
|
+
* 9. Pie-lib-specific transforms (if enabled)
|
|
61
|
+
* 10. Fix styled component TypeScript type inference errors
|
|
62
|
+
*/
|
|
63
|
+
export function applySourceTransforms(content: string, options: TransformOptions = {}): string {
|
|
64
|
+
let transformed = content;
|
|
65
|
+
|
|
66
|
+
// Core transforms (always applied)
|
|
67
|
+
transformed = transformLodashToLodashEs(transformed);
|
|
68
|
+
transformed = transformPieFrameworkEventImports(transformed);
|
|
69
|
+
transformed = transformControllerUtilsImports(transformed);
|
|
70
|
+
transformed = transformSharedPackageImports(transformed);
|
|
71
|
+
transformed = transformMathquillImports(transformed);
|
|
72
|
+
transformed = transformMathQuillInterface(transformed);
|
|
73
|
+
transformed = transformMenuToInlineMenu(transformed);
|
|
74
|
+
|
|
75
|
+
// Transform self-referential imports to relative paths
|
|
76
|
+
if (options.packageName && options.relativePath) {
|
|
77
|
+
transformed = transformSelfReferentialImports(
|
|
78
|
+
transformed,
|
|
79
|
+
options.packageName,
|
|
80
|
+
options.relativePath
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Configure-specific transforms
|
|
85
|
+
if (options.includeConfigure) {
|
|
86
|
+
transformed = inlineConfigureDefaults(transformed);
|
|
87
|
+
if (options.relativePath) {
|
|
88
|
+
transformed = transformConfigureUtilsImports(transformed, options.relativePath);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Pie-lib-specific transforms
|
|
93
|
+
if (options.includePieLib) {
|
|
94
|
+
transformed = inlineEditableHtmlConstants(transformed);
|
|
95
|
+
if (options.sourcePath) {
|
|
96
|
+
transformed = reexportTokenTypes(transformed, options.sourcePath);
|
|
97
|
+
transformed = addInlineMenuExport(transformed, options.sourcePath);
|
|
98
|
+
}
|
|
99
|
+
transformed = transformSsrRequireToReactLazy(transformed);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// TypeScript fixes (always applied)
|
|
103
|
+
transformed = fixStyledComponentTypes(transformed);
|
|
104
|
+
transformed = fixExportedFunctionTypes(transformed, options.sourcePath);
|
|
105
|
+
|
|
106
|
+
return transformed;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Apply all standard package.json transformations
|
|
111
|
+
*
|
|
112
|
+
* Ensures consistent dependency transformations across all packages:
|
|
113
|
+
* 1. lodash → lodash-es
|
|
114
|
+
* 2. @pie-framework event packages → internal packages
|
|
115
|
+
* 3. @pie-lib/controller-utils → @pie-framework/controller-utils
|
|
116
|
+
* 4. @pie-lib shared packages → @pie-element/shared-*
|
|
117
|
+
* 5. @pie-framework/mathquill → @pie-element/shared-mathquill
|
|
118
|
+
*/
|
|
119
|
+
export function applyPackageJsonTransforms<T extends PackageJson>(pkg: T): T {
|
|
120
|
+
let transformed = pkg;
|
|
121
|
+
|
|
122
|
+
transformed = transformPackageJsonLodash(transformed);
|
|
123
|
+
transformed = transformPackageJsonRecharts(transformed);
|
|
124
|
+
transformed = transformPackageJsonPieEvents(transformed);
|
|
125
|
+
transformed = transformPackageJsonControllerUtils(transformed);
|
|
126
|
+
transformed = transformPackageJsonSharedPackages(transformed);
|
|
127
|
+
transformed = transformPackageJsonMathquill(transformed);
|
|
128
|
+
|
|
129
|
+
return transformed;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Create a transform pipeline for controller files
|
|
134
|
+
*/
|
|
135
|
+
export function createControllerTransformPipeline(packageName?: string) {
|
|
136
|
+
return (content: string, relativePath?: string) =>
|
|
137
|
+
applySourceTransforms(content, { relativePath, packageName, includeConfigure: false });
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Create a transform pipeline for React component files
|
|
142
|
+
*/
|
|
143
|
+
export function createReactComponentTransformPipeline(packageName?: string) {
|
|
144
|
+
return (content: string, relativePath?: string) =>
|
|
145
|
+
applySourceTransforms(content, { relativePath, packageName, includeConfigure: true });
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Create a transform pipeline for pie-lib files
|
|
150
|
+
*/
|
|
151
|
+
export function createPieLibTransformPipeline() {
|
|
152
|
+
return (content: string, sourcePath?: string) =>
|
|
153
|
+
applySourceTransforms(content, { sourcePath, includePieLib: true });
|
|
154
|
+
}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vite configuration generation for sync operations
|
|
3
|
+
*/
|
|
4
|
+
import { existsSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { createExternalFunction } from './sync-externals.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Detect the actual file extension for a source file
|
|
10
|
+
*/
|
|
11
|
+
function detectFileExtension(basePath: string): string | null {
|
|
12
|
+
if (existsSync(`${basePath}.tsx`)) return '.tsx';
|
|
13
|
+
if (existsSync(`${basePath}.ts`)) return '.ts';
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Detect entry points for an element package
|
|
19
|
+
*/
|
|
20
|
+
export function detectElementEntryPoints(elementDir: string): Record<string, string> {
|
|
21
|
+
const entryPoints: Record<string, string> = {};
|
|
22
|
+
|
|
23
|
+
// Main index
|
|
24
|
+
const indexExt = detectFileExtension(join(elementDir, 'src/index'));
|
|
25
|
+
if (indexExt) {
|
|
26
|
+
entryPoints.index = `src/index${indexExt}`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Controller
|
|
30
|
+
const controllerExt = detectFileExtension(join(elementDir, 'src/controller/index'));
|
|
31
|
+
if (controllerExt) {
|
|
32
|
+
entryPoints['controller/index'] = `src/controller/index${controllerExt}`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Configure
|
|
36
|
+
const configureExt = detectFileExtension(join(elementDir, 'src/configure/index'));
|
|
37
|
+
if (configureExt) {
|
|
38
|
+
entryPoints['configure/index'] = `src/configure/index${configureExt}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Delivery
|
|
42
|
+
const deliveryExt = detectFileExtension(join(elementDir, 'src/delivery/index'));
|
|
43
|
+
if (deliveryExt) {
|
|
44
|
+
entryPoints['delivery/index'] = `src/delivery/index${deliveryExt}`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return entryPoints;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Generate Vite config content for an element package
|
|
52
|
+
*/
|
|
53
|
+
export function generateElementViteConfig(entryPoints: Record<string, string>): string {
|
|
54
|
+
if (Object.keys(entryPoints).length === 0) {
|
|
55
|
+
throw new Error('No entry points found for element');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const entryJson = JSON.stringify(entryPoints, null, 8).replace(/^/gm, ' ');
|
|
59
|
+
|
|
60
|
+
return `import { resolve } from 'node:path';
|
|
61
|
+
import react from '@vitejs/plugin-react';
|
|
62
|
+
import { defineConfig } from 'vite';
|
|
63
|
+
|
|
64
|
+
export default defineConfig(({ mode }) => {
|
|
65
|
+
// Demo mode: serve the docs/demo directory
|
|
66
|
+
if (mode === 'demo') {
|
|
67
|
+
return {
|
|
68
|
+
plugins: [react()],
|
|
69
|
+
root: 'docs/demo',
|
|
70
|
+
server: {
|
|
71
|
+
port: 5174,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Build mode: build the library
|
|
77
|
+
return {
|
|
78
|
+
plugins: [react()],
|
|
79
|
+
build: {
|
|
80
|
+
lib: {
|
|
81
|
+
entry: ${entryJson.trimStart()},
|
|
82
|
+
formats: ['es'],
|
|
83
|
+
},
|
|
84
|
+
rollupOptions: {
|
|
85
|
+
external: ${createExternalFunction('element')},
|
|
86
|
+
output: {
|
|
87
|
+
preserveModules: true,
|
|
88
|
+
preserveModulesRoot: 'src',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Generate Vite config content for a pie-lib package
|
|
99
|
+
*/
|
|
100
|
+
export function generatePieLibViteConfig(packageName?: string, packageDir?: string): string {
|
|
101
|
+
// Detect entry point extension if package directory provided
|
|
102
|
+
let entryPoint = 'src/index.ts';
|
|
103
|
+
if (packageDir) {
|
|
104
|
+
const ext = detectFileExtension(join(packageDir, 'src/index'));
|
|
105
|
+
if (ext) {
|
|
106
|
+
entryPoint = `src/index${ext}`;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Special config for math-rendering wrapper (externalizes adapter package)
|
|
111
|
+
if (packageName === 'math-rendering') {
|
|
112
|
+
return `import { resolve } from 'node:path';
|
|
113
|
+
import { defineConfig } from 'vite';
|
|
114
|
+
|
|
115
|
+
export default defineConfig({
|
|
116
|
+
build: {
|
|
117
|
+
lib: {
|
|
118
|
+
entry: {
|
|
119
|
+
index: resolve(__dirname, '${entryPoint}'),
|
|
120
|
+
},
|
|
121
|
+
formats: ['es'],
|
|
122
|
+
},
|
|
123
|
+
rollupOptions: {
|
|
124
|
+
external: (id) => {
|
|
125
|
+
return (
|
|
126
|
+
/^@pie-element\\/shared-/.test(id) ||
|
|
127
|
+
id === '@pie-element/shared-math-rendering-mathjax' ||
|
|
128
|
+
/^@pie-lib\\//.test(id) ||
|
|
129
|
+
['debug'].includes(id)
|
|
130
|
+
);
|
|
131
|
+
},
|
|
132
|
+
output: {
|
|
133
|
+
preserveModules: true,
|
|
134
|
+
preserveModulesRoot: 'src',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
`;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Special config for test-utils (includes testing library externals)
|
|
143
|
+
if (packageName === 'test-utils') {
|
|
144
|
+
return `import { resolve } from 'node:path';
|
|
145
|
+
import react from '@vitejs/plugin-react';
|
|
146
|
+
import { defineConfig } from 'vite';
|
|
147
|
+
|
|
148
|
+
export default defineConfig({
|
|
149
|
+
plugins: [react()],
|
|
150
|
+
build: {
|
|
151
|
+
lib: {
|
|
152
|
+
entry: {
|
|
153
|
+
index: resolve(__dirname, '${entryPoint}'),
|
|
154
|
+
},
|
|
155
|
+
formats: ['es'],
|
|
156
|
+
},
|
|
157
|
+
rollupOptions: {
|
|
158
|
+
external: ${createExternalFunction('pielib')},
|
|
159
|
+
output: {
|
|
160
|
+
preserveModules: true,
|
|
161
|
+
preserveModulesRoot: 'src',
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
`;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Special config for editable-html-tip-tap (externalizes prosemirror and tiptap)
|
|
170
|
+
if (packageName === 'editable-html-tip-tap') {
|
|
171
|
+
return `import { resolve } from 'node:path';
|
|
172
|
+
import react from '@vitejs/plugin-react';
|
|
173
|
+
import { defineConfig } from 'vite';
|
|
174
|
+
|
|
175
|
+
export default defineConfig({
|
|
176
|
+
plugins: [react()],
|
|
177
|
+
build: {
|
|
178
|
+
lib: {
|
|
179
|
+
entry: {
|
|
180
|
+
index: resolve(__dirname, '${entryPoint}'),
|
|
181
|
+
},
|
|
182
|
+
formats: ['es'],
|
|
183
|
+
},
|
|
184
|
+
rollupOptions: {
|
|
185
|
+
external: (id) => {
|
|
186
|
+
return (
|
|
187
|
+
/^react($|\\/)/.test(id) ||
|
|
188
|
+
/^react-dom($|\\/)/.test(id) ||
|
|
189
|
+
/^@pie-lib\\//.test(id) ||
|
|
190
|
+
/^@pie-element\\//.test(id) ||
|
|
191
|
+
/^@pie-element\\//.test(id) ||
|
|
192
|
+
/^@pie-framework\\//.test(id) ||
|
|
193
|
+
/^@mui\\//.test(id) ||
|
|
194
|
+
/^@emotion\\//.test(id) ||
|
|
195
|
+
/^d3-/.test(id) ||
|
|
196
|
+
/^@testing-library\\//.test(id) ||
|
|
197
|
+
id === 'lodash-es' ||
|
|
198
|
+
/^lodash-es\\//.test(id) ||
|
|
199
|
+
/^styled-components/.test(id) ||
|
|
200
|
+
id === 'konva' || /^konva\\//.test(id) ||
|
|
201
|
+
id === 'react-konva' || /^react-konva\\//.test(id) ||
|
|
202
|
+
id === '@mdi/react' || /^@mdi\\/react\\//.test(id) ||
|
|
203
|
+
id === '@mdi/js' || /^@mdi\\/js\\//.test(id) ||
|
|
204
|
+
/^prosemirror-/.test(id) ||
|
|
205
|
+
/^@tiptap\\//.test(id) ||
|
|
206
|
+
['prop-types', 'classnames', 'debug', 'i18next', 'humps', 'mathjs', 'react-jss', 'js-combinatorics', '@dnd-kit/core', 'react-transition-group'].includes(id)
|
|
207
|
+
);
|
|
208
|
+
},
|
|
209
|
+
output: {
|
|
210
|
+
preserveModules: true,
|
|
211
|
+
preserveModulesRoot: 'src',
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
`;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Default pie-lib config
|
|
220
|
+
return `import { resolve } from 'node:path';
|
|
221
|
+
import react from '@vitejs/plugin-react';
|
|
222
|
+
import { defineConfig } from 'vite';
|
|
223
|
+
|
|
224
|
+
export default defineConfig({
|
|
225
|
+
plugins: [react()],
|
|
226
|
+
build: {
|
|
227
|
+
lib: {
|
|
228
|
+
entry: {
|
|
229
|
+
index: resolve(__dirname, '${entryPoint}'),
|
|
230
|
+
},
|
|
231
|
+
formats: ['es'],
|
|
232
|
+
},
|
|
233
|
+
rollupOptions: {
|
|
234
|
+
external: ${createExternalFunction('pielib')},
|
|
235
|
+
output: {
|
|
236
|
+
preserveModules: true,
|
|
237
|
+
preserveModulesRoot: 'src',
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
`;
|
|
243
|
+
}
|