@pisell/build-plugin-lowcode 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
+ <excludeFolder url="file://$MODULE_DIR$/temp" />
7
+ <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
+ </content>
9
+ <orderEntry type="inheritedJdk" />
10
+ <orderEntry type="sourceFolder" forTests="false" />
11
+ </component>
12
+ </module>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/build-plugin-lowcode.iml" filepath="$PROJECT_DIR$/.idea/build-plugin-lowcode.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
package/README.md ADDED
@@ -0,0 +1,31 @@
1
+ ## 概述
2
+
3
+ ## 使用文档
4
+
5
+ ```
6
+ export interface LowcodeOptions {
7
+ builtinAssets?: Array<string|Assets>; // 会作为内置资产保存到构建产物中
8
+ extraAssets?: Array<string|Assets>; // 只在调试环境加载到资产包中
9
+ noParse?: boolean; // 关闭自动解析生成 lowcode meta
10
+ categories?: string[]; // 组件在组件面板中的分类
11
+ groups?: string[]; // 组件在组件面板中的 tab 分组
12
+ baseLibrary?: 'react'|'rax';
13
+ setterMap?: SetterMap; // 注入 setter
14
+ }
15
+
16
+ export interface SetterMap {
17
+ [SetterName: string]: string;
18
+ }
19
+
20
+ ```
21
+ ## 开发调试
22
+ ### 组件开发
23
+
24
+ `demo/component` 目录下是测试组件的项目,改项目引用了 build-plugin-lowcode ,相关配置在 `demo/component/build.lowcode.js` 中;
25
+
26
+ 可以修改 build-plugin-lowcode 的代码、修改 demo/component/build.lowcode.js 的配置进行调试;
27
+
28
+ ```
29
+ 在 build-plugin-lowcode 根目录下执行启动调试环境
30
+ npm run component:dev
31
+ ```
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@pisell/build-plugin-lowcode",
3
+ "version": "1.0.0",
4
+ "description": "build plugin for component-to-lowcode",
5
+ "main": "src/index.js",
6
+ "keywords": [
7
+ "plugin"
8
+ ],
9
+ "scripts": {
10
+ "component:dev": "cd demo/component && npm start",
11
+ "setter:dev": "cd demo/setter && npm start",
12
+ "antdSetterMap:dev": "cd demo/antd-setter-map && npm start"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/alibaba/lowcode-tools.git",
17
+ "directory": "packages/build-plugin-lowcode"
18
+ },
19
+ "author": "",
20
+ "license": "MIT",
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "dependencies": {
25
+ "@alilc/lowcode-material-parser": "^1.0.1",
26
+ "@alilc/lowcode-rax-renderer": "^1.0.2",
27
+ "@alilc/lowcode-react-renderer": "^1.0.1",
28
+ "@alilc/lowcode-types": "^1.0.1",
29
+ "@alilc/lowcode-utils": "^1.0.1",
30
+ "axios": "^0.21.4",
31
+ "build-scripts-config": "^3.0.3",
32
+ "chokidar": "^3.5.3",
33
+ "cross-spawn-promise": "^0.10.2",
34
+ "driver-universal": "^3.4.0",
35
+ "glob": "^7.1.7",
36
+ "handlebars": "^4.4.0",
37
+ "html-webpack-plugin": "^3.2.0",
38
+ "is-wsl": "^2.2.0",
39
+ "lodash": "^4.17.21",
40
+ "rpx-loader": "^1.0.1",
41
+ "style-loader": "^2.0.0",
42
+ "webpack": "^4.46.0"
43
+ }
44
+ }
@@ -0,0 +1,71 @@
1
+ const path = require('path');
2
+
3
+ module.exports = [
4
+ {
5
+ name: 'alias',
6
+ validation: 'object',
7
+ configWebpack: (config, alias, context) => {
8
+ const { rootDir } = context;
9
+ const aliasWithRoot = {};
10
+ Object.keys(alias).forEach((key) => {
11
+ if (path.isAbsolute(alias[key])) {
12
+ aliasWithRoot[key] = alias[key];
13
+ } else {
14
+ aliasWithRoot[key] = path.resolve(rootDir, alias[key]);
15
+ }
16
+ });
17
+ config.merge({
18
+ resolve: {
19
+ alias: aliasWithRoot,
20
+ },
21
+ });
22
+ },
23
+ },
24
+ {
25
+ name: 'library',
26
+ validation: 'string',
27
+ },
28
+ {
29
+ name: 'libraryExport',
30
+ validation: 'string',
31
+ },
32
+ {
33
+ name: 'libraryTarget',
34
+ validation: 'string',
35
+ },
36
+ {
37
+ name: 'filename',
38
+ validation: 'string',
39
+ },
40
+ {
41
+ name: 'sourceMap',
42
+ validation: 'boolean',
43
+ },
44
+ {
45
+ name: 'minify',
46
+ validation: 'boolean',
47
+ },
48
+ {
49
+ name: 'type',
50
+ validation: 'string',
51
+ },
52
+ {
53
+ name: 'devServer',
54
+ validation: 'object',
55
+ defaultValue: {
56
+ logLevel: 'silent',
57
+ compress: true,
58
+ disableHostCheck: true,
59
+ clientLogLevel: 'error',
60
+ hot: true,
61
+ quiet: true,
62
+ overlay: false,
63
+ },
64
+ configWebpack: (config, devServer, context) => {
65
+ const { command } = context;
66
+ if (command === 'start' && devServer) {
67
+ config.merge({ devServer });
68
+ }
69
+ },
70
+ },
71
+ ];
@@ -0,0 +1,135 @@
1
+ const SUPPORTED_COMMAND = ['start', 'build'];
2
+
3
+ const COMMON_EXTERNALS = {
4
+ react: 'var window.React',
5
+ 'react-dom': 'var window.ReactDOM',
6
+ 'prop-types': 'var window.PropTypes',
7
+ '@alifd/next': 'var window.Next',
8
+ '@alifd/meet': 'var window.Meet',
9
+ '@ali/visualengine': 'var window.VisualEngine',
10
+ '@ali/visualengine-utils': 'var window.VisualEngineUtils',
11
+ '@ali/lowcode-engine': 'var window.AliLowCodeEngine',
12
+ '@alilc/lowcode-engine': 'var window.AliLowCodeEngine',
13
+ '@ali/lowcode-rax-renderer': 'var window.alilcLowcodeRaxRenderer',
14
+ rax: 'var window.Rax',
15
+ antd: 'var window.antd',
16
+ '@alifd/lowcode-preset-plugin': 'var window.PluginLowcodeEditor',
17
+ 'monaco-editor/esm/vs/editor/editor.api': 'var window.monaco',
18
+ 'monaco-editor/esm/vs/editor/editor.main.js': 'var window.monaco',
19
+ };
20
+
21
+ const ALILC_COMMON_EXTERNALS = {
22
+ ...COMMON_EXTERNALS,
23
+ '@alifd/lowcode-preset-plugin': 'var window.LowcodePresetPlugin',
24
+ };
25
+
26
+ const DEFAULT_GROUPS = ['精选组件', '原子组件'];
27
+ const DEFAULT_CATEGORIES = [
28
+ '基础元素',
29
+ '布局容器类',
30
+ '表格类',
31
+ '表单详情类',
32
+ '帮助类',
33
+ '对话框类',
34
+ '业务类',
35
+ '通用',
36
+ '引导',
37
+ '信息输入',
38
+ '信息展示',
39
+ '信息反馈',
40
+ ];
41
+
42
+ const STATIC_RESOURCES = {
43
+ themeVariableUrl: 'https://alifd.alicdn.com/npm/@alifd/theme-lowcode-dark@0.6.1/variables.css',
44
+ themeStyleUrl:
45
+ 'https://alifd.alicdn.com/npm/@alifd/theme-lowcode-dark@0.6.1/dist/next.var.min.css',
46
+ engineCoreCssUrl:
47
+ 'https://dev.g.alicdn.com/ali-lowcode/ali-lowcode-engine/0.16.6/engine-core.css',
48
+ enginePresetCssUrl:
49
+ 'https://alifd.alicdn.com/npm/@alifd/lowcode-preset-plugin@1.1.8/dist/editor-preset-plugin.css',
50
+ engineExtCssUrl: 'https://g.alicdn.com/ali-lowcode/lowcode-engine-ext/1.0.20/engine-ext.css',
51
+ engineCoreJsUrl: 'https://dev.g.alicdn.com/ali-lowcode/ali-lowcode-engine/0.16.6/engine-core.js',
52
+ engineExtJsUrl: 'https://g.alicdn.com/ali-lowcode/lowcode-engine-ext/1.0.20/engine-ext.js',
53
+ enginePresetJsUrl:
54
+ 'https://alifd.alicdn.com/npm/@alifd/lowcode-preset-plugin@1.1.8/dist/editor-preset-plugin.js',
55
+ raxRenderJsUrl: 'https://alifd.alicdn.com/npm/@alilc/lowcode-rax-renderer@1.0.18/dist/index.umd.js',
56
+ raxRenderCssUrl: 'https://alifd.alicdn.com/npm/@alilc/lowcode-rax-renderer@1.0.18/dist/index.css',
57
+ };
58
+
59
+ const ALILC_STATIC_RESOURCES = {
60
+ themeVariableUrl: 'https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css',
61
+ themeStyleUrl:
62
+ 'https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css',
63
+ engineCoreCssUrl:
64
+ 'https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.7-beta.11/dist/css/engine-core.css',
65
+ engineExtCssUrl:
66
+ 'https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6-beta.25/dist/css/engine-ext.css',
67
+ enginePresetCssUrl:
68
+ 'https://alifd.alicdn.com/npm/@alilc/lowcode-preset-plugin@0.1.2/dist/lowcode-preset-plugin.css',
69
+ engineCoreJsUrl:
70
+ 'https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.7-beta.11/dist/js/engine-core.js',
71
+ engineExtJsUrl:
72
+ 'https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6-beta.25/dist/js/engine-ext.js',
73
+ enginePresetJsUrl:
74
+ 'https://alifd.alicdn.com/npm/@alilc/lowcode-preset-plugin@0.1.2/dist/lowcode-preset-plugin.js',
75
+ raxRenderJsUrl: 'https://alifd.alicdn.com/npm/@alilc/lowcode-rax-renderer@1.0.18/dist/index.umd.js',
76
+ raxRenderCssUrl: 'https://alifd.alicdn.com/npm/@alilc/lowcode-rax-renderer@1.0.18/dist/index.css',
77
+ };
78
+
79
+ const STATIC_RESOURCES_MAP = {
80
+ '@ali': STATIC_RESOURCES,
81
+ '@alilc': ALILC_STATIC_RESOURCES,
82
+ };
83
+
84
+ const COMMON_EXTERNALS_MAP = {
85
+ '@ali': COMMON_EXTERNALS,
86
+ '@alilc': ALILC_COMMON_EXTERNALS,
87
+ };
88
+
89
+ const BASIC_LIBRARY_VERSION = {
90
+ '@alifd/next': '1.25.23',
91
+ '@alifd/meet': '2.6.3',
92
+ antd: '4.17.3',
93
+ };
94
+ const COMPONENT_PROPS = [
95
+ 'componentName',
96
+ 'title',
97
+ 'description',
98
+ 'docUrl',
99
+ 'screenshot',
100
+ 'icon',
101
+ 'tags',
102
+ 'keywards',
103
+ 'devMode',
104
+ 'npm',
105
+
106
+ 'props',
107
+ 'configure',
108
+ 'snippets',
109
+ 'group',
110
+ 'category',
111
+ 'priority',
112
+ ];
113
+
114
+ const UNPKG_BASE_URL_MAP = {
115
+ '@ali': 'https://unpkg.alibaba-inc.com',
116
+ '@alilc': 'https://unpkg.com',
117
+ };
118
+
119
+ const META_TYPES = ['', 'dev', 'web', 'mobile', 'design', 'sketch'];
120
+
121
+ module.exports = {
122
+ SUPPORTED_COMMAND,
123
+ COMMON_EXTERNALS,
124
+ ALILC_COMMON_EXTERNALS,
125
+ COMMON_EXTERNALS_MAP,
126
+ DEFAULT_GROUPS,
127
+ DEFAULT_CATEGORIES,
128
+ STATIC_RESOURCES,
129
+ ALILC_STATIC_RESOURCES,
130
+ STATIC_RESOURCES_MAP,
131
+ BASIC_LIBRARY_VERSION,
132
+ COMPONENT_PROPS,
133
+ UNPKG_BASE_URL_MAP,
134
+ META_TYPES,
135
+ };