Browse Source

KERNEL-14512 chore: fineui.worker.js

es6
Treecat 2 years ago
parent
commit
661a1b36b4
  1. 3
      package.json
  2. 7
      packages/fineui/src/core/platform/web/jquery/_jquery.js
  3. 1
      packages/fineui/src/core/platform/web/jquery/index.js
  4. 81
      packages/fineui/src/core/platform/web/jquery/jquery.polyfill.js
  5. 1
      packages/fineui/src/index.js
  6. 125
      packages/fineui/webpack/attachments.js
  7. 4
      packages/fineui/webpack/webpack.prod.js

3
package.json

@ -9,7 +9,8 @@
"dev": "npm-run-all --parallel dev:*",
"dev:demo": "pnpm --dir packages/demo dev",
"dev:fineui": "pnpm --dir packages/fineui dev",
"build": "pnpm --dir packages/fineui build"
"build": "pnpm --dir packages/fineui build",
"build:demo": "pnpm --dir packages/demo build"
},
"devDependencies": {
"@babel/cli": "^7.21.0",

7
packages/fineui/src/core/platform/web/jquery/_jquery.js vendored

@ -1,7 +0,0 @@
// import jQuery from "jquery";
// import { _global } from "@/core/0.foundation";
// // todo:先垫着,不然开发会崩
// _global.BI = _global.BI || {};
// _global.BI.jQuery = _global.BI.$ = jQuery;

1
packages/fineui/src/core/platform/web/jquery/index.js vendored

@ -1,4 +1,3 @@
import "./_jquery";
import "./event";
import "./fn";
import "./jquery.mousewheel";

81
packages/fineui/src/core/platform/web/jquery/jquery.polyfill.js

@ -0,0 +1,81 @@
/**
* 用于 jquery worker 环境或者 V8 引擎的 polyfill
*/
import { _global } from "@/core/0.foundation";
if (!_global.window) {
_global.window = _global;
const document = (_global.document = {});
const fakeElement = Object.create(document);
Object.assign(document, {
parentNode: null,
nodeType: 9,
head: fakeElement,
body: fakeElement,
ownerDocument: document,
documentElement: document,
toString() {
return "FakeDocument";
},
appendChild(child) {
return child;
},
implementation: {
createHTMLDocument() {
return {
body: {
childNodes: [],
},
};
},
createDocumentFragment() {
return this;
},
},
getElementById() {
return fakeElement;
},
createElement() {
return fakeElement;
},
createDocumentFragment() {
return this;
},
cloneNode() {
return this;
},
getElementsByTagName() {
return [fakeElement];
},
getElementsByClassName() {
return [fakeElement];
},
setAttribute() {
return null;
},
getAttribute() {
return null;
},
removeChild() {
return null;
},
addEventListener() {
return null;
},
removeEventListener() {
return null;
},
});
Object.assign(fakeElement, {
nodeType: 1,
style: {},
ownerDocument: document,
parentNod: fakeElement,
firstChild: fakeElement,
lastChild: fakeElement,
toString() {
return "FakeElement";
},
});
}

1
packages/fineui/src/index.js

@ -1,5 +1,4 @@
// sideEffects
import "./polyfill";
import "./core/system";
import "./core/element";
import "./core/platform";

125
packages/fineui/webpack/attachments.js

@ -1,19 +1,16 @@
const { sync, uniq } = require("./utils");
const fixJs = "./dist/fix/fix.js";
const fixProxyJs = './dist/fix/fix.proxy.js';
const fixProxyJs = "./dist/fix/fix.proxy.js";
const fixCompact = "./dist/fix/fix.compact.js";
const workerCompact = './dist/fix/worker.compact.js';
const workerCompact = "./dist/fix/worker.compact.js";
const lodashJs = "src/core/1.lodash.js";
const jqueryJs = "src/core/platform/web/jquery/_jquery.js";
const jqueryPolyfill = "./src/core/platform/web/jquery/jquery.polyfill.js";
const runtimePolyfill = ["core-js/stable"];
const runtimePolyfill = [];
const basicAttachmentMap = {
polyfill: sync([
"src/core/0.foundation.js",
"src/polyfill/**/*.js",
]).concat(runtimePolyfill),
polyfill: sync(["src/core/0.foundation.js", "src/polyfill/**/*.js"]).concat(runtimePolyfill),
core: sync([
"src/less/core/**/*.less",
"src/less/theme/**/*.less",
@ -39,38 +36,23 @@ const basicAttachmentMap = {
// "src/widget/**/*.js",
// "src/component/**/*.js",
]),
router: sync([
"src/router/**/*.js",
]),
core_without_platform: sync([
"src/core/0.foundation.js",
lodashJs,
"src/core/**/*.js",
"src/data/**/*.js",
], [
"src/core/platform/**/*.js",
"src/core/controller/**/*.js",
]),
router: sync(["src/router/**/*.js"]),
core_without_platform: sync(
["src/core/0.foundation.js", lodashJs, "src/core/**/*.js", "src/data/**/*.js"],
["src/core/platform/**/*.js", "src/core/controller/**/*.js"]
),
core_without_normalize: sync(
["src/less/core/**/*.less", "src/less/theme/**/*.less"], ["src/less/core/normalize.less", "src/less/core/normalize2.less"]
["src/less/core/**/*.less", "src/less/theme/**/*.less"],
["src/less/core/normalize.less", "src/less/core/normalize2.less"]
),
core_without_conflict: sync(
["src/less/core/**/*.less", "src/less/theme/**/*.less", lodashJs, "src/core/**/*.js", "src/data/**/*.js"],
["src/core/conflict.js"]
),
core_without_conflict: sync([
"src/less/core/**/*.less",
"src/less/theme/**/*.less",
lodashJs,
"src/core/**/*.js",
"src/data/**/*.js",
], [
"src/core/conflict.js",
]),
resource: sync(["src/less/resource/**/*.less"]),
font: sync(["public/less/font.less"]),
ts: ['./typescript/bundle.ts'],
ui: sync([
'ui/less/app.less',
'ui/less/**/*.less',
'ui/js/**/*.js',
]),
ts: ["./typescript/bundle.ts"],
ui: sync(["ui/less/app.less", "ui/less/**/*.less", "ui/js/**/*.js"]),
config: sync(["demo/version.js", "i18n/i18n.cn.js"]),
utils: sync([
"src/core/0.foundation.js",
@ -95,7 +77,7 @@ const basicAttachmentMap = {
"src/less/widget/**/*.less",
"src/less/component/**/*.less",
]),
js_bundle: sync(["src/bundle.js"])
js_bundle: sync(["src/bundle.js"]),
};
const bundle = [].concat(
@ -109,13 +91,10 @@ const bundle = [].concat(
[fixCompact, workerCompact],
basicAttachmentMap.router,
sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]),
basicAttachmentMap.ts,
basicAttachmentMap.ts
);
const bundleCss = [].concat(
basicAttachmentMap.less,
sync(["public/less/app.less", "public/less/**/*.less"]),
);
const bundleCss = [].concat(basicAttachmentMap.less, sync(["public/less/app.less", "public/less/**/*.less"]));
// const bundleModern = [].concat(
// sync(["src/less/modern.less"]),
@ -129,9 +108,9 @@ const coreJs = [].concat(
basicAttachmentMap.base,
basicAttachmentMap.case,
basicAttachmentMap.widget,
['./dist/fix/fix.compact.js'],
["./dist/fix/fix.compact.js"],
basicAttachmentMap.router,
basicAttachmentMap.ts,
basicAttachmentMap.ts
);
const resource = sync(["private/less/app.less", "private/less/**/*.less"]);
@ -140,16 +119,17 @@ const config = sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js
const bundleWithoutNormalize = [].concat(
basicAttachmentMap.core_without_normalize,
sync([
sync(
[
"src/less/base/**/*.less",
"src/less/case/**/*.less",
"src/less/widget/**/*.less",
"src/less/component/**/*.less",
"public/less/**/*.less",
// ts的less
], [
"public/less/app.less",
]),
],
["public/less/app.less"]
)
);
const fineuiWithoutNormalize = [].concat(
@ -159,20 +139,27 @@ const fineuiWithoutNormalize = [].concat(
"src/less/case/**/*.less",
"src/less/widget/**/*.less",
"src/less/component/**/*.less",
'ui/less/app.less',
'ui/less/**/*.less',
]),
"ui/less/app.less",
"ui/less/**/*.less",
])
);
const fineui = [].concat(
bundleCss,
basicAttachmentMap.polyfill,
basicAttachmentMap.js_bundle,
basicAttachmentMap.ui,
basicAttachmentMap.ts,
basicAttachmentMap.ts
);
const fineuiForWorker = [].concat(
jqueryPolyfill,
basicAttachmentMap.js_bundle,
basicAttachmentMap.ui,
basicAttachmentMap.ts
);
const fineuiWithoutConflict = [].concat(
basicAttachmentMap.polyfill,
basicAttachmentMap.core_without_conflict,
basicAttachmentMap.fix,
basicAttachmentMap.base,
@ -182,6 +169,7 @@ const fineuiWithoutConflict = [].concat(
[fixCompact, workerCompact],
basicAttachmentMap.ui,
basicAttachmentMap.ts,
basicAttachmentMap.polyfill
);
// const fineuiModern = [].concat(
@ -202,30 +190,7 @@ const fineuiProxy = [].concat(
basicAttachmentMap.router,
[fixCompact, workerCompact],
basicAttachmentMap.ui,
basicAttachmentMap.ts,
);
const fineuiWithoutJqueryAndPolyfillJs = [].concat(
runtimePolyfill,
sync([
"src/core/0.foundation.js",
lodashJs,
"src/core/**/*.js",
"src/data/**/*.js",
], [
"src/core/platform/web/**/*.js",
]),
basicAttachmentMap.fix,
sync([
"src/base/**/*.js",
"src/case/**/*.js",
], [
"src/base/single/input/file.js",
"src/case/ztree/**/*.js",
]),
basicAttachmentMap.widget,
sync([fixCompact, workerCompact, "ui/js/**/*.js"]),
basicAttachmentMap.ts,
basicAttachmentMap.ts
);
const demo = [].concat(
@ -240,7 +205,7 @@ const demo = [].concat(
sync(["public/less/app.less", "public/less/**/*.less"]),
[fixCompact, workerCompact],
basicAttachmentMap.ts,
sync(["demo/less/*.less", "demo/less/**/*.less", "demo/app.js", "demo/js/**/*.js", "demo/config.js"]),
sync(["demo/less/*.less", "demo/less/**/*.less", "demo/app.js", "demo/js/**/*.js", "demo/config.js"])
);
module.exports = {
@ -254,12 +219,12 @@ module.exports = {
bundleWithoutNormalize: uniq(bundleWithoutNormalize),
fineui: uniq(fineui),
fineuiProxy: uniq(fineuiProxy),
fineuiWithoutJqueryAndPolyfillJs: uniq(fineuiWithoutJqueryAndPolyfillJs),
fineuiForWorker: uniq(fineuiForWorker),
utils: uniq(basicAttachmentMap.utils),
demo: uniq(demo),
coreWithoutPlatform: uniq(basicAttachmentMap.core_without_platform),
coreJs: uniq(coreJs),
resource: uniq((resource)),
resource: uniq(resource),
config: uniq(config),
bundleCss: uniq(bundleCss),
};

4
packages/fineui/webpack/webpack.prod.js

@ -17,7 +17,8 @@ module.exports = merge(common, {
mode: "production",
entry: {
"fineui.min": attachments.fineui
"fineui.min": attachments.fineui,
"fineui.worker.min": attachments.fineuiForWorker,
},
output: {
@ -49,7 +50,6 @@ module.exports = merge(common, {
],
},
plugins: [
new MiniCssExtractPlugin({
filename: "[name].css",

Loading…
Cancel
Save