From d95861cd31e9ab56cf47654f9f4a08f984d36c63 Mon Sep 17 00:00:00 2001 From: Treecat Date: Fri, 21 Apr 2023 14:02:17 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-14316=20fix:=E5=AE=9A=E6=97=B6=E8=B0=83?= =?UTF-8?q?=E5=BA=A6=E7=9B=B8=E5=85=B3=E7=9A=84=20BUG=20=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 5 +++-- packages/demo/src/main.js | 2 +- packages/fineui/esm.babel.js | 18 ++++++++++++++++++ packages/fineui/src/core/5.inject.js | 6 ++++++ .../platform/web/jquery/jquery.polyfill.js | 4 ++-- packages/fineui/src/index.js | 4 +--- packages/fineui/typescript/bundle.ts | 4 ++-- packages/fineui/webpack/attachments.js | 2 ++ 8 files changed, 35 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 06c697c02..1878b8ae7 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "@babel/core": "^7.21.0", "@babel/runtime": "^7.21.0", "@fui/babel-preset-fineui": "^3.0.1", + "@types/node": "^18.15.11", "autoprefixer": "^10.4.14", "babel-loader": "^9.1.2", "babel-plugin-module-resolver": "^5.0.0", @@ -29,6 +30,7 @@ "css-loader": "^6.7.3", "css-minimizer-webpack-plugin": "^5.0.0", "fork-ts-checker-webpack-plugin": "^8.0.0", + "glob": "^9.3.4", "html-webpack-plugin": "^5.5.0", "less": "^4.1.3", "less-loader": "^11.1.0", @@ -36,11 +38,10 @@ "npm-run-all": "^4.1.5", "postcss": "^8.4.21", "postcss-loader": "^7.1.0", - "glob": "^9.3.4", "style-loader": "^3.3.1", "terser-webpack-plugin": "^5.3.7", + "ts-node": "^10.9.1", "typescript": "^4.9.5", - "uglifyjs-webpack-plugin": "^2.2.0", "webpack": "^5.75.0", "webpack-bundle-analyzer": "^4.8.0", "webpack-cli": "^5.0.1", diff --git a/packages/demo/src/main.js b/packages/demo/src/main.js index 02f8f32ed..ecfe5095b 100644 --- a/packages/demo/src/main.js +++ b/packages/demo/src/main.js @@ -1,4 +1,4 @@ -import { shortcut, Widget, BorderLayout, Label } from "@fui/core"; +import { shortcut, Widget, BorderLayout } from "@fui/core"; import { West } from "./west"; import { Center } from "./center"; import { North } from "./north"; diff --git a/packages/fineui/esm.babel.js b/packages/fineui/esm.babel.js index b2f93ed08..f6cf3fc75 100644 --- a/packages/fineui/esm.babel.js +++ b/packages/fineui/esm.babel.js @@ -1,5 +1,23 @@ +const { resolve } = require("path"); +const modules = ["./core/platform/web/config"]; + module.exports = { plugins: [ + function (babel) { + const { types: t } = babel; + return { + visitor: { + Program(path) { + if (path.hub.file.opts.filename === resolve(__dirname, "src/index.js")) { + for (let i = 0; i < modules.length; i++) { + const importStatement = t.importDeclaration([], t.stringLiteral(modules[i])); + path.pushContainer("body", importStatement); + } + } + }, + }, + }; + }, [ "@babel/plugin-proposal-decorators", { diff --git a/packages/fineui/src/core/5.inject.js b/packages/fineui/src/core/5.inject.js index 2654940b7..a2f621ad6 100644 --- a/packages/fineui/src/core/5.inject.js +++ b/packages/fineui/src/core/5.inject.js @@ -403,6 +403,12 @@ export function shortcut(xtype, cls) { if (cls) { cls.xtype = xtype; } + + // 兼容性 + if(!cls.superclass) { + cls.superclass = Object.getPrototypeOf(cls.prototype); + } + kv[xtype] = cls; } diff --git a/packages/fineui/src/core/platform/web/jquery/jquery.polyfill.js b/packages/fineui/src/core/platform/web/jquery/jquery.polyfill.js index ba2a8d60b..d7fb59e75 100644 --- a/packages/fineui/src/core/platform/web/jquery/jquery.polyfill.js +++ b/packages/fineui/src/core/platform/web/jquery/jquery.polyfill.js @@ -1,9 +1,9 @@ /** * 用于 jquery 在 worker 环境或者 V8 引擎的 polyfill */ -import { _global } from "@/core/0.foundation"; +// import { _global } from "@/core/0.foundation"; -// const _global = globalThis; +const _global = globalThis; const document = {}; const fakeElement = Object.create(document); diff --git a/packages/fineui/src/index.js b/packages/fineui/src/index.js index e0600bc9e..76dbf84ff 100644 --- a/packages/fineui/src/index.js +++ b/packages/fineui/src/index.js @@ -1,8 +1,6 @@ // sideEffects import "./core/system"; -import "./core/platform/web/jquery" -import "./core/platform/web/config"; - +import "./core/platform/web/jquery"; import jquery from "jquery"; export * from "./core"; diff --git a/packages/fineui/typescript/bundle.ts b/packages/fineui/typescript/bundle.ts index 61cffc88a..fb4e34400 100644 --- a/packages/fineui/typescript/bundle.ts +++ b/packages/fineui/typescript/bundle.ts @@ -1,3 +1,3 @@ -import fineui from "./index"; +// import fineui from "./index"; -BI.extend(BI, fineui); +// BI.extend(BI, fineui); diff --git a/packages/fineui/webpack/attachments.js b/packages/fineui/webpack/attachments.js index 58ea3107c..991c289e9 100644 --- a/packages/fineui/webpack/attachments.js +++ b/packages/fineui/webpack/attachments.js @@ -6,6 +6,7 @@ const fixCompact = "./dist/fix/fix.compact.js"; const workerCompact = "./dist/fix/worker.compact.js"; const lodashJs = "src/core/1.lodash.js"; const jqueryPolyfill = "./src/core/platform/web/jquery/jquery.polyfill.js"; +const configJS = "./src/core/platform/web/config.js"; const runtimePolyfill = []; @@ -145,6 +146,7 @@ const fineuiWithoutNormalize = [].concat( ); const fineui = [].concat( + configJS, bundleCss, basicAttachmentMap.polyfill, basicAttachmentMap.js_bundle,