diff --git a/.editorconfig b/.editorconfig
deleted file mode 100644
index 7053c49a045c91bd8b3015c1cf3d1f6da21660d8..0000000000000000000000000000000000000000
--- a/.editorconfig
+++ /dev/null
@@ -1,5 +0,0 @@
-[*.{js,jsx,ts,tsx,vue}]
-indent_style = space
-indent_size = 2
-trim_trailing_whitespace = true
-insert_final_newline = true
diff --git a/.gitignore b/.gitignore
index ed4489f4b5930292374cc71351dea6eb066e385f..e0db44c313ef4f653ed816a9c3d00727b076fed0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,26 +1,108 @@
-.DS_Store
-.temp
-.my
-node_modules
-/dist
-/apps
-/docs/.vuepress/public/api
-/src/views/josephtest/
-/debug.log
-# local env files
-.env.local
-.env.*.local
-
-# Log files
+.idea
+
+# Logs
+logs
+*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
+lerna-debug.log*
-# Editor directories and files
-.idea
-.vscode
-*.suo
-*.ntvs*
-*.njsproj
-*.sln
-*.sw?
+# Diagnostic reports (https://nodejs.org/api/report.html)
+report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+*.lcov
+
+# nyc test coverage
+.nyc_output
+
+# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Bower dependency directory (https://bower.io/)
+bower_components
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (https://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules/
+jspm_packages/
+
+# TypeScript v1 declaration files
+typings/
+
+# TypeScript cache
+*.tsbuildinfo
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Microbundle cache
+.rpt2_cache/
+.rts2_cache_cjs/
+.rts2_cache_es/
+.rts2_cache_umd/
+
+# Optional REPL history
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variables file
+.env
+.env.test
+
+# parcel-bundler cache (https://parceljs.org/)
+.cache
+
+# Next.js build output
+.next
+
+# Nuxt.js build / generate output
+.nuxt
+dist
+
+# Gatsby files
+.cache/
+# Comment in the public line in if your project uses Gatsby and *not* Next.js
+# https://nextjs.org/blog/next-9-1#public-directory-support
+# public
+
+# vuepress build output
+.vuepress/dist
+
+# Serverless directories
+.serverless/
+
+# FuseBox cache
+.fusebox/
+
+# DynamoDB Local files
+.dynamodb/
+
+# TernJS port file
+.tern-port
+
+package-lock.json
diff --git a/.npmignore b/.npmignore
deleted file mode 100644
index 9d8abe0ed0d5c13cb9ae80ea2b15fe9bed9d7d41..0000000000000000000000000000000000000000
--- a/.npmignore
+++ /dev/null
@@ -1,27 +0,0 @@
-.DS_Store
-*.map
-.temp
-.my
-.npmignore
-.editorconfig
-.eslintignore
-.idea
-.gitignore
-/node_modules
-/schemas
-/public
-/apps
-/src
-/svg
-!ui/**/*
-/tests
-/docs
-!web/docs
-/dist
-/my.config.js
-/babel.config.js
-!core/babel.config.js
-/vue.config.js
-!core/vue.config.js
-/debug.log
-
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..ec8f32611d8ae27c37931deeaf3611906769e277
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,26 @@
+# 安装依赖及打包
+FROM node:12-alpine AS Builder
+
+WORKDIR /app
+
+COPY ./package*.json /app/
+
+RUN npm install
+
+COPY . /app
+
+RUN npm run build
+
+# 配置 nginx 资源转发
+FROM nginx:alpine
+
+COPY --from=Builder app/dist/ /usr/share/nginx/html/
+
+COPY --from=Builder \
+ app/nginx.conf \
+ /etc/nginx/conf.d/default.conf
+
+EXPOSE 80
+
+
+# 可直接配置 nginx, 在项目外部打包
diff --git a/LICENSE b/LICENSE
index f3afe62119b6f39bd0da52060d24eb3b88a4ef9b..261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,21 +1,201 @@
-MIT License
-
-Copyright (c) 2017-present 陈华春
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/README.md b/README.md
index a3d3d931f273b1b7de0ff27cc1780db9b1571d1b..3a6ecbc8d6250e5dc20e632577c4060d22d997e4 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,202 @@
-# Vue2+ElementUI+BPMN2.0整合(基于Bpmn Process Designer)
-- 克隆项目自定义
-```
-git clone https://gitee.com/lwstudy/vue2_el_bpmn.git
-yarn
-npm run dev
+
+
+
+
+
+
+Bpmn Process Designer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+### 项目简介
+
+一个基于 `bpmn.js`,`Vue 2.x` 和 `ElementUI` 开发的流程设计器。
+
+您可以使用它在浏览器上查看和编辑符合 `BPMN 2.0` 规范的流程文件。
+
+在线demo请访问 [MiyueFE Blog](https://miyuesc.github.io/process-designer/)
+
+码云同步镜像请访问 [Gitee/MiyueSC Process Designer](https://miyuesc.gitee.io/process-designer/)
+
+> 🚀🚀🚀
+>
+> **Vite + Vue 3 + pinia + naiveUI 新项目,取消了window命名空间保存bpmn实例的方式,并进行了大部分显示自定义功能,完成了 bpmn.js 基本依赖的 typescript 类型声明。**
+>
+> **体验请访问:[vite-vue-bpmn-process](https://miyuesc.github.io/vite-vue-bpmn-process/)**
+>
+> **国内同步体验地址:[vite-vue-bpmn-process](https://miyuesc.gitee.io/vite-vue-bpmn-process/)**
+>
+> 付费咨询请加微信(毕竟生活太累了😩😩😩)
+>
+> 源码地址:[vite-vue-bpmn-process](https://github.com/moon-studio/vite-vue-bpmn-process)
+
+
+### 友情链接
+
+1. Me: [Bpmn.js 中文文档、json描述文件说明等](https://juejin.cn/column/6964382482007490590)
+2. Yiuman: 低代码平台 [citrus](https://github.com/Yiuman/citrus) ,已集成 activiti7 工作流引擎后端部分
+3. [霖呆呆(掘金五级大佬)](https://juejin.cn/user/360295513463912): [《全网最详bpmn.js教材目录》](https://juejin.cn/post/6844904017567416328),[关于bpmn.js交流群的说明](https://juejin.cn/post/6844904041026158599)
+4. PL-FE: [Bpmn Document](https://github.com/PL-FE/bpmn-doc)
+5. 芋道源码: [ruoyi-vue-pro](https://gitee.com/zhijiantianya/ruoyi-vue-pro) ,一套全部开源的企业级的快速开发平台,毫无保留给个人及企业免费使用。
+6. 运维咖啡吧: [《BPMN系列原创文章》](https://mp.weixin.qq.com/mp/appmsgalbum?__biz=MzU5MDY1MzcyOQ==&action=getalbum&album_id=1576254888626454529&scene=173&from_msgid=2247484449&from_itemidx=1&count=3&nolastread=1#wechat_redirect)
+
+
+## 友情赞助
+
+生活不易,偷偷丢个赞赏码吧,各位大佬赏个饭钱🤪🤪🤪🤪~~~~
+
+
+
+
+
+
+> 付费咨询联系微信:
+>
+>
+
+## 1. 安装依赖 Installation
+
+```shell
+npm install
+// or yarn install
```
-- 引入依赖
-```bash
-npm install vue2-el-bpmn
+
+## 2. 运行 Quick Start
+
+```shell
+npm run demo
+// or yarn run demo
```
-- 效果图
-
+## 3. 文档说明 Documentation
+
+### 3.1 MyProcessDesigner
+
+#### 3.1.1 Attributes
+
+| Attribute | Description | Type | Accepted Values | Default |
+| --------------------- | --------------------------------------------------------- | ----------- | -------------------------------------- | ------------------------------------------------------------ |
+| `value/v-model` | 初始化流程对应的 `xml` 字符串 | String | - | - |
+| `translations` | 翻译文件 | Object | - | [zh.js](https://github.com/miyuesc/bpmn-process-designer/blob/main/package/designer/plugins/translate/zh.js) |
+| `additionalModel` | 自定义的附加模块 | Object[] / Object | - | - |
+| `moddleExtension` | 自定义的扩展模块 | Object | - | - |
+| `onlyCustomizeAddi` | 仅使用开发时的自定义附加模块 | Boolean | - | `false` |
+| `onlyCustomizeModdle` | 仅使用开发时的自定义扩展模块 | Boolean | - | `false` |
+| `prefix` | 流程引擎对应扩展属性前缀 | String | `camunda`, `activiti`, `flowable` | `camunda` |
+| `events` | 需要使用的事件列表,可用事件见 [Bpmn.js 中文文档](https://github.com/miyuesc/blog/blob/master/bpmn/docs/Bpmn.js%20document.md#%E4%B8%89-%E4%BA%8B%E4%BB%B6) | Array | - | `[element.click]` |
+| `headerButtonSize` | 头部按钮组的大小 | String | `"default", "medium", "small", "mini"` | `small` |
+
+#### 3.1.2 Events
+
+| Event Name | Description | Callback Parameters |
+| --------------- | ------------------------------------------------------------ | -------------------------------- |
+| `init-finished` | 流程实例等初始化完成之后 | `modeler` |
+| `change` | 流程发生可监听的改变时 ( `EventBus.on("commandStack.changed")`) | `XMLString` |
+| `destroy` | 组件准备销毁时,此时流程实例已经销毁 | `modeler` |
+| `BpmnEvents` | Like `element.click`, will replace `.` to `-` (`ex: "element.click" => "element-click"` ). If you want to use an event, you must add the event name to the "`events`" parameter 传入参数 `events` 对应的事件发生时触发,会将 `events` 数组内部的事件名称中的 `.` 替换成 `-` 来适配 `vue` 的自定义监听事件。比如 `"element.click"` 会变成 `element-click` | `element, InternalEventInstance` |
+
+#### 3.1.3 Methods
+
+| Method Name | Parameters | Description |
+| ----------------------- | ------------------------------ | ---------------------------------------- |
+| `downloadProcessAsXml` | `name: string = "diagram"` | 下载文件为 `${name}.xml` 格式的文件 |
+| `downloadProcessAsBpmn` | `name: string = "diagram"` | 下载文件为 `${name}.bpmn` 格式的文件 |
+| `downloadProcessAsSvg` | `name: string = "diagram"` | 下载文件为 `${name}.svg` 格式的文件 |
+| `processRedo` | - | 恢复上次操作 |
+| `processUndo` | - | 撤销本次操作 |
+| `processZoomIn` | `newZoom: number = 0.1` | 按照指定倍率缩小视图(小数点后两位) |
+| `processZoomOut` | `newZoom: number = 1` | 按照指定倍率放大视图(小数点后两位) |
+| `processZoomTo` | `newZoom: number = 1` | 缩放视图到指定倍率 |
+| `processReZoom` | - | 重置缩放倍率并居中显示全部元素 |
+| `processRestart` | - | 重置所有编辑过程并清空画布 |
+| `createNewDiagram` | `xml: string` | 重新导入新的xml字符串 |
+
+### 3.2 MyProcessPenal
+
+#### 3.2.1 Attributes
+
+| Attribute | Description | Type | Accepted Values | Default |
+| -------------- | --------------------------------- | ------ | --------------------------------- | --------- |
+| `bpmn-modeler` | 初始化生成的 `modeler` 实例,必须 | Object | - | - |
+| `prefix` | 流程引擎对应扩展属性前缀 | String | `camunda`, `activiti`, `flowable` | `camunda` |
+| `width` | 侧边栏宽度 | Number | - | 480 |
+
+
+## 4. 功能说明
+
+1. 工具栏:包含常见操作,比如打开文件、下载文件、预览、对齐方式、缩放管理、撤销删除等
+2. 常规信息:id、名称、扩展属性、元素文档
+3. 特殊节点属性:
+ 1. 流程全局消息与信号
+ 2. 执行监听器
+ 3. 用户任务节点 任务监听器
+ 4. 表单配置
+ 5. 任务配置
+ 6. 多实例任务
+ 7. 流转条件
+4. 内置常用 `camunda` ,`flowable`,`activiti` 解析文件
+5. 自定义左侧元素栏 `platte` 与弹出菜单 `contentPad` 示例模块
+6. 自定义渲染方法 `renderer` 模块实例
+
+
+## 5. 运行截图
+
+### 5.1 初始界面
+
+
+
+### 5.2 监听器
+
+
+
+
+
+
+
+### 5.3 扩展属性
+
+
+
+### 5.4 流转路径配置
+
+
+
+
+### 5.5 任务配置
+
+
+
+### 5.6 多实例任务
+
+
+
+### 5.8 表单配置
+
+
+
+
+
+### 5.9 预览
+
+
+
+
+## 学习交流
+
+如果您觉得这些文章对您有帮助,想和我一起学习,欢迎您关注我的微信订阅号。
+
+订阅号名称:前端小白MiyueFE
+订阅号:[前端小白MiyueFE](https://images.weserv.nl/?url=https://i0.hdslb.com/bfs/article/fdef0d8f1731ed03b4123d22b7d82acacb6ca10c.jpg)
diff --git a/babel.config.js b/babel.config.js
index ac34f0fa5435bf80afb160bf4396c0532930e238..e9558405fdcc02f12d757acb308e02937a7444f1 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -1,3 +1,5 @@
-// 需要在项目根目录放置 babel.config.js
-// 通过修改webpack配置制定configFile路径,发现打包主题有缓存,结果全部都是第一次编译的主题,在根目录放置配置文件即正常
-module.exports = require('./core/babel.config')
+module.exports = {
+ presets: [
+ '@vue/cli-plugin-babel/preset'
+ ]
+}
diff --git a/bin/my.js b/bin/my.js
deleted file mode 100644
index 3f040e9be10f76dc0c63e036cbca4d37082fec7b..0000000000000000000000000000000000000000
--- a/bin/my.js
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env node
-
-const {semver, error, warn} = require('@vue/cli-shared-utils')
-const requiredVersion = require('../package.json').engines.node
-
-if (!semver.satisfies(process.version, requiredVersion)) {
- error(
- `您在用的Node版本是 ${process.version} 但是 my 命令行工具要求 Node 版本 ${requiredVersion}。 请您升级Node版本!`
- )
- process.exit(1)
-}
-
-const defaultCommand = function (args, type) {
- warn(
- `my不支持${type}命令,请检查输入是否正确,或查看my命令文档和用法。`
- )
-}
-
-const commandArray = [
- 'coder',
- 'fix',
- 'color',
- 'jsdoc',
- 'svg',
- 'demo',
- 'theme',
- 'ready',
- 'route',
- 'bridge',
- 'start',
- 'server',
- 'preview',
- 'app',
- 'page',
- 'widgets',
- 'create'
-]
-const commandMap = Object.create(null)
-commandArray.forEach(name => {
- commandMap[name] = require(`../core/bin/${name}`)
-})
-
-const rawArgv = process.argv.slice(2)
-const [type, ...args] = rawArgv
-const commandHandler = commandMap[type] || defaultCommand
-
-commandHandler(args, type)
diff --git a/core/babel.config.js b/core/babel.config.js
deleted file mode 100644
index e957f99e26b7f4f1439b7c71405cb0b770ed5d6c..0000000000000000000000000000000000000000
--- a/core/babel.config.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * babel 配置
- * @author chenhuachun
- */
-module.exports = {
- presets: [
- '@vue/cli-plugin-babel/preset'
- ],
- sourceType: 'unambiguous',
- plugins: [
- [
- 'component',
- {
- libraryName: 'element-ui',
- styleLibraryName: `~.my/el-themes/${process.env.THEME || 'default'}`
- }
- ],
- [
- 'component',
- {
- libraryName: '$ui',
- libDir: 'components',
- styleLibraryName: `~.my/ui-themes/${process.env.THEME || 'default'}`
- },
- '$ui'
- ],
- [
- 'component',
- {
- libraryName: '$ui/charts',
- libDir: 'packages',
- style: false
- },
- '$ui/charts'
- ],
- [
- 'component',
- {
- libraryName: '$ui/map',
- libDir: 'packages',
- style: false
- },
- '$ui/map'
- ],
- [
- 'component',
- {
- libraryName: '$ui/dv',
- libDir: 'packages',
- style: false
- },
- '$ui/dv'
- ]
- ]
-}
diff --git a/core/babel.plugins.js b/core/babel.plugins.js
deleted file mode 100644
index 97945878eb6c19f67167f402731acc1e8283f686..0000000000000000000000000000000000000000
--- a/core/babel.plugins.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 基础项目引用的babel插件
- */
-module.exports = [
- [
- 'component',
- {
- libraryName: 'element-ui',
- styleLibraryName: 'theme-chalk'
- }
- ],
- [
- 'component',
- {
- libraryName: '$ui',
- libDir: 'components',
- styleLibraryName: '~node_modules/@xdh/my/ui/lib/styles',
- ext: '.scss'
- },
- '$ui'
- ],
- [
- 'component',
- {
- libraryName: '$ui/charts',
- libDir: 'packages',
- style: false
- },
- '$ui/charts'
- ],
- [
- 'component',
- {
- libraryName: '$ui/map',
- libDir: 'packages',
- style: false
- },
- '$ui/map'
- ],
- [
- 'component',
- {
- libraryName: '$ui/dv',
- libDir: 'packages',
- style: false
- },
- '$ui/dv'
- ]
-]
diff --git a/core/bin/app.js b/core/bin/app.js
deleted file mode 100644
index 93e3763a6bc9a835d5bba287bb2d845727506400..0000000000000000000000000000000000000000
--- a/core/bin/app.js
+++ /dev/null
@@ -1,29 +0,0 @@
-module.exports = function (args = []) {
- const app = require('../build/app')
- const utils = require('../utils')
- const [action, appName, port] = args
-
- switch (action) {
- case 'add':
- if (!appName) {
- utils.log('需要指定应用名称', 'warning')
- return false
- }
- app.add(appName, parseInt(port || 8001))
- break;
- case 'remove':
- if (!appName) {
- utils.log('需要指定应用名称', 'warning')
- return false
- }
- app.remove(appName)
- break;
- case 'build':
- app.build()
- break;
- default:
- utils.log('缺少操作名称', 'warning')
- break;
- }
-
-}
diff --git a/core/bin/bridge.js b/core/bin/bridge.js
deleted file mode 100644
index 950b88b2f3eabf15a71ddb70d01ce9c61164aeb1..0000000000000000000000000000000000000000
--- a/core/bin/bridge.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = function() {
- require('../build/bridge-builder')
-}
diff --git a/core/bin/coder.js b/core/bin/coder.js
deleted file mode 100644
index 804233a7a7e2be2ec3458e361a8f998b3e7a16bf..0000000000000000000000000000000000000000
--- a/core/bin/coder.js
+++ /dev/null
@@ -1,7 +0,0 @@
-const coder = require('../build/coder')
-
-module.exports = function (args) {
- const force = !!args[0]
- coder(force)
-
-}
diff --git a/core/bin/color.js b/core/bin/color.js
deleted file mode 100644
index 518e2037f83a7dc9df27ae27afea7d91eb790309..0000000000000000000000000000000000000000
--- a/core/bin/color.js
+++ /dev/null
@@ -1,4 +0,0 @@
-const palette = require('../build/colors.js')
-module.exports = function (args) {
- palette.write()
-}
diff --git a/core/bin/create.js b/core/bin/create.js
deleted file mode 100644
index 109c4e7011a5e1887d06c4b44cb633fe8d721114..0000000000000000000000000000000000000000
--- a/core/bin/create.js
+++ /dev/null
@@ -1,30 +0,0 @@
-const core = require('../index')
-const utils = require('../utils')
-const join = utils.join
-const root = core.MyRootPath
-const pathsList = {
- bin: join(root, 'bin'),
- core: join(root, 'core'),
- types: join(root, 'types'),
- ui: join(root, 'ui'),
- web: join(root, 'web'),
- LICENSE: join(root, 'LICENSE'),
- 'package.json': join(root, 'package.json'),
- 'README.md': join(root, 'README.md')
-}
-
-const localPath = join(core.ProjectRootPath, '.my', '@xdh', 'my')
-
-module.exports = function(args = []) {
- utils.mkdir(localPath)
- const allCopy = Object.entries(pathsList).map((entry) => {
- return utils.copy(entry[1], join(localPath, entry[0])).then((res) => {
- utils.log(`复制${entry[0]}成功`, 'success')
- return Promise.resolve()
- })
- })
- Promise.all(allCopy).then(() => {
- utils.log('创建完成', 'success')
- })
-
-}
\ No newline at end of file
diff --git a/core/bin/demo.js b/core/bin/demo.js
deleted file mode 100644
index 2078dec43a0e8e71ada606845b67aef8777e278e..0000000000000000000000000000000000000000
--- a/core/bin/demo.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = function () {
- require('../build/demo-builder')()
-}
diff --git a/core/bin/fix.js b/core/bin/fix.js
deleted file mode 100644
index 5b951ae6633e4ff8b709f9a150e60d8a3f5e7469..0000000000000000000000000000000000000000
--- a/core/bin/fix.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = function (args) {
- require('../build/fix')
-}
diff --git a/core/bin/jsdoc.js b/core/bin/jsdoc.js
deleted file mode 100644
index bc1dd2b09983a7afad60332a75d21653b78a544a..0000000000000000000000000000000000000000
--- a/core/bin/jsdoc.js
+++ /dev/null
@@ -1,8 +0,0 @@
-module.exports = function () {
- const builder = require('../build/jsdoc-builder')
- builder('utils')
- builder('components')
- builder('map')
- builder('charts')
- builder('dv')
-}
diff --git a/core/bin/page.js b/core/bin/page.js
deleted file mode 100644
index f174feabcff54143851ac9e03df3c465c98815a6..0000000000000000000000000000000000000000
--- a/core/bin/page.js
+++ /dev/null
@@ -1,35 +0,0 @@
-const fs = require('fs')
-const core = require('../index')
-const utils = require('../utils')
-const packageJSON = core.IsInstalled ? require('../../../../../package.json') : require('../../package.json')
-
-function isExistApp(app) {
- return !!(packageJSON.apps || {})[app]
-}
-
-module.exports = function (args = []) {
- const [page, local, app] = args
- if (!page || !local) {
- utils.log('缺少 page 和 local 参数', 'error')
- return
- }
- if (app && !isExistApp(app)) {
- utils.log(`子应用 ${app} 不存在`, 'error')
- return;
- }
-
- const pagePath = utils.join(core.LibPath, 'pages', page + '.vue')
- if (!fs.existsSync(pagePath)) {
- utils.log(`不存在 ${page} 的页面模板`, 'warning')
- return
- }
- const localPath = app
- ? utils.join(core.AppsPath, app, 'views', local + '.vue')
- : utils.join(core.ProjectRootPath, 'src', 'views', local + '.vue')
- if (fs.existsSync(localPath)) {
- utils.log(`当前目录已存在 ${local} 的文件,请更换名称或删除该文件。`, 'warning')
- return
- }
- utils.copyFile(pagePath, localPath)
- utils.log(`页面已经安装成功,位置:${localPath}`, 'success')
-}
diff --git a/core/bin/preview.js b/core/bin/preview.js
deleted file mode 100644
index a7bb7f02c7a8b57cc1f7a52fdf2951561de2b284..0000000000000000000000000000000000000000
--- a/core/bin/preview.js
+++ /dev/null
@@ -1,15 +0,0 @@
-module.exports = function () {
- const config = require('../config')();
- const core = require('../index')
- const utils = require('../utils')
- const createHttpServer = require('../server/http')
-
- createHttpServer({
- port: config.previewServerPort,
- root: utils.join(core.ProjectRootPath, config.outputDir),
- path: config.publicPath,
- routes: [],
- open: true
- })
-
-}
diff --git a/core/bin/ready.js b/core/bin/ready.js
deleted file mode 100644
index 6270c23e1e416320d25673d3f8c5d4b44be1eb0f..0000000000000000000000000000000000000000
--- a/core/bin/ready.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * 初始化,在启动开发环境或生产环境打包之前要完成的操作
- */
-
-
-module.exports = function (args) {
-
- const fs = require('fs')
- const core = require('../index')
- const themeBuilder = require('./theme')
- const elThemes = core.OutputElementThemePath
- const uiThemes = core.OutputUIThemePath
-
-
-// 如不存在 el-themes 即 编译
- if (!fs.existsSync(elThemes)) {
- themeBuilder(['el'])
- }
-// 如不存在 ui-themes 即编译
- if (!fs.existsSync(uiThemes)) {
- themeBuilder(['ui'])
- }
-
-// 重新生成代码
- require('./coder')(args)
-}
diff --git a/core/bin/route.js b/core/bin/route.js
deleted file mode 100644
index 15d0b4d4070a56ecff3391b907118abd7d10c0ed..0000000000000000000000000000000000000000
--- a/core/bin/route.js
+++ /dev/null
@@ -1,43 +0,0 @@
-module.exports = function (args = []) {
- const core = require('../index')
- const utils = require('../utils')
- const config = require('../config')()
- const packageJson = core.IsInstalled ? require('../../../../../package.json') : require('../../package.json')
-
- const [routeAction, routeApp] = args
- const routesBuilder = require('../build/routes')
- let viewPath = ''
- let outFile = ''
- let autoRoutes = true
- if (routeApp) {
- const apps = packageJson.apps || {}
- const app = apps[routeApp]
- if (app) {
- viewPath = utils.join(core.AppsPath, routeApp, 'views')
- outFile = utils.join(core.TempPath, 'routes', `${routeApp}.js`)
- autoRoutes = app.autoRoutes
- } else {
- utils.log(`应用${routeApp}不存在`)
- }
- } else {
- viewPath = core.ViewsPath
- outFile = core.OutputRoutesFile
- autoRoutes = config.autoRoutes
- }
-
- if (routeAction === 'watch') {
- routesBuilder.watch(
- viewPath,
- outFile,
- !autoRoutes
- )
- }
-
- if (routeAction === 'build') {
- routesBuilder.build(
- viewPath,
- outFile,
- !autoRoutes
- )
- }
-}
diff --git a/core/bin/server.js b/core/bin/server.js
deleted file mode 100644
index 117c260ac93117178ce9c76c76eda67f6e4f2da1..0000000000000000000000000000000000000000
--- a/core/bin/server.js
+++ /dev/null
@@ -1,4 +0,0 @@
-// 适配兼容旧版本,新版改为 start
-module.exports = function () {
- require('../server/app')
-}
diff --git a/core/bin/start.js b/core/bin/start.js
deleted file mode 100644
index 5b7e8c1dca28d655bc81534b8847321fce4313ad..0000000000000000000000000000000000000000
--- a/core/bin/start.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = function () {
- require('../server/app')
-}
diff --git a/core/bin/svg.js b/core/bin/svg.js
deleted file mode 100644
index 56770bea158a05d2095963bb66744488874df116..0000000000000000000000000000000000000000
--- a/core/bin/svg.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = function () {
- require('../build/svg')
-}
diff --git a/core/bin/theme.js b/core/bin/theme.js
deleted file mode 100644
index 6068a3fbdc36a8d1eb16e6690824a2ad92e5c75b..0000000000000000000000000000000000000000
--- a/core/bin/theme.js
+++ /dev/null
@@ -1,35 +0,0 @@
-const builder = require('../build/theme')
-
-
-module.exports = function (args) {
- const type = args[0]
- switch (type) {
- case 'el':
- case 'ui':
- builder(type, (stats, ret) => {
- if (!ret) {
- console.log(stats.toString({
- chunks: false,
- colors: true
- }))
- }
- })
- break;
- case 'prod':
- require('../build/prod-theme-builder')(args[1])
- break;
- default:
- ['el', 'ui'].forEach(t => {
- builder(t, (stats, ret) => {
- if (!ret) {
- console.log(stats.toString({
- chunks: false,
- colors: true
- }))
- }
- })
- })
- break
- }
-
-}
diff --git a/core/bin/widgets.js b/core/bin/widgets.js
deleted file mode 100644
index 453fc3ac5067d835e34a2eec4c6470c7f0b06675..0000000000000000000000000000000000000000
--- a/core/bin/widgets.js
+++ /dev/null
@@ -1,20 +0,0 @@
-// const fs = require('fs')
-const core = require('../index')
-const utils = require('../utils')
-const pathList = require(utils.join(core.LibPath, 'widgets/path.js'))
-
-module.exports = function(args = []) {
- const pathName = args[0]
- if (!pathName || !pathList[pathName]) {
- utils.log('缺少 工具参数 或 没有当前工具', 'error')
- return
- }
- const widgetPath = utils.join(core.LibPath, 'widgets', pathList[pathName])
-
- const localPath = utils.join(core.ProjectRootPath, '.my', 'widgets', pathList[pathName])
-
- // console.log(widgetPath, localPath)
-
- utils.copy(widgetPath, localPath)
- utils.log(`工具已经安装成功,位置:${localPath}`, 'success')
-}
\ No newline at end of file
diff --git a/core/build/app.js b/core/build/app.js
deleted file mode 100644
index b56b338bc1a1194ed4fa8728e24eed6c6545082b..0000000000000000000000000000000000000000
--- a/core/build/app.js
+++ /dev/null
@@ -1,227 +0,0 @@
-const fs = require('fs')
-const process = require('child_process')
-const utils = require('../utils')
-const core = require('../index')
-const packageJSON = core.IsInstalled ? require('../../../../../package.json') : require('../../package.json')
-
-const packageFile = utils.join(core.ProjectRootPath, 'package.json')
-const appsDir = core.AppsPath
-const appsConfigJSON = packageJSON.apps || {}
-
-/**
- * 验证要创建的应用名称是否合法
- * @param name
- * @return {boolean}
- */
-function validate(name) {
- if (core.AppReservedWords.includes(name)) {
- utils.log(`>>> ${name} 是保留关键字,请更换其他名称再试!`, 'warning')
- return false
- }
- if (fs.existsSync(appsDir)) {
- const dirs = fs.readdirSync(appsDir)
- if (dirs.includes(name)) {
- utils.log(`>>> 站点名称 ${name} 已被使用 ,请更换其他名称再试!`, 'warning')
- return false
- }
- }
- return true
-}
-
-/**
- * 写入package.json命令
- * @param name
- */
-function insertCommander(name) {
- const dev = `npm run ready && cross-env APP=${name} concurrently "npm run serve -- --open" "npm run route watch ${name}"`
- const build = `npm run ready && npm run route build ${name} && npm run theme prod ${name} && cross-env APP=${name} npm run build`
- packageJSON.scripts[`dev:${name}`] = dev
- packageJSON.scripts[`build:${name}`] = build
- utils.writeFile(
- packageFile,
- JSON.stringify(packageJSON, null, 2)
- )
-}
-
-/**
- * 删除package.json命令
- * @param name
- */
-function removeCommander(name) {
- delete packageJSON.scripts[`dev:${name}`]
- delete packageJSON.scripts[`build:${name}`]
- utils.writeFile(
- packageFile,
- JSON.stringify(packageJSON, null, 2)
- )
-}
-
-/**
- * 写入配置
- * @param name
- * @param port
- */
-function writeConfig(name, port) {
- appsConfigJSON[name] = {
- name: name,
- port: port,
- autoRoutes: true,
- // 默认自动
- publicPath: null,
- // 默认自动
- outputDir: null,
- // 是否采用独立的静态配置文件,false表示取主应用的配置
- staticConfig: false,
- // 开启模拟数据
- mock: false,
- contentBase: []
- }
-
- packageJSON.apps = appsConfigJSON
-
- utils.writeFile(
- packageFile,
- JSON.stringify(packageJSON, null, 2)
- )
-}
-
-/**
- * 把应用名称写入到配置文件
- * @param to
- * @param name
- */
-function injectAppName(to, name) {
- const file = utils.join(to, 'config.js')
- let content = fs.readFileSync(file, 'utf-8')
- if (content) {
- content = content.replace(/{{appName}}/gi, name)
- }
- utils.writeFile(
- file,
- content
- )
-}
-
-/**
- * 清除配置文件
- * @param name
- */
-function clearConfig(name) {
- delete appsConfigJSON[name]
- packageJSON.apps = appsConfigJSON
-
- const content = JSON.stringify(packageJSON, null, 2)
- utils.writeFile(packageFile, content)
-}
-
-/**
- * 新增应用
- * @param name 应用名称
- * @param port 开发环境端口号
- */
-function add(name, port) {
- if (!validate(name)) return
-
- // 写入配置文件
- writeConfig(name, port)
-
- const from = core.AppTemplatePath
- const to = utils.join(core.AppsPath, name)
-
- // 复制app模板到 apps目录
- utils.copy(from, to).then(() => {
- // 注入应用名称到配置文件
- injectAppName(to, name)
- })
-
- // 写入 package.json 命令
- insertCommander(name)
-
- utils.log(`>>>【 ${name} 】站点创建成功!`, 'success')
-}
-
-/**
- * 删除应用
- * @param name 应用名称
- */
-function remove(name) {
-
- // 清除命令
- removeCommander(name)
-
- // 清除命令
- clearConfig(name)
-
- // 删除应用文件
- utils.rm(utils.join(core.AppsPath, name))
-
- utils.log(`>>>【 ${name} 】站点删除成功!`, 'success')
-}
-
-/**
- * 执行队列函数
- * @param array
- * @param func
- * @param finish
- */
-function queue(array, func, finish) {
- if (array.length > 0) {
- const item = array.shift();
- func(item)
- .then(() => {
- queue(array, func, finish);
- })
- .catch(e => {
- queue(array, func, finish);
- });
- } else {
- finish && finish();
- }
-}
-
-/**
- * 发布全部应用
- */
-function build() {
- const apps = Object.keys(appsConfigJSON)
- const total = apps.length
- if (total === 0) {
- utils.log('没有可发布的子应用', 'warning')
- return
- }
- const startTime = new Date().getTime();
- utils.log('开始发布子应用')
- queue(apps,
- function (name) {
- utils.log(`>>> ${name} ...`)
- return new Promise((resolve, reject) => {
- const cmd = `npm run build:${name}`
- process.exec(cmd, (err, std) => {
- if (err) {
- utils.log(err, 'error')
- utils.log(`>>> 【${name}】应用编译失败,错误信息:`, 'warning')
- utils.log(std)
- reject(err)
- return
- }
- resolve()
- utils.log(`>>>【${name}】应用编译成功!`, 'success')
- })
- })
-
- },
- function () {
- const endTime = (new Date().getTime() - startTime) / 1000;
- utils.log(`>>> 全部子应用发布完成, 耗时:${endTime}秒, 平均每个应用耗时:${endTime / total}秒`, 'success')
- })
-
-}
-
-
-module.exports = {
- add,
- remove,
- build
-}
-
-
diff --git a/core/build/bridge-builder.js b/core/build/bridge-builder.js
deleted file mode 100644
index b4177189a7737d29d32066d0a37a8fda63e56c20..0000000000000000000000000000000000000000
--- a/core/build/bridge-builder.js
+++ /dev/null
@@ -1,21 +0,0 @@
-const webpack = require('webpack')
-const utils = require('../utils')
-const config = require('../config/webpack.bridge.config')
-const libConfig = require('../config/wepack.bridge.lib.config')
-
-utils.rm(config.output.path)
-utils.log('正在执行编译bridge ...')
-webpack(config, (err, stats) => {
- if (err || stats.hasErrors()) {
- utils.log(stats, 'error')
- } else {
- // 打包类库
- webpack(libConfig, (err, stats) => {
- if (err || stats.hasErrors()) {
- utils.log(stats, 'error')
- } else {
- utils.log('>>> bridge 编译完成', 'success')
- }
- })
- }
-})
diff --git a/core/build/bridge-entry.js b/core/build/bridge-entry.js
deleted file mode 100644
index da7e53bb7859fc90bcfa4799267a5d0629ab6085..0000000000000000000000000000000000000000
--- a/core/build/bridge-entry.js
+++ /dev/null
@@ -1,10 +0,0 @@
-import Messager, {MESSAGE_TYPE} from '$ui/utils/messager'
-
-const messager = new Messager({
- target: parent.window
-})
-
-messager.on(MESSAGE_TYPE, function (data) {
- messager.pass(data)
-})
-
diff --git a/core/build/coder.js b/core/build/coder.js
deleted file mode 100644
index 54c0b47db7181a20600fd4c84fc79e059026d0ec..0000000000000000000000000000000000000000
--- a/core/build/coder.js
+++ /dev/null
@@ -1,510 +0,0 @@
-/**
- * 代码生成器
- * @author chenhuachun
- */
-const fs = require('fs')
-const path = require('path')
-const {logWithSpinner, stopSpinner} = require('@vue/cli-shared-utils')
-const _ = require('lodash')
-const pathToRegexp = require('path-to-regexp')
-const config = require('../config/coder.config')
-const utils = require('../utils')
-
-const schemaFiles = getSchemaFiles(config.schemasDir)
-const schemaInfo = getSchemaInfo(schemaFiles)
-const schemaJSON = parseSchemas(schemaInfo)
-const apiRender = getRender('api.js')
-const mockRender = getRender('mock.js')
-const storeRender = getRender('store.js')
-const mixinRender = getRender('mixin.js')
-const typesRender = getRender('types.js')
-const iconsRender = getRender('icons.js')
-
-/**
- * 读取模板渲染函数
- * @param file
- */
-function getRender(file) {
- return require(path.join(config.templatesDir, file))
-}
-
-/**
- * 转换成规范的js命名,如:sys_log.js 转换成 sysLog
- * @param name
- */
-function toSchemaName(name) {
- return _.camelCase(name.replace('.js', ''))
-}
-
-/**
- * 获取架构配置文件列表
- * @param root 从那个路径开始查找
- * @param parent 当前的目录名称,可选
- * @returns {Array}
- */
-function getSchemaFiles(root, parent) {
- let fileList = []
- if (!fs.existsSync(root)) {
- utils.log('警告:schemas已自动创建', 'warning')
- fs.mkdirSync(root)
- return fileList
- }
- const files = fs.readdirSync(root)
- _.each(files, function (file) {
- const filePath = path.join(root, file)
- const stat = fs.lstatSync(filePath)
- if (stat.isDirectory()) {
- fileList = fileList.concat(getSchemaFiles(filePath, file))
- } else {
- if (file.indexOf('.js') > 0) {
- fileList.push({
- name: toSchemaName(parent ? [parent, file].join('_') : file),
- path: filePath
- })
- }
- }
- })
- return fileList
-}
-
-/**
- * 根据配置文件生成配置JSON
- * @param files
- * @returns {{}}
- */
-function getSchemaInfo(files) {
- const models = {}
- _.each(files, function (file) {
- models[file.name] = require(file.path)
- })
- return models
-}
-
-/**
- * 创建文件
- * @param path
- * @param fileName
- * @param content
- */
-function writeFile(path, fileName, content) {
- utils.writeFile(utils.join(path, fileName + '.js'), content)
-}
-
-function toUpperCase(name) {
- return name.toUpperCase()
-}
-
-/**
- * Foo Bar | --foo-bar | __foo_bar__ => fooBar
- * @param name
- */
-function toCamelCase(name) {
- return _.camelCase(name)
-}
-
-/**
- * Foo Bar | fooBar | --foo-bar => foo_bar
- * @param name
- */
-function toSnakeCase(name) {
- return _.snakeCase(name)
-}
-
-/**
- * fooBar => foo-bar
- * @param name
- */
-function toKebabCase(name) {
- return _.kebabCase(name)
-}
-
-function toUpperSnakeCaseName(name) {
- return toUpperCase(toSnakeCase(name))
-}
-
-
-/**
- * JSON转换成字符串,并把双引号转换成单引号
- * @param json
- */
-function stringify(json) {
- const str = JSON.stringify(json)
- return str ? str.replace(/'/g, '\\\'').replace(/"/g, '\'') : ''
-}
-
-/**
- * 解析models
- * @param schemas
- * @returns {{}}
- */
-function parseSchemas(schemas) {
- const result = {}
- _.each(schemas, function (schema, name) {
- result[name] = parseModel(schema.model, name, schema.vuex)
- })
- return result
-}
-
-function getTitle(name, item, info) {
- const methodComment = config.methodCommentMap[item.methodType] || item.title || '<%=cname%> ' + (item.upperSnakeCaseName || '')
- return _.template(methodComment)({cname: info[name].name || name})
-}
-
-/**
- * 解析单个model
- * @param model
- * @param name
- * @param vuex
- * @returns {Array}
- */
-function parseModel(model, name, vuex) {
- let result = []
- if (_.isArray(model)) {
- _.each(model, function (item) {
- if (item.disabled !== true && item.path) {
- result = result.concat(parseModel(item, name, vuex))
- }
- })
- } else {
- if (model.disabled !== true && model.path) {
- if (model.methods === false) {
- if (!model.name) {
- throw Error('methods为false时,必须要设置name')
- }
- if (vuex && (!model.state && !model.method)) {
- throw Error('vuex模式,methods为false,并且method为空时,必须要设置state')
- }
-
- if (model.method && !config.methods.includes(model.method)) {
- throw Error('method的值必须是' + config.methods.join(' ') + '中的一个')
- }
- // ajax请求类型
- const httpMethod = config.methodTypeMap[model.method || model.name] || 'post'
-
- const options = _.extend({}, {method: httpMethod}, model.options || {})
- result.push({
- path: model.path,
- prefix: model.prefix || config.pathPrefix,
- transform: model.transform,
- options: options,
- columns: model.columns,
- methodType: model.method || model.name,
- httpMethod: options.method,
- suffix: '',
- upperSnakeCaseName: toUpperSnakeCaseName(model.name),
- camelCaseName: toCamelCase(model.name),
- template: model.template,
- name: model.name,
- state: model.state,
- title: model.title,
- cache: model.cache,
- socket: model.socket
- })
- } else {
- const methods = model.methods || config.methods
- _.each(methods, function (method) {
-
- // 检测是否开启了批量删除
- if (method === 'batch' && !config.batchEnabled) return
-
- // ajax请求类型
- const httpMethod = config.methodTypeMap[method] || 'get'
- // axios options
- const options = _.extend({}, {method: httpMethod}, model.options || {})
- result.push({
- path: model.path,
- transform: model.transform,
- prefix: model.prefix || config.pathPrefix,
- suffix: config.methodSuffixMap[method] || '',
- options: options,
- columns: model.columns,
- methodType: method,
- httpMethod: httpMethod,
- upperSnakeCaseName: toUpperSnakeCaseName(method + '_' + name),
- camelCaseName: toCamelCase(method + '_' + name),
- template: model.template,
- title: model.title,
- cache: model.cache,
- socket: model.socket
- })
- })
- }
- }
- }
- return result
-}
-
-/**
- * 生成api文件
- */
-function writeApi(json, info) {
- _.each(json, function (model, name) {
- const items = []
- let configKeys = [], transforms = []
- _.each(model, function (item) {
- if (item.prefix) {
- configKeys.push(item.prefix)
- }
- if (item.transform) {
- transforms.push(item.transform)
- }
- const url = item.path + item.suffix
- const keys = []
- pathToRegexp(url, keys)
-
- // 去重,在数组中已存在的URL不加进去
- if (!items.some(n => n.URL === item.upperSnakeCaseName)) {
- items.push({
- URL: item.upperSnakeCaseName,
- url: item.path + item.suffix,
- prefix: item.prefix,
- params: keys.map(n => n.name),
- camelCaseName: item.camelCaseName,
- options: item.options,
- ajaxParam: 'data',
- transform: item.transform,
- title: getTitle(name, item, info),
- cache: item.cache,
- socket: item.socket
- })
- }
- })
- // 去重
- configKeys = _.uniq(configKeys)
- transforms = _.uniq(transforms)
- writeFile(config.outApiPath, toKebabCase(name), utils.beautifyJs(apiRender({
- cname: info[name].name,
- name: name,
- transforms: transforms,
- configKeys: configKeys,
- items: items
- })))
- })
-}
-
-/**
- * 生成mock文件
- */
-function writeMock(json) {
- const dbConfig = [], extendsArray = [];
- _.each(json, function (model, name) {
- const kebabCaseName = toKebabCase(name)
- dbConfig.push(`import ${name} from '$my/code/mock/${kebabCaseName}'`)
- extendsArray.push(`...${name}`)
- const mocks = []
- let importApiArray = [], templateArray = []
- _.each(model, function (item) {
- if (item.columns || item.template) {
- importApiArray.push(item.upperSnakeCaseName)
- }
- if (item.template) {
- templateArray.push(item.template)
- }
- if (item.columns || item.template) {
- mocks.push({
- URL: item.upperSnakeCaseName,
- page: config.statePageName || 'page',
- limit: config.statePageSizeName || 'limit',
- total: config.stateTotalName || 'total',
- list: config.stateListName || 'list',
- httpMethod: item.httpMethod,
- methodType: item.methodType,
- columns: stringify(item.columns || {}, '', '\t'),
- template: item.template
- })
- }
- })
- importApiArray = _.uniq(importApiArray)
- templateArray = _.uniq(templateArray)
- writeFile(config.outMockPath, toKebabCase(name), utils.beautifyJs(mockRender({
- importApiArray: importApiArray,
- name: name,
- kebabCaseName: toKebabCase(name),
- mocks: mocks,
- code: config.mockCodeName || 'code',
- data: config.mockDataName || 'data',
- message: config.mockMsgName || 'message',
- templateArray: templateArray,
- codeValue: config.successCodeValue,
- addData: stringify(config.addMockData),
- updateData: stringify(config.updateMockData),
- removeData: stringify(config.removeMockData),
- batchData: stringify(config.batchMockData)
- })))
- })
- dbConfig.push(`export default [${extendsArray.join(', ')}]`)
- writeFile(config.outMockConfig, 'rules', dbConfig.join('\n') + '\n')
-}
-
-/**
- * 生成mixin文件
- */
-function writeMixin(json, info) {
- _.each(json, function (model, name) {
- if (info[name].vuex) {
- return
- }
- let importTypeArray = [],
- importApiArray = [],
- customStateArray = []
- const items = []
- _.each(model, function (item) {
- importTypeArray.push(item.upperSnakeCaseName)
- importApiArray.push(item.camelCaseName)
- if (item.state) {
- customStateArray.push({
- state: item.state,
- title: item.title || item.upperSnakeCaseName
- })
- }
- const url = item.path + item.suffix
- const keys = []
- pathToRegexp(url, keys)
-
- items.push({
- NAME: item.upperSnakeCaseName,
- name: item.camelCaseName,
- state: item.state,
- params: keys.map(n => n.name),
- httpMethod: item.httpMethod,
- methodType: item.methodType,
- ajaxParam: 'data',
- title: getTitle(name, item, info),
- cache: item.cache
- })
- })
- importTypeArray = _.uniq(importTypeArray)
- importApiArray = _.uniq(importApiArray)
- customStateArray = _.uniq(customStateArray)
- writeFile(config.outMixinPath, toKebabCase(name), utils.beautifyJs(mixinRender({
- name: name,
- cname: info[name].name || name,
- kebabCaseName: toKebabCase(name),
- importTypeArray: importTypeArray,
- importApiArray: importApiArray,
- customStateArray: customStateArray,
- page: config.statePageName || 'page',
- limit: config.statePageSizeName || 'limit',
- total: config.stateTotalName || 'total',
- list: config.stateListName || 'list',
- model: config.stateModelName || 'model',
- items: items
- })))
- })
-}
-
-/**
- * 生成store文件
- */
-function writeStore(json, info) {
- const types = {}
- const modules = [], extendsArray = []
- _.each(json, function (model, name) {
- if (!info[name].vuex) {
- return
- }
- modules.push(`import {${name}} from '$my/code/store/${toKebabCase(name)}'`)
- extendsArray.push(name)
-
- let importTypeArray = [],
- importApiArray = [],
- customStateArray = []
- const items = []
- types[name] = []
- _.each(model, function (item) {
- types[name].push({
- name: item.upperSnakeCaseName,
- title: getTitle(name, item, info)
- })
- importTypeArray.push(item.upperSnakeCaseName)
- importApiArray.push(item.camelCaseName)
- if (item.state) {
- customStateArray.push({
- state: item.state,
- title: item.title || item.upperSnakeCaseName
- })
- }
- const url = item.path + item.suffix
- const keys = []
- pathToRegexp(url, keys)
- items.push({
- NAME: item.upperSnakeCaseName,
- name: item.camelCaseName,
- state: item.state,
- params: keys.map(n => n.name),
- httpMethod: item.httpMethod,
- methodType: item.methodType,
- ajaxParam: 'data',
- title: getTitle(name, item, info),
- cache: item.cache
- })
- })
- importTypeArray = _.uniq(importTypeArray)
- importApiArray = _.uniq(importApiArray)
- customStateArray = _.uniq(customStateArray)
- writeFile(config.outStorePath, toKebabCase(name), utils.beautifyJs(storeRender({
- name: name,
- cname: info[name].name || name,
- kebabCaseName: toKebabCase(name),
- importTypeArray: importTypeArray,
- importApiArray: importApiArray,
- customStateArray: customStateArray,
- page: config.statePageName || 'page',
- limit: config.statePageSizeName || 'limit',
- total: config.stateTotalName || 'total',
- list: config.stateListName || 'list',
- model: config.stateModelName || 'model',
- items: items
- })))
- })
-
- writeFile(config.outStoreType, 'types', utils.beautifyJs(typesRender({types: types})))
- modules.push(`export default {${extendsArray.join(', ')}}`)
- writeFile(config.outStoreType, 'modules', modules.join('\n') + '\n')
-}
-
-function getMyIconData() {
- const content = fs.readFileSync(config.iconCssFile, {encoding: 'utf-8'})
- const regex = /.icon-[\w-_]+:/g
- const matches = content.match(regex)
- return matches.map(function (item) {
- return item.replace('.', '').replace(':', '')
- })
-}
-
-function writeIconData() {
- // element-ui icon
- const content = fs.readFileSync(config.elIconCssFile, {encoding: 'utf-8'})
- const regex = /.el-icon-[\w-_]+:/g
- const matches = content.match(regex)
- const elItems = matches.map(function (item) {
- return item.replace('.el-', 'el-').replace(':', '')
- })
-
- const items = getMyIconData()
-
- const fileContent = iconsRender({items: stringify(items), elItems: stringify(elItems)})
- fs.writeFileSync(config.outIconFile,
- utils.beautifyJs(fileContent),
- 'utf-8')
-}
-
-module.exports = function (force) {
- if (force) {
- utils.rm(config.outDir)
- logWithSpinner('清空目录')
- }
- logWithSpinner('构建代码')
- if (!fs.existsSync(config.outDir)) {
- utils.mkdir(config.outDir)
- }
- writeApi(schemaJSON, schemaInfo)
- writeMock(schemaJSON)
- writeStore(schemaJSON, schemaInfo)
- writeMixin(schemaJSON, schemaInfo)
- writeIconData()
- stopSpinner()
-}
-
-
-
diff --git a/core/build/colors.js b/core/build/colors.js
deleted file mode 100644
index c532ceb7d0112f7510d2db07f882eeedd8fcafca..0000000000000000000000000000000000000000
--- a/core/build/colors.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * 创建 Ant Design 配色SCSS变量文件
- */
-const {logWithSpinner, stopSpinner} = require('@vue/cli-shared-utils')
-const palette = require('@ant-design/colors')
-const utils = require('../utils')
-const core = require('../index')
-
-function getNeutral(color, index) {
- const percents = [1, 0.85, 0.65, 0.45, 0.25, 0.15, 0.09, 0.04, 0.02, 0]
- const val = color === 'black' ? 0 : 255
- return `rgba(${val}, ${val}, ${val}, ${percents[index]})`
-}
-
-function createNeutralVars() {
- const neutralBlack = []
- const neutralWhite = []
-
- for (let i = 0; i < 10; i++) {
- neutralBlack.push(getNeutral('black', i))
- neutralWhite.push(getNeutral('white', i))
- }
- return {
- 'neutral-black': neutralBlack,
- 'neutral-white': neutralWhite
- }
-}
-
-
-// #409EFF
-function writeScssVar() {
- logWithSpinner(core.ColorsVarFilePath)
- const colors = palette.presetPalettes
- colors.custom = generate('#409EFF')
- const content = []
- content.push('// base')
- content.push('$black: #000 !default;')
- content.push('$white: #fff !default;')
- content.push('$none: transparent !default;')
-
- Object.keys(colors).forEach(name => {
- const items = colors[name]
- content.push(`// ${name}`)
- content.push(`$${name}-primary: ${items.primary} !default;`)
- items.reverse().forEach((val, index) => {
- content.push(`$${name}-${index + 1}: ${val} !default;`)
- })
- })
- const neutrals = createNeutralVars()
- Object.keys(neutrals).forEach(name => {
- const items = neutrals[name]
- content.push(`// ${name}`)
- items.forEach((val, index) => {
- content.push(`$${name}-${index + 1}: ${val} !default;`)
- })
- })
-
-
- utils.writeFile(core.ColorsVarFilePath, content.join('\n'))
- stopSpinner()
-}
-
-function generate(color) {
- const items = palette.generate(color);
- items.primary = color;
- return items;
-}
-
-module.exports = {
- write: writeScssVar
-}
-
diff --git a/core/build/demo-builder.js b/core/build/demo-builder.js
deleted file mode 100644
index 8e443dc2fe6a4e50502b99480f132134e0ff1f63..0000000000000000000000000000000000000000
--- a/core/build/demo-builder.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * markdown文档生成demo vue组件
- *
- * @author chenhuachun
- */
-const fs = require('fs')
-const {logWithSpinner, stopSpinner} = require('@vue/cli-shared-utils')
-const MarkdownIt = require('markdown-it')
-const mdLoader = require('../loaders/docs-extend-md-loader')
-const core = require('../index')
-const utils = require('../utils')
-const demoDir = core.DocsTempDemoPath
-
-/**
- * 删除demo文件夹
- */
-function clear() {
- utils.rm(demoDir)
-}
-
-/**
- * 分析md文件,生成demo vue组件
- */
-function build() {
- logWithSpinner('构建markdown代码示例demo')
- const files = utils.getFiles(core.DocsPath)
- .filter(file => file.includes('.md'))
-
- const md = new MarkdownIt({
- html: true
- })
-
- mdLoader(md)
-
- files.forEach((file, index) => {
- const content = fs.readFileSync(file, 'utf-8')
- md.render(content)
- if (index >= files.length - 1) {
- stopSpinner()
- }
- })
-}
-
-module.exports = function () {
- // 先清空目录再生成
- clear()
- build()
-}
-
diff --git a/core/build/dev-theme-switch.js b/core/build/dev-theme-switch.js
deleted file mode 100644
index 8d5adadd2aca7b66f3a5e8466c9a26653f5b5cf7..0000000000000000000000000000000000000000
--- a/core/build/dev-theme-switch.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 开发环境在线切换主题配置,通过改变文件触发热更新实现组件主题刷新
- *
- * @author chenhuachun
- */
-const utils = require('../utils')
-const core = require('../index')
-const fs = require('fs')
-
-/**
- * 更换主题
- * @param theme 主题名称
- */
-module.exports = function (theme) {
- if (theme) {
- const content = `@import "../themes/${theme}";`
- utils.writeFile(core.ProjectThemeScssFile, content)
- const elCssFile = utils.join(core.TempPath, 'el-themes', theme, 'index.css')
- const uiCssFile = utils.join(core.TempPath, 'ui-themes', theme, 'index.css')
- let cssContent = ''
- try {
- const elCss = fs.readFileSync(elCssFile, 'utf-8')
- const uiCss = fs.readFileSync(uiCssFile, 'utf-8')
- cssContent = [elCss, uiCss].join('\n')
- } catch (e) {
- utils.log(e, 'error')
- }
- return cssContent
-
- }
-}
diff --git a/core/build/fix.js b/core/build/fix.js
deleted file mode 100644
index a38087041fe7e44c04161a6c230b4dba8416d86f..0000000000000000000000000000000000000000
--- a/core/build/fix.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * 修复 node_modules 源码的bug
- */
-const fs = require('fs')
-const chalk = require('chalk')
-const ELEMENT_UI_FILE = 'node_modules/element-ui/lib/element-ui.common.js'
-const ELEMENT_UI_UPLOAD_AJAX = 'node_modules/element-ui/lib/upload.js'
-const AXIOS_FILE = 'node_modules/axios/lib/adapters/xhr.js'
-const GOJS_FILE = 'node_modules/gojs/release/go.js'
-
-function fixElementUI(file) {
- try {
- let content = fs.readFileSync(file, 'utf-8')
- // flag1 与 flag2 互换位置
- const flag1 = 'xhr.open(\'post\', action, true);'
- const flag2 = `if (option.withCredentials && 'withCredentials' in xhr) {
- xhr.withCredentials = true;
- }`;
- if (content.includes('/*flag1*/')) {
- console.log(`fix ${file} ${chalk.yellow('fixed')}`)
- return
- }
-
- if (content.includes(flag1) && content.includes(flag2)) {
- content = content
- .replace(flag1, `/*flag1*/${flag1}/*flag1*/`)
- .replace(flag2, `/*flag2*/${flag2}/*flag2*/`)
-
-
- content = content.replace(`/*flag1*/${flag1}/*flag1*/`, `/*flag1*/${flag2}/*flag1*/`)
- .replace(`/*flag2*/${flag2}/*flag2*/`, `/*flag2*/${flag1}/*flag2*/`)
-
- fs.writeFileSync(file, content, 'utf-8')
-
- console.log(`fix ${file} ${chalk.green('success')}`)
- } else {
- console.log(`fix ${file} ${chalk.red('fail')}`)
- }
- } catch (e) {
- console.log(`fix ${file} ${chalk.red('fail')}`)
- }
-}
-
-function fixAxios() {
- try {
- let content = fs.readFileSync(AXIOS_FILE, 'utf-8')
- // flag1 移到 flag2 的前面
- const flag1 = `if (!utils.isUndefined(config.withCredentials)) {
- request.withCredentials = !!config.withCredentials;
- }`
- const flag2 = 'request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);'
- if (content.includes('/*flag2*/')) {
- console.log(`fix ${AXIOS_FILE} ${chalk.yellow('fixed')}`)
- return
- }
- // console.log(content.includes(flag1), content.includes(flag2))
- if (content.includes(flag1) && content.includes(flag2)) {
-
- content = content
- .replace(flag1, `/*flag1*/${flag1}/*flag1*/`)
- .replace(flag2, `/*flag2*/${flag2}/*flag2*/`)
-
- content = content
- .replace(flag2, `${flag1} \n ${flag2}`)
- .replace(`/*flag1*/${flag1}/*flag1*/`, '')
-
-
- fs.writeFileSync(AXIOS_FILE, content, 'utf-8')
-
- console.log(`fix ${AXIOS_FILE} ${chalk.green('success')}`)
- } else {
- console.log(`fix ${AXIOS_FILE} ${chalk.red('fail')}`)
- }
- } catch (e) {
- console.log(`fix ${AXIOS_FILE} ${chalk.red('fail')}`)
- }
-}
-
-function fixGojs(file) {
- try {
- let content = fs.readFileSync(file, 'utf-8')
- if (content.includes('/*flag*/')) {
- console.log(`fix ${file} ${chalk.yellow('fixed')}`)
- return
- }
- // 破解gojs
- const flag = '7eba17a4ca3b1a8346'
- const index = content.indexOf(flag)
- if (index > 0) {
- const start = index - 8, end = index + 32 + flag.length
- const section = content.substring(start, end)
- content = content.replace(section, 'function(){return true;};/*flag*/')
- content = content.replace('bfunction(){return true;}', 'function(){return true;}')
- fs.writeFileSync(file, content, 'utf-8')
-
- console.log(`fix ${file} ${chalk.green('success')}`)
- } else {
- console.log(`fix ${file} ${chalk.red('fail')}`)
- }
- } catch (e) {
- console.log(`fix ${file} ${chalk.red('fail')}`)
- }
-}
-
-fixElementUI(ELEMENT_UI_FILE)
-fixElementUI(ELEMENT_UI_UPLOAD_AJAX)
-fixAxios()
-fixGojs(GOJS_FILE)
-fixGojs(GOJS_FILE.replace('go.js', 'go-module.js'))
-fixGojs(GOJS_FILE.replace('go.js', 'go-debug.js'))
-fixGojs(GOJS_FILE.replace('go.js', 'go-debug-module.js'))
-fixGojs(GOJS_FILE.replace('go.js', 'go.mjs'))
-fixGojs(GOJS_FILE.replace('go.js', 'go-debug.mjs'))
-
-
-
diff --git a/core/build/front-matter.js b/core/build/front-matter.js
deleted file mode 100644
index 832d1c2f83a39c7b8b4b136e4b12b08994bc535a..0000000000000000000000000000000000000000
--- a/core/build/front-matter.js
+++ /dev/null
@@ -1,65 +0,0 @@
-// see: https://github.com/jonschlinkert/gray-matter
-
-/*
-
-属性
----
-title: 标题
----
-
-数组
----
-list:
- - one
- - two
----
-
-对象
----
-obj:
- name: kenny
- age: 18
----
-
-数组包含对象
----
-list:
- -
- name: kenny
- age: 18
- -
- name: sam
- age: 20
----
-
- */
-
-
-const fs = require('fs')
-const matter = require('gray-matter');
-const _ = require('lodash')
-const utils = require('../utils')
-
-const regex = /---\n?[\s\S]*\n?---/gi
-
-/**
- * 解释文件,返回标记数据
- * @param file 文件路径
- * @param isString 是否返回字符串
- * @return {null|*}
- */
-function parse(file, isString) {
- const content = fs.readFileSync(file, 'utf-8')
- const matches = content.match(regex) || []
- if (matches.length === 0) {
- return null
- }
- const results = matches.map(block => {
- return matter(block.trim()).data || {}
- });
- const data = _.merge.apply(_.merge, results)
- return _.isPlainObject(data) ? (isString ? utils.stringify(data) : data) : null
-}
-
-
-module.exports = parse
diff --git a/core/build/jsdoc-builder.js b/core/build/jsdoc-builder.js
deleted file mode 100644
index 6aaae4f69091d3bf183128681188edc83d349259..0000000000000000000000000000000000000000
--- a/core/build/jsdoc-builder.js
+++ /dev/null
@@ -1,24 +0,0 @@
-const process = require('child_process')
-const {logWithSpinner, stopSpinner, failSpinner} = require('@vue/cli-shared-utils')
-const utils = require('../utils')
-
-const jsdoc = 'node node_modules/jsdoc/jsdoc.js'
-
-function getConfigPath(dir) {
- return utils.resolve(`core/config/jsdoc.${dir}.config.js`)
-}
-
-function builder(dir) {
- const cmd = `${jsdoc} -c ${getConfigPath(dir)} -r`
- logWithSpinner(`${dir}文档生成完成`)
- process.exec(cmd, (err, std) => {
- if (err) {
- failSpinner(`${dir}文档生成失败`)
- utils.log(err, 'error')
- return
- }
- stopSpinner()
- })
-}
-
-module.exports = builder
diff --git a/core/build/prod-theme-builder.js b/core/build/prod-theme-builder.js
deleted file mode 100644
index ba3a0495aa025f74ebb475a5d777963c1c7efa21..0000000000000000000000000000000000000000
--- a/core/build/prod-theme-builder.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * 编译生产环境主题样式
- *
- * @author chenhuachun
- */
-const process = require('child_process')
-const {logWithSpinner, stopSpinner} = require('@vue/cli-shared-utils')
-const fs = require('fs')
-const config = require('../config')()
-const utils = require('../utils')
-const core = require('../index')
-
-
-// 获取项目的主题变量文件
-const themeConfigFiles = fs.readdirSync(core.ProjectThemeVarPath) || []
-
-// 编译临时存放的目录
-const tempDir = core.ProductionThemesCompiledPath
-
-// 编译完成后输出的css目录路径
-const compiledCssPath = utils.join(core.BuildThemeDistPath, config.assetsDir, 'css')
-
-// 主题名称数组
-const themes = themeConfigFiles.map(item => {
- return item.replace('.scss', '').substring(1)
-}).filter(item => item !== 'default')
-
-/**
- * 编译函数
- * @param themes 主题名称数组
- */
-function builder(themes, app) {
- if (themes.length === 0) return
- const theme = themes.pop()
- const appLabel = app ? `APP=${app}` : ''
- const cmd = `node ./node_modules/cross-env/src/bin/cross-env.js BUILD_THEME=true THEME=${theme} ${appLabel} node node_modules/@vue/cli-service/bin/vue-cli-service.js build`
- logWithSpinner(`打包生产环境主题【${theme}】`)
- process.exec(cmd, function (err, sto) {
- if (err) {
- utils.log(err, 'error')
- console.log(sto)
- return
- }
- // utils.log(`>>> 生产环境主题【${theme}】打包成功!`, 'success')
- stopSpinner()
- // 存储结果到临时文件夹
- utils.copyFiles(compiledCssPath, tempDir)
-
- // 删除临时目录
- utils.rm(core.BuildThemeDistPath)
- // 递归
- builder(themes)
- })
-}
-
-
-module.exports = function (app) {
- // 先删除上次编译产生的临时文件
- utils.rm(tempDir)
- utils.rm(core.BuildThemeDistPath)
-// 执行编译
- builder(themes, app)
-}
diff --git a/core/build/routes.js b/core/build/routes.js
deleted file mode 100644
index 46e54061672b7b180b6099001f011238f189666e..0000000000000000000000000000000000000000
--- a/core/build/routes.js
+++ /dev/null
@@ -1,378 +0,0 @@
-const fs = require('fs')
-const url = require('url')
-const isEqual = require('lodash/isEqual')
-const _set = require('lodash/set')
-// const core = require('../index')
-const utils = require('../utils')
-const frontMatter = require('./front-matter')
-const routesRender = require('../renders/routes')
-const routesWrapperRender = require('../renders/routes-wrapper')
-
-
-const vueFileRegex = /\.vue$/
-
-// const dir = core.ViewsPath
-
-
-/**
- * 当前目录文件解析元数据缓存
- * 数据示例
- * {'file path': {file:文件路径, name: 文件名, path: 路由路径, parent: 上级路径, vue: 是否vue后缀文件, meta: 标记数据}}
- * @type {FilesMap}
- */
-let FilesMap = null
-
-/**
- * 解析函数,把路由配置解析成js代码
- * @param routes
- * @return {*}
- */
-function render(routes) {
- const content = routesRender({
- items: routes,
- render: routesRender
- })
- const wrapper = routesWrapperRender({
- content: content
- })
- return utils.beautifyJs(wrapper)
-}
-
-/**
- * 写入路由代码文件
- * @param content 内容
- * @param path 保存位置
- */
-function saveFile(content, path) {
- utils.writeFile(path, content)
-}
-
-/**
- * 还原文件默认内容
- * @param path
- */
-function cleanFile(path) {
- const content = render([])
- saveFile(content, path)
-}
-
-
-/**
- * 检测文件是否存在
- * @param dir
- * @param file
- * @return {boolean}
- */
-function isExistFile(dir, file) {
- return fs.existsSync(utils.join(dir, file))
-}
-
-
-/**
- * 解析文件得到标记信息
- * @param root 目录
- * @param path 文件路径
- * @return {{path: string, parent: string, file: *, meta: *, vue: boolean, name: *}}
- */
-function parseFile(root, path) {
- const msg = utils.parsePath(path)
- const absolutePath = utils.join(root, path)
- const info = fs.statSync(absolutePath)
- const isDirectory = info.isDirectory()
- let meta = null
- try {
- meta = frontMatter(absolutePath)
- } catch (e) {
- utils.log(e, 'error')
- }
-
- return {
- file: path,
- name: msg.base,
- path: url.format(utils.join('/', msg.dir, msg.name)),
- parent: url.format(msg.dir),
- vue: !isDirectory,
- meta: meta
- }
-}
-
-/**
- * 采集文件下全部文件的标记信息
- * @param dir
- */
-function collectFilesMap(dir) {
- const files = utils.getFiles(dir)
- // 筛选出vue文件
- .filter(file => vueFileRegex.test(file))
- // 取出相对根目录路径
- .map(file => file.replace(dir, ''))
- const result = {}
- files.forEach(file => {
- result[file] = parseFile(dir, file)
- })
- return result
-}
-
-/**
- * 递归元数据转化成数组
- * @param data
- * @param parent
- * @return {Array}
- */
-function walk(data = {}, parent) {
- const nodes = []
- for (const key in data) {
- const item = data[key]
- if (item.vue) {
- nodes.push(item)
- } else {
- const path = utils.join(parent, key)
- const node = {
- name: key,
- path: path,
- vue: false,
- children: walk(item, path)
- }
- nodes.push(node)
- }
- }
- return nodes
-
-}
-
-/**
- * 元数据转换成树结构
- * @param map
- * @return {Array}
- */
-function mapToTree(map) {
- const list = Object.keys(map).map(key => map[key])
- const result = {}
- list.forEach(item => {
- const attrs = item.path.substring(1).split('/')
- _set(result, attrs.join('.'), item)
- })
-
- return walk(result, '/')
-}
-
-/**
- * 分析元数据结构树,得到路由数据
- * @param tree
- * @param name
- * @param path
- * @return {{layout: *, path: string, excludes: *[], name: string, index: *, files: *[], any: *}}
- */
-function analyser(tree = [], name = '', path = '/') {
- // 布局文件
- const layout = tree.find(item => item.name === '_layout.vue')
- // 外置 404 文件
- const any = tree.find(item => item.name === '_404.vue')
- // 内置 404 文件
- const innerAny = tree.find(item => item.name === '404.vue')
- // 主页
- const index = tree.find(item => item.name === 'index.vue')
- // 子目录
- const children = tree.filter(item => !!item.children)
-
- // 不放入二级路由的页面
- const excludes = tree.filter(item => {
- return /^_/.test(item.name) && ![layout, any].includes(item)
- })
-
- // 纳入路由的其他文件,不包含:布局、404、主页、外置页面
- const files = tree.filter(item => {
- return ![layout, any, index, innerAny].includes(item) && !children.includes(item) && !excludes.includes(item)
- })
-
- const config = {
- name: name,
- path: path,
- layout,
- index,
- any,
- files,
- excludes,
- innerAny
- }
-
- // 递归子目录
- if (children.length > 0) {
- config.children = children.map(child => {
- return analyser(child.children, child.name, child.path)
- })
- }
-
- return config
-
-}
-
-function transformToken(config, context) {
- // 处理主页
- if (config.index) {
- context.push({
- path: config.index.path.replace('/index', '').replace(/\/\$/gi, '/:'),
- component: config.index.path.substring(1),
- meta: utils.stringify(config.index.meta)
- })
- }
-
- // 处理普通页面
- config.files.forEach(file => {
- context.push({
- path: file.path.replace(/\/\$/gi, '/:'),
- component: file.path.substring(1),
- meta: utils.stringify(file.meta)
- })
- })
-
- // 处理子目录
- if (config.children) {
- config.children.forEach(child => {
- context = context.concat(transform(child))
- })
- }
-
- // 处理内置的404
- if (config.innerAny) {
- context.push({
- path: config.innerAny.path.replace('/404', '/*').replace(/\/\$/gi, '/:'),
- component: config.innerAny.path.substring(1),
- meta: utils.stringify(config.innerAny.meta)
- })
- }
-
- return context
-}
-
-/**
- * 路由数据转换成配置信息
- * @param config
- * @return {Array}
- */
-function transform(config) {
- let routes = []
-
- if (config.layout) {
-
- const route = {
- path: utils.urlFormat(config.path).replace(/\/\$/gi, '/:'),
- component: config.layout.path.substring(1),
- meta: utils.stringify(config.layout.meta),
- children: []
- }
-
- route.children = transformToken(config, route.children)
- routes.push(route)
-
- config.excludes.forEach(file => {
- routes.unshift({
- path: file.path.replace(/\/_/gi, '/').replace(/\/\$/gi, '/:'),
- component: file.path.substring(1),
- meta: utils.stringify(file.meta)
- })
- })
-
- } else {
- config.files = config.files.concat(config.excludes)
- routes = transformToken(config, routes)
- }
-
- // 处理404页面
- if (config.any) {
- routes.push({
- path: config.any.path.replace('_404', '*'),
- component: config.any.path.substring(1),
- meta: utils.stringify(config.any.meta)
- })
- }
-
-
- return routes
-}
-
-/**
- * 检查文件的标记是否发生了改变
- * @param file
- * @param message
- * @return {boolean}
- */
-function isChange(file, message) {
- const item = FilesMap[file]
- return !isEqual(message, item)
-}
-
-
-/**
- * 生成路由配置
- * @param viewsPath 视图文件夹绝对路径
- * @param outPath 数据路由配置文件路径
- * @param disabled 是否禁用
- */
-function build(viewsPath, outPath, disabled = false) {
- // 如果禁用,将还原初始空配置,不做任何处理
- if (disabled) {
- cleanFile(outPath)
- return
- }
-
- if (!FilesMap) {
- FilesMap = collectFilesMap(viewsPath)
- }
- const tree = mapToTree(FilesMap)
- const config = analyser(tree)
- const routes = transform(config)
- const content = render(routes)
- saveFile(content, outPath)
- utils.log('>>> 更新路由文件', 'success')
-}
-
-/**
- * 侦听文件变化做响应处理
- * @param viewsPath 视图文件夹绝对路径
- * @param outPath 数据路由配置文件路径
- * @param disabled 是否禁用
- */
-function watch(viewsPath, outPath, disabled = false) {
-
- build(viewsPath, outPath, disabled)
-
- if (disabled) return
-
- if (!FilesMap) {
- FilesMap = collectFilesMap(viewsPath)
- }
-
- fs.watch(viewsPath, {recursive: true}, (eventType, filename) => {
-
- const file = '/' + filename
- if (!vueFileRegex.test(file)) {
- return
- }
-
- // 新增、修改文件
- if (isExistFile(viewsPath, file)) {
- const message = parseFile(viewsPath, file)
- // 标记是否发生了变化
- if (isChange(file, message)) {
- FilesMap[file] = message
- build(viewsPath, outPath, disabled)
- }
- } else {
- // 删除了文件
- delete FilesMap[file]
- build(viewsPath, outPath, disabled)
- }
-
- })
-
- utils.log(`watch: ${viewsPath}`, 'success')
-}
-
-module.exports = {
- watch,
- build
-}
-
-
-
diff --git a/core/build/svg.js b/core/build/svg.js
deleted file mode 100644
index 338413d12ca64866404e215526830c7ba3705a2b..0000000000000000000000000000000000000000
--- a/core/build/svg.js
+++ /dev/null
@@ -1,46 +0,0 @@
-const fs = require('fs')
-const {logWithSpinner, stopSpinner, failSpinner} = require('@vue/cli-shared-utils')
-const utils = require('../utils')
-const core = require('../index')
-// const constant = require('../constant')
-const render = require('../renders/svg-component')
-const regex = /()|( )/gi
-const fillRegex = /\sfill="[\w#]*"/gi
-const svgFiles = utils.getFiles(core.SVGSrcPath)
-const saveDir = core.SVGIconPath
-const imports = []
-
-
-logWithSpinner('生成SVG组件')
-try {
- svgFiles.forEach(file => {
- const content = fs.readFileSync(file, 'utf-8')
- const matches = content.match(regex) || []
- const cleanPaths = matches.map(n => {
- const fills = n.match(fillRegex) || []
- fills.forEach(f => {
- n = n.replace(f, '')
- })
- n = n.replace(/\s*\/>/gi, '/>')
- .replace(//gi, '')
- .replace(/<\/g>/gi, '')
- .replace(/\n/gi, ' ')
- .replace(/\t/gi, ' ')
- .replace(/\s\s/gi, ' ')
- return n
- })
- if (cleanPaths.length > 0) {
- const fileMsg = utils.parsePath(file)
- const importPath = `import './${fileMsg.name}'`
- const fileContent = render({paths: cleanPaths, name: fileMsg.name})
- utils.writeFile(utils.join(saveDir, fileMsg.name + '.js'), fileContent)
- imports.push(importPath)
- }
- })
-
- utils.writeFile(utils.join(saveDir, 'index.js'), imports.join('\n'))
- stopSpinner()
-} catch (e) {
- utils.log(e, 'error')
- failSpinner('生成SVG组件失败!')
-}
diff --git a/core/build/theme.js b/core/build/theme.js
deleted file mode 100644
index 7d3b1c41339f70848271a693516ab8ce8f7bffe4..0000000000000000000000000000000000000000
--- a/core/build/theme.js
+++ /dev/null
@@ -1,175 +0,0 @@
-/**
- * 主题预编译, 把Element 和 UI 主题scss 预先编译成css, 提高运行时编译效率
- *
- * @author chenhuachun
- *
- */
-
-const fs = require('fs')
-const webpack = require('webpack')
-const {logWithSpinner, stopSpinner} = require('@vue/cli-shared-utils')
-const utils = require('../utils')
-const core = require('../index')
-
-// webpack config 创建函数
-const configFactory = require('../config/webpack.theme.factory')
-
-
-/**
- * 获取本地的主题配置文件
- * @return {{file: *, name: *}[]}
- */
-function getLocalVarFiles() {
- const path = core.ProjectThemeVarPath
- const dirs = fs.readdirSync(path) || []
- return dirs.map(item => {
- return {
- file: item,
- name: utils.kebabCase(item.replace('.scss', ''))
- }
- })
-}
-
-/**
- * 获取主题编译后存放位置
- * @param type
- * @return {string}
- */
-function getSavePath(type) {
- return type === 'el' ? core.OutputElementThemePath : core.OutputUIThemePath
-}
-
-/**
- * 获取样式源码目录
- * @param type
- * @return {string}
- */
-function getSrcPath(type) {
- return type === 'el' ? core.ElementThemeSrcPath : core.UIThemeSrcPath
-}
-
-/**
- * 创建入口文件js文件,并写入scss引用, webpack4入口文件必须要js文件
- * @param type 框架类型了 ,el 或 ui
- * @param entryDir 入口文件存放目录
- * @return {*[]}
- */
-function createEntryFile(type, entryDir) {
- const themeSrcDir = getSrcPath(type)
- if (!fs.existsSync(themeSrcDir)) {
- utils.log(`${themeSrcDir} 目录不存在`, 'error')
- return []
- }
- const files = (fs.readdirSync(themeSrcDir) || [])
- .filter(item => item.includes('.scss'))
-
- files.forEach(item => {
- const msg = utils.parsePath(item)
- const content = type === 'el'
- ? `import 'element-ui/packages/theme-chalk/src/${msg.base}'`
- : `import '${utils.urlFormat(utils.join(core.LibPath, 'styles', msg.base))}'`;
-
- utils.writeFile(`${entryDir}/${msg.base.replace('.scss', '.js')}`, content, 'utf-8')
- })
- return files
-}
-
-/**
- * 构建入口的配置信息
- * @param files 入口文件名数组
- * @param entryDir 入口文件目录
- */
-function getEntry(files, entryDir) {
- const entry = {}
- files.forEach(file => {
- const name = file.replace('.scss', '')
- entry[name] = utils.join(entryDir, name + '.js')
- })
- return entry
-}
-
-/**
- * 清理无用的文件
- * @param {string} type 框架类型了 ,el 或 ui
- * @param {object} theme 主题描述对象
- * @param {string} entryDir
- */
-function clean(type, theme, entryDir) {
- const savePath = getSavePath(type)
- const buildDir = utils.join(savePath, theme.name, 'build')
- utils.rm(entryDir)
- utils.rm(buildDir)
-}
-
-function filesWriteToIndex() {
- const dir = utils.join(core.LibPath, 'styles')
- const files = fs.readdirSync(dir) || []
- const scss = files.filter(f => (f.includes('.scss') && f !== 'index.scss'))
- const content = scss.map(f => {
- return `@import "${f}";`
- })
- fs.writeFileSync(utils.join(dir, 'index.scss'), content.join('\n'), 'utf-8')
-}
-
-
-/**
- * 编译函数
- * @param type
- * @param themes
- * @param entryDir
- * @param callback
- */
-function build(type, themes, entryDir, callback) {
- const theme = themes.pop()
- // utils.log(`正在编译${type === 'el' ? 'Element' : 'UI'}主题【${theme.name}】...`)
- logWithSpinner(`编译${type === 'el' ? 'Element' : 'UI'}主题【${theme.name}】`)
-
- // 创建入口文件
- const files = createEntryFile(type, entryDir)
-
-
- // 入口文件构造成webpack配置的entry对象
- const entry = getEntry(files, entryDir)
-
-
- // 构建webpack配置
- const config = configFactory(theme, entry, getSavePath(type))
-
-
- // 执行编译
- webpack(config, (err, stats) => {
- // 编译成功,清理无用文件
- clean(type, theme, entryDir)
-
- if (err || stats.hasErrors()) {
- callback && callback(stats, false)
- } else {
- // utils.log(`>>> ${type === 'el' ? 'Element' : 'UI'}主题【${theme.name}】编译成功!`, 'success')
- stopSpinner()
- callback && callback(stats, true)
- if (themes.length > 0) {
- build(type, themes, entryDir, callback)
- }
- }
- })
-}
-
-module.exports = function (type = 'el', callback) {
- filesWriteToIndex()
- // 同步官方变量文件
- // copySrcToLocal(type)
- const savePath = getSavePath(type)
- const entryDir = utils.join(savePath, '.entry')
-
- // 获取项目主题文件
- const themes = getLocalVarFiles() || []
-
- // 递归编译主题
- if (themes.length > 0) {
- build(type, themes, entryDir, callback)
- } else {
- utils.log('主题配置文件', 'warning')
- }
-}
-
-
diff --git a/core/config.js b/core/config.js
deleted file mode 100644
index f1cf2513fbfdcc78fd367611564a21b8456678a4..0000000000000000000000000000000000000000
--- a/core/config.js
+++ /dev/null
@@ -1,142 +0,0 @@
-/**
- * 工程配置
- */
-const fs = require('fs')
-const utils = require('./utils')
-const core = require('./index')
-const merge = require('lodash/merge')
-const configPath = utils.join(core.ProjectRootPath, 'my.config.js')
-let myConfig = null
-// 如果项目工程根目录有 my.config.js 文件,即读取配置文件,合并到配置信息
-if (!myConfig && fs.existsSync(configPath)) {
- myConfig = core.IsInstalled ? require('../../../../my.config.js') : require('../my.config')
-}
-
-let __config__ = {
- /**
- * 部署应用时的基本 URL, VueCli v3.3 改名为 publicPath
- */
- publicPath: '/',
-
- /**
- * 入口文件
- */
- entry: './src/main.js',
-
- /**
- * 开发环境端口号
- */
- devServerPort: 8000,
-
- /**
- * 开发环境代理配置, 不能设置空对象 {}
- */
- devServerProxy: null,
-
- /**
- * dist 预览服务器端口
- */
- previewServerPort: 7000,
-
- /**
- * 生成的生产环境构建文件的目录
- */
- outputDir: 'dist',
-
- /**
- * 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录。
- */
- assetsDir: 'assets',
-
- /**
- * 扩展的静态资源目录,只对主站有效
- */
- extendContentBase: [],
-
- /**
- * 强制 eslint-loader 将 lint 错误输出为编译错误
- */
- lintOnSave: 'error',
-
- /**
- * 开启预加载,页面加载完成后,利用空闲时间提前获取用户未来可能会访问的内容
- *
- * Prefetch 链接将会消耗带宽。
- * 如果你的应用很大且有很多 async chunk,而用户主要使用的是对带宽较敏感的移动端,
- * 那么你可能需要关掉 prefetch 链接并手动选择要提前获取的代码区块。
- */
- prefetch: false,
-
- /**
- * 生产环境打包dll
- */
- dll: ['vue', 'vue-router', 'vuex', 'axios', 'path-to-regexp', 'nprogress'],
-
-
- /**
- * 文档开发环境启动端口号
- */
- docsDevPort: 3001,
-
- /**
- * 文档部署目录
- */
- docsBaseUrl: '/my/',
-
- /**
- * 文档编译输出目录
- */
- docsOutputDir: 'web',
-
- /**
- * 自动生成路由表
- */
- autoRoutes: true,
-
- /**
- * 服务端启动端口号
- */
- serverPort: 7001,
-
- /**
- * 开启静态配置
- */
- staticConfig: true,
-
- /**
- * 代码生成器配置
- */
- coder: {},
-
- /**
- * 默认情况下 babel-loader 会忽略所有 node_modules 中的文件。如果你想要通过 Babel 显式转译一个依赖,可以在这个选项中列出来。
- */
- transpileDependencies: ['@xdh/my'],
-
- // 生成环境是否生成SourceMap
- productionSourceMap: false,
-
- /**
- * 开启模拟数据
- */
- mock: process.env.NODE_ENV !== 'production',
-
- /**
- * 开启微应用服务
- */
- microApp: false,
-
- // Webpack自定义配置
- chainWebpack: chain => {
- }
-}
-
-__config__ = merge(__config__, myConfig || {})
-
-
-module.exports = config => {
- if (config) {
- return merge(__config__, config || {})
- }
- return __config__
-}
diff --git a/core/config/coder.config.js b/core/config/coder.config.js
deleted file mode 100644
index c9fade525f99766fabc133491ac60dac5cde3517..0000000000000000000000000000000000000000
--- a/core/config/coder.config.js
+++ /dev/null
@@ -1,138 +0,0 @@
-/**
- * 代码生成器配置
- * @author chenhuachun
- */
-const _ = require('lodash')
-const utils = require('../utils')
-const core = require('../index')
-const config = require('../config')()
-const outDir = core.OutputCodePath
-
-
-module.exports = _.merge({
- // 架构配置文件目录
- schemasDir: core.SchemasPath,
-
- // 模板文件目录
- templatesDir: utils.resolve('core/renders/coder'),
-
- outDir: outDir,
-
- // iconfont css文件路径
- iconCssFile: utils.join(core.LibPath, 'assets/icons/iconfont.css'),
-
- // svg图标目录
- svgIconDir: utils.join(core.LibPath, 'assets/svg/'),
-
- // element-ui icon
- elIconCssFile: utils.join(core.ProjectRootPath, 'node_modules/element-ui/packages/theme-chalk/lib/icon.css'),
-
- // 生成api文件路径
- outApiPath: utils.join(outDir, 'api'),
-
- // 生成mock文件路径
- outMockPath: utils.join(outDir, 'mock'),
-
- // 生成mock配置文件路径
- outMockConfig: outDir,
-
- // 生成store文件路径
- outStorePath: utils.join(outDir, 'store'),
-
- // 生成store配置文件路径
- outStoreType: outDir,
-
- // 生成mixin文件路径
- outMixinPath: utils.join(outDir, 'mixin'),
-
- // 生成icon文件路径
- outIconFile: utils.join(outDir, 'icons.js'),
-
- // api请求地址前缀
- pathPrefix: 'API_HOST',
-
- // api支持的请求方法
- methods: [
- 'fetch', // 获取列表数据,响应数据含有分页信息,如:总数、当前页码、页大小
- 'get', // 获取单条实体数据, 响应数据是对象形式
- 'add', // 新增实体数据
- 'update', // 更新实体数据
- 'remove', // 删除实体
- 'batch' // 批量删除
- ],
-
- // 数据请求类型对应http请求方法的映射
- methodTypeMap: {
- fetch: 'get',
- get: 'get',
- add: 'post',
- update: 'patch',
- remove: 'delete',
- batch: 'post'
- },
-
- // 数据请求类型对应api地址的后缀映射
- methodSuffixMap: {
- fetch: '',
- get: '/:id',
- add: '',
- update: '',
- remove: '/:id',
- batch: '/remove'
- },
-
- // 请求方法对应的中文注释
- methodCommentMap: {
- fetch: '获取<%=cname%>列表',
- get: '获取<%=cname%>单条记录',
- add: '新增<%=cname%>',
- update: '更新<%=cname%>',
- remove: '删除<%=cname%>',
- batch: '批量删除<%=cname%>'
- },
-
- // 是否开启生成批量删除
- batchEnabled: true,
-
- // store 或 mixin 状态保存列表的字段名称,和接口响应数据对应, 默认:list
- stateListName: 'list',
-
- // store 或 mixin 状态保存单个实体字段名称,默认:model
- stateModelName: 'model',
-
- // store 或 mixin 状态保当前页码的字段名称,和接口响应数据对应, 默认:page
- statePageName: 'page',
-
- // store 或 mixin 状态保存页大小的字段名称,和接口响应数据对应,默认:limit
- statePageSizeName: 'limit',
-
- // store 或 mixin 状态保存数据总条数字段名称,和接口响应数据对应,默认:total
- stateTotalName: 'total',
-
- // Mock响应数据字段名称,默认:data
- mockDataName: 'data',
-
- // Mock响应状态字段名称,默认:code
- mockCodeName: 'code',
-
- // Mock响应信息说明字段名称,默认:msg
- mockMsgName: 'msg',
-
- // Mock响应成功时的code值,默认:0
- successCodeValue: 0,
-
- // Mock新增接口响应mock信息
- addMockData: {
- id: '@guid'
- },
-
- // Mock更新接口响应mock信息
- updateMockData: true,
-
- // Mock删除接口响应mock信息
- removeMockData: true,
-
- // Mock批量删除响应mock信息
- batchMockData: true
-
-}, config.coder || {})
diff --git a/core/config/jsdoc.charts.config.js b/core/config/jsdoc.charts.config.js
deleted file mode 100644
index 199c74191f4143025fc148c7bf7f98f0b27cf9ea..0000000000000000000000000000000000000000
--- a/core/config/jsdoc.charts.config.js
+++ /dev/null
@@ -1,6 +0,0 @@
-const factory = require('./jsdoc.factory')
-module.exports = factory(
- 'ui/lib/charts',
- 'docs/.vuepress/public/api/charts',
- 'docs/ui/charts/README.md'
-)
diff --git a/core/config/jsdoc.components.config.js b/core/config/jsdoc.components.config.js
deleted file mode 100644
index e853ef009559607c0adbc6b2f52a637be5814115..0000000000000000000000000000000000000000
--- a/core/config/jsdoc.components.config.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * ui/components jsdoc 配置
- * @author chenhuachun
- */
-const factory = require('./jsdoc.factory')
-module.exports = factory(
- 'ui/lib/components',
- 'docs/.vuepress/public/api/components',
- 'docs/ui/components/README.md'
-)
diff --git a/core/config/jsdoc.dv.config.js b/core/config/jsdoc.dv.config.js
deleted file mode 100644
index f4a95f68f7af66f0935e8084f0e17e0d2540153b..0000000000000000000000000000000000000000
--- a/core/config/jsdoc.dv.config.js
+++ /dev/null
@@ -1,6 +0,0 @@
-const factory = require('./jsdoc.factory')
-module.exports = factory(
- 'ui/lib/dv',
- 'docs/.vuepress/public/api/dv',
- 'docs/ui/dv/README.md'
-)
diff --git a/core/config/jsdoc.factory.js b/core/config/jsdoc.factory.js
deleted file mode 100644
index e5cfb528707f87fd35f848e12c58dfd80ff4bd5b..0000000000000000000000000000000000000000
--- a/core/config/jsdoc.factory.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * jsdoc 配置工厂函数
- * @author chenhuachun
- */
-const utils = require('../utils')
-module.exports = function (src, out, readme) {
- return {
- tags: {
- allowUnknownTags: true,
- dictionaries: ['jsdoc', 'closure']
- },
- source: {
- include: [
- utils.resolve(src),
- utils.resolve(readme)
- ],
- includePattern: '\\.(vue|js)$'
- },
- plugins: [
- 'plugins/markdown',
- utils.resolve('core/plugins/vue-jsdoc-plugin.js')
- ],
- templates: {
- cleverLinks: false,
- monospaceLinks: false
- },
- opts: {
- destination: utils.resolve(out),
- template: 'core/templates/jsdoc'
- }
- }
-}
diff --git a/core/config/jsdoc.map.config.js b/core/config/jsdoc.map.config.js
deleted file mode 100644
index a4aab270f495fea6692cfbe25569048117b0f061..0000000000000000000000000000000000000000
--- a/core/config/jsdoc.map.config.js
+++ /dev/null
@@ -1,6 +0,0 @@
-const factory = require('./jsdoc.factory')
-module.exports = factory(
- 'ui/lib/map',
- 'docs/.vuepress/public/api/map',
- 'docs/ui/map/README.md'
-)
diff --git a/core/config/jsdoc.utils.config.js b/core/config/jsdoc.utils.config.js
deleted file mode 100644
index cf8064cd630bd98bb00fd775bdfa84c22056a2a7..0000000000000000000000000000000000000000
--- a/core/config/jsdoc.utils.config.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * ui/utils jsdoc 配置
- * @author chenhuachun
- */
-const factory = require('./jsdoc.factory')
-module.exports = factory(
- 'ui/lib/utils',
- 'docs/.vuepress/public/api/utils',
- 'docs/ui/utils/README.md'
-)
diff --git a/core/config/proxy.factory.js b/core/config/proxy.factory.js
deleted file mode 100644
index d60b0949d290eab0fb997f10ae2a81bffa1596ae..0000000000000000000000000000000000000000
--- a/core/config/proxy.factory.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * webpack 子应用 代理构建函数
- */
-const utils = require('../utils')
-const config = require('../config')()
-
-module.exports = function (apps) {
- // 无代理要返回 null,不能返回{}
- let proxy = null
- Object.keys(apps).forEach(name => {
- const item = apps[name]
- proxy = proxy || {}
- proxy[utils.urlFormat(utils.join(config.publicPath, item.name))] = {
- ws: true,
- changeOrigin: true,
- target: `http://localhost:${item.port}`
- }
- })
- return proxy
-}
diff --git a/core/config/webpack.base.extend.js b/core/config/webpack.base.extend.js
deleted file mode 100644
index 5a543561fd38ff2c699af24de8df00eb980da490..0000000000000000000000000000000000000000
--- a/core/config/webpack.base.extend.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * 开发环境 和 生产环境的共同webpack配置
- *
- * @author chenhuachun
- */
-const utils = require('../utils')
-const HtmlInjectConfigPlugin = require('../plugins/html-inject-config-plugin')
-const core = require('../index')
-const config = require('../config')()
-
-module.exports = function (chain, theme, app) {
- const entry = app ? `./apps/${app.name}/main.js` : config.entry
- // 修改入口文件
- chain.entry('app')
- .clear()
- .add(entry).end();
-
- // 不显示文件过大警告
- chain.performance.hints(false)
-
- // 自动注入注册ElementUI组件代码
- chain.module.rule('vue')
- .use('component-loader')
- .loader(core.ComponentLoaderPath)
- .tap(opt => {
- return {
- ...opt,
- cacheDirectory: utils.join(core.ProjectRootPath, 'node_modules/.cache/vue-loader'),
- theme: theme
- }
- })
-
- // 增加 ui 别名
- chain.resolve.alias.set('$ui', core.LibPath)
-
- // 增加 $my 别名
- chain.resolve.alias.set('$my', core.TempPath)
-
- // 增加 $apps 别名
- chain.resolve.alias.set('$apps', core.AppsPath)
-
- let configBaseUrl = config.publicPath
- let contentBase = config.extendContentBase || []
- let extraEnv = {}
- if (app) {
- // 是否设置独立的静态配置
- if (app.staticConfig) {
- configBaseUrl = app.publicPath || utils.join(config.publicPath, app.name, '/')
- chain.plugin('HtmlInjectConfigPlugin').use(HtmlInjectConfigPlugin, [configBaseUrl])
- }
- contentBase = app.contentBase || []
- extraEnv = {
- // 子应用不需要 MY_MICRO_APP
- MY_MICRO_APP: JSON.stringify('false'),
- MY_MOCK: JSON.stringify(`${!!app.mock}`)
- }
- } else {
- // 注入配置文件
- if (config.staticConfig) {
- chain.plugin('HtmlInjectConfigPlugin').use(HtmlInjectConfigPlugin, [configBaseUrl])
- }
- extraEnv = {
- MY_MICRO_APP: JSON.stringify(`${!!config.microApp}`),
- MY_MOCK: JSON.stringify(`${!!config.mock}`)
- }
-
- }
-
- // 注入环境变量
- chain
- .plugin('define')
- .tap(opt => {
- const env = opt[0]['process.env']
- Object.assign(env, extraEnv)
- opt[0] = {
- 'process.env': env
- }
- return opt
- })
-
- // 扩展复制静态目录
- chain.plugin('copy').tap(opt => {
- const items = contentBase.map(dir => {
- const toPath = utils.join(core.ProjectRootPath, config.outputDir, configBaseUrl)
- return {
- from: utils.join(core.ProjectRootPath, dir),
- to: toPath,
- toType: 'dir',
- ignore: [
- '.DS_Store',
- '.idea'
- ]
- }
- })
- opt[0] = opt[0].concat(items)
- return opt
- })
-
-
-}
diff --git a/core/config/webpack.bridge.config.js b/core/config/webpack.bridge.config.js
deleted file mode 100644
index 2c225842444376e06b61231acaef77558e150b94..0000000000000000000000000000000000000000
--- a/core/config/webpack.bridge.config.js
+++ /dev/null
@@ -1,36 +0,0 @@
-const utils = require('../utils')
-const core = require('../index')
-const HtmlWebpackPlugin = require('html-webpack-plugin')
-
-module.exports = {
- mode: 'production',
- entry: {
- bridge: core.BridgeEntry
- },
- output: {
- filename: 'js/[name].[contenthash:8].js',
- path: utils.join(core.ProjectRootPath, 'public/assets/bridge'),
- publicPath: '',
- chunkFilename: 'js/[name].[contenthash:8].js'
- },
- resolve: {
- alias: {
- $ui: core.LibPath
- }
- },
- module: {
- rules: [
- {
- exclude: /node_modules/,
- use: {
- loader: 'babel-loader'
- }
- }
- ]
- },
- plugins: [
- new HtmlWebpackPlugin({
- title: 'Message Bridge'
- })
- ]
-}
diff --git a/core/config/webpack.dev.extend.js b/core/config/webpack.dev.extend.js
deleted file mode 100644
index f83bb635b73c3390ca10ea57cfffde1c126e43d9..0000000000000000000000000000000000000000
--- a/core/config/webpack.dev.extend.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 工程开发环境webpack配置
- *
- * @author chenhuachun
- */
-const utils = require('../utils')
-const config = require('../config')()
-const core = require('../index')
-const devThemeSwitch = require('../build/dev-theme-switch')
-// const routesBuilder = require('../build/routes')
-
-module.exports = function (chain, theme) {
-
- // 扩展静态目录
- const contentBase = (config.extendContentBase || []).map(dir => utils.resolve(dir))
-
- // 监听文件views文件编号,生成路由配置
- // routesBuilder.watch(
- // core.ViewsPath,
- // core.OutputRoutesFile,
- // !config.autoRoutes
- // )
-
-
- // 扩展静态文件服务目录
- chain.devServer.contentBase([
- utils.join(core.ProjectRootPath, 'public'),
- core.TempPath,
- ...contentBase
- ])
-
- // 在线更换主题服务接口
- chain.devServer.setup(server => {
- server.get(core.DevThemeSwitchServiceApi, function (req, res) {
- const theme = req.query.theme
- let code = -1
- let data = null
- if (theme) {
- data = devThemeSwitch(theme)
- code = 0
- }
- res.json({
- code: code,
- data
- })
- })
- })
-}
-
-
diff --git a/core/config/webpack.docs.extend.js b/core/config/webpack.docs.extend.js
deleted file mode 100644
index a59ffd5a39143fd08e1edc236a6bfeb945cdc809..0000000000000000000000000000000000000000
--- a/core/config/webpack.docs.extend.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 文档webpack配置
- */
-
-const core = require('../index')
-
-module.exports = function (chain) {
-
- // 自动注入注册ElementUI组件代码
- chain.module.rule('vue')
- .use('component-loader')
- .loader(core.ComponentLoaderPath)
-
- // 修改babel配置文件
- chain.module.rule('js')
- .use('babel-loader')
- .tap(opt => {
- return {
- configFile: core.BabelConfigFile
- }
- })
-
- // 增加 ui 别名
- chain.resolve.alias.set('$ui', core.LibPath)
-
- // 增加 $my 别名
- chain.resolve.alias.set('$my', core.TempPath)
-
- chain.resolve.alias.set('@', core.ProjectRootPath + '/src')
-
- // 增加 $docs 别名
- chain.resolve.alias.set('$docs', core.DocsPath + '/.vuepress')
-
- // 为了同时兼容 core-js 2.x 和 core-js 3.x
- chain.resolve.alias.set('core-js/library', 'babel-runtime/node_modules/core-js/library')
- chain.resolve.alias.set('core-js/fn', 'babel-runtime/node_modules/core-js/fn')
- chain.resolve.alias.set('core-js/shim', 'babel-runtime/node_modules/core-js/shim')
- chain.resolve.alias.set('core-js/core', 'babel-runtime/node_modules/core-js/core')
- chain.resolve.alias.set('core-js/es5', 'babel-runtime/node_modules/core-js/es5')
- chain.resolve.alias.set('core-js/es6', 'babel-runtime/node_modules/core-js/es6')
- chain.resolve.alias.set('core-js/es7', 'babel-runtime/node_modules/core-js/es7')
- chain.resolve.alias.set('core-js/client', 'babel-runtime/node_modules/core-js/client')
-}
-
-
diff --git a/core/config/webpack.prod.extend.js b/core/config/webpack.prod.extend.js
deleted file mode 100644
index 53a791417a93ca8e44e689bdfa20a2e1f716e6ba..0000000000000000000000000000000000000000
--- a/core/config/webpack.prod.extend.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * 工程生产环境 webpack 配置
- *
- * @author chenhhuachun
- */
-const AutoDllPlugin = require('autodll-webpack-plugin')
-const ThemeSwitchForCompilePlugin = require('../plugins/theme-switch-for-compile-plugin')
-const CopyThemeAfterCompiledPlugin = require('../plugins/copy-theme-after-compiled-plugin')
-const HtmlInjectThemePlugin = require('../plugins/html-inject-theme-plugin')
-const config = require('../config')()
-const utils = require('../utils')
-const core = require('../index')
-
-module.exports = function (chain, theme, app) {
-
- // 移除 prefetch 插件
- if (!config.prefetch) {
- chain.plugins.delete('prefetch')
- }
-
- // 合并css文件、vue组件style
- chain.optimization.splitChunks({
- cacheGroups: {
- style: {
- name: 'style',
- test(module, chunks) {
- const r = module.resource || '', t = module.type
- // 合并 css、scss、vue文件的style
- return r.includes('.scss') || r.includes('.css') || t.includes('css')
- },
- chunks: 'all',
- enforce: true
- }
- }
- })
-
- // 独立打包基础公共文件
- chain.plugin('dll').use(AutoDllPlugin, [{
- inject: true,
- debug: true,
- filename: '[name]_[hash:8].js',
- path: utils.urlFormat(utils.join(config.assetsDir, 'js')),
- entry: {
- vendor: config.dll
- }
- }])
-
- // 抽取css到独立文件
- chain.plugin('extract-css').tap(args => {
- return [
- {
- filename: `assets/css/${theme}-[name].[contenthash:8].css`,
- chunkFilename: `assets/css/${theme}-[name].[contenthash:8].css`,
- // 忽略css引用顺序导致的警告
- ignoreOrder: true
- }
- ]
- })
-
- // 修改主题,指定要打包的主题
- chain.plugin('ThemeSwitchForCompilePlugin').use(ThemeSwitchForCompilePlugin, [{
- theme: theme,
- src: core.ProjectThemeScssFile
- }])
-
- if (theme === 'default') {
- let toPath = utils.join(core.ProjectRootPath, config.outputDir, config.publicPath, config.assetsDir, 'css')
- let themePath = utils.join(config.publicPath, config.assetsDir, 'css')
-
- if (app) {
- toPath = utils.join(
- core.ProjectRootPath,
- config.outputDir,
- config.publicPath,
- app.outputDir || app.name,
- app.publicPath || '',
- config.assetsDir,
- 'css')
-
- themePath = utils.join(config.publicPath, app.publicPath || app.name, config.assetsDir, 'css')
-
- }
-
- // 默认主题打包完成后,复制已编译好的主题放入css目录
- chain.plugin('CopyThemeAfterCompiledPlugin').use(CopyThemeAfterCompiledPlugin, [{
- from: core.ProductionThemesCompiledPath,
- to: toPath
- }])
-
- // 注入主题theme.js描述文件
- chain.plugin('HtmlInjectThemePlugin').use(HtmlInjectThemePlugin, [{
- tempDir: core.ProductionThemesCompiledPath,
- path: themePath,
- appName: app ? app.name : null,
- savePath: app
- ? utils.join(core.ProjectRootPath, config.outputDir, config.publicPath, app.outputDir || app.name, app.publicPath || '')
- : utils.join(core.ProjectRootPath, config.outputDir, config.publicPath),
- baseUrl: app
- ? utils.join('/', config.publicPath, app.outputDir || app.name, app.publicPath || '')
- : utils.join('/', config.publicPath)
- }])
-
- }
-
-
- // 把样式引用的图片地址改成绝对路径
- const ruleArray = ['css', 'postcss', 'scss', 'less', 'sass', 'stylus']
- const oneOfArray = ['vue-modules', 'vue', 'normal-modules', 'normal']
- const assetsPath = app
- ? utils.join('/', config.publicPath, app.outputDir || app.name, app.publicPath || '')
- : utils.join('/', config.publicPath)
- ruleArray.forEach(rule => {
- oneOfArray.forEach(one => {
- chain.module.rule(rule).oneOf(one).use('extract-css-loader').tap(opts => {
- opts.publicPath = utils.urlFormat(assetsPath)
- return opts
- })
- })
- })
-
-}
diff --git a/core/config/webpack.theme.factory.js b/core/config/webpack.theme.factory.js
deleted file mode 100644
index aa61fa43da67951a49af2d5bc748bac676e4b6cc..0000000000000000000000000000000000000000
--- a/core/config/webpack.theme.factory.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * Element 主题打包 webpack 配置文件
- *
- * @author chenhuachun
- */
-const MiniCssExtractPlugin = require('mini-css-extract-plugin')
-const OptimizeCssnanoPlugin = require('@intervolga/optimize-cssnano-plugin')
-const utils = require('../utils')
-const core = require('../index')
-
-module.exports = function (theme, entry, outDir) {
- return {
- mode: 'production',
- entry: entry,
- output: {
- filename: '[name].js',
- path: utils.join(outDir, theme.name, 'build')
- },
- resolve: {
- alias: {
- '@': utils.join(core.ProjectRootPath, 'src'),
- $ui: core.LibPath,
- $my: core.TempPath
- }
- },
- module: {
- rules: [
- {
- test: /\.(woff2?|eot|ttf|otf|svg)(\?.*)?$/i,
- use: [
- {
- loader: 'url-loader',
- options: {
- limit: 4096,
- fallback: {
- loader: 'file-loader',
- options: {
- name: '../fonts/[name].[ext]'
- }
- }
- }
- }
- ]
- },
- {
- test: /\.scss$/,
- use: [
- {
- loader: MiniCssExtractPlugin.loader,
- options: {
- hmr: false,
- publicPath: 'fonts/'
- }
- },
- {
- loader: 'css-loader',
- options: {
- sourceMap: false
- }
- },
- {
- loader: 'postcss-loader',
- options: {
- sourceMap: false
- }
- },
- {
- loader: 'sass-loader',
- options: {
- sourceMap: false
- }
- },
- {
- loader: core.ThemeVarScssLoaderPath,
- options: {
- vars: utils.join(core.ProjectThemeVarPath, theme.file)
- }
- }
- ]
- }
- ]
- },
- plugins: [
- new MiniCssExtractPlugin({
- filename: '../[name].css'
- }),
- new OptimizeCssnanoPlugin(
- {
- sourceMap: false,
- cssnanoOptions: {
- preset: [
- 'default',
- {
- mergeLonghand: false,
- cssDeclarationSorter: false
- }
- ]
- }
- }
- )
- ]
- }
-}
diff --git a/core/config/wepack.bridge.lib.config.js b/core/config/wepack.bridge.lib.config.js
deleted file mode 100644
index 9ba974c78df3c6bee5c869ffa988627ed39d3c7b..0000000000000000000000000000000000000000
--- a/core/config/wepack.bridge.lib.config.js
+++ /dev/null
@@ -1,30 +0,0 @@
-const utils = require('../utils')
-const core = require('../index')
-
-module.exports = {
- mode: 'production',
- entry: core.BridgeLibEnter,
- output: {
- filename: 'index.js',
- path: utils.join(core.ProjectRootPath, 'public/assets/bridge/lib'),
- publicPath: '',
- libraryTarget: 'umd',
- chunkFilename: 'index.js',
- library: 'MyBridge'
- },
- resolve: {
- alias: {
- $ui: core.LibPath
- }
- },
- module: {
- rules: [
- {
- exclude: /node_modules/,
- use: {
- loader: 'babel-loader'
- }
- }
- ]
- }
-}
diff --git a/core/index.js b/core/index.js
deleted file mode 100644
index 62c0f10c404dbc8212b4730dfbf364c473d125c5..0000000000000000000000000000000000000000
--- a/core/index.js
+++ /dev/null
@@ -1,141 +0,0 @@
-const utils = require('./utils')
-
-// 检查当前是否安装模式,false表示开发模式
-const IsInstalled = utils.urlFormat(__dirname).includes('node_modules/@xdh/my')
-
-// My库所在的绝对路径位置
-const MyRootPath = utils.resolve('./')
-
-// 项目工程根目录
-const ProjectRootPath = IsInstalled ? process.cwd() : MyRootPath
-
-// UI 所在绝对路径位置
-const UIPath = utils.join(MyRootPath, 'ui')
-
-// lib 所在绝对路径位置
-const LibPath = utils.join(MyRootPath, 'ui/lib')
-
-// core 所在绝对路径位置
-const CorePath = utils.join(MyRootPath, 'core')
-
-
-// 临时文件存放绝对路径, 临时目录在工程下
-const TempPath = utils.join(ProjectRootPath, '.my')
-
-// 调色板scss变量文件位置
-const ColorsVarFilePath = utils.join(LibPath, 'styles/common/_colors.scss')
-
-// 代码生成器输出目录
-const OutputCodePath = utils.join(TempPath, 'code')
-
-// 代码生成器配置文件目录
-const SchemasPath = utils.join(ProjectRootPath, 'schemas')
-
-// SVG文件源文件目录
-const SVGSrcPath = utils.join(ProjectRootPath, 'svg')
-
-// SVG转成Vue组件存放目录
-const SVGIconPath = utils.join(LibPath, 'icons')
-
-// ElementUI 主题编译后存放目录
-const OutputElementThemePath = utils.join(TempPath, 'el-themes')
-
-// UI 主题编译后存放目录
-const OutputUIThemePath = utils.join(TempPath, 'ui-themes')
-
-// 编译项目主题时产生的临时文件存放路径
-const BuildThemeDistPath = utils.join(TempPath, 'dist')
-
-// 工程的主题配置SCSS文件夹路径
-const ProjectThemeVarPath = utils.join(ProjectRootPath, 'src/style/themes')
-
-const ThemeVarScssLoaderPath = utils.join(MyRootPath, 'core/loaders/theme-var-scss-loader.js')
-
-// ElementUI样式源码目录
-const ElementThemeSrcPath = utils.join(ProjectRootPath, 'node_modules/element-ui/packages/theme-chalk/src')
-
-// UI主题源码目录
-const UIThemeSrcPath = utils.join(LibPath, 'styles')
-
-// 组件自动注册加载器loader
-const ComponentLoaderPath = utils.join(MyRootPath, 'core/loaders/component-loader.js')
-
-// 工程项目视图目录
-const ViewsPath = utils.join(ProjectRootPath, 'src/views')
-
-// 输入路由配置文件位置
-const OutputRoutesFile = utils.join(TempPath, 'routes/index.js')
-
-// 开发环境切换主题http服务接口路径
-const DevThemeSwitchServiceApi = '/my/dev-theme-switch-service'
-
-// 项目主题入口文件,显示什么样的主题由该文件决定
-const ProjectThemeScssFile = utils.join(ProjectRootPath, 'src/style/vars/_theme.scss')
-
-// 预打包生产环境的主题文件存放目录
-const ProductionThemesCompiledPath = utils.join(TempPath, 'compiled')
-
-// 备份项目主题配置文件存放位置
-const BackupLocalThemesFile = utils.join(TempPath, '_theme.scss')
-
-// 文档Markdown文件抽取的demo组件存放位置
-const DocsTempDemoPath = utils.join(TempPath, 'demo')
-
-// 文档工程目录位置
-const DocsPath = utils.join(MyRootPath, 'docs')
-
-// babel 配置文件
-const BabelConfigFile = utils.join(MyRootPath, 'core/babel.config.js')
-
-// Bridge入口文件位置
-const BridgeEntry = utils.join(MyRootPath, 'core/build/bridge-entry.js')
-
-// Bridge类库入口文件位置
-const BridgeLibEnter = utils.join(LibPath, 'utils/bridge.js')
-
-// apps目录
-const AppsPath = utils.join(ProjectRootPath, 'apps')
-
-// app名称保留关键字
-const AppReservedWords = ['docs']
-
-// app模板目录
-const AppTemplatePath = utils.join(MyRootPath, 'core/templates/app')
-
-module.exports = {
- IsInstalled,
- MyRootPath,
- ProjectRootPath,
- UIPath,
- LibPath,
- CorePath,
- TempPath,
- ColorsVarFilePath,
- OutputCodePath,
- SchemasPath,
- SVGSrcPath,
- SVGIconPath,
- OutputElementThemePath,
- OutputUIThemePath,
- ProjectThemeVarPath,
- ThemeVarScssLoaderPath,
- ElementThemeSrcPath,
- UIThemeSrcPath,
- ComponentLoaderPath,
- ViewsPath,
- OutputRoutesFile,
- DevThemeSwitchServiceApi,
- ProjectThemeScssFile,
- ProductionThemesCompiledPath,
- BackupLocalThemesFile,
- DocsTempDemoPath,
- DocsPath,
- BabelConfigFile,
- BridgeEntry,
- BridgeLibEnter,
- AppsPath,
- AppReservedWords,
- AppTemplatePath,
- BuildThemeDistPath
-}
-
diff --git a/core/loaders/component-loader.js b/core/loaders/component-loader.js
deleted file mode 100644
index 961e2b967ae7d59d1d0df9423a24354631c4978a..0000000000000000000000000000000000000000
--- a/core/loaders/component-loader.js
+++ /dev/null
@@ -1,145 +0,0 @@
-/**
- * ElementUI 组件自动注册 webpack loader
- * @author chenhuachun
- *
- * @description
- *
- * 在 webpack 加载 *.vue 文件的时候,检测文件收集template块使用到的element-ui组件,注入全局注册成Vue组件的的的代码
- *
- * @example
- *
- * config.module.rule('vue')
- * .use('el-loader')
- * .loader(utils.resolve('.my/core/loaders/el-loader.js'))
- *
- */
-
-const compiler = require('vue-template-compiler')
-const utils = require('../utils')
-const elTagRegex = / t + ' as __' + t + '__').join(',')}} from 'element-ui';`
- : '';
-
- const elUse = elTags.length
- ? `${elTags.map(t => '__vue__.use(__' + t + '__)').join(';\n')}`
- : '';
-
- const myCharts = myTags.filter(tag => tag.includes('MyChart'))
- const myMaps = myTags.filter(tag => tag.includes('MyMap'))
- const myDv = myTags.filter(tag => tag.includes('MyDv'))
- const myComponents = myTags.filter(tag => !myCharts.includes(tag) && !myMaps.includes(tag) && !myDv.includes(tag))
-
- const myComponentsImport = myComponents.length
- ? `import {${myComponents.map(t => t + ' as __' + t + '__').join(',')}} from '$ui';`
- : '';
- const myChartsImport = myCharts.length
- ? `import {${myCharts.map(t => t + ' as __' + t + '__').join(',')}} from '$ui/charts';`
- : '';
-
- const myMapsImport = myMaps.length
- ? `import {${myMaps.map(t => t + ' as __' + t + '__').join(',')}} from '$ui/map';`
- : '';
-
- const myDvImport = myDv.length
- ? `import {${myDv.map(t => t + ' as __' + t + '__').join(',')}} from '$ui/dv';`
- : '';
-
- const myUse = myTags.length
- ? `${myTags.map(t => '__vue__.use(__' + t + '__)').join(';\n')}`
- : '';
-
- return `
- import __vue__ from 'vue';
- ${elImport}
- ${myComponentsImport}
- ${myChartsImport}
- ${myMapsImport}
- ${myDvImport}
- ${code || 'export default {};'}
- ${elUse}
- ${myUse}
- `
-}
-
-/**
- * 替换script内容
- * @param {string} source vue文件的源码
- * @param {number} start script块内容在源码的开始索引
- * @param {number} end script块内容在源码的结束索引
- * @param {string} content 需要替换的内容
- * @return {string} 替换后的源码
- */
-function replaceScript(source, start, end, content) {
- const left = source.substring(0, start)
- const right = source.substring(end, source.length)
- return `
- ${left}
- ${content}
- ${right}
- `
-}
-
-module.exports = function (source) {
- const theme = process.env.THEME || 'default'
-
- // 利用 vue-template-compiler 解析vue文件内容
- const vue = compiler.parseComponent(source)
-
- // 没有模板,不处理
- if (!vue.template || !vue.template.content) return source
-
- let elTags = vue.template.content.match(elTagRegex) || []
-
- let myTags = vue.template.content.match(myTagRegex) || []
-
-
-
- // 没有 my 和 el 组件,不需要处理
- if (elTags.length === 0 && myTags.length === 0) {
- return source
- }
-
- if (elTags.length) {
- // 匹配到element-ui组件名称去掉el-前缀,并转换成大写开头的驼峰式
- elTags = elTags.map(item => item.replace(' utils.upperFirst(utils.camelCase(tag)))
- }
-
- if (myTags.length) {
- // 匹配到my组件名称去掉<符号,并转换成大写开头的驼峰式
- myTags = myTags.map(item => item.replace('<', ''))
- // 去重 并 转换成大小开头的驼峰
- myTags = [...new Set(myTags)].map(tag => utils.upperFirst(utils.camelCase(tag)))
- }
-
- // 源码有script块,注入的代码替换script的内容
- if (vue.script) {
- const code = source.substring(vue.script.start, vue.script.end).trim()
- const scriptContent = injectCode(code, elTags, myTags, theme)
- return replaceScript(source, vue.script.start, vue.script.end, scriptContent)
- } else {
- // 源码没有script块,追加注入内容
- return `
- ${source}
-
- `
- }
-}
diff --git a/core/loaders/docs-extend-md-loader.js b/core/loaders/docs-extend-md-loader.js
deleted file mode 100644
index da3c2c4755b62d693139d2e30ca85d6061c7adc3..0000000000000000000000000000000000000000
--- a/core/loaders/docs-extend-md-loader.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * 扩展 markdown loader
- * @author chenhuachun
- */
-const path = require('path')
-const fs = require('fs')
-const crypto = require('crypto-browserify')
-const core = require('../index')
-const utils = require('../utils')
-
-const CACHE_DIR = core.DocsTempDemoPath
-
-const regex = /^demo(\(?)\s*(.*)(\)?)$/
-const nameRegex = /(?<=demo\().+(?=\))/
-
-function getMd5(content) {
- return crypto.createHash('sha1').update(content).digest('hex')
-}
-
-function initCacheDir(dir) {
- utils.mkdir(dir)
-}
-
-function hasCacheFile(md5) {
- const filePath = path.join(CACHE_DIR, md5 + '.vue')
- return fs.existsSync(filePath)
-}
-
-function saveFile(md5, content) {
- const filePath = path.join(CACHE_DIR, md5 + '.vue')
- utils.writeFile(filePath, content)
-}
-
-function createCache(content) {
- const md5 = getMd5(content)
- if (!hasCacheFile(md5)) {
- saveFile(md5, content)
- }
- return md5
-}
-
-function createFile(name, content) {
- saveFile(name, content)
- return name
-}
-
-initCacheDir(CACHE_DIR)
-
-module.exports = (md, d) => {
- md.use(require('markdown-it-container'), 'demo', {
- validate(params) {
- return params.trim().match(regex)
- },
- render(tokens, idx) {
- const token = tokens[idx],
- info = token.info.trim();
-
- // 匹配 demo(name)
- let titles = info.match(/^demo\(.+\)\s+(.*)$/)
- if (!titles) {
- // 匹配 demo
- titles = info.match(/^demo\s+(.*)$/)
- }
-
- titles = titles || []
-
- if (token.nesting === 1) {
- const nextToken = tokens[idx + 1] || {}
- const matchName = info.match(nameRegex)
- // 有命名的demo,采用命名,无即生成md5名称
- const fileName = matchName
- ? createFile(matchName[0], nextToken.content)
- : createCache(nextToken.content)
-
- let descComponent = ''
- const title = titles[1]
- if (title) {
- const desc = md.render(title).html
- descComponent = !!title ? `${desc}
` : ''
- }
- return `
-
- ${descComponent}
-
-
-
-
-
- `
- } else {
- return '
'
- }
-
- }
- })
-}
diff --git a/core/loaders/theme-var-scss-loader.js b/core/loaders/theme-var-scss-loader.js
deleted file mode 100644
index 8723cd5dce29167983919616c61da3ec80d38e91..0000000000000000000000000000000000000000
--- a/core/loaders/theme-var-scss-loader.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * 主题样式变量文件更换 webpack loader
- * @author chenhuachun
- */
-
-const utils = require('../utils')
-module.exports = function (source) {
- const vars = `@import "${utils.urlFormat(this.query.vars)}";\n`
- return vars + source
-}
diff --git a/core/plugins/auto-routes-plugin.js b/core/plugins/auto-routes-plugin.js
deleted file mode 100644
index 79600db57e7088130a3cb82a4dbac937f572cf7b..0000000000000000000000000000000000000000
--- a/core/plugins/auto-routes-plugin.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * 根据views目录,自动生成路由表 Webpack 插件
- *
- * @author chenhuachun
- */
-
-const utils = require('../utils')
-const builder = require('../build/routes')
-const routesRender = require('../renders/routes')
-const routesWrapperRender = require('../renders/routes-wrapper')
-
-/**
- * 解析函数,把路由配置解析成js代码
- * @param routes
- * @return {*}
- */
-function parse(routes) {
- const content = routesRender({
- items: routes,
- render: routesRender
- })
- const wrapper = routesWrapperRender({
- content: content
- })
- return utils.beautifyJs(wrapper)
-}
-
-/**
- * 写入路由代码文件
- * @param content 内容
- * @param path 保存位置
- */
-function saveFile(content, path) {
- utils.writeFile(path, content)
-}
-
-/**
- * 还原文件默认内容
- * @param path
- */
-function cleanFile(path) {
- const content = parse([])
- saveFile(content, path)
-}
-
-/**
- * 自动生成路由表 webpack插件
- */
-class AutoRoutesPlugin {
-
- constructor(options) {
- this.options = {
- // 是否禁用
- disabled: false,
-
- // 生成的路由表文件路径,包括文件名
- routes: './routes.js',
-
- // views的目录位置
- views: './src/views',
-
- // 开启 FrontMatter
- enableFrontMatter: false,
-
- ...(options || {})
- }
- this.cache = ''
- // views目录路径
- this.views = this.options.views
-
- this.enableFrontMatter = this.options.enableFrontMatter
-
- // 禁用插件时,重置路由文件
- if (this.options.disabled) {
- cleanFile(this.options.routes)
- }
- }
-
- apply(compiler) {
- compiler.hooks.beforeCompile.tap('RoutesBuilderPlugin', () => {
- if (this.options.disabled) return
- const content = parse(builder(this.views))
- if (this.cache !== content) {
- this.cache = content
- saveFile(content, this.options.routes)
- }
-
- })
-
- }
-}
-
-module.exports = AutoRoutesPlugin
diff --git a/core/plugins/copy-theme-after-compiled-plugin.js b/core/plugins/copy-theme-after-compiled-plugin.js
deleted file mode 100644
index ff7b9dc8852aef4278a8fd2b7e0c2d2aae83fab7..0000000000000000000000000000000000000000
--- a/core/plugins/copy-theme-after-compiled-plugin.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * 生产环境编译完成后,复制已编译好的主题样式文件到发布目录
- *
- * @author chenhuachun
- */
-
-const utils = require('../utils')
-
-class CopyThemeAfterCompiledPlugin {
- constructor (opt = {}) {
- this.options = {
- // 源文件目录
- from: '',
- // 复制到目录
- to: '',
- ...opt
- }
- }
-
- apply (compiler) {
- compiler.hooks.done.tap('copy', () => {
- const o = this.options
- utils.copyFiles(o.from, o.to)
- })
- }
-}
-
-module.exports = CopyThemeAfterCompiledPlugin
diff --git a/core/plugins/html-inject-config-plugin.js b/core/plugins/html-inject-config-plugin.js
deleted file mode 100644
index 202a6ac8c120bfe891e25efaba554b72cf361104..0000000000000000000000000000000000000000
--- a/core/plugins/html-inject-config-plugin.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 在html文件注入配置文件
- * @author chenhuachun@xdh.net.cn
- *
- * @example
- *
- * new HtmlInjectConfig()
- */
-
-
-/**
- * @class
- */
-class HtmlInjectConfigPlugin {
- /**
- * 构造函数
- */
- constructor(baseUrl = '') {
- this.files = [baseUrl + 'config.js?t=' + (new Date().getTime())]
- }
-
- apply(compiler) {
- compiler.hooks.compilation.tap('HtmlInjectConfigPlugin', compilation => {
- compilation.hooks.htmlWebpackPluginBeforeHtmlProcessing.tapAsync('HtmlInjectConfig', (data, callback) => {
- data.assets.js = this.files.concat(data.assets.js)
- callback(null, data)
- })
- })
- }
-}
-
-module.exports = HtmlInjectConfigPlugin
diff --git a/core/plugins/html-inject-theme-plugin.js b/core/plugins/html-inject-theme-plugin.js
deleted file mode 100644
index 62542b280a3284e5693ea4c6a7467286dba64af4..0000000000000000000000000000000000000000
--- a/core/plugins/html-inject-theme-plugin.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * 生产环境编译, 引入主题文件信息描述的js文件
- *
- */
-const fs = require('fs')
-const utils = require('../utils')
-
-
-class InsertThemeScriptInHtmlPlugin {
- constructor(opt) {
- this.options = {
-
- // 应用名称
- appName: null,
-
- // 生产环境编译主题时的临时存放目录
- tempDir: '',
-
- // 主题样式文件的访问路径
- path: '',
-
- // theme.js文件保存路径
- savePath: '',
- // theme.js 在html的引用路径
- baseUrl: '',
-
- ...opt
- }
- }
-
- apply(compiler) {
- compiler.hooks.compilation.tap('InsertThemeScriptInHtmlPlugin', compilation => {
- compilation.hooks.htmlWebpackPluginBeforeHtmlProcessing.tapAsync('insert', (data, callback) => {
- const themes = {}
- // const tempDir = utils.join(this.options.tempDir, this.options.baseUrl)
- // 目录不存在,不处理
- if (!fs.existsSync(this.options.tempDir)) {
- callback(null, data)
- }
- // 读取主题文件名称
- const themeFiles = fs.readdirSync(this.options.tempDir) || []
- // 无主题文件,不需要创建
- if (themeFiles.length === 0) return
-
- // 构造主题的访问路径映射
- themeFiles.forEach(file => {
- const name = file.split('-')[0]
- themes[name] = utils.urlFormat(utils.join(this.options.path, file))
- })
-
- const varName = this.options.appName ? `__MY_THEMES_${this.options.appName}__` : '__MY_THEMES__'
- const content = `(function(global){global.${varName}=${JSON.stringify(themes)}})(window)`
- utils.writeFile(utils.join(this.options.savePath, 'theme.js'), content)
- const file = utils.urlFormat(utils.join(this.options.baseUrl, '/theme.js?t=' + (new Date().getTime())))
- data.assets.js = [file].concat(data.assets.js)
- callback(null, data)
- })
- })
- }
-}
-
-module.exports = InsertThemeScriptInHtmlPlugin
diff --git a/core/plugins/theme-switch-for-compile-plugin.js b/core/plugins/theme-switch-for-compile-plugin.js
deleted file mode 100644
index c54ef0e48c637fef04faa17c8c01e4aa2d55ed8f..0000000000000000000000000000000000000000
--- a/core/plugins/theme-switch-for-compile-plugin.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 更换主题配置文件webpack插件,修改主题配置,指定要打包的主题
- *
- * @author chenhuachun
- *
- * 步骤:
- * 1. 先备份 _theme.scss
- * 2. 开始编译之前写入_theme.scss此次编译主题
- * 3. 编译完成后还原_theme.scss文件
- *
- *
- */
-const utils = require('../utils')
-const core = require('../index')
-const backupFilePath = core.BackupLocalThemesFile
-
-class ThemeSwitchForCompilePlugin {
-
- constructor(opt = {}) {
- const o = this.options = {
- // 主题名称
- theme: 'default',
-
- // 主题scss引入文件路径,即 _theme.scss 的路径
- src: '',
-
- ...opt
- }
-
- // 先备份文件
- utils.copyFile(o.src, backupFilePath)
- }
-
- apply(compiler) {
- // 开始编译之前写入主题路径
- compiler.hooks.beforeCompile.tap('writeFile', () => {
- const o = this.options
- const content = `@import "../themes/${o.theme}";`
- utils.writeFile(o.src, content)
- })
-
- // 编译完成,还原配置
- compiler.hooks.done.tap('restore', () => {
- utils.copyFile(backupFilePath, this.options.src)
- // 删除备份文件
- utils.rm(backupFilePath)
- })
- }
-}
-
-module.exports = ThemeSwitchForCompilePlugin
diff --git a/core/plugins/vue-jsdoc-plugin.js b/core/plugins/vue-jsdoc-plugin.js
deleted file mode 100644
index e5621ea881338113c75dff43f4f1381abd373172..0000000000000000000000000000000000000000
--- a/core/plugins/vue-jsdoc-plugin.js
+++ /dev/null
@@ -1,11 +0,0 @@
-const compiler = require('vue-template-compiler')
-
-exports.handlers = {
- // 利用 vue-template-compiler 编译 vue 模板
- beforeParse: function (e) {
- if (/\.vue$/.test(e.filename)) {
- const output = compiler.parseComponent(e.source);
- e.source = output.script ? output.script.content : '';
- }
- }
-}
diff --git a/core/renders/coder/api.js b/core/renders/coder/api.js
deleted file mode 100644
index ef8e5f3c84f28420efd51d9e8592162112ed8b32..0000000000000000000000000000000000000000
--- a/core/renders/coder/api.js
+++ /dev/null
@@ -1,82 +0,0 @@
-const _ = require('lodash')
-module.exports = _.template(`
-/**
- * <%=cname%> api
- * @module code/api/<%=name%>
- * @author coder
- */
-
-<%if(configKeys.length>0){%>
-// <%=configKeys.join(', ')%>
-import { <%=configKeys.join(', ')%>} from '@/constant'
-<%}%>
-
-<%if(transforms.length>0){%>
-// ajax
-import ajax, { transformHandler } from '$ui/utils/ajax'
-
-// transformer
-import transformer from '@/mapping/index'
-const { <%=transforms.join(', ')%> } = transformer
-
-<%}else{%>
-// ajax
-import ajax from '$ui/utils/ajax'
-<%}%>
-
-<%_.each(items, function(item, i){%>
-/**
- * <%=item.title||item.URL%>
- * @const
- * @type {String}
- * @default '<%if(item.prefix){%>[<%=item.prefix%>]<%}%><%=item.url%>'
- */
-export const <%=item.URL%> = <%if(item.prefix){%> <%=item.prefix%> + <%}%>'<%=item.url%>'
-
-/**
- * <%=item.title||item.camelCaseName%>
- <%_.each(item.params, function(param){%>
- * @param {string|number} <%=param%> Url参数<%=param%>
- <%})%>
- * @param {object} [<%=item.ajaxParam%>] 发送键值对数据
- * @param {object} [options] ajax参数选项
- * @returns {Promise}
- */
-export function <%=item.camelCaseName%> (
-
-<%=item.params.join(', ')%>
-
-<%if(item.params.length>0){%>,<%}%>
-
- <%=item.ajaxParam%>
-
-, options
-
-) {
- return ajax({
- <%if(item.options){%>
- <%_.each(item.options, function(value, key){%>
- <%=key%>: <%if(typeof value=='string'){%> '<%=value%>' <%}else{%> <%=JSON.stringify(value)%> <%}%>,
- <%})%>
- <%}%>
-
- <%if(item.params.length>0){%>
- params:{<%=item.params.join(', ')%>},
- <%}%>
-
- <%if(item.transform && item.transform.length>0){%>
- transformResponse: [transformHandler(<%=item.transform%>, '<%=item.camelCaseName%>', <%=item.ajaxParam%>, options
- <%if(item.params.length>0){%>
- ,{<%=item.params.join(', ')%>}
- <%}%>)],
- <%}%>
-
- <%=item.ajaxParam%>:<%=item.ajaxParam%>,
-
- url: <%=item.URL%>,
-
- ...options
- })
-}
-<%})%>
-`)
diff --git a/core/renders/coder/icons.js b/core/renders/coder/icons.js
deleted file mode 100644
index cb30a38603585679be5ec20114ebe44121efe2a7..0000000000000000000000000000000000000000
--- a/core/renders/coder/icons.js
+++ /dev/null
@@ -1,16 +0,0 @@
-const _ = require('lodash')
-
-module.exports = _.template(`
-/**
- * icons
- * @module $my/code/icons
- * @author coder
- */
-
-export const elIcons = <%=elItems%>;
-
-export const myIcons = <%=items%>
-
-export default {elIcons, myIcons}
-
-`)
diff --git a/core/renders/coder/mixin.js b/core/renders/coder/mixin.js
deleted file mode 100644
index 21e86382c43c4162addf3039331918111703cd34..0000000000000000000000000000000000000000
--- a/core/renders/coder/mixin.js
+++ /dev/null
@@ -1,308 +0,0 @@
-const _ = require('lodash')
-module.exports = _.template(`
-/**
- * <%=cname%> mixin module
- * @module $my/code/mixin/<%=name%>
- * @author coder
- */
-import { <%=importApiArray.join(', ')%> } from '$my/code/api/<%=kebabCaseName%>'
-
-// mixin
-export default {
- /**
- * <%=cname%>数据存储载体对象
- * @member <%=name%>
- <%_.each(customStateArray, function(item){ %>
- * @property {*} [<%=item.state%>=null] <%=item.title%>响应数据
- <%})%>
- * @property {Array} [<%=list%>=\\[\\]] 获取<%=cname%>列表响应数据
- * @property {number} [<%=page%>=null] 获取<%=cname%>列表响应页码
- * @property {number} [<%=limit%>=null] 获取<%=cname%>列表页大小,每页记录条数
- * @property {number} [<%=total%>=0] 获取<%=cname%>列表数据记录总条数
- * @property {object} [<%=model%>=null] 获取<%=cname%>单条记录
- */
- data() {
- return {
- <%=name%>: {
- <%_.each(customStateArray, function(item){ %>
- <%=item.state%>: null,
- <%})%>
- <%=list%>: [],
- <%=page%>: null,
- <%=limit%>: null,
- <%=total%>: 0,
- <%=model%>: null
- }
- }
- },
- methods: {
-
- <%_.each(items, function(item, i){%>
- <%if(i>0){%>,<%}%>
-
- <%if(item.methodType == 'fetch'){%>
- /**
- * <%=item.title%>
- * @function <%=item.name%>
- <%_.each(item.params, function(param){%>
- * @param {string|number} <%=param%> 请求URL路径参数<%=param%>数据
- <%})%>
- * @param {object} data 请求发送的数据<%=item.ajaxParam%>
- * @param {object} [options] ajax参数选项
- * @returns {Promise} Promise实例
- */
- <%=item.name%>({
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options }={}
- ) {
- return <%=item.name%>(
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options
- ).then(res => {
- this.<%=name%>.<%=list%> = res.<%=list%> || []
- this.<%=name%>.<%=page%> = Number.parseInt(res.<%=page%>) || 0
- this.<%=name%>.<%=limit%> = Number.parseInt(res.<%=limit%>) || 0
- this.<%=name%>.<%=total%> = Number.parseInt(res.<%=total%>) || 0
- return res
- })
-
- }
- <%}%>
-
- <%if(item.methodType == 'add'){%>
- /**
- * <%=item.title%>
- * @function <%=item.name%>
- <%_.each(item.params, function(param){%>
- * @param {string|number} <%=param%> 请求URL路径参数<%=param%>数据
- <%})%>
- * @param {object} data 请求发送的数据<%=item.ajaxParam%>
- * @param {number} [index] 新增到列表的位置索引,默认最近到列表最后
- * @param {object} [options] ajax参数选项
- * @returns {Promise} Promise实例
- */
- <%=item.name%>({
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- index,
- options }={}
- ) {
- return <%=item.name%>(
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- index,
- options
- ).then(res => {
- const model = Object.assign({}, <%=item.ajaxParam%>, res||{})
- const list = [...this.<%=name%>.<%=list%>]
- if(index !== undefined) {
- list.splice(index, 0, model)
- }else {
- list.push(model);
- }
- this.<%=name%>.<%=list%> = list
- this.<%=name%>.<%=total%> += 1;
- return res
- })
- }
-
- <%}%>
-
- <%if(item.methodType == 'update'){%>
- /**
- * <%=item.title%>
- * @function <%=item.name%>
- <%_.each(item.params, function(param){%>
- * @param {string|number} <%=param%> 请求URL路径参数<%=param%>数据
- <%})%>
- * @param {object} data 请求发送的数据<%=item.ajaxParam%>
- * @param {number} [index] 源实体在列表的位置索引,如没有index,即不更新实体在源列表数据
- * @param {object} [options] ajax参数选项
- * @returns {Promise} Promise实例
- */
- <%=item.name%>({
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- index,
- options }={}
- ) {
- return <%=item.name%>(
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- index,
- options
- ).then(res => {
- const model = Object.assign({}, <%=item.ajaxParam%>, res||{})
- const list = [...this.<%=name%>.<%=list%>]
- if(index !== undefined) {
- list.splice(index, 1, model)
- }
- this.<%=name%>.<%=list%> = list
- return res
- })
- }
-
-
- <%}%>
-
- <%if(item.methodType == 'remove'){%>
- /**
- * <%=item.title%>
- * @function <%=item.name%>
- <%_.each(item.params, function(param){%>
- * @param {string|number} <%=param%> 请求URL路径参数<%=param%>数据
- <%})%>
- * @param {object} data 请求发送的数据<%=item.ajaxParam%>
- * @param {number} [index] 源实体在列表的位置索引,如没有index,即不删除实体在源列表数据
- * @param {object} [options] ajax参数选项
- * @returns {Promise} Promise实例
- */
- <%=item.name%>({
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- index,
- options }={}
- ) {
- return <%=item.name%>(
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options
- ).then(res => {
- const list = [...this.<%=name%>.<%=list%>]
- if(index !== undefined) {
- list.splice(index, 1)
- }
- this.<%=name%>.<%=list%> = list
- this.<%=name%>.<%=total%> -= 1;
- return res
-
- })
- }
-
- <%}%>
-
- <%if(item.methodType == 'get'){%>
- /**
- * <%=item.title%>
- * @function <%=item.name%>
- <%_.each(item.params, function(param){%>
- * @param {string|number} <%=param%> 请求URL路径参数<%=param%>数据
- <%})%>
- * @param {object} data 请求发送的数据<%=item.ajaxParam%>
- * @param {object} [options] ajax参数选项
- * @returns {Promise} Promise实例
- */
- <%=item.name%>({
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options }={}
- ) {
- return <%=item.name%>(
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options
- ).then(res => {
- this.<%=name%>.model = Object.assign({}, <%=item.ajaxParam%>, res||{})
- return res
- })
- }
- <%}%>
-
-
- <%if(item.methodType == 'batch'){%>
- /**
- * <%=item.title%>
- * @function <%=item.name%>
- <%_.each(item.params, function(param){%>
- * @param {string|number} <%=param%> 请求URL路径参数<%=param%>数据
- <%})%>
- * @param {object} data 请求发送的数据<%=item.ajaxParam%>
- * @param {number[]} [indexes] 源实体在列表的位置索引,如没有indexes,即不删除实体在源列表数据
- * @param {object} [options] ajax参数选项
- * @returns {Promise} Promise实例
- */
- <%=item.name%>({
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- indexes = [],
- options }={}
- ) {
- return <%=item.name%>(
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options
- ).then(res => {
- if(indexes.length > 0) {
- this.<%=name%>.<%=list%> = this.<%=name%>.<%=list%>.filter((item, index) => !indexes.includes(index))
- }
- this.<%=name%>.<%=total%> -= indexes.length;
- return res
- })
- }
-
- <%}%>
-
- <%if(['fetch','get','add','update','remove','batch'].indexOf(item.methodType)==-1){%>
- /**
- * <%=item.title%>
- * @function <%=item.name%>
- <%_.each(item.params, function(param){%>
- * @param {string|number} <%=param%> 请求URL路径参数<%=param%>数据
- <%})%>
- * @param {object} data 请求发送的数据<%=item.ajaxParam%>
- * @param {object} [options] ajax参数选项
- * @returns {Promise} Promise实例
- */
- <%=item.name%>({
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options }={}
- ) {
- return <%=item.name%>(
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options
- ).then(res => {
- <%if(item.state){%>
- this.<%=name%>.<%=item.state%> = res
- <%}%>
- return res
- })
- }
-
- <%}%>
-
- <%})%>
- }
-}
-`)
diff --git a/core/renders/coder/mock.js b/core/renders/coder/mock.js
deleted file mode 100644
index 898d4bec9e730b93e3aa6ea8985f77d2ff88a63b..0000000000000000000000000000000000000000
--- a/core/renders/coder/mock.js
+++ /dev/null
@@ -1,154 +0,0 @@
-const _ = require('lodash')
-module.exports = _.template(`
-<% if(importApiArray.length>0){%>
-// <%=importApiArray.join(', ')%>
-import { <%=importApiArray.join(', ')%> } from '$my/code/api/<%=kebabCaseName%>'
-<%}%>
-<%if(templateArray.length>0){%>
-// <%=templateArray.join(', ')%>
-import { <%=templateArray.join(', ')%>} from '@/mock/templates'
-<%}%>
-// Mock
-export default [
-<%_.each(mocks, function(item, i){%>
- <%if(i>0){%>,<%}%>
-
- <%if(item.methodType == 'fetch'){%>
- {
- title: '<%=item.URL%>',
- url: <%=item.URL%>,
- method: '<%=item.httpMethod%>',
- params: {
- <%=item.page%>: 1,
- <%=item.limit%>: 10
- },
- <%if(item.template){%>
- template: <%=item.template%> }
- <%} else {%>
- template: {
- <%=code%>: <%=codeValue%>,
- <%=message%>: '获取列表成功',
- <%=data%>: {
- <%=item.page%>: '{{<%=item.page%>}}',
- <%=item.limit%>: '{{<%=item.limit%>}}',
- <%=item.total%>: 1000,
- '<%=item.list%>|{{<%=item.limit%>}}': [<%=item.columns%>]
- }
- }
- }
-
- <%}%>
- <%}%>
-
- <%if(item.methodType == 'update'){%>
- {
- title: '<%=item.URL%>',
- url: <%=item.URL%>,
- method: '<%=item.httpMethod%>',
- params: {},
- <%if(item.template){%>
- template: <%=item.template%>
- <%} else {%>
- template: {
- <%=code%>: <%=codeValue%>,
- <%=message%>: '更新成功',
- <%=data%>: <%=updateData%>
- }
- <%}%>
- }
- <%}%>
-
- <%if(item.methodType == 'get'){%>
- {
- title: '<%=item.URL%>',
- url: <%=item.URL%>,
- method: '<%=item.httpMethod%>',
- params: {},
- <%if(item.template){%>
- template: <%=item.template%>
- <%} else {%>
- template: {
- <%=code%>: <%=codeValue%>,
- <%=message%>: '获取成功',
- <%=data%>: <%=item.columns%>
- }
- <%}%>
- }
- <%}%>
-
- <%if(item.methodType == 'add'){%>
- {
- title: '<%=item.URL%>',
- url: <%=item.URL%>,
- method: '<%=item.httpMethod%>',
- params: {},
- <%if(item.template){%>
- template: <%=item.template%>
- <%} else {%>
- template: {
- <%=code%>: <%=codeValue%>,
- <%=message%>: '添加成功',
- <%=data%>: <%=addData%>
- }
- <%}%>
- }
- <%}%>
-
- <%if(item.methodType == 'remove'){%>
- {
- title: '<%=item.URL%>',
- url: <%=item.URL%>,
- method: '<%=item.httpMethod%>',
- params: {},
- <%if(item.template){%>
- template: <%=item.template%>
- <%} else {%>
- template: {
- <%=code%>: <%=codeValue%>,
- <%=message%>: '删除成功',
- <%=data%>: <%=removeData%>
- }
- <%}%>
- }
- <%}%>
-
- <%if(item.methodType == 'batch'){%>
- {
- title: '<%=item.URL%>',
- url: <%=item.URL%>,
- method: '<%=item.httpMethod%>',
- params: {},
- <%if(item.template){%>
- template: <%=item.template%>
- <%} else {%>
- template: {
- <%=code%>: <%=codeValue%>,
- <%=message%>: '批量删除成功',
- <%=data%>: <%=batchData%>
- }
- <%}%>
- }
- <%}%>
-
- <%if(['fetch','get','update','remove','add','batch'].indexOf(item.methodType)==-1){%>
- {
- title: '<%=item.URL%>',
- url: <%=item.URL%>,
- method: '<%=item.httpMethod%>',
- params: {},
- <%if(item.template){%>
- template: <%=item.template%>
- <%} else {%>
- template: {
- <%=code%>: <%=codeValue%>,
- <%=message%>: '请求成功',
- <%=data%>: <%=item.columns%>
- }
- <%}%>
- }
- <%}%>
-
-
-<%})%>
-]
-`)
diff --git a/core/renders/coder/store.js b/core/renders/coder/store.js
deleted file mode 100644
index 4f74400c39cea4e0a165d02f32d73dd8dc3e2a86..0000000000000000000000000000000000000000
--- a/core/renders/coder/store.js
+++ /dev/null
@@ -1,465 +0,0 @@
-const _ = require('lodash')
-module.exports = _.template(`
-/**
- * <%=cname%> store module
- * @module $my/code/store/<%=name%>
- * @author coder
- */
-
-import {mapState, mapActions} from 'vuex'
-import { <%=importTypeArray.join(', ')%> } from '$my/code/types'
-import { <%=importApiArray.join(', ')%> } from '$my/code/api/<%=kebabCaseName%>'
-// store module
-export const <%=name%> = {
- /**
- * 状态数据
- * @member state
- <%_.each(customStateArray, function(item){ %>
- * @property {*} <%=item.state%> <%=item.title%>响应数据
- <%})%>
- * @property {Array} <%=list%> 获取<%=cname%>列表响应数据
- * @property {Number} <%=page%> 获取<%=cname%>列表响应页码
- * @property {Number} <%=limit%> 获取<%=cname%>列表页大小,每页记录条数
- * @property {Number} <%=total%> 获取<%=cname%>列表数据记录总条数
- * @property {Object} <%=model%> 获取<%=cname%>单条记录
- */
- state: {
- <%_.each(customStateArray, function(item){ %>
- <%=item.state%>: null,
- <%})%>
- <%=list%>: [],
- <%=page%>: 1,
- <%=limit%>: 0,
- <%=total%>: 0,
- <%=model%>: null
- },
- mutations: {
- <%_.each(items, function(item, i){%>
- <%if(i>0){%>,<%}%>
-
- <%if(item.methodType == 'fetch'){%>
- /**
- * <%=item.title%>
- * @function [mutations]<%=item.NAME%>
- * @param {object} state vuex状态
- * @param {object} payload 负载数据
- * @param {Array} [payload.<%=list%>] 数据列表
- * @param {number} [payload.<%=page%>=0] 数据页码
- * @param {number} [payload.<%=limit%>=0] 每页条数
- * @param {number} [payload.<%=total%>=0] 总记录数
- */
- [<%=item.NAME%>](state, payload) {
- state.<%=list%> = payload.<%=list%> || [];
- state.<%=page%> = payload.<%=page%> || 0;
- state.<%=limit%> = payload.<%=limit%> || 0;
- state.<%=total%> = payload.<%=total%> || 0;
- }
- <%}%>
-
- <%if(item.methodType == 'add'){%>
- /**
- * <%=item.title%>
- * @function [mutations]<%=item.NAME%>
- * @param {object} state vuex状态
- * @param {object} payload 负载数据
- * @param {number} [payload.index] 新增到列表的位置索引,默认最近到列表最后
- * @param {object} payload.<%=model%> 新增的实体对象
- */
- [<%=item.NAME%>](state, payload) {
- const list = [...state.<%=list%>]
- if(payload.index !== undefined) {
- list.splice(payload.index, 0, payload.<%=model%>)
- }else {
- list.push(payload.<%=model%>);
- }
- state.<%=list%> = list
- state.<%=total%> += 1
- }
- <%}%>
-
- <%if(item.methodType == 'update'){%>
- /**
- * <%=item.title%>
- * @function [mutations]<%=item.NAME%>
- * @param {object} state vuex状态
- * @param {object} payload 负载数据
- * @param {number} [payload.index] 源实体在列表的位置索引,如没有index,即不更新源列表数据
- * @param {object} payload.<%=model%> 更新的实体对象
- */
- [<%=item.NAME%>](state, payload) {
- if(payload.index !== undefined) {
- const list = [...state.<%=list%>]
- list.splice(payload.index, 1, payload.<%=model%>)
- state.<%=list%> = list
- }
- }
- <%}%>
-
- <%if(item.methodType == 'remove'){%>
- /**
- * <%=item.title%>
- * @function [mutations]<%=item.NAME%>
- * @param {object} state vuex状态
- * @param {object} payload 负载数据
- * @param {number} [payload.index] 源实体在列表的位置索引,如没有index,即不删除实体在源列表数据
- */
- [<%=item.NAME%>](state, payload) {
- if(payload.index !== undefined) {
- const list = [...state.<%=list%>]
- list.splice(payload.index, 1)
- state.<%=list%> = list
- }
- state.<%=total%> -= 1
- }
- <%}%>
-
- <%if(item.methodType == 'get'){%>
- /**
- * <%=item.title%>
- * @function [mutations]<%=item.NAME%>
- * @param {object} state vuex状态
- * @param {object} payload 负载数据
- * @param {object} payload.<%=model%> 实体对象
- */
- [<%=item.NAME%>](state, payload) {
- state.<%=model%> = payload.<%=model%>
- }
- <%}%>
-
- <%if(item.methodType == 'batch'){%>
- /**
- * <%=item.title%>
- * @function [mutations]<%=item.NAME%>
- * @param {object} state vuex状态
- * @param {object} payload 负载数据
- * @param {number[]} [payload.indexes] 源实体在列表的位置索引,如没有index,即不删除实体在源列表数据
- */
- [<%=item.NAME%>](state, payload) {
- state.<%=list%> = state.<%=list%>.filter((item, index) => !payload.indexes.includes(index));
- state.<%=total%> -= payload.indexes.length
- }
- <%}%>
-
-
- <%if(['fetch','get','add','update','remove','batch'].indexOf(item.methodType)==-1){%>
- /**
- * <%=item.title%>
- * @function [mutations]<%=item.NAME%>
- * @param {object} state vuex状态
- * @param {object} payload 负载数据
- * @param {object} payload.<%=item.state%> 需保存的数据
- */
- [<%=item.NAME%>](state, payload) {
- state.<%=item.state%> = payload.<%=item.state%>
- }
- <%}%>
-
- <%})%>
-
- },
- actions: {
-
- <%_.each(items, function(item, i){%>
- <%if(i>0){%>,<%}%>
- <%if(item.methodType == 'fetch'){%>
- /**
- * <%=item.title%>
- * @function [actions]<%=item.NAME%>
- * @param {object} context Store实例
- * @param {function} context.commit 提交mutation方法
- * @param {object} payload 负载数据对象
- <%_.each(item.params, function(param){%>
- * @param {string|number} payload.<%=param%> URL路径参数数据<%=param%>
- <%})%>
- * @param {object} payload.<%=item.ajaxParam%> 请求发送数据<%=item.ajaxParam%>
- * @param {object} payload.options ajax参数选项
- * @returns {Promise} Promise实例
- */
- [<%=item.NAME%>]({commit}, {
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options
- } = {}) {
- return <%=item.name%>(
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options
- ).then(res => {
- commit({
- type: <%=item.NAME%>,
- <%=list%>: res.<%=list%>,
- <%=page%>: Number.parseInt(res.<%=page%>),
- <%=limit%>: Number.parseInt(res.<%=limit%>),
- <%=total%>: Number.parseInt(res.<%=total%>)
- })
- return res
- })
- }
- <%}%>
-
- <%if(item.methodType == 'add'){%>
- /**
- * <%=item.title%>
- * @function [actions]<%=item.NAME%>
- * @param {object} context Store实例
- * @param {function} context.commit 提交mutation方法
- * @param {object} payload 负载数据对象
- <%_.each(item.params, function(param){%>
- * @param {string|number} payload.<%=param%> URL路径参数数据<%=param%>
- <%})%>
- * @param {object} payload.<%=item.ajaxParam%> 请求发送数据<%=item.ajaxParam%>
- * @param {number} [payload.index] 新增到列表的位置索引,默认最近到列表最后
- * @param {object} payload.options ajax参数选项
- * @returns {Promise} Promise实例
- */
- [<%=item.NAME%>]({commit}, {
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- index,
- options
- } = {}) {
- return <%=item.name%>(
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options
- ).then(res => {
- commit({
- type: <%=item.NAME%>,
- <%=model%>: Object.assign({}, <%=item.ajaxParam%>, res),
- index: index
- })
- return res
- })
- }
- <%}%>
-
- <%if(item.methodType == 'update'){%>
- /**
- * <%=item.title%>
- * @function [actions]<%=item.NAME%>
- * @param {object} context Store实例
- * @param {function} context.commit 提交mutation方法
- * @param {object} payload 负载数据对象
- <%_.each(item.params, function(param){%>
- * @param {string|number} payload.<%=param%> URL路径参数数据<%=param%>
- <%})%>
- * @param {object} payload.<%=item.ajaxParam%> 请求发送数据<%=item.ajaxParam%>
- * @param {number} [payload.index] 源实体在列表的位置索引,如没有index,即不更新实体在源列表数据
- * @param {object} payload.options ajax参数选项
- * @returns {Promise} Promise实例
- */
- [<%=item.NAME%>]({commit, state}, {
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- index,
- options
- }={}) {
- return <%=item.name%>(
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options
- ).then(res => {
- commit({
- type: <%=item.NAME%>,
- index: index,
- <%=model%>: Object.assign({}, state.<%=list%>[index], <%=item.ajaxParam%>, res)
- })
- return res
- })
- }
- <%}%>
-
- <%if(item.methodType == 'remove'){%>
- /**
- * <%=item.title%>
- * @function [actions]<%=item.NAME%>
- * @param {object} context Store实例
- * @param {function} context.commit 提交mutation方法
- * @param {object} payload 负载数据对象
- <%_.each(item.params, function(param){%>
- * @param {string|number} payload.<%=param%> URL路径参数数据<%=param%>
- <%})%>
- * @param {object} payload.<%=item.ajaxParam%> 请求发送数据<%=item.ajaxParam%>
- * @param {number} [payload.index] 源实体在列表的位置索引,如没有index,即不删除实体在源列表数据
- * @param {object} payload.options ajax参数选项
- * @returns {Promise} Promise实例
- */
- [<%=item.NAME%>]({commit}, {
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- index,
- options
- }={}) {
- return <%=item.name%>(
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options
- ).then(res => {
- commit({
- type: <%=item.NAME%>,
- index: index
- })
- return res
- })
- }
- <%}%>
-
- <%if(item.methodType == 'get'){%>
- /**
- * <%=item.title%>
- * @function [actions]<%=item.NAME%>
- * @param {object} context Store实例
- * @param {function} context.commit 提交mutation方法
- * @param {object} payload 负载数据对象
- <%_.each(item.params, function(param){%>
- * @param {string|number} payload.<%=param%> URL路径参数数据<%=param%>
- <%})%>
- * @param {object} payload.<%=item.ajaxParam%> 请求发送数据<%=item.ajaxParam%>
- * @param {object} payload.options ajax参数选项
- * @returns {Promise} Promise实例
- */
- [<%=item.NAME%>]({commit}, {
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options
- }={}) {
- return <%=item.name%>(
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options
- ).then(res => {
- commit({
- type: <%=item.NAME%>,
- <%=model%>: res
- })
- return res
- })
- }
- <%}%>
-
- <%if(item.methodType == 'batch'){%>
- /**
- * <%=item.title%>
- * @function [actions]<%=item.NAME%>
- * @param {object} context Store实例
- * @param {function} context.commit 提交mutation方法
- * @param {object} payload 负载数据对象
- <%_.each(item.params, function(param){%>
- * @param {string|number} payload.<%=param%> URL路径参数数据<%=param%>
- <%})%>
- * @param {object} payload.<%=item.ajaxParam%> 请求发送数据<%=item.ajaxParam%>
- * @param {number[]} [payload.indexes] 源实体在列表的位置索引,如没有indexes,即不删除实体在源列表数据
- * @param {object} payload.options ajax参数选项
- * @returns {Promise} Promise实例
- */
- [<%=item.NAME%>]({commit}, {
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- indexes,
- options
- }={}) {
- return <%=item.name%>(
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options
- ).then(res => {
- commit({
- type: <%=item.NAME%>,
- indexes: indexes || []
- })
- return res
- })
- }
- <%}%>
-
-
- <%if(['fetch','get','add','update','remove', 'batch'].indexOf(item.methodType)==-1){%>
- /**
- * <%=item.title%>
- * @function [actions]<%=item.NAME%>
- * @param {object} context Store实例
- * @param {function} context.commit 提交mutation方法
- * @param {object} payload 负载数据对象
- <%_.each(item.params, function(param){%>
- * @param {string|number} payload.<%=param%> URL路径参数数据<%=param%>
- <%})%>
- * @param {object} payload.<%=item.ajaxParam%> 请求发送数据<%=item.ajaxParam%>
- * @param {object} payload.options ajax参数选项
- * @returns {Promise} Promise实例
- */
- [<%=item.NAME%>]({commit}, {
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options
- }={}) {
- return <%=item.name%>(
- <%_.each(item.params, function(param){%>
- <%=param%>,
- <%})%>
- <%=item.ajaxParam%>,
- options
- ).then(res => {
- commit({
- type: <%=item.NAME%>,
- <%=item.state%>: res
- })
- return res
- })
- }
- <%}%>
-
- <%})%>
- }
-}
-
-/**
- * Vue mixin setup
- */
-export default {
- computed: {
- ...mapState(['<%=name%>'])
- },
- methods: {
- ...mapActions({
- <%_.each(items, function(item, i){%>
- <%if(i>0){%>,<%}%>
- <%=item.name%>: <%=item.NAME%>
- <%})%>
- })
- },
- beforeCreate() {
- const store = this.$store
- if (!store) return
- if (!store.state.<%=name%>) {
- store.registerModule('<%=name%>', <%=name%>)
- }
- }
-}
-
-`)
diff --git a/core/renders/coder/types.js b/core/renders/coder/types.js
deleted file mode 100644
index 9f1a6e26d2017f82d162086f1d2eb07e9a3f7e58..0000000000000000000000000000000000000000
--- a/core/renders/coder/types.js
+++ /dev/null
@@ -1,21 +0,0 @@
-const _ = require('lodash')
-module.exports = _.template(`
-/**
-* Vuex Mutation type
-* @module base/types
-* @author coder
-*/
-<%_.each(types, function(items, name){%>
-// ------------------------ <%=name%> -------------------------
- <%_.each(items, function(item){%>
- /**
- * <%=item.title%>
- * @const
- * @type {String}
- * @default '<%=item.name%>'
- */
- export const <%=item.name%> = '<%=item.name%>'
- <%})%>
-
-<%})%>
-`)
diff --git a/core/renders/routes-wrapper.js b/core/renders/routes-wrapper.js
deleted file mode 100644
index 6e5ba8e05fa395c808675b40b5cd89055606b109..0000000000000000000000000000000000000000
--- a/core/renders/routes-wrapper.js
+++ /dev/null
@@ -1,17 +0,0 @@
-const _ = require('lodash')
-
-/**
- * 路由外层代码
- * @param {object} options 参数数据
- * @param {string} options.content 内容
- */
-module.exports = _.template(`
-/**
-* 该文件由 .my/core/build/routes-builder-plugin.js webpack插件自动生成
-*/
-export default function ({get}) {
- return <%= content %>
-
-}
-
-`)
diff --git a/core/renders/routes.js b/core/renders/routes.js
deleted file mode 100644
index 3c4868c24dda7422388f3521a839e8e8003eeb72..0000000000000000000000000000000000000000
--- a/core/renders/routes.js
+++ /dev/null
@@ -1,29 +0,0 @@
-const _ = require('lodash')
-
-/**
- * 渲染函数
- * @param {object} options 参数对象
- * @param {object[]} options.items 路由数组
- * @param {function} options.render 渲染函数
- */
-module.exports = _.template(`
- [
- <% _.each(items, function(item, index) {%>
- <%if(index>0){%>,<%}%>
- {
-
- path: '<%= item.path %>',
- component: get('<%= item.component %>')
- <%if(item.children && item.children.length>0) { %>
- ,children: <%= render({items:item.children, render: render}) %>
- <%}%>
- <%if(item.meta){%>
- ,meta: <%=item.meta%>
- <%}%>
- ,props: true
- }
-
- <%})%>
-
- ]
-`)
diff --git a/core/renders/svg-component.js b/core/renders/svg-component.js
deleted file mode 100644
index 32a9b3bb0ef684eb3e372812173c36bcbd63520b..0000000000000000000000000000000000000000
--- a/core/renders/svg-component.js
+++ /dev/null
@@ -1,24 +0,0 @@
-const _ = require('lodash')
-
-
-module.exports = _.template(`
-/**
- * 该文件由 .my/core/build/svg.js 生成
- */
-
-import Vue from 'vue'
-import globalConfig from '$ui/config'
-
-const Icon = ({props}) => {
- const attrs = {...globalConfig.svg, ...props}
- return (
-
- <%= paths %>
-
- )
-}
-
-Vue.component('icon-<%= name %>', Icon)
-export default Icon
-
-`)
diff --git a/core/server/app.js b/core/server/app.js
deleted file mode 100644
index be26eba3e0718e9675ef5af0ce90f9f88296a013..0000000000000000000000000000000000000000
--- a/core/server/app.js
+++ /dev/null
@@ -1,8 +0,0 @@
-const utils = require('../utils')
-const core = require('../../core/index')
-const createHttpServer = require('./http')
-const config = require('../../core/config')()
-createHttpServer({
- port: config.serverPort,
- root: utils.join(core.MyRootPath, 'web')
-})
diff --git a/core/server/db.js b/core/server/db.js
deleted file mode 100644
index 2aed9fc824ec1c7e7fa38a0819d96973524596a7..0000000000000000000000000000000000000000
--- a/core/server/db.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * 文件数据库操作类
- * @author 陈华春
- */
-const fs = require('fs')
-const utils = require('../utils')
-const constant = require('../constant')
-const dbPath = utils.resolve(constant.dbDir)
-
-const loadFile = function (file) {
- if (!fs.existsSync(file)) {
- utils.writeFile(file, '{}')
- }
- return JSON.parse(fs.readFileSync(file, 'utf-8'))
-}
-
-const saveFile = function (path, model) {
- utils.writeFile(path, JSON.stringify(model))
-}
-
-class DB {
- constructor(name) {
- this.name = name;
- this.file = utils.join(dbPath, `${name}.json`);
- this.data = loadFile(this.file)
- }
-
- get(id) {
- return this.data[id]
- }
-
- add(model) {
- const id = utils.uid()
- model._id = id;
- model._time = new Date().toLocaleString()
- this.data[id] = model
- utils.writeFile(this.file, this.data)
- return id
- }
-
- update(id, model) {
- const m = this.data[id];
- if (m) {
- model._time = new Date().toLocaleString()
- this.data[id] = model
- }
- saveFile(this.file, this.data)
- }
-
- remove(id) {
- const m = this.data[id];
- if (m) {
- delete this.data[id];
- }
- saveFile(this.file, this.data)
- }
-
- list() {
- return Object.keys(this.data).map(key => this.data[key])
- }
-
- clear() {
- this.data = {}
- saveFile(this.file, this.data)
- }
-
- drop() {
- this.data = null
- fs.unlinkSync(this.file)
- }
-
- destroy() {
- this.data = null
- }
-}
-
-
-DB.getFiles = function () {
- const files = fs.readdirSync(dbPath) || []
- return files.map(file => {
- return new DB(file.replace('.json', ''))
- })
-}
-
-DB.create = function (name) {
- return new DB(name)
-}
-
-module.exports = DB
diff --git a/core/server/dev.js b/core/server/dev.js
deleted file mode 100644
index a25c330c0ed4fc4719df0992617e576d090880c8..0000000000000000000000000000000000000000
--- a/core/server/dev.js
+++ /dev/null
@@ -1,11 +0,0 @@
-const app = require('express')();
-const http = require('http').createServer(app);
-const io = require('socket.io')(http);
-
-io.on('connection', function(socket) {
- console.log('a user connected');
-});
-
-http.listen(30001, function() {
- console.log('listening on *:30001');
-});
diff --git a/core/server/http.js b/core/server/http.js
deleted file mode 100644
index 21bd3af383237bc0d7f2e142c6baa7580e47a5d3..0000000000000000000000000000000000000000
--- a/core/server/http.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * http 静态文件服务器创建方法
- *
- * @author chenhuachun
- */
-const express = require('express')
-const opn = require('opn')
-const bodyParser = require('body-parser')
-const utils = require('../utils')
-
-/**
- * 设置通用响应头
- * @param req
- * @param res
- */
-function setHeaders(req, res) {
- res.set({
- 'Access-Control-Allow-Credentials': 'true',
- 'Access-Control-Allow-Origin': req.get('Origin') || '*',
- 'Access-Control-Allow-Methods': 'GET,POST,DELETE,PUSH,PATCH,OPTIONS',
- 'Access-Control-Allow-Headers': 'Content-Type,XFILENAME,XFILECATEGORY,XFILESIZE'
- })
-}
-
-/**
- * 创建服务器函数
- * @param {Object} options 参数选项
- * @param {number} options.port 服务启动端口号
- * @param {string} options.root 文件系统根目录路径
- * @param {string} options.path 浏览器打开后访问目录路径
- * @param {boolean} options.open 是否自动打开浏览器
- * @param {object[]} routes 路由配置 {path, type, handler}
- * @return {{app, server}}
- */
-function createHttpServer({port, root, path, routes, open}) {
- const app = express()
-
- // 设置静态目录
- if (root) {
- app.use('/', express.static(root))
- }
-
- // 参数转换成json格式
- app.use(bodyParser.json())
-
- // 通用响应头设置
- app.use(function (req, res, next) {
- setHeaders(req, res)
- next()
- })
-
- routes = routes || []
- // 设置接口路由
- routes.forEach(({path, type, handler}) => {
- app[type || 'get'](path, handler)
- })
-
- // 处理跨域
- app.options('/*', (req, res) => {
- res.send(null)
- })
-
- // 启动http服务
- const server = app.listen(port, function (err) {
-
- if (err) utils.log(err, 'error')
-
- const port = server.address().port
- const host = `http://127.0.0.1:${port}`
- const url = host + utils.join('/', path || '')
-
- utils.log(`http server listening at ${host}`, 'success')
-
- // 打开浏览器
- opn && opn(url)
-
- })
- return {
- app,
- server
- }
-}
-
-module.exports = createHttpServer
diff --git a/core/templates/app/config.js b/core/templates/app/config.js
deleted file mode 100644
index ac2c77be7f38211f9741acd02f42149f8d677a37..0000000000000000000000000000000000000000
--- a/core/templates/app/config.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import {set as setConfig} from '$ui/config'
-
-// 写入运行时配置
-setConfig({
-
- appName: '{{appName}}',
-
- routePrefix: '/{{appName}}',
-
- // 路由模式
- router: {
- mode: 'hash',
- base: '/'
- },
-
- // 是否应用自动生成的路由配置
- autoRoutes: true,
-
- access: {
- // 启用请求权限控制
- axios: true,
-
- // 启用路由权限控制
- router: true,
-
- // 缓存存储方式 session 或 local
- storage: 'session',
-
- // 登录页面路径
- loginPath: '/login',
-
- // 权限不足页面路径
- authorizePath: '/403'
- }
-})
diff --git a/core/templates/app/main.js b/core/templates/app/main.js
deleted file mode 100644
index 2e866ea6359e1d98794b8992e8ebde82291b198b..0000000000000000000000000000000000000000
--- a/core/templates/app/main.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * 初始化配置
- */
-
-import './config'
-
-/**
- * 获取全局配置
- */
-import globalConfig from '$ui/config'
-
-/**
- * 子应用提供的能力
- */
-import {Vuex, getView, progress, createMicroApp} from '$ui/app'
-
-/**
- * 基础通用样式
- */
-import '@/style/index.scss'
-
-/**
- * 项目自定义的路由, 手动写的
- */
-const routesFactory = require(`$apps/${process.env.APP}/router/routes`).default
-
-/**
- * 按views目录下文件自动生成的路由
- */
-const autoRoutesFactory = require(`$my/routes/${process.env.APP}`).default
-
-/**
- * 项目Vuex实例参数选项
- */
-const vuexOptions = require(`$apps/${process.env.APP}/store/index`).default
-
-/**
- * 全局共享数据 Vuex实例
- */
-const store = new Vuex.Store(vuexOptions)
-
-/**
- * 如果启用了自动创建路由功能,获取路由配置信息
- * @type {Array}
- */
-const autoRoutes = globalConfig.autoRoutes ? autoRoutesFactory({get: getView}) : []
-
-/**
- * 项目手工配置的路由与自动路由合并
- */
-const routes = routesFactory({get: getView}).concat(autoRoutes)
-
-/**
- * 前端微服务应用
- */
-const microApp = createMicroApp({
- el: '#app',
- config: globalConfig,
- routes,
- store,
- progress
-})
-
-/**
- * 如果没有主应用,即独立运行
- */
-if (!window.__POWERED_BY_MY_APPS__) {
- if (process.env.MY_MOCK === 'true') {
- require('@/mock/index')
- }
- microApp.mount()
-}
-
-
-/**
- * 子应用启动的钩子
- * @type {bootstrap}
- */
-export const bootstrap = microApp.bootstrap
-
-/**
- * 子应用挂载钩子
- */
-export const mount = microApp.mount
-
-/**
- * 子应用卸载钩子
- */
-export const unmount = microApp.unmount
-
-/**
- * 子应用更新
- */
-export const update = microApp.update
-
diff --git a/core/templates/app/router/routes.js b/core/templates/app/router/routes.js
deleted file mode 100644
index e308e3c975fc92da898435b19f6d70fddbefa942..0000000000000000000000000000000000000000
--- a/core/templates/app/router/routes.js
+++ /dev/null
@@ -1,4 +0,0 @@
-export default function ({get}) {
- return []
-}
-
diff --git a/core/templates/app/store/getters.js b/core/templates/app/store/getters.js
deleted file mode 100644
index 3a7f2207f97e33c26f955b8e417d308897f5083c..0000000000000000000000000000000000000000
--- a/core/templates/app/store/getters.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * 自定义store getters
- * @module store/getters
- *
- * @example 定义getter方式
- *
- * getterExample(state, getters) {
- * // do something...
- * return state.list.length // 必须要有返回值
- * }
- *
- */
-export default {}
diff --git a/core/templates/app/store/index.js b/core/templates/app/store/index.js
deleted file mode 100644
index e398ef3a05cbee7c21bfa99490abfa01522fd203..0000000000000000000000000000000000000000
--- a/core/templates/app/store/index.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * vuex store 初始化入口文件
- * @module store/index
- */
-
-import state from './state'
-import mutations from './mutations'
-import getters from './getters'
-import modules from '$my/code/modules'
-
-/**
- * Vuex.Store 实例
- */
-export default {
- strict: process.env.NODE_ENV !== 'production',
- /**
- * 自定义 state 在 [store/state]{@link module:store/state} 中定义
- * @type {Object}
- */
- state,
- /**
- * modules, 由代码生成器生成, import modules from '@/base/modules'
- * @type {Object}
- */
- modules,
- /**
- * 非代码生成器生成的mutations, 在 [store/mutations]{@link module:store/mutations} 中定义
- * @type {Object}
- */
- mutations,
- /**
- * 自定义的getters 在 [module:store/getters]{@link module:store/getters} 中定义
- * @type {Object}
- */
- getters
-}
diff --git a/core/templates/app/store/mutations.js b/core/templates/app/store/mutations.js
deleted file mode 100644
index 59cfa0688ba4dd6ba7f77412d0d80d8396c97264..0000000000000000000000000000000000000000
--- a/core/templates/app/store/mutations.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * 自定义Mutations
- * @module store/mutations
- *
- * @example 定义mutation方式
- *
- * methodName(state, payload) {
- * state.moduleName.model = payload
- * }
- *
- */
-export default {
-}
diff --git a/core/templates/app/store/state.js b/core/templates/app/store/state.js
deleted file mode 100644
index c626b0139237cef7e898333e988ce804070e0ac9..0000000000000000000000000000000000000000
--- a/core/templates/app/store/state.js
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * 自定义state
- * @module store/state
- *
- */
-export default {}
diff --git a/core/templates/app/views/_404.vue b/core/templates/app/views/_404.vue
deleted file mode 100644
index 098d34ae8d5fb258996b899508af1a95e77551de..0000000000000000000000000000000000000000
--- a/core/templates/app/views/_404.vue
+++ /dev/null
@@ -1,11 +0,0 @@
-
- 404
-
-
-
-
-
diff --git a/core/templates/app/views/index.vue b/core/templates/app/views/index.vue
deleted file mode 100644
index 5f5739a9cb19de4aaa658e5d0c277864a29f8d01..0000000000000000000000000000000000000000
--- a/core/templates/app/views/index.vue
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- app
-
-
-
-
-
-
diff --git a/core/templates/jsdoc/README.md b/core/templates/jsdoc/README.md
deleted file mode 100644
index 2bf476b7073d22212df7e04360495d7311951bfb..0000000000000000000000000000000000000000
--- a/core/templates/jsdoc/README.md
+++ /dev/null
@@ -1,147 +0,0 @@
-# Docdash
-[](https://travis-ci.org/clenemt/docdash) [](https://badge.fury.io/js/docdash) [](LICENSE.md)
-
-A clean, responsive documentation template theme for JSDoc 3.
-
-
-
-
-
-## Example
-See http://clenemt.github.io/docdash/ for a sample demo. :rocket:
-
-## Install
-
-```bash
-$ npm install docdash
-```
-
-## Usage
-Clone repository to your designated `jsdoc` template directory, then:
-
-```bash
-$ jsdoc entry-file.js -t path/to/docdash
-```
-
-## Usage (npm)
-In your projects `package.json` file add a new script:
-
-```json
-"script": {
- "generate-docs": "node_modules/.bin/jsdoc -c jsdoc.json"
-}
-```
-
-In your `jsdoc.json` file, add a template option.
-
-```json
-"opts": {
- "template": "node_modules/docdash"
-}
-```
-
-## Sample `jsdoc.json`
-See the config file for the [fixtures](fixtures/fixtures.conf.json) or the sample below.
-
-```json
-{
- "tags": {
- "allowUnknownTags": false
- },
- "source": {
- "include": "../js",
- "includePattern": ".js$",
- "excludePattern": "(node_modules/|docs)"
- },
- "plugins": [
- "plugins/markdown"
- ],
- "opts": {
- "template": "assets/template/docdash/",
- "encoding": "utf8",
- "destination": "docs/",
- "recurse": true,
- "verbose": true
- },
- "templates": {
- "cleverLinks": false,
- "monospaceLinks": false
- }
-}
-```
-
-## Options
-Docdash supports the following options:
-
-```
-{
- "docdash": {
- "static": [false|true], // Display the static members inside the navbar
- "sort": [false|true], // Sort the methods in the navbar
- "sectionOrder": [ // Order the main section in the navbar (default order shown here)
- "Classes",
- "Modules",
- "Externals",
- "Events",
- "Namespaces",
- "Mixins",
- "Tutorials",
- "Interfaces"
- ]
- "disqus": "", // Shortname for your disqus (subdomain during site creation)
- "openGraph": { // Open Graph options (mostly for Facebook and other sites to easily extract meta information)
- "title": "", // Title of the website
- "type": "website", // Type of the website
- "image": "", // Main image/logo
- "site_name": "", // Site name
- "url": "" // Main canonical URL for the main page of the site
- },
- "meta": { // Meta information options (mostly for search engines that have not indexed your site yet)
- "title": "", // Also will be used as postfix to actualy page title, prefixed with object/document name
- "description": "", // Description of overal contents of your website
- "keyword": "" // Keywords for search engines
- },
- "search": [false|true], // Display seach box above navigation which allows to search/filter navigation items
- "collapse": [false|true], // Collapse navigation by default except current object's navigation of the current page
- "wrap": [false|true], // Wrap long navigation names instead of trimming them
- "typedefs": [false|true], // Include typedefs in menu
- "navLevel": [integer], // depth level to show in navbar, starting at 0 (false or -1 to disable)
- "private": [false|true], // set to false to not show @private in navbar
- "removeQuotes": [none|all|trim],// Remove single and double quotes, trim removes only surrounding ones
- "scripts": [] // Array of external (or relative local copied using templates.default.staticFiles.include) js or css files to inject into HTML,
- "menu":{ // Adding additional menu items after Home
- "Project Website":{ // Menu item name
- "href":"https://myproject.com", //the rest of HTML properties to add to manu item
- "target":"_blank",
- "class":"menu-item",
- "id":"website_link"
- },
- "Forum":{
- "href":"https://myproject.com.forum",
- "target":"_blank",
- "class":"menu-item",
- "id":"forum_link"
- }
- }
- }
-}
-```
-
-Place them anywhere inside your `jsdoc.json` file.
-
-## Contributors
-
-[](https://sourcerer.io/fame/ar2rsawseen/clenemt/docdash/links/0)
-[](https://sourcerer.io/fame/ar2rsawseen/clenemt/docdash/links/1)
-[](https://sourcerer.io/fame/ar2rsawseen/clenemt/docdash/links/2)
-[](https://sourcerer.io/fame/ar2rsawseen/clenemt/docdash/links/3)
-[](https://sourcerer.io/fame/ar2rsawseen/clenemt/docdash/links/4)
-[](https://sourcerer.io/fame/ar2rsawseen/clenemt/docdash/links/5)
-[](https://sourcerer.io/fame/ar2rsawseen/clenemt/docdash/links/6)
-[](https://sourcerer.io/fame/ar2rsawseen/clenemt/docdash/links/7)
-
-## Thanks
-Thanks to [lodash](https://lodash.com) and [minami](https://github.com/nijikokun/minami).
-
-## License
-Licensed under the Apache License, version 2.0. (see [Apache-2.0](LICENSE.md)).
diff --git a/core/templates/jsdoc/package.json b/core/templates/jsdoc/package.json
deleted file mode 100644
index f1f89eda5892a57d2397909699006834e955e2a8..0000000000000000000000000000000000000000
--- a/core/templates/jsdoc/package.json
+++ /dev/null
@@ -1,64 +0,0 @@
-{
- "_from": "docdash",
- "_id": "docdash@1.1.1",
- "_inBundle": false,
- "_integrity": "sha512-WQkkr01zL6kcIfq9YCSXtqqevM6NYoTXLdl+Td0OYCEcX0RgsuEMeqHXQaXFt+p6Lo15RIgA5XhLAn7RL+erhA==",
- "_location": "/docdash",
- "_phantomChildren": {},
- "_requested": {
- "type": "tag",
- "registry": true,
- "raw": "docdash",
- "name": "docdash",
- "escapedName": "docdash",
- "rawSpec": "",
- "saveSpec": null,
- "fetchSpec": "latest"
- },
- "_requiredBy": [
- "#DEV:/",
- "#USER"
- ],
- "_resolved": "https://registry.npmjs.org/docdash/-/docdash-1.1.1.tgz",
- "_shasum": "89924e57938388fc3d1fa900927acfced7f3b24f",
- "_spec": "docdash",
- "_where": "/Users/kenny/@xdh/my",
- "author": {
- "name": "Clement Moron",
- "email": "clement.moron@gmail.com"
- },
- "bugs": {
- "url": "https://github.com/clenemt/docdash/issues"
- },
- "bundleDependencies": false,
- "deprecated": false,
- "description": "A clean, responsive documentation template theme for JSDoc 3 inspired by lodash and minami",
- "devDependencies": {
- "browser-sync": "latest",
- "jsdoc": "latest",
- "watch-run": "latest"
- },
- "files": [
- "publish.js",
- "static",
- "tmpl"
- ],
- "homepage": "https://github.com/clenemt/docdash#readme",
- "keywords": [
- "jsdoc",
- "template"
- ],
- "license": "Apache-2.0",
- "main": "publish.js",
- "name": "docdash",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/clenemt/docdash.git"
- },
- "scripts": {
- "sync": "browser-sync start -s ../fixtures-doc -f ../fixtures-doc --reload-delay 1000 --no-ui --no-notify",
- "test": "jsdoc -c fixtures/fixtures.conf.json",
- "watch": "watch-run -d 1000 -p tmpl/**,static/** \"npm run test\""
- },
- "version": "1.1.1"
-}
diff --git a/core/templates/jsdoc/publish.js b/core/templates/jsdoc/publish.js
deleted file mode 100644
index 74e721b86391b74fd4073930f1e9bd48af6d068e..0000000000000000000000000000000000000000
--- a/core/templates/jsdoc/publish.js
+++ /dev/null
@@ -1,775 +0,0 @@
-/*global env: true */
-'use strict';
-
-var doop = require('jsdoc/util/doop');
-var fs = require('jsdoc/fs');
-var helper = require('jsdoc/util/templateHelper');
-var logger = require('jsdoc/util/logger');
-var path = require('jsdoc/path');
-var taffy = require('taffydb').taffy;
-var template = require('jsdoc/template');
-var util = require('util');
-
-var htmlsafe = helper.htmlsafe;
-var linkto = helper.linkto;
-var resolveAuthorLinks = helper.resolveAuthorLinks;
-var scopeToPunc = helper.scopeToPunc;
-var hasOwnProp = Object.prototype.hasOwnProperty;
-
-var data;
-var view;
-
-var outdir = path.normalize(env.opts.destination);
-
-function copyFile(source, target, cb) {
- var cbCalled = false;
-
- var rd = fs.createReadStream(source);
- rd.on("error", function(err) {
- done(err);
- });
- var wr = fs.createWriteStream(target);
- wr.on("error", function(err) {
- done(err);
- });
- wr.on("close", function(ex) {
- done();
- });
- rd.pipe(wr);
-
- function done(err) {
- if (!cbCalled) {
- cb(err);
- cbCalled = true;
- }
- }
-}
-
-function find(spec) {
- return helper.find(data, spec);
-}
-
-function tutoriallink(tutorial) {
- return helper.toTutorial(tutorial, null, { tag: 'em', classname: 'disabled', prefix: 'Tutorial: ' });
-}
-
-function getAncestorLinks(doclet) {
- return helper.getAncestorLinks(data, doclet);
-}
-
-function hashToLink(doclet, hash) {
- if ( !/^(#.+)/.test(hash) ) { return hash; }
-
- var url = helper.createLink(doclet);
-
- url = url.replace(/(#.+|$)/, hash);
- return '' + hash + ' ';
-}
-
-function needsSignature(doclet) {
- var needsSig = false;
-
- // function and class definitions always get a signature
- if (doclet.kind === 'function' || doclet.kind === 'class' && !doclet.hideconstructor) {
- needsSig = true;
- }
- // typedefs that contain functions get a signature, too
- else if (doclet.kind === 'typedef' && doclet.type && doclet.type.names &&
- doclet.type.names.length) {
- for (var i = 0, l = doclet.type.names.length; i < l; i++) {
- if (doclet.type.names[i].toLowerCase() === 'function') {
- needsSig = true;
- break;
- }
- }
- }
- // and namespaces that are functions get a signature (but finding them is a
- // bit messy)
- else if (doclet.kind === 'namespace' && doclet.meta && doclet.meta.code &&
- doclet.meta.code.type && doclet.meta.code.type.match(/[Ff]unction/)) {
- needsSig = true;
- }
-
- return needsSig;
-}
-
-function getSignatureAttributes(item) {
- var attributes = [];
-
- if (item.optional) {
- attributes.push('opt');
- }
-
- if (item.nullable === true) {
- attributes.push('nullable');
- }
- else if (item.nullable === false) {
- attributes.push('non-null');
- }
-
- return attributes;
-}
-
-function updateItemName(item) {
- var attributes = getSignatureAttributes(item);
- var itemName = item.name || '';
-
- if (item.variable) {
- itemName = '…' + itemName;
- }
-
- if (attributes && attributes.length) {
- itemName = util.format( '%s%s ', itemName,
- attributes.join(', ') );
- }
-
- return itemName;
-}
-
-function addParamAttributes(params) {
- return params.filter(function(param) {
- return param.name && param.name.indexOf('.') === -1;
- }).map(updateItemName);
-}
-
-function buildItemTypeStrings(item) {
- var types = [];
-
- if (item && item.type && item.type.names) {
- item.type.names.forEach(function(name) {
- types.push( linkto(name, htmlsafe(name)) );
- });
- }
-
- return types;
-}
-
-function buildAttribsString(attribs) {
- var attribsString = '';
-
- if (attribs && attribs.length) {
- attribsString = htmlsafe( util.format('(%s) ', attribs.join(', ')) );
- }
-
- return attribsString;
-}
-
-function addNonParamAttributes(items) {
- var types = [];
-
- items.forEach(function(item) {
- types = types.concat( buildItemTypeStrings(item) );
- });
-
- return types;
-}
-
-function addSignatureParams(f) {
- var params = f.params ? addParamAttributes(f.params) : [];
- f.signature = util.format( '%s(%s)', (f.signature || ''), params.join(', ') );
-}
-
-function addSignatureReturns(f) {
- var attribs = [];
- var attribsString = '';
- var returnTypes = [];
- var returnTypesString = '';
- var source = f.yields || f.returns;
-
- // jam all the return-type attributes into an array. this could create odd results (for example,
- // if there are both nullable and non-nullable return types), but let's assume that most people
- // who use multiple @return tags aren't using Closure Compiler type annotations, and vice-versa.
- if (source) {
- source.forEach(function(item) {
- helper.getAttribs(item).forEach(function(attrib) {
- if (attribs.indexOf(attrib) === -1) {
- attribs.push(attrib);
- }
- });
- });
-
- attribsString = buildAttribsString(attribs);
- }
-
- if (source) {
- returnTypes = addNonParamAttributes(source);
- }
- if (returnTypes.length) {
- returnTypesString = util.format( ' → %s{%s}', attribsString, returnTypes.join('|') );
- }
-
- f.signature = '' + (f.signature || '') + ' ' +
- '' + returnTypesString + ' ';
-}
-
-function addSignatureTypes(f) {
- var types = f.type ? buildItemTypeStrings(f) : [];
-
- f.signature = (f.signature || '') + '' +
- (types.length ? ' :' + types.join('|') : '') + ' ';
-}
-
-function addAttribs(f) {
- var attribs = helper.getAttribs(f);
- var attribsString = buildAttribsString(attribs);
-
- f.attribs = util.format('%s ', attribsString);
-}
-
-function shortenPaths(files, commonPrefix) {
- Object.keys(files).forEach(function(file) {
- files[file].shortened = files[file].resolved.replace(commonPrefix, '')
- // always use forward slashes
- .replace(/\\/g, '/');
- });
-
- return files;
-}
-
-function getPathFromDoclet(doclet) {
- if (!doclet.meta) {
- return null;
- }
-
- return doclet.meta.path && doclet.meta.path !== 'null' ?
- path.join(doclet.meta.path, doclet.meta.filename) :
- doclet.meta.filename;
-}
-
-function generate(type, title, docs, filename, resolveLinks) {
- resolveLinks = resolveLinks === false ? false : true;
-
- var docData = {
- type: type,
- title: title,
- docs: docs
- };
-
- var outpath = path.join(outdir, filename),
- html = view.render('container.tmpl', docData);
-
- if (resolveLinks) {
- html = helper.resolveLinks(html); // turn {@link foo} into foo
- }
-
- fs.writeFileSync(outpath, html, 'utf8');
-}
-
-function generateSourceFiles(sourceFiles, encoding) {
- encoding = encoding || 'utf8';
- Object.keys(sourceFiles).forEach(function(file) {
- var source;
- // links are keyed to the shortened path in each doclet's `meta.shortpath` property
- var sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened);
- helper.registerLink(sourceFiles[file].shortened, sourceOutfile);
-
- try {
- source = {
- kind: 'source',
- code: helper.htmlsafe( fs.readFileSync(sourceFiles[file].resolved, encoding) )
- };
- }
- catch(e) {
- logger.error('Error while generating source file %s: %s', file, e.message);
- }
-
- generate('Source', sourceFiles[file].shortened, [source], sourceOutfile, false);
- });
-}
-
-/**
- * Look for classes or functions with the same name as modules (which indicates that the module
- * exports only that class or function), then attach the classes or functions to the `module`
- * property of the appropriate module doclets. The name of each class or function is also updated
- * for display purposes. This function mutates the original arrays.
- *
- * @private
- * @param {Array.} doclets - The array of classes and functions to
- * check.
- * @param {Array.} modules - The array of module doclets to search.
- */
-function attachModuleSymbols(doclets, modules) {
- var symbols = {};
-
- // build a lookup table
- doclets.forEach(function(symbol) {
- symbols[symbol.longname] = symbols[symbol.longname] || [];
- symbols[symbol.longname].push(symbol);
- });
-
- return modules.map(function(module) {
- if (symbols[module.longname]) {
- module.modules = symbols[module.longname]
- // Only show symbols that have a description. Make an exception for classes, because
- // we want to show the constructor-signature heading no matter what.
- .filter(function(symbol) {
- return symbol.description || symbol.kind === 'class';
- })
- .map(function(symbol) {
- symbol = doop(symbol);
-
- if (symbol.kind === 'class' || symbol.kind === 'function' && !symbol.hideconstructor) {
- symbol.name = symbol.name.replace('module:', '(require("') + '"))';
- }
-
- return symbol;
- });
- }
- });
-}
-
-function buildMemberNav(items, itemHeading, itemsSeen, linktoFn) {
- var nav = '';
-
- if (items && items.length) {
- var itemsNav = '';
- var docdash = env && env.conf && env.conf.docdash || {};
- var level = typeof docdash.navLevel === 'number' && docdash.navLevel >= 0 ?
- docdash.navLevel :
- Infinity;
-
- items.forEach(function(item) {
- var displayName;
- var methods = find({kind:'function', memberof: item.longname});
- var members = find({kind:'member', memberof: item.longname});
- var conf = env && env.conf || {};
- var classes = '';
-
- // show private class?
- if (docdash.private === false && item.access === 'private') return;
-
- // depth to show?
- if (item.ancestors && item.ancestors.length > level) {
- classes += 'level-hide';
- }
-
- classes = classes ? ' class="'+ classes + '"' : '';
- itemsNav += '';
- if ( !hasOwnProp.call(item, 'longname') ) {
- itemsNav += linktoFn('', item.name);
- } else if ( !hasOwnProp.call(itemsSeen, item.longname) ) {
- if (conf.templates.default.useLongnameInNav) {
- displayName = item.longname;
- } else {
- displayName = item.name;
- }
- itemsNav += linktoFn(item.longname, displayName.replace(/\b(module|event):/g, ''));
-
- if (docdash.static && members.find(function (m) { return m.scope === 'static'; } )) {
- itemsNav += "";
-
- members.forEach(function (member) {
- if (!member.scope === 'static') return;
- itemsNav += "";
- itemsNav += linkto(member.longname, member.name);
- itemsNav += " ";
- });
-
- itemsNav += " ";
- }
-
- if (methods.length) {
- itemsNav += "";
-
- methods.forEach(function (method) {
- itemsNav += "";
- itemsNav += linkto(method.longname, method.name);
- itemsNav += " ";
- });
-
- itemsNav += " ";
- }
-
- itemsSeen[item.longname] = true;
- }
- itemsNav += ' ';
- });
-
- if (itemsNav !== '') {
- nav += '' + itemHeading + ' ';
- }
- }
-
- return nav;
-}
-
-function linktoTutorial(longName, name) {
- return tutoriallink(name);
-}
-
-function linktoExternal(longName, name) {
- return linkto(longName, name.replace(/(^"|"$)/g, ''));
-}
-
-/**
- * Create the navigation sidebar.
- * @param {object} members The members that will be used to create the sidebar.
- * @param {array} members.classes
- * @param {array} members.externals
- * @param {array} members.globals
- * @param {array} members.mixins
- * @param {array} members.modules
- * @param {array} members.namespaces
- * @param {array} members.tutorials
- * @param {array} members.events
- * @param {array} members.interfaces
- * @return {string} The HTML for the navigation sidebar.
- */
-
-function buildNav(members) {
- var nav = '';
- var seen = {};
- var seenTutorials = {};
- var docdash = env && env.conf && env.conf.docdash || {};
- if(docdash.menu){
- for(var menu in docdash.menu){
- nav += '';
- }
- }
- var defaultOrder = [
- 'Classes', 'Modules', 'Externals', 'Events', 'Namespaces', 'Mixins', 'Tutorials', 'Interfaces'
- ];
- var order = docdash.sectionOrder || defaultOrder;
- var sections = {
- Classes: buildMemberNav(members.classes, 'Classes', seen, linkto),
- Modules: buildMemberNav(members.modules, 'Modules', {}, linkto),
- Externals: buildMemberNav(members.externals, 'Externals', seen, linktoExternal),
- Events: buildMemberNav(members.events, 'Events', seen, linkto),
- Namespaces: buildMemberNav(members.namespaces, 'Namespaces', seen, linkto),
- Mixins: buildMemberNav(members.mixins, 'Mixins', seen, linkto),
- Tutorials: buildMemberNav(members.tutorials, 'Tutorials', seenTutorials, linktoTutorial),
- Interfaces: buildMemberNav(members.interfaces, 'Interfaces', seen, linkto),
- };
- order.forEach(member => nav += sections[member]);
-
- if (members.globals.length) {
- var globalNav = '';
-
- members.globals.forEach(function(g) {
- if ( (docdash.typedefs || g.kind !== 'typedef') && !hasOwnProp.call(seen, g.longname) ) {
- globalNav += '' + linkto(g.longname, g.name) + ' ';
- }
- seen[g.longname] = true;
- });
-
- if (!globalNav) {
- // turn the heading into a link so you can actually get to the global page
- nav += '' + linkto('global', 'Global') + ' ';
- }
- else {
- nav += 'Global ';
- }
- }
-
- return nav;
-}
-
-/**
- @param {TAFFY} taffyData See .
- @param {object} opts
- @param {Tutorial} tutorials
- */
-exports.publish = function(taffyData, opts, tutorials) {
- var docdash = env && env.conf && env.conf.docdash || {};
- data = taffyData;
-
- var conf = env.conf.templates || {};
- conf.default = conf.default || {};
-
- var templatePath = path.normalize(opts.template);
- view = new template.Template( path.join(templatePath, 'tmpl') );
-
- // claim some special filenames in advance, so the All-Powerful Overseer of Filename Uniqueness
- // doesn't try to hand them out later
- var indexUrl = helper.getUniqueFilename('index');
- // don't call registerLink() on this one! 'index' is also a valid longname
-
- var globalUrl = helper.getUniqueFilename('global');
- helper.registerLink('global', globalUrl);
-
- // set up templating
- view.layout = conf.default.layoutFile ?
- path.getResourcePath(path.dirname(conf.default.layoutFile),
- path.basename(conf.default.layoutFile) ) :
- 'layout.tmpl';
-
- // set up tutorials for helper
- helper.setTutorials(tutorials);
-
- data = helper.prune(data);
-
- docdash.sort !== false && data.sort('longname, version, since');
- helper.addEventListeners(data);
-
- var sourceFiles = {};
- var sourceFilePaths = [];
- data().each(function(doclet) {
- if(docdash.removeQuotes){
- if(docdash.removeQuotes === "all"){
- if(doclet.name){
- doclet.name = doclet.name.replace(/"/g, '');
- doclet.name = doclet.name.replace(/'/g, '');
- }
- if(doclet.longname){
- doclet.longname = doclet.longname.replace(/"/g, '');
- doclet.longname = doclet.longname.replace(/'/g, '');
- }
- }
- else if(docdash.removeQuotes === "trim"){
- if(doclet.name){
- doclet.name = doclet.name.replace(/^"(.*)"$/, '$1');
- doclet.name = doclet.name.replace(/^'(.*)'$/, '$1');
- }
- if(doclet.longname){
- doclet.longname = doclet.longname.replace(/^"(.*)"$/, '$1');
- doclet.longname = doclet.longname.replace(/^'(.*)'$/, '$1');
- }
- }
- }
- doclet.attribs = '';
-
- if (doclet.examples) {
- doclet.examples = doclet.examples.map(function(example) {
- var caption, code;
-
- if (example && example.match(/^\s*([\s\S]+?)<\/caption>(\s*[\n\r])([\s\S]+)$/i)) {
- caption = RegExp.$1;
- code = RegExp.$3;
- }
-
- return {
- caption: caption || '',
- code: code || example || ''
- };
- });
- }
- if (doclet.see) {
- doclet.see.forEach(function(seeItem, i) {
- doclet.see[i] = hashToLink(doclet, seeItem);
- });
- }
-
- // build a list of source files
- var sourcePath;
- if (doclet.meta) {
- sourcePath = getPathFromDoclet(doclet);
- sourceFiles[sourcePath] = {
- resolved: sourcePath,
- shortened: null
- };
- if (sourceFilePaths.indexOf(sourcePath) === -1) {
- sourceFilePaths.push(sourcePath);
- }
- }
- });
-
- // update outdir if necessary, then create outdir
- var packageInfo = ( find({kind: 'package'}) || [] ) [0];
- if (packageInfo && packageInfo.name) {
- outdir = path.join( outdir, packageInfo.name, (packageInfo.version || '') );
- }
- fs.mkPath(outdir);
-
- // copy the template's static files to outdir
- var fromDir = path.join(templatePath, 'static');
- var staticFiles = fs.ls(fromDir, 3);
-
- staticFiles.forEach(function(fileName) {
- var toDir = fs.toDir( fileName.replace(fromDir, outdir) );
- fs.mkPath(toDir);
- copyFile(fileName, path.join(toDir, path.basename(fileName)), function(err){if(err) console.err(err);});
- });
-
- // copy user-specified static files to outdir
- var staticFilePaths;
- var staticFileFilter;
- var staticFileScanner;
- if (conf.default.staticFiles) {
- // The canonical property name is `include`. We accept `paths` for backwards compatibility
- // with a bug in JSDoc 3.2.x.
- staticFilePaths = conf.default.staticFiles.include ||
- conf.default.staticFiles.paths ||
- [];
- staticFileFilter = new (require('jsdoc/src/filter')).Filter(conf.default.staticFiles);
- staticFileScanner = new (require('jsdoc/src/scanner')).Scanner();
-
- staticFilePaths.forEach(function(filePath) {
- var extraStaticFiles = staticFileScanner.scan([filePath], 10, staticFileFilter);
-
- extraStaticFiles.forEach(function(fileName) {
- var sourcePath = fs.toDir(filePath);
- var toDir = fs.toDir( fileName.replace(sourcePath, outdir) );
- fs.mkPath(toDir);
- copyFile(fileName, path.join(toDir, path.basename(fileName)), function(err){if(err) console.err(err);});
- });
- });
- }
-
- if (sourceFilePaths.length) {
- sourceFiles = shortenPaths( sourceFiles, path.commonPrefix(sourceFilePaths) );
- }
- data().each(function(doclet) {
- var url = helper.createLink(doclet);
- helper.registerLink(doclet.longname, url);
-
- // add a shortened version of the full path
- var docletPath;
- if (doclet.meta) {
- docletPath = getPathFromDoclet(doclet);
- docletPath = sourceFiles[docletPath].shortened;
- if (docletPath) {
- doclet.meta.shortpath = docletPath;
- }
- }
- });
-
- data().each(function(doclet) {
- var url = helper.longnameToUrl[doclet.longname];
-
- if (url.indexOf('#') > -1) {
- doclet.id = helper.longnameToUrl[doclet.longname].split(/#/).pop();
- }
- else {
- doclet.id = doclet.name;
- }
-
- if ( needsSignature(doclet) ) {
- addSignatureParams(doclet);
- addSignatureReturns(doclet);
- addAttribs(doclet);
- }
- });
-
- // do this after the urls have all been generated
- data().each(function(doclet) {
- doclet.ancestors = getAncestorLinks(doclet);
-
- if (doclet.kind === 'member') {
- addSignatureTypes(doclet);
- addAttribs(doclet);
- }
-
- if (doclet.kind === 'constant') {
- addSignatureTypes(doclet);
- addAttribs(doclet);
- doclet.kind = 'member';
- }
- });
-
- var members = helper.getMembers(data);
- members.tutorials = tutorials.children;
-
- // output pretty-printed source files by default
- var outputSourceFiles = conf.default && conf.default.outputSourceFiles !== false
- ? true
- : false;
-
- // add template helpers
- view.find = find;
- view.linkto = linkto;
- view.resolveAuthorLinks = resolveAuthorLinks;
- view.tutoriallink = tutoriallink;
- view.htmlsafe = htmlsafe;
- view.outputSourceFiles = outputSourceFiles;
-
- // once for all
- view.nav = buildNav(members);
- attachModuleSymbols( find({ longname: {left: 'module:'} }), members.modules );
-
- // generate the pretty-printed source files first so other pages can link to them
- if (outputSourceFiles) {
- generateSourceFiles(sourceFiles, opts.encoding);
- }
-
- if (members.globals.length) {
- generate('', 'Global', [{kind: 'globalobj'}], globalUrl);
- }
-
- // index page displays information from package.json and lists files
- var files = find({kind: 'file'});
- var packages = find({kind: 'package'});
-
- generate('', 'Home',
- packages.concat(
- [{kind: 'mainpage', readme: opts.readme, longname: (opts.mainpagetitle) ? opts.mainpagetitle : 'Main Page'}]
- ).concat(files),
- indexUrl);
-
- // set up the lists that we'll use to generate pages
- var classes = taffy(members.classes);
- var modules = taffy(members.modules);
- var namespaces = taffy(members.namespaces);
- var mixins = taffy(members.mixins);
- var externals = taffy(members.externals);
- var interfaces = taffy(members.interfaces);
-
- Object.keys(helper.longnameToUrl).forEach(function(longname) {
- var myModules = helper.find(modules, {longname: longname});
- if (myModules.length) {
- generate('Module', myModules[0].name, myModules, helper.longnameToUrl[longname]);
- }
-
- var myClasses = helper.find(classes, {longname: longname});
- if (myClasses.length) {
- generate('Class', myClasses[0].name, myClasses, helper.longnameToUrl[longname]);
- }
-
- var myNamespaces = helper.find(namespaces, {longname: longname});
- if (myNamespaces.length) {
- generate('Namespace', myNamespaces[0].name, myNamespaces, helper.longnameToUrl[longname]);
- }
-
- var myMixins = helper.find(mixins, {longname: longname});
- if (myMixins.length) {
- generate('Mixin', myMixins[0].name, myMixins, helper.longnameToUrl[longname]);
- }
-
- var myExternals = helper.find(externals, {longname: longname});
- if (myExternals.length) {
- generate('External', myExternals[0].name, myExternals, helper.longnameToUrl[longname]);
- }
-
- var myInterfaces = helper.find(interfaces, {longname: longname});
- if (myInterfaces.length) {
- generate('Interface', myInterfaces[0].name, myInterfaces, helper.longnameToUrl[longname]);
- }
- });
-
- // TODO: move the tutorial functions to templateHelper.js
- function generateTutorial(title, tutorial, filename) {
- var tutorialData = {
- title: title,
- header: tutorial.title,
- content: tutorial.parse(),
- children: tutorial.children
- };
-
- var tutorialPath = path.join(outdir, filename);
- var html = view.render('tutorial.tmpl', tutorialData);
-
- // yes, you can use {@link} in tutorials too!
- html = helper.resolveLinks(html); // turn {@link foo} into foo
- fs.writeFileSync(tutorialPath, html, 'utf8');
- }
-
- // tutorials can have only one parent so there is no risk for loops
- function saveChildren(node) {
- node.children.forEach(function(child) {
- generateTutorial('Tutorial: ' + child.title, child, helper.tutorialToUrl(child.name));
- saveChildren(child);
- });
- }
-
- saveChildren(tutorials);
-};
diff --git a/core/templates/jsdoc/static/scripts/collapse.js b/core/templates/jsdoc/static/scripts/collapse.js
deleted file mode 100644
index 327039fb34d889655a658a740961be8f14c97e85..0000000000000000000000000000000000000000
--- a/core/templates/jsdoc/static/scripts/collapse.js
+++ /dev/null
@@ -1,20 +0,0 @@
-function hideAllButCurrent(){
- //by default all submenut items are hidden
- //but we need to rehide them for search
- document.querySelectorAll("nav > ul > li > ul li").forEach(function(parent) {
- parent.style.display = "none";
- });
-
- //only current page (if it exists) should be opened
- var file = window.location.pathname.split("/").pop().replace(/\.html/, '');
- document.querySelectorAll("nav > ul > li > a").forEach(function(parent) {
- var href = parent.attributes.href.value.replace(/\.html/, '');
- if (file === href) {
- parent.parentNode.querySelectorAll("ul li").forEach(function(elem) {
- elem.style.display = "block";
- });
- }
- });
-}
-
-hideAllButCurrent();
\ No newline at end of file
diff --git a/core/templates/jsdoc/static/scripts/linenumber.js b/core/templates/jsdoc/static/scripts/linenumber.js
deleted file mode 100644
index 8d52f7eafdb166eeba1de2f1a223fcde9ffbe4fe..0000000000000000000000000000000000000000
--- a/core/templates/jsdoc/static/scripts/linenumber.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/*global document */
-(function() {
- var source = document.getElementsByClassName('prettyprint source linenums');
- var i = 0;
- var lineNumber = 0;
- var lineId;
- var lines;
- var totalLines;
- var anchorHash;
-
- if (source && source[0]) {
- anchorHash = document.location.hash.substring(1);
- lines = source[0].getElementsByTagName('li');
- totalLines = lines.length;
-
- for (; i < totalLines; i++) {
- lineNumber++;
- lineId = 'line' + lineNumber;
- lines[i].id = lineId;
- if (lineId === anchorHash) {
- lines[i].className += ' selected';
- }
- }
- }
-})();
diff --git a/core/templates/jsdoc/static/scripts/nav.js b/core/templates/jsdoc/static/scripts/nav.js
deleted file mode 100644
index 6dd83134296e0c55fa21101fd058b8dea73fcffb..0000000000000000000000000000000000000000
--- a/core/templates/jsdoc/static/scripts/nav.js
+++ /dev/null
@@ -1,12 +0,0 @@
-function scrollToNavItem() {
- var path = window.location.href.split('/').pop().replace(/\.html/, '');
- document.querySelectorAll('nav a').forEach(function(link) {
- var href = link.attributes.href.value.replace(/\.html/, '');
- if (path === href) {
- link.scrollIntoView({block: 'center'});
- return;
- }
- })
- }
-
- scrollToNavItem();
diff --git a/core/templates/jsdoc/static/scripts/polyfill.js b/core/templates/jsdoc/static/scripts/polyfill.js
deleted file mode 100644
index 44b4c92dcdee486f3ad1ba378b74d97949382ccf..0000000000000000000000000000000000000000
--- a/core/templates/jsdoc/static/scripts/polyfill.js
+++ /dev/null
@@ -1,4 +0,0 @@
-//IE Fix, src: https://www.reddit.com/r/programminghorror/comments/6abmcr/nodelist_lacks_foreach_in_internet_explorer/
-if (typeof(NodeList.prototype.forEach)!==typeof(alert)){
- NodeList.prototype.forEach=Array.prototype.forEach;
-}
\ No newline at end of file
diff --git a/core/templates/jsdoc/static/scripts/prettify/Apache-License-2.0.txt b/core/templates/jsdoc/static/scripts/prettify/Apache-License-2.0.txt
deleted file mode 100644
index d645695673349e3947e8e5ae42332d0ac3164cd7..0000000000000000000000000000000000000000
--- a/core/templates/jsdoc/static/scripts/prettify/Apache-License-2.0.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/core/templates/jsdoc/static/scripts/prettify/lang-css.js b/core/templates/jsdoc/static/scripts/prettify/lang-css.js
deleted file mode 100644
index 041e1f59067977554f29146ed51c13bcf509f0af..0000000000000000000000000000000000000000
--- a/core/templates/jsdoc/static/scripts/prettify/lang-css.js
+++ /dev/null
@@ -1,2 +0,0 @@
-PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n"]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com",
-/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]);
diff --git a/core/templates/jsdoc/static/scripts/prettify/prettify.js b/core/templates/jsdoc/static/scripts/prettify/prettify.js
deleted file mode 100644
index eef5ad7e6a07676b3919146d583d1c190bf1e163..0000000000000000000000000000000000000000
--- a/core/templates/jsdoc/static/scripts/prettify/prettify.js
+++ /dev/null
@@ -1,28 +0,0 @@
-var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
-(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
-[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
-l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
-q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
-q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
-"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
-a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
-for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
-"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
-H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
-J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
-I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]+/],["dec",/^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-class="wrap">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Please enable JavaScript to view the comments powered by Disqus.
-
-
-
-
-
-
- Documentation generated by JSDoc on using the docdash theme.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-