From 4216880d11ed8dcd5a99cbe7cec134e23b459a9d Mon Sep 17 00:00:00 2001 From: roymondchen Date: Fri, 1 Jul 2022 17:38:33 +0800 Subject: [PATCH] =?UTF-8?q?build:=20runtime=E6=94=AF=E6=8C=81=E7=83=AD?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/package.json | 6 +- packages/core/package.json | 2 +- packages/editor/package.json | 5 +- packages/form/package.json | 5 +- packages/schema/package.json | 2 +- packages/stage/package.json | 2 +- packages/table/package.json | 4 +- packages/ui-vue2/src/page/formConfig.ts | 23 ++- packages/utils/package.json | 2 +- playground/package.json | 6 +- playground/vite.config.ts | 12 +- pnpm-lock.yaml | 231 ++++++++++++++++++------ runtime/react/package.json | 12 +- runtime/react/src/playground/main.tsx | 8 +- runtime/react/vite.config.ts | 87 ++++++--- runtime/vue2/package-lock.json | 14 +- runtime/vue2/package.json | 12 +- runtime/vue2/src/playground/main.ts | 4 +- runtime/vue2/vite.config.ts | 87 ++++++--- runtime/vue3/package.json | 14 +- runtime/vue3/src/playground/main.ts | 6 +- runtime/vue3/vite.config.ts | 84 ++++++--- 22 files changed, 427 insertions(+), 201 deletions(-) diff --git a/docs/package.json b/docs/package.json index f6b74393..a5226b31 100644 --- a/docs/package.json +++ b/docs/package.json @@ -9,9 +9,9 @@ }, "dependencies": { "@element-plus/icons": "0.0.11", - "@tmagic/form": "^1.0.0-rc.7", - "@tmagic/schema": "^1.0.0-rc.7", - "@tmagic/utils": "^1.0.0-rc.7", + "@tmagic/form": "^1.0.2", + "@tmagic/schema": "^1.0.2", + "@tmagic/utils": "^1.0.2", "element-plus": "^2.2.6", "highlight.js": "^11.2.0", "lodash": "^4.17.21", diff --git a/packages/core/package.json b/packages/core/package.json index b0f020b6..e431c2b8 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -40,7 +40,7 @@ "@types/events": "^3.0.0", "@types/node": "^15.12.4", "typescript": "^4.3.4", - "vite": "^2.3.7", + "vite": "^ 2.9.13", "vite-plugin-dts": "^0.9.6" } } diff --git a/packages/editor/package.json b/packages/editor/package.json index 57dad58a..1a3f18d0 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -70,13 +70,12 @@ "@types/lodash-es": "^4.17.4", "@types/node": "^15.12.4", "@types/serialize-javascript": "^5.0.1", - "@vitejs/plugin-vue": "^1.2.3", - "@vitejs/plugin-vue-jsx": "^1.1.6", + "@vitejs/plugin-vue": "^2.3.3", "@vue/compiler-sfc": "^3.2.0", "@vue/test-utils": "^2.0.0", "sass": "^1.35.1", "typescript": "^4.3.4", - "vite": "^2.3.7", + "vite": "^ 2.9.13", "vite-plugin-dts": "^0.9.6", "vue-tsc": "^0.38.2" } diff --git a/packages/form/package.json b/packages/form/package.json index cf5dbe86..fc884748 100644 --- a/packages/form/package.json +++ b/packages/form/package.json @@ -49,13 +49,12 @@ "@types/lodash-es": "^4.17.4", "@types/node": "^15.12.4", "@types/sortablejs": "^1.10.7", - "@vitejs/plugin-vue": "^1.2.3", - "@vitejs/plugin-vue-jsx": "^1.1.6", + "@vitejs/plugin-vue": "^2.3.3", "@vue/compiler-sfc": "^3.2.0", "@vue/test-utils": "^2.0.0", "sass": "^1.35.1", "typescript": "^4.3.4", - "vite": "^2.3.7", + "vite": "^ 2.9.13", "vite-plugin-dts": "^0.9.6", "vue-tsc": "^0.38.2" } diff --git a/packages/schema/package.json b/packages/schema/package.json index 4fd06e61..2d8d29e5 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -19,7 +19,7 @@ "devDependencies": { "@types/node": "^15.12.4", "typescript": "^4.3.4", - "vite": "^2.3.7", + "vite": "^ 2.9.13", "vite-plugin-dts": "^0.9.6" } } diff --git a/packages/stage/package.json b/packages/stage/package.json index 5f20b755..0ca0da3b 100644 --- a/packages/stage/package.json +++ b/packages/stage/package.json @@ -41,7 +41,7 @@ "@types/node": "^15.12.4", "sass": "^1.35.1", "typescript": "^4.3.4", - "vite": "^2.3.7", + "vite": "^ 2.9.13", "vite-plugin-dts": "^0.9.6" } } diff --git a/packages/table/package.json b/packages/table/package.json index 610ce76a..99009207 100644 --- a/packages/table/package.json +++ b/packages/table/package.json @@ -44,12 +44,12 @@ "@types/color": "^3.0.1", "@types/lodash-es": "^4.17.4", "@types/node": "^15.12.4", - "@vitejs/plugin-vue": "^1.2.3", + "@vitejs/plugin-vue": "^2.3.3", "@vue/compiler-sfc": "^3.2.0", "@vue/test-utils": "^2.0.0", "sass": "^1.35.1", "typescript": "^4.3.4", - "vite": "^2.3.7", + "vite": "^ 2.9.13", "vite-plugin-dts": "^0.9.6", "vue-tsc": "^0.38.2" } diff --git a/packages/ui-vue2/src/page/formConfig.ts b/packages/ui-vue2/src/page/formConfig.ts index 9a11d765..54fd0012 100644 --- a/packages/ui-vue2/src/page/formConfig.ts +++ b/packages/ui-vue2/src/page/formConfig.ts @@ -16,4 +16,25 @@ * limitations under the License. */ -export default []; +export default [ + { + text: '页面标识', + name: 'name', + disabled: true, + extra: '在多页面的情况下用来指定要打开的页面', + }, + { + text: '页面标题', + name: 'title', + }, + { + name: 'layout', + text: '容器布局', + type: 'select', + defaultValue: 'absolute', + options: [ + { value: 'absolute', text: '绝对定位' }, + { value: 'relative', text: '流式布局' }, + ], + }, +]; diff --git a/packages/utils/package.json b/packages/utils/package.json index e3d73dbf..762a8b02 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -28,7 +28,7 @@ "devDependencies": { "@types/node": "^15.12.4", "typescript": "^4.3.4", - "vite": "^2.3.7", + "vite": "^ 2.9.13", "vite-plugin-dts": "^0.9.6" } } diff --git a/playground/package.json b/playground/package.json index 4aba2eeb..3f3241c7 100644 --- a/playground/package.json +++ b/playground/package.json @@ -27,12 +27,12 @@ "@types/node": "^15.12.4", "@types/serialize-javascript": "^5.0.1", "@vitejs/plugin-legacy": "^1.8.2", - "@vitejs/plugin-vue": "^1.2.3", - "@vitejs/plugin-vue-jsx": "^1.1.6", + "@vitejs/plugin-vue": "^2.3.3", + "@vitejs/plugin-vue-jsx": "^1.3.10", "@vue/compiler-sfc": "^3.2.0", "sass": "^1.35.1", "typescript": "^4.3.4", - "vite": "^2.3.7", + "vite": "^ 2.9.13", "vue-tsc": "^0.38.2" } } diff --git a/playground/vite.config.ts b/playground/vite.config.ts index e48bead0..89732170 100644 --- a/playground/vite.config.ts +++ b/playground/vite.config.ts @@ -61,17 +61,7 @@ export default defineConfig({ host: '0.0.0.0', port: 8098, proxy: { - '^/tmagic-editor/playground/runtime/react': { - target: 'http://127.0.0.1:8076', - changeOrigin: true, - prependPath: false, - }, - '^/tmagic-editor/playground/runtime/vue2': { - target: 'http://127.0.0.1:8077', - changeOrigin: true, - prependPath: false, - }, - '^/tmagic-editor/playground/runtime/vue3': { + '^/tmagic-editor/playground/runtime': { target: 'http://127.0.0.1:8078', changeOrigin: true, prependPath: false, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 50a061db..8259860f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -110,7 +110,7 @@ importers: '@types/node': ^15.12.4 events: ^3.3.0 typescript: ^4.3.4 - vite: ^2.3.7 + vite: ^ 2.9.13 vite-plugin-dts: ^0.9.6 dependencies: '@tmagic/schema': link:../schema @@ -119,8 +119,8 @@ importers: '@types/events': 3.0.0 '@types/node': 15.14.9 typescript: 4.7.3 - vite: 2.9.10 - vite-plugin-dts: 0.9.10_vite@2.9.10 + vite: 2.9.13 + vite-plugin-dts: 0.9.10_vite@2.9.13 packages/editor: specifiers: @@ -135,8 +135,7 @@ importers: '@types/lodash-es': ^4.17.4 '@types/node': ^15.12.4 '@types/serialize-javascript': ^5.0.1 - '@vitejs/plugin-vue': ^1.2.3 - '@vitejs/plugin-vue-jsx': ^1.1.6 + '@vitejs/plugin-vue': ^2.3.3 '@vue/compiler-sfc': ^3.2.0 '@vue/test-utils': ^2.0.0 buffer: ^6.0.3 @@ -150,7 +149,7 @@ importers: sass: ^1.35.1 serialize-javascript: ^6.0.0 typescript: ^4.3.4 - vite: ^2.3.7 + vite: ^ 2.9.13 vite-plugin-dts: ^0.9.6 vue: ^3.2.0 vue-tsc: ^0.38.2 @@ -177,14 +176,13 @@ importers: '@types/lodash-es': 4.17.6 '@types/node': 15.14.9 '@types/serialize-javascript': 5.0.2 - '@vitejs/plugin-vue': 1.10.2_vite@2.9.10 - '@vitejs/plugin-vue-jsx': 1.3.10 + '@vitejs/plugin-vue': 2.3.3_vite@2.9.13+vue@3.2.37 '@vue/compiler-sfc': 3.2.37 '@vue/test-utils': 2.0.0_vue@3.2.37 sass: 1.52.2 typescript: 4.7.3 - vite: 2.9.10_sass@1.52.2 - vite-plugin-dts: 0.9.10_vite@2.9.10 + vite: 2.9.13_sass@1.52.2 + vite-plugin-dts: 0.9.10_vite@2.9.13 vue-tsc: 0.38.2_typescript@4.7.3 packages/form: @@ -195,8 +193,7 @@ importers: '@types/lodash-es': ^4.17.4 '@types/node': ^15.12.4 '@types/sortablejs': ^1.10.7 - '@vitejs/plugin-vue': ^1.2.3 - '@vitejs/plugin-vue-jsx': ^1.1.6 + '@vitejs/plugin-vue': ^2.3.3 '@vue/compiler-sfc': ^3.2.0 '@vue/test-utils': ^2.0.0 element-plus: ^2.2.6 @@ -205,7 +202,7 @@ importers: sass: ^1.35.1 sortablejs: ^1.14.0 typescript: ^4.3.4 - vite: ^2.3.7 + vite: ^ 2.9.13 vite-plugin-dts: ^0.9.6 vue: ^3.2.0 vue-tsc: ^0.38.2 @@ -222,27 +219,26 @@ importers: '@types/lodash-es': 4.17.6 '@types/node': 15.14.9 '@types/sortablejs': 1.13.0 - '@vitejs/plugin-vue': 1.10.2_vite@2.9.10 - '@vitejs/plugin-vue-jsx': 1.3.10 + '@vitejs/plugin-vue': 2.3.3_vite@2.9.13+vue@3.2.37 '@vue/compiler-sfc': 3.2.37 '@vue/test-utils': 2.0.0_vue@3.2.37 sass: 1.52.2 typescript: 4.7.3 - vite: 2.9.10_sass@1.52.2 - vite-plugin-dts: 0.9.10_vite@2.9.10 + vite: 2.9.13_sass@1.52.2 + vite-plugin-dts: 0.9.10_vite@2.9.13 vue-tsc: 0.38.2_typescript@4.7.3 packages/schema: specifiers: '@types/node': ^15.12.4 typescript: ^4.3.4 - vite: ^2.3.7 + vite: ^ 2.9.13 vite-plugin-dts: ^0.9.6 devDependencies: '@types/node': 15.14.9 typescript: 4.7.3 - vite: 2.9.10 - vite-plugin-dts: 0.9.10_vite@2.9.10 + vite: 2.9.13 + vite-plugin-dts: 0.9.10_vite@2.9.13 packages/stage: specifiers: @@ -259,7 +255,7 @@ importers: moveable-helper: ^0.4.0 sass: ^1.35.1 typescript: ^4.3.4 - vite: ^2.3.7 + vite: ^ 2.9.13 vite-plugin-dts: ^0.9.6 dependencies: '@scena/guides': 0.17.0 @@ -276,8 +272,8 @@ importers: '@types/node': 15.14.9 sass: 1.52.2 typescript: 4.7.3 - vite: 2.9.10_sass@1.52.2 - vite-plugin-dts: 0.9.10_vite@2.9.10 + vite: 2.9.13_sass@1.52.2 + vite-plugin-dts: 0.9.10_vite@2.9.13 packages/table: specifiers: @@ -285,14 +281,14 @@ importers: '@types/color': ^3.0.1 '@types/lodash-es': ^4.17.4 '@types/node': ^15.12.4 - '@vitejs/plugin-vue': ^1.2.3 + '@vitejs/plugin-vue': ^2.3.3 '@vue/compiler-sfc': ^3.2.0 '@vue/test-utils': ^2.0.0 element-plus: ^2.2.6 lodash-es: ^4.17.21 sass: ^1.35.1 typescript: ^4.3.4 - vite: ^2.3.7 + vite: ^ 2.9.13 vite-plugin-dts: ^0.9.6 vue: ^3.2.0 vue-tsc: ^0.38.2 @@ -305,13 +301,13 @@ importers: '@types/color': 3.0.3 '@types/lodash-es': 4.17.6 '@types/node': 15.14.9 - '@vitejs/plugin-vue': 1.10.2_vite@2.9.10 + '@vitejs/plugin-vue': 2.3.3_vite@2.9.13+vue@3.2.37 '@vue/compiler-sfc': 3.2.37 '@vue/test-utils': 2.0.0_vue@3.2.37 sass: 1.52.2 typescript: 4.7.3 - vite: 2.9.10_sass@1.52.2 - vite-plugin-dts: 0.9.10_vite@2.9.10 + vite: 2.9.13_sass@1.52.2 + vite-plugin-dts: 0.9.10_vite@2.9.13 vue-tsc: 0.38.2_typescript@4.7.3 packages/ui: @@ -381,7 +377,7 @@ importers: '@types/node': ^15.12.4 moment: ^2.29.2 typescript: ^4.3.4 - vite: ^2.3.7 + vite: ^ 2.9.13 vite-plugin-dts: ^0.9.6 dependencies: '@tmagic/schema': link:../schema @@ -389,8 +385,8 @@ importers: devDependencies: '@types/node': 15.14.9 typescript: 4.7.3 - vite: 2.9.10 - vite-plugin-dts: 0.9.10_vite@2.9.10 + vite: 2.9.13 + vite-plugin-dts: 0.9.10_vite@2.9.13 playground: specifiers: @@ -403,15 +399,15 @@ importers: '@types/node': ^15.12.4 '@types/serialize-javascript': ^5.0.1 '@vitejs/plugin-legacy': ^1.8.2 - '@vitejs/plugin-vue': ^1.2.3 - '@vitejs/plugin-vue-jsx': ^1.1.6 + '@vitejs/plugin-vue': ^2.3.3 + '@vitejs/plugin-vue-jsx': ^1.3.10 '@vue/compiler-sfc': ^3.2.0 element-plus: ^2.2.6 monaco-editor: ^0.32.1 sass: ^1.35.1 serialize-javascript: ^6.0.0 typescript: ^4.3.4 - vite: ^2.3.7 + vite: ^ 2.9.13 vue: ^3.2.0 vue-router: ^4.0.10 vue-tsc: ^0.38.2 @@ -430,13 +426,13 @@ importers: devDependencies: '@types/node': 15.14.9 '@types/serialize-javascript': 5.0.2 - '@vitejs/plugin-legacy': 1.8.2_vite@2.9.10 - '@vitejs/plugin-vue': 1.10.2_vite@2.9.10 + '@vitejs/plugin-legacy': 1.8.2_vite@2.9.13 + '@vitejs/plugin-vue': 2.3.3_vite@2.9.13+vue@3.2.37 '@vitejs/plugin-vue-jsx': 1.3.10 '@vue/compiler-sfc': 3.2.37 sass: 1.52.2 typescript: 4.7.3 - vite: 2.9.10_sass@1.52.2 + vite: 2.9.13_sass@1.52.2 vue-tsc: 0.38.2_typescript@4.7.3 runtime/react: @@ -450,7 +446,7 @@ importers: react-dom: ^17.0.2 recast: ^0.20.4 typescript: ^4.3.4 - vite: ^2.3.7 + vite: ^ 2.9.13 dependencies: '@tmagic/schema': link:../../packages/schema '@tmagic/stage': link:../../packages/stage @@ -462,7 +458,7 @@ importers: '@vitejs/plugin-react-refresh': 1.3.6 recast: 0.20.5 typescript: 4.7.3 - vite: 2.9.10 + vite: 2.9.13 runtime/vue2: specifiers: @@ -475,7 +471,7 @@ importers: rollup: ^2.25.0 rollup-plugin-external-globals: ^0.6.1 sass: ^1.35.1 - vite: ^2.3.7 + vite: ^ 2.9.13 vite-plugin-vue2: ^2.0.1 vue: ^2.6.14 vue-template-compiler: ^2.6.14 @@ -491,8 +487,8 @@ importers: rollup: 2.75.5 rollup-plugin-external-globals: 0.6.1_rollup@2.75.5 sass: 1.52.2 - vite: 2.9.10_sass@1.52.2 - vite-plugin-vue2: 2.0.1_5jesfqc2ouaeplxglzazh5atyu + vite: 2.9.13_sass@1.52.2 + vite-plugin-vue2: 2.0.1_rjze3w2zsgj4z24tnggj7hdbyq vue-template-compiler: 2.6.14 runtime/vue3: @@ -500,7 +496,7 @@ importers: '@tmagic/schema': 1.0.2 '@tmagic/stage': 1.0.2 '@types/node': ^15.12.4 - '@vitejs/plugin-vue': ^1.2.3 + '@vitejs/plugin-vue': ^2.3.3 '@vue/compiler-sfc': ^3.2.0 '@vue/test-utils': ^2.0.0 axios: ^0.25.0 @@ -509,7 +505,7 @@ importers: rollup-plugin-external-globals: ^0.6.1 sass: ^1.35.1 typescript: ^4.3.4 - vite: ^2.3.7 + vite: ^ 2.9.13 vue: ^3.2.0 vue-tsc: ^0.38.2 dependencies: @@ -519,7 +515,7 @@ importers: vue: 3.2.37 devDependencies: '@types/node': 15.14.9 - '@vitejs/plugin-vue': 1.10.2_vite@2.9.10 + '@vitejs/plugin-vue': 2.3.3_vite@2.9.13+vue@3.2.37 '@vue/compiler-sfc': 3.2.37 '@vue/test-utils': 2.0.0_vue@3.2.37 recast: 0.20.5 @@ -527,7 +523,7 @@ importers: rollup-plugin-external-globals: 0.6.1_rollup@2.75.5 sass: 1.52.2 typescript: 4.7.3 - vite: 2.9.10_sass@1.52.2 + vite: 2.9.13_sass@1.52.2 vue-tsc: 0.38.2_typescript@4.7.3 packages: @@ -1775,7 +1771,7 @@ packages: eslint-visitor-keys: 2.1.0 dev: true - /@vitejs/plugin-legacy/1.8.2_vite@2.9.10: + /@vitejs/plugin-legacy/1.8.2_vite@2.9.13: resolution: {integrity: sha512-NCOKU+pU+cxLMR9P9RTolEuOK+h+zYBXlknj+zGcKSj/NXBZYgA1GAH1FnO4zijoWRiTaiOm2ha9LQrELE7XHg==} engines: {node: '>=12.0.0'} peerDependencies: @@ -1786,7 +1782,7 @@ packages: magic-string: 0.26.2 regenerator-runtime: 0.13.9 systemjs: 6.12.1 - vite: 2.9.10_sass@1.52.2 + vite: 2.9.13_sass@1.52.2 dev: true /@vitejs/plugin-react-refresh/1.3.6: @@ -1837,6 +1833,17 @@ packages: vue: 3.2.37 dev: true + /@vitejs/plugin-vue/2.3.3_vite@2.9.13+vue@3.2.37: + resolution: {integrity: sha512-SmQLDyhz+6lGJhPELsBdzXGc+AcaT8stgkbiTFGpXPe8Tl1tJaBw1A6pxDqDuRsVkD8uscrkx3hA7QDOoKYtyw==} + engines: {node: '>=12.0.0'} + peerDependencies: + vite: ^2.5.10 + vue: ^3.2.25 + dependencies: + vite: 2.9.13_sass@1.52.2 + vue: 3.2.37 + dev: true + /@volar/code-gen/0.38.2: resolution: {integrity: sha512-H81I6d7rZB7teqL+zhK/Xz1v0/kKkUwkB0Aq6b4+BTCqcJeiZkoWxd0gFhrhWTnUoqiM83lhoTGo2vkvx5YagQ==} dependencies: @@ -7086,7 +7093,7 @@ packages: dev: true /svg-tags/1.0.0: - resolution: {integrity: sha1-WPcc7jvVGbWdSyqEO2x95krAR2Q=} + resolution: {integrity: sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA==} dev: true /symbol-tree/3.2.4: @@ -7411,7 +7418,7 @@ packages: spdx-expression-parse: 3.0.1 dev: true - /vite-plugin-dts/0.9.10_vite@2.9.10: + /vite-plugin-dts/0.9.10_vite@2.9.13: resolution: {integrity: sha512-dNfFJXRsm3YW8k+Wm8SesSaEGOaicKdgFz5PoUpT9zUh6URr5cwu5NMOBhJgiofrzcuYtOU2Ez7JQtg68RII8g==} engines: {node: '>=12.0.0'} peerDependencies: @@ -7420,7 +7427,7 @@ packages: fast-glob: 3.2.11 fs-extra: 10.1.0 ts-morph: 13.0.3 - vite: 2.9.10 + vite: 2.9.13 dev: true /vite-plugin-vue2/2.0.1_5jesfqc2ouaeplxglzazh5atyu: @@ -7517,6 +7524,100 @@ packages: - whiskers dev: true + /vite-plugin-vue2/2.0.1_rjze3w2zsgj4z24tnggj7hdbyq: + resolution: {integrity: sha512-8ixcIDZwk3PSbdaqKrPFYDot044lPLIqpjjuRXUDHdRhml87Kbc6JqLq6uwHERlPovwfI3DpluWRMVgn/Llmag==} + peerDependencies: + vite: ^2.0.0 + vue-template-compiler: ^2.2.0 + dependencies: + '@babel/core': 7.18.2 + '@babel/parser': 7.18.4 + '@babel/plugin-proposal-class-properties': 7.17.12_@babel+core@7.18.2 + '@babel/plugin-proposal-decorators': 7.18.2_@babel+core@7.18.2 + '@babel/plugin-proposal-nullish-coalescing-operator': 7.17.12_@babel+core@7.18.2 + '@babel/plugin-proposal-object-rest-spread': 7.18.0_@babel+core@7.18.2 + '@babel/plugin-proposal-optional-chaining': 7.17.12_@babel+core@7.18.2 + '@babel/plugin-transform-arrow-functions': 7.17.12_@babel+core@7.18.2 + '@babel/plugin-transform-block-scoping': 7.18.4_@babel+core@7.18.2 + '@babel/plugin-transform-computed-properties': 7.17.12_@babel+core@7.18.2 + '@babel/plugin-transform-destructuring': 7.18.0_@babel+core@7.18.2 + '@babel/plugin-transform-parameters': 7.17.12_@babel+core@7.18.2 + '@babel/plugin-transform-spread': 7.17.12_@babel+core@7.18.2 + '@babel/plugin-transform-typescript': 7.18.4_@babel+core@7.18.2 + '@rollup/pluginutils': 4.2.1 + '@vue/babel-helper-vue-jsx-merge-props': 1.2.1 + '@vue/babel-preset-jsx': 1.2.4_@babel+core@7.18.2 + '@vue/component-compiler-utils': 3.3.0 + consolidate: 0.16.0 + debug: 4.3.4 + fs-extra: 10.1.0 + hash-sum: 2.0.0 + magic-string: 0.26.2 + prettier: 2.6.2 + querystring: 0.2.1 + rollup: 2.75.5 + slash: 3.0.0 + source-map: 0.7.4 + vite: 2.9.13_sass@1.52.2 + vue-template-babel-compiler: 1.2.0_ev5jzj74xu2fombjvobqpq452a + vue-template-compiler: 2.6.14 + transitivePeerDependencies: + - arc-templates + - atpl + - babel-core + - bracket-template + - coffee-script + - dot + - dust + - dustjs-helpers + - dustjs-linkedin + - eco + - ect + - ejs + - haml-coffee + - hamlet + - hamljs + - handlebars + - hogan.js + - htmling + - jade + - jazz + - jqtpl + - just + - liquid-node + - liquor + - lodash + - marko + - mote + - mustache + - nunjucks + - plates + - pug + - qejs + - ractive + - razor-tmpl + - react + - react-dom + - slm + - squirrelly + - supports-color + - swig + - swig-templates + - teacup + - templayed + - then-jade + - then-pug + - tinyliquid + - toffee + - twig + - twing + - underscore + - vash + - velocityjs + - walrus + - whiskers + dev: true + /vite/2.9.10: resolution: {integrity: sha512-TwZRuSMYjpTurLqXspct+HZE7ONiW9d+wSWgvADGxhDPPyoIcNywY+RX4ng+QpK30DCa1l/oZgi2PLZDibhzbQ==} engines: {node: '>=12.2.0'} @@ -7541,8 +7642,32 @@ packages: fsevents: 2.3.2 dev: true - /vite/2.9.10_sass@1.52.2: - resolution: {integrity: sha512-TwZRuSMYjpTurLqXspct+HZE7ONiW9d+wSWgvADGxhDPPyoIcNywY+RX4ng+QpK30DCa1l/oZgi2PLZDibhzbQ==} + /vite/2.9.13: + resolution: {integrity: sha512-AsOBAaT0AD7Mhe8DuK+/kE4aWYFMx/i0ZNi98hJclxb4e0OhQcZYUrvLjIaQ8e59Ui7txcvKMiJC1yftqpQoDw==} + engines: {node: '>=12.2.0'} + hasBin: true + peerDependencies: + less: '*' + sass: '*' + stylus: '*' + peerDependenciesMeta: + less: + optional: true + sass: + optional: true + stylus: + optional: true + dependencies: + esbuild: 0.14.42 + postcss: 8.4.14 + resolve: 1.22.0 + rollup: 2.75.5 + optionalDependencies: + fsevents: 2.3.2 + dev: true + + /vite/2.9.13_sass@1.52.2: + resolution: {integrity: sha512-AsOBAaT0AD7Mhe8DuK+/kE4aWYFMx/i0ZNi98hJclxb4e0OhQcZYUrvLjIaQ8e59Ui7txcvKMiJC1yftqpQoDw==} engines: {node: '>=12.2.0'} hasBin: true peerDependencies: diff --git a/runtime/react/package.json b/runtime/react/package.json index 174e56f2..a53dd3af 100644 --- a/runtime/react/package.json +++ b/runtime/react/package.json @@ -3,10 +3,12 @@ "version": "1.0.2", "private": true, "scripts": { - "dev:react": "npm run build && npm run serve", - "start": "node scripts/dev.js && vite", - "build": "node scripts/build.js && vite build", - "serve": "vite preview --port 8076" + "dev:react": "npm run entry && npm run build:lib & npm run dev:html", + "build": "npm run entry && vite build", + "serve": "vite preview", + "entry": "node scripts/build.js", + "build:lib": "vite build --mode lib", + "dev:html": "vite --port 8078" }, "dependencies": { "@tmagic/schema": "1.0.2", @@ -24,6 +26,6 @@ "@vitejs/plugin-react-refresh": "^1.3.1", "recast": "^0.20.4", "typescript": "^4.3.4", - "vite": "^2.3.7" + "vite": "^ 2.9.13" } } diff --git a/runtime/react/src/playground/main.tsx b/runtime/react/src/playground/main.tsx index 7ef00a27..d0abf6ca 100644 --- a/runtime/react/src/playground/main.tsx +++ b/runtime/react/src/playground/main.tsx @@ -20,16 +20,14 @@ import React from 'react'; import ReactDOM from 'react-dom'; import Core from '@tmagic/core'; -import { MApp } from '@tmagic/schema'; -import { RemoveData, SortEventData, UpdateData } from '@tmagic/stage'; +import type { MApp } from '@tmagic/schema'; +import type { RemoveData, SortEventData, UpdateData } from '@tmagic/stage'; import { AppContent } from '@tmagic/ui-react'; import { getUrlParam } from '@tmagic/utils'; import App from './App'; -const componentUrl = '/tmagic-editor/playground/runtime/react/assets/components.js'; - -import(componentUrl).then(() => { +import('../comp-entry').then(() => { const { components } = window.magicPresetComponents; const app = new Core({ diff --git a/runtime/react/vite.config.ts b/runtime/react/vite.config.ts index 18c4c37e..131c0714 100644 --- a/runtime/react/vite.config.ts +++ b/runtime/react/vite.config.ts @@ -18,47 +18,76 @@ import path from 'path'; -import { defineConfig } from 'vite'; +import { defineConfig, loadEnv } from 'vite'; import reactRefresh from '@vitejs/plugin-react-refresh'; -// https://vitejs.dev/config/ -export default defineConfig({ - base: '/tmagic-editor/playground/runtime/react', - plugins: [reactRefresh()], +export default defineConfig(({ command, mode }) => { + const { WATCH_INCLUDE = '' } = loadEnv(mode, process.cwd(), ''); + const libInput = { + config: './src/config-entry.ts', + value: './src/value-entry.ts', + event: './src/event-entry.ts', + }; - resolve: { - alias: [ - { find: /^react$/, replacement: path.join(__dirname, 'node_modules/react/index.js') }, - { find: /^react-dom$/, replacement: path.join(__dirname, 'node_modules/react-dom/index.js') }, - { find: /^@tmagic\/ui-react/, replacement: path.join(__dirname, '../../packages/ui-react/src/index.ts') }, - { find: /^@tmagic\/utils/, replacement: path.join(__dirname, '../../packages/utils/src/index.ts') }, - { find: /^@tmagic\/core/, replacement: path.join(__dirname, '../../packages/core/src/index.ts') }, - { find: /^@tmagic\/schema/, replacement: path.join(__dirname, '../../packages/schema/src/index.ts') }, - ], - }, + const htmlInput = { + page: './page.html', + playground: './playground.html', + }; - server: { - host: '0.0.0.0', - port: 8090, - }, + const devInput = mode === 'lib' ? libInput : htmlInput; - build: { + const buildConfig = { sourcemap: true, cssCodeSplit: false, rollupOptions: { - input: { - page: './page.html', - playground: './playground.html', - components: './src/comp-entry.ts', - config: './src/config-entry.ts', - value: './src/value-entry.ts', - event: './src/event-entry.ts', - }, + input: + command === 'build' && mode !== 'lib' + ? { + ...htmlInput, + ...libInput, + } + : devInput, output: { entryFileNames: 'assets/[name].js', }, }, - }, + }; + + if (mode === 'lib') { + return { + build: { + ...buildConfig, + watch: { + include: WATCH_INCLUDE.split(','), + }, + }, + }; + } + + return { + base: '/tmagic-editor/playground/runtime/react', + + plugins: [reactRefresh()], + + resolve: { + alias: [ + { find: /^react$/, replacement: path.join(__dirname, 'node_modules/react/index.js') }, + { find: /^react-dom$/, replacement: path.join(__dirname, 'node_modules/react-dom/index.js') }, + { find: /^@tmagic\/ui-react/, replacement: path.join(__dirname, '../../packages/ui-react/src/index.ts') }, + { find: /^@tmagic\/utils/, replacement: path.join(__dirname, '../../packages/utils/src/index.ts') }, + { find: /^@tmagic\/core/, replacement: path.join(__dirname, '../../packages/core/src/index.ts') }, + { find: /^@tmagic\/schema/, replacement: path.join(__dirname, '../../packages/schema/src/index.ts') }, + ], + }, + + publicDir: command === 'serve' ? 'dist' : 'public', + + server: { + host: '0.0.0.0', + }, + + build: buildConfig, + }; }); diff --git a/runtime/vue2/package-lock.json b/runtime/vue2/package-lock.json index d54c0524..5a622558 100644 --- a/runtime/vue2/package-lock.json +++ b/runtime/vue2/package-lock.json @@ -20,7 +20,7 @@ "rollup": "^2.25.0", "rollup-plugin-external-globals": "^0.6.1", "sass": "^1.35.1", - "vite": "^2.3.7", + "vite": "^ 2.9.13", "vite-plugin-vue2": "^2.0.1", "vue-template-compiler": "^2.6.14" } @@ -2648,9 +2648,9 @@ "dev": true }, "node_modules/vite": { - "version": "2.9.10", - "resolved": "https://registry.npmjs.org/vite/-/vite-2.9.10.tgz", - "integrity": "sha512-TwZRuSMYjpTurLqXspct+HZE7ONiW9d+wSWgvADGxhDPPyoIcNywY+RX4ng+QpK30DCa1l/oZgi2PLZDibhzbQ==", + "version": "2.9.13", + "resolved": "https://registry.npmjs.org/vite/-/vite-2.9.13.tgz", + "integrity": "sha512-AsOBAaT0AD7Mhe8DuK+/kE4aWYFMx/i0ZNi98hJclxb4e0OhQcZYUrvLjIaQ8e59Ui7txcvKMiJC1yftqpQoDw==", "dev": true, "dependencies": { "esbuild": "^0.14.27", @@ -4676,9 +4676,9 @@ "dev": true }, "vite": { - "version": "2.9.10", - "resolved": "https://registry.npmjs.org/vite/-/vite-2.9.10.tgz", - "integrity": "sha512-TwZRuSMYjpTurLqXspct+HZE7ONiW9d+wSWgvADGxhDPPyoIcNywY+RX4ng+QpK30DCa1l/oZgi2PLZDibhzbQ==", + "version": "2.9.13", + "resolved": "https://registry.npmjs.org/vite/-/vite-2.9.13.tgz", + "integrity": "sha512-AsOBAaT0AD7Mhe8DuK+/kE4aWYFMx/i0ZNi98hJclxb4e0OhQcZYUrvLjIaQ8e59Ui7txcvKMiJC1yftqpQoDw==", "dev": true, "requires": { "esbuild": "^0.14.27", diff --git a/runtime/vue2/package.json b/runtime/vue2/package.json index d8f31c92..f099165a 100644 --- a/runtime/vue2/package.json +++ b/runtime/vue2/package.json @@ -3,10 +3,12 @@ "version": "1.0.2", "private": true, "scripts": { - "dev:vue2": "npm run build && npm run serve", - "start": "node scripts/dev.js && vite", - "build": "node scripts/build.js && vite build", - "serve": "vite preview --port 8077" + "dev:vue2": "npm run entry && npm run build:lib & npm run dev:html", + "build": "npm run entry && vite build", + "serve": "vite preview", + "entry": "node scripts/build.js", + "build:lib": "vite build --mode lib", + "dev:html": "vite --port 8078" }, "dependencies": { "@tmagic/schema": "1.0.2", @@ -21,7 +23,7 @@ "rollup": "^2.25.0", "rollup-plugin-external-globals": "^0.6.1", "sass": "^1.35.1", - "vite": "^2.3.7", + "vite": "^ 2.9.13", "vite-plugin-vue2": "^2.0.1", "vue-template-compiler": "^2.6.14" } diff --git a/runtime/vue2/src/playground/main.ts b/runtime/vue2/src/playground/main.ts index fd2fb628..3647046e 100644 --- a/runtime/vue2/src/playground/main.ts +++ b/runtime/vue2/src/playground/main.ts @@ -20,9 +20,7 @@ import Vue from 'vue'; import App from './App.vue'; -const componentUrl = '/tmagic-editor/playground/runtime/vue2/assets/components.js'; - -import(componentUrl).then(() => { +import('../comp-entry').then(() => { const { components, plugins } = window.magicPresetComponents; Object.values(components).forEach((component: any) => { diff --git a/runtime/vue2/vite.config.ts b/runtime/vue2/vite.config.ts index 6a9e3323..40aa4bfa 100644 --- a/runtime/vue2/vite.config.ts +++ b/runtime/vue2/vite.config.ts @@ -18,47 +18,78 @@ import path from 'path'; -import { defineConfig } from 'vite'; +import { defineConfig, loadEnv } from 'vite'; import { createVuePlugin } from 'vite-plugin-vue2'; // @ts-ignore import externalGlobals from 'rollup-plugin-external-globals'; -export default defineConfig({ - base: '/tmagic-editor/playground/runtime/vue2', - plugins: [createVuePlugin(), externalGlobals({ vue: 'Vue' }, { exclude: ['page.html', 'playground.html'] })], +export default defineConfig(({ command, mode }) => { + const { WATCH_INCLUDE = '' } = loadEnv(mode, process.cwd(), ''); + const libInput = { + config: './src/config-entry.ts', + value: './src/value-entry.ts', + event: './src/event-entry.ts', + }; - resolve: { - alias: [ - { find: /^vue$/, replacement: path.join(__dirname, 'node_modules/vue/dist/vue.esm.js') }, - { find: /^@vue\/composition-api$/, replacement: path.join(__dirname, 'node_modules/@vue/composition-api') }, - { find: /^@tmagic\/ui-vue2/, replacement: path.join(__dirname, '../../packages/ui-vue2/src/index.ts') }, - { find: /^@tmagic\/utils/, replacement: path.join(__dirname, '../../packages/utils/src/index.ts') }, - { find: /^@tmagic\/core/, replacement: path.join(__dirname, '../../packages/core/src/index.ts') }, - { find: /^@tmagic\/schema/, replacement: path.join(__dirname, '../../packages/schema/src/index.ts') }, - ], - }, + const htmlInput = { + page: './page.html', + playground: './playground.html', + }; - server: { - host: '0.0.0.0', - port: 8089, - }, - build: { + const devInput = mode === 'lib' ? libInput : htmlInput; + + const buildConfig = { sourcemap: true, cssCodeSplit: false, rollupOptions: { - input: { - page: './page.html', - playground: './playground.html', - components: './src/comp-entry.ts', - config: './src/config-entry.ts', - value: './src/value-entry.ts', - event: './src/event-entry.ts', - }, + input: + command === 'build' && mode !== 'lib' + ? { + ...htmlInput, + ...libInput, + } + : devInput, output: { entryFileNames: 'assets/[name].js', }, }, - }, + }; + + if (mode === 'lib') { + return { + build: { + ...buildConfig, + watch: { + include: WATCH_INCLUDE.split(','), + }, + }, + }; + } + + return { + base: '/tmagic-editor/playground/runtime/vue2', + + plugins: [createVuePlugin(), externalGlobals({ vue: 'Vue' }, { exclude: ['page.html', 'playground.html'] })], + + resolve: { + alias: [ + { find: /^vue$/, replacement: path.join(__dirname, 'node_modules/vue/dist/vue.esm.js') }, + { find: /^@vue\/composition-api$/, replacement: path.join(__dirname, 'node_modules/@vue/composition-api') }, + { find: /^@tmagic\/ui-vue2/, replacement: path.join(__dirname, '../../packages/ui-vue2/src/index.ts') }, + { find: /^@tmagic\/utils/, replacement: path.join(__dirname, '../../packages/utils/src/index.ts') }, + { find: /^@tmagic\/core/, replacement: path.join(__dirname, '../../packages/core/src/index.ts') }, + { find: /^@tmagic\/schema/, replacement: path.join(__dirname, '../../packages/schema/src/index.ts') }, + ], + }, + + publicDir: command === 'serve' ? 'dist' : 'public', + + server: { + host: '0.0.0.0', + }, + + build: buildConfig, + }; }); diff --git a/runtime/vue3/package.json b/runtime/vue3/package.json index bbce2724..21ff95b7 100644 --- a/runtime/vue3/package.json +++ b/runtime/vue3/package.json @@ -3,10 +3,12 @@ "version": "1.0.2", "private": true, "scripts": { - "dev": "npm run build && npm run serve", - "start": "node scripts/dev.js && vite", - "build": "node scripts/build.js && vite build", - "serve": "vite preview --port 8078" + "dev": "npm run entry && npm run build:lib & npm run dev:html", + "build": "npm run entry && vite build", + "serve": "vite preview", + "entry": "node scripts/build.js", + "build:lib": "vite build --mode lib", + "dev:html": "vite --port 8078" }, "dependencies": { "@tmagic/schema": "1.0.2", @@ -16,7 +18,7 @@ }, "devDependencies": { "@types/node": "^15.12.4", - "@vitejs/plugin-vue": "^1.2.3", + "@vitejs/plugin-vue": "^2.3.3", "@vue/compiler-sfc": "^3.2.0", "@vue/test-utils": "^2.0.0", "recast": "^0.20.4", @@ -24,7 +26,7 @@ "rollup-plugin-external-globals": "^0.6.1", "sass": "^1.35.1", "typescript": "^4.3.4", - "vite": "^2.3.7", + "vite": "^ 2.9.13", "vue-tsc": "^0.38.2" } } diff --git a/runtime/vue3/src/playground/main.ts b/runtime/vue3/src/playground/main.ts index 7165d18d..bdc382de 100644 --- a/runtime/vue3/src/playground/main.ts +++ b/runtime/vue3/src/playground/main.ts @@ -20,11 +20,9 @@ import { createApp } from 'vue'; import App from './App.vue'; -const componentUrl = '/tmagic-editor/playground/runtime/vue3/assets/components.js'; - -import(componentUrl).then(() => { +import('../comp-entry').then((entry) => { + const { components, plugins } = entry.default; const magicApp = createApp(App); - const { components, plugins } = window.magicPresetComponents; Object.values(components).forEach((component: any) => { magicApp.component(component.name, component); diff --git a/runtime/vue3/vite.config.ts b/runtime/vue3/vite.config.ts index 82cf8899..5e02f2de 100644 --- a/runtime/vue3/vite.config.ts +++ b/runtime/vue3/vite.config.ts @@ -18,46 +18,78 @@ import path from 'path'; -import { defineConfig } from 'vite'; +import { defineConfig, loadEnv } from 'vite'; import vue from '@vitejs/plugin-vue'; +// @ts-ignore import vueJsx from '@vitejs/plugin-vue-jsx'; // @ts-ignore import externalGlobals from 'rollup-plugin-external-globals'; -export default defineConfig({ - base: '/tmagic-editor/playground/runtime/vue3', - plugins: [vue(), vueJsx(), externalGlobals({ vue: 'Vue' }, { exclude: ['page.html', 'playground.html'] })], +export default defineConfig(({ command, mode }) => { + const { WATCH_INCLUDE = '' } = loadEnv(mode, process.cwd(), ''); + const libInput = { + config: './src/config-entry.ts', + value: './src/value-entry.ts', + event: './src/event-entry.ts', + }; - resolve: { - alias: [ - { find: /^vue$/, replacement: path.join(__dirname, 'node_modules/vue/dist/vue.esm-bundler.js') }, - { find: /^@tmagic\/utils/, replacement: path.join(__dirname, '../../packages/utils/src/index.ts') }, - { find: /^@tmagic\/core/, replacement: path.join(__dirname, '../../packages/core/src/index.ts') }, - { find: /^@tmagic\/schema/, replacement: path.join(__dirname, '../../packages/schema/src/index.ts') }, - ], - }, + const htmlInput = { + page: './page.html', + playground: './playground.html', + }; - server: { - host: '0.0.0.0', - port: 8089, - }, - build: { + const devInput = mode === 'lib' ? libInput : htmlInput; + + const buildConfig = { sourcemap: true, cssCodeSplit: false, rollupOptions: { - input: { - page: './page.html', - playground: './playground.html', - components: './src/comp-entry.ts', - config: './src/config-entry.ts', - value: './src/value-entry.ts', - event: './src/event-entry.ts', - }, + input: + command === 'build' && mode !== 'lib' + ? { + ...htmlInput, + ...libInput, + } + : devInput, output: { entryFileNames: 'assets/[name].js', }, }, - }, + }; + + if (mode === 'lib') { + return { + build: { + ...buildConfig, + watch: { + include: WATCH_INCLUDE.split(','), + }, + }, + }; + } + + return { + base: '/tmagic-editor/playground/runtime/vue3', + + plugins: [vue(), vueJsx(), externalGlobals({ vue: 'Vue' }, { exclude: ['page.html', 'playground.html'] })], + + resolve: { + alias: [ + { find: /^vue$/, replacement: path.join(__dirname, 'node_modules/vue/dist/vue.esm-bundler.js') }, + { find: /^@tmagic\/utils/, replacement: path.join(__dirname, '../../packages/utils/src/index.ts') }, + { find: /^@tmagic\/core/, replacement: path.join(__dirname, '../../packages/core/src/index.ts') }, + { find: /^@tmagic\/schema/, replacement: path.join(__dirname, '../../packages/schema/src/index.ts') }, + ], + }, + + publicDir: command === 'serve' ? 'dist' : 'public', + + server: { + host: '0.0.0.0', + }, + + build: buildConfig, + }; });