@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,231 @@
|
|
|
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
|
+
* Detect the actual file extension for a source file
|
|
9
|
+
*/
|
|
10
|
+
function detectFileExtension(basePath) {
|
|
11
|
+
if (existsSync(`${basePath}.tsx`))
|
|
12
|
+
return '.tsx';
|
|
13
|
+
if (existsSync(`${basePath}.ts`))
|
|
14
|
+
return '.ts';
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Detect entry points for an element package
|
|
19
|
+
*/
|
|
20
|
+
export function detectElementEntryPoints(elementDir) {
|
|
21
|
+
const entryPoints = {};
|
|
22
|
+
// Main index
|
|
23
|
+
const indexExt = detectFileExtension(join(elementDir, 'src/index'));
|
|
24
|
+
if (indexExt) {
|
|
25
|
+
entryPoints.index = `src/index${indexExt}`;
|
|
26
|
+
}
|
|
27
|
+
// Controller
|
|
28
|
+
const controllerExt = detectFileExtension(join(elementDir, 'src/controller/index'));
|
|
29
|
+
if (controllerExt) {
|
|
30
|
+
entryPoints['controller/index'] = `src/controller/index${controllerExt}`;
|
|
31
|
+
}
|
|
32
|
+
// Configure
|
|
33
|
+
const configureExt = detectFileExtension(join(elementDir, 'src/configure/index'));
|
|
34
|
+
if (configureExt) {
|
|
35
|
+
entryPoints['configure/index'] = `src/configure/index${configureExt}`;
|
|
36
|
+
}
|
|
37
|
+
// Delivery
|
|
38
|
+
const deliveryExt = detectFileExtension(join(elementDir, 'src/delivery/index'));
|
|
39
|
+
if (deliveryExt) {
|
|
40
|
+
entryPoints['delivery/index'] = `src/delivery/index${deliveryExt}`;
|
|
41
|
+
}
|
|
42
|
+
return entryPoints;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Generate Vite config content for an element package
|
|
46
|
+
*/
|
|
47
|
+
export function generateElementViteConfig(entryPoints) {
|
|
48
|
+
if (Object.keys(entryPoints).length === 0) {
|
|
49
|
+
throw new Error('No entry points found for element');
|
|
50
|
+
}
|
|
51
|
+
const entryJson = JSON.stringify(entryPoints, null, 8).replace(/^/gm, ' ');
|
|
52
|
+
return `import { resolve } from 'node:path';
|
|
53
|
+
import react from '@vitejs/plugin-react';
|
|
54
|
+
import { defineConfig } from 'vite';
|
|
55
|
+
|
|
56
|
+
export default defineConfig(({ mode }) => {
|
|
57
|
+
// Demo mode: serve the docs/demo directory
|
|
58
|
+
if (mode === 'demo') {
|
|
59
|
+
return {
|
|
60
|
+
plugins: [react()],
|
|
61
|
+
root: 'docs/demo',
|
|
62
|
+
server: {
|
|
63
|
+
port: 5174,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Build mode: build the library
|
|
69
|
+
return {
|
|
70
|
+
plugins: [react()],
|
|
71
|
+
build: {
|
|
72
|
+
lib: {
|
|
73
|
+
entry: ${entryJson.trimStart()},
|
|
74
|
+
formats: ['es'],
|
|
75
|
+
},
|
|
76
|
+
rollupOptions: {
|
|
77
|
+
external: ${createExternalFunction('element')},
|
|
78
|
+
output: {
|
|
79
|
+
preserveModules: true,
|
|
80
|
+
preserveModulesRoot: 'src',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
`;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Generate Vite config content for a pie-lib package
|
|
90
|
+
*/
|
|
91
|
+
export function generatePieLibViteConfig(packageName, packageDir) {
|
|
92
|
+
// Detect entry point extension if package directory provided
|
|
93
|
+
let entryPoint = 'src/index.ts';
|
|
94
|
+
if (packageDir) {
|
|
95
|
+
const ext = detectFileExtension(join(packageDir, 'src/index'));
|
|
96
|
+
if (ext) {
|
|
97
|
+
entryPoint = `src/index${ext}`;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// Special config for math-rendering wrapper (externalizes adapter package)
|
|
101
|
+
if (packageName === 'math-rendering') {
|
|
102
|
+
return `import { resolve } from 'node:path';
|
|
103
|
+
import { defineConfig } from 'vite';
|
|
104
|
+
|
|
105
|
+
export default defineConfig({
|
|
106
|
+
build: {
|
|
107
|
+
lib: {
|
|
108
|
+
entry: {
|
|
109
|
+
index: resolve(__dirname, '${entryPoint}'),
|
|
110
|
+
},
|
|
111
|
+
formats: ['es'],
|
|
112
|
+
},
|
|
113
|
+
rollupOptions: {
|
|
114
|
+
external: (id) => {
|
|
115
|
+
return (
|
|
116
|
+
/^@pie-element\\/shared-/.test(id) ||
|
|
117
|
+
id === '@pie-element/shared-math-rendering-mathjax' ||
|
|
118
|
+
/^@pie-lib\\//.test(id) ||
|
|
119
|
+
['debug'].includes(id)
|
|
120
|
+
);
|
|
121
|
+
},
|
|
122
|
+
output: {
|
|
123
|
+
preserveModules: true,
|
|
124
|
+
preserveModulesRoot: 'src',
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
`;
|
|
130
|
+
}
|
|
131
|
+
// Special config for test-utils (includes testing library externals)
|
|
132
|
+
if (packageName === 'test-utils') {
|
|
133
|
+
return `import { resolve } from 'node:path';
|
|
134
|
+
import react from '@vitejs/plugin-react';
|
|
135
|
+
import { defineConfig } from 'vite';
|
|
136
|
+
|
|
137
|
+
export default defineConfig({
|
|
138
|
+
plugins: [react()],
|
|
139
|
+
build: {
|
|
140
|
+
lib: {
|
|
141
|
+
entry: {
|
|
142
|
+
index: resolve(__dirname, '${entryPoint}'),
|
|
143
|
+
},
|
|
144
|
+
formats: ['es'],
|
|
145
|
+
},
|
|
146
|
+
rollupOptions: {
|
|
147
|
+
external: ${createExternalFunction('pielib')},
|
|
148
|
+
output: {
|
|
149
|
+
preserveModules: true,
|
|
150
|
+
preserveModulesRoot: 'src',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
`;
|
|
156
|
+
}
|
|
157
|
+
// Special config for editable-html-tip-tap (externalizes prosemirror and tiptap)
|
|
158
|
+
if (packageName === 'editable-html-tip-tap') {
|
|
159
|
+
return `import { resolve } from 'node:path';
|
|
160
|
+
import react from '@vitejs/plugin-react';
|
|
161
|
+
import { defineConfig } from 'vite';
|
|
162
|
+
|
|
163
|
+
export default defineConfig({
|
|
164
|
+
plugins: [react()],
|
|
165
|
+
build: {
|
|
166
|
+
lib: {
|
|
167
|
+
entry: {
|
|
168
|
+
index: resolve(__dirname, '${entryPoint}'),
|
|
169
|
+
},
|
|
170
|
+
formats: ['es'],
|
|
171
|
+
},
|
|
172
|
+
rollupOptions: {
|
|
173
|
+
external: (id) => {
|
|
174
|
+
return (
|
|
175
|
+
/^react($|\\/)/.test(id) ||
|
|
176
|
+
/^react-dom($|\\/)/.test(id) ||
|
|
177
|
+
/^@pie-lib\\//.test(id) ||
|
|
178
|
+
/^@pie-element\\//.test(id) ||
|
|
179
|
+
/^@pie-element\\//.test(id) ||
|
|
180
|
+
/^@pie-framework\\//.test(id) ||
|
|
181
|
+
/^@mui\\//.test(id) ||
|
|
182
|
+
/^@emotion\\//.test(id) ||
|
|
183
|
+
/^d3-/.test(id) ||
|
|
184
|
+
/^@testing-library\\//.test(id) ||
|
|
185
|
+
id === 'lodash-es' ||
|
|
186
|
+
/^lodash-es\\//.test(id) ||
|
|
187
|
+
/^styled-components/.test(id) ||
|
|
188
|
+
id === 'konva' || /^konva\\//.test(id) ||
|
|
189
|
+
id === 'react-konva' || /^react-konva\\//.test(id) ||
|
|
190
|
+
id === '@mdi/react' || /^@mdi\\/react\\//.test(id) ||
|
|
191
|
+
id === '@mdi/js' || /^@mdi\\/js\\//.test(id) ||
|
|
192
|
+
/^prosemirror-/.test(id) ||
|
|
193
|
+
/^@tiptap\\//.test(id) ||
|
|
194
|
+
['prop-types', 'classnames', 'debug', 'i18next', 'humps', 'mathjs', 'react-jss', 'js-combinatorics', '@dnd-kit/core', 'react-transition-group'].includes(id)
|
|
195
|
+
);
|
|
196
|
+
},
|
|
197
|
+
output: {
|
|
198
|
+
preserveModules: true,
|
|
199
|
+
preserveModulesRoot: 'src',
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
`;
|
|
205
|
+
}
|
|
206
|
+
// Default pie-lib config
|
|
207
|
+
return `import { resolve } from 'node:path';
|
|
208
|
+
import react from '@vitejs/plugin-react';
|
|
209
|
+
import { defineConfig } from 'vite';
|
|
210
|
+
|
|
211
|
+
export default defineConfig({
|
|
212
|
+
plugins: [react()],
|
|
213
|
+
build: {
|
|
214
|
+
lib: {
|
|
215
|
+
entry: {
|
|
216
|
+
index: resolve(__dirname, '${entryPoint}'),
|
|
217
|
+
},
|
|
218
|
+
formats: ['es'],
|
|
219
|
+
},
|
|
220
|
+
rollupOptions: {
|
|
221
|
+
external: ${createExternalFunction('pielib')},
|
|
222
|
+
output: {
|
|
223
|
+
preserveModules: true,
|
|
224
|
+
preserveModulesRoot: 'src',
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
`;
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=sync-vite-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-vite-config.js","sourceRoot":"","sources":["../../../src/lib/upstream/sync-vite-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;GAEG;AACH,SAAS,mBAAmB,CAAC,QAAgB;IAC3C,IAAI,UAAU,CAAC,GAAG,QAAQ,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IACjD,IAAI,UAAU,CAAC,GAAG,QAAQ,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC/C,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,UAAkB;IACzD,MAAM,WAAW,GAA2B,EAAE,CAAC;IAE/C,aAAa;IACb,MAAM,QAAQ,GAAG,mBAAmB,CAAC,IAAI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CAAC;;;;;;;;;CASpD,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,WAAoB,EAAE,UAAmB;IAChF,6DAA6D;IAC7D,IAAI,UAAU,GAAG,cAAc,CAAC;IAChC,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,GAAG,GAAG,mBAAmB,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;QAC/D,IAAI,GAAG,EAAE,CAAC;YACR,UAAU,GAAG,YAAY,GAAG,EAAE,CAAC;QACjC,CAAC;IACH,CAAC;IAED,2EAA2E;IAC3E,IAAI,WAAW,KAAK,gBAAgB,EAAE,CAAC;QACrC,OAAO;;;;;;;qCAO0B,UAAU;;;;;;;;;;;;;;;;;;;;CAoB9C,CAAC;IACA,CAAC;IAED,qEAAqE;IACrE,IAAI,WAAW,KAAK,YAAY,EAAE,CAAC;QACjC,OAAO;;;;;;;;;qCAS0B,UAAU;;;;;kBAK7B,sBAAsB,CAAC,QAAQ,CAAC;;;;;;;;CAQjD,CAAC;IACA,CAAC;IAED,iFAAiF;IACjF,IAAI,WAAW,KAAK,uBAAuB,EAAE,CAAC;QAC5C,OAAO;;;;;;;;;qCAS0B,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoC9C,CAAC;IACA,CAAC;IAED,yBAAyB;IACzB,OAAO;;;;;;;;;qCAS4B,UAAU;;;;;kBAK7B,sBAAsB,CAAC,QAAQ,CAAC;;;;;;;;CAQjD,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESM package.json validation result
|
|
3
|
+
*/
|
|
4
|
+
export interface EsmPackageValidation {
|
|
5
|
+
hasTypeModule: boolean;
|
|
6
|
+
hasExportsField: boolean;
|
|
7
|
+
hasMainExport: boolean;
|
|
8
|
+
hasControllerExport: boolean;
|
|
9
|
+
sideEffectsFree: boolean;
|
|
10
|
+
mainExportIsEsm: boolean;
|
|
11
|
+
controllerExportIsEsm: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* ESM player validation result for an element
|
|
15
|
+
*/
|
|
16
|
+
export interface EsmValidationResult {
|
|
17
|
+
compatible: boolean;
|
|
18
|
+
packageJson: EsmPackageValidation;
|
|
19
|
+
blockers: string[];
|
|
20
|
+
warnings: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Runtime-ish validation for ESM player readiness (CDN resolution / module parse).
|
|
24
|
+
* Note: this is NOT a full browser execution test, but it provides production-like signal
|
|
25
|
+
* by verifying CDN URLs resolve and the returned JS parses as an ES module.
|
|
26
|
+
*/
|
|
27
|
+
export interface EsmRuntimeValidationResult {
|
|
28
|
+
/**
|
|
29
|
+
* Whether this element passed the runtime-ish probe.
|
|
30
|
+
* When false, see `errors` for details.
|
|
31
|
+
*/
|
|
32
|
+
compatible: boolean;
|
|
33
|
+
/** The CDN base URL used for probing (e.g. https://esm.sh). */
|
|
34
|
+
cdnBaseUrl: string;
|
|
35
|
+
/** Version that was probed (usually the upstream package.json version). */
|
|
36
|
+
version: string;
|
|
37
|
+
/** Whether the package entrypoint URL resolved (HTTP 200). */
|
|
38
|
+
entryOk: boolean;
|
|
39
|
+
/** Whether the controller URL resolved (HTTP 200). */
|
|
40
|
+
controllerOk: boolean;
|
|
41
|
+
/** Whether the returned JS for the entry parsed as an ES module. */
|
|
42
|
+
entryParseOk: boolean;
|
|
43
|
+
/** Whether the returned JS for the controller parsed as an ES module. */
|
|
44
|
+
controllerParseOk: boolean;
|
|
45
|
+
/** Any errors/warnings collected during probe. */
|
|
46
|
+
errors: string[];
|
|
47
|
+
/**
|
|
48
|
+
* Probe details (for deep/transitive validation)
|
|
49
|
+
*/
|
|
50
|
+
probeMode?: 'shallow' | 'deep';
|
|
51
|
+
maxDepth?: number;
|
|
52
|
+
maxModules?: number;
|
|
53
|
+
fetchedModules?: number;
|
|
54
|
+
fetchedOk?: number;
|
|
55
|
+
firstFailingUrl?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Compatibility report structure
|
|
59
|
+
*/
|
|
60
|
+
export interface CompatibilityReport {
|
|
61
|
+
elements: string[];
|
|
62
|
+
pieLibPackages: string[];
|
|
63
|
+
blockedElements: Record<string, string[]>;
|
|
64
|
+
elementDetails: Record<string, ElementDetail>;
|
|
65
|
+
pieLibDetails: Record<string, PieLibDetail>;
|
|
66
|
+
esmPlayerReady: string[];
|
|
67
|
+
esmValidation: Record<string, EsmValidationResult>;
|
|
68
|
+
/**
|
|
69
|
+
* Whether ESM player validation (package.json structure / exports) was run as part of analysis.
|
|
70
|
+
* Optional for backwards compatibility with older reports.
|
|
71
|
+
*/
|
|
72
|
+
esmPlayerValidationEnabled?: boolean;
|
|
73
|
+
esmRuntimeValidationEnabled?: boolean;
|
|
74
|
+
esmRuntimeCdnBaseUrl?: string;
|
|
75
|
+
esmRuntimeValidation?: Record<string, EsmRuntimeValidationResult>;
|
|
76
|
+
studentUIOnly?: string[];
|
|
77
|
+
lastAnalyzed: string;
|
|
78
|
+
summary: {
|
|
79
|
+
totalElements: number;
|
|
80
|
+
compatibleElements: number;
|
|
81
|
+
blockedElements: number;
|
|
82
|
+
studentUIOnlyElements?: number;
|
|
83
|
+
esmPlayerReady: number;
|
|
84
|
+
esmRuntimeReady?: number;
|
|
85
|
+
totalPieLibPackages: number;
|
|
86
|
+
compatiblePieLibPackages: number;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export interface ElementDetail {
|
|
90
|
+
compatible: boolean;
|
|
91
|
+
directDeps: string[];
|
|
92
|
+
pieLibDeps: string[];
|
|
93
|
+
pieElementDeps: string[];
|
|
94
|
+
blockers: string[];
|
|
95
|
+
studentUI?: {
|
|
96
|
+
compatible: boolean;
|
|
97
|
+
blockers: string[];
|
|
98
|
+
};
|
|
99
|
+
configure?: {
|
|
100
|
+
compatible: boolean;
|
|
101
|
+
blockers: string[];
|
|
102
|
+
};
|
|
103
|
+
controller?: {
|
|
104
|
+
compatible: boolean;
|
|
105
|
+
blockers: string[];
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
export interface PieLibDetail {
|
|
109
|
+
compatible: boolean;
|
|
110
|
+
usedBy: string[];
|
|
111
|
+
blockers: string[];
|
|
112
|
+
}
|
|
113
|
+
export declare function loadCompatibilityReport(path: string): Promise<CompatibilityReport>;
|
|
114
|
+
export declare function isElementCompatible(element: string, report: CompatibilityReport): boolean;
|
|
115
|
+
export declare function isPieLibPackageCompatible(pkg: string, report: CompatibilityReport): boolean;
|
|
116
|
+
export declare function getElementBlockers(element: string, report: CompatibilityReport): string[];
|
|
117
|
+
/**
|
|
118
|
+
* Check if an element is ESM player ready (no CommonJS deps + proper ESM package structure)
|
|
119
|
+
*/
|
|
120
|
+
export declare function isElementEsmPlayerReady(element: string, report: CompatibilityReport): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Check if an element has student UI ready (even if configure/controller aren't)
|
|
123
|
+
*/
|
|
124
|
+
export declare function isElementStudentUIReady(element: string, report: CompatibilityReport): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Get ESM validation details for an element
|
|
127
|
+
*/
|
|
128
|
+
export declare function getEsmValidation(element: string, report: CompatibilityReport): EsmValidationResult | null;
|
|
129
|
+
//# sourceMappingURL=compatibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compatibility.d.ts","sourceRoot":"","sources":["../../src/utils/compatibility.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW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,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAOxF;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAEzF;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAE3F;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,MAAM,EAAE,CAEzF;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAE7F;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAS7F;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,mBAAmB,GAC1B,mBAAmB,GAAG,IAAI,CAE5B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
export async function loadCompatibilityReport(path) {
|
|
4
|
+
if (!existsSync(path)) {
|
|
5
|
+
throw new Error(`Compatibility report not found at: ${path}`);
|
|
6
|
+
}
|
|
7
|
+
const content = await readFile(path, 'utf-8');
|
|
8
|
+
return JSON.parse(content);
|
|
9
|
+
}
|
|
10
|
+
export function isElementCompatible(element, report) {
|
|
11
|
+
return report.elements.includes(element);
|
|
12
|
+
}
|
|
13
|
+
export function isPieLibPackageCompatible(pkg, report) {
|
|
14
|
+
return report.pieLibPackages.includes(pkg);
|
|
15
|
+
}
|
|
16
|
+
export function getElementBlockers(element, report) {
|
|
17
|
+
return report.blockedElements[element] || [];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Check if an element is ESM player ready (no CommonJS deps + proper ESM package structure)
|
|
21
|
+
*/
|
|
22
|
+
export function isElementEsmPlayerReady(element, report) {
|
|
23
|
+
return report.esmPlayerReady.includes(element);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Check if an element has student UI ready (even if configure/controller aren't)
|
|
27
|
+
*/
|
|
28
|
+
export function isElementStudentUIReady(element, report) {
|
|
29
|
+
const detail = report.elementDetails[element];
|
|
30
|
+
if (!detail)
|
|
31
|
+
return false;
|
|
32
|
+
// If fully compatible, student UI is ready
|
|
33
|
+
if (detail.compatible)
|
|
34
|
+
return true;
|
|
35
|
+
// Check if student UI is explicitly marked as compatible
|
|
36
|
+
return detail.studentUI?.compatible === true;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get ESM validation details for an element
|
|
40
|
+
*/
|
|
41
|
+
export function getEsmValidation(element, report) {
|
|
42
|
+
return report.esmValidation[element] || null;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=compatibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compatibility.js","sourceRoot":"","sources":["../../src/utils/compatibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAkIrC,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,IAAY;IACxD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,sCAAsC,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC9C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAwB,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,MAA2B;IAC9E,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,GAAW,EAAE,MAA2B;IAChF,OAAO,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAe,EAAE,MAA2B;IAC7E,OAAO,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAe,EAAE,MAA2B;IAClF,OAAO,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACjD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAe,EAAE,MAA2B;IAClF,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAC9C,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAE1B,2CAA2C;IAC3C,IAAI,MAAM,CAAC,UAAU;QAAE,OAAO,IAAI,CAAC;IAEnC,yDAAyD;IACzD,OAAO,MAAM,CAAC,SAAS,EAAE,UAAU,KAAK,IAAI,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAe,EACf,MAA2B;IAE3B,OAAO,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JavaScript to TypeScript conversion utilities
|
|
3
|
+
*/
|
|
4
|
+
export interface ConversionMetadata {
|
|
5
|
+
sourcePath: string;
|
|
6
|
+
commit: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ConversionResult {
|
|
9
|
+
code: string;
|
|
10
|
+
hasDefaultObjectExport: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Convert JavaScript to TypeScript
|
|
14
|
+
*/
|
|
15
|
+
export declare function convertJsToTs(jsCode: string, metadata: ConversionMetadata): ConversionResult;
|
|
16
|
+
/**
|
|
17
|
+
* Convert JSX to TSX
|
|
18
|
+
*/
|
|
19
|
+
export declare function convertJsxToTsx(jsxCode: string, metadata: ConversionMetadata): ConversionResult;
|
|
20
|
+
/**
|
|
21
|
+
* Fix imports from default export files
|
|
22
|
+
* Some files export default objects but are imported with named imports
|
|
23
|
+
*/
|
|
24
|
+
export declare function fixImports(content: string, hasDefaultObjectExport: boolean): string;
|
|
25
|
+
//# sourceMappingURL=conversion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversion.d.ts","sourceRoot":"","sources":["../../src/utils/conversion.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB,EAAE,OAAO,CAAC;CACjC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,GAAG,gBAAgB,CA0B5F;AAwDD;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,GAAG,gBAAgB,CAuB/F;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,OAAO,GAAG,MAAM,CAqBnF"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JavaScript to TypeScript conversion utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Convert JavaScript to TypeScript
|
|
6
|
+
*/
|
|
7
|
+
export function convertJsToTs(jsCode, metadata) {
|
|
8
|
+
// We intentionally do NOT transform the JavaScript syntax.
|
|
9
|
+
// Goal: keep upstream source as-is, while letting the monorepo's TS/Vite pipeline build it.
|
|
10
|
+
// TypeScript diagnostics are suppressed for synced files.
|
|
11
|
+
let tsCode = jsCode;
|
|
12
|
+
const hasDefaultObjectExport = false;
|
|
13
|
+
// Convert CommonJS module.exports to ES modules
|
|
14
|
+
tsCode = convertModuleExportsToEsm(tsCode);
|
|
15
|
+
// Must be at the very top of the file to reliably suppress TypeScript diagnostics.
|
|
16
|
+
// We keep synced files buildable even when upstream JS has type issues.
|
|
17
|
+
const tsNoCheck = `// @ts-nocheck\n`;
|
|
18
|
+
// Add sync metadata header
|
|
19
|
+
const header = `/**
|
|
20
|
+
* @synced-from ${metadata.sourcePath}
|
|
21
|
+
* @auto-generated
|
|
22
|
+
*
|
|
23
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
24
|
+
* Manual edits will be overwritten on next sync.
|
|
25
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
`;
|
|
29
|
+
return { code: tsNoCheck + header + tsCode, hasDefaultObjectExport };
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Convert CommonJS module.exports to ES module exports
|
|
33
|
+
*/
|
|
34
|
+
function convertModuleExportsToEsm(content) {
|
|
35
|
+
// Match: module.exports = { key: value, key2: value2, ... };
|
|
36
|
+
const moduleExportsPattern = /module\.exports\s*=\s*\{([\s\S]*?)\};?/;
|
|
37
|
+
const match = content.match(moduleExportsPattern);
|
|
38
|
+
if (!match) {
|
|
39
|
+
return content;
|
|
40
|
+
}
|
|
41
|
+
const [fullMatch, objectContent] = match;
|
|
42
|
+
// Parse the object content into key-value pairs
|
|
43
|
+
const exports = [];
|
|
44
|
+
const lines = objectContent.split('\n');
|
|
45
|
+
let currentKey = null;
|
|
46
|
+
let currentValue = [];
|
|
47
|
+
for (const line of lines) {
|
|
48
|
+
const trimmed = line.trim();
|
|
49
|
+
if (!trimmed || trimmed === '{' || trimmed === '}')
|
|
50
|
+
continue;
|
|
51
|
+
// Check if this line starts a new key
|
|
52
|
+
const keyMatch = trimmed.match(/^(\w+):\s*(.*)/);
|
|
53
|
+
if (keyMatch) {
|
|
54
|
+
// Save previous export if any
|
|
55
|
+
if (currentKey) {
|
|
56
|
+
const value = currentValue.join('\n').replace(/,\s*$/, ''); // Remove trailing comma
|
|
57
|
+
exports.push(`export const ${currentKey} =\n${value};`);
|
|
58
|
+
}
|
|
59
|
+
// Start new export
|
|
60
|
+
currentKey = keyMatch[1];
|
|
61
|
+
currentValue = [keyMatch[2]];
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
// Continuation of current value
|
|
65
|
+
currentValue.push(line);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Save last export
|
|
69
|
+
if (currentKey) {
|
|
70
|
+
const value = currentValue.join('\n').replace(/,\s*$/, '');
|
|
71
|
+
exports.push(`export const ${currentKey} =\n${value};`);
|
|
72
|
+
}
|
|
73
|
+
// Replace the module.exports block with ES module exports
|
|
74
|
+
const esmExports = exports.join('\n\n');
|
|
75
|
+
return content.replace(fullMatch, esmExports);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Convert JSX to TSX
|
|
79
|
+
*/
|
|
80
|
+
export function convertJsxToTsx(jsxCode, metadata) {
|
|
81
|
+
// We intentionally do NOT transform the JavaScript/JSX syntax.
|
|
82
|
+
// Goal: keep upstream source as-is, while letting the monorepo's TS/Vite pipeline build it.
|
|
83
|
+
// TypeScript diagnostics are suppressed for synced files.
|
|
84
|
+
const tsxCode = jsxCode;
|
|
85
|
+
const hasDefaultObjectExport = false;
|
|
86
|
+
// Must be at the very top of the file to reliably suppress TypeScript diagnostics.
|
|
87
|
+
// We keep synced files buildable even when upstream JSX has type issues.
|
|
88
|
+
const tsNoCheck = `// @ts-nocheck\n`;
|
|
89
|
+
// Add sync metadata header
|
|
90
|
+
const header = `/**
|
|
91
|
+
* @synced-from ${metadata.sourcePath}
|
|
92
|
+
* @auto-generated
|
|
93
|
+
*
|
|
94
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
95
|
+
* Manual edits will be overwritten on next sync.
|
|
96
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
`;
|
|
100
|
+
return { code: tsNoCheck + header + tsxCode, hasDefaultObjectExport };
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Fix imports from default export files
|
|
104
|
+
* Some files export default objects but are imported with named imports
|
|
105
|
+
*/
|
|
106
|
+
export function fixImports(content, hasDefaultObjectExport) {
|
|
107
|
+
if (!hasDefaultObjectExport) {
|
|
108
|
+
return content;
|
|
109
|
+
}
|
|
110
|
+
// Convert: import { something } from './file'
|
|
111
|
+
// To: import * as file from './file'
|
|
112
|
+
// This is needed when the imported file has export default {}
|
|
113
|
+
return content.replace(/import\s+{\s*([^}]+)\s*}\s+from\s+(['"]\.\/[^'"]+['"])/g, (_match, _imports, path) => {
|
|
114
|
+
// Extract filename from path
|
|
115
|
+
const filename = path
|
|
116
|
+
.replace(/['"]/g, '')
|
|
117
|
+
.split('/')
|
|
118
|
+
.pop()
|
|
119
|
+
?.replace(/\.\w+$/, '') || 'module';
|
|
120
|
+
return `import * as ${filename} from ${path}`;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=conversion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversion.js","sourceRoot":"","sources":["../../src/utils/conversion.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc,EAAE,QAA4B;IACxE,2DAA2D;IAC3D,4FAA4F;IAC5F,0DAA0D;IAC1D,IAAI,MAAM,GAAG,MAAM,CAAC;IACpB,MAAM,sBAAsB,GAAG,KAAK,CAAC;IAErC,gDAAgD;IAChD,MAAM,GAAG,yBA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IACzE,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC5B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,8CAA8C;IAC9C,qCAAqC;IACrC,8DAA8D;IAC9D,OAAO,OAAO,CAAC,OAAO,CACpB,yDAAyD,EACzD,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;QACzB,6BAA6B;QAC7B,MAAM,QAAQ,GACZ,IAAI;aACD,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;aACpB,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,EAAE;YACN,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,QAAQ,CAAC;QACxC,OAAO,eAAe,QAAQ,SAAS,IAAI,EAAE,CAAC;IAChD,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function getCurrentCommit(cwd: string): string;
|
|
2
|
+
export declare function getCurrentCommitShort(cwd: string): string;
|
|
3
|
+
export declare function getCommitsSince(since: string, cwd: string): string[];
|
|
4
|
+
export declare function getFileModifiedDate(filePath: string, cwd: string): Date;
|
|
5
|
+
export declare function getCommitDetails(commit: string, cwd: string): string;
|
|
6
|
+
export declare function getAuthorName(cwd: string): string;
|
|
7
|
+
//# sourceMappingURL=git.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMpD;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMzD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAYpE;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAWvE;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CASpE;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMjD"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
export function getCurrentCommit(cwd) {
|
|
3
|
+
try {
|
|
4
|
+
return execSync('git rev-parse HEAD', { cwd, encoding: 'utf8' }).trim();
|
|
5
|
+
}
|
|
6
|
+
catch (error) {
|
|
7
|
+
throw new Error(`Failed to get current commit: ${error}`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export function getCurrentCommitShort(cwd) {
|
|
11
|
+
try {
|
|
12
|
+
return execSync('git rev-parse --short HEAD', { cwd, encoding: 'utf8' }).trim();
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
throw new Error(`Failed to get short commit: ${error}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function getCommitsSince(since, cwd) {
|
|
19
|
+
try {
|
|
20
|
+
const output = execSync(`git log ${since}..HEAD --oneline`, {
|
|
21
|
+
cwd,
|
|
22
|
+
encoding: 'utf8',
|
|
23
|
+
}).trim();
|
|
24
|
+
if (!output)
|
|
25
|
+
return [];
|
|
26
|
+
return output.split('\n');
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
throw new Error(`Failed to get commits since ${since}: ${error}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export function getFileModifiedDate(filePath, cwd) {
|
|
33
|
+
try {
|
|
34
|
+
const timestamp = execSync(`git log -1 --format=%ct -- "${filePath}"`, {
|
|
35
|
+
cwd,
|
|
36
|
+
encoding: 'utf8',
|
|
37
|
+
}).trim();
|
|
38
|
+
return new Date(Number.parseInt(timestamp, 10) * 1000);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
throw new Error(`Failed to get file modification date: ${error}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export function getCommitDetails(commit, cwd) {
|
|
45
|
+
try {
|
|
46
|
+
return execSync(`git show --stat ${commit}`, {
|
|
47
|
+
cwd,
|
|
48
|
+
encoding: 'utf8',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
throw new Error(`Failed to get commit details: ${error}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export function getAuthorName(cwd) {
|
|
56
|
+
try {
|
|
57
|
+
return execSync('git config user.name', { cwd, encoding: 'utf8' }).trim();
|
|
58
|
+
}
|
|
59
|
+
catch (_error) {
|
|
60
|
+
return 'Unknown';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,oBAAoB,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,iCAAiC,KAAK,EAAE,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,GAAW;IAC/C,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,4BAA4B,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAClF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,+BAA+B,KAAK,EAAE,CAAC,CAAC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