Browse Source

Pull request #3488: KERNEL-14316 chore: 代码调整

Merge in VISUAL/fineui from ~TREECAT/fineui:es6 to es6

* commit 'b367f07bb020e9895a421078649ce0117ed6ee0b':
  KERNEL-14512 chore:打包结构调整
  KERNEL-14512 chore:打包结构调整
  KERNEL-14512 chore:打包调整
  KERNEL-14512 chore:打包调整
  KERNEL-14512 chore: 代码结构调整
  KERNEL-14512 chore: fineui.worker.js
  KERNEL-14512 chore: demo 支持 build
  KERNEL-14316 chore: 代码调整
  KERNEL-14316 fix: jQuery 升级及 worker 缺失的问题
es6
treecat-罗群 2 years ago
parent
commit
5f8e68dc9a
  1. 8
      package.json
  2. 3
      packages/demo/package.json
  3. 58
      packages/demo/webpack.prod.js
  4. 21
      packages/fineui/bin/cli/cli.js
  5. 76
      packages/fineui/bin/cli/worker/cli.worker.js
  6. 48
      packages/fineui/bin/cli/worker/template/main_thread.helper.t
  7. 13
      packages/fineui/bin/cli/worker/template/main_thread/action/action.worker_ability_test.t
  8. 13
      packages/fineui/bin/cli/worker/template/main_thread/main_thread.t
  9. 8
      packages/fineui/bin/cli/worker/template/utils/action_type.t
  10. 13
      packages/fineui/bin/cli/worker/template/utils/payload_type.t
  11. 24
      packages/fineui/bin/cli/worker/template/worker_thread/action/action.worker_ability_test.t
  12. 12
      packages/fineui/bin/cli/worker/template/worker_thread/worker_thread.t
  13. 27
      packages/fineui/package.json
  14. 11
      packages/fineui/src/core/index.js
  15. 7
      packages/fineui/src/core/platform/web/jquery/_jquery.js
  16. 6
      packages/fineui/src/core/platform/web/jquery/fn.js
  17. 1
      packages/fineui/src/core/platform/web/jquery/index.js
  18. 81
      packages/fineui/src/core/platform/web/jquery/jquery.polyfill.js
  19. 10
      packages/fineui/src/index.js
  20. 8
      packages/fineui/src/polyfill/event.js
  21. 7
      packages/fineui/tsconfig.json
  22. 125
      packages/fineui/webpack/attachments.js
  23. 4
      packages/fineui/webpack/webpack.prod.js
  24. 0
      scripts/chinese.js
  25. 0
      scripts/code.static.js
  26. 0
      scripts/lib/fui.component.json
  27. 0
      scripts/lib/fui.export.txt
  28. 0
      scripts/lib/utils.js
  29. 0
      scripts/rename.js

8
package.json

@ -5,11 +5,17 @@
"keywords": [], "keywords": [],
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"engines": {
"node": ">=16.0.0",
"yarn": "please-use-pnpm",
"pnpm": ">=7.0.0"
},
"scripts": { "scripts": {
"dev": "npm-run-all --parallel dev:*", "dev": "npm-run-all --parallel dev:*",
"dev:demo": "pnpm --dir packages/demo dev", "dev:demo": "pnpm --dir packages/demo dev",
"dev:fineui": "pnpm --dir packages/fineui 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": { "devDependencies": {
"@babel/cli": "^7.21.0", "@babel/cli": "^7.21.0",

3
packages/demo/package.json

@ -4,7 +4,8 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"dev": "webpack-dev-server --open --config=webpack.dev.js" "dev": "webpack-dev-server --open --config=webpack.dev.js --progress",
"build": "webpack --config=webpack.prod.js --progress"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",

58
packages/demo/webpack.prod.js

@ -0,0 +1,58 @@
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const TerserPlugin = require("terser-webpack-plugin");
const webpack = require("webpack");
const childProcess = require("child_process");
function git(command) {
return childProcess.execSync(`git ${command}`).toString().trim();
}
module.exports = {
mode: 'production',
entry: {
"demo.min": './src/index.js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
{
test: /\.less$/i,
use: ['style-loader', 'css-loader', 'less-loader'],
},
],
},
devtool: 'source-map',
resolve: {
extensions: ['.js', '.ts'],
alias: {
'@': path.resolve(__dirname, './src'),
},
},
optimization: {
usedExports: false,
minimize: true,
minimizer: [
new TerserPlugin({
include: /\.min/,
parallel: true,
terserOptions: {
output: {
comments: false,
},
},
}),
new webpack.BannerPlugin({
banner: `time: ${new Date().toLocaleString("en-US")}; branch: ${git(
"name-rev --name-only HEAD"
)} commit: ${git("rev-parse HEAD")}`,
})
],
},
};

21
packages/fineui/bin/cli/cli.js

@ -0,0 +1,21 @@
#!/usr/bin/env node
const yargs = require('yargs/yargs');
const { hideBin } = require('yargs/helpers');
const workerCmd = require('./worker/cli.worker');
const argv = yargs(hideBin(process.argv)).argv;
const cmd = argv._[0];
const cmds = new Map([
['worker', workerCmd],
]);
if (!cmd) throw new Error('Command is undefined!');
if (cmds.has(cmd)) {
cmds.get(cmd)?.exec(argv);
} else {
throw new Error(`Command ${cmd} not supported`);
}

76
packages/fineui/bin/cli/worker/cli.worker.js

@ -0,0 +1,76 @@
const fs = require('fs');
const path = require('path');
function first2UpperCase(str) {
return str.toLowerCase().replace(/( |^)[a-z]/g, L => L.toUpperCase());
}
function scanAndCreate(structure, workerName, root) {
Object.keys(structure)
.forEach(name => {
if (typeof structure[name] === 'object') {
fs.mkdirSync(path.resolve(root, name));
scanAndCreate(structure[name], workerName, path.resolve(root, `./${name}`));
} else if (structure[name] === '') {
fs.appendFileSync(path.resolve(root, name), '');
} else if (typeof structure[name] === 'string') {
let content = fs.readFileSync(structure[name]).toString();
content = content
.replace(/\${WorkerName}/g, first2UpperCase(workerName))
.replace(/\${workerName}/g, workerName);
fs.appendFileSync(path.resolve(root, name), content);
}
});
}
module.exports = {
exec: async args => {
if (!args.init) {
throw new Error(`Command init not found in args`);
}
if (!args.name) {
throw new Error('Command --name=... not found in args');
}
const name = args.name;
const structure = {
[`${name}_worker`]: {
'main_thread': {
action: {
'action.worker_ability_test.ts': path.resolve(__dirname, './template/main_thread/action/action.worker_ability_test.t'),
},
[`${name}_main_thread.ts`]: path.resolve(__dirname, './template/main_thread/main_thread.t'),
},
utils: {
'action_type.ts': path.resolve(__dirname, './template/utils/action_type.t'),
'payload_type.ts': path.resolve(__dirname, './template/utils/payload_type.t'),
},
'worker_thread': {
action: {
'action.worker_ability_test.ts': path.resolve(__dirname, './template/worker_thread/action/action.worker_ability_test.t'),
},
[`${name}_worker_thread.ts`]: path.resolve(__dirname, './template/worker_thread/worker_thread.t'),
},
[`${name}_main_thread.helper.ts`]: path.resolve(__dirname, './template/main_thread.helper.t'),
},
};
scanAndCreate(structure, name, args.where ? path.resolve(args.where) : process.cwd());
},
};
// 结构
// -xxx_worker
// -|--main_thread
// -|--|--action
// -|--|--xxx_main_thread.ts
// -|--utils
// -|--|--action_type.ts
// -|--worker_thread
// -|--|--action
// -|--|--worker_main_thread.ts

48
packages/fineui/bin/cli/worker/template/main_thread.helper.t

@ -0,0 +1,48 @@
import { ${WorkerName}MainThreadWorker } from './main_thread/${workerName}_main_thread';
// 不需要一起打包的话则不需要引入这行
// FuiWorkerPlugin中的属性会同步到fui-worker中同时支持loader行内传入属性
// 根据实际需求传入inline返回格式 true -> blob urlfalse -> servicePath
import workerUrl from 'fui-worker!./worker_thread/${workerName}_worker_thread';
export class ${WorkerName}WorkerHelper {
private worker: ${WorkerName}MainThreadWorker;
/**
* 拿到helper中的worker
*/
public getWorker() {
if (this.worker) {
return this.worker;
}
this.worker = BI.Workers.createWorker(${WorkerName}MainThreadWorker, {
workerUrl: this.urlFormatter(workerUrl),
workerName: BI.UUID(),
});
return this.worker;
}
/**
* 格式化worker url比如补充一些环境信息到参数里
* 可通过 #hash 将参数传入blob url
* @param url worker url
*/
private urlFormatter(url: string) {
return url;
}
/**
* 终止worker
*/
public terminate() {
this.worker?.terminate();
}
}
// 使用示例
// const workerHelper = new ${WorkerName}WorkerHelper();
// workerHelper.getWorker()
// .testCommunication()
// .then(res => console.log(res));

13
packages/fineui/bin/cli/worker/template/main_thread/action/action.worker_ability_test.t

@ -0,0 +1,13 @@
import { WorkerAbilityTestActionType } from '../../utils/action_type';
import { WorkerAbilityTestPayload, WorkerAbilityTestReponse } from '../../utils/payload_type';
export class WorkerAbilityTestMainThreadAction extends BI.Workers.WorkerBaseAction {
/**
* 通信能力检测
*/
public communicationTest(): Promise<WorkerAbilityTestReponse['CommunicationTest']> {
const mainThreadPostTime: WorkerAbilityTestPayload['CommunicationTest'] = Date.now();
return this.controller.requestPromise(WorkerAbilityTestActionType.CommunicationTest, mainThreadPostTime);
}
}

13
packages/fineui/bin/cli/worker/template/main_thread/main_thread.t

@ -0,0 +1,13 @@
import { WorkerAbilityTestMainThreadAction } from './action/action.worker_ability_test';
export class ${WorkerName}MainThreadWorker extends BI.Workers.MainThreadWorker {
private communicationTest: WorkerAbilityTestMainThreadAction;
public initActions(): void {
this.communicationTest = this.createAction(WorkerAbilityTestMainThreadAction);
}
public testCommunication() {
return this.communicationTest.communicationTest();
}
}

8
packages/fineui/bin/cli/worker/template/utils/action_type.t

@ -0,0 +1,8 @@
/*
* Worker 事务标识
* 每类事务有命名空间, 包含多个具体事务
*/
export const enum WorkerAbilityTestActionType {
CommunicationTest = 'CommunicationTest',
}

13
packages/fineui/bin/cli/worker/template/utils/payload_type.t

@ -0,0 +1,13 @@
/**
* 跨线程通信各事务的发送数据类型声明
*/
export interface WorkerAbilityTestPayload {
CommunicationTest: number;
}
/**
* 跨线程通信各事务的响应数据类型声明
*/
export interface WorkerAbilityTestReponse {
CommunicationTest: number;
}

24
packages/fineui/bin/cli/worker/template/worker_thread/action/action.worker_ability_test.t

@ -0,0 +1,24 @@
import { WorkerAbilityTestActionType } from '../../utils/action_type';
import { WorkerAbilityTestPayload, WorkerAbilityTestReponse } from '../../utils/payload_type';
export class WorkerAbilityTestWorkerThreadAction extends BI.Workers.WorkerBaseAction {
protected addActionHandler(): void {
this.controller.addActionHandler(
WorkerAbilityTestActionType.CommunicationTest,
this.communicationTest.bind(this)
);
}
/**
* 通信能力检测的处理器
*/
private communicationTest(
payload: WorkerAbilityTestPayload['CommunicationTest']
): WorkerAbilityTestReponse['CommunicationTest'] {
const mainThreadPostTime = payload;
// 收到主线程信息的耗时
const workerGetMessageDuration = Date.now() - mainThreadPostTime;
return workerGetMessageDuration;
}
}

12
packages/fineui/bin/cli/worker/template/worker_thread/worker_thread.t

@ -0,0 +1,12 @@
// TODO: 这边需要先import fineui资源
import { WorkerAbilityTestWorkerThreadAction } from './action/action.worker_ability_test';
class ${WorkerName}WorkerTreadWorker extends BI.Workers.WorkerThreadWorker {
public communicationTest: WorkerAbilityTestWorkerThreadAction;
public initActions(): void {
this.communicationTest = this.createAction(WorkerAbilityTestWorkerThreadAction);
}
}
export const ${workerName}WorkerTreadWorker = BI.Workers.createWorker(${WorkerName}WorkerTreadWorker);

27
packages/fineui/package.json

@ -2,29 +2,35 @@
"name": "@fui/core", "name": "@fui/core",
"version": "2.0.20230208163847", "version": "2.0.20230208163847",
"description": "fineui", "description": "fineui",
"main": "dist/fineui_without_conflict.min.js", "main": "dist/fineui.min.js",
"module": "dist/es/index.js", "module": "dist/es/index.js",
"types": "dist/type/index.d.ts", "types": "dist/lib/index.d.ts",
"bin": { "bin": {
"fui-cli": "./bin/cli/cli.js" "fui-cli": "./bin/cli/cli.js"
}, },
"sideEffects": [ "sideEffects": [
"**/*.less", "**/*.less",
"src/**/*.js", "src/**/*.js",
"dist/es/core/*.js", "dist/es/index.js",
"dist/es/core/element/**/*.js", "dist/es/core/system.js",
"dist/es/core/platform/**/*.js", "dist/es/core/platform/web/config.js",
"dist/es/core/platform/web/jquery/*.js",
"dist/es/polyfill/**/*.js", "dist/es/polyfill/**/*.js",
"dist/es/case/ztree/jquery.ztree.core-3.5.js", "dist/es/case/ztree/jquery.ztree.core-3.5.js",
"dist/es/case/ztree/jquery.ztree.excheck-3.5.js" "dist/es/case/ztree/jquery.ztree.excheck-3.5.js"
], ],
"scripts": { "scripts": {
"dev": "babel src -d dist/es --config-file ./esm.babel.js -w", "dev": "tsc && babel src -d dist/es --config-file ./esm.babel.js -w",
"build": "webpack --config=webpack/webpack.prod.js", "build": "tsc && run-p build:*",
"build:es": "babel src -d dist/es --config-file ./esm.babel.js",
"build:fineui": "webpack --progress --config=webpack/webpack.prod.js",
"webpack:css": "webpack --config=webpack/webpack.css.js --mode production", "webpack:css": "webpack --config=webpack/webpack.css.js --mode production",
"biCss": "cross-env LESS_CONFIG_PATH=lessconfig/bi.lessconfig.json LESS_FILE_NAME=bi npm run webpack:css", "build:biCss": "cross-env LESS_CONFIG_PATH=lessconfig/bi.lessconfig.json LESS_FILE_NAME=bi npm run webpack:css",
"jsyCss": "cross-env LESS_CONFIG_PATH=lessconfig/jsy.lessconfig.json LESS_FILE_NAME=jsy npm run webpack:css" "build:jsyCss": "cross-env LESS_CONFIG_PATH=lessconfig/jsy.lessconfig.json LESS_FILE_NAME=jsy npm run webpack:css"
}, },
"files": [
"dist"
],
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://git.coding.net/fanruan/fineui.git" "url": "https://git.coding.net/fanruan/fineui.git"
@ -35,7 +41,8 @@
"finebi" "finebi"
], ],
"publishConfig": { "publishConfig": {
"registry": "https://registry.npmjs.org" "registry": "https://registry.npmjs.org",
"access": "public"
}, },
"author": "fanruan", "author": "fanruan",
"license": "MIT", "license": "MIT",

11
packages/fineui/src/core/index.js

@ -1,5 +1,5 @@
export * from './system'; export * from './system';
export { Plugin } from './6.plugin';
export { StyleLoaderManager } from './loader/loader.style'; export { StyleLoaderManager } from './loader/loader.style';
export { ShowListener } from './listener/listener.show'; export { ShowListener } from './listener/listener.show';
export { useInWorker } from './worker'; export { useInWorker } from './worker';
@ -15,16 +15,14 @@ export { PopoverController } from './controller/controller.popover';
export { ResizeController } from './controller/controller.resizer'; export { ResizeController } from './controller/controller.resizer';
export { TooltipsController } from './controller/controller.tooltips'; export { TooltipsController } from './controller/controller.tooltips';
export * from './4.widget'; export * as _ from './1.lodash';
export * from './2.base'; export * from './2.base';
export * from './3.ob'; export * from './3.ob';
export * from './4.widget';
export * from './5.inject'; export * from './5.inject';
export * from './6.plugin'; export * from './6.plugin';
export * from './action'; export * from './action';
// export * from "./behavior";
// export * from "./controller";
export * from './func'; export * from './func';
export * from './structure'; export * from './structure';
export * from './h'; export * from './h';
@ -36,6 +34,5 @@ export * from './utils';
export { shortcut, provider, store, model, mixin, mixins } from './decorator'; export { shortcut, provider, store, model, mixin, mixins } from './decorator';
import _ from './1.lodash';
export { _ };

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;

6
packages/fineui/src/core/platform/web/jquery/fn.js vendored

@ -252,3 +252,9 @@ $.fn.extend({
}, },
}); });
$.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "), (function(e, t) {
$.fn[t] = function(e, i) {
return arguments.length > 0 ? this.on(t, null, e, i) : this.trigger(t)
}
}))

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

@ -1,4 +1,3 @@
import "./_jquery";
import "./event"; import "./event";
import "./fn"; import "./fn";
import "./jquery.mousewheel"; 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";
},
});
}

10
packages/fineui/src/index.js

@ -1,13 +1,9 @@
// sideEffects // sideEffects
import "./polyfill";
import "./core/system"; import "./core/system";
import "./core/element";
import "./core/platform";
import "./core/platform/web/jquery" import "./core/platform/web/jquery"
// 必须要等上面的准备好, 才初始化 config
import "./core/platform/web/config"; import "./core/platform/web/config";
import _jquery from "jquery"; import jquery from "jquery";
export * from "./core"; export * from "./core";
export * from "./base"; export * from "./base";
@ -17,5 +13,5 @@ export * from "./component";
export * from "./fix"; export * from "./fix";
export * from "./router"; export * from "./router";
export * as Popper from "@popperjs/core"; export * as Popper from "@popperjs/core";
export const jQuery = _jquery; export const jQuery = jquery;
export const $ = _jquery; export const $ = jquery;

8
packages/fineui/src/polyfill/event.js

@ -1,9 +1,9 @@
(function () { const isIE = () => typeof window.CustomEvent !== "function";
if (typeof window.CustomEvent === "function") return false; // If not IE
if (isIE()) {
function CustomEvent(event, params) { function CustomEvent(event, params) {
params = params || { bubbles: false, cancelable: false, detail: undefined }; params = params || { bubbles: false, cancelable: false, detail: undefined };
var evt = document.createEvent("CustomEvent"); const evt = document.createEvent("CustomEvent");
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt; return evt;
@ -12,4 +12,4 @@
CustomEvent.prototype = window.Event.prototype; CustomEvent.prototype = window.Event.prototype;
window.CustomEvent = CustomEvent; window.CustomEvent = CustomEvent;
}()); }

7
packages/fineui/tsconfig.json

@ -4,10 +4,13 @@
"target": "es2017", "target": "es2017",
"module": "es2015", "module": "es2015",
"moduleResolution": "node", "moduleResolution": "node",
"lib": ["es2017", "dom"], "lib": [
"es2017",
"dom"
],
"declaration": true, "declaration": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"outDir": "./type/lib", "outDir": "./dist/lib",
"baseUrl": ".", "baseUrl": ".",
// "strict": true, // "strict": true,
"strictNullChecks": true, "strictNullChecks": true,

125
packages/fineui/webpack/attachments.js

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

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

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

0
script/chinese.js → scripts/chinese.js

0
script/code.static.js → scripts/code.static.js

0
script/lib/fui.component.json → scripts/lib/fui.component.json

0
script/lib/fui.export.txt → scripts/lib/fui.export.txt

0
script/lib/utils.js → scripts/lib/utils.js

0
script/rename.js → scripts/rename.js

Loading…
Cancel
Save